diff options
author | Volker Lendecke <vl@samba.org> | 2021-01-11 21:25:40 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2021-01-14 13:29:35 +0000 |
commit | dcc8f37af148df11ebc848013933967da45b0698 (patch) | |
tree | 3bec901fc8d310116cf5d78025b5cc821a39aeaa /source3/rpc_server | |
parent | acca9ec4b606173c85809bbc0894011c0e29bab0 (diff) | |
download | samba-dcc8f37af148df11ebc848013933967da45b0698.tar.gz |
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>
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/rpc_handles.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index d897e0caabe..45968746440 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -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; + } + + 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; } - p->fault_state = DCERPC_FAULT_CONTEXT_MISMATCH; + if (data_p) { + *data_p = h->data; + } - return NULL; + return h; } /**************************************************************************** |