#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 */
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';