summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-05-03 02:41:10 +0200
committerVolker Lendecke <vl@samba.org>2008-05-06 12:16:02 +0200
commit1fe90d8d04368c09ba6509949b1281b8b887b04b (patch)
treee3fdbe29c49720171741e6411383ade577a45c5d /source3
parent611d79d0ed27a1762c40caeb12b383fd96a58511 (diff)
downloadsamba-1fe90d8d04368c09ba6509949b1281b8b887b04b.tar.gz
samba-1fe90d8d04368c09ba6509949b1281b8b887b04b.tar.bz2
samba-1fe90d8d04368c09ba6509949b1281b8b887b04b.zip
Fix a valgrind bug in the new [ug]id2sid cache
When we're given a SID, it is not always padded with zeros. Only look at the initialized parts in the SID. (This used to be commit 8717085dba832cfe6d7b807a10f779e495adc326)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/lookup_sid.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index 4341bc02cc..debd67b136 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -1027,7 +1027,7 @@ static bool fetch_uid_from_cache( uid_t *puid, const DOM_SID *psid )
DATA_BLOB cache_value;
if (!memcache_lookup(NULL, SID_UID_CACHE,
- data_blob_const(psid, sizeof(*psid)),
+ data_blob_const(psid, ndr_size_dom_sid(psid, 0)),
&cache_value)) {
return false;
}
@@ -1045,11 +1045,11 @@ static bool fetch_uid_from_cache( uid_t *puid, const DOM_SID *psid )
void store_uid_sid_cache(const DOM_SID *psid, uid_t uid)
{
memcache_add(NULL, SID_UID_CACHE,
- data_blob_const(psid, sizeof(*psid)),
+ data_blob_const(psid, ndr_size_dom_sid(psid, 0)),
data_blob_const(&uid, sizeof(uid)));
memcache_add(NULL, UID_SID_CACHE,
data_blob_const(&uid, sizeof(uid)),
- data_blob_const(psid, sizeof(*psid)));
+ data_blob_const(psid, ndr_size_dom_sid(psid, 0)));
}
/*****************************************************************
@@ -1081,7 +1081,7 @@ static bool fetch_gid_from_cache(gid_t *pgid, const DOM_SID *psid)
DATA_BLOB cache_value;
if (!memcache_lookup(NULL, SID_UID_CACHE,
- data_blob_const(psid, sizeof(*psid)),
+ data_blob_const(psid, ndr_size_dom_sid(psid, 0)),
&cache_value)) {
return false;
}
@@ -1099,11 +1099,11 @@ static bool fetch_gid_from_cache(gid_t *pgid, const DOM_SID *psid)
void store_gid_sid_cache(const DOM_SID *psid, gid_t gid)
{
memcache_add(NULL, SID_GID_CACHE,
- data_blob_const(psid, sizeof(*psid)),
+ data_blob_const(psid, ndr_size_dom_sid(psid, 0)),
data_blob_const(&gid, sizeof(gid)));
memcache_add(NULL, GID_SID_CACHE,
data_blob_const(&gid, sizeof(gid)),
- data_blob_const(psid, sizeof(*psid)));
+ data_blob_const(psid, ndr_size_dom_sid(psid, 0)));
}
/*****************************************************************