diff options
author | Gerald Carter <jerry@samba.org> | 2003-07-15 02:27:00 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-07-15 02:27:00 +0000 |
commit | 8582358d54f382bf77adf03fcfbd3653063341e4 (patch) | |
tree | d2e8fb31dda71e2f6912a9ff740036504023bb7e /source3 | |
parent | 7ca9b855b5f0bd643099bb910fd3d624dbda9551 (diff) | |
download | samba-8582358d54f382bf77adf03fcfbd3653063341e4.tar.gz samba-8582358d54f382bf77adf03fcfbd3653063341e4.tar.bz2 samba-8582358d54f382bf77adf03fcfbd3653063341e4.zip |
make sure to fallback to rid algoruthm for users not in smbpasswd (e.g. force user = foo)
(This used to be commit 399799c68cbc91cb3908b0d83ee4f51fa3bf3023)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/passdb/passdb.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index a126594d72..333ac8ace6 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -1051,6 +1051,7 @@ DOM_SID *local_uid_to_sid(DOM_SID *psid, uid_t uid) { SAM_ACCOUNT *sampw = NULL; struct passwd *unix_pw; + BOOL ret; winbind_off(); unix_pw = sys_getpwuid( uid ); @@ -1062,20 +1063,29 @@ DOM_SID *local_uid_to_sid(DOM_SID *psid, uid_t uid) } if ( !NT_STATUS_IS_OK(pdb_init_sam(&sampw)) ) { - DEBUG(0,("local_uid_to_sid: failed to allocate SAM_ACCOUTN object\n")); + DEBUG(0,("local_uid_to_sid: failed to allocate SAM_ACCOUNT object\n")); return NULL; } become_root(); - if ( !pdb_getsampwnam( sampw, unix_pw->pw_name ) ) { - unbecome_root(); + ret = pdb_getsampwnam( sampw, unix_pw->pw_name ); + unbecome_root(); + + if ( ret ) + sid_copy( psid, pdb_get_user_sid(sampw) ); + else { DEBUG(4,("local_uid_to_sid: User %s [uid == %d] has no samba account\n", unix_pw->pw_name, uid)); - return NULL; + + if ( !lp_enable_rid_algorithm() ) + return NULL; + + DEBUG(8,("local_uid_to_sid: falling back to RID algorithm\n")); + + sid_copy( psid, get_global_sam_sid() ); + sid_append_rid( psid, fallback_pdb_uid_to_user_rid(uid) ); } - unbecome_root(); - - sid_copy( psid, pdb_get_user_sid(sampw) ); + DEBUG(10,("local_uid_to_sid: uid (%d) -> SID %s (%s).\n", (unsigned int)uid, sid_string_static(psid), unix_pw->pw_name)); |