mirror of
https://github.com/samba-team/samba.git
synced 2025-08-30 17:49:30 +03:00
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
This commit is contained in:
@ -203,13 +203,11 @@ static void idmap_cache_xid2sid_parser(const struct gencache_timeout *timeout,
|
|||||||
(struct idmap_cache_xid2sid_state *)private_data;
|
(struct idmap_cache_xid2sid_state *)private_data;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
ZERO_STRUCTP(state->sid);
|
|
||||||
state->ret = false;
|
|
||||||
|
|
||||||
if ((blob.length == 0) || (blob.data[blob.length-1] != 0)) {
|
if ((blob.length == 0) || (blob.data[blob.length-1] != 0)) {
|
||||||
/*
|
/*
|
||||||
* Not a string, can't be a valid mapping
|
* Not a string, can't be a valid mapping
|
||||||
*/
|
*/
|
||||||
|
state->ret = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,6 +217,7 @@ static void idmap_cache_xid2sid_parser(const struct gencache_timeout *timeout,
|
|||||||
/*
|
/*
|
||||||
* Return NULL SID, see comment to uid2sid
|
* Return NULL SID, see comment to uid2sid
|
||||||
*/
|
*/
|
||||||
|
*state->sid = (struct dom_sid) {0};
|
||||||
state->ret = true;
|
state->ret = true;
|
||||||
} else {
|
} else {
|
||||||
state->ret = string_to_sid(state->sid, value);
|
state->ret = string_to_sid(state->sid, value);
|
||||||
|
@ -465,7 +465,7 @@ struct tevent_req *wb_xids2sids_send(TALLOC_CTX *mem_ctx,
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i=0; i<num_xids; i++) {
|
for (i=0; i<num_xids; i++) {
|
||||||
struct dom_sid sid;
|
struct dom_sid sid = {0};
|
||||||
bool ok, expired;
|
bool ok, expired;
|
||||||
|
|
||||||
switch (xids[i].type) {
|
switch (xids[i].type) {
|
||||||
|
Reference in New Issue
Block a user