diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | backend.c | 6 | ||||
-rw-r--r-- | form.c | 4 | ||||
-rw-r--r-- | istream.c | 20 | ||||
-rw-r--r-- | main.c | 7 | ||||
-rw-r--r-- | url.c | 7 |
6 files changed, 36 insertions, 16 deletions
@@ -1,3 +1,9 @@ +2001-12-28 Fumitoshi UKAI <ukai@debian.or.jp> + + * istream.c (ssl_get_certificate): show certificate subject and issuer + * istream.c (ssl_check_cert_ident): add missing NULL for Strcat_m_charp + * url.c (openSSLHandle): close(sock) and SSL_free(handle) on failure + 2001-12-28 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> * [w3m-dev 02770] form element outside <form>..</form> @@ -1748,4 +1754,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.194 2001/12/27 18:01:52 ukai Exp $ +$Id: ChangeLog,v 1.195 2001/12/27 18:22:59 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: backend.c,v 1.6 2001/12/27 17:50:56 ukai Exp $ */ +/* $Id: backend.c,v 1.7 2001/12/27 18:22:59 ukai Exp $ */ #include <stdio.h> #include <string.h> #include <sys/types.h> @@ -146,7 +146,7 @@ internal_get(char *url, int flag, FormList *request) Str first, last; int len = 0; for (p = backend_halfdump_buf->first; p; p = p->next) - len += p->ptr->line->length + 1; + len += p->ptr->line->length + 1; first = Strnew_charp("<pre>\n"); last = Strnew_m_charp("</pre><title>", html_quote(buf->buffername), "</title>\n", NULL); @@ -162,7 +162,7 @@ internal_get(char *url, int flag, FormList *request) printf("\n"); printf("%s", first->ptr); for (p = backend_halfdump_buf->first; p; p = p->next) - printf("%s\n", p->ptr->line->ptr); + printf("%s\n", p->ptr->line->ptr); printf("%s", last->ptr); } else { @@ -1,4 +1,4 @@ -/* $Id: form.c,v 1.10 2001/12/27 18:01:52 ukai Exp $ */ +/* $Id: form.c,v 1.11 2001/12/27 18:22:59 ukai Exp $ */ /* * HTML forms */ @@ -359,7 +359,7 @@ formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form) } } if (rows > 1) { - if (! FoldTextarea) { + if (!FoldTextarea) { while (p[j] && p[j] != '\r' && p[j] != '\n') j++; } @@ -1,4 +1,4 @@ -/* $Id: istream.c,v 1.9 2001/12/26 18:46:33 ukai Exp $ */ +/* $Id: istream.c,v 1.10 2001/12/27 18:22:59 ukai Exp $ */ #include "fm.h" #include "istream.h" #include <signal.h> @@ -370,9 +370,12 @@ ssl_get_certificate(InputStream stream) { BIO *bp; X509 *x; + X509_NAME *xn; char *p; int len; Str s; + char buf[2048]; + if (stream == NULL) return NULL; if (IStype(stream) != IST_SSL) @@ -381,13 +384,24 @@ ssl_get_certificate(InputStream stream) return NULL; x = SSL_get_peer_certificate(stream->ssl.handle->ssl); if (x == NULL) - return NULL; + return Strnew_charp("no peer certificate"); bp = BIO_new(BIO_s_mem()); X509_print(bp, x); len = (int)BIO_ctrl(bp, BIO_CTRL_INFO, 0, (char *)&p); s = ssl_certificate_validity ? Strdup(ssl_certificate_validity) : Strnew_charp("valid certificate"); Strcat_charp(s, "\n"); + xn = X509_get_subject_name(x); + if (X509_NAME_get_text_by_NID(xn, NID_commonName, buf, sizeof(buf)) == -1) + Strcat_charp(s, " subject=<unknown>"); + else + Strcat_m_charp(s, " subject=", buf, NULL); + xn = X509_get_issuer_name(x); + if (X509_NAME_get_text_by_NID(xn, NID_commonName, buf, sizeof(buf)) == -1) + Strcat_charp(s, ": issuer=<unnown>"); + else + Strcat_m_charp(s, ": issuer=", buf, NULL); + Strcat_charp(s, "\n\n"); Strcat_charp_n(s, p, len); BIO_free_all(bp); X509_free(x); @@ -444,7 +458,7 @@ ssl_check_cert_ident(SSL * handle, char *hostname) if (!seen_dnsname) seen_dnsname = Strnew(); - Strcat_m_charp(seen_dnsname, sn, " "); + Strcat_m_charp(seen_dnsname, sn, " ", NULL); /* Is this an exact match? */ if ((len1 == sl) && !strncasecmp(hostname, sn, len1)) break; @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.53 2001/12/27 18:01:52 ukai Exp $ */ +/* $Id: main.c,v 1.54 2001/12/27 18:22:59 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -3020,10 +3020,7 @@ _followForm(int submit) buf->form_submit = save_submit_formlist(fi); } } - else if ((fi->parent->method == FORM_METHOD_INTERNAL && - (!Strcmp_charp(fi->parent->action, "map") || - !Strcmp_charp(fi->parent->action, "none"))) || - Currentbuf->bufferprop & BP_INTERNAL) { /* internal */ + else if ((fi->parent->method == FORM_METHOD_INTERNAL && (!Strcmp_charp(fi->parent->action, "map") || !Strcmp_charp(fi->parent->action, "none"))) || Currentbuf->bufferprop & BP_INTERNAL) { /* internal */ do_internal(tmp2->ptr, tmp->ptr); } else { @@ -1,4 +1,4 @@ -/* $Id: url.c,v 1.27 2001/12/27 02:32:08 ukai Exp $ */ +/* $Id: url.c,v 1.28 2001/12/27 18:22:59 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include <sys/socket.h> @@ -275,7 +275,7 @@ init_PRNG() static SSL * openSSLHandle(int sock, char *hostname) { - SSL *handle; + SSL *handle = NULL; Str emsg; Str amsg = NULL; char *ans; @@ -456,6 +456,9 @@ openSSLHandle(int sock, char *hostname) accept_this_site = Strnew_charp(hostname); return handle; eend: + close(sock); + if (handle) + SSL_free(handle); accept_this_site = NULL; emsg = Sprintf("SSL error: %s", ERR_error_string(ERR_get_error(), NULL)); disp_err_message(emsg->ptr, FALSE); |