]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: rpc_server: Remove SAMR specific policy_handle_find() function
authorSamuel Cabrero <scabrero@samba.org>
Thu, 7 May 2020 12:24:56 +0000 (14:24 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 24 May 2020 23:55:36 +0000 (23:55 +0000)
The generic function already checks the handle type.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpc_server/rpc_handles.c
source3/rpc_server/rpc_pipes.h
source3/rpc_server/samr/srv_samr_nt.c

index 9b7669d64f6fa46563b83fdd044ac3aabf463dfc..e32c918fb48aa64c3b530d7187b678a16833751b 100644 (file)
@@ -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;
-}
index 90cd0655f5570f0eccb8c457695f3469b2d3bd00..9df438d33a5259cc5394585191f7ab968f733194 100644 (file)
@@ -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_ */
index 711faebba4a57adfdb7b1f2b31950dd9d41c4fc2..ed029b33dc1b49af58ec711406b7596de37edc5b 100644 (file)
@@ -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,