diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-01-30 15:08:48 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-01-30 15:08:48 +0000 |
commit | 05af6d32e67e92f4bcc21c337acf66c7eb05a3cd (patch) | |
tree | 2859704dfe87fb59093590dab50bc2cc24a1dfee | |
parent | [w3m-dev 02931] use POST in multipart.cgi (diff) | |
download | w3m-05af6d32e67e92f4bcc21c337acf66c7eb05a3cd.tar.gz w3m-05af6d32e67e92f4bcc21c337acf66c7eb05a3cd.zip |
[w3m-dev 02933] segmentation fault when w3m -dump https:
* file.c (readHeader): use inputAnswer()
* file.c (getAuthCookie): remove term_cbreak()
* file.c (checkOverWrite): use inputAnswer()
* file.c (inputAnswer): added
* istream.c (ssl_get_certificate): use inputAnswer()
* main.c (qquitfm): change prompt
* proto.h (inputAnswer): added
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | file.c | 51 | ||||
-rw-r--r-- | istream.c | 23 | ||||
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | proto.h | 3 |
5 files changed, 57 insertions, 39 deletions
@@ -1,3 +1,14 @@ +2002-01-31 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 02933] segmentation fault when w3m -dump https: + * file.c (readHeader): use inputAnswer() + * file.c (getAuthCookie): remove term_cbreak() + * file.c (checkOverWrite): use inputAnswer() + * file.c (inputAnswer): added + * istream.c (ssl_get_certificate): use inputAnswer() + * main.c (qquitfm): change prompt + * proto.h (inputAnswer): added + 2002-01-30 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> * [w3m-dev 02931] use POST in multipart.cgi @@ -2410,4 +2421,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.276 2002/01/30 04:42:38 ukai Exp $ +$Id: ChangeLog,v 1.277 2002/01/30 15:08:48 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.50 2002/01/30 04:25:02 ukai Exp $ */ +/* $Id: file.c,v 1.51 2002/01/30 15:08:48 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -731,16 +731,14 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) ? "y" : NULL; if (fmInitialized && (err & COO_OVERRIDE_OK) && accept_bad_cookie == ACCEPT_BAD_COOKIE_ASK) { - Str msg = - Sprintf - ("Accept bad cookie from %s for %s? (y or n) ", - pu->host, - domain - && domain->ptr ? domain->ptr : "<localdomain>"); - if (msg->length > COLS - 4) - Strshrink(msg, msg->length - (COLS - 4)); - term_raw(); - ans = inputChar(msg->ptr); + Str msg = Sprintf("Accept bad cookie from %s for %s?", + pu->host, + ((domain && domain->ptr) + ? domain->ptr : "<localdomain>")); + if (msg->length > COLS - 10) + Strshrink(msg, msg->length - (COLS - 10)); + Strcat_charp(msg, " (y/n)"); + ans = inputAnswer(msg->ptr); } if (ans == NULL || tolower(*ans) != 'y' || (err = @@ -1222,7 +1220,6 @@ getAuthCookie(struct http_auth *hauth, char *auth_header, IN_PASSWORD)) == NULL) return NULL; pwd = Str_conv_to_system(Strnew_charp(pp)); - term_cbreak(); } else { int proxy = !strncasecmp("Proxy-Authorization:", auth_header, @@ -6393,22 +6390,34 @@ int checkOverWrite(char *path) { struct stat st; - char buf[2]; - char *ans = NULL; + char *ans; if (stat(path, &st) < 0) return 0; + ans = inputAnswer("File exists. Overwrite? (y/n)"); + if (ans && tolower(*ans) == 'y') + return 0; + else + return -1; +} + +char * +inputAnswer(char *prompt) +{ + char *ans; + char buf[2]; + if (fmInitialized) { - ans = inputChar("File exists. Overwrite? (y or n)"); + term_raw(); + ans = inputChar(prompt); } else { - printf("File exists. Overwrite? (y or n)"); - ans = fgets(buf, 2, stdin); + printf(prompt); + fflush(stdout); + fgets(buf, 2, stdin); + ans = allocStr(buf, 1); } - if (ans != NULL && (*ans == '\0' || tolower(*ans) == 'y')) - return 0; - else - return -1; + return ans; } static void @@ -1,4 +1,4 @@ -/* $Id: istream.c,v 1.11 2002/01/12 13:33:47 ukai Exp $ */ +/* $Id: istream.c,v 1.12 2002/01/30 15:08:48 ukai Exp $ */ #include "fm.h" #include "istream.h" #include <signal.h> @@ -476,11 +476,10 @@ ssl_get_certificate(InputStream stream, char *hostname) && strcasecmp(accept_this_site->ptr, hostname) == 0) ans = "y"; else { - emsg = Strnew_charp("No SSL peer certificate: accept (y/n)?"); - term_raw(); - ans = inputChar(emsg->ptr); + emsg = Strnew_charp("No SSL peer certificate: accept? (y/n)"); + ans = inputAnswer(emsg->ptr); } - if (tolower(*ans) == 'y') + if (ans && tolower(*ans) == 'y') amsg = Strnew_charp ("Accept SSL session without any peer certificate"); else { @@ -510,11 +509,10 @@ ssl_get_certificate(InputStream stream, char *hostname) && strcasecmp(accept_this_site->ptr, hostname) == 0) ans = "y"; else { - emsg = Sprintf("%s: accept (y/n)?", em); - term_raw(); - ans = inputChar(emsg->ptr); + emsg = Sprintf("%s: accept? (y/n)", em); + ans = inputAnswer(emsg->ptr); } - if (tolower(*ans) == 'y') { + if (ans && tolower(*ans) == 'y') { amsg = Sprintf("Accept unsecure SSL session: " "unverified: %s", em); } @@ -537,11 +535,10 @@ ssl_get_certificate(InputStream stream, char *hostname) Str ep = Strdup(emsg); if (ep->length > COLS - 16) Strshrink(ep, ep->length - (COLS - 16)); - term_raw(); - Strcat_charp(ep, ": accept(y/n)?"); - ans = inputChar(ep->ptr); + Strcat_charp(ep, ": accept? (y/n)"); + ans = inputAnswer(ep->ptr); } - if (tolower(*ans) == 'y') { + if (ans && tolower(*ans) == 'y') { amsg = Strnew_charp("Accept unsecure SSL session:"); Strcat(amsg, emsg); } @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.73 2002/01/26 17:24:01 ukai Exp $ */ +/* $Id: main.c,v 1.74 2002/01/30 15:08:48 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -2095,8 +2095,8 @@ qquitfm(void) char *ans; if (!confirm_on_quit) quitfm(); - ans = inputChar("Do you want to exit w3m? (y or n)"); - if (ans != NULL && tolower(*ans) == 'y') + ans = inputChar("Do you want to exit w3m? (y/n)"); + if (ans && tolower(*ans) == 'y') quitfm(); displayBuffer(Currentbuf, B_NORMAL); } @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.30 2002/01/29 19:08:50 ukai Exp $ */ +/* $Id: proto.h,v 1.31 2002/01/30 15:08:48 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -184,6 +184,7 @@ extern void doFileSave(URLFile uf, char *defstr); extern int checkCopyFile(char *path1, char *path2); extern int checkSaveFile(InputStream stream, char *path); extern int checkOverWrite(char *path); +extern char *inputAnswer(char *prompt); extern int matchattr(char *p, char *attr, int len, Str *value); extern char *checkHeader(Buffer *buf, char *field); extern Buffer *newBuffer(int width); |