00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "includes.h"
00022
00023
00024
00025
00026 static WERROR rcinit_stop( const char *service, SERVICE_STATUS *status )
00027 {
00028 pstring command;
00029 int ret, fd;
00030
00031 pstr_sprintf( command, "%s/%s/%s stop", dyn_LIBDIR, SVCCTL_SCRIPT_DIR, service );
00032
00033
00034
00035 become_root();
00036 ret = smbrun( command , &fd );
00037 unbecome_root();
00038
00039 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command, ret));
00040 close(fd);
00041
00042 ZERO_STRUCTP( status );
00043 status->type = 0x0020;
00044 status->state = (ret == 0 ) ? 0x0001 : 0x0004;
00045 status->controls_accepted = 0x0005;
00046
00047 return ( ret == 0 ) ? WERR_OK : WERR_ACCESS_DENIED;
00048 }
00049
00050
00051
00052
00053 static WERROR rcinit_start( const char *service )
00054 {
00055 pstring command;
00056 int ret, fd;
00057
00058 pstr_sprintf( command, "%s/%s/%s start", dyn_LIBDIR, SVCCTL_SCRIPT_DIR, service );
00059
00060
00061
00062 become_root();
00063 ret = smbrun( command , &fd );
00064 unbecome_root();
00065
00066 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command, ret));
00067 close(fd);
00068
00069 return ( ret == 0 ) ? WERR_OK : WERR_ACCESS_DENIED;
00070 }
00071
00072
00073
00074
00075 static WERROR rcinit_status( const char *service, SERVICE_STATUS *status )
00076 {
00077 pstring command;
00078 int ret, fd;
00079
00080 pstr_sprintf( command, "%s/%s/%s status", dyn_LIBDIR, SVCCTL_SCRIPT_DIR, service );
00081
00082
00083
00084
00085
00086 become_root();
00087 ret = smbrun( command , &fd );
00088 unbecome_root();
00089
00090 DEBUGADD(5, ("rcinit_start: [%s] returned [%d]\n", command, ret));
00091 close(fd);
00092
00093 ZERO_STRUCTP( status );
00094 status->type = 0x0020;
00095 status->state = (ret == 0 ) ? 0x0004 : 0x0001;
00096 status->controls_accepted = 0x0005;
00097
00098 return WERR_OK;
00099 }
00100
00101
00102
00103
00104
00105
00106 SERVICE_CONTROL_OPS rcinit_svc_ops = {
00107 rcinit_stop,
00108 rcinit_start,
00109 rcinit_status
00110 };