diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-12 16:47:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-12 16:47:03 +0000 |
commit | 947d67211183be0b9dc84b538bad0a49b67a717e (patch) | |
tree | 1ae267b43a99c4aabc765b558c4a13781e66297a | |
parent | 96e3eea4a51c7bcc464192cb86741668a0bcfc8d (diff) | |
download | libmicrohttpd-947d67211183be0b9dc84b538bad0a49b67a717e.tar.gz libmicrohttpd-947d67211183be0b9dc84b538bad0a49b67a717e.zip |
check GNUtls version
-rw-r--r-- | src/microhttpd/daemon.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 6b06c639..ba7ffd1d 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -546,13 +546,22 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon) | |||
546 | cert.data = (unsigned char *) daemon->https_mem_cert; | 546 | cert.data = (unsigned char *) daemon->https_mem_cert; |
547 | cert.size = strlen (daemon->https_mem_cert); | 547 | cert.size = strlen (daemon->https_mem_cert); |
548 | 548 | ||
549 | if (NULL != daemon->https_key_password) | 549 | if (NULL != daemon->https_key_password) { |
550 | #if GNUTLS_VERSION_MAJOR >= 3 | ||
550 | ret = gnutls_certificate_set_x509_key_mem2 (daemon->x509_cred, | 551 | ret = gnutls_certificate_set_x509_key_mem2 (daemon->x509_cred, |
551 | &cert, &key, | 552 | &cert, &key, |
552 | GNUTLS_X509_FMT_PEM, | 553 | GNUTLS_X509_FMT_PEM, |
553 | daemon->https_key_password, | 554 | daemon->https_key_password, |
554 | 0); | 555 | 0); |
555 | 556 | #else | |
557 | #if HAVE_MESSAGES | ||
558 | MHD_DLOG (daemon, | ||
559 | "Failed to setup x509 certificate/key: pre 3.X.X version " \ | ||
560 | "of GnuTLS does not support setting key password"); | ||
561 | #endif | ||
562 | return -1; | ||
563 | #endif | ||
564 | } | ||
556 | else | 565 | else |
557 | ret = gnutls_certificate_set_x509_key_mem (daemon->x509_cred, | 566 | ret = gnutls_certificate_set_x509_key_mem (daemon->x509_cred, |
558 | &cert, &key, | 567 | &cert, &key, |