diff options
author | Gerald Carter <jerry@samba.org> | 2003-04-29 05:30:29 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-04-29 05:30:29 +0000 |
commit | 2aa8a05f336781d7cc7c8cdce9533f96ba9ca8d6 (patch) | |
tree | 73343023dab2e68a225a9c63e2e12b3cbef5ae32 /source3 | |
parent | 6760896739914c292a056a9de5ed83fb111b3a66 (diff) | |
download | samba-2aa8a05f336781d7cc7c8cdce9533f96ba9ca8d6.tar.gz samba-2aa8a05f336781d7cc7c8cdce9533f96ba9ca8d6.tar.bz2 samba-2aa8a05f336781d7cc7c8cdce9533f96ba9ca8d6.zip |
only call the add_script if the getpwnam_alloc() fails
(This used to be commit c0807e21999ec718d722fc0be6b3353c9369db04)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index d6441fd361..8ff993d8a6 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -2274,26 +2274,35 @@ NTSTATUS _api_samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u, SAMR_R_ } #endif - /* - * we can't check both the ending $ and the acb_info. - * - * UserManager creates trust accounts (ending in $, - * normal that hidden accounts) with the acb_info equals to ACB_NORMAL. - * JFM, 11/29/2001 - */ - if (account[strlen(account)-1] == '$') - pstrcpy(add_script, lp_addmachine_script()); - else - pstrcpy(add_script, lp_adduser_script()); - - if (*add_script) { - int add_ret; - all_string_sub(add_script, "%u", account, sizeof(account)); - add_ret = smbrun(add_script,NULL); - DEBUG(3,("_api_samr_create_user: Running the command `%s' gave %d\n", add_script, add_ret)); - } - + /* the passdb lookup has failed; check to see if we need to run the + add user/machine script */ + pw = getpwnam_alloc(account); + + if ( !pw ) { + /* + * we can't check both the ending $ and the acb_info. + * + * UserManager creates trust accounts (ending in $, + * normal that hidden accounts) with the acb_info equals to ACB_NORMAL. + * JFM, 11/29/2001 + */ + if (account[strlen(account)-1] == '$') + pstrcpy(add_script, lp_addmachine_script()); + else + pstrcpy(add_script, lp_adduser_script()); + + if (*add_script) { + int add_ret; + all_string_sub(add_script, "%u", account, sizeof(account)); + add_ret = smbrun(add_script,NULL); + DEBUG(3,("_api_samr_create_user: Running the command `%s' gave %d\n", add_script, add_ret)); + } + + /* try again */ + pw = getpwnam_alloc(account); + } + if (pw) { nt_status = pdb_init_sam_pw(&sam_pass, pw); |