r4156: GetKeySecurity() IDL and torture test
authorJelmer Vernooij <jelmer@samba.org>
Sat, 11 Dec 2004 23:28:48 +0000 (23:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:07:20 +0000 (13:07 -0500)
(This used to be commit 1c49de51aeb6041a3b53b8da7dc8e2bcf089bfe0)

source4/librpc/idl/winreg.idl
source4/torture/rpc/winreg.c

index d721172507191e7ba7965d671fa373bf62cadc6e..370ca828b13b654403d756b56381b767c7a46136 100644 (file)
        );
 
        typedef struct {
-               uint32 max_len;
-               uint32 offset;
+               [size_is(size),length_is(len)] uint8 *data;
+               uint32 size;
                uint32 len;
-       } KeySecuritySize;
-
-       typedef struct {
-               uint32 max_len;
-               DATA_BLOB data;
        } KeySecurityData;
 
        /******************/
        /* Function: 0x0c */
        WERROR winreg_GetKeySecurity(
                [in,ref] policy_handle *handle,
-               [in] uint32 unknown,
-               [in,out] KeySecuritySize *size,
-               [in,out] KeySecurityData data
+               [in] uint32 access_mask,
+               [in,out,ref] KeySecurityData *data
        );
 
        /******************/
index be1ca03b6fbbb7b187867c6222571afb41afa5a7..183128d3718367991c9781f1493ef2920de82150 100644 (file)
@@ -95,6 +95,36 @@ static BOOL test_CreateKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        return True;
 }
 
+static BOOL test_GetKeySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+                         struct policy_handle *handle)
+{
+       NTSTATUS status;
+       struct winreg_GetKeySecurity r;
+
+       printf("\ntesting GetKeySecurity\n");
+
+       ZERO_STRUCT(r);
+
+       r.in.handle = handle;
+       r.in.data = r.out.data =  talloc_zero_p(mem_ctx, struct KeySecurityData);
+       r.in.data->size = 0xffff;
+       r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+
+       status = dcerpc_winreg_GetKeySecurity(p, mem_ctx, &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("GetKeySecurity failed - %s\n", nt_errstr(status));
+               return False;
+       }
+
+       if (!W_ERROR_IS_OK(r.out.result)) {
+               printf("GetKeySecurity failed - %s\n", win_errstr(r.out.result));
+               return False;
+       }
+
+       return False;
+}
+
 static BOOL test_CloseKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
                          struct policy_handle *handle)
 {
@@ -540,12 +570,17 @@ static BOOL test_key(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        if (!test_QueryInfoKey(p, mem_ctx, handle, NULL)) {
        }
 
+
+       if (!test_GetKeySecurity(p, mem_ctx, handle)) {
+       }
+
        if (!test_EnumKey(p, mem_ctx, handle, depth)) {
        }
 
        if (!test_EnumValue(p, mem_ctx, handle, 0xFF, 0xFFFF)) {
        }
 
+
        test_CloseKey(p, mem_ctx, handle);
 
        return True;