Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
macks committed Jul 5, 2010
2 parents 495f919 + f7424c4 commit 1d628a4
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 27 deletions.
40 changes: 22 additions & 18 deletions html.c
Expand Up @@ -5,6 +5,9 @@


#define ATTR_CORE ATTR_ID #define ATTR_CORE ATTR_ID
#define MAXA_CORE 1 #define MAXA_CORE 1
unsigned char ALST_CORE[] = {
ATTR_CORE
};
unsigned char ALST_A[] = { unsigned char ALST_A[] = {
ATTR_NAME, ATTR_HREF, ATTR_REL, ATTR_CHARSET, ATTR_TARGET, ATTR_HSEQ, ATTR_NAME, ATTR_HREF, ATTR_REL, ATTR_CHARSET, ATTR_TARGET, ATTR_HSEQ,
ATTR_REFERER, ATTR_REFERER,
Expand Down Expand Up @@ -133,8 +136,8 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"h", ALST_P, MAXA_P, 0}, /* 3 HTML_H */ {"h", ALST_P, MAXA_P, 0}, /* 3 HTML_H */
{"/h", NULL, 0, TFLG_END}, /* 4 HTML_N_H */ {"/h", NULL, 0, TFLG_END}, /* 4 HTML_N_H */
{"p", ALST_P, MAXA_P, 0}, /* 5 HTML_P */ {"p", ALST_P, MAXA_P, 0}, /* 5 HTML_P */
{"br", NULL, 0, 0}, /* 6 HTML_BR */ {"br", ALST_CORE, MAXA_CORE, 0}, /* 6 HTML_BR */
{"b", NULL, 0, 0}, /* 7 HTML_B */ {"b", ALST_CORE, MAXA_CORE, 0}, /* 7 HTML_B */
{"/b", NULL, 0, TFLG_END}, /* 8 HTML_N_B */ {"/b", NULL, 0, TFLG_END}, /* 8 HTML_N_B */
{"ul", ALST_UL, MAXA_UL, 0}, /* 9 HTML_UL */ {"ul", ALST_UL, MAXA_UL, 0}, /* 9 HTML_UL */
{"/ul", NULL, 0, TFLG_END}, /* 10 HTML_N_UL */ {"/ul", NULL, 0, TFLG_END}, /* 10 HTML_N_UL */
Expand All @@ -153,7 +156,7 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"blockquote", ALST_NOP, MAXA_NOP, 0}, /* 23 HTML_BLQ */ {"blockquote", ALST_NOP, MAXA_NOP, 0}, /* 23 HTML_BLQ */
{"/blockquote", NULL, 0, TFLG_END}, /* 24 HTML_N_BLQ */ {"/blockquote", NULL, 0, TFLG_END}, /* 24 HTML_N_BLQ */
{"img", ALST_IMG, MAXA_IMG, 0}, /* 25 HTML_IMG */ {"img", ALST_IMG, MAXA_IMG, 0}, /* 25 HTML_IMG */
{"listing", NULL, 0, 0}, /* 26 HTML_LISTING */ {"listing", ALST_CORE, MAXA_CORE, 0}, /* 26 HTML_LISTING */
{"/listing", NULL, 0, TFLG_END}, /* 27 HTML_N_LISTING */ {"/listing", NULL, 0, TFLG_END}, /* 27 HTML_N_LISTING */
{"xmp", NULL, 0, 0}, /* 28 HTML_XMP */ {"xmp", NULL, 0, 0}, /* 28 HTML_XMP */
{"/xmp", NULL, 0, TFLG_END}, /* 29 HTML_N_XMP */ {"/xmp", NULL, 0, TFLG_END}, /* 29 HTML_N_XMP */
Expand All @@ -165,9 +168,9 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"frame", ALST_FRAME, MAXA_FRAME, 0}, /* 35 HTML_FRAME */ {"frame", ALST_FRAME, MAXA_FRAME, 0}, /* 35 HTML_FRAME */
{"frameset", ALST_FRAMESET, MAXA_FRAMESET, 0}, /* 36 HTML_FRAMESET */ {"frameset", ALST_FRAMESET, MAXA_FRAMESET, 0}, /* 36 HTML_FRAMESET */
{"/frameset", NULL, 0, TFLG_END}, /* 37 HTML_N_FRAMESET */ {"/frameset", NULL, 0, TFLG_END}, /* 37 HTML_N_FRAMESET */
{"center", NULL, 0, 0}, /* 38 HTML_CENTER */ {"center", ALST_CORE, MAXA_CORE, 0}, /* 38 HTML_CENTER */
{"/center", NULL, 0, TFLG_END}, /* 39 HTML_N_CENTER */ {"/center", NULL, 0, TFLG_END}, /* 39 HTML_N_CENTER */
{"font", NULL, 0, 0}, /* 40 HTML_FONT */ {"font", ALST_CORE, MAXA_CORE, 0}, /* 40 HTML_FONT */
{"/font", NULL, 0, TFLG_END}, /* 41 HTML_N_FONT */ {"/font", NULL, 0, TFLG_END}, /* 41 HTML_N_FONT */
{"form", ALST_FORM, MAXA_FORM, 0}, /* 42 HTML_FORM */ {"form", ALST_FORM, MAXA_FORM, 0}, /* 42 HTML_FORM */
{"/form", NULL, 0, TFLG_END}, /* 43 HTML_N_FORM */ {"/form", NULL, 0, TFLG_END}, /* 43 HTML_N_FORM */
Expand All @@ -177,7 +180,7 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"select", ALST_SELECT, MAXA_SELECT, 0}, /* 47 HTML_SELECT */ {"select", ALST_SELECT, MAXA_SELECT, 0}, /* 47 HTML_SELECT */
{"/select", NULL, 0, TFLG_END}, /* 48 HTML_N_SELECT */ {"/select", NULL, 0, TFLG_END}, /* 48 HTML_N_SELECT */
{"option", ALST_OPTION, MAXA_OPTION, 0}, /* 49 HTML_OPTION */ {"option", ALST_OPTION, MAXA_OPTION, 0}, /* 49 HTML_OPTION */
{"nobr", NULL, 0, 0}, /* 50 HTML_NOBR */ {"nobr", ALST_CORE, MAXA_CORE, 0}, /* 50 HTML_NOBR */
{"/nobr", NULL, 0, TFLG_END}, /* 51 HTML_N_NOBR */ {"/nobr", NULL, 0, TFLG_END}, /* 51 HTML_N_NOBR */
{"div", ALST_P, MAXA_P, 0}, /* 52 HTML_DIV */ {"div", ALST_P, MAXA_P, 0}, /* 52 HTML_DIV */
{"/div", NULL, 0, TFLG_END}, /* 53 HTML_N_DIV */ {"/div", NULL, 0, TFLG_END}, /* 53 HTML_N_DIV */
Expand All @@ -188,16 +191,16 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"script", NULL, 0, 0}, /* 58 HTML_SCRIPT */ {"script", NULL, 0, 0}, /* 58 HTML_SCRIPT */
{"/script", NULL, 0, TFLG_END}, /* 59 HTML_N_SCRIPT */ {"/script", NULL, 0, TFLG_END}, /* 59 HTML_N_SCRIPT */
{"base", ALST_BASE, MAXA_BASE, 0}, /* 60 HTML_BASE */ {"base", ALST_BASE, MAXA_BASE, 0}, /* 60 HTML_BASE */
{"del", NULL, 0, 0}, /* 61 HTML_DEL */ {"del", ALST_CORE, MAXA_CORE, 0}, /* 61 HTML_DEL */
{"/del", NULL, 0, TFLG_END}, /* 62 HTML_N_DEL */ {"/del", NULL, 0, TFLG_END}, /* 62 HTML_N_DEL */
{"ins", NULL, 0, 0}, /* 63 HTML_INS */ {"ins", ALST_CORE, MAXA_CORE, 0}, /* 63 HTML_INS */
{"/ins", NULL, 0, TFLG_END}, /* 64 HTML_N_INS */ {"/ins", NULL, 0, TFLG_END}, /* 64 HTML_N_INS */
{"u", NULL, 0, 0}, /* 65 HTML_U */ {"u", ALST_CORE, MAXA_CORE, 0}, /* 65 HTML_U */
{"/u", NULL, 0, TFLG_END}, /* 66 HTML_N_U */ {"/u", NULL, 0, TFLG_END}, /* 66 HTML_N_U */
{"style", NULL, 0, 0}, /* 67 HTML_STYLE */ {"style", NULL, 0, 0}, /* 67 HTML_STYLE */
{"/style", NULL, 0, TFLG_END}, /* 68 HTML_N_STYLE */ {"/style", NULL, 0, TFLG_END}, /* 68 HTML_N_STYLE */
{"wbr", NULL, 0, 0}, /* 69 HTML_WBR */ {"wbr", NULL, 0, 0}, /* 69 HTML_WBR */
{"em", NULL, 0, 0}, /* 70 HTML_EM */ {"em", ALST_CORE, MAXA_CORE, 0}, /* 70 HTML_EM */
{"/em", NULL, 0, TFLG_END}, /* 71 HTML_N_EM */ {"/em", NULL, 0, TFLG_END}, /* 71 HTML_N_EM */
{"body", ALST_BODY, MAXA_BODY, 0}, /* 72 HTML_BODY */ {"body", ALST_BODY, MAXA_BODY, 0}, /* 72 HTML_BODY */
{"/body", NULL, 0, TFLG_END}, /* 73 HTML_N_BODY */ {"/body", NULL, 0, TFLG_END}, /* 73 HTML_N_BODY */
Expand Down Expand Up @@ -228,25 +231,26 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"noframes", ALST_NOFRAMES, MAXA_NOFRAMES, 0}, /* 98 HTML_NOFRAMES */ {"noframes", ALST_NOFRAMES, MAXA_NOFRAMES, 0}, /* 98 HTML_NOFRAMES */
{"/noframes", NULL, 0, TFLG_END}, /* 99 HTML_N_NOFRAMES */ {"/noframes", NULL, 0, TFLG_END}, /* 99 HTML_N_NOFRAMES */


{"sup", NULL, 0, 0}, /* 100 HTML_SUP */ {"sup", ALST_CORE, MAXA_CORE, 0}, /* 100 HTML_SUP */
{"/sup", NULL, 0, 0}, /* 101 HTML_N_SUP */ {"/sup", NULL, 0, 0}, /* 101 HTML_N_SUP */
{"sub", NULL, 0, 0}, /* 102 HTML_SUB */ /* FIXME: Should /sup and /sub have TFLG_END ? */
{"sub", ALST_CORE, MAXA_CORE, 0}, /* 102 HTML_SUB */
{"/sub", NULL, 0, 0}, /* 103 HTML_N_SUB */ {"/sub", NULL, 0, 0}, /* 103 HTML_N_SUB */
{"link", ALST_LINK, MAXA_LINK, 0}, /* 104 HTML_LINK */ {"link", ALST_LINK, MAXA_LINK, 0}, /* 104 HTML_LINK */
{"s", NULL, 0, 0}, /* 105 HTML_S */ {"s", ALST_CORE, MAXA_CORE, 0}, /* 105 HTML_S */
{"/s", NULL, 0, TFLG_END}, /* 106 HTML_N_S */ {"/s", NULL, 0, TFLG_END}, /* 106 HTML_N_S */
{"q", NULL, 0, 0}, /* 107 HTML_Q */ {"q", ALST_CORE, MAXA_CORE, 0}, /* 107 HTML_Q */
{"/q", NULL, 0, TFLG_END}, /* 108 HTML_N_Q */ {"/q", NULL, 0, TFLG_END}, /* 108 HTML_N_Q */
{"i", NULL, 0, 0}, /* 109 HTML_I */ {"i", ALST_CORE, MAXA_CORE, 0}, /* 109 HTML_I */
{"/i", NULL, 0, TFLG_END}, /* 110 HTML_N_I */ {"/i", NULL, 0, TFLG_END}, /* 110 HTML_N_I */
{"strong", NULL, 0, 0}, /* 111 HTML_STRONG */ {"strong", ALST_CORE, MAXA_CORE, 0}, /* 111 HTML_STRONG */
{"/strong", NULL, 0, TFLG_END}, /* 112 HTML_N_STRONG */ {"/strong", NULL, 0, TFLG_END}, /* 112 HTML_N_STRONG */
{"iframe", ALST_IFRAME, MAXA_IFRAME, 0}, /* 113 HTML_IFRAME */ {"iframe", ALST_IFRAME, MAXA_IFRAME, 0}, /* 113 HTML_IFRAME */
{"/iframe", NULL, 0, TFLG_END}, /* 114 HTML_N_IFRAME */ {"/iframe", NULL, 0, TFLG_END}, /* 114 HTML_N_IFRAME */
{"button", ALST_BUTTON, MAXA_BUTTON, 0}, /* 115 HTML_BUTTON */ {"button", ALST_BUTTON, MAXA_BUTTON, 0}, /* 115 HTML_BUTTON */
{"/button", NULL, 0, TFLG_END}, /* 116 HTML_N_BUTTON */ {"/button", NULL, 0, TFLG_END}, /* 116 HTML_N_BUTTON */
{NULL, NULL, 0, 0}, /* 117 Undefined */ {"span", ALST_CORE, MAXA_CORE, 0}, /* 117 HTML_SPAN */
{NULL, NULL, 0, 0}, /* 118 Undefined */ {"/span", NULL, 0, TFLG_END}, /* 118 HTML_N_SPAN */
{NULL, NULL, 0, 0}, /* 119 Undefined */ {NULL, NULL, 0, 0}, /* 119 Undefined */


/* pseudo tag */ /* pseudo tag */
Expand Down
2 changes: 2 additions & 0 deletions html.h
Expand Up @@ -206,6 +206,8 @@ typedef struct {
#define HTML_N_IFRAME 114 #define HTML_N_IFRAME 114
#define HTML_BUTTON 115 #define HTML_BUTTON 115
#define HTML_N_BUTTON 116 #define HTML_N_BUTTON 116
#define HTML_SPAN 117
#define HTML_N_SPAN 118


/* pseudo tag */ /* pseudo tag */
#define HTML_SELECT_INT 120 #define HTML_SELECT_INT 120
Expand Down
28 changes: 24 additions & 4 deletions istream.c
Expand Up @@ -447,8 +447,17 @@ ssl_check_cert_ident(X509 * x, char *hostname)


if (!seen_dnsname) if (!seen_dnsname)
seen_dnsname = Strnew(); seen_dnsname = Strnew();
/* replace \0 to make full string visible to user */
if (sl != strlen(sn)) {
int i;
for (i = 0; i < sl; ++i) {
if (!sn[i])
sn[i] = '!';
}
}
Strcat_m_charp(seen_dnsname, sn, " ", NULL); Strcat_m_charp(seen_dnsname, sn, " ", NULL);
if (ssl_match_cert_ident(sn, sl, hostname)) if (sl == strlen(sn) /* catch \0 in SAN */
&& ssl_match_cert_ident(sn, sl, hostname))
break; break;
} }
} }
Expand All @@ -466,16 +475,27 @@ ssl_check_cert_ident(X509 * x, char *hostname)
if (match_ident == FALSE && ret == NULL) { if (match_ident == FALSE && ret == NULL) {
X509_NAME *xn; X509_NAME *xn;
char buf[2048]; char buf[2048];
int slen;


xn = X509_get_subject_name(x); xn = X509_get_subject_name(x);


if (X509_NAME_get_text_by_NID(xn, NID_commonName, slen = X509_NAME_get_text_by_NID(xn, NID_commonName, buf, sizeof(buf));
buf, sizeof(buf)) == -1) if ( slen == -1)
/* FIXME: gettextize? */ /* FIXME: gettextize? */
ret = Strnew_charp("Unable to get common name from peer cert"); ret = Strnew_charp("Unable to get common name from peer cert");
else if (!ssl_match_cert_ident(buf, strlen(buf), hostname)) else if (slen != strlen(buf)
|| !ssl_match_cert_ident(buf, strlen(buf), hostname)) {
/* replace \0 to make full string visible to user */
if (slen != strlen(buf)) {
int i;
for (i = 0; i < slen; ++i) {
if (!buf[i])
buf[i] = '!';
}
}
/* FIXME: gettextize? */ /* FIXME: gettextize? */
ret = Sprintf("Bad cert ident %s from %s", buf, hostname); ret = Sprintf("Bad cert ident %s from %s", buf, hostname);
}
else else
match_ident = TRUE; match_ident = TRUE;
} }
Expand Down
10 changes: 5 additions & 5 deletions scripts/w3mman/w3mman2html.cgi.in 100644 → 100755
Expand Up @@ -32,15 +32,15 @@ Content-Type: text/html
<h2>man -k <b>$k</b></h2> <h2>man -k <b>$k</b></h2>
<ul> <ul>
EOF EOF
$keyword =~ s:([^-\w\200-\377.,])::g; $keyword =~ s:([^-\w\200-\377.,\:])::g;
open(F, "$MAN -k $keyword 2> /dev/null |"); open(F, "$MAN -k $keyword 2> /dev/null |");
@line = (); @line = ();
while(<F>) { while(<F>) {
chop; chop;
$_ = &html_quote($_); $_ = &html_quote($_);
s/(\s+-.*)$//; s/(\s+-.*)$//;
$title = $1; $title = $1;
s@(\w[\w.\-]*(\s*\,\s*\w[\w.\-]*)*)\s*(\([\dn]\w*\))@&keyword_ref($1, $3)@ge; s@(\w[\w.:\-]*(\s*\,\s*\w[\w.:\-]*)*)\s*(\([\dn]\w*\))@&keyword_ref($1, $3)@ge;
print "<li>$_$title\n"; print "<li>$_$title\n";
} }
close(F); close(F);
Expand Down Expand Up @@ -90,8 +90,8 @@ if ($query{"local"}) {
$man_section = "$man"; $man_section = "$man";
} }


$section =~ s:([^-\w\200-\377.,])::g; $section =~ s:([^-\w\200-\377.,\:])::g;
$man =~ s:([^-\w\200-\377.,])::g; $man =~ s:([^-\w\200-\377.,\:])::g;
open(F, "$MAN $section $man 2> /dev/null |"); open(F, "$MAN $section $man 2> /dev/null |");
} }
$ok = 0; $ok = 0;
Expand Down Expand Up @@ -161,7 +161,7 @@ EOF
s@(include(<\/?[bu]\>|\s)*\&lt;)([\w.\-/]+)@$1 . &include_ref($3)@ge; s@(include(<\/?[bu]\>|\s)*\&lt;)([\w.\-/]+)@$1 . &include_ref($3)@ge;
if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\</[bu]\>)*(\([\dm]\w*\))@) { if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\</[bu]\>)*(\([\dm]\w*\))@) {
$cmd .= "$2$4"; $cmd .= "$2$4";
$prev =~ s@(\w[\w.\-]*-)((\</[bu]\>)*\s*)$@<a href="$CGI?$cmd">$1</a>$2@; $prev =~ s@(\w[\w.:\-]*-)((\</[bu]\>)*\s*)$@<a href="$CGI?$cmd">$1</a>$2@;
print $prev; print $prev;
$prev = ''; $prev = '';
s@^(\s*(\<[bu]\>)*)(\w[\w.\-]*)@@; s@^(\s*(\<[bu]\>)*)(\w[\w.\-]*)@@;
Expand Down
2 changes: 2 additions & 0 deletions tagtable.tab
Expand Up @@ -60,6 +60,8 @@ kbd HTML_NOP
/kbd HTML_NOP /kbd HTML_NOP
samp HTML_NOP samp HTML_NOP
/samp HTML_NOP /samp HTML_NOP
span HTML_SPAN
/span HTML_N_SPAN
strong HTML_STRONG strong HTML_STRONG
/strong HTML_N_STRONG /strong HTML_N_STRONG
var HTML_NOP var HTML_NOP
Expand Down

0 comments on commit 1d628a4

Please sign in to comment.