]> Pileus Git - ~andy/fetchmail/blobdiff - smtp.c
Drop back to using SockGets/SockWrite.
[~andy/fetchmail] / smtp.c
diff --git a/smtp.c b/smtp.c
index 515366b583eb90998a7ff1ab9802199b35efb873..a5be092779cde4c5d15985ae2c037dfd2b8f2f8c 100644 (file)
--- a/smtp.c
+++ b/smtp.c
 
 #include <stdio.h>
 #include <config.h>
-#include <sys/types.h>
 #include <unistd.h>
 #include <string.h>
-#include "socket.h"
 #include "fetchmail.h"
+#include "socket.h"
 #include "smtp.h"
 
 int smtp_response;     /* numeric value of SMTP response code */
@@ -95,11 +94,16 @@ int SMTP_eom(FILE *sockfp)
 int SMTP_ok(FILE *sockfp)
 /* returns status of SMTP connection */
 {
-    int  n;
-    char buf[SMTPBUFSIZE];
+    char buf[SMTPBUFSIZE], *ip;
   
-    while ((n = SockGets(buf, sizeof(buf)-1, sockfp)) > 0)
+    while ((ip = SockGets(buf, sizeof(buf)-1, 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';