]> code.citadel.org Git - citadel.git/commitdiff
* Fixed bug in mime_parser.c that caused parts to be dropped when the last
authorArt Cancro <ajc@citadel.org>
Fri, 18 May 2001 20:12:09 +0000 (20:12 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 18 May 2001 20:12:09 +0000 (20:12 +0000)
  boundary was the very last line of the message.
* serv_smtp.c: toned down some of the command response verbage.

citadel/ChangeLog
citadel/mime_parser.c
citadel/serv_smtp.c

index 92cdddd55b39e5fe7eee7ebba54007a7d319fa41..36c950bc1c94e2767596e1f3a55ea4921d9dd3ac 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 573.133  2001/05/18 20:12:09  ajc
+ * Fixed bug in mime_parser.c that caused parts to be dropped when the last
+   boundary was the very last line of the message.
+ * serv_smtp.c: toned down some of the command response verbage.
+
  Revision 573.132  2001/04/28 04:42:55  ajc
  * Updated some of the docs.  Bumped version number to 5.80 in anticipation
    of going into a release cycle soon.
@@ -2517,4 +2522,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index a1dbe42e5235582c5d75f617b205b683bcb40af9..f1aec5fbd49fcdf518e5e1851380b57f2eeb9677 100644 (file)
@@ -56,21 +56,20 @@ char *memreadline(char *start, char *buf, int maxlen)
 {
        char ch;
        char *ptr;
+       int len = 0;    /* tally our own length to avoid strlen() delays */
 
        ptr = start;
        memset(buf, 0, maxlen);
 
        while (1) {
                ch = *ptr++;
-               if ((ch == 10) || (ch == 0)) {
-                       if (strlen(buf) > 0)
-                               if (buf[strlen(buf) - 1] == 13)
-                                       buf[strlen(buf) - 1] = 0;
-                       return ptr;
-               }
-               if (strlen(buf) < (maxlen - 1)) {
+               if ( (len < (maxlen - 1)) && (ch != 13) && (ch != 10) ) {
                        buf[strlen(buf) + 1] = 0;
                        buf[strlen(buf)] = ch;
+                       ++len;
+               }
+               if ((ch == 10) || (ch == 0)) {
+                       return ptr;
                }
        }
 }
@@ -387,11 +386,11 @@ void the_mime_parser(char *partnum,
                do {
                        part_end = ptr;
                        ptr = memreadline(ptr, buf, sizeof buf);
-                       if (*ptr == 0) goto END_MULTI;  /* premature end */
                        if (content_end != NULL)
                                if (ptr >= content_end) goto END_MULTI;
-                       if ((!strcasecmp(buf, startary))
-                           || (!strcasecmp(buf, endary))) {
+
+                       if ( (!strcasecmp(buf, startary))
+                          || (!strcasecmp(buf, endary)) ) {
                                if (part_start != NULL) {
                                        if (strlen(partnum) > 0) {
                                                sprintf(nested_partnum, "%s.%d",
@@ -411,7 +410,7 @@ void the_mime_parser(char *partnum,
                                }
                                part_start = ptr;
                        }
-               } while (strcasecmp(buf, endary));
+               } while ( (strcasecmp(buf, endary)) && (ptr != 0) );
 END_MULTI:     if (PostMultiPartCallBack != NULL) {
                        PostMultiPartCallBack("", "", partnum, "", NULL,
                                content_type, 0, encoding, userdata);
index 1e54b7f07b9fa097daef125c3f08f877e062eb45..ddbe9398cdb1e9cdd4ebe3b61bb440f77b7da2c5 100644 (file)
@@ -91,7 +91,7 @@ void smtp_greeting(void) {
        CtdlAllocUserData(SYM_SMTP_RECP, SIZ);
        sprintf(SMTP_RECP, "%s", "");
 
-       cprintf("220 Welcome to the Citadel/UX ESMTP server at %s\r\n",
+       cprintf("220 Citadel/UX ESMTP server at %s ready.\r\n",
                config.c_fqdn);
 }
 
@@ -119,7 +119,7 @@ void smtp_hello(char *argbuf, int is_esmtp) {
  * Implement HELP command.
  */
 void smtp_help(void) {
-       cprintf("214-Here's the frequency, Kenneth:\r\n");
+       cprintf("214-Commands accepted:\r\n");
        cprintf("214-    DATA\r\n");
        cprintf("214-    EHLO\r\n");
        cprintf("214-    EXPN\r\n");
@@ -131,7 +131,7 @@ void smtp_help(void) {
        cprintf("214-    RCPT\r\n");
        cprintf("214-    RSET\r\n");
        cprintf("214-    VRFY\r\n");
-       cprintf("214 I could tell you more, but then I'd have to kill you.\r\n");
+       cprintf("214     \r\n");
 }
 
 
@@ -440,7 +440,7 @@ void smtp_rcpt(char *argbuf) {
 
                case rfc822_address_nonlocal:
                        if (SMTP->message_originated_locally == 0) {
-                               cprintf("551 Relaying denied\r\n");
+                               cprintf("551 Third-party relaying denied.\r\n");
                        }
                        else {
                                cprintf("250 Remote recipient %s ok\r\n", recp);
@@ -672,7 +672,7 @@ void smtp_data(void) {
        CtdlFreeMessage(msg);
 
        if (!retval) {
-               cprintf("250 Message accepted for delivery.\r\n");
+               cprintf("250 ok terrific\r\n");
        }
        else {
                cprintf("550 Internal delivery errors: %d\r\n", retval);
@@ -759,7 +759,7 @@ void smtp_command_loop(void) {
        }
 
        else {
-               cprintf("502 I'm sorry Dave, I'm afraid I can't do that.\r\n");
+               cprintf("502 I'm afraid I can't do that.\r\n");
        }
 
 }