s3: remove rpccli_svcctl_query_config.
authorGünther Deschner <gd@samba.org>
Wed, 15 Oct 2008 23:35:27 +0000 (01:35 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 16 Oct 2008 07:54:49 +0000 (09:54 +0200)
Guenther

source3/include/proto.h
source3/rpc_client/cli_svcctl.c
source3/utils/net_rpc_service.c

index 3c196dbd5aa5cf1235f00d3814a295c00fb234d7..f70a6cef75de3508377b58736c18ede15d24b349 100644 (file)
@@ -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  */
 
index 3c29dcdee85eb3a711531e198fb6a1b4bb2f1b1d..51678083d33b7aed8a374823b48c5b75b2d85eac 100644 (file)
@@ -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;
-}
index d1349a903d0e4e8c70f8db8fb8548c8a3d764336..133173116c3338eb3662133d9e83690584c9ea44 100644 (file)
@@ -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: