From: Wilfried Goesgens Date: Sun, 21 Nov 2010 15:34:16 +0000 (+0100) Subject: Relax SMTP Client timeout settings as discussed. X-Git-Tag: v7.86~29 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=cea750b0e7430731f9a2c3497d235cd3f7a9b6b0 Relax SMTP Client timeout settings as discussed. - default is 30 seconds - Server greeting 90 seconds (DNS lookups for RBLs might be slow - Server sending the response to the EOM sequence; here we might have background processing like virus or spam scanning that wants to finish before finaly accepting the message. --- diff --git a/citadel/modules/smtp/serv_smtp.c b/citadel/modules/smtp/serv_smtp.c index a4441674e..b0572f5a1 100644 --- a/citadel/modules/smtp/serv_smtp.c +++ b/citadel/modules/smtp/serv_smtp.c @@ -1121,7 +1121,7 @@ void smtp_try(const char *key, const char *addr, int *status, CCC->sPos = NULL; /* Process the SMTP greeting from the server */ - if (ml_sock_gets(&sock, buf, 5) < 0) { + if (ml_sock_gets(&sock, buf, 90) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP conversation"); goto bail; @@ -1146,7 +1146,7 @@ void smtp_try(const char *key, const char *addr, int *status, snprintf(buf, sizeof buf, "EHLO %s\r\n", config.c_fqdn); CtdlLogPrintf(CTDL_DEBUG, ">%s", buf); sock_write(&sock, buf, strlen(buf)); - if (ml_sock_gets(&sock, buf, 5) < 0) { + if (ml_sock_gets(&sock, buf, 30) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP HELO"); goto bail; @@ -1156,7 +1156,7 @@ void smtp_try(const char *key, const char *addr, int *status, snprintf(buf, sizeof buf, "HELO %s\r\n", config.c_fqdn); CtdlLogPrintf(CTDL_DEBUG, ">%s", buf); sock_write(&sock, buf, strlen(buf)); - if (ml_sock_gets(&sock, buf, 5) < 0) { + if (ml_sock_gets(&sock, buf, 30) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP HELO"); goto bail; @@ -1183,7 +1183,7 @@ void smtp_try(const char *key, const char *addr, int *status, snprintf(buf, sizeof buf, "AUTH PLAIN %s\r\n", encoded); CtdlLogPrintf(CTDL_DEBUG, ">%s", buf); sock_write(&sock, buf, strlen(buf)); - if (ml_sock_gets(&sock, buf, 5) < 0) { + if (ml_sock_gets(&sock, buf, 30) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP AUTH"); goto bail; @@ -1207,7 +1207,7 @@ void smtp_try(const char *key, const char *addr, int *status, snprintf(buf, sizeof buf, "MAIL FROM:<%s>\r\n", envelope_from); CtdlLogPrintf(CTDL_DEBUG, ">%s", buf); sock_write(&sock, buf, strlen(buf)); - if (ml_sock_gets(&sock, buf, 5) < 0) { + if (ml_sock_gets(&sock, buf, 30) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP MAIL"); goto bail; @@ -1230,7 +1230,7 @@ void smtp_try(const char *key, const char *addr, int *status, snprintf(buf, sizeof buf, "RCPT TO:<%s@%s>\r\n", user, node); CtdlLogPrintf(CTDL_DEBUG, ">%s", buf); sock_write(&sock, buf, strlen(buf)); - if (ml_sock_gets(&sock, buf, 5) < 0) { + if (ml_sock_gets(&sock, buf, 30) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP RCPT"); goto bail; @@ -1252,7 +1252,7 @@ void smtp_try(const char *key, const char *addr, int *status, /* RCPT succeeded, now try the DATA command */ CtdlLogPrintf(CTDL_DEBUG, ">DATA\n"); sock_write(&sock, "DATA\r\n", 6); - if (ml_sock_gets(&sock, buf, 5) < 0) { + if (ml_sock_gets(&sock, buf, 30) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP DATA"); goto bail; @@ -1307,7 +1307,7 @@ void smtp_try(const char *key, const char *addr, int *status, CtdlLogPrintf(CTDL_DEBUG, ">QUIT\n"); sock_write(&sock, "QUIT\r\n", 6); - ml_sock_gets(&sock, buf, 1); + ml_sock_gets(&sock, buf, 30); CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf); CtdlLogPrintf(CTDL_INFO, "SMTP client: delivery to <%s> @ <%s> (%s) succeeded\n", user, node, name);