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.
This commit is contained in:
parent
8ff1e4e407
commit
6fdfc9ef36
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: user.c,v 1.79 2005/04/05 22:54:26 agc Exp $ */
|
/* $NetBSD: user.c,v 1.80 2005/06/14 18:29:58 agc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||||
@ -35,7 +35,7 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
__COPYRIGHT("@(#) Copyright (c) 1999 \
|
__COPYRIGHT("@(#) Copyright (c) 1999 \
|
||||||
The NetBSD Foundation, Inc. All rights reserved.");
|
The NetBSD Foundation, Inc. All rights reserved.");
|
||||||
__RCSID("$NetBSD: user.c,v 1.79 2005/04/05 22:54:26 agc Exp $");
|
__RCSID("$NetBSD: user.c,v 1.80 2005/06/14 18:29:58 agc Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -1990,6 +1990,9 @@ groupdel(int argc, char **argv)
|
|||||||
if (argc != 1) {
|
if (argc != 1) {
|
||||||
usermgmt_usage("groupdel");
|
usermgmt_usage("groupdel");
|
||||||
}
|
}
|
||||||
|
if (getgrnam(*argv) == NULL) {
|
||||||
|
errx(EXIT_FAILURE, "No such group `%s'", *argv);
|
||||||
|
}
|
||||||
checkeuid();
|
checkeuid();
|
||||||
openlog("groupdel", LOG_PID, LOG_USER);
|
openlog("groupdel", LOG_PID, LOG_USER);
|
||||||
if (!modify_gid(*argv, NULL)) {
|
if (!modify_gid(*argv, NULL)) {
|
||||||
@ -2057,7 +2060,7 @@ groupmod(int argc, char **argv)
|
|||||||
err(EXIT_FAILURE, "Duplicate which gid?");
|
err(EXIT_FAILURE, "Duplicate which gid?");
|
||||||
}
|
}
|
||||||
if ((grp = getgrnam(*argv)) == NULL) {
|
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)) {
|
if (!is_local(*argv, _PATH_GROUP)) {
|
||||||
errx(EXIT_FAILURE, "Group `%s' must be a local group", *argv);
|
errx(EXIT_FAILURE, "Group `%s' must be a local group", *argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user