summaryrefslogtreecommitdiff
path: root/source3/utils/net_rpc_samsync.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-01-29 18:47:57 +0000
committerGerald Carter <jerry@samba.org>2003-01-29 18:47:57 +0000
commitaed54afc2cfc468d29b65b2b503d975070515528 (patch)
tree3f1b032a30056ae6a2c50476c1ad114d929e774b /source3/utils/net_rpc_samsync.c
parent655000e43ec9dccba3c53baef34ebe41028981b5 (diff)
downloadsamba-aed54afc2cfc468d29b65b2b503d975070515528.tar.gz
samba-aed54afc2cfc468d29b65b2b503d975070515528.tar.bz2
samba-aed54afc2cfc468d29b65b2b503d975070515528.zip
playing janitor for abartlet. :-(
" Make the vampire code use just pdb calls - allowing better operation on systems that are not configured with an add user script, and have an _nua backend for storage. We really need to get the PDB backends out of the IDMAP game... Andrew Bartlett " (This used to be commit e959a8eb67e78bb90ae017687dca8f8b3b147b09)
Diffstat (limited to 'source3/utils/net_rpc_samsync.c')
-rw-r--r--source3/utils/net_rpc_samsync.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index 1bd39e3ebb..ac3b78fc7a 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -287,6 +287,7 @@ fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta)
GROUP_MAP map;
struct group *grp;
DOM_SID sid;
+ BOOL try_add = False;
fstrcpy(account, unistr2_static(&delta->uni_acct_name));
d_printf("Creating account: %s\n", account);
@@ -295,10 +296,6 @@ fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta)
return nt_ret;
if (!pdb_getsampwnam(sam_account, account)) {
- struct passwd *pw;
-
- pdb_free_sam(&sam_account);
-
/* Create appropriate user */
if (delta->acb_info & ACB_NORMAL) {
pstrcpy(add_script, lp_adduser_script());
@@ -319,29 +316,25 @@ fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta)
DEBUG(1,("fetch_account: Running the command `%s' "
"gave %d\n", add_script, add_ret));
}
- pw = getpwnam_alloc(account);
- if (pw) {
- nt_ret = pdb_init_sam_pw(&sam_account, pw);
-
- if (!NT_STATUS_IS_OK(nt_ret)) {
- passwd_free(&pw);
- pdb_free_sam(&sam_account);
- return nt_ret;
- }
- passwd_free(&pw);
- } else {
- DEBUG(3, ("Could not create account %s\n", account));
- pdb_free_sam(&sam_account);
- return NT_STATUS_NO_SUCH_USER;
+
+ if (!pdb_getsampwnam(sam_account, account)) {
+ try_add = True;
+ /* still not there, hope the backend likes NUAs */
}
}
sam_account_from_delta(sam_account, delta);
- if (!pdb_add_sam_account(sam_account)) {
- DEBUG(1, ("SAM Account for %s already exists, updating\n",
- account));
- pdb_update_sam_account(sam_account);
+ if (try_add) {
+ if (!pdb_add_sam_account(sam_account)) {
+ DEBUG(1, ("SAM Account for %s failed to be added to the passdb!\n",
+ account));
+ }
+ } else {
+ if (!pdb_update_sam_account(sam_account)) {
+ DEBUG(1, ("SAM Account for %s failed to be updated in the passdb!\n",
+ account));
+ }
}
sid = *pdb_get_group_sid(sam_account);