aboutsummaryrefslogtreecommitdiff
path: root/dpi/https.c
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2010-08-03 16:42:54 +0000
committercorvid <corvid@lavabit.com>2010-08-03 16:42:54 +0000
commit0bb2a1ac723693e7ef03b655e829126e2253c547 (patch)
treeae328f984297f9e8c463d2c5be752570531d8903 /dpi/https.c
parent9463b8969e39cf2d140a3f3f88c2de85a5b677d4 (diff)
Show the self-signed cert warning dialog even when no CN given.
I'm still not getting the page afterward -- wrote the request, read zero bytes -- but oh well.
Diffstat (limited to 'dpi/https.c')
-rw-r--r--dpi/https.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/dpi/https.c b/dpi/https.c
index d6a16405..c531e456 100644
--- a/dpi/https.c
+++ b/dpi/https.c
@@ -416,7 +416,7 @@ static int handle_certificate_problem(SSL * ssl_connection)
int response_number;
int ret = -1;
long st;
- char *cn, *cn_end;
+ char *cn;
char buf[4096], *d_cmd, *msg;
X509 * remote_cert;
@@ -452,19 +452,19 @@ static int handle_certificate_problem(SSL * ssl_connection)
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
/*Either self signed and untrusted*/
/*Extract CN from certificate name information*/
- if ((cn = strstr(remote_cert->name, "/CN=")) == NULL)
- break;
-
- cn += 4;
-
- if ((cn_end = strstr(cn, "/")) == NULL )
- cn_end = cn + strlen(cn);
+ if ((cn = strstr(remote_cert->name, "/CN=")) == NULL) {
+ strcpy(buf, "(no CN given)");
+ } else {
+ char *cn_end;
- strncpy(buf, cn, (size_t) (cn_end - cn));
+ cn += 4;
- /*Add terminating NULL*/
- buf[cn_end - cn] = 0;
+ if ((cn_end = strstr(cn, "/")) == NULL )
+ cn_end = cn + strlen(cn);
+ strncpy(buf, cn, (size_t) (cn_end - cn));
+ buf[cn_end - cn] = '\0';
+ }
msg = dStrconcat("The remote certificate is self-signed and "
"untrusted.\nFor address: ", buf, NULL);
d_cmd = a_Dpip_build_cmd(