s4/test-libnet: Remove multiple test_samr_close() impelementations
authorKamen Mazdrashki <kamenim@samba.org>
Fri, 28 May 2010 19:14:39 +0000 (22:14 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Fri, 28 May 2010 19:30:10 +0000 (22:30 +0300)
We now have a nice common test_samr_close_handle() function to use

source4/torture/libnet/libnet_group.c
source4/torture/libnet/libnet_user.c

index 10d1f1cf500821da3d40a6a038f9cf8bf60628f8..f26f9880271f162fec7cf97ecc8ac450c45a9ae5 100644 (file)
@@ -25,6 +25,7 @@
 #include "librpc/gen_ndr/ndr_samr_c.h"
 #include "librpc/gen_ndr/ndr_lsa_c.h"
 #include "torture/rpc/torture_rpc.h"
+#include "torture/libnet/proto.h"
 #include "param/param.h"
 
 
@@ -191,25 +192,6 @@ static bool test_opendomain(struct torture_context *tctx,
 }
 
 
-static bool test_samr_close(struct torture_context *tctx,
-                           struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
-                           struct policy_handle *domain_handle)
-{
-       struct samr_Close r;
-
-       r.in.handle = domain_handle;
-       r.out.handle = domain_handle;
-
-       torture_assert_ntstatus_ok(tctx,
-               dcerpc_samr_Close_r(b, mem_ctx, &r),
-               "Close samr domain failed");
-       torture_assert_ntstatus_ok(tctx, r.out.result,
-               "Close samr domain failed");
-
-       return true;
-}
-
-
 static bool test_lsa_close(struct torture_context *tctx,
                           struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
                           struct policy_handle *domain_handle)
@@ -285,7 +267,8 @@ bool torture_groupinfo_api(struct torture_context *torture)
                goto done;
        }
 
-       if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
+       if (!test_samr_close_handle(torture,
+                                   ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
                torture_comment(torture, "domain close failed\n");
                ret = false;
        }
@@ -341,7 +324,8 @@ bool torture_grouplist(struct torture_context *torture)
                goto done;
        }
 
-       if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
+       if (!test_samr_close_handle(torture,
+                                   ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
                torture_comment(torture, "domain close failed\n");
                ret = false;
        }
@@ -389,7 +373,8 @@ bool torture_creategroup(struct torture_context *torture)
                goto done;
        }
 
-       if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
+       if (!test_samr_close_handle(torture,
+                                   ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
                torture_comment(torture, "domain close failed\n");
                ret = false;
        }
index 8fcf9818db7fee02f6538f91786379ced7d3fd64..587676a7675ff78e0bf52ae76153f91c4634c1dc 100644 (file)
@@ -157,25 +157,6 @@ static bool test_cleanup(struct torture_context *tctx,
 }
 
 
-static bool test_samr_close(struct torture_context *tctx,
-                           struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
-                           struct policy_handle *domain_handle)
-{
-       struct samr_Close r;
-
-       r.in.handle = domain_handle;
-       r.out.handle = domain_handle;
-
-       torture_assert_ntstatus_ok(tctx,
-               dcerpc_samr_Close_r(b, mem_ctx, &r),
-               "Close samr domain failed");
-       torture_assert_ntstatus_ok(tctx, r.out.result,
-               "Close samr domain failed");
-
-       return true;
-}
-
-
 static bool test_lsa_close(struct torture_context *tctx,
                           struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
                           struct policy_handle *domain_handle)
@@ -225,7 +206,8 @@ bool torture_createuser(struct torture_context *torture)
                goto done;
        }
 
-       if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
+       if (!test_samr_close_handle(torture,
+                                   ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
                torture_comment(torture, "domain close failed\n");
                ret = false;
        }
@@ -563,7 +545,8 @@ cleanup:
                goto done;
        }
 
-       if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, torture, &ctx->samr.handle)) {
+       if (!test_samr_close_handle(torture,
+                                   ctx->samr.pipe->binding_handle, torture, &ctx->samr.handle)) {
                torture_comment(torture, "domain close failed\n");
                ret = false;
        }
@@ -633,7 +616,8 @@ bool torture_userinfo_api(struct torture_context *torture)
                goto done;
        }
 
-       if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
+       if (!test_samr_close_handle(torture,
+                                   ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
                torture_comment(torture, "domain close failed\n");
                ret = false;
        }
@@ -690,7 +674,8 @@ bool torture_userlist(struct torture_context *torture)
                goto done;
        }
 
-       if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
+       if (!test_samr_close_handle(torture,
+                                   ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
                torture_comment(torture, "samr domain close failed\n");
                ret = false;
                goto done;