Source-Changes-HG archive

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

[src/netbsd-3]: src/usr.sbin/user Pull up revision 1.80 (requested by agc in ...



details:   https://anonhg.NetBSD.org/src/rev/06ddb1fa5da8
branches:  netbsd-3
changeset: 576341:06ddb1fa5da8
user:      tron <tron%NetBSD.org@localhost>
date:      Wed Jun 29 12:18:49 2005 +0000

description:
Pull up revision 1.80 (requested by agc in ticket #492):
Be consistent when deleting a non-existent group - tell if the group is
non-existent.
Problem noted by Geert Hendrickx, fix from Liam J. Foy.

diffstat:

 usr.sbin/user/user.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r df39fa3ff1fd -r 06ddb1fa5da8 usr.sbin/user/user.c
--- a/usr.sbin/user/user.c      Wed Jun 29 12:17:29 2005 +0000
+++ b/usr.sbin/user/user.c      Wed Jun 29 12:18:49 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.77.2.2 2005/04/13 15:59:37 tron Exp $ */
+/* $NetBSD: user.c,v 1.77.2.3 2005/06/29 12:18:49 tron Exp $ */
 
 /*
  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
@@ -35,7 +35,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1999 \
                The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: user.c,v 1.77.2.2 2005/04/13 15:59:37 tron Exp $");
+__RCSID("$NetBSD: user.c,v 1.77.2.3 2005/06/29 12:18:49 tron Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1990,6 +1990,9 @@
        if (argc != 1) {
                usermgmt_usage("groupdel");
        }
+       if (getgrnam(*argv) == NULL) {
+               errx(EXIT_FAILURE, "No such group `%s'", *argv);
+       }
        checkeuid();
        openlog("groupdel", LOG_PID, LOG_USER);
        if (!modify_gid(*argv, NULL)) {
@@ -2057,7 +2060,7 @@
                err(EXIT_FAILURE, "Duplicate which gid?");
        }
        if ((grp = getgrnam(*argv)) == NULL) {
-               err(EXIT_FAILURE, "can't find group `%s' to modify", *argv);
+               errx(EXIT_FAILURE, "can't find group `%s' to modify", *argv);
        }
        if (!is_local(*argv, _PATH_GROUP)) {
                errx(EXIT_FAILURE, "Group `%s' must be a local group", *argv);



Home | Main Index | Thread Index | Old Index