summaryrefslogtreecommitdiff
path: root/package/uhttpd/src
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-06-12 12:58:11 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-06-12 12:58:11 +0000
commit585ffa49417ef3f502175a0cd8ced20cc5377955 (patch)
tree7d7707253bf517c48b6a401484c01a5cd6ed21ef /package/uhttpd/src
parentc80ad970e00d850477d654602423aaf6f9b7bc78 (diff)
downloadmtk-20170518-585ffa49417ef3f502175a0cd8ced20cc5377955.zip
mtk-20170518-585ffa49417ef3f502175a0cd8ced20cc5377955.tar.gz
mtk-20170518-585ffa49417ef3f502175a0cd8ced20cc5377955.tar.bz2
uhttpd: - fix incorrect parsing of multiple listen options (#7458) - support PEM certificates for SSL
SVN-Revision: 21762
Diffstat (limited to 'package/uhttpd/src')
-rw-r--r--package/uhttpd/src/uhttpd-tls.c14
-rw-r--r--package/uhttpd/src/uhttpd.c1
2 files changed, 13 insertions, 2 deletions
diff --git a/package/uhttpd/src/uhttpd-tls.c b/package/uhttpd/src/uhttpd-tls.c
index cb50616..26143dd 100644
--- a/package/uhttpd/src/uhttpd-tls.c
+++ b/package/uhttpd/src/uhttpd-tls.c
@@ -35,12 +35,22 @@ SSL_CTX * uh_tls_ctx_init()
int uh_tls_ctx_cert(SSL_CTX *c, const char *file)
{
- return SSL_CTX_use_certificate_file(c, file, SSL_FILETYPE_ASN1);
+ int rv;
+
+ if( (rv = SSL_CTX_use_certificate_file(c, file, SSL_FILETYPE_PEM)) < 1 )
+ rv = SSL_CTX_use_certificate_file(c, file, SSL_FILETYPE_ASN1);
+
+ return rv;
}
int uh_tls_ctx_key(SSL_CTX *c, const char *file)
{
- return SSL_CTX_use_PrivateKey_file(c, file, SSL_FILETYPE_ASN1);
+ int rv;
+
+ if( (rv = SSL_CTX_use_PrivateKey_file(c, file, SSL_FILETYPE_PEM)) < 1 )
+ rv = SSL_CTX_use_PrivateKey_file(c, file, SSL_FILETYPE_ASN1);
+
+ return rv;
}
void uh_tls_ctx_free(struct listener *l)
diff --git a/package/uhttpd/src/uhttpd.c b/package/uhttpd/src/uhttpd.c
index 152e0b4..2f77a32 100644
--- a/package/uhttpd/src/uhttpd.c
+++ b/package/uhttpd/src/uhttpd.c
@@ -550,6 +550,7 @@ int main (int argc, char **argv)
&hints, (opt == 's'), &conf
);
+ memset(bind, 0, sizeof(bind));
break;
#ifdef HAVE_TLS