[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-983-g76da89d

Günther Deschner gd at samba.org
Thu Apr 9 14:42:56 GMT 2009


The branch, master has been updated
       via  76da89daaadc358c836817cf597a1ff1489a9029 (commit)
       via  693c2e95294909292cd28982983681ea24912d28 (commit)
       via  2d211450420ee4848d3c5ad73ce9d529a267c13a (commit)
       via  af32ab94eb5cb954328174f6809ff3c856d3ef6e (commit)
      from  8b9f2abfcb956f3ad496cefcc9d8ced8eadf1470 (commit)

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


- Log -----------------------------------------------------------------
commit 76da89daaadc358c836817cf597a1ff1489a9029
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 9 15:39:45 2009 +0200

    s3-svcctl: minor fix for _svcctl_EnumDependentServicesW().
    
    Guenther

commit 693c2e95294909292cd28982983681ea24912d28
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 9 15:30:18 2009 +0200

    s4-smbtorture: add test_EnumDependentServicesW() to RPC-SVCCTL.
    
    Guenther

commit 2d211450420ee4848d3c5ad73ce9d529a267c13a
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 9 16:41:32 2009 +0200

    s3: re-run make samba3-idl.
    
    Guenther

commit af32ab94eb5cb954328174f6809ff3c856d3ef6e
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 9 16:40:13 2009 +0200

    svcctl: use svcctl_ServiceState type for dependent calls in IDL.
    
    Guenther

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

Summary of changes:
 librpc/gen_ndr/cli_svcctl.c        |    4 +-
 librpc/gen_ndr/cli_svcctl.h        |    4 +-
 librpc/gen_ndr/ndr_svcctl.c        |   12 +++---
 librpc/gen_ndr/svcctl.h            |    4 +-
 librpc/idl/svcctl.idl              |    4 +-
 source3/rpc_server/srv_svcctl_nt.c |    9 +++++
 source4/torture/rpc/svcctl.c       |   67 +++++++++++++++++++++++++++++++++++-
 7 files changed, 89 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/gen_ndr/cli_svcctl.c b/librpc/gen_ndr/cli_svcctl.c
index 1d9de55..f6cedfb 100644
--- a/librpc/gen_ndr/cli_svcctl.c
+++ b/librpc/gen_ndr/cli_svcctl.c
@@ -647,7 +647,7 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
 					      TALLOC_CTX *mem_ctx,
 					      struct policy_handle *service /* [in] [ref] */,
-					      uint32_t state /* [in]  */,
+					      enum svcctl_ServiceState state /* [in]  */,
 					      uint8_t *service_status /* [out] [ref,size_is(offered)] */,
 					      uint32_t offered /* [in] [range(0,0x40000)] */,
 					      uint32_t *needed /* [out] [ref,range(0,0x40000)] */,
@@ -1288,7 +1288,7 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli,
 					      TALLOC_CTX *mem_ctx,
 					      struct policy_handle *service /* [in] [ref] */,
-					      uint32_t state /* [in]  */,
+					      enum svcctl_ServiceState state /* [in]  */,
 					      struct ENUM_SERVICE_STATUSA *service_status /* [out] [unique] */,
 					      uint32_t offered /* [in]  */,
 					      uint32_t *needed /* [out] [ref] */,
diff --git a/librpc/gen_ndr/cli_svcctl.h b/librpc/gen_ndr/cli_svcctl.h
index 0bd5f53..c656eba 100644
--- a/librpc/gen_ndr/cli_svcctl.h
+++ b/librpc/gen_ndr/cli_svcctl.h
@@ -93,7 +93,7 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
 					      TALLOC_CTX *mem_ctx,
 					      struct policy_handle *service /* [in] [ref] */,
-					      uint32_t state /* [in]  */,
+					      enum svcctl_ServiceState state /* [in]  */,
 					      uint8_t *service_status /* [out] [ref,size_is(offered)] */,
 					      uint32_t offered /* [in] [range(0,0x40000)] */,
 					      uint32_t *needed /* [out] [ref,range(0,0x40000)] */,
@@ -198,7 +198,7 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli,
 					      TALLOC_CTX *mem_ctx,
 					      struct policy_handle *service /* [in] [ref] */,
-					      uint32_t state /* [in]  */,
+					      enum svcctl_ServiceState state /* [in]  */,
 					      struct ENUM_SERVICE_STATUSA *service_status /* [out] [unique] */,
 					      uint32_t offered /* [in]  */,
 					      uint32_t *needed /* [out] [ref] */,
diff --git a/librpc/gen_ndr/ndr_svcctl.c b/librpc/gen_ndr/ndr_svcctl.c
index 117d497..ee828ee 100644
--- a/librpc/gen_ndr/ndr_svcctl.c
+++ b/librpc/gen_ndr/ndr_svcctl.c
@@ -2689,7 +2689,7 @@ static enum ndr_err_code ndr_push_svcctl_EnumDependentServicesW(struct ndr_push
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
 		NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.service));
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
+		NDR_CHECK(ndr_push_svcctl_ServiceState(ndr, NDR_SCALARS, r->in.state));
 		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered));
 	}
 	if (flags & NDR_OUT) {
@@ -2726,7 +2726,7 @@ static enum ndr_err_code ndr_pull_svcctl_EnumDependentServicesW(struct ndr_pull
 		NDR_PULL_SET_MEM_CTX(ndr, r->in.service, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.service));
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_0, LIBNDR_FLAG_REF_ALLOC);
-		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
+		NDR_CHECK(ndr_pull_svcctl_ServiceState(ndr, NDR_SCALARS, &r->in.state));
 		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered));
 		if (r->in.offered > 0x40000) {
 			return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
@@ -2786,7 +2786,7 @@ _PUBLIC_ void ndr_print_svcctl_EnumDependentServicesW(struct ndr_print *ndr, con
 		ndr->depth++;
 		ndr_print_policy_handle(ndr, "service", r->in.service);
 		ndr->depth--;
-		ndr_print_uint32(ndr, "state", r->in.state);
+		ndr_print_svcctl_ServiceState(ndr, "state", r->in.state);
 		ndr_print_uint32(ndr, "offered", r->in.offered);
 		ndr->depth--;
 	}
@@ -4561,7 +4561,7 @@ static enum ndr_err_code ndr_push_svcctl_EnumDependentServicesA(struct ndr_push
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
 		NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.service));
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
+		NDR_CHECK(ndr_push_svcctl_ServiceState(ndr, NDR_SCALARS, r->in.state));
 		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered));
 	}
 	if (flags & NDR_OUT) {
@@ -4599,7 +4599,7 @@ static enum ndr_err_code ndr_pull_svcctl_EnumDependentServicesA(struct ndr_pull
 		NDR_PULL_SET_MEM_CTX(ndr, r->in.service, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.service));
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_0, LIBNDR_FLAG_REF_ALLOC);
-		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
+		NDR_CHECK(ndr_pull_svcctl_ServiceState(ndr, NDR_SCALARS, &r->in.state));
 		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered));
 		NDR_PULL_ALLOC(ndr, r->out.needed);
 		ZERO_STRUCTP(r->out.needed);
@@ -4652,7 +4652,7 @@ _PUBLIC_ void ndr_print_svcctl_EnumDependentServicesA(struct ndr_print *ndr, con
 		ndr->depth++;
 		ndr_print_policy_handle(ndr, "service", r->in.service);
 		ndr->depth--;
-		ndr_print_uint32(ndr, "state", r->in.state);
+		ndr_print_svcctl_ServiceState(ndr, "state", r->in.state);
 		ndr_print_uint32(ndr, "offered", r->in.offered);
 		ndr->depth--;
 	}
diff --git a/librpc/gen_ndr/svcctl.h b/librpc/gen_ndr/svcctl.h
index 59bc039..c0daab4 100644
--- a/librpc/gen_ndr/svcctl.h
+++ b/librpc/gen_ndr/svcctl.h
@@ -478,7 +478,7 @@ struct svcctl_CreateServiceW {
 struct svcctl_EnumDependentServicesW {
 	struct {
 		struct policy_handle *service;/* [ref] */
-		uint32_t state;
+		enum svcctl_ServiceState state;
 		uint32_t offered;/* [range(0,0x40000)] */
 	} in;
 
@@ -682,7 +682,7 @@ struct svcctl_CreateServiceA {
 struct svcctl_EnumDependentServicesA {
 	struct {
 		struct policy_handle *service;/* [ref] */
-		uint32_t state;
+		enum svcctl_ServiceState state;
 		uint32_t offered;
 	} in;
 
diff --git a/librpc/idl/svcctl.idl b/librpc/idl/svcctl.idl
index 8bbf514..a5685e8 100644
--- a/librpc/idl/svcctl.idl
+++ b/librpc/idl/svcctl.idl
@@ -260,7 +260,7 @@ import "misc.idl", "security.idl";
 	/* Function 0x0d */
 	WERROR svcctl_EnumDependentServicesW(
 		[in,ref] policy_handle *service,
-		[in] uint32 state,
+		[in] svcctl_ServiceState state,
 		[out,ref,size_is(offered)] uint8 *service_status,
 		[in,range(0,0x40000)] uint32 offered,
 		[out,ref,range(0,0x40000)] uint32 *needed,
@@ -475,7 +475,7 @@ import "misc.idl", "security.idl";
 	/* Function 0x19 */
 	WERROR svcctl_EnumDependentServicesA(
 		[in,ref] policy_handle *service,
-		[in] uint32 state,
+		[in] svcctl_ServiceState state,
 		[out,unique] ENUM_SERVICE_STATUSA *service_status,
 		[in] uint32 offered,
 		[out,ref] uint32 *needed,
diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c
index 350a5ca..0b0ef83 100644
--- a/source3/rpc_server/srv_svcctl_nt.c
+++ b/source3/rpc_server/srv_svcctl_nt.c
@@ -546,6 +546,15 @@ WERROR _svcctl_EnumDependentServicesW(pipes_struct *p,
 	if ( !(info->access_granted & SC_RIGHT_SVC_ENUMERATE_DEPENDENTS) )
 		return WERR_ACCESS_DENIED;
 
+	switch (r->in.state) {
+	case SERVICE_STATE_ACTIVE:
+	case SERVICE_STATE_INACTIVE:
+	case SERVICE_STATE_ALL:
+		break;
+	default:
+		return WERR_INVALID_PARAM;
+	}
+
 	/* we have to set the outgoing buffer size to the same as the
 	   incoming buffer size (even in the case of failure */
 	/* this is done in the autogenerated server already - gd */
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index 2ed85ec..e38e8da 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -3,7 +3,7 @@
    test suite for srvsvc rpc operations
 
    Copyright (C) Jelmer Vernooij 2004
-   Copyright (C) Guenther Deschner 2008
+   Copyright (C) Guenther Deschner 2008,2009
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -385,6 +385,69 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
 	return true;
 }
 
+static bool test_EnumDependentServicesW(struct torture_context *tctx,
+					struct dcerpc_pipe *p)
+{
+	struct svcctl_EnumDependentServicesW r;
+	struct policy_handle h, s;
+	uint32_t needed;
+	uint32_t services_returned;
+	uint32_t i;
+	uint32_t states[] = { SERVICE_STATE_ACTIVE,
+			      SERVICE_STATE_INACTIVE,
+			      SERVICE_STATE_ALL };
+
+	if (!test_OpenSCManager(p, tctx, &h))
+		return false;
+
+	if (!test_OpenService(p, tctx, &h, "Netlogon", &s))
+		return false;
+
+	r.in.service = &s;
+	r.in.offered = 0;
+	r.in.state = 0;
+	r.out.service_status = NULL;
+	r.out.services_returned = &services_returned;
+	r.out.needed = &needed;
+
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r),
+		"EnumDependentServicesW failed!");
+
+	torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM,
+		"EnumDependentServicesW failed!");
+
+	for (i=0; i<ARRAY_SIZE(states); i++) {
+
+		r.in.state = states[i];
+
+		torture_assert_ntstatus_ok(tctx,
+			dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r),
+			"EnumDependentServicesW failed!");
+
+		if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
+			r.in.offered = needed;
+			r.out.service_status = talloc_array(tctx, uint8_t, needed);
+
+			torture_assert_ntstatus_ok(tctx,
+				dcerpc_svcctl_EnumDependentServicesW(p, tctx, &r),
+				"EnumDependentServicesW failed!");
+
+		}
+
+		torture_assert_werr_ok(tctx, r.out.result,
+			"EnumDependentServicesW failed");
+	}
+
+	if (!test_CloseServiceHandle(p, tctx, &s))
+		return false;
+
+	if (!test_CloseServiceHandle(p, tctx, &h))
+		return false;
+
+	return true;
+}
+
 static bool test_SCManager(struct torture_context *tctx,
 						   struct dcerpc_pipe *p)
 {
@@ -410,6 +473,8 @@ struct torture_suite *torture_rpc_svcctl(TALLOC_CTX *mem_ctx)
 				   test_SCManager);
 	torture_rpc_tcase_add_test(tcase, "EnumServicesStatus",
 				   test_EnumServicesStatus);
+	torture_rpc_tcase_add_test(tcase, "EnumDependentServicesW",
+				   test_EnumDependentServicesW);
 	torture_rpc_tcase_add_test(tcase, "QueryServiceStatus",
 				   test_QueryServiceStatus);
 	torture_rpc_tcase_add_test(tcase, "QueryServiceStatusEx",


-- 
Samba Shared Repository


More information about the samba-cvs mailing list