diff options
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r-- | usr.sbin/smtpd/util.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 3637d4dfff7..df7fabad782 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.137 2018/09/02 21:06:44 gilles Exp $ */ +/* $OpenBSD: util.c,v 1.138 2018/10/31 16:32:12 gilles Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -541,6 +541,21 @@ valid_domainpart(const char *s) } int +valid_smtp_response(const char *s) +{ + if (strlen(s) < 5) + return 0; + + if ((s[0] < '2' || s[0] > '5') || + (s[1] < '0' || s[1] > '9') || + (s[2] < '0' || s[2] > '9') || + (s[3] != ' ')) + return 0; + + return 1; +} + +int secure_file(int fd, char *path, char *userdir, uid_t uid, int mayread) { char buf[PATH_MAX]; |