summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/utils/net_rpc_service.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c
index 242d653017..c4cc19eaa1 100644
--- a/source3/utils/net_rpc_service.c
+++ b/source3/utils/net_rpc_service.c
@@ -19,10 +19,6 @@
#include "includes.h"
#include "utils/net.h"
-
-#define CLI_SERVER_NAME_SLASH(_ctx, _p, _cli) \
- _p = talloc_asprintf(_ctx, "\\\\%s", _cli->cli->desthost);
-
/********************************************************************
********************************************************************/
@@ -172,7 +168,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 +175,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 +227,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 +234,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 +337,6 @@ static NTSTATUS rpc_service_stop_internal(const DOM_SID *domain_sid,
WERROR result = WERR_GENERAL_FAILURE;
NTSTATUS status;
fstring servicename;
- const char *server_name;
if (argc != 1 ) {
d_printf("Usage: net rpc service status <service>\n");
@@ -359,11 +346,8 @@ static NTSTATUS rpc_service_stop_internal(const DOM_SID *domain_sid,
fstrcpy( servicename, argv[0] );
/* 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,
@@ -396,7 +380,6 @@ static NTSTATUS rpc_service_pause_internal(const DOM_SID *domain_sid,
WERROR result = WERR_GENERAL_FAILURE;
NTSTATUS status;
fstring servicename;
- const char *server_name;
if (argc != 1 ) {
d_printf("Usage: net rpc service status <service>\n");
@@ -406,11 +389,8 @@ static NTSTATUS rpc_service_pause_internal(const DOM_SID *domain_sid,
fstrcpy( servicename, argv[0] );
/* 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,
@@ -443,7 +423,6 @@ static NTSTATUS rpc_service_resume_internal(const DOM_SID *domain_sid,
WERROR result = WERR_GENERAL_FAILURE;
NTSTATUS status;
fstring servicename;
- const char *server_name;
if (argc != 1 ) {
d_printf("Usage: net rpc service status <service>\n");
@@ -453,11 +432,8 @@ static NTSTATUS rpc_service_resume_internal(const DOM_SID *domain_sid,
fstrcpy( servicename, argv[0] );
/* 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,
@@ -490,7 +466,6 @@ static NTSTATUS rpc_service_start_internal(const DOM_SID *domain_sid,
WERROR result = WERR_GENERAL_FAILURE;
NTSTATUS status;
uint32 state = 0;
- const char *server_name;
if (argc != 1 ) {
d_printf("Usage: net rpc service status <service>\n");
@@ -498,11 +473,8 @@ static NTSTATUS rpc_service_start_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,