diff options
| author | simonb <simonb@NetBSD.org> | 2000-06-25 13:32:34 +0000 |
|---|---|---|
| committer | simonb <simonb@NetBSD.org> | 2000-06-25 13:32:34 +0000 |
| commit | dde4b6e5d0b7cee5a64c0975b4be81f9302fc341 (patch) | |
| tree | b46b5701734f7bfeef9afa8b02c6c625b6513372 /libexec | |
| parent | c543a6625360a5bbfa2c143457e430272783ec9f (diff) | |
Use LOGIN_NAME_MAX for sizing the mailname buffer. Allows usernames
longer than 8 characters to run jobs instead of aborting because
"File ... is in wrong format".
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/atrun/atrun.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/libexec/atrun/atrun.c b/libexec/atrun/atrun.c index 77c16b58e01..cf1ca6c2d30 100644 --- a/libexec/atrun/atrun.c +++ b/libexec/atrun/atrun.c @@ -1,4 +1,4 @@ -/* $NetBSD: atrun.c,v 1.7 1999/08/16 03:08:33 simonb Exp $ */ +/* $NetBSD: atrun.c,v 1.8 2000/06/25 13:32:34 simonb Exp $ */ /* * atrun.c - run jobs queued by at; run with root privileges. @@ -56,21 +56,13 @@ #include "pathnames.h" #include "atrun.h" -/* File scope defines */ - -#if (MAXLOGNAME-1) > UT_NAMESIZE -#define LOGNAMESIZE UT_NAMESIZE -#else -#define LOGNAMESIZE (MAXLOGNAME-1) -#endif - /* File scope variables */ static char *namep; #if 0 static char rcsid[] = "$OpenBSD: atrun.c,v 1.7 1997/09/08 22:12:10 millert Exp $"; #else -__RCSID("$NetBSD: atrun.c,v 1.7 1999/08/16 03:08:33 simonb Exp $"); +__RCSID("$NetBSD: atrun.c,v 1.8 2000/06/25 13:32:34 simonb Exp $"); #endif static int debug = 0; @@ -152,7 +144,7 @@ run_file(filename, uid, gid) pid_t pid; int fd_out, fd_in; int queue; - char mailbuf[LOGNAMESIZE + 1], fmt[49]; + char mailbuf[LOGIN_NAME_MAX], fmt[49]; char *mailname = NULL; FILE *stream; int send_mail = 0; @@ -239,7 +231,7 @@ run_file(filename, uid, gid) (void)snprintf(fmt, sizeof(fmt), "#!/bin/sh\n# atrun uid=%%ld gid=%%ld\n# mail %%%ds %%d", - LOGNAMESIZE); + LOGIN_NAME_MAX); if (fscanf(stream, fmt, &nuid, &ngid, mailbuf, &send_mail) != 4) { syslog(LOG_ERR, "File %s is in wrong format - aborting", filename); |
