summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-04-29 05:37:42 +0000
committerGerald Carter <jerry@samba.org>2003-04-29 05:37:42 +0000
commit46eac77b3bcfec190acd738e2dfea33c70c9b9cd (patch)
tree88ddd4db7a83002b029da3c7fc9c2e567b1de1e1 /source3/rpc_server
parent97a16d0cae72020a240734ac20a978489c458673 (diff)
downloadsamba-46eac77b3bcfec190acd738e2dfea33c70c9b9cd.tar.gz
samba-46eac77b3bcfec190acd738e2dfea33c70c9b9cd.tar.bz2
samba-46eac77b3bcfec190acd738e2dfea33c70c9b9cd.zip
only call the add_script if the getpwnam_alloc() fails
(This used to be commit ba1e654a15fa800e56732fe005afd7479c18324b)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr_nt.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 5a8a16b256..9cc6474500 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -6,7 +6,7 @@
* Copyright (C) Paul Ashton 1997,
* Copyright (C) Marc Jacobsen 1999,
* Copyright (C) Jeremy Allison 2001-2002,
- * Copyright (C) Jean François Micouleau 1998-2001,
+ * Copyright (C) Jean François Micouleau 1998-2001,
* Copyright (C) Anthony Liguori 2002,
* Copyright (C) Jim McDonough 2002.
*
@@ -2271,30 +2271,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 (!NT_STATUS_IS_OK(nt_status = pdb_init_sam(&sam_pass))) {
- return nt_status;
+ 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);
}
- pw = getpwnam_alloc(account);
if (pw) {
DOM_SID user_sid;