o Instead of passing "*system*" as the fname to process_crontab()
for the system crontab file, pass a NULL pointer instead. This prevents someone from creating a "*system*" file in the tabs directory that acts as an alternate root crontab. from openbsd
This commit is contained in:
parent
354a8ea84b
commit
4fd217fda9
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: database.c,v 1.4 1998/01/31 14:40:26 christos Exp $ */
|
||||
/* $NetBSD: database.c,v 1.5 2002/08/03 02:03:00 itojun Exp $ */
|
||||
|
||||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
@ -22,7 +22,7 @@
|
||||
#if 0
|
||||
static char rcsid[] = "Id: database.c,v 2.8 1994/01/15 20:43:43 vixie Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: database.c,v 1.4 1998/01/31 14:40:26 christos Exp $");
|
||||
__RCSID("$NetBSD: database.c,v 1.5 2002/08/03 02:03:00 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -93,9 +93,8 @@ load_database(old_db)
|
||||
new_db.head = new_db.tail = NULL;
|
||||
|
||||
if (syscron_stat.st_mtime) {
|
||||
process_crontab("root", "*system*",
|
||||
SYSCRONTAB, &syscron_stat,
|
||||
&new_db, old_db);
|
||||
process_crontab("root", NULL, SYSCRONTAB, &syscron_stat,
|
||||
&new_db, old_db);
|
||||
}
|
||||
|
||||
/* we used to keep this dir open all the time, for the sake of
|
||||
@ -210,7 +209,11 @@ process_crontab(uname, fname, tabname, statbuf, new_db, old_db)
|
||||
int crontab_fd = OK - 1;
|
||||
user *u;
|
||||
|
||||
if (strcmp(fname, "*system*") && !(pw = getpwnam(uname))) {
|
||||
if (fname == NULL) {
|
||||
/* must be set to something.
|
||||
*/
|
||||
fname = "*system*";
|
||||
} else if ((pw = getpwnam(uname)) == NULL) {
|
||||
/* file doesn't have a user in passwd file.
|
||||
*/
|
||||
log_it(fname, getpid(), "ORPHAN", "no passwd entry");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: do_command.c,v 1.10 2002/03/23 09:38:02 jdolecek Exp $ */
|
||||
/* $NetBSD: do_command.c,v 1.11 2002/08/03 02:03:00 itojun Exp $ */
|
||||
|
||||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
@ -22,7 +22,7 @@
|
||||
#if 0
|
||||
static char rcsid[] = "Id: do_command.c,v 2.12 1994/01/15 20:43:43 vixie Exp ";
|
||||
#else
|
||||
__RCSID("$NetBSD: do_command.c,v 1.10 2002/03/23 09:38:02 jdolecek Exp $");
|
||||
__RCSID("$NetBSD: do_command.c,v 1.11 2002/08/03 02:03:00 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -198,6 +198,8 @@ child_process(e, u)
|
||||
#ifdef SYSLOG
|
||||
closelog();
|
||||
#endif
|
||||
if (setlogin(usernm) < 0)
|
||||
syslog(LOG_ERR, "setlogin() failure: %m");
|
||||
|
||||
/* get new pgrp, void tty, etc.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user