2012-10-29 16:15:23 +01:00
|
|
|
--- src/userdel.c
|
2016-05-30 12:38:25 +02:00
|
|
|
+++ src/userdel.c
|
|
|
|
@@ -762,13 +762,13 @@ static void update_user (void)
|
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;
|
|
|
|
}
|
2016-05-30 12:38:25 +02:00
|
|
|
@@ -1163,9 +1163,10 @@ int main (int argc, char **argv)
|
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.
|
|
|
|
*/
|
|
|
|
+ call_script ("USERDEL_PRECMD", user_name);
|
|
|
|
open_files ();
|
|
|
|
update_user ();
|
|
|
|
update_groups ();
|
2016-05-30 12:38:25 +02:00
|
|
|
@@ -1268,7 +1269,7 @@ int main (int argc, char **argv)
|
2012-10-29 16:15:23 +01:00
|
|
|
* Cancel any crontabs or at jobs. Have to do this before we remove
|
|
|
|
* the entry from /etc/passwd.
|
|
|
|
*/
|
|
|
|
- user_cancel (user_name);
|
|
|
|
+ call_script ("USERDEL_CMD", user_name);
|
|
|
|
close_files ();
|
|
|
|
|
|
|
|
#ifdef WITH_TCB
|
2016-05-30 12:38:25 +02:00
|
|
|
@@ -1278,6 +1279,8 @@ int main (int argc, char **argv)
|
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);
|
|
|
|
}
|
|
|
|
-
|