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/ndr_svcctl.h"
22 #include "../librpc/gen_ndr/cli_svcctl.h"
24 struct svc_state_msg
{
29 static struct svc_state_msg state_msg_table
[] = {
30 { SVCCTL_STOPPED
, N_("stopped") },
31 { SVCCTL_START_PENDING
, N_("start pending") },
32 { SVCCTL_STOP_PENDING
, N_("stop pending") },
33 { SVCCTL_RUNNING
, N_("running") },
34 { SVCCTL_CONTINUE_PENDING
, N_("resume pending") },
35 { SVCCTL_PAUSE_PENDING
, N_("pause pending") },
36 { SVCCTL_PAUSED
, N_("paused") },
41 /********************************************************************
42 ********************************************************************/
43 const char *svc_status_string( uint32 state
)
48 fstr_sprintf( msg
, _("Unknown State [%d]"), state
);
50 for ( i
=0; state_msg_table
[i
].message
; i
++ ) {
51 if ( state_msg_table
[i
].flag
== state
) {
52 fstrcpy( msg
, state_msg_table
[i
].message
);
57 return talloc_strdup(talloc_tos(), msg
);
60 /********************************************************************
61 ********************************************************************/
63 static WERROR
query_service_state(struct rpc_pipe_client
*pipe_hnd
,
65 struct policy_handle
*hSCM
,
69 struct policy_handle hService
;
70 struct SERVICE_STATUS service_status
;
71 WERROR result
= WERR_GENERAL_FAILURE
;
74 /* now cycle until the status is actually 'watch_state' */
76 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
79 SC_RIGHT_SVC_QUERY_STATUS
,
82 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
83 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
88 status
= rpccli_svcctl_QueryServiceStatus(pipe_hnd
, mem_ctx
,
93 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
94 *state
= service_status
.state
;
97 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
102 /********************************************************************
103 ********************************************************************/
105 static WERROR
watch_service_state(struct rpc_pipe_client
*pipe_hnd
,
107 struct policy_handle
*hSCM
,
110 uint32
*final_state
)
114 WERROR result
= WERR_GENERAL_FAILURE
;
118 while ( (state
!= watch_state
) && i
<30 ) {
121 result
= query_service_state(pipe_hnd
, mem_ctx
, hSCM
, service
, &state
);
122 if ( !W_ERROR_IS_OK(result
) ) {
132 *final_state
= state
;
137 /********************************************************************
138 ********************************************************************/
140 static WERROR
control_service(struct rpc_pipe_client
*pipe_hnd
,
142 struct policy_handle
*hSCM
,
147 struct policy_handle hService
;
148 WERROR result
= WERR_GENERAL_FAILURE
;
150 struct SERVICE_STATUS service_status
;
153 /* Open the Service */
155 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
158 (SC_RIGHT_SVC_STOP
|SC_RIGHT_SVC_PAUSE_CONTINUE
),
162 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
163 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
170 status
= rpccli_svcctl_ControlService(pipe_hnd
, mem_ctx
,
176 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
177 d_fprintf(stderr
, _("Control service request failed. [%s]\n"),
182 /* loop -- checking the state until we are where we want to be */
184 result
= watch_service_state(pipe_hnd
, mem_ctx
, hSCM
, service
, watch_state
, &state
);
186 d_printf(_("%s service is %s.\n"), service
, svc_status_string(state
));
189 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
194 /********************************************************************
195 ********************************************************************/
197 static NTSTATUS
rpc_service_list_internal(struct net_context
*c
,
198 const struct dom_sid
*domain_sid
,
199 const char *domain_name
,
200 struct cli_state
*cli
,
201 struct rpc_pipe_client
*pipe_hnd
,
206 struct policy_handle hSCM
;
207 struct ENUM_SERVICE_STATUSW
*services
= NULL
;
208 WERROR result
= WERR_GENERAL_FAILURE
;
212 uint8_t *buffer
= NULL
;
213 uint32_t buf_size
= 0;
214 uint32_t bytes_needed
= 0;
215 uint32_t num_services
= 0;
216 uint32_t resume_handle
= 0;
219 d_printf("%s net rpc service list\n", _("Usage:"));
223 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
224 pipe_hnd
->srv_name_slash
,
226 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
229 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
231 _("Failed to open Service Control Manager. [%s]\n"),
233 return werror_to_ntstatus(result
);
237 status
= rpccli_svcctl_EnumServicesStatusW(pipe_hnd
, mem_ctx
,
248 if (NT_STATUS_IS_ERR(status
)) {
250 _("Failed to enumerate services. [%s]\n"),
255 if (W_ERROR_EQUAL(result
, WERR_MORE_DATA
) && bytes_needed
> 0) {
256 buffer
= talloc_array(mem_ctx
, uint8_t, bytes_needed
);
257 buf_size
= bytes_needed
;
261 if ( num_services
== 0 ) {
262 d_printf(_("No services returned\n"));
267 enum ndr_err_code ndr_err
;
269 struct ndr_pull
*ndr
;
271 blob
.length
= buf_size
;
272 blob
.data
= talloc_steal(mem_ctx
, buffer
);
274 services
= talloc_array(mem_ctx
, struct ENUM_SERVICE_STATUSW
, num_services
);
276 status
= NT_STATUS_NO_MEMORY
;
280 ndr
= ndr_pull_init_blob(&blob
, mem_ctx
);
282 status
= NT_STATUS_NO_MEMORY
;
286 ndr_err
= ndr_pull_ENUM_SERVICE_STATUSW_array(
287 ndr
, num_services
, services
);
288 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
289 status
= ndr_map_error2ntstatus(ndr_err
);
293 for ( i
=0; i
<num_services
; i
++ ) {
294 d_printf("%-20s \"%s\"\n",
295 services
[i
].service_name
,
296 services
[i
].display_name
);
300 } while (W_ERROR_EQUAL(result
, WERR_MORE_DATA
));
302 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
307 /********************************************************************
308 ********************************************************************/
310 static NTSTATUS
rpc_service_status_internal(struct net_context
*c
,
311 const struct dom_sid
*domain_sid
,
312 const char *domain_name
,
313 struct cli_state
*cli
,
314 struct rpc_pipe_client
*pipe_hnd
,
319 struct policy_handle hSCM
, hService
;
320 WERROR result
= WERR_GENERAL_FAILURE
;
322 struct SERVICE_STATUS service_status
;
323 struct QUERY_SERVICE_CONFIG config
;
324 uint32_t buf_size
= sizeof(config
);
325 uint32_t ret_size
= 0;
328 d_printf("%s net rpc service status <service>\n", _("Usage:"));
332 /* Open the Service Control Manager */
333 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
334 pipe_hnd
->srv_name_slash
,
336 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
339 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
341 _("Failed to open Service Control Manager. [%s]\n"),
343 return werror_to_ntstatus(result
);
346 /* Open the Service */
348 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
351 (SC_RIGHT_SVC_QUERY_STATUS
|SC_RIGHT_SVC_QUERY_CONFIG
),
355 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
356 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
363 status
= rpccli_svcctl_QueryServiceStatus(pipe_hnd
, mem_ctx
,
368 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
369 d_fprintf(stderr
, _("Query status request failed. [%s]\n"),
374 d_printf(_("%s service is %s.\n"), argv
[0],
375 svc_status_string(service_status
.state
));
379 status
= rpccli_svcctl_QueryServiceConfigW(pipe_hnd
, mem_ctx
,
385 if (W_ERROR_EQUAL(result
, WERR_INSUFFICIENT_BUFFER
)) {
387 status
= rpccli_svcctl_QueryServiceConfigW(pipe_hnd
, mem_ctx
,
395 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
396 d_fprintf(stderr
, _("Query config request failed. [%s]\n"),
401 /* print out the configuration information for the service */
403 d_printf(_("Configuration details:\n"));
404 d_printf(_("\tControls Accepted = 0x%x\n"),
405 service_status
.controls_accepted
);
406 d_printf(_("\tService Type = 0x%x\n"), config
.service_type
);
407 d_printf(_("\tStart Type = 0x%x\n"), config
.start_type
);
408 d_printf(_("\tError Control = 0x%x\n"), config
.error_control
);
409 d_printf(_("\tTag ID = 0x%x\n"), config
.tag_id
);
411 if (config
.executablepath
) {
412 d_printf(_("\tExecutable Path = %s\n"),
413 config
.executablepath
);
416 if (config
.loadordergroup
) {
417 d_printf(_("\tLoad Order Group = %s\n"),
418 config
.loadordergroup
);
421 if (config
.dependencies
) {
422 d_printf(_("\tDependencies = %s\n"),
423 config
.dependencies
);
426 if (config
.startname
) {
427 d_printf(_("\tStart Name = %s\n"), config
.startname
);
430 if (config
.displayname
) {
431 d_printf(_("\tDisplay Name = %s\n"),
436 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
437 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
439 return werror_to_ntstatus(result
);
442 /********************************************************************
443 ********************************************************************/
445 static NTSTATUS
rpc_service_stop_internal(struct net_context
*c
,
446 const struct dom_sid
*domain_sid
,
447 const char *domain_name
,
448 struct cli_state
*cli
,
449 struct rpc_pipe_client
*pipe_hnd
,
454 struct policy_handle hSCM
;
455 WERROR result
= WERR_GENERAL_FAILURE
;
460 d_printf("%s net rpc service status <service>\n", _("Usage:"));
464 fstrcpy( servicename
, argv
[0] );
466 /* Open the Service Control Manager */
467 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
468 pipe_hnd
->srv_name_slash
,
470 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
473 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
475 _("Failed to open Service Control Manager. [%s]\n"),
477 return werror_to_ntstatus(result
);
480 result
= control_service(pipe_hnd
, mem_ctx
, &hSCM
, servicename
,
481 SVCCTL_CONTROL_STOP
, SVCCTL_STOPPED
);
483 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
485 return werror_to_ntstatus(result
);
488 /********************************************************************
489 ********************************************************************/
491 static NTSTATUS
rpc_service_pause_internal(struct net_context
*c
,
492 const struct dom_sid
*domain_sid
,
493 const char *domain_name
,
494 struct cli_state
*cli
,
495 struct rpc_pipe_client
*pipe_hnd
,
500 struct policy_handle hSCM
;
501 WERROR result
= WERR_GENERAL_FAILURE
;
506 d_printf("%s net rpc service status <service>\n", _("Usage:"));
510 fstrcpy( servicename
, argv
[0] );
512 /* Open the Service Control Manager */
513 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
514 pipe_hnd
->srv_name_slash
,
516 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
519 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
521 _("Failed to open Service Control Manager. [%s]\n"),
523 return werror_to_ntstatus(result
);
526 result
= control_service(pipe_hnd
, mem_ctx
, &hSCM
, servicename
,
527 SVCCTL_CONTROL_PAUSE
, SVCCTL_PAUSED
);
529 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
531 return werror_to_ntstatus(result
);
534 /********************************************************************
535 ********************************************************************/
537 static NTSTATUS
rpc_service_resume_internal(struct net_context
*c
,
538 const struct dom_sid
*domain_sid
,
539 const char *domain_name
,
540 struct cli_state
*cli
,
541 struct rpc_pipe_client
*pipe_hnd
,
546 struct policy_handle hSCM
;
547 WERROR result
= WERR_GENERAL_FAILURE
;
552 d_printf("%s net rpc service status <service>\n", _("Usage:"));
556 fstrcpy( servicename
, argv
[0] );
558 /* Open the Service Control Manager */
559 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
560 pipe_hnd
->srv_name_slash
,
562 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
565 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
567 _("Failed to open Service Control Manager. [%s]\n"),
569 return werror_to_ntstatus(result
);
572 result
= control_service(pipe_hnd
, mem_ctx
, &hSCM
, servicename
,
573 SVCCTL_CONTROL_CONTINUE
, SVCCTL_RUNNING
);
575 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
577 return werror_to_ntstatus(result
);
580 /********************************************************************
581 ********************************************************************/
583 static NTSTATUS
rpc_service_start_internal(struct net_context
*c
,
584 const struct dom_sid
*domain_sid
,
585 const char *domain_name
,
586 struct cli_state
*cli
,
587 struct rpc_pipe_client
*pipe_hnd
,
592 struct policy_handle hSCM
, hService
;
593 WERROR result
= WERR_GENERAL_FAILURE
;
598 d_printf("%s net rpc service status <service>\n", _("Usage:"));
602 /* Open the Service Control Manager */
603 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
604 pipe_hnd
->srv_name_slash
,
606 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
609 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
611 _("Failed to open Service Control Manager. [%s]\n"),
613 return werror_to_ntstatus(result
);
616 /* Open the Service */
618 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
625 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
626 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
633 status
= rpccli_svcctl_StartServiceW(pipe_hnd
, mem_ctx
,
639 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
640 d_fprintf(stderr
, _("Query status request failed. [%s]\n"),
645 result
= watch_service_state(pipe_hnd
, mem_ctx
, &hSCM
, argv
[0], SVCCTL_RUNNING
, &state
);
647 if ( W_ERROR_IS_OK(result
) && (state
== SVCCTL_RUNNING
) )
648 d_printf(_("Successfully started service: %s\n"),
651 d_fprintf(stderr
,_("Failed to start service: %s [%s]\n"),
652 argv
[0], win_errstr(result
) );
655 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
656 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
658 return werror_to_ntstatus(result
);
661 /********************************************************************
662 ********************************************************************/
664 static NTSTATUS
rpc_service_delete_internal(struct net_context
*c
,
665 const struct dom_sid
*domain_sid
,
666 const char *domain_name
,
667 struct cli_state
*cli
,
668 struct rpc_pipe_client
*pipe_hnd
,
673 struct policy_handle hSCM
, hService
;
674 WERROR result
= WERR_GENERAL_FAILURE
;
678 d_printf("%s net rpc service delete <service>\n", _("Usage:"));
682 /* Open the Service Control Manager */
683 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
684 pipe_hnd
->srv_name_slash
,
686 SC_RIGHT_MGR_ENUMERATE_SERVICE
,
689 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
691 _("Failed to open Service Control Manager. [%s]\n"),
693 return werror_to_ntstatus(result
);
696 /* Open the Service */
698 status
= rpccli_svcctl_OpenServiceW(pipe_hnd
, mem_ctx
,
705 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
706 d_fprintf(stderr
, _("Failed to open service. [%s]\n"),
711 /* Delete the Service */
713 status
= rpccli_svcctl_DeleteService(pipe_hnd
, mem_ctx
,
717 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
718 d_fprintf(stderr
, _("Delete service request failed. [%s]\n"),
723 d_printf(_("Successfully deleted Service: %s\n"), argv
[0]);
726 if (is_valid_policy_hnd(&hService
)) {
727 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
729 if (is_valid_policy_hnd(&hSCM
)) {
730 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
733 return werror_to_ntstatus(result
);
736 /********************************************************************
737 ********************************************************************/
739 static NTSTATUS
rpc_service_create_internal(struct net_context
*c
,
740 const struct dom_sid
*domain_sid
,
741 const char *domain_name
,
742 struct cli_state
*cli
,
743 struct rpc_pipe_client
*pipe_hnd
,
748 struct policy_handle hSCM
, hService
;
749 WERROR result
= WERR_GENERAL_FAILURE
;
751 const char *ServiceName
;
752 const char *DisplayName
;
753 const char *binary_path
;
756 d_printf("%s net rpc service create <service> "
757 "<displayname> <binarypath>\n", _("Usage:"));
761 /* Open the Service Control Manager */
762 status
= rpccli_svcctl_OpenSCManagerW(pipe_hnd
, mem_ctx
,
763 pipe_hnd
->srv_name_slash
,
765 SC_RIGHT_MGR_CREATE_SERVICE
,
768 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
)) {
770 _("Failed to open Service Control Manager. [%s]\n"),
772 return werror_to_ntstatus(result
);
775 /* Create the service */
777 ServiceName
= argv
[0];
778 DisplayName
= argv
[1];
779 binary_path
= argv
[2];
781 status
= rpccli_svcctl_CreateServiceW(pipe_hnd
, mem_ctx
,
786 SERVICE_TYPE_WIN32_OWN_PROCESS
,
788 SVCCTL_SVC_ERROR_NORMAL
,
790 NULL
, /* LoadOrderGroupKey */
792 NULL
, /* dependencies */
793 0, /* dependencies_size */
794 NULL
, /* service_start_name */
796 0, /* password_size */
800 if (!NT_STATUS_IS_OK(status
) || !W_ERROR_IS_OK(result
) ) {
801 d_fprintf(stderr
, _("Create service request failed. [%s]\n"),
806 d_printf(_("Successfully created Service: %s\n"), argv
[0]);
809 if (is_valid_policy_hnd(&hService
)) {
810 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hService
, NULL
);
812 if (is_valid_policy_hnd(&hSCM
)) {
813 rpccli_svcctl_CloseServiceHandle(pipe_hnd
, mem_ctx
, &hSCM
, NULL
);
816 return werror_to_ntstatus(result
);
819 /********************************************************************
820 ********************************************************************/
822 static int rpc_service_list(struct net_context
*c
, int argc
, const char **argv
)
824 if (c
->display_usage
) {
826 "net rpc service list\n"
829 _("View configured Win32 services"));
833 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
834 rpc_service_list_internal
, argc
, argv
);
837 /********************************************************************
838 ********************************************************************/
840 static int rpc_service_start(struct net_context
*c
, int argc
, const char **argv
)
842 if (c
->display_usage
) {
844 "net rpc service start <service>\n"
847 _("Start a Win32 service"));
851 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
852 rpc_service_start_internal
, argc
, argv
);
855 /********************************************************************
856 ********************************************************************/
858 static int rpc_service_stop(struct net_context
*c
, int argc
, const char **argv
)
860 if (c
->display_usage
) {
862 "net rpc service stop <service>\n"
865 _("Stop a Win32 service"));
869 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
870 rpc_service_stop_internal
, argc
, argv
);
873 /********************************************************************
874 ********************************************************************/
876 static int rpc_service_resume(struct net_context
*c
, int argc
, const char **argv
)
878 if (c
->display_usage
) {
880 "net rpc service resume <service>\n"
883 _("Resume a Win32 service"));
887 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
888 rpc_service_resume_internal
, argc
, argv
);
891 /********************************************************************
892 ********************************************************************/
894 static int rpc_service_pause(struct net_context
*c
, int argc
, const char **argv
)
896 if (c
->display_usage
) {
898 "net rpc service pause <service>\n"
901 _("Pause a Win32 service"));
905 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
906 rpc_service_pause_internal
, argc
, argv
);
909 /********************************************************************
910 ********************************************************************/
912 static int rpc_service_status(struct net_context
*c
, int argc
, const char **argv
)
914 if (c
->display_usage
) {
916 "net rpc service status <service>\n"
919 _("Show the current status of a service"));
923 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
924 rpc_service_status_internal
, argc
, argv
);
927 /********************************************************************
928 ********************************************************************/
930 static int rpc_service_delete(struct net_context
*c
, int argc
, const char **argv
)
932 if (c
->display_usage
) {
934 "net rpc service delete <service>\n"
937 _("Delete a Win32 service"));
941 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
942 rpc_service_delete_internal
, argc
, argv
);
945 /********************************************************************
946 ********************************************************************/
948 static int rpc_service_create(struct net_context
*c
, int argc
, const char **argv
)
950 if (c
->display_usage
) {
952 "net rpc service create <service>\n"
955 _("Create a Win32 service"));
959 return run_rpc_command(c
, NULL
, &ndr_table_svcctl
.syntax_id
, 0,
960 rpc_service_create_internal
, argc
, argv
);
963 /********************************************************************
964 ********************************************************************/
966 int net_rpc_service(struct net_context
*c
, int argc
, const char **argv
)
968 struct functable func
[] = {
973 N_("View configured Win32 services"),
974 N_("net rpc service list\n"
975 " View configured Win32 services")
981 N_("Start a service"),
982 N_("net rpc service start\n"
989 N_("Stop a service"),
990 N_("net rpc service stop\n"
997 N_("Pause a service"),
998 N_("net rpc service pause\n"
1005 N_("Resume a paused service"),
1006 N_("net rpc service resume\n"
1007 " Resume a service")
1013 N_("View current status of a service"),
1014 N_("net rpc service status\n"
1015 " View current status of a service")
1021 N_("Delete a service"),
1022 N_("net rpc service delete\n"
1023 " Deletes a service")
1029 N_("Create a service"),
1030 N_("net rpc service create\n"
1031 " Creates a service")
1034 {NULL
, NULL
, 0, NULL
, NULL
}
1037 return net_run_function(c
, argc
, argv
, "net rpc service",func
);