summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-11-24 00:36:37 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-11-24 00:36:37 +0000
commite8e73f7f0fcd86c8c2bfe3fc0b44ea2fd6570cc5 (patch)
treefcecd770e96b42293cdbf8d8a1384642370747c8
parent1748d5a2af1f2dcf718d6f162ed483b001542494 (diff)
downloadsamba-e8e73f7f0fcd86c8c2bfe3fc0b44ea2fd6570cc5.tar.gz
samba-e8e73f7f0fcd86c8c2bfe3fc0b44ea2fd6570cc5.tar.xz
samba-e8e73f7f0fcd86c8c2bfe3fc0b44ea2fd6570cc5.zip
Kill off that crazy copy_sam_passwd(). You simply can't do that if the
structre contains pointers (well not if you intend of free those pointers at some stage) There is no reason (given the new passdb interface) that you can't modify a SAM_ACCOUNT in any case. Andrew Bartlett
-rw-r--r--source/passdb/passdb.c12
-rw-r--r--source/rpc_server/srv_samr_nt.c35
2 files changed, 11 insertions, 36 deletions
diff --git a/source/passdb/passdb.c b/source/passdb/passdb.c
index dc8e5471e15..873e569f680 100644
--- a/source/passdb/passdb.c
+++ b/source/passdb/passdb.c
@@ -868,18 +868,6 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
}
/*************************************************************
- Copies a SAM_ACCOUNT.
- **************************************************************/
-
-void copy_sam_passwd(SAM_ACCOUNT *to, const SAM_ACCOUNT *from)
-{
- if (!from || !to)
- return;
-
- memcpy(to, from, sizeof(SAM_ACCOUNT));
-}
-
-/*************************************************************
Change a password entry in the local smbpasswd file.
FIXME!! The function needs to be abstracted into the
diff --git a/source/rpc_server/srv_samr_nt.c b/source/rpc_server/srv_samr_nt.c
index f1f3040ba45..71237a9eec2 100644
--- a/source/rpc_server/srv_samr_nt.c
+++ b/source/rpc_server/srv_samr_nt.c
@@ -2311,7 +2311,6 @@ static BOOL set_user_info_12(SAM_USER_INFO_12 *id12, uint32 rid)
static BOOL set_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid)
{
SAM_ACCOUNT *pwd = NULL;
- SAM_ACCOUNT *new_pwd = NULL;
if (id21 == NULL) {
DEBUG(5, ("set_user_info_21: NULL id21\n"));
@@ -2319,17 +2318,13 @@ static BOOL set_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid)
}
pdb_init_sam(&pwd);
- pdb_init_sam(&new_pwd);
if (!pdb_getsampwrid(pwd, rid)) {
pdb_free_sam(&pwd);
- pdb_free_sam(&new_pwd);
return False;
}
- /* we make a copy so that we can modify stuff */
- copy_sam_passwd(new_pwd, pwd);
- copy_id21_to_sam_passwd(new_pwd, id21);
+ copy_id21_to_sam_passwd(pwd, id21);
/*
* The funny part about the previous two calls is
@@ -2339,14 +2334,12 @@ static BOOL set_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid)
*/
/* write the change out */
- if(!pdb_update_sam_account(new_pwd, True)) {
+ if(!pdb_update_sam_account(pwd, True)) {
pdb_free_sam(&pwd);
- pdb_free_sam(&new_pwd);
return False;
}
pdb_free_sam(&pwd);
- pdb_free_sam(&new_pwd);
return True;
}
@@ -2358,7 +2351,6 @@ static BOOL set_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid)
static BOOL set_user_info_23(SAM_USER_INFO_23 *id23, uint32 rid)
{
SAM_ACCOUNT *pwd = NULL;
- SAM_ACCOUNT *new_pwd = NULL;
pstring plaintext_buf;
uint32 len;
uint16 acct_ctrl;
@@ -2369,28 +2361,23 @@ static BOOL set_user_info_23(SAM_USER_INFO_23 *id23, uint32 rid)
}
pdb_init_sam(&pwd);
- pdb_init_sam(&new_pwd);
if (!pdb_getsampwrid(pwd, rid)) {
pdb_free_sam(&pwd);
- pdb_free_sam(&new_pwd);
return False;
}
acct_ctrl = pdb_get_acct_ctrl(pwd);
- copy_sam_passwd(new_pwd, pwd);
- pdb_free_sam(&pwd);
-
- copy_id23_to_sam_passwd(new_pwd, id23);
+ copy_id23_to_sam_passwd(pwd, id23);
if (!decode_pw_buffer((char*)id23->pass, plaintext_buf, 256, &len)) {
- pdb_free_sam(&new_pwd);
+ pdb_free_sam(&pwd);
return False;
}
- if (!pdb_set_plaintext_passwd (new_pwd, plaintext_buf)) {
- pdb_free_sam(&new_pwd);
+ if (!pdb_set_plaintext_passwd (pwd, plaintext_buf)) {
+ pdb_free_sam(&pwd);
return False;
}
@@ -2402,20 +2389,20 @@ static BOOL set_user_info_23(SAM_USER_INFO_23 *id23, uint32 rid)
} else {
/* update the UNIX password */
if (lp_unix_password_sync() )
- if(!chgpasswd(pdb_get_username(new_pwd), "", plaintext_buf, True)) {
- pdb_free_sam(&new_pwd);
+ if(!chgpasswd(pdb_get_username(pwd), "", plaintext_buf, True)) {
+ pdb_free_sam(&pwd);
return False;
}
}
ZERO_STRUCT(plaintext_buf);
- if(!pdb_update_sam_account(new_pwd, True)) {
- pdb_free_sam(&new_pwd);
+ if(!pdb_update_sam_account(pwd, True)) {
+ pdb_free_sam(&pwd);
return False;
}
- pdb_free_sam(&new_pwd);
+ pdb_free_sam(&pwd);
return True;
}