diff options
author | Gerald Carter <jerry@samba.org> | 2003-08-06 19:16:17 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-08-06 19:16:17 +0000 |
commit | 575483a1efe18a90055490117ba6894512ae568a (patch) | |
tree | 47abe9011ee109808ef6205261db3f815fc9f00f /source/passdb | |
parent | d98a68e0ebaf2fbd360b826f5df472bc3f94285b (diff) | |
download | samba-575483a1efe18a90055490117ba6894512ae568a.tar.gz samba-575483a1efe18a90055490117ba6894512ae568a.tar.xz samba-575483a1efe18a90055490117ba6894512ae568a.zip |
fix bug #208; have to get the gid of the user's primary group for %G
Diffstat (limited to 'source/passdb')
-rw-r--r-- | source/passdb/passdb.c | 7 | ||||
-rw-r--r-- | source/passdb/pdb_ldap.c | 11 |
2 files changed, 17 insertions, 1 deletions
diff --git a/source/passdb/passdb.c b/source/passdb/passdb.c index 8871cd7832d..e005913eb27 100644 --- a/source/passdb/passdb.c +++ b/source/passdb/passdb.c @@ -1300,6 +1300,7 @@ BOOL init_sam_from_buffer(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen) BOOL ret = True; uid_t uid = -1; gid_t gid = -1; + struct passwd *pw = NULL; if(sampass == NULL || buf == NULL) { DEBUG(0, ("init_sam_from_buffer: NULL parameters found!\n")); @@ -1355,6 +1356,12 @@ BOOL init_sam_from_buffer(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen) pdb_set_nt_username(sampass, nt_username, PDB_SET); pdb_set_fullname(sampass, fullname, PDB_SET); + + if ( (pw=Get_Pwnam(username)) != NULL ) { + uid = pw->pw_uid; + gid = pw->pw_gid; + } + if (homedir) { pdb_set_homedir(sampass, homedir, PDB_SET); } diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c index aee64957593..d458267b08b 100644 --- a/source/passdb/pdb_ldap.c +++ b/source/passdb/pdb_ldap.c @@ -419,8 +419,9 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, uint32 hours_len; uint8 hours[MAX_HOURS_LEN]; pstring temp; + struct passwd *pw = NULL; uid_t uid = -1; - gid_t gid = getegid(); + gid_t gid = -1; /* * do a little initialization @@ -455,6 +456,14 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, DEBUG(2, ("Entry found for user: %s\n", username)); + /* I'm not going to fail here, since there are checks + higher up the cal stack to do this --jerry */ + + if ( (pw=Get_Pwnam(username)) != NULL ) { + uid = pw->pw_uid; + gid = pw->pw_gid; + } + pstrcpy(nt_username, username); pstrcpy(domain, ldap_state->domain_name); |