Module Name: src Committed By: tron Date: Sun Mar 4 18:38:31 UTC 2012
Modified Files: src/external/bsd/cron/dist: crontab.c Log Message: Fix multiple problems in previous commit: 1.) Correct set-uid check to allow "root" to run "crontab -l" again. 2.) Don't the the last error reported in "errno" in case "crontab" is not installed set-uid "root". As no system-call failed "errno" is set to zero. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/cron/dist/crontab.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/cron/dist/crontab.c diff -u src/external/bsd/cron/dist/crontab.c:1.4 src/external/bsd/cron/dist/crontab.c:1.5 --- src/external/bsd/cron/dist/crontab.c:1.4 Fri Mar 2 19:26:40 2012 +++ src/external/bsd/cron/dist/crontab.c Sun Mar 4 18:38:31 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: crontab.c,v 1.4 2012/03/02 19:26:40 christos Exp $ */ +/* $NetBSD: crontab.c,v 1.5 2012/03/04 18:38:31 tron Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -25,7 +25,7 @@ #if 0 static char rcsid[] = "Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp"; #else -__RCSID("$NetBSD: crontab.c,v 1.4 2012/03/02 19:26:40 christos Exp $"); +__RCSID("$NetBSD: crontab.c,v 1.5 2012/03/04 18:38:31 tron Exp $"); #endif #endif @@ -97,8 +97,8 @@ main(int argc, char *argv[]) { ruid = getuid(); rgid = getgid(); - if (euid == ruid || euid) - err(ERROR_EXIT, "Not installed setuid root"); + if (euid == ruid && ruid != 0) + errx(ERROR_EXIT, "Not installed setuid root"); (void)setvbuf(stderr, NULL, _IOLBF, 0); parse_args(argc, argv); /* sets many globals, opens a file */ @@ -599,7 +599,7 @@ replace_cmd(void) { */ (void)fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n"); (void)fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now)); - (void)fprintf(tmp, "# (Cron version %s -- %s)\n", CRON_VERSION, "$NetBSD: crontab.c,v 1.4 2012/03/02 19:26:40 christos Exp $"); + (void)fprintf(tmp, "# (Cron version %s -- %s)\n", CRON_VERSION, "$NetBSD: crontab.c,v 1.5 2012/03/04 18:38:31 tron Exp $"); /* copy the crontab to the tmp */