r2952: add idl and torture test for DsCrackNames
authorStefan Metzmacher <metze@samba.org>
Wed, 13 Oct 2004 14:25:44 +0000 (14:25 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:51 +0000 (12:59 -0500)
(I need to find out what the fields mean but it works)

metze
(This used to be commit eff51fc623f2e7b57e7e53eb81760684815db2f4)

source4/librpc/idl/drsuapi.idl
source4/rpc_server/drsuapi/dcesrv_drsuapi.c
source4/torture/rpc/drsuapi.c

index 74ed5ed1e8df9955e4760f209b2179f084a2907b..fc9aee6b7f80fb869ad35892a4728a081e72b7e6 100644 (file)
@@ -71,8 +71,46 @@ interface drsuapi
        NTSTATUS DRSUAPI_GET_NT4_CHANGELOG();
 
        /*****************/
-        /* Function 0x0c */
-       NTSTATUS DRSUAPI_CRACKNAMES();
+       /* Function 0x0c */
+       typedef struct {
+               unistr *str;
+       } drsuapi_DsCrackNamesInInfo1Names;
+
+       typedef struct {
+               uint32 unknown1;
+               uint32 unknown2;
+               uint32 unknown3;
+               uint32 unknown4;
+               uint32 unknown5;
+               [range(1,10000)] uint32 count;
+               [size_is(count)] drsuapi_DsCrackNamesInInfo1Names *names;
+       } drsuapi_DsCrackNamesInInfo1;
+
+       typedef union {
+               [case(1)] drsuapi_DsCrackNamesInInfo1 info1;
+       } drsuapi_DsCrackNamesInInfo;
+
+       typedef struct {
+               uint32 unknown1;
+               unistr *name1;
+               unistr *name2;
+       } drsuapi_DsCrackNamesOutInfo1Names;
+
+       typedef struct {
+               uint32 count;
+               [size_is(count)] drsuapi_DsCrackNamesOutInfo1Names *names;
+       } drsuapi_DsCrackNamesOutInfo1;
+
+       typedef union {
+               [case(1)] drsuapi_DsCrackNamesOutInfo1 *info1;
+       } drsuapi_DsCrackNamesOutInfo;
+
+       NTSTATUS drsuapi_DsCrackNames(
+               [in,ref] policy_handle *bind_handle,
+               [in, out] uint32 level,
+               [in,switch_is(level)] drsuapi_DsCrackNamesInInfo in,
+               [out,switch_is(level)] drsuapi_DsCrackNamesOutInfo out
+               );
 
        /*****************/
         /* Function 0x0d */
index d90920921176bec99e029ff6054394e52c1df735..9d1e5968a26e6639b0351eccd3e0f55e1d302245 100644 (file)
@@ -190,10 +190,10 @@ static NTSTATUS DRSUAPI_GET_NT4_CHANGELOG(struct dcesrv_call_state *dce_call, TA
 
 
 /* 
-  DRSUAPI_CRACKNAMES 
+  drsuapi_DsCrackNames 
 */
-static NTSTATUS DRSUAPI_CRACKNAMES(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-                      struct DRSUAPI_CRACKNAMES *r)
+static NTSTATUS drsuapi_DsCrackNames(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+                      struct drsuapi_DsCrackNames *r)
 {
        DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 }
index 907183083b8c207c17d8489908b86e366ba0acf1..aed7f884d2f1b8777f923b3d6ffdf84143d0a449 100644 (file)
@@ -48,6 +48,40 @@ static BOOL test_DsBind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        return ret;
 }
 
+static BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+                     struct policy_handle *bind_handle)
+{
+       NTSTATUS status;
+       struct drsuapi_DsCrackNames r;
+       struct drsuapi_DsCrackNamesInInfo1Names names[1];
+       BOOL ret = True;
+
+       ZERO_STRUCT(r);
+       r.in.bind_handle = bind_handle;
+       r.in.level = 1;
+       r.in.in.info1.unknown1 = 0x000004e4;
+       r.in.in.info1.unknown2 = 0x00000407;
+       r.in.in.info1.unknown3 = 0x00000000;
+       r.in.in.info1.unknown4 = 0x00000007;
+       r.in.in.info1.unknown5 = 0x00000002;
+       r.in.in.info1.count = 1;
+       r.in.in.info1.names = names;
+       
+       names[0].str = talloc_asprintf(mem_ctx, "%s/", lp_realm());
+
+       status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
+       if (!NT_STATUS_IS_OK(status)) {
+               const char *errstr = nt_errstr(status);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
+                       errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
+               }
+               printf("drsuapi_DsCrackNames failed - %s\n", errstr);
+               ret = False;
+       }
+
+       return ret;
+}
+
 static BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
                        struct policy_handle *bind_handle)
 {
@@ -95,6 +129,10 @@ BOOL torture_rpc_drsuapi(int dummy)
                ret = False;
        }
 
+       if (!test_DsCrackNames(p, mem_ctx, &bind_handle)) {
+               ret = False;
+       }
+
        if (!test_DsUnbind(p, mem_ctx, &bind_handle)) {
                ret = False;
        }