From 06f3e405a332a610d9510dc412f0661540622475 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 19 Mar 2000 05:02:40 +0000 Subject: [PATCH] * SMTP hacks to deal with AOL braindamage --- citadel/ChangeLog | 4 +++- citadel/clientsocket.c | 20 ++++++++++++++++++-- citadel/clientsocket.h | 1 + citadel/network/mail.sysinfo | 12 ++++++------ citadel/serv_smtp.c | 14 +++++++------- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index b4d4a9d30..146cba171 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 1.493 2000/03/19 05:02:39 ajc + * SMTP hacks to deal with AOL braindamage + Revision 1.492 2000/03/18 18:18:04 ajc * Support multiline responses from SMTP servers when sending mail @@ -1759,4 +1762,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/clientsocket.c b/citadel/clientsocket.c index f645e9261..a7a7e82c2 100644 --- a/citadel/clientsocket.c +++ b/citadel/clientsocket.c @@ -169,8 +169,8 @@ int ml_sock_gets(int sock, char *buf) { int g; g = sock_gets(sock, buf); - if (g < 0) return(g); - if ( (g < 4) || (buf[3] != '-')) return(g); + if (g < 4) return(g); + if (buf[3] != '-') return(g); do { g = sock_gets(sock, bigbuf); @@ -195,3 +195,19 @@ int sock_puts(int sock, char *buf) if (j<0) return(j); return(i+j); } + + +/* + * sock_puts_crlf() - same as sock_puts() but ends line with CRLF, not LF + * Returns the number of bytes written, or -1 for error. + */ +int sock_puts_crlf(int sock, char *buf) +{ + int i, j; + + i = sock_write(sock, buf, strlen(buf)); + if (i<0) return(i); + j = sock_write(sock, "\r\n", 2); + if (j<0) return(j); + return(i+j); +} diff --git a/citadel/clientsocket.h b/citadel/clientsocket.h index 6bbe88db5..cdcae4489 100644 --- a/citadel/clientsocket.h +++ b/citadel/clientsocket.h @@ -10,6 +10,7 @@ int sock_write(int sock, char *buf, int nbytes); int ml_sock_gets(int sock, char *buf); int sock_gets(int sock, char *buf); int sock_puts(int sock, char *buf); +int sock_puts_crlf(int sock, char *buf); /* * This looks dumb, but it's being done for future portability diff --git a/citadel/network/mail.sysinfo b/citadel/network/mail.sysinfo index c18500367..5437c78ae 100644 --- a/citadel/network/mail.sysinfo +++ b/citadel/network/mail.sysinfo @@ -3,7 +3,7 @@ use uncnsrd phonenum US 612 470 9635 gdom MN humannode C-86 Test System -lastcontact 953174223 Wed Mar 15 21:37:03 2000 +lastcontact 953365023 Sat Mar 18 02:37:03 2000 bccs use uncnsrd @@ -15,13 +15,13 @@ lastcontact 953246224 Thu Mar 16 17:37:04 2000 internet uum %s humannode Internet Gateway -lastcontact 953307423 Fri Mar 17 10:37:03 2000 +lastcontact 953440623 Sat Mar 18 23:37:03 2000 uncnsrd bin Mail phonenum US 914 244 3252 humannode Uncensored -lastcontact 953282223 Fri Mar 17 03:37:03 2000 +lastcontact 953343423 Fri Mar 17 20:37:03 2000 test bin Mail @@ -36,7 +36,7 @@ tesseract bin Mail phonenum US 800 555 1212 humannode Tesseract Project -lastcontact 953307423 Fri Mar 17 10:37:03 2000 +lastcontact 953440623 Sat Mar 18 23:37:03 2000 pixel use uncnsrd @@ -99,7 +99,7 @@ use uncnsrd phonenum CA (604) 589-8539 gdom BC humannode Feathers & Furballs -lastcontact 952925823 Mon Mar 13 00:37:03 2000 +lastcontact 953325424 Fri Mar 17 15:37:04 2000 sbn use uncnsrd @@ -113,7 +113,7 @@ use uncnsrd phonenum netproc[4026]: Adding non-neighbor system to map gdom or system to map humannode Dog Pound BBS II -lastcontact 953217423 Thu Mar 16 09:37:03 2000 +lastcontact 953339823 Fri Mar 17 19:37:03 2000 jacs use uncnsrd diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 83a7d02b4..81d90956d 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -885,7 +885,7 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum) /* Do a HELO command */ snprintf(buf, sizeof buf, "HELO %s", config.c_fqdn); lprintf(9, ">%s\n", buf); - sock_puts(sock, buf); + sock_puts_crlf(sock, buf); if (ml_sock_gets(sock, buf) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP conversation"); @@ -907,9 +907,9 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum) /* HELO succeeded, now try the MAIL From: command */ - snprintf(buf, sizeof buf, "MAIL From: %s", mailfrom); + snprintf(buf, sizeof buf, "MAIL From: <%s>", mailfrom); lprintf(9, ">%s\n", buf); - sock_puts(sock, buf); + sock_puts_crlf(sock, buf); if (ml_sock_gets(sock, buf) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP conversation"); @@ -931,9 +931,9 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum) /* MAIL succeeded, now try the RCPT To: command */ - snprintf(buf, sizeof buf, "RCPT To: %s", addr); + snprintf(buf, sizeof buf, "RCPT To: <%s>", addr); lprintf(9, ">%s\n", buf); - sock_puts(sock, buf); + sock_puts_crlf(sock, buf); if (ml_sock_gets(sock, buf) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP conversation"); @@ -956,7 +956,7 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum) /* RCPT succeeded, now try the DATA command */ lprintf(9, ">DATA\n"); - sock_puts(sock, "DATA"); + sock_puts_crlf(sock, "DATA"); if (ml_sock_gets(sock, buf) < 0) { *status = 4; strcpy(dsn, "Connection broken during SMTP conversation"); @@ -1016,7 +1016,7 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum) *status = 2; lprintf(9, ">QUIT\n"); - sock_puts(sock, "QUIT"); + sock_puts_crlf(sock, "QUIT"); ml_sock_gets(sock, buf); lprintf(9, "<%s\n", buf); -- 2.39.2