From 8f547d13d8a3aeaea3db700fba18227a28a30218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Wed, 8 Jun 2011 12:56:10 +0200 Subject: [PATCH] s3-winbindd: make sure we obey the -n switch also for samlogon cache access. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Wed Jun 8 14:44:31 CEST 2011 on sn-devel-104 --- source3/winbindd/winbindd_ads.c | 2 +- source3/winbindd/winbindd_cache.c | 4 ++++ source3/winbindd/winbindd_creds.c | 4 ++++ source3/winbindd/winbindd_msrpc.c | 6 ++++-- source3/winbindd/winbindd_util.c | 4 ++++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c index 3099ff0..51d38bc 100644 --- a/source3/winbindd/winbindd_ads.c +++ b/source3/winbindd/winbindd_ads.c @@ -497,7 +497,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain, /* try netsamlogon cache first */ - if ( (user = netsamlogon_cache_get( mem_ctx, sid )) != NULL ) + if (winbindd_use_cache() && (user = netsamlogon_cache_get( mem_ctx, sid )) != NULL ) { DEBUG(5,("query_user: Cache lookup succeeded for %s\n", sid_string_dbg(sid))); diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index ea503e1..ff86460 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -1299,6 +1299,10 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain, uint32 rid; fstring tmp; + if (!winbindd_use_cache()) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + if (!cache->tdb) { return NT_STATUS_INTERNAL_DB_ERROR; } diff --git a/source3/winbindd/winbindd_creds.c b/source3/winbindd/winbindd_creds.c index 6bbd0ff..a160f7a 100644 --- a/source3/winbindd/winbindd_creds.c +++ b/source3/winbindd/winbindd_creds.c @@ -38,6 +38,10 @@ NTSTATUS winbindd_get_creds(struct winbindd_domain *domain, struct netr_SamInfo3 *info; NTSTATUS status; + if (!winbindd_use_cache()) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + status = wcache_get_creds(domain, mem_ctx, sid, cached_nt_pass, cred_salt); if (!NT_STATUS_IS_OK(status)) { return status; diff --git a/source3/winbindd/winbindd_msrpc.c b/source3/winbindd/winbindd_msrpc.c index 921cdb5..95ab73b 100644 --- a/source3/winbindd/winbindd_msrpc.c +++ b/source3/winbindd/winbindd_msrpc.c @@ -400,7 +400,7 @@ static NTSTATUS msrpc_query_user(struct winbindd_domain *domain, { struct rpc_pipe_client *samr_pipe; struct policy_handle dom_pol; - struct netr_SamInfo3 *user; + struct netr_SamInfo3 *user = NULL; TALLOC_CTX *tmp_ctx; NTSTATUS status; @@ -418,7 +418,9 @@ static NTSTATUS msrpc_query_user(struct winbindd_domain *domain, } /* try netsamlogon cache first */ - user = netsamlogon_cache_get(tmp_ctx, user_sid); + if (winbindd_use_cache()) { + user = netsamlogon_cache_get(tmp_ctx, user_sid); + } if (user != NULL) { DEBUG(5,("msrpc_query_user: Cache lookup succeeded for %s\n", sid_string_dbg(user_sid))); diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 37b6578..3ae3050 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -1022,6 +1022,10 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain, *user_sids = NULL; *p_num_groups = 0; + if (!winbindd_use_cache()) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + info3 = netsamlogon_cache_get(mem_ctx, user_sid); if (info3 == NULL) { -- 1.7.1