[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-321-g5838d81

Günther Deschner gd at samba.org
Thu Mar 20 00:47:36 GMT 2008


The branch, v3-2-test has been updated
       via  5838d81346a51ef1e996bab938533ae2097f7e47 (commit)
       via  988291a9c07c055213f8979ebe75bb392811008d (commit)
       via  fe7203090c0c51e4561a3b5ce0d5d131d280ba8e (commit)
       via  46bfded43dcabdd2302d82920fb2a37c41e58126 (commit)
       via  2860ae2eb2cb99b4febb352f516b3fa9fbd2abbb (commit)
       via  b5291d477381521cd4b71674616f8c9899007002 (commit)
      from  818044d877597ba5c11dc7f30bab929c4b41db89 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 5838d81346a51ef1e996bab938533ae2097f7e47
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 20 01:40:04 2008 +0100

    Remove unused marshalling for SVCCTL_ENUM_DEPENDENT_SERVICES.
    
    Guenther

commit 988291a9c07c055213f8979ebe75bb392811008d
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 20 01:38:23 2008 +0100

    Use pidl for _svcctl_EnumDependentServicesW().
    
    Guenther

commit fe7203090c0c51e4561a3b5ce0d5d131d280ba8e
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 20 01:35:58 2008 +0100

    Re-run make idl.
    
    Guenther

commit 46bfded43dcabdd2302d82920fb2a37c41e58126
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 20 01:32:20 2008 +0100

    Fix IDL for svcctl_EnumDependentServicesW().
    
    Guenther

commit 2860ae2eb2cb99b4febb352f516b3fa9fbd2abbb
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 20 01:26:37 2008 +0100

    Move svc_status_string() out of rpc_client/cli_svcctl.c
    
    Guenther

commit b5291d477381521cd4b71674616f8c9899007002
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 20 01:24:55 2008 +0100

    No need to compose CLI_SERVER_NAME_SLASH in "net rpc service" anymore.
    
    Guenther

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

Summary of changes:
 source/include/rpc_svcctl.h        |   16 --------
 source/librpc/gen_ndr/cli_svcctl.c |    6 +--
 source/librpc/gen_ndr/cli_svcctl.h |    2 +-
 source/librpc/gen_ndr/ndr_svcctl.c |   42 +++++++++++---------
 source/librpc/gen_ndr/srv_svcctl.c |    2 +-
 source/librpc/gen_ndr/svcctl.h     |    8 ++--
 source/librpc/idl/svcctl.idl       |    8 ++--
 source/rpc_client/cli_svcctl.c     |   36 ------------------
 source/rpc_parse/parse_svcctl.c    |   56 ---------------------------
 source/rpc_server/srv_svcctl.c     |   18 +--------
 source/rpc_server/srv_svcctl_nt.c  |   19 +++------
 source/utils/net_rpc_service.c     |   73 ++++++++++++++++++++----------------
 12 files changed, 84 insertions(+), 202 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/rpc_svcctl.h b/source/include/rpc_svcctl.h
index 5a87e35..aa1d166 100644
--- a/source/include/rpc_svcctl.h
+++ b/source/include/rpc_svcctl.h
@@ -216,22 +216,6 @@ typedef struct {
 
 typedef struct {
 	POLICY_HND handle;
-	uint32 state;
-	uint32 buffer_size;
-} SVCCTL_Q_ENUM_DEPENDENT_SERVICES;
-
-typedef struct {
-	RPC_BUFFER buffer;
-	uint32 needed;
-	uint32 returned;
-	WERROR status;
-} SVCCTL_R_ENUM_DEPENDENT_SERVICES;
-
-
-/**************************/
-
-typedef struct {
-	POLICY_HND handle;
 	uint32 buffer_size;
 } SVCCTL_Q_QUERY_SERVICE_CONFIG;
 
diff --git a/source/librpc/gen_ndr/cli_svcctl.c b/source/librpc/gen_ndr/cli_svcctl.c
index b8f18af..1d3bc57 100644
--- a/source/librpc/gen_ndr/cli_svcctl.c
+++ b/source/librpc/gen_ndr/cli_svcctl.c
@@ -661,7 +661,7 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
 					      TALLOC_CTX *mem_ctx,
 					      struct policy_handle *service,
 					      uint32_t state,
-					      struct ENUM_SERVICE_STATUS *service_status,
+					      uint8_t *service_status,
 					      uint32_t buf_size,
 					      uint32_t *bytes_needed,
 					      uint32_t *services_returned,
@@ -699,9 +699,7 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
 	}
 
 	/* Return variables */
-	if (service_status && r.out.service_status) {
-		*service_status = *r.out.service_status;
-	}
+	memcpy(service_status, r.out.service_status, r.in.buf_size);
 	*bytes_needed = *r.out.bytes_needed;
 	*services_returned = *r.out.services_returned;
 
diff --git a/source/librpc/gen_ndr/cli_svcctl.h b/source/librpc/gen_ndr/cli_svcctl.h
index 7c62519..5f724ed 100644
--- a/source/librpc/gen_ndr/cli_svcctl.h
+++ b/source/librpc/gen_ndr/cli_svcctl.h
@@ -94,7 +94,7 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
 					      TALLOC_CTX *mem_ctx,
 					      struct policy_handle *service,
 					      uint32_t state,
-					      struct ENUM_SERVICE_STATUS *service_status,
+					      uint8_t *service_status,
 					      uint32_t buf_size,
 					      uint32_t *bytes_needed,
 					      uint32_t *services_returned,
diff --git a/source/librpc/gen_ndr/ndr_svcctl.c b/source/librpc/gen_ndr/ndr_svcctl.c
index 16e0416..f7e7874 100644
--- a/source/librpc/gen_ndr/ndr_svcctl.c
+++ b/source/librpc/gen_ndr/ndr_svcctl.c
@@ -1693,10 +1693,11 @@ static enum ndr_err_code ndr_push_svcctl_EnumDependentServicesW(struct ndr_push
 		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
 	}
 	if (flags & NDR_OUT) {
-		NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.service_status));
-		if (r->out.service_status) {
-			NDR_CHECK(ndr_push_ENUM_SERVICE_STATUS(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.service_status));
+		if (r->out.service_status == NULL) {
+			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
+		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
+		NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.service_status, r->in.buf_size));
 		if (r->out.bytes_needed == NULL) {
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
@@ -1712,9 +1713,7 @@ static enum ndr_err_code ndr_push_svcctl_EnumDependentServicesW(struct ndr_push
 
 static enum ndr_err_code ndr_pull_svcctl_EnumDependentServicesW(struct ndr_pull *ndr, int flags, struct svcctl_EnumDependentServicesW *r)
 {
-	uint32_t _ptr_service_status;
 	TALLOC_CTX *_mem_save_service_0;
-	TALLOC_CTX *_mem_save_service_status_0;
 	TALLOC_CTX *_mem_save_bytes_needed_0;
 	TALLOC_CTX *_mem_save_services_returned_0;
 	if (flags & NDR_IN) {
@@ -1729,30 +1728,31 @@ static enum ndr_err_code ndr_pull_svcctl_EnumDependentServicesW(struct ndr_pull
 		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_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
+		if (r->in.buf_size < 0 || r->in.buf_size > 0x40000) {
+			return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+		}
+		NDR_PULL_ALLOC_N(ndr, r->out.service_status, r->in.buf_size);
+		memset(r->out.service_status, 0, (r->in.buf_size) * sizeof(*r->out.service_status));
 		NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
 		ZERO_STRUCTP(r->out.bytes_needed);
 		NDR_PULL_ALLOC(ndr, r->out.services_returned);
 		ZERO_STRUCTP(r->out.services_returned);
 	}
 	if (flags & NDR_OUT) {
-		NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_service_status));
-		if (_ptr_service_status) {
-			NDR_PULL_ALLOC(ndr, r->out.service_status);
-		} else {
-			r->out.service_status = NULL;
-		}
-		if (r->out.service_status) {
-			_mem_save_service_status_0 = NDR_PULL_GET_MEM_CTX(ndr);
-			NDR_PULL_SET_MEM_CTX(ndr, r->out.service_status, 0);
-			NDR_CHECK(ndr_pull_ENUM_SERVICE_STATUS(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.service_status));
-			NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_status_0, 0);
+		NDR_CHECK(ndr_pull_array_size(ndr, &r->out.service_status));
+		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+			NDR_PULL_ALLOC_N(ndr, r->out.service_status, ndr_get_array_size(ndr, &r->out.service_status));
 		}
+		NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.service_status, ndr_get_array_size(ndr, &r->out.service_status)));
 		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
 			NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
 		}
 		_mem_save_bytes_needed_0 = NDR_PULL_GET_MEM_CTX(ndr);
 		NDR_PULL_SET_MEM_CTX(ndr, r->out.bytes_needed, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.bytes_needed));
+		if (*r->out.bytes_needed < 0 || *r->out.bytes_needed > 0x40000) {
+			return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+		}
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_bytes_needed_0, LIBNDR_FLAG_REF_ALLOC);
 		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
 			NDR_PULL_ALLOC(ndr, r->out.services_returned);
@@ -1760,8 +1760,14 @@ static enum ndr_err_code ndr_pull_svcctl_EnumDependentServicesW(struct ndr_pull
 		_mem_save_services_returned_0 = NDR_PULL_GET_MEM_CTX(ndr);
 		NDR_PULL_SET_MEM_CTX(ndr, r->out.services_returned, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.services_returned));
+		if (*r->out.services_returned < 0 || *r->out.services_returned > 0x40000) {
+			return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+		}
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_services_returned_0, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+		if (r->out.service_status) {
+			NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.service_status, r->in.buf_size));
+		}
 	}
 	return NDR_ERR_SUCCESS;
 }
@@ -1789,9 +1795,7 @@ _PUBLIC_ void ndr_print_svcctl_EnumDependentServicesW(struct ndr_print *ndr, con
 		ndr->depth++;
 		ndr_print_ptr(ndr, "service_status", r->out.service_status);
 		ndr->depth++;
-		if (r->out.service_status) {
-			ndr_print_ENUM_SERVICE_STATUS(ndr, "service_status", r->out.service_status);
-		}
+		ndr_print_array_uint8(ndr, "service_status", r->out.service_status, r->in.buf_size);
 		ndr->depth--;
 		ndr_print_ptr(ndr, "bytes_needed", r->out.bytes_needed);
 		ndr->depth++;
diff --git a/source/librpc/gen_ndr/srv_svcctl.c b/source/librpc/gen_ndr/srv_svcctl.c
index 10db320..264dea3 100644
--- a/source/librpc/gen_ndr/srv_svcctl.c
+++ b/source/librpc/gen_ndr/srv_svcctl.c
@@ -1047,7 +1047,7 @@ static bool api_svcctl_EnumDependentServicesW(pipes_struct *p)
 	}
 
 	ZERO_STRUCT(r->out);
-	r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUS);
+	r->out.service_status = talloc_zero_array(r, uint8_t, r->in.buf_size);
 	if (r->out.service_status == NULL) {
 		talloc_free(r);
 		return false;
diff --git a/source/librpc/gen_ndr/svcctl.h b/source/librpc/gen_ndr/svcctl.h
index c13e96b..fad51c4 100644
--- a/source/librpc/gen_ndr/svcctl.h
+++ b/source/librpc/gen_ndr/svcctl.h
@@ -274,13 +274,13 @@ struct svcctl_EnumDependentServicesW {
 	struct {
 		struct policy_handle *service;/* [ref] */
 		uint32_t state;
-		uint32_t buf_size;
+		uint32_t buf_size;/* [range(0,0x40000)] */
 	} in;
 
 	struct {
-		struct ENUM_SERVICE_STATUS *service_status;/* [unique] */
-		uint32_t *bytes_needed;/* [ref] */
-		uint32_t *services_returned;/* [ref] */
+		uint8_t *service_status;/* [ref,size_is(buf_size)] */
+		uint32_t *bytes_needed;/* [ref,range(0,0x40000)] */
+		uint32_t *services_returned;/* [ref,range(0,0x40000)] */
 		WERROR result;
 	} out;
 
diff --git a/source/librpc/idl/svcctl.idl b/source/librpc/idl/svcctl.idl
index e36a091..00542bd 100644
--- a/source/librpc/idl/svcctl.idl
+++ b/source/librpc/idl/svcctl.idl
@@ -205,10 +205,10 @@
 	WERROR svcctl_EnumDependentServicesW(
 		[in,ref] policy_handle *service,
 		[in] uint32 state,
-		[out,unique] ENUM_SERVICE_STATUS *service_status,
-		[in] uint32 buf_size,
-		[out,ref] uint32 *bytes_needed,
-		[out,ref] uint32 *services_returned
+		[out,ref,size_is(buf_size)] uint8 *service_status,
+		[in,range(0,0x40000)] uint32 buf_size,
+		[out,ref,range(0,0x40000)] uint32 *bytes_needed,
+		[out,ref,range(0,0x40000)] uint32 *services_returned
 	);
 
 	/*****************/
diff --git a/source/rpc_client/cli_svcctl.c b/source/rpc_client/cli_svcctl.c
index b21909f..221dd60 100644
--- a/source/rpc_client/cli_svcctl.c
+++ b/source/rpc_client/cli_svcctl.c
@@ -21,42 +21,6 @@
 #include "includes.h"
 #include "rpc_client.h"
 
-struct svc_state_msg {
-	uint32 flag;
-	const char *message;
-};
-
-static struct svc_state_msg state_msg_table[] = {
-	{ SVCCTL_STOPPED,            "stopped" },
-	{ SVCCTL_START_PENDING,      "start pending" },
-	{ SVCCTL_STOP_PENDING,       "stop pending" },
-	{ SVCCTL_RUNNING,            "running" },
-	{ SVCCTL_CONTINUE_PENDING,   "resume pending" },
-	{ SVCCTL_PAUSE_PENDING,      "pause pending" },
-	{ SVCCTL_PAUSED,             "paused" },
-	{ 0,                          NULL }
-};
-	
-
-/********************************************************************
-********************************************************************/
-const char* svc_status_string( uint32 state )
-{
-	fstring msg;
-	int i;
-	
-	fstr_sprintf( msg, "Unknown State [%d]", state );
-	
-	for ( i=0; state_msg_table[i].message; i++ ) {
-		if ( state_msg_table[i].flag == state ) {
-			fstrcpy( msg, state_msg_table[i].message );
-			break;	
-		}
-	}
-	
-	return talloc_strdup(talloc_tos(), msg);
-}
-
 /*******************************************************************
 *******************************************************************/
 
diff --git a/source/rpc_parse/parse_svcctl.c b/source/rpc_parse/parse_svcctl.c
index 62c1e21..c5d9386 100644
--- a/source/rpc_parse/parse_svcctl.c
+++ b/source/rpc_parse/parse_svcctl.c
@@ -262,62 +262,6 @@ bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_S
 /*******************************************************************
 ********************************************************************/
 
-bool svcctl_io_q_enum_dependent_services(const char *desc, SVCCTL_Q_ENUM_DEPENDENT_SERVICES *q_u, prs_struct *ps, int depth)
-{
-	if (q_u == NULL)
-		return False;
-
-	prs_debug(ps, depth, desc, "svcctl_io_q_enum_dependent_services");
-	depth++;
-
-	if(!prs_align(ps))
-		return False;
-
-	if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
-		return False;
-
-	if(!prs_uint32("state", ps, depth, &q_u->state))
-		return False;
-	if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
-		return False;
-
-	return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth)
-{
-	if (r_u == NULL)
-		return False;
-
-	prs_debug(ps, depth, desc, "svcctl_io_r_enum_dependent_services");
-	depth++;
-
-	if(!prs_align(ps))
-		return False;
-
-	if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
-		return False;
-
-	if(!prs_align(ps))
-		return False;
-
-	if(!prs_uint32("needed", ps, depth, &r_u->needed))
-		return False;
-	if(!prs_uint32("returned", ps, depth, &r_u->returned))
-		return False;
-
-	if(!prs_werror("status", ps, depth, &r_u->status))
-		return False;
-
-	return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
 bool svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth)
 {
 	if (q_u == NULL)
diff --git a/source/rpc_server/srv_svcctl.c b/source/rpc_server/srv_svcctl.c
index 5e12514..e3ff2cc 100644
--- a/source/rpc_server/srv_svcctl.c
+++ b/source/rpc_server/srv_svcctl.c
@@ -131,23 +131,7 @@ static bool api_svcctl_query_service_status_ex(pipes_struct *p)
 
 static bool api_svcctl_enum_dependent_services(pipes_struct *p)
 {
-	SVCCTL_Q_ENUM_DEPENDENT_SERVICES q_u;
-	SVCCTL_R_ENUM_DEPENDENT_SERVICES r_u;
-	prs_struct *data = &p->in_data.data;
-	prs_struct *rdata = &p->out_data.rdata;
-
-	ZERO_STRUCT(q_u);
-	ZERO_STRUCT(r_u);
-
-	if(!svcctl_io_q_enum_dependent_services("", &q_u, data, 0))
-		return False;
-
-	r_u.status = _svcctl_enum_dependent_services(p, &q_u, &r_u);
-
-	if(!svcctl_io_r_enum_dependent_services("", &r_u, rdata, 0))
-		return False;
-
-	return True;
+	return proxy_svcctl_call(p, NDR_SVCCTL_ENUMDEPENDENTSERVICESW);
 }
 
 /*******************************************************************
diff --git a/source/rpc_server/srv_svcctl_nt.c b/source/rpc_server/srv_svcctl_nt.c
index 3962626..c117d46 100644
--- a/source/rpc_server/srv_svcctl_nt.c
+++ b/source/rpc_server/srv_svcctl_nt.c
@@ -527,11 +527,13 @@ WERROR _svcctl_ControlService(pipes_struct *p,
 }
 
 /********************************************************************
+ _svcctl_EnumDependentServicesW
 ********************************************************************/
 
-WERROR _svcctl_enum_dependent_services( pipes_struct *p, SVCCTL_Q_ENUM_DEPENDENT_SERVICES *q_u, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u )
+WERROR _svcctl_EnumDependentServicesW(pipes_struct *p,
+				      struct svcctl_EnumDependentServicesW *r)
 {
-	SERVICE_INFO *info = find_service_info_by_hnd( p, &q_u->handle );
+	SERVICE_INFO *info = find_service_info_by_hnd( p, r->in.service );
 
 	/* perform access checks */
 
@@ -543,13 +545,12 @@ WERROR _svcctl_enum_dependent_services( pipes_struct *p, SVCCTL_Q_ENUM_DEPENDENT
 
 	/* 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 */
 
-	rpcbuf_init( &r_u->buffer, q_u->buffer_size, p->mem_ctx );
-
-	r_u->needed      = q_u->buffer_size;
+	*r->out.bytes_needed = r->in.buf_size;
 
 	/* no dependent services...basically a stub function */
-	r_u->returned    = 0;
+	*r->out.services_returned = 0;
 
 	return WERR_OK;
 }
@@ -948,12 +949,6 @@ WERROR _svcctl_CreateServiceW(pipes_struct *p, struct svcctl_CreateServiceW *r)
 	return WERR_NOT_SUPPORTED;
 }
 
-WERROR _svcctl_EnumDependentServicesW(pipes_struct *p, struct svcctl_EnumDependentServicesW *r)
-{
-	p->rng_fault_state = True;
-	return WERR_NOT_SUPPORTED;
-}
-
 WERROR _svcctl_EnumServicesStatusW(pipes_struct *p, struct svcctl_EnumServicesStatusW *r)
 {
 	p->rng_fault_state = True;
diff --git a/source/utils/net_rpc_service.c b/source/utils/net_rpc_service.c
index 242d653..1b12bd3 100644
--- a/source/utils/net_rpc_service.c
+++ b/source/utils/net_rpc_service.c
@@ -20,8 +20,41 @@
 #include "utils/net.h"
 
 
-#define CLI_SERVER_NAME_SLASH(_ctx, _p, _cli) \
-	_p = talloc_asprintf(_ctx, "\\\\%s", _cli->cli->desthost);
+struct svc_state_msg {
+	uint32 flag;
+	const char *message;
+};
+
+static struct svc_state_msg state_msg_table[] = {
+	{ SVCCTL_STOPPED,            "stopped" },
+	{ SVCCTL_START_PENDING,      "start pending" },
+	{ SVCCTL_STOP_PENDING,       "stop pending" },
+	{ SVCCTL_RUNNING,            "running" },
+	{ SVCCTL_CONTINUE_PENDING,   "resume pending" },
+	{ SVCCTL_PAUSE_PENDING,      "pause pending" },
+	{ SVCCTL_PAUSED,             "paused" },
+	{ 0,                          NULL }
+};
+
+
+/********************************************************************
+********************************************************************/
+const char *svc_status_string( uint32 state )
+{
+	fstring msg;
+	int i;
+
+	fstr_sprintf( msg, "Unknown State [%d]", state );
+
+	for ( i=0; state_msg_table[i].message; i++ ) {
+		if ( state_msg_table[i].flag == state ) {
+			fstrcpy( msg, state_msg_table[i].message );
+			break;
+		}
+	}
+
+	return talloc_strdup(talloc_tos(), msg);
+}
 
 /********************************************************************
 ********************************************************************/
@@ -172,7 +205,6 @@ static NTSTATUS rpc_service_list_internal(const DOM_SID *domain_sid,
 	fstring servicename;
 	fstring displayname;
 	uint32 num_services = 0;
-	const char *server_name;
 	int i;
 
 	if (argc != 0 ) {
@@ -180,11 +212,8 @@ static NTSTATUS rpc_service_list_internal(const DOM_SID *domain_sid,
 		return NT_STATUS_OK;
 	}
 
-	CLI_SERVER_NAME_SLASH(mem_ctx, server_name, pipe_hnd);
-	NT_STATUS_HAVE_NO_MEMORY(server_name);
-
 	status = rpccli_svcctl_OpenSCManagerW(pipe_hnd, mem_ctx,
-					      server_name,
+					      pipe_hnd->cli->srv_name_slash,
 					      NULL,
 					      SC_RIGHT_MGR_ENUMERATE_SERVICE,
 					      &hSCM,
@@ -235,7 +264,6 @@ static NTSTATUS rpc_service_status_internal(const DOM_SID *domain_sid,
 	SERVICE_STATUS service_status;
 	SERVICE_CONFIG config;
 	fstring ascii_string;
-	const char *server_name;
 
 	if (argc != 1 ) {
 		d_printf("Usage: net rpc service status <service>\n");
@@ -243,11 +271,8 @@ static NTSTATUS rpc_service_status_internal(const DOM_SID *domain_sid,
 	}
 
 	/* Open the Service Control Manager */
-	CLI_SERVER_NAME_SLASH(mem_ctx, server_name, pipe_hnd);
-	NT_STATUS_HAVE_NO_MEMORY(server_name);
-
 	status = rpccli_svcctl_OpenSCManagerW(pipe_hnd, mem_ctx,
-					      server_name,
+					      pipe_hnd->cli->srv_name_slash,
 					      NULL,
 					      SC_RIGHT_MGR_ENUMERATE_SERVICE,
 					      &hSCM,
@@ -349,7 +374,6 @@ static NTSTATUS rpc_service_stop_internal(const DOM_SID *domain_sid,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list