diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-04-29 09:43:17 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-04-29 09:43:17 +0000 |
commit | 281d95e2f35f8276d23d075d6e528d16eda9fadc (patch) | |
tree | 9b91d5842a743bf3135e91a3942b76a173e1fd13 /source3/rpc_server | |
parent | e3ae1a2f2398e8fa107673e83f75675629938d75 (diff) | |
download | samba-281d95e2f35f8276d23d075d6e528d16eda9fadc.tar.gz samba-281d95e2f35f8276d23d075d6e528d16eda9fadc.tar.bz2 samba-281d95e2f35f8276d23d075d6e528d16eda9fadc.zip |
Use a common function to create the SAM_ACCOUNT being used to add accounts
to the system. This means that we always run Get_Pwnam(), and can never add
FOO when foo exists on the system (the idea is to instead add foo into
the passdb, using it's full name, RID etc).
Andrew Bartlett
(This used to be commit bb79b127e02cefae13c822fd0fd165f1f214b740)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 8ff993d8a6..62d5f8ab0c 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -2277,7 +2277,7 @@ NTSTATUS _api_samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u, SAMR_R_ /* the passdb lookup has failed; check to see if we need to run the add user/machine script */ - pw = getpwnam_alloc(account); + pw = Get_Pwnam(account); if ( !pw ) { /* @@ -2299,33 +2299,14 @@ NTSTATUS _api_samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u, SAMR_R_ 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); - passwd_free(&pw); /* done with this now */ - if (!NT_STATUS_IS_OK(nt_status)) { - pdb_free_sam(&sam_pass); - return nt_status; - } - } else { - DEBUG(3,("attempting to create non-unix account %s\n", account)); - - if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam(&sam_pass))) { - return nt_status; - } + nt_status = pdb_init_sam_new(&sam_pass, account); + if (!NT_STATUS_IS_OK(nt_status)) + return nt_status; - if (!pdb_set_username(sam_pass, account, PDB_CHANGED)) { - pdb_free_sam(&sam_pass); - return NT_STATUS_NO_MEMORY; - } - } - pdb_set_acct_ctrl(sam_pass, acb_info, PDB_CHANGED); - + if (!pdb_add_sam_account(sam_pass)) { pdb_free_sam(&sam_pass); DEBUG(0, ("could not add user/computer %s to passdb. Check permissions?\n", |