summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-02-26 12:46:39 +0100
committerKarolin Seeger <kseeger@samba.org>2019-03-12 11:25:42 +0000
commitb0a1d90050c54bb22006b5c0e3c67187c20e7f04 (patch)
treec05f9127ea53c2556f02f10f08d62838ffaba8d8
parent14234542aa56dcee04609019db30c598f381a491 (diff)
downloadsamba-b0a1d90050c54bb22006b5c0e3c67187c20e7f04.tar.gz
idmap_cache: Only touch "sid" on success in find_xid_to_sid
Why? This makes the negative mapping condition (is_null_sid) more explicit in the code. The callers in lookup_sid initialized "psid" anyway before, and the ones in wb_xids2sids now do as well. This is more in line with other APIs we have: Only touch output parameters if you have something to say. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Bug: https://bugzilla.samba.org/show_bug.cgi?id=13813 (cherry picked from commit 4faf3e9f6da7515fc263d79f77226d105c2f8524)
-rw-r--r--source3/lib/idmap_cache.c5
-rw-r--r--source3/winbindd/wb_xids2sids.c2
2 files changed, 3 insertions, 4 deletions
diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c
index 0ec23df6a05..cf63a229da5 100644
--- a/source3/lib/idmap_cache.c
+++ b/source3/lib/idmap_cache.c
@@ -201,13 +201,11 @@ static void idmap_cache_xid2sid_parser(time_t timeout, DATA_BLOB blob,
(struct idmap_cache_xid2sid_state *)private_data;
char *value;
- ZERO_STRUCTP(state->sid);
- state->ret = false;
-
if ((blob.length == 0) || (blob.data[blob.length-1] != 0)) {
/*
* Not a string, can't be a valid mapping
*/
+ state->ret = false;
return;
}
@@ -217,6 +215,7 @@ static void idmap_cache_xid2sid_parser(time_t timeout, DATA_BLOB blob,
/*
* Return NULL SID, see comment to uid2sid
*/
+ *state->sid = (struct dom_sid) {0};
state->ret = true;
} else {
state->ret = string_to_sid(state->sid, value);
diff --git a/source3/winbindd/wb_xids2sids.c b/source3/winbindd/wb_xids2sids.c
index 1e251d8cbeb..766092b2664 100644
--- a/source3/winbindd/wb_xids2sids.c
+++ b/source3/winbindd/wb_xids2sids.c
@@ -462,7 +462,7 @@ struct tevent_req *wb_xids2sids_send(TALLOC_CTX *mem_ctx,
uint32_t i;
for (i=0; i<num_xids; i++) {
- struct dom_sid sid;
+ struct dom_sid sid = {0};
bool ok, expired;
switch (xids[i].type) {