summaryrefslogtreecommitdiffstats
path: root/source3/lib/access.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-20 16:05:57 +0100
committerVolker Lendecke <vl@samba.org>2007-12-21 09:58:20 +0100
commit89f7883fe9b62248e8cc9e508ddef3a26330f71c (patch)
tree95e837c9c446d1435d6211b144f3ed7710ddd356 /source3/lib/access.c
parent0565bc733566462bace3bf9dd17a6fe6cbe87db5 (diff)
downloadsamba-89f7883fe9b62248e8cc9e508ddef3a26330f71c.tar.gz
samba-89f7883fe9b62248e8cc9e508ddef3a26330f71c.tar.xz
samba-89f7883fe9b62248e8cc9e508ddef3a26330f71c.zip
Add a singleton cache
First user is yp_default_domain (This used to be commit c19363eb77fcc3e1bf3341e6373d38f1e91fc08f)
Diffstat (limited to 'source3/lib/access.c')
-rw-r--r--source3/lib/access.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source3/lib/access.c b/source3/lib/access.c
index 1e4df836079..6a463446d1a 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -97,13 +97,29 @@ static bool string_match(const char *tok,const char *s)
}
} else if (tok[0] == '@') { /* netgroup: look it up */
#ifdef HAVE_NETGROUP
- static char *mydomain = NULL;
+ DATA_BLOB tmp;
+ char *mydomain = NULL;
char *hostname = NULL;
bool netgroup_ok = false;
- if (!mydomain)
+ if (memcache_lookup(
+ NULL, SINGLETON_CACHE,
+ data_blob_string_const("yp_default_domain"),
+ &tmp)) {
+
+ SMB_ASSERT(tmp.length > 0);
+ mydomain = (tmp.data[0] == '\0')
+ ? NULL : (char *)tmp.data;
+ }
+ else {
yp_get_default_domain(&mydomain);
+ memcache_add(
+ NULL, SINGLETON_CACHE,
+ data_blob_string_const("yp_default_domain"),
+ data_blob_string_const(mydomain?mydomain:""));
+ }
+
if (!mydomain) {
DEBUG(0,("Unable to get default yp domain. "
"Try without it.\n"));