aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/daemon.c')
-rw-r--r--src/daemon/daemon.c54
1 files changed, 1 insertions, 53 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 950239a6..7e3e7e3e 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of libmicrohttpd 2 This file is part of libmicrohttpd
3 (C) 2007 Daniel Pittman and Christian Grothoff 3 (C) 2007, 2008 Daniel Pittman and Christian Grothoff
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -125,55 +125,9 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
125 gnutls_datum_t key; 125 gnutls_datum_t key;
126 gnutls_datum_t cert; 126 gnutls_datum_t cert;
127 127
128 /* certificate & key loaded from file */
129 if (daemon->https_cert_path && daemon->https_key_path)
130 {
131 if (daemon->https_mem_cert || daemon->https_mem_key)
132 {
133#if HAVE_MESSAGES
134 MHD_DLOG (daemon, "You specified certificates both in memory and on disk!",
135 daemon->https_cert_path,
136 strerror(errno));
137#endif
138 return -1;
139 }
140 /* test for private key & certificate file exsitance */
141 if (access (daemon->https_cert_path, R_OK))
142 {
143#if HAVE_MESSAGES
144 MHD_DLOG (daemon, "Missing X.509 certificate file `%s': %s\n",
145 daemon->https_cert_path,
146 strerror(errno));
147#endif
148 return -1;
149 }
150
151 if (access (daemon->https_key_path, R_OK))
152 {
153#if HAVE_MESSAGES
154 MHD_DLOG (daemon, "Missing X.509 key file `%s': %s\n",
155 daemon->https_key_path,
156 strerror(errno));
157#endif
158 return -1;
159 }
160 return MHD_gnutls_certificate_set_x509_key_file (daemon->x509_cred,
161 daemon->https_cert_path,
162 daemon->https_key_path,
163 GNUTLS_X509_FMT_PEM);
164 }
165 /* certificate & key loaded from memory */ 128 /* certificate & key loaded from memory */
166 if (daemon->https_mem_cert && daemon->https_mem_key) 129 if (daemon->https_mem_cert && daemon->https_mem_key)
167 { 130 {
168 if (daemon->https_cert_path || daemon->https_key_path)
169 {
170#if HAVE_MESSAGES
171 MHD_DLOG (daemon, "You specified certificates both in memory and on disk!",
172 daemon->https_cert_path,
173 strerror(errno));
174#endif
175 return -1;
176 }
177 key.data = (unsigned char *) daemon->https_mem_key; 131 key.data = (unsigned char *) daemon->https_mem_key;
178 key.size = strlen (daemon->https_mem_key); 132 key.size = strlen (daemon->https_mem_key);
179 cert.data = (unsigned char *) daemon->https_mem_cert; 133 cert.data = (unsigned char *) daemon->https_mem_cert;
@@ -928,12 +882,6 @@ MHD_start_daemon_va (unsigned int options,
928 _set_priority (&retVal->priority_cache->protocol, 882 _set_priority (&retVal->priority_cache->protocol,
929 va_arg (ap, const int *)); 883 va_arg (ap, const int *));
930 break; 884 break;
931 case MHD_OPTION_HTTPS_KEY_PATH:
932 retVal->https_key_path = va_arg (ap, const char *);
933 break;
934 case MHD_OPTION_HTTPS_CERT_PATH:
935 retVal->https_cert_path = va_arg (ap, const char *);
936 break;
937 case MHD_OPTION_HTTPS_MEM_KEY: 885 case MHD_OPTION_HTTPS_MEM_KEY:
938 retVal->https_mem_key = va_arg (ap, const char *); 886 retVal->https_mem_key = va_arg (ap, const char *);
939 break; 887 break;