summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/rpc_client/cli_svcctl.c76
-rw-r--r--source3/utils/net_rpc_service.c49
3 files changed, 30 insertions, 97 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3c196dbd5a..f70a6cef75 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -7172,8 +7172,6 @@ WERROR rpccli_spoolss_rffpcnex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
WERROR rpccli_svcctl_enumerate_services( struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *hSCM, uint32 type, uint32 state,
uint32 *returned, ENUM_SERVICES_STATUS **service_array );
-WERROR rpccli_svcctl_query_config(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *hService, SERVICE_CONFIG *config );
/* The following definitions come from rpc_client/init_lsa.c */
diff --git a/source3/rpc_client/cli_svcctl.c b/source3/rpc_client/cli_svcctl.c
index 3c29dcdee8..51678083d3 100644
--- a/source3/rpc_client/cli_svcctl.c
+++ b/source3/rpc_client/cli_svcctl.c
@@ -90,79 +90,3 @@ WERROR rpccli_svcctl_enumerate_services( struct rpc_pipe_client *cli, TALLOC_CTX
return out.status;
}
-
-/*******************************************************************
-*******************************************************************/
-
-WERROR rpccli_svcctl_query_config(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *hService, SERVICE_CONFIG *config )
-{
- SVCCTL_Q_QUERY_SERVICE_CONFIG in;
- SVCCTL_R_QUERY_SERVICE_CONFIG out;
- prs_struct qbuf, rbuf;
-
- ZERO_STRUCT(in);
- ZERO_STRUCT(out);
-
- memcpy( &in.handle, hService, sizeof(POLICY_HND) );
- in.buffer_size = 0;
-
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &ndr_table_svcctl.syntax_id,
- SVCCTL_QUERY_SERVICE_CONFIG_W,
- in, out,
- qbuf, rbuf,
- svcctl_io_q_query_service_config,
- svcctl_io_r_query_service_config,
- WERR_GENERAL_FAILURE );
-
- if ( W_ERROR_EQUAL( out.status, WERR_INSUFFICIENT_BUFFER ) ) {
- in.buffer_size = out.needed;
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &ndr_table_svcctl.syntax_id,
- SVCCTL_QUERY_SERVICE_CONFIG_W,
- in, out,
- qbuf, rbuf,
- svcctl_io_q_query_service_config,
- svcctl_io_r_query_service_config,
- WERR_GENERAL_FAILURE );
- }
-
- if ( !W_ERROR_IS_OK( out.status ) )
- return out.status;
-
- memcpy( config, &out.config, sizeof(SERVICE_CONFIG) );
-
- config->executablepath = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- config->loadordergroup = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- config->dependencies = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- config->startname = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- config->displayname = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
-
- if ( out.config.executablepath ) {
- config->executablepath = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->executablepath, out.config.executablepath );
- }
-
- if ( out.config.loadordergroup ) {
- config->loadordergroup = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->loadordergroup, out.config.loadordergroup );
- }
-
- if ( out.config.dependencies ) {
- config->dependencies = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->dependencies, out.config.dependencies );
- }
-
- if ( out.config.startname ) {
- config->startname = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->startname, out.config.startname );
- }
-
- if ( out.config.displayname ) {
- config->displayname = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->displayname, out.config.displayname );
- }
-
- return out.status;
-}
diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c
index d1349a903d..133173116c 100644
--- a/source3/utils/net_rpc_service.c
+++ b/source3/utils/net_rpc_service.c
@@ -264,8 +264,9 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
WERROR result = WERR_GENERAL_FAILURE;
NTSTATUS status;
SERVICE_STATUS service_status;
- SERVICE_CONFIG config;
- fstring ascii_string;
+ struct QUERY_SERVICE_CONFIG config;
+ uint32_t buf_size = sizeof(config);
+ uint32_t ret_size = 0;
if (argc != 1 ) {
d_printf("Usage: net rpc service status <service>\n");
@@ -314,8 +315,23 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
/* get the config */
- result = rpccli_svcctl_query_config(pipe_hnd, mem_ctx, &hService, &config );
- if ( !W_ERROR_IS_OK(result) ) {
+ status = rpccli_svcctl_QueryServiceConfigW(pipe_hnd, mem_ctx,
+ &hService,
+ &config,
+ buf_size,
+ &ret_size,
+ &result);
+ if (W_ERROR_EQUAL(result, WERR_INSUFFICIENT_BUFFER)) {
+ buf_size = ret_size;
+ status = rpccli_svcctl_QueryServiceConfigW(pipe_hnd, mem_ctx,
+ &hService,
+ &config,
+ buf_size,
+ &ret_size,
+ &result);
+ }
+
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
d_fprintf(stderr, "Query config request failed. [%s]\n", dos_errstr(result));
goto done;
}
@@ -329,29 +345,24 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
d_printf("\tError Control = 0x%x\n", config.error_control);
d_printf("\tTag ID = 0x%x\n", config.tag_id);
- if ( config.executablepath ) {
- rpcstr_pull( ascii_string, config.executablepath->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tExecutable Path = %s\n", ascii_string);
+ if (config.executablepath) {
+ d_printf("\tExecutable Path = %s\n", config.executablepath);
}
- if ( config.loadordergroup ) {
- rpcstr_pull( ascii_string, config.loadordergroup->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tLoad Order Group = %s\n", ascii_string);
+ if (config.loadordergroup) {
+ d_printf("\tLoad Order Group = %s\n", config.loadordergroup);
}
- if ( config.dependencies ) {
- rpcstr_pull( ascii_string, config.dependencies->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tDependencies = %s\n", ascii_string);
+ if (config.dependencies) {
+ d_printf("\tDependencies = %s\n", config.dependencies);
}
- if ( config.startname ) {
- rpcstr_pull( ascii_string, config.startname->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tStart Name = %s\n", ascii_string);
+ if (config.startname) {
+ d_printf("\tStart Name = %s\n", config.startname);
}
- if ( config.displayname ) {
- rpcstr_pull( ascii_string, config.displayname->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tDisplay Name = %s\n", ascii_string);
+ if (config.displayname) {
+ d_printf("\tDisplay Name = %s\n", config.displayname);
}
done: