diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2018-01-30 12:44:56 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2018-01-30 12:44:56 +0000 |
commit | aab307ac82a9fb70f7f6eeb22b9233c8f76a872d (patch) | |
tree | abe5ff65d995fa38c7a71741d852c2e5d77a8c45 | |
parent | dc8fa2f4c92445193b6697c6ee91550ad14038b8 (diff) |
don't reject smtp responses containing non-printable chars as long
as the status is valid. use strnvis() for displaying status lines
in "smtpctl show queue".
ok gilles@ sunil@
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 9 | ||||
-rw-r--r-- | usr.sbin/smtpd/util.c | 9 |
2 files changed, 7 insertions, 11 deletions
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 5642d1b5da2..76949609c1f 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.156 2018/01/26 08:00:54 eric Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.157 2018/01/30 12:44:55 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -41,6 +41,7 @@ #include <string.h> #include <time.h> #include <unistd.h> +#include <vis.h> #include <limits.h> #include "smtpd.h" @@ -1165,7 +1166,7 @@ static void show_queue_envelope(struct envelope *e, int online) { const char *src = "?", *agent = "?"; - char status[128], runstate[128]; + char status[128], runstate[128], errline[LINE_MAX]; status[0] = '\0'; @@ -1210,6 +1211,8 @@ show_queue_envelope(struct envelope *e, int online) else if (e->ss.ss_family == AF_INET6) src = "inet6"; + strnvis(errline, e->errorline, sizeof(errline), 0); + printf("%016"PRIx64 "|%s|%s|%s|%s@%s|%s@%s|%s@%s" "|%zu|%zu|%zu|%zu|%s|%s\n", @@ -1228,7 +1231,7 @@ show_queue_envelope(struct envelope *e, int online) (size_t) e->lasttry, (size_t) e->retry, runstate, - e->errorline); + errline); } static void diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 4a509ed4520..3700c7627c0 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.132 2017/01/09 14:49:22 reyk Exp $ */ +/* $OpenBSD: util.c,v 1.133 2018/01/30 12:44:55 eric Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -685,8 +685,6 @@ session_socket_error(int fd) const char * parse_smtp_response(char *line, size_t len, char **msg, int *cont) { - size_t i; - if (len >= LINE_MAX) return "line too long"; @@ -708,11 +706,6 @@ parse_smtp_response(char *line, size_t len, char **msg, int *cont) !isdigit((unsigned char)line[2])) return "reply code out of range"; - /* validate reply message */ - for (i = 0; i < len; i++) - if (!isprint((unsigned char)line[i])) - return "non-printable character in reply"; - return NULL; } |