mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-22 11:36:21 +00:00
Fixed cert emptiness check
This commit is contained in:
1 parent
be40827e17
commit
393c811f31
2 files changed
+4
-4
No files matched your search
+2
-2
@@ -19602,7 +19602,7 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
||||
if (!c->is_client) tls->is_twoway = true; // server + CA: two-way auth
|
||||
}
|
||||
|
||||
if (opts->cert.buf == NULL) {
|
||||
if (opts->cert.buf == NULL || opts->cert.len == 0) {
|
||||
MG_VERBOSE(("No certificate provided"));
|
||||
goto xit;
|
||||
}
|
||||
@@ -19631,7 +19631,7 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
||||
}
|
||||
|
||||
// parse PEM or DER EC key
|
||||
if (opts->key.buf == NULL) {
|
||||
if (opts->key.buf == NULL || opts->key.len == 0) {
|
||||
mg_error(c, "Certificate provided without a private key");
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-2
@@ -2733,7 +2733,7 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
||||
if (!c->is_client) tls->is_twoway = true; // server + CA: two-way auth
|
||||
}
|
||||
|
||||
if (opts->cert.buf == NULL) {
|
||||
if (opts->cert.buf == NULL || opts->cert.len == 0) {
|
||||
MG_VERBOSE(("No certificate provided"));
|
||||
goto xit;
|
||||
}
|
||||
@@ -2762,7 +2762,7 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
||||
}
|
||||
|
||||
// parse PEM or DER EC key
|
||||
if (opts->key.buf == NULL) {
|
||||
if (opts->key.buf == NULL || opts->key.len == 0) {
|
||||
mg_error(c, "Certificate provided without a private key");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user