s4/test: remove local impl for open_domain and use common one
authorKamen Mazdrashki <kamenim@samba.org>
Fri, 28 May 2010 02:20:18 +0000 (05:20 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Fri, 28 May 2010 19:30:09 +0000 (22:30 +0300)
source4/torture/libnet/libnet_user.c
source4/torture/libnet/utils.c

index 4bda76378d82ec75783f762679eac408f6d3a3e4..7002b13e93ce504163ae4c33b4dc18e3feb51493 100644 (file)
@@ -26,6 +26,7 @@
 #include "librpc/gen_ndr/ndr_lsa_c.h"
 #include "torture/rpc/torture_rpc.h"
 #include "torture/libnet/usertest.h"
+#include "torture/libnet/proto.h"
 #include "param/param.h"
 #include "lib/ldb_wrap.h"
 
@@ -156,59 +157,6 @@ static bool test_cleanup(struct torture_context *tctx,
 }
 
 
-static bool test_opendomain(struct torture_context *tctx,
-                           struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
-                           struct policy_handle *handle, struct lsa_String *domname)
-{
-       struct policy_handle h, domain_handle;
-       struct samr_Connect r1;
-       struct samr_LookupDomain r2;
-       struct dom_sid2 *sid = NULL;
-       struct samr_OpenDomain r3;
-
-       torture_comment(tctx, "connecting\n");
-
-       r1.in.system_name = 0;
-       r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
-       r1.out.connect_handle = &h;
-
-       torture_assert_ntstatus_ok(tctx,
-               dcerpc_samr_Connect_r(b, mem_ctx, &r1),
-               "Connect failed");
-       torture_assert_ntstatus_ok(tctx, r1.out.result,
-               "Connect failed");
-
-       r2.in.connect_handle = &h;
-       r2.in.domain_name = domname;
-       r2.out.sid = &sid;
-
-       torture_comment(tctx, "domain lookup on %s\n", domname->string);
-
-       torture_assert_ntstatus_ok(tctx,
-               dcerpc_samr_LookupDomain_r(b, mem_ctx, &r2),
-               "LookupDomain failed");
-       torture_assert_ntstatus_ok(tctx, r2.out.result,
-               "LookupDomain failed");
-
-       r3.in.connect_handle = &h;
-       r3.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
-       r3.in.sid = *r2.out.sid;
-       r3.out.domain_handle = &domain_handle;
-
-       torture_comment(tctx, "opening domain\n");
-
-       torture_assert_ntstatus_ok(tctx,
-               dcerpc_samr_OpenDomain_r(b, mem_ctx, &r3),
-               "OpenDomain failed");
-       torture_assert_ntstatus_ok(tctx, r3.out.result,
-               "OpenDomain failed");
-
-       *handle = domain_handle;
-
-       return true;
-}
-
-
 static bool test_samr_close(struct torture_context *tctx,
                            struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
                            struct policy_handle *domain_handle)
@@ -378,7 +326,7 @@ bool torture_deleteuser(struct torture_context *torture)
        }
 
        domain_name.string = lp_workgroup(torture->lp_ctx);
-       if (!test_opendomain(torture, p->binding_handle, prep_mem_ctx, &h, &domain_name)) {
+       if (!test_domain_open(torture, p->binding_handle, &domain_name, prep_mem_ctx, &h, NULL)) {
                ret = false;
                goto done;
        }
@@ -599,7 +547,7 @@ bool torture_modifyuser(struct torture_context *torture)
        name = talloc_strdup(prep_mem_ctx, TEST_USERNAME);
 
        domain_name.string = lp_workgroup(torture->lp_ctx);
-       if (!test_opendomain(torture, b, prep_mem_ctx, &h, &domain_name)) {
+       if (!test_domain_open(torture, b, &domain_name, prep_mem_ctx, &h, NULL)) {
                ret = false;
                goto done;
        }
@@ -714,7 +662,7 @@ bool torture_userinfo_api(struct torture_context *torture)
        b = p->binding_handle;
 
        domain_name.string = lp_workgroup(torture->lp_ctx);
-       if (!test_opendomain(torture, b, prep_mem_ctx, &h, &domain_name)) {
+       if (!test_domain_open(torture, b, &domain_name, prep_mem_ctx, &h, NULL)) {
                ret = false;
                goto done;
        }
index 0bd8a7c0dca5f0192acbf11c4c7df159578fce41..02baf07046e0dd73c1aae5ba8eba1e228f839b87 100644 (file)
@@ -26,7 +26,7 @@
 #include "torture/rpc/torture_rpc.h"
 #include "libnet/libnet.h"
 #include "librpc/gen_ndr/ndr_samr_c.h"
-#include "torture/libnet/utils.h"
+#include "torture/libnet/proto.h"
 
 /**
  * Opens handle on Domain using SAMR