diff options
author | Gerald Carter <jerry@samba.org> | 2005-03-24 17:11:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:56:18 -0500 |
commit | eb1adc527bb1b01f28fa86e7caa66c85181df764 (patch) | |
tree | 1e5ccdd45775a886a2af812c7c81c55684a2bfbf /source3/utils | |
parent | 259d44dbb2c2239339f6888fd5da12632abcbb28 (diff) | |
download | samba-eb1adc527bb1b01f28fa86e7caa66c85181df764.tar.gz samba-eb1adc527bb1b01f28fa86e7caa66c85181df764.tar.bz2 samba-eb1adc527bb1b01f28fa86e7caa66c85181df764.zip |
r6039: add CLI_DO_RPC macro for cookie cutter code; no new functionality to 'net rpc service'
(This used to be commit 759affb1e1aa59fcb878b4dee781aa362b3e7e1c)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_rpc_service.c | 66 |
1 files changed, 3 insertions, 63 deletions
diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c index 79e7eaa900..98711c95b6 100644 --- a/source3/utils/net_rpc_service.c +++ b/source3/utils/net_rpc_service.c @@ -20,68 +20,6 @@ #include "includes.h" #include "utils/net.h" - -/******************************************************************** -********************************************************************/ - -static WERROR open_scmanager( struct cli_state *cli, TALLOC_CTX *mem_ctx, POLICY_HND *hSCM ) -{ - SVCCTL_Q_OPEN_SCMANAGER in; - SVCCTL_R_OPEN_SCMANAGER out; - WERROR result; - fstring server; - - ZERO_STRUCT(in); - ZERO_STRUCT(out); - - /* leave the database name NULL to get the default service db */ - - in.database = NULL; - - /* set the server name */ - - if ( !(in.servername = TALLOC_P( mem_ctx, UNISTR2 )) ) - return WERR_NOMEM; - fstr_sprintf( server, "\\\\%s", cli->desthost ); - init_unistr2( in.servername, server, UNI_STR_TERMINATE ); - - in.access = SC_MANAGER_ALL_ACCESS; - - result = cli_svcctl_open_scm( cli, mem_ctx, &in, &out ); - - if ( !W_ERROR_IS_OK( result ) ) - return result; - - memcpy( hSCM, &out.handle, sizeof(POLICY_HND) ); - - return WERR_OK; -} - - -/******************************************************************** -********************************************************************/ - -static WERROR close_service_handle( struct cli_state *cli, TALLOC_CTX *mem_ctx, POLICY_HND *hService ) -{ - SVCCTL_Q_CLOSE_SERVICE in; - SVCCTL_R_CLOSE_SERVICE out; - WERROR result; - - ZERO_STRUCT(in); - ZERO_STRUCT(out); - - memcpy( &in.handle, hService, sizeof(POLICY_HND) ); - - result = cli_svcctl_close_service( cli, mem_ctx, &in, &out ); - - if ( !W_ERROR_IS_OK( result ) ) - return result; - - return WERR_OK; -} - - - /******************************************************************** ********************************************************************/ @@ -97,13 +35,15 @@ static NTSTATUS rpc_service_list_internal( const DOM_SID *domain_sid, const char return NT_STATUS_OK; } - if ( !W_ERROR_IS_OK(result = open_scmanager( cli, mem_ctx, &hSCM )) ) { + if ( !W_ERROR_IS_OK(result = cli_svcctl_open_scm( cli, mem_ctx, &hSCM, SC_RIGHT_MGR_ENUMERATE_SERVICE )) ) { d_printf("Failed to open Service Control Manager. [%s]\n", dos_errstr(result)); return werror_to_ntstatus(result); } d_printf("Successfully opened Service Control Manager.\n"); + + close_service_handle( cli, mem_ctx, &hSCM ); return NT_STATUS_OK; |