[Pkg-shadow-commits] r780 - trunk/debian/patches
Nicolas FRANCOIS
nekral-guest at costa.debian.org
Tue Jan 10 00:02:38 UTC 2006
Author: nekral-guest
Date: 2006-01-10 00:02:36 +0000 (Tue, 10 Jan 2006)
New Revision: 780
Added:
trunk/debian/patches/481_userdel_remove_remove_group
Modified:
trunk/debian/patches/series
Log:
The user's group is already removed by update_groups. remove_group is not
needed.
This caused warnings when a user was deleted.
Added: trunk/debian/patches/481_userdel_remove_remove_group
===================================================================
--- trunk/debian/patches/481_userdel_remove_remove_group 2006-01-09 19:30:40 UTC (rev 779)
+++ trunk/debian/patches/481_userdel_remove_remove_group 2006-01-10 00:02:36 UTC (rev 780)
@@ -0,0 +1,117 @@
+Goal: avoid a warning when removing an user.
+
+The user's group is already removed by update_groups. remove_group is not
+needed.
+Thus userdel reports a warning:
+userdel: error removing group entry
+userdel: error removing shadow group entry
+
+Index: shadow-4.0.14/src/userdel.c
+===================================================================
+--- shadow-4.0.14.orig/src/userdel.c 2006-01-09 21:27:19.000000000 +0100
++++ shadow-4.0.14/src/userdel.c 2006-01-09 21:59:33.000000000 +0100
+@@ -66,9 +66,7 @@
+ #define E_HOMEDIR 12 /* can't remove home directory */
+ static char *user_name;
+ static uid_t user_id;
+-static gid_t user_gid;
+ static char *user_home;
+-static char *user_group;
+
+ static char *Prog;
+ static int fflg = 0, rflg = 0;
+@@ -265,65 +263,6 @@
+ }
+
+ /*
+- * remove_group - remove the user's group unless it is not really a user-private group
+- */
+-static void remove_group ()
+-{
+- char *glist_name;
+- struct group *gr;
+- struct passwd *pwd;
+-
+- if (user_group == NULL || user_name == NULL)
+- return;
+-
+- if (strcmp (user_name, user_group)) {
+- return;
+- }
+-
+- glist_name = NULL;
+- gr = getgrnam (user_group);
+- if (gr)
+- glist_name = *(gr->gr_mem);
+- while (glist_name) {
+- while (glist_name && *glist_name) {
+- if (strncmp (glist_name, user_name, 16)) {
+- return;
+- }
+- glist_name++;
+- }
+- }
+-
+- setpwent ();
+- while ((pwd = getpwent ())) {
+- if (strcmp (pwd->pw_name, user_name) == 0)
+- continue;
+-
+- if (pwd->pw_gid == user_gid) {
+- return;
+- }
+- }
+-
+- /* now actually do the removal if we haven't already returned */
+-
+- if (!gr_remove (user_group)) {
+- fprintf (stderr, _("%s: error removing group entry\n"), Prog);
+- }
+-#ifdef SHADOWGRP
+-
+- /*
+- * Delete the shadow group entries as well.
+- */
+-
+- if (is_shadow_grp && !sgr_remove (user_group)) {
+- fprintf (stderr, _("%s: error removing shadow group entry\n"),
+- Prog);
+- }
+-#endif /* SHADOWGRP */
+- SYSLOG ((LOG_INFO, "remove group `%s'\n", user_group));
+- return;
+-}
+-
+-/*
+ * close_files - close all of the files that were opened
+ *
+ * close_files() closes all of the files that were opened for this
+@@ -658,7 +597,6 @@
+ int main (int argc, char **argv)
+ {
+ struct passwd *pwd;
+- struct group *grp;
+ int arg;
+ int errors = 0;
+
+@@ -766,10 +704,6 @@
+ #endif
+ user_id = pwd->pw_uid;
+ user_home = xstrdup (pwd->pw_dir);
+- user_gid = pwd->pw_gid;
+- grp = getgrgid (user_gid);
+- if (grp)
+- user_group = xstrdup (grp->gr_name);
+ /*
+ * Check to make certain the user isn't logged in.
+ */
+@@ -823,9 +757,6 @@
+ }
+ #endif
+
+- /* Remove the user's group if appropriate. */
+- remove_group ();
+-
+ if (rflg) {
+ if (remove_tree (user_home)
+ || rmdir (user_home)) {
Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series 2006-01-09 19:30:40 UTC (rev 779)
+++ trunk/debian/patches/series 2006-01-10 00:02:36 UTC (rev 780)
@@ -44,6 +44,7 @@
478_nologin.8.xml
479_chowntty_debug
480_getopt_args_reorder
+481_userdel_remove_remove_group
# 999-2 is about using cdbs. It does not patch upstream files
# so shouldn't be here, but we keep it for the future
# 999-2_build_using_cdbs
More information about the Pkg-shadow-commits
mailing list