[w3m-dev 02772]

From: Fumitoshi UKAI <ukai@debian.or.jp>
This commit is contained in:
Fumitoshi UKAI
2001-12-27 18:22:59 +00:00
parent 0fb25226f1
commit 44ca7f4423
6 changed files with 36 additions and 16 deletions
+7 -1
View File
@@ -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> 2001-12-28 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 02770] form element outside <form>..</form> * [w3m-dev 02770] form element outside <form>..</form>
@@ -1748,4 +1754,4 @@
* release-0-2-1 * release-0-2-1
* import w3m-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 $
+3 -3
View File
@@ -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 <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
@@ -146,7 +146,7 @@ internal_get(char *url, int flag, FormList *request)
Str first, last; Str first, last;
int len = 0; int len = 0;
for (p = backend_halfdump_buf->first; p; p = p->next) 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"); first = Strnew_charp("<pre>\n");
last = Strnew_m_charp("</pre><title>", html_quote(buf->buffername), last = Strnew_m_charp("</pre><title>", html_quote(buf->buffername),
"</title>\n", NULL); "</title>\n", NULL);
@@ -162,7 +162,7 @@ internal_get(char *url, int flag, FormList *request)
printf("\n"); printf("\n");
printf("%s", first->ptr); printf("%s", first->ptr);
for (p = backend_halfdump_buf->first; p; p = p->next) 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); printf("%s", last->ptr);
} }
else { else {
+2 -2
View File
@@ -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 * HTML forms
*/ */
@@ -359,7 +359,7 @@ formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)
} }
} }
if (rows > 1) { if (rows > 1) {
if (! FoldTextarea) { if (!FoldTextarea) {
while (p[j] && p[j] != '\r' && p[j] != '\n') while (p[j] && p[j] != '\r' && p[j] != '\n')
j++; j++;
} }
+17 -3
View File
@@ -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 "fm.h"
#include "istream.h" #include "istream.h"
#include <signal.h> #include <signal.h>
@@ -370,9 +370,12 @@ ssl_get_certificate(InputStream stream)
{ {
BIO *bp; BIO *bp;
X509 *x; X509 *x;
X509_NAME *xn;
char *p; char *p;
int len; int len;
Str s; Str s;
char buf[2048];
if (stream == NULL) if (stream == NULL)
return NULL; return NULL;
if (IStype(stream) != IST_SSL) if (IStype(stream) != IST_SSL)
@@ -381,13 +384,24 @@ ssl_get_certificate(InputStream stream)
return NULL; return NULL;
x = SSL_get_peer_certificate(stream->ssl.handle->ssl); x = SSL_get_peer_certificate(stream->ssl.handle->ssl);
if (x == NULL) if (x == NULL)
return NULL; return Strnew_charp("no peer certificate");
bp = BIO_new(BIO_s_mem()); bp = BIO_new(BIO_s_mem());
X509_print(bp, x); X509_print(bp, x);
len = (int)BIO_ctrl(bp, BIO_CTRL_INFO, 0, (char *)&p); len = (int)BIO_ctrl(bp, BIO_CTRL_INFO, 0, (char *)&p);
s = ssl_certificate_validity ? Strdup(ssl_certificate_validity) s = ssl_certificate_validity ? Strdup(ssl_certificate_validity)
: Strnew_charp("valid certificate"); : Strnew_charp("valid certificate");
Strcat_charp(s, "\n"); 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); Strcat_charp_n(s, p, len);
BIO_free_all(bp); BIO_free_all(bp);
X509_free(x); X509_free(x);
@@ -444,7 +458,7 @@ ssl_check_cert_ident(SSL * handle, char *hostname)
if (!seen_dnsname) if (!seen_dnsname)
seen_dnsname = Strnew(); seen_dnsname = Strnew();
Strcat_m_charp(seen_dnsname, sn, " "); Strcat_m_charp(seen_dnsname, sn, " ", NULL);
/* Is this an exact match? */ /* Is this an exact match? */
if ((len1 == sl) && !strncasecmp(hostname, sn, len1)) if ((len1 == sl) && !strncasecmp(hostname, sn, len1))
break; break;
+2 -5
View File
@@ -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 #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -3020,10 +3020,7 @@ _followForm(int submit)
buf->form_submit = save_submit_formlist(fi); buf->form_submit = save_submit_formlist(fi);
} }
} }
else if ((fi->parent->method == FORM_METHOD_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 */
(!Strcmp_charp(fi->parent->action, "map") ||
!Strcmp_charp(fi->parent->action, "none"))) ||
Currentbuf->bufferprop & BP_INTERNAL) { /* internal */
do_internal(tmp2->ptr, tmp->ptr); do_internal(tmp2->ptr, tmp->ptr);
} }
else { else {
+5 -2
View File
@@ -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 "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -275,7 +275,7 @@ init_PRNG()
static SSL * static SSL *
openSSLHandle(int sock, char *hostname) openSSLHandle(int sock, char *hostname)
{ {
SSL *handle; SSL *handle = NULL;
Str emsg; Str emsg;
Str amsg = NULL; Str amsg = NULL;
char *ans; char *ans;
@@ -456,6 +456,9 @@ openSSLHandle(int sock, char *hostname)
accept_this_site = Strnew_charp(hostname); accept_this_site = Strnew_charp(hostname);
return handle; return handle;
eend: eend:
close(sock);
if (handle)
SSL_free(handle);
accept_this_site = NULL; accept_this_site = NULL;
emsg = Sprintf("SSL error: %s", ERR_error_string(ERR_get_error(), NULL)); emsg = Sprintf("SSL error: %s", ERR_error_string(ERR_get_error(), NULL));
disp_err_message(emsg->ptr, FALSE); disp_err_message(emsg->ptr, FALSE);