handle multi-line greeting messages
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 12 Apr 1994 23:21:15 +0000 (15:21 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 12 Apr 1994 23:21:15 +0000 (15:21 -0800)
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 8.33

usr/src/usr.sbin/sendmail/src/srvrsmtp.c

index 545a7b5..d80a505 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.32 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.33 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)srvrsmtp.c 8.32 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.33 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -125,13 +125,25 @@ smtp(e)
 
        setproctitle("server %s startup", CurSmtpClient);
        expand("\201e", inp, &inp[sizeof inp], e);
 
        setproctitle("server %s startup", CurSmtpClient);
        expand("\201e", inp, &inp[sizeof inp], e);
+       p = strchr(inp, '\n');
+       if (p != NULL)
+               *p++ = '\0';
        if (BrokenSmtpPeers)
        {
                message("220 %s", inp);
        }
        else
        {
        if (BrokenSmtpPeers)
        {
                message("220 %s", inp);
        }
        else
        {
-               message("220-%s", inp);
+               char *q = inp;
+
+               while (q != NULL)
+               {
+                       message("220-%s", q);
+                       q = p;
+                       p = strchr(p, '\n');
+                       if (p != NULL)
+                               *p++ = '\0';
+               }
                message("220 ESMTP spoken here");
        }
        protocol = NULL;
                message("220 ESMTP spoken here");
        }
        protocol = NULL;