summaryrefslogtreecommitdiff
path: root/usr.sbin/cron
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-04-26 17:15:38 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-04-26 17:15:38 +0000
commitbf7ac075f16cb48e474583da9ade56d39cfd62c0 (patch)
treeb019c84bd5c3397e7828b5148e0dfaa0d450d082 /usr.sbin/cron
parente0ad97e101a7fd8292fb50c8438bcd6edee81a83 (diff)
isalnum() does not match '_' so check it explicitly. This allows cron
to send mail to usernames with a '_' in them. From David Gwynne.
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r--usr.sbin/cron/do_command.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c
index c8545745fde..c43537341c0 100644
--- a/usr.sbin/cron/do_command.c
+++ b/usr.sbin/cron/do_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: do_command.c,v 1.25 2003/07/30 20:20:01 millert Exp $ */
+/* $OpenBSD: do_command.c,v 1.26 2004/04/26 17:15:37 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@@ -22,7 +22,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char const rcsid[] = "$OpenBSD: do_command.c,v 1.25 2003/07/30 20:20:01 millert Exp $";
+static char const rcsid[] = "$OpenBSD: do_command.c,v 1.26 2004/04/26 17:15:37 millert Exp $";
#endif
#include "cron.h"
@@ -509,7 +509,8 @@ safe_p(const char *usernm, const char *s) {
for (t = s, first = 1; (ch = *t++) != '\0'; first = 0) {
if (isascii(ch) && isprint(ch) &&
- (isalnum(ch) || (!first && strchr(safe_delim, ch))))
+ (isalnum(ch) || ch == '_' ||
+ (!first && strchr(safe_delim, ch))))
continue;
log_it(usernm, getpid(), "UNSAFE", s);
return (FALSE);