00001 /* 00002 * Unix SMB/CIFS implementation. 00003 * Service Control API Implementation 00004 * Copyright (C) Gerald Carter 2005. 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #include "includes.h" 00022 00023 /* Implementation for internal netlogon service */ 00024 00025 /********************************************************************* 00026 *********************************************************************/ 00027 00028 static WERROR netlogon_status( const char *service, SERVICE_STATUS *service_status ) 00029 { 00030 ZERO_STRUCTP( service_status ); 00031 00032 service_status->type = 0x20; 00033 service_status->controls_accepted = SVCCTL_ACCEPT_NONE; 00034 00035 if ( lp_servicenumber("NETLOGON") != -1 ) { 00036 service_status->state = SVCCTL_RUNNING; 00037 service_status->win32_exit_code = WERR_SERVICE_NEVER_STARTED; 00038 } 00039 else 00040 service_status->state = SVCCTL_STOPPED; 00041 00042 return WERR_OK; 00043 } 00044 00045 /********************************************************************* 00046 *********************************************************************/ 00047 00048 static WERROR netlogon_stop( const char *service, SERVICE_STATUS *service_status ) 00049 { 00050 netlogon_status( service, service_status ); 00051 00052 return WERR_ACCESS_DENIED; 00053 } 00054 00055 /********************************************************************* 00056 *********************************************************************/ 00057 00058 static WERROR netlogon_start( const char *service ) 00059 { 00060 if ( lp_servicenumber("NETLOGON") == -1 ) 00061 return WERR_SERVICE_DISABLED; 00062 00063 return WERR_ACCESS_DENIED; 00064 } 00065 00066 /********************************************************************* 00067 *********************************************************************/ 00068 00069 /* struct for svcctl control to manipulate netlogon service */ 00070 00071 SERVICE_CONTROL_OPS netlogon_svc_ops = { 00072 netlogon_stop, 00073 netlogon_start, 00074 netlogon_status 00075 };