diff options
author | Simo Sorce <idra@samba.org> | 2002-01-21 08:08:54 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2002-01-21 08:08:54 +0000 |
commit | 2af4b8a500531f682765280b2af9cbcafb5036d9 (patch) | |
tree | bcd41013e5f6f848610202b0f6fd56331a90d440 /source3 | |
parent | d6b4327f11875c5634fa9452242ed2c5730d5934 (diff) | |
download | samba-2af4b8a500531f682765280b2af9cbcafb5036d9.tar.gz samba-2af4b8a500531f682765280b2af9cbcafb5036d9.tar.bz2 samba-2af4b8a500531f682765280b2af9cbcafb5036d9.zip |
getpwnam_alloc -> getpwnam
same reason as per pdb_tdb.c
there isn't (and will never be probably) another call to any getpw* fn,
let's use getpwnam_alloc only when needed.
(This used to be commit f12361b1327306e6a3fcf8ff138413ad9a6c69a3)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/passdb/pdb_ldap.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 4e602cae40..2de02d9b76 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -382,7 +382,7 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass, acct_desc, munged_dial, workstations; - struct passwd *sys_user; + struct passwd *pw; uint32 user_rid, group_rid; uint8 smblmpwd[16], @@ -392,6 +392,7 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass, uint32 hours_len; uint8 hours[MAX_HOURS_LEN]; pstring temp; + uid_t uid = -1; gid_t gid = getegid(); @@ -499,12 +500,13 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass, /* These values MAY be in LDAP, but they can also be retrieved through * sys_getpw*() which is how we're doing it */ - sys_user = getpwnam_alloc(username); - if (sys_user == NULL) { + pw = getpwnam(username); + if (pw == NULL) { DEBUG (2,("init_sam_from_ldap: User [%s] does not ave a uid!\n", username)); return False; } - + uid = pw->pw_uid; + gid = pw->pw_gid; /* FIXME: hours stuff should be cleaner */ @@ -524,12 +526,9 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass, if (acct_ctrl == 0) acct_ctrl |= ACB_NORMAL; - pdb_set_uid(sampass, sys_user->pw_uid); - pdb_set_gid(sampass, sys_user->pw_gid); + pdb_set_uid(sampass, uid); + pdb_set_gid(sampass, gid); - /* We are done with this now */ - passwd_free(&sys_user); - pdb_set_acct_ctrl(sampass, acct_ctrl); pdb_set_logon_time(sampass, logon_time); pdb_set_logoff_time(sampass, logoff_time); |