#include "utils/net.h"
+#define CLI_SERVER_NAME_SLASH(_ctx, _p, _cli) \
+ _p = talloc_asprintf(_ctx, "\\\\%s", _cli->cli->desthost);
+
/********************************************************************
********************************************************************/
POLICY_HND hSCM;
ENUM_SERVICES_STATUS *services;
WERROR result = WERR_GENERAL_FAILURE;
+ NTSTATUS status;
fstring servicename;
fstring displayname;
uint32 num_services = 0;
+ const char *server_name;
int i;
if (argc != 0 ) {
return NT_STATUS_OK;
}
- result = rpccli_svcctl_open_scm(pipe_hnd, mem_ctx, &hSCM, SC_RIGHT_MGR_ENUMERATE_SERVICE );
- if ( !W_ERROR_IS_OK(result) ) {
+ 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,
+ NULL,
+ SC_RIGHT_MGR_ENUMERATE_SERVICE,
+ &hSCM,
+ &result);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
return werror_to_ntstatus(result);
}
{
POLICY_HND hSCM, hService;
WERROR result = WERR_GENERAL_FAILURE;
+ NTSTATUS status;
fstring servicename;
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");
fstrcpy( servicename, argv[0] );
/* Open the Service Control Manager */
-
- result = rpccli_svcctl_open_scm(pipe_hnd, mem_ctx, &hSCM, SC_RIGHT_MGR_ENUMERATE_SERVICE );
- if ( !W_ERROR_IS_OK(result) ) {
+ 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,
+ NULL,
+ SC_RIGHT_MGR_ENUMERATE_SERVICE,
+ &hSCM,
+ &result);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
return werror_to_ntstatus(result);
}
{
POLICY_HND hSCM;
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");
fstrcpy( servicename, argv[0] );
/* Open the Service Control Manager */
-
- result = rpccli_svcctl_open_scm(pipe_hnd, mem_ctx, &hSCM, SC_RIGHT_MGR_ENUMERATE_SERVICE );
- if ( !W_ERROR_IS_OK(result) ) {
+ 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,
+ NULL,
+ SC_RIGHT_MGR_ENUMERATE_SERVICE,
+ &hSCM,
+ &result);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
return werror_to_ntstatus(result);
}
{
POLICY_HND hSCM;
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");
fstrcpy( servicename, argv[0] );
/* Open the Service Control Manager */
-
- result = rpccli_svcctl_open_scm(pipe_hnd, mem_ctx, &hSCM, SC_RIGHT_MGR_ENUMERATE_SERVICE );
- if ( !W_ERROR_IS_OK(result) ) {
+ 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,
+ NULL,
+ SC_RIGHT_MGR_ENUMERATE_SERVICE,
+ &hSCM,
+ &result);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
return werror_to_ntstatus(result);
}
{
POLICY_HND hSCM;
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");
fstrcpy( servicename, argv[0] );
/* Open the Service Control Manager */
-
- result = rpccli_svcctl_open_scm(pipe_hnd, mem_ctx, &hSCM, SC_RIGHT_MGR_ENUMERATE_SERVICE );
- if ( !W_ERROR_IS_OK(result) ) {
+ 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,
+ NULL,
+ SC_RIGHT_MGR_ENUMERATE_SERVICE,
+ &hSCM,
+ &result);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
return werror_to_ntstatus(result);
}
{
POLICY_HND hSCM, hService;
WERROR result = WERR_GENERAL_FAILURE;
+ NTSTATUS status;
fstring servicename;
uint32 state = 0;
+ const char *server_name;
if (argc != 1 ) {
d_printf("Usage: net rpc service status <service>\n");
fstrcpy( servicename, argv[0] );
/* Open the Service Control Manager */
-
- result = rpccli_svcctl_open_scm( pipe_hnd, mem_ctx, &hSCM, SC_RIGHT_MGR_ENUMERATE_SERVICE );
- if ( !W_ERROR_IS_OK(result) ) {
+ 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,
+ NULL,
+ SC_RIGHT_MGR_ENUMERATE_SERVICE,
+ &hSCM,
+ &result);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
return werror_to_ntstatus(result);
}