2 Samba Unix/Linux SMB client library
3 Distributed SMB/CIFS Server Management Utility
4 Copyright (C) Gerald (Jerry) Carter 2005
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "utils/net.h"
21 #include "../librpc/gen_ndr/cli_svcctl.h"
23 struct svc_state_msg
{
28 static struct svc_state_msg state_msg_table
[] = {
29 { SVCCTL_STOPPED
, N_("stopped") },
30 { SVCCTL_START_PENDING
, N_("start pending") },
31 { SVCCTL_STOP_PENDING
, N_("stop pending") },
32 { SVCCTL_RUNNING
, N_("running") },
33 { SVCCTL_CONTINUE_PENDING
, N_("resume pending") },
34 { SVCCTL_PAUSE_PENDING
, N_("pause pending") },
35 { SVCCTL_PAUSED
, N_("paused") },
40 /********************************************************************
41 ********************************************************************/
42 const char *svc_status_string( uint32 state
)
47 fstr_sprintf( msg
, _("Unknown State [%d]"), state
);
49 for ( i
=0; state_msg_table
[i
].message
; i
++ ) {
50 if ( state_msg_table
[i
].flag
== state
) {
51 fstrcpy( msg
, state_msg_table
[i
].message
);
56 return talloc_strdup(talloc_tos(), msg
);
59 /********************************************************************
60 ********************************************************************/
62 static WERROR
query_service_state(struct rpc_pipe_client
*pipe_hnd
,
64 struct policy_handle
*hSCM
,
68 struct policy_handle hService
;
69 struct SERVICE_STATUS service_status
;
70 WERROR result
= WERR_GENERAL_FAILURE
;
73 /* now cycle until the status is actually 'watch_state' */
75 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
78 SC_RIGHT_SVC_QUERY_STATUS
,
81 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
82 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
87 status
= rpccli_svcctl_QueryServiceStatus(pipe_hnd
, mem_ctx
,
92 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
93 *state
= service_status
.state
;
96 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
101 /********************************************************************
102 ********************************************************************/
104 static WERROR
watch_service_state(struct rpc_pipe_client
*pipe_hnd
,
106 struct policy_handle
*hSCM
,
109 uint32
*final_state
)
113 WERROR result
= WERR_GENERAL_FAILURE
;
117 while ( (state
!= watch_state
) && i
<30 ) {
120 result
= query_service_state(pipe_hnd
, mem_ctx
, hSCM
, service
, &state
);
121 if ( !W_ERROR_IS_OK(result
) ) {
131 *final_state
= state
;
136 /********************************************************************
137 ********************************************************************/
139 static WERROR
control_service(struct rpc_pipe_client
*pipe_hnd
,
141 struct policy_handle
*hSCM
,
146 struct policy_handle hService
;
147 WERROR result
= WERR_GENERAL_FAILURE
;
149 struct SERVICE_STATUS service_status
;
152 /* Open the Service */
154 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
157 (SC_RIGHT_SVC_STOP
|SC_RIGHT_SVC_PAUSE_CONTINUE
),
161 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
162 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
169 status
= rpccli_svcctl_ControlService(pipe_hnd
, mem_ctx
,
175 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
176 d_fprintf(stderr
, _("Control service request failed. [%s]\n"),
181 /* loop -- checking the state until we are where we want to be */
183 result
= watch_service_state(pipe_hnd
, mem_ctx
, hSCM
, service
, watch_state
, &state
);
185 d_printf(_("%s service is %s.\n"), service
, svc_status_string(state
));
188 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
193 /********************************************************************
194 ********************************************************************/
196 static NTSTATUS
rpc_service_list_internal(struct net_context
*c
,
197 const struct dom_sid
*domain_sid
,
198 const char *domain_name
,
199 struct cli_state
*cli
,
200 struct rpc_pipe_client
*pipe_hnd
,
205 struct policy_handle hSCM
;
206 struct ENUM_SERVICE_STATUSW
*services
= NULL
;
207 WERROR result
= WERR_GENERAL_FAILURE
;
211 uint8_t *buffer
= NULL
;
212 uint32_t buf_size
= 0;
213 uint32_t bytes_needed
= 0;
214 uint32_t num_services
= 0;
215 uint32_t resume_handle
= 0;
218 d_printf("%s net rpc service list\n", _("Usage:"));
222 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
223 pipe_hnd
->srv_name_slash
,
225 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
228 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
230 _("Failed to open Service Control Manager. [%s]\n"),
232 return werror_to_ntstatus(result
);
236 status
= rpccli_svcctl_EnumServicesStatusW(pipe_hnd
, mem_ctx
,
247 if (NT_STATUS_IS_ERR(status
)) {
249 _("Failed to enumerate services. [%s]\n"),
254 if (W_ERROR_EQUAL(result
, WERR_MORE_DATA
) && bytes_needed
> 0) {
255 buffer
= talloc_array(mem_ctx
, uint8_t, bytes_needed
);
256 buf_size
= bytes_needed
;
260 if ( num_services
== 0 ) {
261 d_printf(_("No services returned\n"));
266 enum ndr_err_code ndr_err
;
268 struct ndr_pull
*ndr
;
270 blob
.length
= buf_size
;
271 blob
.data
= talloc_steal(mem_ctx
, buffer
);
273 services
= talloc_array(mem_ctx
, struct ENUM_SERVICE_STATUSW
, num_services
);
275 status
= NT_STATUS_NO_MEMORY
;
279 ndr
= ndr_pull_init_blob(&blob
, mem_ctx
);
281 status
= NT_STATUS_NO_MEMORY
;
285 ndr_err
= ndr_pull_ENUM_SERVICE_STATUSW_array(
286 ndr
, num_services
, services
);
287 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
288 status
= ndr_map_error2ntstatus(ndr_err
);
292 for ( i
=0; i
<num_services
; i
++ ) {
293 d_printf("%-20s \"%s\"\n",
294 services
[i
].service_name
,
295 services
[i
].display_name
);
299 } while (W_ERROR_EQUAL(result
, WERR_MORE_DATA
));
301 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
306 /********************************************************************
307 ********************************************************************/
309 static NTSTATUS
rpc_service_status_internal(struct net_context
*c
,
310 const struct dom_sid
*domain_sid
,
311 const char *domain_name
,
312 struct cli_state
*cli
,
313 struct rpc_pipe_client
*pipe_hnd
,
318 struct policy_handle hSCM
, hService
;
319 WERROR result
= WERR_GENERAL_FAILURE
;
321 struct SERVICE_STATUS service_status
;
322 struct QUERY_SERVICE_CONFIG config
;
323 uint32_t buf_size
= sizeof(config
);
324 uint32_t ret_size
= 0;
327 d_printf("%s net rpc service status <service>\n", _("Usage:"));
331 /* Open the Service Control Manager */
332 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
333 pipe_hnd
->srv_name_slash
,
335 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
338 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
340 _("Failed to open Service Control Manager. [%s]\n"),
342 return werror_to_ntstatus(result
);
345 /* Open the Service */
347 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
350 (SC_RIGHT_SVC_QUERY_STATUS
|SC_RIGHT_SVC_QUERY_CONFIG
),
354 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
355 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
362 status
= rpccli_svcctl_QueryServiceStatus(pipe_hnd
, mem_ctx
,
367 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
368 d_fprintf(stderr
, _("Query status request failed. [%s]\n"),
373 d_printf(_("%s service is %s.\n"), argv
[0],
374 svc_status_string(service_status
.state
));
378 status
= rpccli_svcctl_QueryServiceConfigW(pipe_hnd
, mem_ctx
,
384 if (W_ERROR_EQUAL(result
, WERR_INSUFFICIENT_BUFFER
)) {
386 status
= rpccli_svcctl_QueryServiceConfigW(pipe_hnd
, mem_ctx
,
394 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
395 d_fprintf(stderr
, _("Query config request failed. [%s]\n"),
400 /* print out the configuration information for the service */
402 d_printf(_("Configuration details:\n"));
403 d_printf(_("\tControls Accepted = 0x%x\n"),
404 service_status
.controls_accepted
);
405 d_printf(_("\tService Type = 0x%x\n"), config
.service_type
);
406 d_printf(_("\tStart Type = 0x%x\n"), config
.start_type
);
407 d_printf(_("\tError Control = 0x%x\n"), config
.error_control
);
408 d_printf(_("\tTag ID = 0x%x\n"), config
.tag_id
);
410 if (config
.executablepath
) {
411 d_printf(_("\tExecutable Path = %s\n"),
412 config
.executablepath
);
415 if (config
.loadordergroup
) {
416 d_printf(_("\tLoad Order Group = %s\n"),
417 config
.loadordergroup
);
420 if (config
.dependencies
) {
421 d_printf(_("\tDependencies = %s\n"),
422 config
.dependencies
);
425 if (config
.startname
) {
426 d_printf(_("\tStart Name = %s\n"), config
.startname
);
429 if (config
.displayname
) {
430 d_printf(_("\tDisplay Name = %s\n"),
435 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
436 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
438 return werror_to_ntstatus(result
);
441 /********************************************************************
442 ********************************************************************/
444 static NTSTATUS
rpc_service_stop_internal(struct net_context
*c
,
445 const struct dom_sid
*domain_sid
,
446 const char *domain_name
,
447 struct cli_state
*cli
,
448 struct rpc_pipe_client
*pipe_hnd
,
453 struct policy_handle hSCM
;
454 WERROR result
= WERR_GENERAL_FAILURE
;
459 d_printf("%s net rpc service status <service>\n", _("Usage:"));
463 fstrcpy( servicename
, argv
[0] );
465 /* Open the Service Control Manager */
466 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
467 pipe_hnd
->srv_name_slash
,
469 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
472 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
474 _("Failed to open Service Control Manager. [%s]\n"),
476 return werror_to_ntstatus(result
);
479 result
= control_service(pipe_hnd
, mem_ctx
, &hSCM
, servicename
,
480 SVCCTL_CONTROL_STOP
, SVCCTL_STOPPED
);
482 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
484 return werror_to_ntstatus(result
);
487 /********************************************************************
488 ********************************************************************/
490 static NTSTATUS
rpc_service_pause_internal(struct net_context
*c
,
491 const struct dom_sid
*domain_sid
,
492 const char *domain_name
,
493 struct cli_state
*cli
,
494 struct rpc_pipe_client
*pipe_hnd
,
499 struct policy_handle hSCM
;
500 WERROR result
= WERR_GENERAL_FAILURE
;
505 d_printf("%s net rpc service status <service>\n", _("Usage:"));
509 fstrcpy( servicename
, argv
[0] );
511 /* Open the Service Control Manager */
512 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
513 pipe_hnd
->srv_name_slash
,
515 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
518 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
520 _("Failed to open Service Control Manager. [%s]\n"),
522 return werror_to_ntstatus(result
);
525 result
= control_service(pipe_hnd
, mem_ctx
, &hSCM
, servicename
,
526 SVCCTL_CONTROL_PAUSE
, SVCCTL_PAUSED
);
528 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
530 return werror_to_ntstatus(result
);
533 /********************************************************************
534 ********************************************************************/
536 static NTSTATUS
rpc_service_resume_internal(struct net_context
*c
,
537 const struct dom_sid
*domain_sid
,
538 const char *domain_name
,
539 struct cli_state
*cli
,
540 struct rpc_pipe_client
*pipe_hnd
,
545 struct policy_handle hSCM
;
546 WERROR result
= WERR_GENERAL_FAILURE
;
551 d_printf("%s net rpc service status <service>\n", _("Usage:"));
555 fstrcpy( servicename
, argv
[0] );
557 /* Open the Service Control Manager */
558 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
559 pipe_hnd
->srv_name_slash
,
561 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
564 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
566 _("Failed to open Service Control Manager. [%s]\n"),
568 return werror_to_ntstatus(result
);
571 result
= control_service(pipe_hnd
, mem_ctx
, &hSCM
, servicename
,
572 SVCCTL_CONTROL_CONTINUE
, SVCCTL_RUNNING
);
574 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
576 return werror_to_ntstatus(result
);
579 /********************************************************************
580 ********************************************************************/
582 static NTSTATUS
rpc_service_start_internal(struct net_context
*c
,
583 const struct dom_sid
*domain_sid
,
584 const char *domain_name
,
585 struct cli_state
*cli
,
586 struct rpc_pipe_client
*pipe_hnd
,
591 struct policy_handle hSCM
, hService
;
592 WERROR result
= WERR_GENERAL_FAILURE
;
597 d_printf("%s net rpc service status <service>\n", _("Usage:"));
601 /* Open the Service Control Manager */
602 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
603 pipe_hnd
->srv_name_slash
,
605 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
608 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
610 _("Failed to open Service Control Manager. [%s]\n"),
612 return werror_to_ntstatus(result
);
615 /* Open the Service */
617 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
624 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
625 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
632 status
= rpccli_svcctl_StartServiceW(pipe_hnd
, mem_ctx
,
638 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
639 d_fprintf(stderr
, _("Query status request failed. [%s]\n"),
644 result
= watch_service_state(pipe_hnd
, mem_ctx
, &hSCM
, argv
[0], SVCCTL_RUNNING
, &state
);
646 if ( W_ERROR_IS_OK(result
) && (state
== SVCCTL_RUNNING
) )
647 d_printf(_("Successfully started service: %s\n"),
650 d_fprintf(stderr
,_("Failed to start service: %s [%s]\n"),
651 argv
[0], win_errstr(result
) );
654 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
655 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
657 return werror_to_ntstatus(result
);
660 /********************************************************************
661 ********************************************************************/
663 static NTSTATUS
rpc_service_delete_internal(struct net_context
*c
,
664 const struct dom_sid
*domain_sid
,
665 const char *domain_name
,
666 struct cli_state
*cli
,
667 struct rpc_pipe_client
*pipe_hnd
,
672 struct policy_handle hSCM
, hService
;
673 WERROR result
= WERR_GENERAL_FAILURE
;
677 d_printf("%s net rpc service delete <service>\n", _("Usage:"));
681 /* Open the Service Control Manager */
682 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
683 pipe_hnd
->srv_name_slash
,
685 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
688 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
690 _("Failed to open Service Control Manager. [%s]\n"),
692 return werror_to_ntstatus(result
);
695 /* Open the Service */
697 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
704 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
705 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
710 /* Delete the Service */
712 status
= rpccli_svcctl_DeleteService(pipe_hnd
, mem_ctx
,
716 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
717 d_fprintf(stderr
, _("Delete service request failed. [%s]\n"),
722 d_printf(_("Successfully deleted Service: %s\n"), argv
[0]);
725 if (is_valid_policy_hnd(&hService
)) {
726 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
728 if (is_valid_policy_hnd(&hSCM
)) {
729 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
732 return werror_to_ntstatus(result
);
735 /********************************************************************
736 ********************************************************************/
738 static NTSTATUS
rpc_service_create_internal(struct net_context
*c
,
739 const struct dom_sid
*domain_sid
,
740 const char *domain_name
,
741 struct cli_state
*cli
,
742 struct rpc_pipe_client
*pipe_hnd
,
747 struct policy_handle hSCM
, hService
;
748 WERROR result
= WERR_GENERAL_FAILURE
;
750 const char *ServiceName
;
751 const char *DisplayName
;
752 const char *binary_path
;
755 d_printf("%s net rpc service create <service> "
756 "<displayname> <binarypath>\n", _("Usage:"));
760 /* Open the Service Control Manager */
761 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
762 pipe_hnd
->srv_name_slash
,
764 SC_RIGHT_MGR_CREATE_SERVICE
,
767 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
769 _("Failed to open Service Control Manager. [%s]\n"),
771 return werror_to_ntstatus(result
);
774 /* Create the service */
776 ServiceName
= argv
[0];
777 DisplayName
= argv
[1];
778 binary_path
= argv
[2];
780 status
= rpccli_svcctl_CreateServiceW(pipe_hnd
, mem_ctx
,
785 SERVICE_TYPE_WIN32_OWN_PROCESS
,
787 SVCCTL_SVC_ERROR_NORMAL
,
789 NULL
, /* LoadOrderGroupKey */
791 NULL
, /* dependencies */
792 0, /* dependencies_size */
793 NULL
, /* service_start_name */
795 0, /* password_size */
799 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
800 d_fprintf(stderr
, _("Create service request failed. [%s]\n"),
805 d_printf(_("Successfully created Service: %s\n"), argv
[0]);
808 if (is_valid_policy_hnd(&hService
)) {
809 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
811 if (is_valid_policy_hnd(&hSCM
)) {
812 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
815 return werror_to_ntstatus(result
);
818 /********************************************************************
819 ********************************************************************/
821 static int rpc_service_list(struct net_context
*c
, int argc
, const char **argv
)
823 if (c
->display_usage
) {
825 "net rpc service list\n"
828 _("View configured Win32 services"));
832 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
833 rpc_service_list_internal
, argc
, argv
);
836 /********************************************************************
837 ********************************************************************/
839 static int rpc_service_start(struct net_context
*c
, int argc
, const char **argv
)
841 if (c
->display_usage
) {
843 "net rpc service start <service>\n"
846 _("Start a Win32 service"));
850 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
851 rpc_service_start_internal
, argc
, argv
);
854 /********************************************************************
855 ********************************************************************/
857 static int rpc_service_stop(struct net_context
*c
, int argc
, const char **argv
)
859 if (c
->display_usage
) {
861 "net rpc service stop <service>\n"
864 _("Stop a Win32 service"));
868 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
869 rpc_service_stop_internal
, argc
, argv
);
872 /********************************************************************
873 ********************************************************************/
875 static int rpc_service_resume(struct net_context
*c
, int argc
, const char **argv
)
877 if (c
->display_usage
) {
879 "net rpc service resume <service>\n"
882 _("Resume a Win32 service"));
886 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
887 rpc_service_resume_internal
, argc
, argv
);
890 /********************************************************************
891 ********************************************************************/
893 static int rpc_service_pause(struct net_context
*c
, int argc
, const char **argv
)
895 if (c
->display_usage
) {
897 "net rpc service pause <service>\n"
900 _("Pause a Win32 service"));
904 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
905 rpc_service_pause_internal
, argc
, argv
);
908 /********************************************************************
909 ********************************************************************/
911 static int rpc_service_status(struct net_context
*c
, int argc
, const char **argv
)
913 if (c
->display_usage
) {
915 "net rpc service status <service>\n"
918 _("Show the current status of a service"));
922 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
923 rpc_service_status_internal
, argc
, argv
);
926 /********************************************************************
927 ********************************************************************/
929 static int rpc_service_delete(struct net_context
*c
, int argc
, const char **argv
)
931 if (c
->display_usage
) {
933 "net rpc service delete <service>\n"
936 _("Delete a Win32 service"));
940 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
941 rpc_service_delete_internal
, argc
, argv
);
944 /********************************************************************
945 ********************************************************************/
947 static int rpc_service_create(struct net_context
*c
, int argc
, const char **argv
)
949 if (c
->display_usage
) {
951 "net rpc service create <service>\n"
954 _("Create a Win32 service"));
958 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
959 rpc_service_create_internal
, argc
, argv
);
962 /********************************************************************
963 ********************************************************************/
965 int net_rpc_service(struct net_context
*c
, int argc
, const char **argv
)
967 struct functable func
[] = {
972 N_("View configured Win32 services"),
973 N_("net rpc service list\n"
974 " View configured Win32 services")
980 N_("Start a service"),
981 N_("net rpc service start\n"
988 N_("Stop a service"),
989 N_("net rpc service stop\n"
996 N_("Pause a service"),
997 N_("net rpc service pause\n"
1004 N_("Resume a paused service"),
1005 N_("net rpc service resume\n"
1006 " Resume a service")
1012 N_("View current status of a service"),
1013 N_("net rpc service status\n"
1014 " View current status of a service")
1020 N_("Delete a service"),
1021 N_("net rpc service delete\n"
1022 " Deletes a service")
1028 N_("Create a service"),
1029 N_("net rpc service create\n"
1030 " Creates a service")
1033 {NULL
, NULL
, 0, NULL
, NULL
}
1036 return net_run_function(c
, argc
, argv
, "net rpc service",func
);