[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Jun 1 21:17:05 MDT 2015


The branch, master has been updated
       via  60d95bb s4-torture: call clusapi_CreateResEnum for all cluster resources.
       via  9c0139f clusapi: add inline comment describing why we use so many "if 0" in this IDL.
      from  0791bb0 KCC: improve docstring for KCC.load_samdb()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 60d95bbf775635e80a61c6809126c6748b1fe6cb
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 23 11:44:43 2015 +0200

    s4-torture: call clusapi_CreateResEnum for all cluster resources.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Jun  2 05:16:00 CEST 2015 on sn-devel-104

commit 9c0139f11f05321f42c8a2854156e02bf4fd6655
Author: Günther Deschner <gd at samba.org>
Date:   Fri May 22 10:59:03 2015 +0200

    clusapi: add inline comment describing why we use so many "if 0" in this IDL.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 librpc/idl/clusapi.idl        | 12 +++++++
 source4/torture/rpc/clusapi.c | 82 +++++++++++++++++++++++++------------------
 2 files changed, 60 insertions(+), 34 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index 7747115..3e87114 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -13,6 +13,11 @@ import "security.idl";
 	interface clusapi
 {
 #if 0
+	/*
+	 * pidl does not yet have a real [context_handle] implementation, so we
+	 * just use some defines here.
+	 */
+
 	typedef [context_handle] void *HCLUSTER_RPC;
 	typedef [context_handle] void *HNODE_RPC;
 	typedef [context_handle] void *HGROUP_RPC;
@@ -73,6 +78,13 @@ import "security.idl";
 	/* Function 0x00 */
 
 #if 0
+	/*
+	 * pidl cannot generate code for functions that return structures in
+	 * IDL, therefore pretend the function is void and add the returned
+	 * structure as an out parameter. This is what we do with pretty much
+	 * all the Open calls right now in this interface - gd
+	 */
+
 	HCLUSTER_RPC
 	clusapi_OpenCluster(
 		[ out ] WERROR *Status
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index 338fb2d..2b554ee 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -862,6 +862,50 @@ static bool test_OfflineResource(struct torture_context *tctx,
 	return ret;
 }
 
+static bool test_CreateResEnum_int(struct torture_context *tctx,
+				   struct dcerpc_pipe *p,
+				   struct policy_handle *hResource)
+{
+	struct dcerpc_binding_handle *b = p->binding_handle;
+	struct clusapi_CreateResEnum r;
+	uint32_t dwType = CLUSTER_ENUM_RESOURCE;
+	struct ENUM_LIST *ReturnEnum;
+	WERROR rpc_status;
+
+	r.in.hResource = *hResource;
+	r.in.dwType = dwType;
+	r.out.ReturnEnum = &ReturnEnum;
+	r.out.rpc_status = &rpc_status;
+
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_clusapi_CreateResEnum_r(b, tctx, &r),
+		"CreateResEnum failed");
+	torture_assert_werr_ok(tctx,
+		r.out.result,
+		"CreateResEnum failed");
+
+	return true;
+}
+
+static bool test_CreateResEnum(struct torture_context *tctx,
+			       void *data)
+{
+	struct torture_clusapi_context *t =
+		talloc_get_type_abort(data, struct torture_clusapi_context);
+	struct policy_handle hResource;
+	bool ret = true;
+
+	if (!test_OpenResource_int(tctx, t->p, "Cluster Name", &hResource)) {
+		return false;
+	}
+
+	ret = test_CreateResEnum_int(tctx, t->p, &hResource);
+
+	test_CloseResource_int(tctx, t->p, &hResource);
+
+	return ret;
+}
+
 static bool test_one_resource(struct torture_context *tctx,
 			      struct dcerpc_pipe *p,
 			      const char *resource_name)
@@ -885,7 +929,10 @@ static bool test_one_resource(struct torture_context *tctx,
 		"failed to query resource id");
 	torture_assert(tctx,
 		test_GetResourceState_int(tctx, p, &hResource),
-		"failed to query resource id");
+		"failed to query resource state");
+	torture_assert(tctx,
+		test_CreateResEnum_int(tctx, p, &hResource),
+		"failed to query resource enum");
 
 	test_CloseResource_int(tctx, p, &hResource);
 
@@ -929,39 +976,6 @@ static bool test_all_resources(struct torture_context *tctx,
 	return true;
 }
 
-static bool test_CreateResEnum(struct torture_context *tctx,
-			       void *data)
-{
-	struct torture_clusapi_context *t =
-		talloc_get_type_abort(data, struct torture_clusapi_context);
-	struct dcerpc_binding_handle *b = t->p->binding_handle;
-	struct clusapi_CreateResEnum r;
-	struct policy_handle hResource;
-	uint32_t dwType = CLUSTER_ENUM_RESOURCE;
-	struct ENUM_LIST *ReturnEnum;
-	WERROR rpc_status;
-
-	torture_assert(tctx,
-		test_OpenResource_int(tctx, t->p, "Cluster Name", &hResource),
-		"OpenResource failed");
-
-	r.in.hResource = hResource;
-	r.in.dwType = dwType;
-	r.out.ReturnEnum = &ReturnEnum;
-	r.out.rpc_status = &rpc_status;
-
-	torture_assert_ntstatus_ok(tctx,
-		dcerpc_clusapi_CreateResEnum_r(b, tctx, &r),
-		"CreateResEnum failed");
-	torture_assert_werr_ok(tctx,
-		r.out.result,
-		"CreateResEnum failed");
-
-	test_CloseResource_int(tctx, t->p, &hResource);
-
-	return true;
-}
-
 static bool test_OpenNode_int(struct torture_context *tctx,
 			      struct dcerpc_pipe *p,
 			      const char *lpszNodeName,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list