]> Pileus Git - ~andy/fetchmail/blobdiff - pop3.c
Drop back to using SockGets/SockWrite.
[~andy/fetchmail] / pop3.c
diff --git a/pop3.c b/pop3.c
index f99b9f35c7a98e8dd9db93498d3e18391e4aaef9..0238fc3573bf19e5c380af2b092871d36778af02 100644 (file)
--- a/pop3.c
+++ b/pop3.c
@@ -17,6 +17,7 @@
 #endif
  
 #include  "fetchmail.h"
+#include  "socket.h"
 
 #define PROTOCOL_ERROR {error(0, 0, "protocol error"); return(PS_ERROR);}
 
@@ -29,7 +30,7 @@ int pop3_ok (FILE *sockfp, char *argbuf)
     char buf [POPBUFSIZE+1];
     char *bufp;
 
-    if (fgets(buf, sizeof(buf), sockfp)) {
+    if (SockGets(buf, sizeof(buf), sockfp)) {
        if (buf[strlen(buf)-1] == '\n')
            buf[strlen(buf)-1] = '\0';
        if (buf[strlen(buf)-1] == '\r')
@@ -168,7 +169,7 @@ static int pop3_getrange(FILE *sockfp, struct query *ctl, int*countp, int*newp)
                int     num;
 
                *newp = 0;
-               while (fgets(buf, sizeof(buf), sockfp))
+               while (SockGets(buf, sizeof(buf), sockfp))
                {
                    if (buf[strlen(buf)-1] == '\n')
                        buf[strlen(buf)-1] = '\0';
@@ -181,6 +182,8 @@ static int pop3_getrange(FILE *sockfp, struct query *ctl, int*countp, int*newp)
                    else if (sscanf(buf, "%d %s", &num, id) == 2)
                    {
                        save_str(&ctl->newsaved, num, id);
+
+                       /* note: ID comparison is caseblind */
                        if (!str_in_list(&ctl->oldsaved, id))
                            (*newp)++;
                    }
@@ -203,7 +206,7 @@ static int pop3_getsizes(FILE *sockfp, int count, int *sizes)
     {
        char buf [POPBUFSIZE+1];
 
-       while (fgets(buf, sizeof(buf), sockfp))
+       while (SockGets(buf, sizeof(buf), sockfp))
        {
            int num, size;
 
@@ -231,6 +234,7 @@ static int pop3_is_old(FILE *sockfp, struct query *ctl, int num)
     if (!ctl->oldsaved)
        return (num <= last);
     else
+       /* note: ID comparison is caseblind */
         return (str_in_list(&ctl->oldsaved,
                            str_find (&ctl->newsaved, num)));
 }