r1649: do a join as dc and run this test as the machine account
authorStefan Metzmacher <metze@samba.org>
Wed, 4 Aug 2004 09:33:41 +0000 (09:33 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:57:47 +0000 (12:57 -0500)
metze
(This used to be commit 59de2b1f528fb82fbfcf9c3783dd733a36d3fb6c)

source4/torture/rpc/drsuapi.c

index a2f3eb61042f6ffa19a4ed23a0a53f9d0dd38698..2938a1a7440eca8087bf6be9c3ca99f5e5d6d454 100644 (file)
 
 #include "includes.h"
 
+static const char *machine_password;
 
+#define TEST_MACHINE_NAME "torturetest"
+
+#if 0
 static void reopen(struct dcerpc_pipe **p, const struct dcerpc_interface_table *iface)
 {
        NTSTATUS status;
@@ -179,6 +183,7 @@ static BOOL test_scan(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
        test_scan_call(mem_ctx, &dcerpc_table_drsuapi, 0x0);
        return True;
 }
+#endif
 
 static BOOL test_DRSBind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {
@@ -203,28 +208,50 @@ BOOL torture_rpc_drsuapi(int dummy)
         struct dcerpc_pipe *p;
        TALLOC_CTX *mem_ctx;
        BOOL ret = True;
+       void *join_ctx;
+       const char *binding = lp_parm_string(-1, "torture", "binding");
+
+       if (!binding) {
+               printf("You must specify a ncacn binding string\n");
+               return False;
+       }
 
-       mem_ctx = talloc_init("torture_rpc_srvsvc");
+       lp_set_cmdline("netbios name", TEST_MACHINE_NAME);
+
+       join_ctx = torture_join_domain(TEST_MACHINE_NAME, lp_workgroup(), ACB_SVRTRUST, 
+                                      &machine_password);
+       if (!join_ctx) {
+               printf("Failed to join as BDC\n");
+               return False;
+       }
+
+       status = dcerpc_pipe_connect(&p, binding,
+                                       DCERPC_DRSUAPI_UUID,
+                                       DCERPC_DRSUAPI_VERSION,
+                                       lp_workgroup(), 
+                                       TEST_MACHINE_NAME"$",
+                                       machine_password);
 
-       status = torture_rpc_connection(&p,
-                                       DCERPC_DRSUAPI_NAME,
-                                       DCERPC_DRSUAPI_UUID,
-                                       DCERPC_DRSUAPI_VERSION);
        if (!NT_STATUS_IS_OK(status)) {
                return False;
        }
 
+       mem_ctx = talloc_init("torture_rpc_drsuapi");
+
        if (!test_DRSBind(p, mem_ctx)) {
                ret = False;
        }
 
+#if 0
        if (!test_scan(p, mem_ctx)) {
                ret = False;
        }
-
+#endif
        talloc_destroy(mem_ctx);
 
         torture_rpc_close(p);
 
+       torture_leave_domain(join_ctx);
+
        return ret;
 }