OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_ch_smtp.c versions 1.3 and 1.4
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/l2/l2_ch_smtp.c 1.3 -> 1.4

--- l2_ch_smtp.c 2001/09/14 12:55:20     1.3
+++ l2_ch_smtp.c 2001/10/06 14:33:09     1.4
@@ -121,7 +121,10 @@
         return L2_ERR_USE;
 
     /* create socket address */
-    if ((rc = sa_u2a(&cfg->saaServer, "tcp://%s:%s", cfg->cpHost, cfg->cpPort)) != SA_OK)
+    if ((rc = sa_addr_create(&cfg->saaServer)) != SA_OK)
+        return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
+    if ((rc = sa_addr_u2a(cfg->saaServer, "inet://%s:%s", 
+                          cfg->cpHost, cfg->cpPort)) != SA_OK)
         return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
 
     /* create socket */
@@ -190,31 +193,31 @@
         cu(sa_rv == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
 
     /* | 220 en1.engelschall.com ESMTP SMTP Sendmail 8.11.0+ ready */
-    sa_rv = sa_readline(sa, caLine, sizeof(caLine), &n);
+    sa_rv = sa_readln(sa, caLine, sizeof(caLine), &n);
     cu_on(!(sa_rv == SA_OK && n > 3 && atoi(caLine) == 220), L2_ERR_IO);
     
     /* | HELO l2
      * | 250 en1.engelschall.com Hello en1.engelschall.com [141.1.129.1], pleased to meet you */
-    sa_printf(sa, "HELO %s\r\n", cfg->cpLocalHost);
-    sa_rv = sa_readline(sa, caLine, sizeof(caLine), &n);
+    sa_writef(sa, "HELO %s\r\n", cfg->cpLocalHost);
+    sa_rv = sa_readln(sa, caLine, sizeof(caLine), &n);
     cu_on(!(sa_rv == SA_OK && n > 3 && atoi(caLine) == 250), L2_ERR_IO);
 
     /* | MAIL From: <l2@localhost>
      * | 250 2.1.0 <l2@localhost>... Sender ok */
-    sa_printf(sa, "MAIL FROM:<%s>\r\n", cfg->cpFrom);
-    sa_rv = sa_readline(sa, caLine, sizeof(caLine), &n);
+    sa_writef(sa, "MAIL FROM:<%s>\r\n", cfg->cpFrom);
+    sa_rv = sa_readln(sa, caLine, sizeof(caLine), &n);
     cu_on(!(sa_rv == SA_OK && n > 3 && atoi(caLine) == 250), L2_ERR_IO);
 
     /* | RCPT To: <rse@engelschall.com>
      * | 250 2.1.5 <rse@engelschall.com>... Recipient ok */
-    sa_printf(sa, "RCPT TO:<%s>\r\n", cfg->cpRcpt);
-    sa_rv = sa_readline(sa, caLine, sizeof(caLine), &n);
+    sa_writef(sa, "RCPT TO:<%s>\r\n", cfg->cpRcpt);
+    sa_rv = sa_readln(sa, caLine, sizeof(caLine), &n);
     cu_on(!(sa_rv == SA_OK && n > 3 && atoi(caLine) == 250), L2_ERR_IO);
 
     /* | DATA
      * | 354 Enter mail, end with "." on a line by itself */
-    sa_printf(sa, "DATA\r\n");
-    sa_rv = sa_readline(sa, caLine, sizeof(caLine), &n);
+    sa_writef(sa, "DATA\r\n");
+    sa_rv = sa_readln(sa, caLine, sizeof(caLine), &n);
     cu_on(!(sa_rv == SA_OK && n > 3 && atoi(caLine) == 354), L2_ERR_IO);
 
     /* | Date: Fri, 14 Sep 2001 14:50:51 CEST
@@ -226,24 +229,24 @@
     t = time(NULL);
     tm = localtime(&t);
     strftime(caDate, sizeof(caDate), "%a, %d %b %Y %H:%M:%S %Z", tm);
-    sa_printf(sa, "Date: %s\r\n", caDate);
-    sa_printf(sa, "From: %s\r\n", cfg->cpFrom);
-    sa_printf(sa, "To: %s\r\n", cfg->cpRcpt);
-    sa_printf(sa, "Subject: %s\r\n", cfg->cpSubject);
+    sa_writef(sa, "Date: %s\r\n", caDate);
+    sa_writef(sa, "From: %s\r\n", cfg->cpFrom);
+    sa_writef(sa, "To: %s\r\n", cfg->cpRcpt);
+    sa_writef(sa, "Subject: %s\r\n", cfg->cpSubject);
     if (cfg->cpLocalProg != NULL)
-        sa_printf(sa, "User-Agent: %s (%s)\r\n", 
+        sa_writef(sa, "User-Agent: %s (%s)\r\n", 
                   l2_version.v_web, cfg->cpLocalProg);
     else
-        sa_printf(sa, "User-Agent: %s\r\n", l2_version.v_web);
+        sa_writef(sa, "User-Agent: %s\r\n", l2_version.v_web);
     sa_write(sa, "\r\n", 2, NULL);
 
     /* | A program of user rse on host en1.engelschall.com logged:
      * | [2001-09-10/01:02:03] <notice> sample logging message      */
     if (cfg->cpLocalProg != NULL)
-        sa_printf(sa, "Program %s of user %s on host %s logged:\r\n", 
+        sa_writef(sa, "Program %s of user %s on host %s logged:\r\n", 
                    cfg->cpLocalProg, cfg->cpLocalUser, cfg->cpLocalHost);
     else
-        sa_printf(sa, "A program of user %s on host %s logged:\r\n", 
+        sa_writef(sa, "A program of user %s on host %s logged:\r\n", 
                    cfg->cpLocalUser, cfg->cpLocalHost);
     cpB = buf;
     cpE = buf;
@@ -263,13 +266,13 @@
     /* | .
      * | 250 2.0.0 f88Aev847031 Message accepted for delivery */
     sa_write(sa, ".\r\n", 3, NULL);
-    sa_readline(sa, caLine, sizeof(caLine), &n);
+    sa_readln(sa, caLine, sizeof(caLine), &n);
     cu_on(!(sa_rv == SA_OK && n > 3 && atoi(caLine) == 250), L2_ERR_IO);
 
     /* | QUIT
      * | 221 2.0.0 en1.engelschall.com closing connection */
-    sa_printf(sa, "QUIT\r\n");
-    sa_readline(sa, caLine, sizeof(caLine), &n);
+    sa_writef(sa, "QUIT\r\n");
+    sa_readln(sa, caLine, sizeof(caLine), &n);
 
     cus:
 
@@ -290,7 +293,7 @@
         cfg->saServer = NULL;
     }
     if (cfg->saaServer != NULL) {
-        free(cfg->saaServer);
+        sa_addr_destroy(cfg->saaServer);
         cfg->saaServer = NULL;
     }
 

CVSTrac 2.0.1