Dear all,

Could you consider quoting the space-containing values in smtpd log
messages?

I like the latest smtpd log format improvements, but it's hard to parse
space-separated key-value pairs if they have space-containing values :)
Please see the patch attached.

-- 
With best regards,
Pavel Korovin
Index: smtp_session.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/smtp_session.c,v
retrieving revision 1.272
diff -u -p -r1.272 smtp_session.c
--- smtp_session.c      22 May 2016 16:31:21 -0000      1.272
+++ smtp_session.c      2 Jun 2016 12:55:51 -0000
@@ -1258,7 +1258,7 @@ smtp_io(struct io *io, int evt)
        switch (evt) {
 
        case IO_TLSREADY:
-               log_info("%016"PRIx64" smtp event=starttls ciphers=%s",
+               log_info("%016"PRIx64" smtp event=starttls ciphers=\"%s\"",
                    s->id, ssl_to_text(s->io.ssl));
 
                s->flags |= SF_SECURE;
@@ -1283,7 +1283,7 @@ smtp_io(struct io *io, int evt)
                x = SSL_get_peer_certificate(s->io.ssl);
                if (x) {
                        log_info("%016"PRIx64" smtp "
-                           "event=client-cert-check result=%s",
+                           "event=client-cert-check result=\"%s\"",
                            s->id,
                            (s->flags & SF_VERIFIED) ? "success" : "failure");
                        X509_free(x);
@@ -1402,7 +1402,7 @@ smtp_io(struct io *io, int evt)
                break;
 
        case IO_ERROR:
-               log_info("%016"PRIx64" smtp event=closed reason=io-error: %s",
+               log_info("%016"PRIx64" smtp event=closed reason=\"io-error: 
%s\"",
                    s->id, io->error);
                smtp_free(s, "IO error");
                break;
@@ -2183,7 +2183,7 @@ smtp_reply(struct smtp_session *s, char 
        case '4':
                if (s->flags & SF_BADINPUT) {
                        log_info("%016"PRIx64" smtp "
-                           "event=bad-input result=%.*s",
+                           "event=bad-input result=\"%.*s\"",
                            s->id, n, buf);
                }
                else if (s->state == STATE_AUTH_INIT) {
@@ -2201,7 +2201,7 @@ smtp_reply(struct smtp_session *s, char 
                else {
                        strnvis(tmp, s->cmd, sizeof tmp, VIS_SAFE | VIS_CSTYLE);
                        log_info("%016"PRIx64" smtp "
-                           "event=failed-command command=%s result=%.*s",
+                           "event=failed-command command=\"%s\" 
result=\"%.*s\"",
                            s->id, tmp, n, buf);
                }
                break;

Reply via email to