forked from pool/shadow
bba5d5413c
* build: include lib/shadowlog_internal.h in dist tarballs - Update to 4.11: * Handle possible TOCTTOU issues in usermod/userdel - (CVE-2013-4235) - Use O_NOFOLLOW when copying file - Kill all user tasks in userdel * Fix useradd -D segfault * Clean up obsolete libc feature-check ifdefs * Fix -fno-common build breaks due to duplicate Prog declarations * Have single date_to_str definition * Fix libsubid SONAME version * Clarify licensing info, use SPDX. - Update to 4.10: * From this release forward, su from this package should be considered deprecated. Please replace any users of it with su from util-linux * libsubid fixes * Rename the test program list_subid_ranges to getsubids, write a manpage, so distros can ship it. * Add libeconf dep for new*idmap * Allow all group types with usermod -G * Avoid useradd generating empty subid range * Handle NULL pw_passwd * Fix default value SHA_get_salt_rounds * Use https where possible in README * Update content and format of README * Translation updates OBS-URL: https://build.opensuse.org/package/show/Base:System/shadow?expand=0&rev=118
105 lines
3.2 KiB
Diff
105 lines
3.2 KiB
Diff
Index: lib/getdef.c
|
|
===================================================================
|
|
--- lib/getdef.c.orig
|
|
+++ lib/getdef.c
|
|
@@ -128,6 +128,8 @@ static struct itemdef def_table[] = {
|
|
{"UID_MIN", NULL},
|
|
{"UMASK", NULL},
|
|
{"USERDEL_CMD", NULL},
|
|
+ {"USERDEL_PRECMD", NULL},
|
|
+ {"USERDEL_POSTCMD", NULL},
|
|
{"USERGROUPS_ENAB", NULL},
|
|
#ifndef USE_PAM
|
|
PAMDEFS
|
|
Index: etc/login.defs
|
|
===================================================================
|
|
--- etc/login.defs.orig
|
|
+++ etc/login.defs
|
|
@@ -242,9 +242,25 @@ NONEXISTENT /nonexistent
|
|
# It should remove any at/cron/print jobs etc. owned by
|
|
# the user to be removed (passed as the first argument).
|
|
#
|
|
+# See also USERDEL_PRECMD and USERDEL_POSTCMD below.
|
|
+#
|
|
#USERDEL_CMD /usr/sbin/userdel_local
|
|
|
|
#
|
|
+# If defined, this command is run before removing a user.
|
|
+# It should remove any at/cron/print jobs etc. owned by
|
|
+# the user to be removed.
|
|
+#
|
|
+USERDEL_PRECMD /usr/sbin/userdel-pre.local
|
|
+
|
|
+#
|
|
+# If defined, this command is run after removing a user.
|
|
+# It should rebuild any NIS database etc. to remove the
|
|
+# account from it.
|
|
+#
|
|
+USERDEL_POSTCMD /usr/sbin/userdel-post.local
|
|
+
|
|
+#
|
|
# Enable setting of the umask group bits to be the same as owner bits
|
|
# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is
|
|
# the same as gid, and username is the same as the primary group name.
|
|
Index: src/userdel.c
|
|
===================================================================
|
|
--- src/userdel.c.orig
|
|
+++ src/userdel.c
|
|
@@ -108,7 +108,7 @@ static void close_files (void);
|
|
static void fail_exit (int);
|
|
static void open_files (void);
|
|
static void update_user (void);
|
|
-static void user_cancel (const char *);
|
|
+static void call_script (const char *, const char *);
|
|
|
|
#ifdef EXTRA_CHECK_HOME_DIR
|
|
static bool path_prefix (const char *, const char *);
|
|
@@ -751,13 +751,13 @@ static void update_user (void)
|
|
* cron, at, or print jobs.
|
|
*/
|
|
|
|
-static void user_cancel (const char *user)
|
|
+static void call_script (const char *program, const char *user)
|
|
{
|
|
const char *cmd;
|
|
const char *argv[3];
|
|
int status;
|
|
|
|
- cmd = getdef_str ("USERDEL_CMD");
|
|
+ cmd = getdef_str (program);
|
|
if (NULL == cmd) {
|
|
return;
|
|
}
|
|
@@ -1203,9 +1203,10 @@ int main (int argc, char **argv)
|
|
}
|
|
|
|
/*
|
|
- * Do the hard stuff - open the files, create the user entries,
|
|
- * create the home directory, then close and update the files.
|
|
+ * Do the hard stuff - open the files, remove the user entries,
|
|
+ * remove the home directory, then close and update the files.
|
|
*/
|
|
+ call_script ("USERDEL_PRECMD", user_name);
|
|
open_files ();
|
|
update_user ();
|
|
update_groups ();
|
|
@@ -1326,7 +1327,7 @@ int main (int argc, char **argv)
|
|
* the entry from /etc/passwd.
|
|
*/
|
|
if (prefix[0] == '\0')
|
|
- user_cancel (user_name);
|
|
+ call_script ("USERDEL_CMD", user_name);
|
|
close_files ();
|
|
|
|
if (run_parts ("/etc/shadow-maint/userdel-post.d", user_name, "userdel")) {
|
|
@@ -1341,6 +1342,9 @@ int main (int argc, char **argv)
|
|
nscd_flush_cache ("group");
|
|
sssd_flush_cache (SSSD_DB_PASSWD | SSSD_DB_GROUP);
|
|
|
|
+ /* Call the post script, for example to rebuild NIS database */
|
|
+ call_script ("USERDEL_POSTCMD", user_name);
|
|
+
|
|
return ((0 != errors) ? E_HOMEDIR : E_SUCCESS);
|
|
}
|
|
|