summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-07-07 08:45:39 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-07-07 08:45:39 +0000
commit28a53730a9c321eed6b833e3b0da69254b5bc08c (patch)
treed40733d2111edbe15e9eaec194d01410c983a398
parent7be19ad10fc30fab199653facd11496170219e1b (diff)
downloadsamba-28a53730a9c321eed6b833e3b0da69254b5bc08c.tar.gz
samba-28a53730a9c321eed6b833e3b0da69254b5bc08c.tar.bz2
samba-28a53730a9c321eed6b833e3b0da69254b5bc08c.zip
Add a new paramater: add machine script
This allows the administrator to define different scripts for adding unix users and automaticly adding machines. If it is not defined, it falls back to the value of 'add user script'. Andrew Bartlett (This used to be commit 7a478e050f3ab33bd0141a58c698d748f0d2b204)
-rw-r--r--source3/param/loadparm.c4
-rw-r--r--source3/rpc_server/srv_samr_nt.c14
2 files changed, 15 insertions, 3 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index da25d526a1..7df701e1d3 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -146,6 +146,7 @@ typedef struct
char *szDelGroupScript;
char *szAddUserToGroupScript;
char *szDelUserToGroupScript;
+ char *szAddMachineScript;
char *szWINSHook;
#ifdef WITH_UTMP
char *szUtmpDir;
@@ -876,6 +877,7 @@ static struct parm_struct parm_table[] = {
{"delete group script", P_STRING, P_GLOBAL, &Globals.szDelGroupScript, NULL, NULL, 0},
{"add user to group script", P_STRING, P_GLOBAL, &Globals.szAddUserToGroupScript, NULL, NULL, 0},
{"delete user from group script", P_STRING, P_GLOBAL, &Globals.szDelUserToGroupScript, NULL, NULL, 0},
+ {"add machine script", P_STRING, P_GLOBAL, &Globals.szAddMachineScript, NULL, NULL, 0},
{"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL, NULL, 0},
{"logon path", P_STRING, P_GLOBAL, &Globals.szLogonPath, NULL, NULL, 0},
@@ -1451,6 +1453,8 @@ FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserToGroupScript)
+FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
+
FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
FN_GLOBAL_STRING(lp_domain_admin_group, &Globals.szDomainAdminGroup)
FN_GLOBAL_STRING(lp_domain_guest_group, &Globals.szDomainGuestGroup)
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index fb2dcf03cc..829218008d 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1860,10 +1860,18 @@ uint32 _api_samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u, SAMR_R_CR
* JFM (2/3/2001), to clear any possible bad understanding (-:
*/
- pstrcpy(add_script, lp_adduser_script());
+ pstrcpy(add_script, lp_addmachine_script());
- if(*add_script)
- smb_create_user(mach_acct, NULL);
+ if (!*add_script) {
+ pstrcpy(add_script, lp_adduser_script());
+ }
+
+ if(*add_script) {
+ int add_ret;
+ all_string_sub(add_script, "%u", mach_acct, sizeof(mach_acct));
+ add_ret = smbrun(add_script,NULL);
+ DEBUG(3,("_api_samr_create_user: Running the command `%s' gave %d\n",add_script,add_ret));
+ }
/* add the user in the smbpasswd file or the Samba authority database */
if (!local_password_change(mach_acct, local_flags, NULL, err_str,