diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2000-06-28 11:04:34 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2000-06-28 11:04:34 +0000 |
commit | 13f1b3693b5f5db62d91a03625eb7fd8aef201da (patch) | |
tree | fbd8e27de5b934e160bf008266e484ff86b784b8 | |
parent | 1b0445caadad8c59d0fc9ead943d4aa3f0f59275 (diff) | |
download | fetchmail-13f1b3693b5f5db62d91a03625eb7fd8aef201da.tar.gz fetchmail-13f1b3693b5f5db62d91a03625eb7fd8aef201da.tar.bz2 fetchmail-13f1b3693b5f5db62d91a03625eb7fd8aef201da.zip |
Try to beat a sign-extension bug.
svn path=/trunk/; revision=2912
-rw-r--r-- | driver.c | 2 | ||||
-rw-r--r-- | fetchmail.c | 5 | ||||
-rw-r--r-- | fetchmail.h | 4 | ||||
-rw-r--r-- | interface.c | 1 | ||||
-rw-r--r-- | rfc822.c | 38 | ||||
-rw-r--r-- | socket.c | 2 |
6 files changed, 28 insertions, 24 deletions
@@ -2229,7 +2229,7 @@ const int maxfetch; /* maximum number of messages to fetch */ (dispatches && protocol->retry && !ctl->keep && !ctl->errcount); } - no_error: + /* no_error: */ /* ordinary termination with no errors -- officially log out */ ok = (protocol->logout_cmd)(mailserver_socket, ctl); /* diff --git a/fetchmail.c b/fetchmail.c index 0dfc7e41..f2f3cff6 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -44,6 +44,7 @@ #include "getopt.h" #include "fetchmail.h" +#include "socket.h" #include "tunable.h" #include "smtp.h" #include "netrc.h" @@ -482,10 +483,11 @@ int main(int argc, char **argv) && ctl->server.protocol != P_IMAP_GSS #endif /* GSSAPI */ && !ctl->password) + { if (!isatty(0)) { fprintf(stderr, - _("fetchmail: can't find a password for %s@s.\n"), + _("fetchmail: can't find a password for %s@%s.\n"), ctl->remotename, ctl->server.pollname); return(PS_AUTHFAIL); } @@ -500,6 +502,7 @@ int main(int argc, char **argv) ctl->remotename, ctl->server.pollname); ctl->password = xstrdup((char *)fm_getpassword(tmpbuf)); } + } } /* diff --git a/fetchmail.h b/fetchmail.h index 4d4022be..1603f4e6 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -432,8 +432,8 @@ void stuff_warning(); void close_warning_by_mail(struct query *, struct msgblk *); /* rfc822.c: RFC822 header parsing */ -char *reply_hack(char *, const char *); -char *nxtaddr(const char *); +unsigned char *reply_hack(unsigned char *, const unsigned char *); +unsigned char *nxtaddr(const unsigned char *); /* uid.c: UID support */ void initialize_saved_lists(struct query *, const char *); diff --git a/interface.c b/interface.c index e52db466..eefcfd1d 100644 --- a/interface.c +++ b/interface.c @@ -42,6 +42,7 @@ #endif #include "config.h" #include "fetchmail.h" +#include "socket.h" #include "i18n.h" #include "tunable.h" @@ -22,12 +22,12 @@ static int verbose; char *program_name = "rfc822"; #endif /* TESTMAIN */ -char *reply_hack(buf, host) +unsigned char *reply_hack(buf, host) /* hack message headers so replies will work properly */ -char *buf; /* header to be hacked */ -const char *host; /* server hostname */ +unsigned char *buf; /* header to be hacked */ +const unsigned char *host; /* server hostname */ { - char *from, *cp, last_nws = '\0', *parens_from = NULL; + unsigned char *from, *cp, last_nws = '\0', *parens_from = NULL; int parendepth, state, has_bare_name_part, has_host_part; #ifndef TESTMAIN int addresscount = 1; @@ -59,7 +59,7 @@ const char *host; /* server hostname */ for (cp = buf; *cp; cp++) if (*cp == ',' || isspace(*cp)) addresscount++; - buf = (char *)xrealloc(buf, strlen(buf) + addresscount * strlen(host) + 1); + buf = (unsigned char *)xrealloc(buf, strlen(buf) + addresscount * strlen(host) + 1); #endif /* TESTMAIN */ /* @@ -115,7 +115,7 @@ const char *host; /* server hostname */ && last_nws != ';') { int hostlen; - char *p; + unsigned char *p; p = from; if (parens_from) @@ -185,15 +185,15 @@ const char *host; /* server hostname */ return(buf); } -char *nxtaddr(hdr) +unsigned char *nxtaddr(hdr) /* parse addresses in succession out of a specified RFC822 header */ -const char *hdr; /* header to be parsed, NUL to continue previous hdr */ +const unsigned char *hdr; /* header to be parsed, NUL to continue previous hdr */ { - static char *tp, address[POPBUFSIZE+1]; - static const char *hp; + static unsigned char *tp, address[POPBUFSIZE+1]; + static const unsigned char *hp; static int state, oldstate; #ifdef TESTMAIN - static const char *orighdr; + static const unsigned char *orighdr; #endif /* TESTMAIN */ int parendepth = 0; @@ -236,14 +236,14 @@ const char *hdr; /* header to be parsed, NUL to continue previous hdr */ continue; *++tp = '\0'; } - return(tp > address ? (tp = address) : (char *)NULL); + return(tp > address ? (tp = address) : (unsigned char *)NULL); } else if (*hp == '\\') /* handle RFC822 escaping */ { if (state != INSIDE_PARENS) { *tp++ = *hp++; /* take the escape */ - *tp++ = *hp; /* take following char */ + *tp++ = *hp; /* take following unsigned char */ } } else switch (state) @@ -348,9 +348,9 @@ const char *hdr; /* header to be parsed, NUL to continue previous hdr */ } #ifdef TESTMAIN -static void parsebuf(char *longbuf, int reply) +static void parsebuf(unsigned char *longbuf, int reply) { - char *cp; + unsigned char *cp; if (reply) { @@ -358,19 +358,19 @@ static void parsebuf(char *longbuf, int reply) printf("Rewritten buffer: %s", longbuf); } else - if ((cp = nxtaddr(longbuf)) != (char *)NULL) + if ((cp = nxtaddr(longbuf)) != (unsigned char *)NULL) do { printf("\t-> \"%s\"\n", cp); } while - ((cp = nxtaddr((char *)NULL)) != (char *)NULL); + ((cp = nxtaddr((unsigned char *)NULL)) != (unsigned char *)NULL); } main(int argc, char *argv[]) { - char buf[MSGBUFSIZE], longbuf[BUFSIZ]; - int ch, reply; + unsigned char buf[MSGBUFSIZE], longbuf[BUFSIZ]; + int ch, reply; verbose = reply = FALSE; while ((ch = getopt(argc, argv, "rv")) != EOF) @@ -698,7 +698,6 @@ int SSLOpen(int sock, char *mycert, char *mykey, char *servercname ) int SockClose(int sock) /* close a socket gracefully */ { - char ch; #ifdef SSL_ENABLE SSL *ssl; @@ -721,6 +720,7 @@ int SockClose(int sock) * This stops sends but allows receives (effectively, it sends a * TCP <FIN>). */ if (shutdown(sock, 1) == 0) { + char ch; /* If there is any data still waiting in the queue, discard it. * Call recv() until either it returns 0 (meaning we received a FIN) * or any error occurs. This makes sure all data sent by the other |