s4:auth: Let dsdb gMSA time influence NTLM previous password allowed period
[Samba.git] / source3 / services / svc_rcinit.c
blob7a8ad6516c2307f9905d218374bea0e9315aec80
1 /*
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 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 "includes.h"
21 #include "services/services.h"
23 /*********************************************************************
24 *********************************************************************/
26 static WERROR rcinit_stop( const char *service, struct SERVICE_STATUS *status )
28 int ret = -1;
31 * Disabled due to security concerns and unknown use in the
32 * field -- vl@samba.org
34 #if 0
35 char *command = NULL;
36 int fd;
38 if (asprintf(&command, "%s/%s/%s stop",
39 get_dyn_MODULESDIR(), SVCCTL_SCRIPT_DIR, service) < 0) {
40 return WERR_NOT_ENOUGH_MEMORY;
43 /* we've already performed the access check when the service was opened */
45 become_root();
46 ret = smbrun(command, &fd, NULL);
47 unbecome_root();
49 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command, ret));
50 close(fd);
52 SAFE_FREE(command);
54 ZERO_STRUCTP( status );
56 status->type = SERVICE_TYPE_WIN32_SHARE_PROCESS;
57 status->state = (ret == 0 ) ? SVCCTL_STOPPED : SVCCTL_RUNNING;
58 status->controls_accepted = SVCCTL_ACCEPT_STOP |
59 SVCCTL_ACCEPT_SHUTDOWN;
60 #endif
61 return ( ret == 0 ) ? WERR_OK : WERR_ACCESS_DENIED;
64 /*********************************************************************
65 *********************************************************************/
67 static WERROR rcinit_start( const char *service )
69 int ret = -1;
71 * Disabled due to security concerns and unknown use in the
72 * field -- vl@samba.org
74 #if 0
75 char *command = NULL;
76 int fd;
78 if (asprintf(&command, "%s/%s/%s start",
79 get_dyn_MODULESDIR(), SVCCTL_SCRIPT_DIR, service) < 0) {
80 return WERR_NOT_ENOUGH_MEMORY;
83 /* we've already performed the access check when the service was opened */
85 become_root();
86 ret = smbrun(command, &fd, NULL);
87 unbecome_root();
89 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command, ret));
90 close(fd);
92 SAFE_FREE(command);
93 #endif
94 return ( ret == 0 ) ? WERR_OK : WERR_ACCESS_DENIED;
97 /*********************************************************************
98 *********************************************************************/
100 static WERROR rcinit_status( const char *service, struct SERVICE_STATUS *status )
103 * Disabled due to security concerns and unknown use in the
104 * field -- vl@samba.org
106 #if 0
107 char *command = NULL;
108 int ret, fd;
110 if (asprintf(&command, "%s/%s/%s status",
111 get_dyn_MODULESDIR(), SVCCTL_SCRIPT_DIR, service) < 0) {
112 return WERR_NOT_ENOUGH_MEMORY;
115 /* we've already performed the access check when the service was opened */
116 /* assume as return code of 0 means that the service is ok. Anything else
117 is STOPPED */
119 become_root();
120 ret = smbrun(command, &fd, NULL);
121 unbecome_root();
123 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command, ret));
124 close(fd);
126 SAFE_FREE(command);
128 ZERO_STRUCTP( status );
130 status->type = SERVICE_TYPE_WIN32_SHARE_PROCESS;
131 status->state = (ret == 0 ) ? SVCCTL_RUNNING : SVCCTL_STOPPED;
132 status->controls_accepted = SVCCTL_ACCEPT_STOP |
133 SVCCTL_ACCEPT_SHUTDOWN;
135 return WERR_OK;
136 #else
137 return WERR_ACCESS_DENIED;
138 #endif
141 /*********************************************************************
142 *********************************************************************/
144 /* struct for svcctl control to manipulate rcinit service */
146 SERVICE_CONTROL_OPS rcinit_svc_ops = {
147 rcinit_stop,
148 rcinit_start,
149 rcinit_status