2 * Copyright (c) 1990 - 1994, Julianne Frances Haugh
3 * Copyright (c) 1996 - 2000, Marek Michałkiewicz
4 * Copyright (c) 2001 - 2006, Tomasz Kłoczko
5 * Copyright (c) 2007 - 2009, Nicolas François
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the copyright holders or contributors may not be used to
17 * endorse or promote products derived from this software without
18 * specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #ident "$Id: gpasswd.c 2851 2009-04-30 21:39:38Z nekral-guest $"
44 #include <sys/types.h>
48 #include "prototypes.h"
53 #include "exitcodes.h"
58 /* The name of this command, as it is invoked */
62 /* Indicate if shadow groups are enabled on the system
63 * (/etc/gshadow present) */
64 static bool is_shadowgrp;
67 /* Flags set by options */
68 static bool aflg = false;
69 static bool Aflg = false;
70 static bool dflg = false;
71 static bool Mflg = false;
72 static bool rflg = false;
73 static bool Rflg = false;
74 /* The name of the group that is being affected */
75 static char *group = NULL;
76 /* The name of the user being added (-a) or removed (-d) from group */
77 static char *user = NULL;
78 /* The new list of members set with -M */
79 static char *members = NULL;
81 /* The new list of group administrators set with -A */
82 static char *admins = NULL;
84 /* The name of the caller */
85 static char *myname = NULL;
86 /* The UID of the caller */
88 /* Indicate if gpasswd was called by root */
89 #define amroot (0 == bywho)
91 /* The number of retries for th user to provide and repeat a new password */
96 /* local function prototypes */
97 static void usage (void);
98 static RETSIGTYPE catch_signals (int killed);
99 static bool is_valid_user_list (const char *users);
100 static void process_flags (int argc, char **argv);
101 static void check_flags (int argc, int opt_index);
102 static void open_files (void);
103 static void close_files (void);
105 static void get_group (struct group *gr, struct sgrp *sg);
106 static void check_perms (const struct group *gr, const struct sgrp *sg);
107 static void update_group (struct group *gr, struct sgrp *sg);
108 static void change_passwd (struct group *gr, struct sgrp *sg);
110 static void get_group (struct group *gr);
111 static void check_perms (const struct group *gr);
112 static void update_group (struct group *gr);
113 static void change_passwd (struct group *gr);
115 static void log_gpasswd_failure (const char *suffix);
116 static void log_gpasswd_failure_system (unused void *arg);
117 static void log_gpasswd_failure_group (unused void *arg);
119 static void log_gpasswd_failure_gshadow (unused void *arg);
121 static void log_gpasswd_success (const char *suffix);
122 static void log_gpasswd_success_system (unused void *arg);
123 static void log_gpasswd_success_group (unused void *arg);
125 static void log_gpasswd_success_gshadow (unused void *arg);
129 * usage - display usage message
131 static void usage (void)
134 _("Usage: %s [option] GROUP\n"
137 " -a, --add USER add USER to GROUP\n"
138 " -d, --delete USER remove USER from GROUP\n"
139 " -r, --remove-password remove the GROUP's password\n"
140 " -R, --restrict restrict access to GROUP to its members\n"
141 " -M, --members USER,... set the list of members of GROUP\n"
146 _(" -A, --administrators ADMIN,...\n"
147 " set the list of administrators for GROUP\n"
148 "Except for the -A and -M options, the options cannot be combined.\n")
150 _("The options cannot be combined.\n")
157 * catch_signals - set or reset termio modes.
159 * catch_signals() is called before processing begins. signal() is then
160 * called with catch_signals() as the signal handler. If signal later
161 * calls catch_signals() with a signal number, the terminal modes are
164 static RETSIGTYPE catch_signals (int killed)
175 (void) putchar ('\n');
176 (void) fflush (stdout);
182 * is_valid_user_list - check a comma-separated list of user names for validity
184 * is_valid_user_list scans a comma-separated list of user names and
185 * checks that each listed name exists is the user database.
187 * It returns true if the list of users is valid.
189 static bool is_valid_user_list (const char *users)
191 char *username, *end;
192 bool is_valid = true;
193 char *tmpusers = xstrdup (users);
195 for (username = tmpusers;
196 (NULL != username) && ('\0' != *username);
198 end = strchr (username, ',');
205 * This user must exist.
208 /* local, no need for xgetpwnam */
209 if (getpwnam (username) == NULL) {
210 fprintf (stderr, _("%s: user '%s' does not exist\n"),
221 static void failure (void)
223 fprintf (stderr, _("%s: Permission denied.\n"), Prog);
224 log_gpasswd_failure (": Permission denied");
229 * process_flags - process the command line options and arguments
231 static void process_flags (int argc, char **argv)
234 int option_index = 0;
235 static struct option long_options[] = {
236 {"add", required_argument, NULL, 'a'},
237 {"delete", required_argument, NULL, 'd'},
238 {"remove-password", no_argument, NULL, 'r'},
239 {"restrict", no_argument, NULL, 'R'},
240 {"administrators", required_argument, NULL, 'A'},
241 {"members", required_argument, NULL, 'M'},
242 {NULL, 0, NULL, '\0'}
245 while ((flag = getopt_long (argc, argv, "a:A:d:gM:rR", long_options, &option_index)) != -1) {
247 case 'a': /* add a user */
250 /* local, no need for xgetpwnam */
251 if (getpwnam (user) == NULL) {
253 _("%s: user '%s' does not exist\n"),
259 case 'A': /* set the list of administrators */
262 _("%s: shadow group passwords required for -A\n"),
264 exit (E_GSHADOW_NOTFOUND);
267 if (!is_valid_user_list (admins)) {
272 #endif /* SHADOWGRP */
273 case 'd': /* delete a user */
277 case 'g': /* no-op from normal password */
279 case 'M': /* set the list of members */
281 if (!is_valid_user_list (members)) {
286 case 'r': /* remove group password */
289 case 'R': /* restrict group password */
297 /* Get the name of the group that is being affected. */
298 group = argv[optind];
300 check_flags (argc, optind);
304 * check_flags - check the validity of options
306 static void check_flags (int argc, int opt_index)
310 * Make sure exclusive flags are exclusive
332 * Make sure one (and only one) group was provided
334 if ((argc != (opt_index+1)) || (NULL == group)) {
340 * open_files - lock and open the group databases
342 * It will call exit in case of error.
344 static void open_files (void)
346 if (gr_lock () == 0) {
348 _("%s: cannot lock %s; try again later.\n"),
352 add_cleanup (cleanup_unlock_group, NULL);
356 if (sgr_lock () == 0) {
358 _("%s: cannot lock %s; try again later.\n"),
359 Prog, sgr_dbname ());
362 add_cleanup (cleanup_unlock_gshadow, NULL);
364 #endif /* SHADOWGRP */
366 add_cleanup (log_gpasswd_failure_system, NULL);
368 if (gr_open (O_RDWR) == 0) {
370 _("%s: cannot open %s\n"),
372 SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ()));
378 if (sgr_open (O_RDWR) == 0) {
380 _("%s: cannot open %s\n"),
381 Prog, sgr_dbname ());
382 SYSLOG ((LOG_WARN, "cannot open %s", sgr_dbname ()));
385 add_cleanup (log_gpasswd_failure_gshadow, NULL);
387 #endif /* SHADOWGRP */
389 add_cleanup (log_gpasswd_failure_group, NULL);
390 del_cleanup (log_gpasswd_failure_system);
393 static void log_gpasswd_failure (const char *suffix)
400 "%s failed to add user %s to group %s%s",
401 myname, user, group, suffix));
404 "%s failed to add user %s to group %s%s",
405 myname, user, group, suffix);
407 audit_logger (AUDIT_USER_ACCT, Prog,
410 SHADOW_AUDIT_FAILURE);
414 "%s failed to remove user %s from group %s%s",
415 myname, user, group, suffix));
418 "%s failed to remove user %s from group %s%s",
419 myname, user, group, suffix);
421 audit_logger (AUDIT_USER_ACCT, Prog,
424 SHADOW_AUDIT_FAILURE);
428 "%s failed to remove password of group %s%s",
429 myname, group, suffix));
432 "%s failed to remove password of group %s%s",
433 myname, group, suffix);
435 audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
438 SHADOW_AUDIT_FAILURE);
442 "%s failed to restrict access to group %s%s",
443 myname, group, suffix));
446 "%s failed to restrict access to group %s%s",
447 myname, group, suffix);
449 audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
452 SHADOW_AUDIT_FAILURE);
454 } else if (Aflg || Mflg) {
458 "%s failed to set the administrators of group %s to %s%s",
459 myname, group, admins, suffix));
462 "%s failed to set the administrators of group %s to %s%s",
463 myname, group, admins, suffix);
465 audit_logger (AUDIT_USER_ACCT, Prog,
468 SHADOW_AUDIT_FAILURE);
471 #endif /* SHADOWGRP */
474 "%s failed to set the members of group %s to %s%s",
475 myname, group, members, suffix));
478 "%s failed to set the members of group %s to %s%s",
479 myname, group, members, suffix);
481 audit_logger (AUDIT_USER_ACCT, Prog,
484 SHADOW_AUDIT_FAILURE);
489 "%s failed to change password of group %s%s",
490 myname, group, suffix));
493 "%s failed to change password of group %s%s",
494 myname, group, suffix);
496 audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
499 SHADOW_AUDIT_FAILURE);
504 static void log_gpasswd_failure_system (unused void *arg)
506 log_gpasswd_failure ("");
509 static void log_gpasswd_failure_group (unused void *arg)
512 snprintf (buf, 1023, " in %s", gr_dbname ());
514 log_gpasswd_failure (buf);
518 static void log_gpasswd_failure_gshadow (unused void *arg)
521 snprintf (buf, 1023, " in %s", sgr_dbname ());
523 log_gpasswd_failure (buf);
525 #endif /* SHADOWGRP */
527 static void log_gpasswd_success (const char *suffix)
534 "user %s added by %s to group %s%s",
535 user, myname, group, suffix));
538 "user %s added by %s to group %s%s",
539 user, myname, group, suffix);
541 audit_logger (AUDIT_USER_ACCT, Prog,
544 SHADOW_AUDIT_SUCCESS);
548 "user %s removed by %s from group %s%s",
549 user, myname, group, suffix));
552 "user %s removed by %s from group %s%s",
553 user, myname, group, suffix);
555 audit_logger (AUDIT_USER_ACCT, Prog,
558 SHADOW_AUDIT_SUCCESS);
562 "password of group %s removed by %s%s",
563 group, myname, suffix));
566 "password of group %s removed by %s%s",
567 group, myname, suffix);
569 audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
572 SHADOW_AUDIT_SUCCESS);
576 "access to group %s restricted by %s%s",
577 group, myname, suffix));
580 "access to group %s restricted by %s%s",
581 group, myname, suffix);
583 audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
586 SHADOW_AUDIT_SUCCESS);
588 } else if (Aflg || Mflg) {
592 "administrators of group %s set by %s to %s%s",
593 group, myname, admins, suffix));
596 "administrators of group %s set by %s to %s%s",
597 group, myname, admins, suffix);
599 audit_logger (AUDIT_USER_ACCT, Prog,
602 SHADOW_AUDIT_SUCCESS);
605 #endif /* SHADOWGRP */
608 "members of group %s set by %s to %s%s",
609 group, myname, members, suffix));
612 "members of group %s set by %s to %s%s",
613 group, myname, members, suffix);
615 audit_logger (AUDIT_USER_ACCT, Prog,
618 SHADOW_AUDIT_SUCCESS);
623 "password of group %s changed by %s%s",
624 group, myname, suffix));
627 "password of group %s changed by %s%s",
628 group, myname, suffix);
630 audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
633 SHADOW_AUDIT_SUCCESS);
638 static void log_gpasswd_success_system (unused void *arg)
640 log_gpasswd_success ("");
643 static void log_gpasswd_success_group (unused void *arg)
646 snprintf (buf, 1023, " in %s", gr_dbname ());
648 log_gpasswd_success (buf);
652 static void log_gpasswd_success_gshadow (unused void *arg)
655 snprintf (buf, 1023, " in %s", sgr_dbname ());
657 log_gpasswd_success (buf);
659 #endif /* SHADOWGRP */
662 * close_files - close and unlock the group databases
664 * This cause any changes in the databases to be committed.
666 * It will call exit in case of error.
668 static void close_files (void)
670 if (gr_close () == 0) {
672 _("%s: failure while writing changes to %s\n"),
676 add_cleanup (log_gpasswd_success_group, NULL);
677 del_cleanup (log_gpasswd_failure_group);
679 cleanup_unlock_group (NULL);
680 del_cleanup (cleanup_unlock_group);
684 if (sgr_close () == 0) {
686 _("%s: failure while writing changes to %s\n"),
687 Prog, sgr_dbname ());
690 add_cleanup (log_gpasswd_success_gshadow, NULL);
691 del_cleanup (log_gpasswd_failure_gshadow);
693 cleanup_unlock_gshadow (NULL);
694 del_cleanup (cleanup_unlock_gshadow);
696 #endif /* SHADOWGRP */
698 log_gpasswd_success_system (NULL);
699 del_cleanup (log_gpasswd_success_group);
702 del_cleanup (log_gpasswd_success_gshadow);
708 * check_perms - check if the user is allowed to change the password of
709 * the specified group.
711 * It only returns if the user is allowed.
714 static void check_perms (const struct group *gr, const struct sgrp *sg)
716 static void check_perms (const struct group *gr)
720 * Only root can use the -M and -A options.
722 if (!amroot && (Aflg || Mflg)) {
729 * The policy here for changing a group is that
730 * 1) you must be root or
731 * 2) you must be listed as an administrative member.
732 * Administrative members can do anything to a group that
735 if (!amroot && !is_on_list (sg->sg_adm, myname)) {
739 #endif /* SHADOWGRP */
741 #ifdef FIRST_MEMBER_IS_ADMIN
743 * The policy here for changing a group is that
744 * 1) you must be root or
745 * 2) you must be the first listed member of the group.
746 * The first listed member of a group can do anything to
747 * that group that the root user can. The rationale for
748 * this hack is that the FIRST user is probably the most
749 * important user in this entire group.
751 * This feature enabled by default could be a security
752 * problem when installed on existing systems where the
753 * first group member might be just a normal user.
757 if (gr->gr_mem[0] == (char *) 0) {
761 if (strcmp (gr->gr_mem[0], myname) != 0) {
765 #else /* ! FIRST_MEMBER_IS_ADMIN */
774 * update_group - Update the group information in the databases
777 static void update_group (struct group *gr, struct sgrp *sg)
779 static void update_group (struct group *gr)
782 if (gr_update (gr) == 0) {
784 _("%s: failed to prepare the new %s entry '%s'\n"),
785 Prog, gr_dbname (), gr->gr_name);
789 if (is_shadowgrp && (sgr_update (sg) == 0)) {
791 _("%s: failed to prepare the new %s entry '%s'\n"),
792 Prog, sgr_dbname (), sg->sg_name);
795 #endif /* SHADOWGRP */
799 * get_group - get the current information for the group
801 * The information are copied in group structure(s) so that they can be
804 * Note: If !is_shadowgrp, *sg will not be initialized.
807 static void get_group (struct group *gr, struct sgrp *sg)
809 static void get_group (struct group *gr)
812 struct group const*tmpgr = NULL;
814 struct sgrp const*tmpsg = NULL;
817 if (gr_open (O_RDONLY) == 0) {
818 fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ());
819 SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ()));
823 tmpgr = gr_locate (group);
826 _("%s: group '%s' does not exist in %s\n"),
827 Prog, group, gr_dbname ());
832 gr->gr_name = xstrdup (tmpgr->gr_name);
833 gr->gr_passwd = xstrdup (tmpgr->gr_passwd);
834 gr->gr_mem = dup_list (tmpgr->gr_mem);
836 if (gr_close () == 0) {
838 _("%s: failure while closing read-only %s\n"),
841 "failure while closing read-only %s",
848 if (sgr_open (O_RDONLY) == 0) {
850 _("%s: cannot open %s\n"),
851 Prog, sgr_dbname ());
852 SYSLOG ((LOG_WARN, "cannot open %s", sgr_dbname ()));
855 tmpsg = sgr_locate (group);
858 sg->sg_name = xstrdup (tmpsg->sg_name);
859 sg->sg_passwd = xstrdup (tmpsg->sg_passwd);
861 sg->sg_mem = dup_list (tmpsg->sg_mem);
862 sg->sg_adm = dup_list (tmpsg->sg_adm);
864 sg->sg_name = xstrdup (group);
865 sg->sg_passwd = gr->gr_passwd;
866 gr->gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
868 sg->sg_mem = dup_list (gr->gr_mem);
870 sg->sg_adm = (char **) xmalloc (sizeof (char *) * 2);
871 #ifdef FIRST_MEMBER_IS_ADMIN
873 sg->sg_adm[0] = xstrdup (sg->sg_mem[0]);
874 sg->sg_adm[1] = NULL;
878 sg->sg_adm[0] = NULL;
882 if (sgr_close () == 0) {
884 _("%s: failure while closing read-only %s\n"),
885 Prog, sgr_dbname ());
887 "failure while closing read-only %s",
892 #endif /* SHADOWGRP */
896 * change_passwd - change the group's password
898 * Get the new password from the user and update the password in the
901 * It will call exit in case of error.
904 static void change_passwd (struct group *gr, struct sgrp *sg)
906 static void change_passwd (struct group *gr)
910 static char pass[BUFSIZ];
914 * A new password is to be entered and it must be encrypted, etc.
915 * The password will be prompted for twice, and both entries must be
916 * identical. There is no need to validate the old password since
917 * the invoker is either the group owner, or root.
919 printf (_("Changing the password for group %s\n"), group);
921 for (retries = 0; retries < RETRIES; retries++) {
922 cp = getpass (_("New Password: "));
929 cp = getpass (_("Re-enter new password: "));
934 if (strcmp (pass, cp) == 0) {
940 memzero (pass, sizeof pass);
942 if (retries + 1 < RETRIES) {
943 puts (_("They don't match; try again"));
947 if (retries == RETRIES) {
948 fprintf (stderr, _("%s: Try again later\n"), Prog);
952 cp = pw_encrypt (pass, crypt_make_salt (NULL, NULL));
953 memzero (pass, sizeof pass);
965 * gpasswd - administer the /etc/group file
967 int main (int argc, char **argv)
973 struct passwd *pw = NULL;
980 (void) setlocale (LC_ALL, "");
981 (void) bindtextdomain (PACKAGE, LOCALEDIR);
982 (void) textdomain (PACKAGE);
985 * Make a note of whether or not this command was invoked by root.
986 * This will be used to bypass certain checks later on. Also, set
987 * the real user ID to match the effective user ID. This will
988 * prevent the invoker from issuing signals which would interfere
992 Prog = Basename (argv[0]);
995 setbuf (stdout, NULL);
996 setbuf (stderr, NULL);
999 is_shadowgrp = sgr_file_present ();
1003 * Determine the name of the user that invoked this command. This
1004 * is really hit or miss because there are so many ways that command
1005 * can be executed and so many ways to trip up the routines that
1006 * report the user name.
1008 pw = get_my_pwent ();
1010 fprintf (stderr, _("%s: Cannot determine your user name.\n"),
1013 "Cannot determine the user name of the caller (UID %lu)",
1014 (unsigned long) getuid ()));
1017 myname = xstrdup (pw->pw_name);
1020 * Register an exit function to warn for any inconsistency that we
1023 if (atexit (do_cleanups) != 0) {
1024 fprintf(stderr, "%s: cannot set exit function\n", Prog);
1028 /* Parse the options */
1029 process_flags (argc, argv);
1032 * Replicate the group so it can be modified later on.
1035 get_group (&grent, &sgent);
1041 * Check if the user is allowed to change the password of this group.
1044 check_perms (&grent, &sgent);
1046 check_perms (&grent);
1050 * Removing a password is straight forward. Just set the password
1054 grent.gr_passwd = ""; /* XXX warning: const */
1056 sgent.sg_passwd = ""; /* XXX warning: const */
1061 * Same thing for restricting the group. Set the password
1064 grent.gr_passwd = "!"; /* XXX warning: const */
1066 sgent.sg_passwd = "!"; /* XXX warning: const */
1072 * Adding a member to a member list is pretty straightforward as
1073 * well. Call the appropriate routine and split.
1076 printf (_("Adding user %s to group %s\n"), user, group);
1077 grent.gr_mem = add_list (grent.gr_mem, user);
1080 sgent.sg_mem = add_list (sgent.sg_mem, user);
1087 * Removing a member from the member list is the same deal as adding
1088 * one, except the routine is different.
1091 bool removed = false;
1093 printf (_("Removing user %s from group %s\n"), user, group);
1095 if (is_on_list (grent.gr_mem, user)) {
1097 grent.gr_mem = del_list (grent.gr_mem, user);
1101 if (is_on_list (sgent.sg_mem, user)) {
1103 sgent.sg_mem = del_list (sgent.sg_mem, user);
1109 _("%s: user '%s' is not a member of '%s'\n"),
1117 * Replacing the entire list of administrators is simple. Check the
1118 * list to make sure everyone is a real user. Then slap the new list
1122 sgent.sg_adm = comma_to_list (admins);
1127 #endif /* SHADOWGRP */
1130 * Replacing the entire list of members is simple. Check the list to
1131 * make sure everyone is a real user. Then slap the new list in
1136 sgent.sg_mem = comma_to_list (members);
1138 grent.gr_mem = comma_to_list (members);
1143 * If the password is being changed, the input and output must both
1144 * be a tty. The typical keyboard signals are caught so the termio
1145 * modes can be restored.
1147 if ((isatty (0) == 0) || (isatty (1) == 0)) {
1148 fprintf (stderr, _("%s: Not a tty\n"), Prog);
1152 catch_signals (0); /* save tty modes */
1154 (void) signal (SIGHUP, catch_signals);
1155 (void) signal (SIGINT, catch_signals);
1156 (void) signal (SIGQUIT, catch_signals);
1157 (void) signal (SIGTERM, catch_signals);
1159 (void) signal (SIGTSTP, catch_signals);
1162 /* Prompt for the new password */
1164 change_passwd (&grent, &sgent);
1166 change_passwd (&grent);
1170 * This is the common arrival point to output the new group file.
1171 * The freshly crafted entry is in allocated space. The group file
1172 * will be locked and opened for writing. The new entry will be
1176 if (setuid (0) != 0) {
1177 fputs (_("Cannot change ID to root.\n"), stderr);
1178 SYSLOG ((LOG_ERR, "can't setuid(0)"));
1187 update_group (&grent, &sgent);
1189 update_group (&grent);
1194 nscd_flush_cache ("group");