From: Samuel Cabrero Date: Thu, 7 May 2020 12:24:56 +0000 (+0200) Subject: s3: rpc_server: Remove SAMR specific policy_handle_find() function X-Git-Tag: ldb-2.2.0~342 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be024932efe70d45ad511171d40ad355c583a9c2;p=thirdparty%2Fsamba.git s3: rpc_server: Remove SAMR specific policy_handle_find() function The generic function already checks the handle type. Signed-off-by: Samuel Cabrero Reviewed-by: Andrew Bartlett --- diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 9b7669d64f6..e32c918fb48 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -463,29 +463,3 @@ bool pipe_access_check(struct pipes_struct *p) return True; } - -void *_policy_handle_find(struct pipes_struct *p, - const struct policy_handle *hnd, - uint8_t handle_type, - const char *name, const char *location, - NTSTATUS *pstatus) -{ - struct dcesrv_handle_old *rpc_hnd = NULL; - void *data; - - rpc_hnd = find_policy_by_hnd_internal(p, hnd, handle_type, &data); - if (rpc_hnd == NULL) { - *pstatus = NT_STATUS_INVALID_HANDLE; - return NULL; - } - if (strcmp(name, talloc_get_name(data)) != 0) { - DEBUG(10, ("expected %s, got %s\n", name, - talloc_get_name(data))); - *pstatus = NT_STATUS_INVALID_HANDLE; - return NULL; - } - - DEBUG(10, ("found handle of type %s\n", talloc_get_name(data))); - *pstatus = NT_STATUS_OK; - return data; -} diff --git a/source3/rpc_server/rpc_pipes.h b/source3/rpc_server/rpc_pipes.h index 90cd0655f55..9df438d33a5 100644 --- a/source3/rpc_server/rpc_pipes.h +++ b/source3/rpc_server/rpc_pipes.h @@ -133,13 +133,4 @@ bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd); void close_policy_by_pipe(struct pipes_struct *p); bool pipe_access_check(struct pipes_struct *p); -void *_policy_handle_find(struct pipes_struct *p, - const struct policy_handle *hnd, - uint8_t handle_type, - const char *name, const char *location, - NTSTATUS *pstatus); -#define policy_handle_find(_p, _hnd, _hnd_type, _type, _pstatus) \ - (_type *)_policy_handle_find((_p), (_hnd), (_hnd_type), \ - #_type, __location__, (_pstatus)) - #endif /* _RPC_PIPES_H_ */ diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 711faebba4a..ed029b33dc1 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -198,29 +198,27 @@ static void *samr_policy_handle_find(struct pipes_struct *p, { struct samr_info *info = NULL; NTSTATUS status; + bool ok; - info = policy_handle_find(p, - handle, - handle_type, - struct samr_info, - &status); - if (!NT_STATUS_IS_OK(status)) { - goto fail; + ok = find_policy_by_hnd(p, + handle, + handle_type, + (void **)(void *)&info); + if (!ok) { + *pstatus = NT_STATUS_INVALID_HANDLE; + return NULL; } status = samr_handle_access_check(info->access_granted, access_required, access_granted); if (!NT_STATUS_IS_OK(status)) { - goto fail; + *pstatus = status; + return NULL; } *pstatus = NT_STATUS_OK; return info; - -fail: - *pstatus = status; - return NULL; } static NTSTATUS make_samr_object_sd( TALLOC_CTX *ctx, struct security_descriptor **psd, size_t *sd_size,