1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3: wcache_invalidate_samlogon only needs the SID

This commit is contained in:
Volker Lendecke 2010-12-11 14:27:54 +01:00 committed by Volker Lendecke
parent e113b1c64f
commit a159958065
3 changed files with 15 additions and 12 deletions

View File

@ -2999,9 +2999,8 @@ static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf,
/* Invalidate the getpwnam and getgroups entries for a winbindd domain */
void wcache_invalidate_samlogon(struct winbindd_domain *domain,
struct netr_SamInfo3 *info3)
const struct dom_sid *sid)
{
struct dom_sid sid;
fstring key_str, sid_string;
struct winbind_cache *cache;
@ -3021,20 +3020,18 @@ void wcache_invalidate_samlogon(struct winbindd_domain *domain,
return;
}
sid_compose(&sid, info3->base.domain_sid, info3->base.rid);
/* Clear U/SID cache entry */
fstr_sprintf(key_str, "U/%s", sid_to_fstring(sid_string, &sid));
fstr_sprintf(key_str, "U/%s", sid_to_fstring(sid_string, sid));
DEBUG(10, ("wcache_invalidate_samlogon: clearing %s\n", key_str));
tdb_delete(cache->tdb, string_tdb_data(key_str));
/* Clear UG/SID cache entry */
fstr_sprintf(key_str, "UG/%s", sid_to_fstring(sid_string, &sid));
fstr_sprintf(key_str, "UG/%s", sid_to_fstring(sid_string, sid));
DEBUG(10, ("wcache_invalidate_samlogon: clearing %s\n", key_str));
tdb_delete(cache->tdb, string_tdb_data(key_str));
/* Samba/winbindd never needs this. */
netsamlogon_clear_cached_user(&sid);
netsamlogon_clear_cached_user(sid);
}
bool wcache_invalidate_cache(void)

View File

@ -1527,7 +1527,11 @@ process_result:
goto done;
}
wcache_invalidate_samlogon(find_domain_from_name(name_domain), info3);
sid_compose(&user_sid, info3->base.domain_sid,
info3->base.rid);
wcache_invalidate_samlogon(find_domain_from_name(name_domain),
&user_sid);
netsamlogon_cache_store(name_user, info3);
/* save name_to_sid info as early as possible (only if
@ -1535,8 +1539,6 @@ process_result:
the cache entry by storing the seq_num for the wrong
domain). */
if ( domain->primary ) {
sid_compose(&user_sid, info3->base.domain_sid,
info3->base.rid);
cache_name2sid(domain, name_domain, name_user,
SID_NAME_USER, &user_sid);
}
@ -1744,8 +1746,12 @@ enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
process_result:
if (NT_STATUS_IS_OK(result)) {
struct dom_sid user_sid;
wcache_invalidate_samlogon(find_domain_from_name(name_domain), info3);
sid_compose(&user_sid, info3->base.domain_sid,
info3->base.rid);
wcache_invalidate_samlogon(find_domain_from_name(name_domain),
&user_sid);
netsamlogon_cache_store(name_user, info3);
/* Check if the user is in the right group */

View File

@ -68,7 +68,7 @@ NTSTATUS wcache_save_creds(struct winbindd_domain *domain,
const struct dom_sid *sid,
const uint8 nt_pass[NT_HASH_LEN]);
void wcache_invalidate_samlogon(struct winbindd_domain *domain,
struct netr_SamInfo3 *info3);
const struct dom_sid *user_sid);
bool wcache_invalidate_cache(void);
bool wcache_invalidate_cache_noinit(void);
bool init_wcache(void);