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 spoolss service */ 00024 00025 /********************************************************************* 00026 *********************************************************************/ 00027 00028 static WERROR spoolss_stop( const char *service, SERVICE_STATUS *service_status ) 00029 { 00030 ZERO_STRUCTP( service_status ); 00031 00032 lp_set_spoolss_state( SVCCTL_STOPPED ); 00033 00034 service_status->type = 0x110; 00035 service_status->state = SVCCTL_STOPPED; 00036 service_status->controls_accepted = SVCCTL_ACCEPT_STOP; 00037 00038 DEBUG(6,("spoolss_stop: spooler stopped (not really)\n")); 00039 00040 return WERR_OK; 00041 } 00042 00043 /********************************************************************* 00044 *********************************************************************/ 00045 00046 static WERROR spoolss_start( const char *service ) 00047 { 00048 /* see if the smb.conf will support this anyways */ 00049 00050 if ( _lp_disable_spoolss() ) 00051 return WERR_ACCESS_DENIED; 00052 00053 lp_set_spoolss_state( SVCCTL_RUNNING ); 00054 00055 return WERR_OK; 00056 } 00057 00058 /********************************************************************* 00059 *********************************************************************/ 00060 00061 static WERROR spoolss_status( const char *service, SERVICE_STATUS *service_status ) 00062 { 00063 ZERO_STRUCTP( service_status ); 00064 00065 service_status->type = 0x110; 00066 service_status->state = lp_get_spoolss_state(); 00067 service_status->controls_accepted = SVCCTL_ACCEPT_STOP; 00068 00069 return WERR_OK; 00070 } 00071 00072 /********************************************************************* 00073 *********************************************************************/ 00074 00075 /* struct for svcctl control to manipulate spoolss service */ 00076 00077 SERVICE_CONTROL_OPS spoolss_svc_ops = { 00078 spoolss_stop, 00079 spoolss_start, 00080 spoolss_status 00081 };