Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/cron/dist Fix multiple problems in previous com...



details:   https://anonhg.NetBSD.org/src/rev/565b4cab5973
branches:  trunk
changeset: 777791:565b4cab5973
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Mar 04 18:38:31 2012 +0000

description:
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.

diffstat:

 external/bsd/cron/dist/crontab.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 6f8fd02bd2ed -r 565b4cab5973 external/bsd/cron/dist/crontab.c
--- a/external/bsd/cron/dist/crontab.c  Sun Mar 04 18:15:35 2012 +0000
+++ b/external/bsd/cron/dist/crontab.c  Sun Mar 04 18:38:31 2012 +0000
@@ -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 @@
        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 @@
         */
        (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
         */



Home | Main Index | Thread Index | Old Index