aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--imap.c8
-rw-r--r--pop2.c4
-rw-r--r--pop3.c12
-rw-r--r--smtp.c4
4 files changed, 28 insertions, 0 deletions
diff --git a/imap.c b/imap.c
index 0b7dcd2f..7fbac659 100644
--- a/imap.c
+++ b/imap.c
@@ -27,6 +27,10 @@ int imap_ok (FILE *sockfp, char *argbuf)
do {
if (!fgets(buf, sizeof(buf), sockfp))
return(PS_SOCKET);
+ if (buf[strlen(buf)-1] == '\n')
+ buf[strlen(buf)-1] = '\0';
+ if (buf[strlen(buf)-1] == '\r')
+ buf[strlen(buf)-1] = '\r';
if (outlevel == O_VERBOSE)
error(0, 0, "IMAP< %s", buf);
@@ -122,6 +126,10 @@ static int imap_getsizes(FILE *sockfp, int count, int *sizes)
{
int num, size;
+ if (buf[strlen(buf)-1] == '\n')
+ buf[strlen(buf)-1] = '\0';
+ if (buf[strlen(buf)-1] == '\r')
+ buf[strlen(buf)-1] = '\r';
if (outlevel == O_VERBOSE)
error(0, 0, "IMAP< %s", buf);
if (strstr(buf, "OK"))
diff --git a/pop2.c b/pop2.c
index c2e5ecc4..0ca40e04 100644
--- a/pop2.c
+++ b/pop2.c
@@ -24,6 +24,10 @@ int pop2_ok (FILE *sockfp, char *argbuf)
pound_arg = equal_arg = -1;
if (fgets(buf, sizeof(buf), sockfp)) {
+ if (buf[strlen(buf)-1] == '\n')
+ buf[strlen(buf)-1] = '\0';
+ if (buf[strlen(buf)-1] == '\r')
+ buf[strlen(buf)-1] = '\r';
if (outlevel == O_VERBOSE)
error(0, 0, "POP2< %s", buf);
diff --git a/pop3.c b/pop3.c
index 9b8616e4..b5c9c4d7 100644
--- a/pop3.c
+++ b/pop3.c
@@ -31,6 +31,10 @@ int pop3_ok (FILE *sockfp, char *argbuf)
char *bufp;
if (fgets(buf, sizeof(buf), sockfp)) {
+ if (buf[strlen(buf)-1] == '\n')
+ buf[strlen(buf)-1] = '\0';
+ if (buf[strlen(buf)-1] == '\r')
+ buf[strlen(buf)-1] = '\r';
if (outlevel == O_VERBOSE)
error(0, 0, "POP3< %s", buf);
@@ -167,6 +171,10 @@ static int pop3_getrange(FILE *sockfp, struct query *ctl, int*countp, int*newp)
*newp = 0;
while (fgets(buf, sizeof(buf), sockfp))
{
+ if (buf[strlen(buf)-1] == '\n')
+ buf[strlen(buf)-1] = '\0';
+ if (buf[strlen(buf)-1] == '\r')
+ buf[strlen(buf)-1] = '\r';
if (outlevel == O_VERBOSE)
error(0, 0, "POP3< %s", buf);
if (buf[0] == '.')
@@ -200,6 +208,10 @@ static int pop3_getsizes(FILE *sockfp, int count, int *sizes)
{
int num, size;
+ if (buf[strlen(buf)-1] == '\n')
+ buf[strlen(buf)-1] = '\0';
+ if (buf[strlen(buf)-1] == '\r')
+ buf[strlen(buf)-1] = '\r';
if (outlevel == O_VERBOSE)
error(0, 0, "POP3< %s", buf);
if (buf[0] == '.')
diff --git a/smtp.c b/smtp.c
index 877e2e5c..733f7050 100644
--- a/smtp.c
+++ b/smtp.c
@@ -101,6 +101,10 @@ int SMTP_ok(FILE *sockfp)
{
int n = strlen(ip);
+ if (buf[strlen(buf)-1] == '\n')
+ buf[strlen(buf)-1] = '\0';
+ if (buf[strlen(buf)-1] == '\r')
+ buf[strlen(buf)-1] = '\r';
if (n < 4)
return SM_ERROR;
buf[n] = '\0';