diff options
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | driver.c | 24 | ||||
-rw-r--r-- | fetchmail.h | 2 | ||||
-rw-r--r-- | imap.c | 1 | ||||
-rw-r--r-- | pop2.c | 1 | ||||
-rw-r--r-- | pop3.c | 1 | ||||
-rw-r--r-- | smtp.c | 1 | ||||
-rw-r--r-- | socket.c | 30 |
8 files changed, 31 insertions, 31 deletions
diff --git a/Makefile.in b/Makefile.in index a1524a0a..96c4013e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -204,7 +204,7 @@ $(srcdir)/rcfile_l.c: $(srcdir)/rcfile_l.l $(srcdir)/rcfile_y.c: $(srcdir)/rcfile_y.y parser = $(srcdir)/rcfile_l.l $(srcdir)/rcfile_y.y -headers = $(srcdir)/fetchmail.h $(srcdir)/socket.h $(srcdir)/smtp.h \ +headers = $(srcdir)/fetchmail.h $(srcdir)/smtp.h \ $(srcdir)/mx.h $(srcdir)/md5.h $(srcdir)/md5global.h extra = $(srcdir)/alloca.c $(srcdir)/getopt.[ch] $(srcdir)/getopt1.c \ $(srcdir)/strcasecmp.c @@ -36,7 +36,6 @@ #include <netinet/in.h> /* must be included before "socket.h".*/ #include <netdb.h> #endif /* KERBEROS_V4 */ -#include "socket.h" #include "fetchmail.h" #include "smtp.h" @@ -486,6 +485,27 @@ struct query *ctl; return(ctl->smtp_sockfp); } +static int strip_gets(buf, len, sockfp) +/* get a line of input, stripping out \r and \n */ +char *buf; +int len; +FILE *sockfp; +{ + if (fgets(buf, len, sockfp) == (char *)NULL) + return(-1); + else + { + char *sp, *tp; + + for (tp = sp = buf; *sp; sp++) + if (*sp != '\r' && *sp != '\n') + *tp++ = *sp; + *tp++ = '\0'; + + return(strlen(buf)); + } +} + static int gen_readmsg (sockfp, len, delimited, ctl) /* read message content and ship to SMTP or MDA */ FILE *sockfp; /* to which the server is connected */ @@ -507,7 +527,7 @@ struct query *ctl; /* query control record */ oldlen = 0; while (delimited || len > 0) { - if ((n = SockGets(buf,sizeof(buf),sockfp)) < 0) + if ((n = strip_gets(buf,sizeof(buf),sockfp)) < 0) return(PS_SOCKET); vtalarm(ctl->timeout); diff --git a/fetchmail.h b/fetchmail.h index eaf11fb0..ee28098a 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -186,6 +186,8 @@ int openmailpipe (char **); int closemailpipe(int); int daemonize(const char *, void (*)(int)); +FILE *Socket(char *, int); + int prc_parse_file(const char *); int prc_filecheck(const char *); @@ -13,7 +13,6 @@ #if defined(STDC_HEADERS) #include <stdlib.h> #endif -#include "socket.h" #include "fetchmail.h" static int count, seen, recent, unseen; @@ -11,7 +11,6 @@ #if defined(STDC_HEADERS) #include <stdlib.h> #endif -#include "socket.h" #include "fetchmail.h" static int pound_arg, equal_arg; @@ -15,7 +15,6 @@ #include <stdlib.h> #endif -#include "socket.h" #include "fetchmail.h" #define PROTOCOL_ERROR {fputs("fetchmail: protocol error\n", stderr); return(PS_ERROR);} @@ -13,7 +13,6 @@ #include <stdio.h> #include <unistd.h> #include <string.h> -#include "socket.h" #include "fetchmail.h" #include "smtp.h" @@ -17,12 +17,14 @@ #if defined(HAVE_UNISTD_H) #include <unistd.h> #endif -#if defined(HAVE_STDARG_H) -#include <stdarg.h> + +#ifndef INADDR_NONE +#ifdef INADDR_BROADCAST +#define INADDR_NONE INADDR_BROADCAST #else -#include <varargs.h> +#define INADDR_NONE -1 +#endif #endif -#include "socket.h" #define INTERNAL_BUFSIZE 2048 @@ -66,24 +68,4 @@ int clientPort; return sockfp; } -int SockGets(buf, len, sockfp) -char *buf; -int len; -FILE *sockfp; -{ - if (fgets(buf, len, sockfp) == (char *)NULL) - return(-1); - else - { - char *sp, *tp; - - for (tp = sp = buf; *sp; sp++) - if (*sp != '\r' && *sp != '\n') - *tp++ = *sp; - *tp++ = '\0'; - - return(strlen(buf)); - } -} - /* socket.c ends here */ |