[prev in list] [next in list] [prev in thread] [next in thread] 

List:       listar-dev
Subject:    [EDev] patch proposal: using \r\n instead of \n during SMTP session
From:       Matthias Bezold <mb () bnbt ! de>
Date:       2002-04-16 11:51:28
[Download RAW message or body]

hi,

the MTA Courier only accepts \r\n line ends, but does not work if one
uses only \n during a SMTP session. So the current version of Ecartis
won't work with Courier. I think that all mail servers should work with
\r\n, so maybe the patch can be merged into Ecartis.

Maybe that diff that is appended to this mail can help - thank you!  

--
Matthias Bezold

-- Attached file included as plaintext by Ecartis --
-- File: smtp.c-patch

--- smtp_alt.c	Tue Mar 26 08:53:02 2002
+++ smtp.c	Tue Apr 16 13:38:49 2002
@@ -63,7 +63,7 @@
     if(!read_data)
         return 0;
 
-    sock_printf(my_socket, "EHLO %s\n", hostname);
+    sock_printf(my_socket, "EHLO %s\r\n", hostname);
     if(sock_readline(my_socket, buf, BIG_BUF) == 0)
         return 0;
 
@@ -118,7 +118,7 @@
         return 0;
     log_printf(9, "Connected: %s (%s)\n", dbg_hostname, dbg_version); 
 
-    sock_printf(my_socket, "HELO %s\n", hostname);
+    sock_printf(my_socket, "HELO %s\r\n", hostname);
     if(sock_readline(my_socket, buf, BIG_BUF) == 0)
         return 0;
     if(!sscanf(buf, "250 %s", testme))
@@ -171,7 +171,7 @@
         final += result;
     }
 
-    final += sock_printf(my_socket, "\n");
+    final += sock_printf(my_socket, "\r\n");
     if (!final) {
         set_var("smtp-last-error", "Error setting SMTP from address.", VAR_TEMP);
         return 0;
@@ -239,7 +239,7 @@
         final += result;
     }
 
-    final += sock_printf(my_socket, "\n");
+    final += sock_printf(my_socket, "\r\n");
   
     if (!final) {
         set_var("smtp-last-error","Can't send to SMTP server (RCPT TO)", VAR_TEMP);
@@ -297,7 +297,7 @@
 
     clean_var("smtp-last-error", VAR_TEMP);
     log_printf(9, "Data transmit starting.\n");
-    if (!sock_printf(my_socket,"DATA\n")) {
+    if (!sock_printf(my_socket,"DATA\r\n")) {
         set_var("smtp-last-error", "Unable to write to SMTP server (DATA).", VAR_TEMP);
         return 0;
     }
@@ -447,7 +447,7 @@
 {
     clean_var("smtp-last-error", VAR_TEMP);
     log_printf(9, "Disconnecting.\n");
-    if (!sock_printf(my_socket, "QUIT\n")) {
+    if (!sock_printf(my_socket, "QUIT\r\n")) {
         set_var("smtp-last-error", "Unable to write to SMTP server (QUIT).", VAR_TEMP);
         return 0;
     }



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic