2018-05-16 16:26:18 +02:00
|
|
|
diff -urEbwB shadow-4.6/src/userdel.c shadow-4.6.new/src/userdel.c
|
|
|
|
--- shadow-4.6/src/userdel.c 2018-04-29 18:42:37.000000000 +0200
|
|
|
|
+++ shadow-4.6.new/src/userdel.c 2018-05-14 16:13:43.996280216 +0200
|
|
|
|
@@ -125,7 +125,7 @@
|
|
|
|
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 *);
|
|
|
|
@@ -767,13 +767,13 @@
|
2012-10-29 16:15:23 +01:00
|
|
|
* 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;
|
|
|
|
}
|
2018-05-16 16:26:18 +02:00
|
|
|
@@ -1213,9 +1213,10 @@
|
2012-10-29 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
- * 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.
|
|
|
|
*/
|
2018-05-16 16:26:18 +02:00
|
|
|
+ call_script ("USERDEL_PRECMD", user_name);
|
2012-10-29 16:15:23 +01:00
|
|
|
open_files ();
|
|
|
|
update_user ();
|
|
|
|
update_groups ();
|
2018-05-16 16:26:18 +02:00
|
|
|
@@ -1319,7 +1320,7 @@
|
2012-10-29 16:15:23 +01:00
|
|
|
* the entry from /etc/passwd.
|
|
|
|
*/
|
2018-05-16 16:26:18 +02:00
|
|
|
if(prefix[0] == '\0')
|
|
|
|
- user_cancel (user_name);
|
|
|
|
+ call_script ("USERDEL_CMD", user_name);
|
2012-10-29 16:15:23 +01:00
|
|
|
close_files ();
|
|
|
|
|
|
|
|
#ifdef WITH_TCB
|
2018-05-16 16:26:18 +02:00
|
|
|
@@ -1329,6 +1330,9 @@
|
2012-10-29 16:15:23 +01:00
|
|
|
nscd_flush_cache ("passwd");
|
|
|
|
nscd_flush_cache ("group");
|
|
|
|
|
|
|
|
+ /* Call the post script, for example to rebuild NIS database */
|
|
|
|
+ call_script ("USERDEL_POSTCMD", user_name);
|
|
|
|
+
|
|
|
|
return ((0 != errors) ? E_HOMEDIR : E_SUCCESS);
|
|
|
|
}
|
2018-05-16 16:26:18 +02:00
|
|
|
|