diff options
author | Samuel Cabrero <scabrero@samba.org> | 2019-10-03 19:51:53 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-10-18 16:07:38 +0000 |
commit | e10028a05000f6b7a2a8252352ad5f720ad23e86 (patch) | |
tree | f5e5f50bf75a01817b07b0cd6da5b528cfacaa1f /librpc | |
parent | 08c663828c9482767b5128820f8204fd0fe4654e (diff) | |
download | samba-e10028a05000f6b7a2a8252352ad5f720ad23e86.tar.gz |
librpc:core: Return NTSTATUS for dcesrv_find_endpoint
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/rpc/dcesrv_core.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/librpc/rpc/dcesrv_core.c b/librpc/rpc/dcesrv_core.c index 9de64126bb9..526c86ad97c 100644 --- a/librpc/rpc/dcesrv_core.c +++ b/librpc/rpc/dcesrv_core.c @@ -75,16 +75,18 @@ static bool endpoints_match(const struct dcerpc_binding *ep1, /* find an endpoint in the dcesrv_context */ -static struct dcesrv_endpoint *dcesrv_find_endpoint(struct dcesrv_context *dce_ctx, - const struct dcerpc_binding *ep_description) +static NTSTATUS dcesrv_find_endpoint(struct dcesrv_context *dce_ctx, + const struct dcerpc_binding *ep_description, + struct dcesrv_endpoint **_out) { - struct dcesrv_endpoint *ep; + struct dcesrv_endpoint *ep = NULL; for (ep=dce_ctx->endpoint_list; ep; ep=ep->next) { if (endpoints_match(ep->ep_description, ep_description)) { - return ep; + *_out = ep; + return NT_STATUS_OK; } } - return NULL; + return NT_STATUS_NOT_FOUND; } /* @@ -281,9 +283,8 @@ _PUBLIC_ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx, /* check if this endpoint exists */ - ep = dcesrv_find_endpoint(dce_ctx, binding); - - if (ep != NULL) { + status = dcesrv_find_endpoint(dce_ctx, binding, &ep); + if (NT_STATUS_IS_OK(status)) { /* * We want a new port on ncacn_ip_tcp for NETLOGON, so * it can be multi-process. Other processes can also @@ -306,7 +307,7 @@ _PUBLIC_ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx, } } - if (ep == NULL || add_ep) { + if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND) || add_ep) { ep = talloc_zero(dce_ctx, struct dcesrv_endpoint); if (!ep) { return NT_STATUS_NO_MEMORY; @@ -331,6 +332,9 @@ _PUBLIC_ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx, } DLIST_ADD(ep->interface_list, ifl); + } else if (!NT_STATUS_IS_OK(status)) { + DBG_NOTICE("Failed to find endpoint: %s\n", nt_errstr(status)); + return status; } /* |