1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

rpc_server: Simplify dcesrv_handle_lookup()

Reduce indentation with a "break;" from the loop, best reviewed with
git show -b

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2021-09-20 16:42:08 +02:00 committed by Jeremy Allison
parent acaa89aac9
commit 1e30fad7ee

View File

@ -116,28 +116,36 @@ struct dcesrv_handle *dcesrv_handle_lookup(struct dcesrv_call_state *call,
for (h=context->conn->assoc_group->handles; h; h=h->next) {
if (h->wire_handle.handle_type == p->handle_type &&
GUID_equal(&p->uuid, &h->wire_handle.uuid)) {
if (!dom_sid_equal(&h->sid, sid)) {
struct dom_sid_buf buf1, buf2;
DBG_ERR("Attempt to use invalid sid %s - %s\n",
dom_sid_str_buf(&h->sid, &buf1),
dom_sid_str_buf(sid, &buf2));
return NULL;
}
if (call->auth_state->auth_level < h->min_auth_level) {
DEBUG(0,(__location__ ": Attempt to use invalid auth_level %u < %u\n",
call->auth_state->auth_level,
h->min_auth_level));
return NULL;
}
if (h->iface != context->iface) {
DEBUG(0,(__location__ ": Attempt to use invalid iface\n"));
return NULL;
}
return h;
break;
}
}
return NULL;
if (h == NULL) {
/* not found */
return NULL;
}
if (!dom_sid_equal(&h->sid, sid)) {
struct dom_sid_buf buf1, buf2;
DBG_ERR("Attempt to use invalid sid %s - %s\n",
dom_sid_str_buf(&h->sid, &buf1),
dom_sid_str_buf(sid, &buf2));
return NULL;
}
if (call->auth_state->auth_level < h->min_auth_level) {
DBG_ERR("Attempt to use invalid auth_level %u < %u\n",
call->auth_state->auth_level,
h->min_auth_level);
return NULL;
}
if (h->iface != context->iface) {
DBG_ERR("Attempt to use invalid iface\n");
return NULL;
}
return h;
}
struct dcesrv_iface_state {