]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Make some tweaks to bsmtp based on patch submitted in bug #1124.
authorKern Sibbald <kern@sibbald.com>
Wed, 23 Jul 2008 14:57:01 +0000 (14:57 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 23 Jul 2008 14:57:01 +0000 (14:57 +0000)
     This fixes bug #1124.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@7423 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/tools/bsmtp.c
bacula/technotes-2.4

index 880ef9b289484df0da8b2783ff6963c21bfddc24..1af6df179cdd266c0739ef9883cdb1f67a7bf415 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2001-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -187,7 +187,7 @@ _("\n"
 "Usage: %s [-f from] [-h mailhost] [-s subject] [-c copy] [recipient ...]\n"
 "       -8          set charset utf-8\n"
 "       -c          set the Cc: field\n"
-"       -dnn        set debug level to nn\n"
+"       -d <nn>     set debug level to <nn>\n"
 "       -f          set the From: field\n"
 "       -h          use mailhost:port as the SMTP server\n"
 "       -s          set the Subject: field\n"
@@ -475,19 +475,19 @@ hp:
     *   we do.
     */
    get_response(); /* banner */
-   chat("helo %s\r\n", my_hostname);
-   chat("mail from:%s\r\n", cleanup_addr(from_addr, buf, sizeof(buf)));
+   chat("HELO %s\r\n", my_hostname);
+   chat("MAIL FROM:%s\r\n", cleanup_addr(from_addr, buf, sizeof(buf)));
    
    for (i = 0; i < argc; i++) {
       Dmsg1(20, "rcpt to: %s\n", argv[i]);
-      chat("rcpt to:%s\r\n", cleanup_addr(argv[i], buf, sizeof(buf)));
+      chat("RCPT TO:%s\r\n", cleanup_addr(argv[i], buf, sizeof(buf)));
    }
 
    if (cc_addr) {
-      chat("rcpt to:%s\r\n", cleanup_addr(cc_addr, buf, sizeof(buf)));
+      chat("RCPT TO:%s\r\n", cleanup_addr(cc_addr, buf, sizeof(buf)));
    }
    Dmsg0(20, "Data\n");
-   chat("data\r\n");
+   chat("DATA\r\n");
 
    /*
     *  Send message header
@@ -560,28 +560,30 @@ hp:
    while (fgets(buf, sizeof(buf), stdin)) {
       if (maxlines > 0 && ++lines > maxlines) {
          Dmsg1(20, "skip line because of maxlines limit: %lu\n", maxlines);
+         while (fgets(buf, sizeof(buf), stdin)) {
+            ++lines;
+         }
          break;
       }
       buf[sizeof(buf)-1] = '\0';
       buf[strlen(buf)-1] = '\0';
-      if (buf[0] == '.' && buf[1] == '\0') { /* quote lone dots */
-         fputs("..\r\n", sfp);
-      } else {                     /* pass body through unchanged */
-         fputs(buf, sfp);
-         fputs("\r\n", sfp);
+      if (buf[0] == '.') {         /* add extra . see RFC 2821 4.5.2 */
+         fputs(".", sfp);
       }
+      fputs(buf, sfp);
+      fputs("\r\n", sfp);
    }
 
    if (lines > maxlines) {
       Dmsg1(10, "hit maxlines limit: %lu\n", maxlines);
-      fprintf(sfp, "\r\n[maximum of %lu lines exceeded, skipped %lu lines of output]\r\n", maxlines, lines-maxlines);
+      fprintf(sfp, "\r\n\r\n[maximum of %lu lines exceeded, skipped %lu lines of output]\r\n", maxlines, lines-maxlines);
    }
 
    /*
     *  Send SMTP quit command
     */
    chat(".\r\n");
-   chat("quit\r\n");
+   chat("QUIT\r\n");
 
    /*
     *  Go away gracefully ...
index f1eb34ba2373fda8eec2b55f58c3eb852bcacdf7..ed82e26f5751e41189db9733520c8201698fa293 100644 (file)
@@ -3,6 +3,8 @@
 General:
 Release Version 2.4.2
 23Jul08
+kes  Make some tweaks to bsmtp based on patch submitted in bug #1124.
+     This fixes bug #1124.
 kes  Make the default bat restore Pool be Any. This fixes bug #1118.
 22Jul08
 kes  Minor cleanups.