SHA256
3
0
forked from pool/shadow

- Remove scripts that claim to be config but are in /usr (boo#1191578)

* userdel-script.patch
  * useradd-script.patch
  * useradd.local
  * userdel-post.local
  * userdel-pre.local

OBS-URL: https://build.opensuse.org/package/show/Base:System/shadow?expand=0&rev=140
This commit is contained in:
Michael Vetter 2023-02-16 09:24:10 +00:00 committed by Git OBS Bridge
parent e2af94b0ed
commit 3a9edf4780
2 changed files with 6 additions and 105 deletions

View File

@ -1,7 +1,12 @@
-------------------------------------------------------------------
Wed Feb 15 10:49:33 UTC 2023 - Ludwig Nussel <lnussel@suse.de>
- remove scripts that claim to be config but are in /usr (boo#1191578)
- Remove scripts that claim to be config but are in /usr (boo#1191578)
* userdel-script.patch
* useradd-script.patch
* useradd.local
* userdel-post.local
* userdel-pre.local
-------------------------------------------------------------------
Fri Jan 13 08:21:46 UTC 2023 - Michael Vetter <mvetter@suse.com>

View File

@ -1,104 +0,0 @@
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);
}