Package: ssmtp
Version: 2.64-5
Severity: wishlist
Tags: patch

The current versions of sSMTP often uses newlines in strings passed to
`log_event()`.  This patch removes those newlines.

This patch should be applied after my patch for bug #662958
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662958).

Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
From 246ac1ca5e044547419d46c5c509a37b724484ef Mon Sep 17 00:00:00 2001
From: W. Trevor King <[email protected]>
Date: Wed, 7 Mar 2012 09:09:51 -0500
Subject: [PATCH 2/3] Strings passed to `log_event()` do not need trailing 
newlines.

---
 ssmtp.c |   54 +++++++++++++++++++++++++++---------------------------
 1 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/ssmtp.c b/ssmtp.c
index 97d19dc..c491cd4 100644
--- a/ssmtp.c
+++ b/ssmtp.c
@@ -411,9 +411,9 @@ void revaliases(struct passwd *pw)
                                        }
 
                                        if(log_level > 0) {
-                                               log_event(LOG_INFO, "Set 
MailHub=\"%s\"\n", mailhost);
+                                               log_event(LOG_INFO, "Set 
MailHub=\"%s\"", mailhost);
                                                log_event(LOG_INFO,
-                                                       "via SMTP Port 
Number=\"%d\"\n", port);
+                                                       "via SMTP Port 
Number=\"%d\"", port);
                                        }
                                }
                        }
@@ -896,7 +896,7 @@ bool_t read_config()
                                }
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
Root=\"%s\"\n", root);
+                                       log_event(LOG_INFO, "Set Root=\"%s\"", 
root);
                                }
                        }
                        else if(strcasecmp(p, "MailHub") == 0) {
@@ -910,8 +910,8 @@ bool_t read_config()
                                }
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
MailHub=\"%s\"\n", mailhost);
-                                       log_event(LOG_INFO, "Set 
RemotePort=\"%d\"\n", port);
+                                       log_event(LOG_INFO, "Set 
MailHub=\"%s\"", mailhost);
+                                       log_event(LOG_INFO, "Set 
RemotePort=\"%d\"", port);
                                }
                        }
                        else if(strcasecmp(p, "HostName") == 0) {
@@ -922,7 +922,7 @@ bool_t read_config()
                                }
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
HostName=\"%s\"\n", hostname);
+                                       log_event(LOG_INFO, "Set 
HostName=\"%s\"", hostname);
                                }
                        }
                        else if(strcasecmp(p,"AddHeader") == 0) {
@@ -933,7 +933,7 @@ bool_t read_config()
                                        die("cannot AddHeader");
                                }
                                if(log_level > 0 ) {
-                                       log_event(LOG_INFO, "Set 
AddHeader=\"%s\"\n", q);
+                                       log_event(LOG_INFO, "Set 
AddHeader=\"%s\"", q);
                                }
                        }
 #ifdef REWRITE_DOMAIN
@@ -942,9 +942,9 @@ bool_t read_config()
                                        mail_domain = strdup(++p);
 
                                        log_event(LOG_ERR,
-                                               "Set RewriteDomain=\"%s\" is 
invalid\n", q);
+                                               "Set RewriteDomain=\"%s\" is 
invalid", q);
                                        log_event(LOG_ERR,
-                                               "Set RewriteDomain=\"%s\" 
used\n", mail_domain);
+                                               "Set RewriteDomain=\"%s\" 
used", mail_domain);
                                }
                                else {
                                        mail_domain = strdup(q);
@@ -957,7 +957,7 @@ bool_t read_config()
 
                                if(log_level > 0) {
                                        log_event(LOG_INFO,
-                                               "Set RewriteDomain=\"%s\"\n", 
mail_domain);
+                                               "Set RewriteDomain=\"%s\"", 
mail_domain);
                                }
                        }
 #endif
@@ -971,7 +971,7 @@ bool_t read_config()
 
                                if(log_level > 0) {
                                        log_event(LOG_INFO,
-                                               "Set FromLineOverride=\"%s\"\n",
+                                               "Set FromLineOverride=\"%s\"",
                                                override_from ? "True" : 
"False");
                                }
                        }
@@ -979,7 +979,7 @@ bool_t read_config()
                                port = atoi(q);
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
RemotePort=\"%d\"\n", port);
+                                       log_event(LOG_INFO, "Set 
RemotePort=\"%d\"", port);
                                }
                        }
 #ifdef HAVE_SSL
@@ -994,7 +994,7 @@ bool_t read_config()
 
                                if(log_level > 0) { 
                                        log_event(LOG_INFO,
-                                               "Set UseTLS=\"%s\"\n", use_tls 
? "True" : "False");
+                                               "Set UseTLS=\"%s\"", use_tls ? 
"True" : "False");
                                }
                        }
                        else if(strcasecmp(p, "UseSTARTTLS") == 0) {
@@ -1008,7 +1008,7 @@ bool_t read_config()
 
                                if(log_level > 0) { 
                                        log_event(LOG_INFO,
-                                               "Set UseSTARTTLS=\"%s\"\n", 
use_tls ? "True" : "False");
+                                               "Set UseSTARTTLS=\"%s\"", 
use_tls ? "True" : "False");
                                }
                        }
                        else if(strcasecmp(p, "UseTLSCert") == 0) {
@@ -1021,7 +1021,7 @@ bool_t read_config()
 
                                if(log_level > 0) {
                                        log_event(LOG_INFO,
-                                               "Set UseTLSCert=\"%s\"\n",
+                                               "Set UseTLSCert=\"%s\"",
                                                use_cert ? "True" : "False");
                                }
                        }
@@ -1031,7 +1031,7 @@ bool_t read_config()
                                }
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
TLSCert=\"%s\"\n", tls_cert);
+                                       log_event(LOG_INFO, "Set 
TLSCert=\"%s\"", tls_cert);
                                }
                        }
                        else if(strcasecmp(p, "TLSKey") == 0) {
@@ -1040,7 +1040,7 @@ bool_t read_config()
                                }
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
TLSKey=\"%s\"\n", tls_key);
+                                       log_event(LOG_INFO, "Set 
TLSKey=\"%s\"", tls_key);
                                }
                        }
 #endif
@@ -1051,7 +1051,7 @@ bool_t read_config()
                                }
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
AuthUser=\"%s\"\n", auth_user);
+                                       log_event(LOG_INFO, "Set 
AuthUser=\"%s\"", auth_user);
                                }
                        }
                        else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) {
@@ -1060,7 +1060,7 @@ bool_t read_config()
                                }
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
AuthPass=\"%s\"\n", auth_pass);
+                                       log_event(LOG_INFO, "Set 
AuthPass=\"%s\"", auth_pass);
                                }
                        }
                        else if(strcasecmp(p, "AuthMethod") == 0 && 
!auth_method) {
@@ -1069,7 +1069,7 @@ bool_t read_config()
                                }
 
                                if(log_level > 0) {
-                                       log_event(LOG_INFO, "Set 
AuthMethod=\"%s\"\n", auth_method);
+                                       log_event(LOG_INFO, "Set 
AuthMethod=\"%s\"", auth_method);
                                }
                        }
                        else if(strcasecmp(p, "UseOldAUTH") == 0) {
@@ -1082,7 +1082,7 @@ bool_t read_config()
  
                                if(log_level > 0) {
                                        log_event(LOG_INFO,
-                                               "Set UseOldAUTH=\"%s\"\n",
+                                               "Set UseOldAUTH=\"%s\"",
                                                use_oldauth ? "True" : "False");
                                }
                        }
@@ -1098,7 +1098,7 @@ bool_t read_config()
                                }
                        }
                        else {
-                               log_event(LOG_INFO, "Unable to set 
%s=\"%s\"\n", p, q);
+                               log_event(LOG_INFO, "Unable to set %s=\"%s\"", 
p, q);
                        }
                        free(p);
                        free(q);
@@ -1138,7 +1138,7 @@ int smtp_open(char *host, int port)
        meth=SSLv23_client_method();
        ctx = SSL_CTX_new(meth);
        if(!ctx) {
-               log_event(LOG_ERR, "No SSL support initiated\n");
+               log_event(LOG_ERR, "No SSL support initiated");
                return(-1);
        }
 
@@ -1154,7 +1154,7 @@ int smtp_open(char *host, int port)
                }
 
                if(!SSL_CTX_check_private_key(ctx)) {
-                       log_event(LOG_ERR, "Private key does not match the 
certificate public key\n");
+                       log_event(LOG_ERR, "Private key does not match the 
certificate public key");
                        return(-1);
                }
        }
@@ -1188,7 +1188,7 @@ int smtp_open(char *host, int port)
 
        if(s < 0) {
                log_event (LOG_ERR,
-                       "Unable to connect to \"%s\" port %d.\n", host, port);
+                       "Unable to connect to \"%s\" port %d.", host, port);
 
                return(-1);
        }
@@ -1338,7 +1338,7 @@ int smtp_read(int fd, char *response)
        while(response[3] == '-');
 
        if(log_level > 0) {
-               log_event(LOG_INFO, "%s\n", response);
+               log_event(LOG_INFO, "%s", response);
        }
 
        if(minus_v) {
@@ -1386,7 +1386,7 @@ ssize_t smtp_write(int fd, char *format, ...)
        va_end(ap);
 
        if(log_level > 0) {
-               log_event(LOG_INFO, "%s\n", buf);
+               log_event(LOG_INFO, "%s", buf);
        }
 
        if(minus_v) {
-- 
1.7.3.4

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to