summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2010-07-13 15:37:13 +0200
committerAndreas Schneider <asn@samba.org>2010-07-13 19:17:41 +0200
commitf85167a161b078b0ffa23598a4a548fb2fd54cbf (patch)
treec745c10026f181143170fe36ac71b9eb0b2875fe
parent57ebc8af8061e1a81a46300154ac6c4d489b302a (diff)
downloadsamba-f85167a161b078b0ffa23598a4a548fb2fd54cbf.tar.gz
samba-f85167a161b078b0ffa23598a4a548fb2fd54cbf.tar.bz2
samba-f85167a161b078b0ffa23598a4a548fb2fd54cbf.zip
s3-winbind: Don't cache queries to builtin and own sam domain.
-rw-r--r--source3/winbindd/winbindd_cache.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index a3e202bc7e..631a14d413 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -669,6 +669,26 @@ static struct cache_entry *wcache_fetch_raw(char *kstr)
return centry;
}
+static bool is_my_own_sam_domain(struct winbindd_domain *domain)
+{
+ if (strequal(domain->name, get_global_sam_name()) &&
+ sid_equal(&domain->sid, get_global_sam_sid())) {
+ return true;
+ }
+
+ return false;
+}
+
+static bool is_builtin_domain(struct winbindd_domain *domain)
+{
+ if (strequal(domain->name, "BUILTIN") &&
+ sid_equal(&domain->sid, &global_sid_Builtin)) {
+ return true;
+ }
+
+ return false;
+}
+
/*
fetch an entry from the cache, with a varargs key. auto-fetch the sequence
number and return status
@@ -684,7 +704,9 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache,
char *kstr;
struct cache_entry *centry;
- if (!winbindd_use_cache()) {
+ if (!winbindd_use_cache() ||
+ is_my_own_sam_domain(domain) ||
+ is_builtin_domain(domain)) {
return NULL;
}
@@ -4681,7 +4703,9 @@ bool wcache_fetch_ndr(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
TDB_DATA key, data;
bool ret = false;
- if (!wcache_opnum_cacheable(opnum)) {
+ if (!wcache_opnum_cacheable(opnum) ||
+ is_my_own_sam_domain(domain) ||
+ is_builtin_domain(domain)) {
return false;
}
@@ -4737,7 +4761,9 @@ void wcache_store_ndr(struct winbindd_domain *domain, uint32_t opnum,
TDB_DATA key, data;
uint32_t dom_seqnum, last_check;
- if (!wcache_opnum_cacheable(opnum)) {
+ if (!wcache_opnum_cacheable(opnum) ||
+ is_my_own_sam_domain(domain) ||
+ is_builtin_domain(domain)) {
return;
}