w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 421dd5b74099a85a0143d903481d1818640d494c
parent 82e47063f088ff25313eb88ab803ecfc163f7984
Author: ukai <ukai>
Date:   Thu, 27 Dec 2001 18:22:59 +0000

[w3m-dev 02772]
From: Fumitoshi UKAI <ukai@debian.or.jp>

Diffstat:
MChangeLog | 6++++++
Mbackend.c | 4++--
Mform.c | 2+-
Mistream.c | 18++++++++++++++++--
Mmain.c | 5+----
Murl.c | 5++++-
6 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -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> diff --git a/backend.c b/backend.c @@ -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 { diff --git a/form.c b/form.c @@ -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++; } diff --git a/istream.c b/istream.c @@ -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; diff --git a/main.c b/main.c @@ -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 { diff --git a/url.c b/url.c @@ -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);