Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/cron o Instead of passing "*system*" as the fname t...
details: https://anonhg.NetBSD.org/src/rev/4752d33cac35
branches: trunk
changeset: 534793:4752d33cac35
user: itojun <itojun%NetBSD.org@localhost>
date: Sat Aug 03 02:03:00 2002 +0000
description:
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
diffstat:
usr.sbin/cron/database.c | 15 +++++++++------
usr.sbin/cron/do_command.c | 6 ++++--
2 files changed, 13 insertions(+), 8 deletions(-)
diffs (70 lines):
diff -r 6b1e287bc759 -r 4752d33cac35 usr.sbin/cron/database.c
--- a/usr.sbin/cron/database.c Sat Aug 03 01:24:03 2002 +0000
+++ b/usr.sbin/cron/database.c Sat Aug 03 02:03:00 2002 +0000
@@ -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 @@
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 @@
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");
diff -r 6b1e287bc759 -r 4752d33cac35 usr.sbin/cron/do_command.c
--- a/usr.sbin/cron/do_command.c Sat Aug 03 01:24:03 2002 +0000
+++ b/usr.sbin/cron/do_command.c Sat Aug 03 02:03:00 2002 +0000
@@ -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 @@
#ifdef SYSLOG
closelog();
#endif
+ if (setlogin(usernm) < 0)
+ syslog(LOG_ERR, "setlogin() failure: %m");
/* get new pgrp, void tty, etc.
*/
Home |
Main Index |
Thread Index |
Old Index