diff options
author | Gerald Carter <jerry@samba.org> | 2000-11-21 05:55:16 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2000-11-21 05:55:16 +0000 |
commit | 0dcbafe2b97035df779f2e0742a130c4c79e3241 (patch) | |
tree | 0d556fda89c3ce7423430186618e71a5790c0359 /source3/passdb/pdb_smbpasswd.c | |
parent | 2130ced345a6f3ecffe61c3622aceb8986925baa (diff) | |
download | samba-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/passdb/pdb_smbpasswd.c')
-rw-r--r-- | source3/passdb/pdb_smbpasswd.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 4473dd74c0..951c97ab3c 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1222,6 +1222,13 @@ static BOOL build_sam_account (SAM_ACCOUNT *sam_pass, struct passwd *pwfile; + if (!sam_pass) + return (False); + + /* make sure that we own the memory here--also clears + any existing members as a side effect */ + pdb_set_mem_ownership(sam_pass, True); + /* is the user valid? Verify in system password file... FIXME!!! This is where we should look up an internal @@ -1347,10 +1354,8 @@ SAM_ACCOUNT* pdb_getsampwent (void) if (pw_buf == NULL) return NULL; - /* clear out any preexisting information from the last call */ - pdb_clear_sam (&global_sam_pass); - - /* build the SAM_ACCOUNT entry from the smb_passwd struct */ + /* build the SAM_ACCOUNT entry from the smb_passwd struct. + This will also clear out the previous SAM_ACCOUNT fields */ if (!build_sam_account (&global_sam_pass, pw_buf)) return NULL; @@ -1420,7 +1425,6 @@ SAM_ACCOUNT* pdb_getsampwnam (char *username) DEBUG(10, ("found by name: %s\n", smb_pw->smb_name)); /* now build the SAM_ACCOUNT */ - pdb_clear_sam (&global_sam_pass); if (!build_sam_account (&global_sam_pass, smb_pw)) return NULL; @@ -1460,7 +1464,6 @@ SAM_ACCOUNT* pdb_getsampwuid (uid_t uid) DEBUG(10, ("found by name: %s\n", smb_pw->smb_name)); /* now build the SAM_ACCOUNT */ - pdb_clear_sam (&global_sam_pass); if (!build_sam_account (&global_sam_pass, smb_pw)) return NULL; @@ -1499,7 +1502,6 @@ SAM_ACCOUNT* pdb_getsampwrid (uint32 rid) DEBUG(10, ("found by name: %s\n", smb_pw->smb_name)); /* now build the SAM_ACCOUNT */ - pdb_clear_sam (&global_sam_pass); if (!build_sam_account (&global_sam_pass, smb_pw)) return NULL; |