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

rpc_server: Simplify find_policy_by_hnd_internal()

Best viewed with "git show -b". Use the typical pattern of an early
error return.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
This commit is contained in:
Volker Lendecke 2021-01-11 21:25:40 +01:00
parent acca9ec4b6
commit dcc8f37af1

View File

@ -153,22 +153,23 @@ static struct dcesrv_handle *find_policy_by_hnd_internal(
* pipes_struct if the handle type does not match
*/
h = dcesrv_handle_lookup(p->dce_call, hnd, DCESRV_HANDLE_ANY);
if (h != NULL) {
if (handle_type != DCESRV_HANDLE_ANY &&
h->wire_handle.handle_type != handle_type) {
/* Just return NULL, do not set a fault
* state in pipes_struct */
return NULL;
}
if (data_p) {
*data_p = h->data;
}
return h;
if (h == NULL) {
p->fault_state = DCERPC_FAULT_CONTEXT_MISMATCH;
return NULL;
}
p->fault_state = DCERPC_FAULT_CONTEXT_MISMATCH;
if (handle_type != DCESRV_HANDLE_ANY &&
h->wire_handle.handle_type != handle_type) {
/* Just return NULL, do not set a fault
* state in pipes_struct */
return NULL;
}
return NULL;
if (data_p) {
*data_p = h->data;
}
return h;
}
/****************************************************************************