2 * Unix SMB/CIFS implementation.
3 * Service Control API Implementation
4 * Copyright (C) Gerald 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 2 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, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 /*********************************************************************
24 *********************************************************************/
26 static WERROR
rcinit_stop( const char *service
, SERVICE_STATUS
*status
)
31 pstr_sprintf( command
, "%s/%s/%s stop", dyn_LIBDIR
, SVCCTL_SCRIPT_DIR
, service
);
33 /* we've already performed the access check when the service was opened */
36 ret
= smbrun( command
, &fd
);
39 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command
, ret
));
42 ZERO_STRUCTP( status
);
43 status
->type
= 0x0020;
44 status
->state
= (ret
== 0 ) ? 0x0001 : 0x0004;
45 status
->controls_accepted
= 0x0005;
47 return ( ret
== 0 ) ? WERR_OK
: WERR_ACCESS_DENIED
;
50 /*********************************************************************
51 *********************************************************************/
53 static WERROR
rcinit_start( const char *service
)
58 pstr_sprintf( command
, "%s/%s/%s start", dyn_LIBDIR
, SVCCTL_SCRIPT_DIR
, service
);
60 /* we've already performed the access check when the service was opened */
63 ret
= smbrun( command
, &fd
);
66 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command
, ret
));
69 return ( ret
== 0 ) ? WERR_OK
: WERR_ACCESS_DENIED
;
72 /*********************************************************************
73 *********************************************************************/
75 static WERROR
rcinit_status( const char *service
, SERVICE_STATUS
*status
)
80 pstr_sprintf( command
, "%s/%s/%s status", dyn_LIBDIR
, SVCCTL_SCRIPT_DIR
, service
);
82 /* we've already performed the access check when the service was opened */
83 /* assume as return code of 0 means that the service is ok. Anything else
87 ret
= smbrun( command
, &fd
);
90 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command
, ret
));
93 ZERO_STRUCTP( status
);
94 status
->type
= 0x0020;
95 status
->state
= (ret
== 0 ) ? 0x0004 : 0x0001;
96 status
->controls_accepted
= 0x0005;
101 /*********************************************************************
102 *********************************************************************/
104 /* struct for svcctl control to manipulate rcinit service */
106 SERVICE_CONTROL_OPS rcinit_svc_ops
= {