diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-05-13 01:00:25 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-05-13 01:00:25 +0000 |
commit | ddb600102f1d67fc55e31d2cc7d181f1d48afcef (patch) | |
tree | ade81f154289e2fa3c749c8b8f7b652f351028f9 /source3/passdb | |
parent | 834612d9fc3ce15991e1e3b97bc0af02d23775d5 (diff) | |
download | samba-ddb600102f1d67fc55e31d2cc7d181f1d48afcef.tar.gz samba-ddb600102f1d67fc55e31d2cc7d181f1d48afcef.tar.bz2 samba-ddb600102f1d67fc55e31d2cc7d181f1d48afcef.zip |
Try to fix up some code in pdb_smbpasswd that assumed we still had a 'uid'.
This is to get non-unix accounts going for the build farm.
Andrew Bartlett
(This used to be commit 3daf7cba2393af768b253c419152ea305204f3d8)
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/pdb_smbpasswd.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 91fc7bc8e0..6a7d7c42ad 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1133,24 +1133,34 @@ Error was %s\n", pwd->smb_name, pfile2, strerror(errno))); ********************************************************************/ static BOOL build_smb_pass (struct smb_passwd *smb_pw, const SAM_ACCOUNT *sampass) { - uid_t uid; uint32 rid; if (sampass == NULL) return False; - - rid = pdb_get_user_rid(sampass); - - /* If the user specified a RID, make sure its able to be both stored and retreived */ - if (rid && rid != DOMAIN_USER_RID_GUEST && uid != fallback_pdb_user_rid_to_uid(rid)) { - DEBUG(0,("build_sam_pass: Failing attempt to store user with non-uid based user RID. \n")); - return False; - } - ZERO_STRUCTP(smb_pw); - smb_pw->smb_userid_set = True; - smb_pw->smb_userid=uid; + if (!IS_SAM_DEFAULT(sampass, PDB_USERSID)) { + rid = pdb_get_user_rid(sampass); + + /* If the user specified a RID, make sure its able to be both stored and retreived */ + if (rid == DOMAIN_USER_RID_GUEST) { + struct passwd *passwd = getpwnam_alloc(lp_guestaccount()); + if (!passwd) { + DEBUG(0, ("Could not find gest account via getpwnam()! (%s)\n", lp_guestaccount())); + return False; + } + smb_pw->smb_userid_set = True; + smb_pw->smb_userid=passwd->pw_uid; + passwd_free(&passwd); + + } else if (fallback_pdb_rid_is_user(rid)) { + smb_pw->smb_userid_set = True; + smb_pw->smb_userid=fallback_pdb_user_rid_to_uid(rid); + } else { + DEBUG(0,("build_sam_pass: Failing attempt to store user with non-uid based user RID. \n")); + return False; + } + } smb_pw->smb_name=(const char*)pdb_get_username(sampass); |