summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-11-21 05:55:16 +0000
committerGerald Carter <jerry@samba.org>2000-11-21 05:55:16 +0000
commit0dcbafe2b97035df779f2e0742a130c4c79e3241 (patch)
tree0d556fda89c3ce7423430186618e71a5790c0359 /source3/rpc_server
parent2130ced345a6f3ecffe61c3622aceb8986925baa (diff)
downloadsamba-0dcbafe2b97035df779f2e0742a130c4c79e3241.tar.gz
samba-0dcbafe2b97035df779f2e0742a130c4c79e3241.tar.bz2
samba-0dcbafe2b97035df779f2e0742a130c4c79e3241.zip
Another large patch for the passdb rewrite.
o added BOOL own_memory flag in SAM_ACCOUNT so we could use static memory for string pointer assignment or allocate a new string o added a reference TDB passdb backend. This is only a reference and should not be used in production because - RID's are generated using the same algorithm as with smbpasswd - a TDB can only have one key (w/o getting into problems) and we need three. Therefore the pdb_sam-getpwuid() and pdb_getsampwrid() functions are interative searches :-( we need transaction support, multiple indexes, and a nice open source DBM. The Berkeley DB (from sleepycat.com seems to fit this criteria now) o added a new parameter "private dir" as many places in the code were using lp_smb_passwd_file() and chopping off the filename part. This makes more sense to me and I will docuement it in the man pages o Ran through Insure-lite and corrected memory leaks. Need for a public flogging this time Jeremy (-: -- jerry (This used to be commit 4792029a2991bd84251d152a62b1033dec62cee2)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr.c41
1 files changed, 10 insertions, 31 deletions
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index dcb5b9c9e3..ed3cf7df82 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -2226,7 +2226,7 @@ static BOOL set_user_info_12(SAM_USER_INFO_12 *id12, uint32 rid)
/*******************************************************************
set_user_info_21
********************************************************************/
-static BOOL set_user_info_21(SAM_USER_INFO_21 * id21, uint32 rid)
+static BOOL set_user_info_21 (SAM_USER_INFO_21 *id21, uint32 rid)
{
SAM_ACCOUNT *pwd = pdb_getsampwrid(rid);
SAM_ACCOUNT new_pwd;
@@ -2239,33 +2239,20 @@ static BOOL set_user_info_21(SAM_USER_INFO_21 * id21, uint32 rid)
if (pwd == NULL)
return False;
- /* Zero out struct and set a few initial items */
- pdb_init_sam(&new_pwd);
-
- /* FIXME!! these two calls may need to be fixed. copy_sam_passwd()
- uses static strings and copy_id21..() reassigns some
- strings. Right now there is no memory leaks, but if
- the internals of copy_sam_passwd() changes to use dynamically
- allocated strings, this will need to be fixed --jerry */
+ /* we make a copy so that we can modify stuff */
copy_sam_passwd(&new_pwd, pwd);
copy_id21_to_sam_passwd(&new_pwd, id21);
+
+ /*
+ * The funny part about the previous two calls is
+ * that pwd still has the password hashes from the
+ * passdb entry. These have not been updated from
+ * id21. I don't know if they need to be set. --jerry
+ */
- /* passwords are not copied as part of copy_sam_passwd() */
- if (pdb_get_nt_passwd(pwd) != NULL)
- pdb_set_nt_passwd (&new_pwd, pdb_get_nt_passwd(pwd));
-
- if (pdb_get_lanman_passwd(pwd) != NULL)
- pdb_set_lanman_passwd (&new_pwd, pdb_get_lanman_passwd(pwd));
-
+ /* write the change out */
if(!pdb_update_sam_account(&new_pwd, True))
return False;
-
- /* FIXME!!! Memory leak here. Cannot call pdb_clear_sam()
- because copy_sam_passwd uses static arrays. Therefore,
- we will manually free the password pointers here. This
- needs to be fixed. ---jerry */
- if (new_pwd.nt_pw) free (new_pwd.nt_pw);
- if (new_pwd.lm_pw) free (new_pwd.lm_pw);
return True;
}
@@ -2290,7 +2277,6 @@ static BOOL set_user_info_23(SAM_USER_INFO_23 *id23, uint32 rid)
if (pwd == NULL)
return False;
- pdb_init_sam(&new_pwd);
copy_sam_passwd(&new_pwd, pwd);
copy_id23_to_sam_passwd(&new_pwd, id23);
@@ -2311,13 +2297,6 @@ static BOOL set_user_info_23(SAM_USER_INFO_23 *id23, uint32 rid)
if(!pdb_update_sam_account(&new_pwd, True))
return False;
-
- /* FIXME!!! Memory leak here. Cannot call pdb_clear_sam()
- because copy_sam_passwd uses static arrays. Therefore,
- we will manually free the password pointers here. This
- needs to be fixed. ---jerry */
- if (new_pwd.nt_pw) free (new_pwd.nt_pw);
- if (new_pwd.lm_pw) free (new_pwd.lm_pw);
return True;
}