diff options
author | Andreas Schneider <asn@samba.org> | 2011-08-19 17:28:37 +0200 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2011-08-21 09:08:25 -0400 |
commit | 177db0a8802842a0eb9801622bee9f4c1592ef88 (patch) | |
tree | 7e6ce29f00fa7ef54649b799af50dcfc8c798e2d /source3/passdb | |
parent | 0f4ee5d1b7bc1e8122982450dc0730ac1500a9c9 (diff) | |
download | samba-177db0a8802842a0eb9801622bee9f4c1592ef88.tar.gz samba-177db0a8802842a0eb9801622bee9f4c1592ef88.tar.bz2 samba-177db0a8802842a0eb9801622bee9f4c1592ef88.zip |
s3-id_cache: Move id caches mgmt out of smbd
We must leave the MSG_IDMAP_KILL operation in SMBD as it uses smbd
specific internal globals and makes sense only in the context of a smbd
daemon.
The rest is moved under lib/ as we need to deal with id cache cleanups
in other daemons too (like lsasd).
Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/lookup_sid.c | 65 | ||||
-rw-r--r-- | source3/passdb/lookup_sid.h | 5 |
2 files changed, 0 insertions, 70 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index 8b5330c097..4c2e73befd 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -1745,68 +1745,3 @@ done: return NT_STATUS_OK; } -bool delete_uid_cache(uid_t puid) -{ - DATA_BLOB uid = data_blob_const(&puid, sizeof(puid)); - DATA_BLOB sid; - - if (!memcache_lookup(NULL, UID_SID_CACHE, uid, &sid)) { - DEBUG(3, ("UID %d is not memcached!\n", (int)puid)); - return false; - } - DEBUG(3, ("Delete mapping UID %d <-> %s from memcache\n", (int)puid, - sid_string_dbg((struct dom_sid*)sid.data))); - memcache_delete(NULL, SID_UID_CACHE, sid); - memcache_delete(NULL, UID_SID_CACHE, uid); - return true; -} - -bool delete_gid_cache(gid_t pgid) -{ - DATA_BLOB gid = data_blob_const(&pgid, sizeof(pgid)); - DATA_BLOB sid; - if (!memcache_lookup(NULL, GID_SID_CACHE, gid, &sid)) { - DEBUG(3, ("GID %d is not memcached!\n", (int)pgid)); - return false; - } - DEBUG(3, ("Delete mapping GID %d <-> %s from memcache\n", (int)pgid, - sid_string_dbg((struct dom_sid*)sid.data))); - memcache_delete(NULL, SID_GID_CACHE, sid); - memcache_delete(NULL, GID_SID_CACHE, gid); - return true; -} - -bool delete_sid_cache(const struct dom_sid* psid) -{ - DATA_BLOB sid = data_blob_const(psid, ndr_size_dom_sid(psid, 0)); - DATA_BLOB id; - if (memcache_lookup(NULL, SID_GID_CACHE, sid, &id)) { - DEBUG(3, ("Delete mapping %s <-> GID %d from memcache\n", - sid_string_dbg(psid), *(int*)id.data)); - memcache_delete(NULL, SID_GID_CACHE, sid); - memcache_delete(NULL, GID_SID_CACHE, id); - } else if (memcache_lookup(NULL, SID_UID_CACHE, sid, &id)) { - DEBUG(3, ("Delete mapping %s <-> UID %d from memcache\n", - sid_string_dbg(psid), *(int*)id.data)); - memcache_delete(NULL, SID_UID_CACHE, sid); - memcache_delete(NULL, UID_SID_CACHE, id); - } else { - DEBUG(3, ("SID %s is not memcached!\n", sid_string_dbg(psid))); - return false; - } - return true; -} - -void flush_gid_cache(void) -{ - DEBUG(3, ("Flush GID <-> SID memcache\n")); - memcache_flush(NULL, SID_GID_CACHE); - memcache_flush(NULL, GID_SID_CACHE); -} - -void flush_uid_cache(void) -{ - DEBUG(3, ("Flush UID <-> SID memcache\n")); - memcache_flush(NULL, SID_UID_CACHE); - memcache_flush(NULL, UID_SID_CACHE); -} diff --git a/source3/passdb/lookup_sid.h b/source3/passdb/lookup_sid.h index b56aaba039..5ce455d08b 100644 --- a/source3/passdb/lookup_sid.h +++ b/source3/passdb/lookup_sid.h @@ -91,10 +91,5 @@ NTSTATUS get_primary_group_sid(TALLOC_CTX *mem_ctx, const char *username, struct passwd **_pwd, struct dom_sid **_group_sid); -bool delete_uid_cache(uid_t uid); -bool delete_gid_cache(gid_t gid); -bool delete_sid_cache(const struct dom_sid* psid); -void flush_uid_cache(void); -void flush_gid_cache(void); #endif /* _PASSDB_LOOKUP_SID_H_ */ |