2019-05-06 09:58:15 +02:00
|
|
|
Index: etc/login.defs
|
|
|
|
===================================================================
|
|
|
|
--- etc/login.defs.orig
|
|
|
|
+++ etc/login.defs
|
|
|
|
@@ -212,6 +212,13 @@ CHFN_RESTRICT rwh
|
|
|
|
DEFAULT_HOME yes
|
|
|
|
|
|
|
|
#
|
|
|
|
+# If defined, this command is run when adding a user.
|
|
|
|
+# It should rebuild any NIS database etc. to add the
|
|
|
|
+# new created account.
|
|
|
|
+#
|
|
|
|
+USERADD_CMD /usr/sbin/useradd.local
|
|
|
|
+
|
|
|
|
+#
|
|
|
|
# If defined, this command is run when removing a user.
|
|
|
|
# It should remove any at/cron/print jobs etc. owned by
|
|
|
|
# the user to be removed (passed as the first argument).
|
|
|
|
Index: lib/getdef.c
|
|
|
|
===================================================================
|
|
|
|
--- lib/getdef.c.orig
|
|
|
|
+++ lib/getdef.c
|
2019-06-14 09:41:25 +02:00
|
|
|
@@ -126,6 +126,7 @@ static struct itemdef def_table[] = {
|
2019-05-06 09:58:15 +02:00
|
|
|
{"UID_MAX", NULL},
|
|
|
|
{"UID_MIN", NULL},
|
|
|
|
{"UMASK", NULL},
|
|
|
|
+ {"USERADD_CMD", NULL},
|
|
|
|
{"USERDEL_CMD", NULL},
|
|
|
|
{"USERDEL_PRECMD", NULL},
|
|
|
|
{"USERDEL_POSTCMD", NULL},
|
|
|
|
Index: src/useradd.c
|
|
|
|
===================================================================
|
|
|
|
--- src/useradd.c.orig
|
2016-05-30 12:38:25 +02:00
|
|
|
+++ src/useradd.c
|
2019-06-14 09:41:25 +02:00
|
|
|
@@ -2216,6 +2216,30 @@ static void create_mail (void)
|
2012-10-29 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
+ * call_script - call a script to do some work
|
|
|
|
+ *
|
|
|
|
+ * call_script calls a script for additional changes to the
|
|
|
|
+ * account.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+static void call_script (const char *user)
|
|
|
|
+{
|
|
|
|
+ const char *cmd;
|
|
|
|
+ const char *argv[3];
|
|
|
|
+ int status;
|
|
|
|
+
|
|
|
|
+ cmd = getdef_str ("USERADD_CMD");
|
|
|
|
+ if (NULL == cmd) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ argv[0] = cmd;
|
|
|
|
+ argv[1] = user;
|
|
|
|
+ argv[2] = (char *)0;
|
|
|
|
+ (void) run_command (cmd, argv, NULL, &status);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
* main - useradd command
|
|
|
|
*/
|
|
|
|
int main (int argc, char **argv)
|
2019-06-14 09:41:25 +02:00
|
|
|
@@ -2492,6 +2516,7 @@ int main (int argc, char **argv)
|
2012-10-29 16:15:23 +01:00
|
|
|
nscd_flush_cache ("group");
|
2019-06-14 09:41:25 +02:00
|
|
|
sssd_flush_cache (SSSD_DB_PASSWD | SSSD_DB_GROUP);
|
2012-10-29 16:15:23 +01:00
|
|
|
|
|
|
|
+ call_script (user_name);
|
|
|
|
+
|
|
|
|
return E_SUCCESS;
|
|
|
|
}
|
|
|
|
-
|