Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

conf.c

Go to the documentation of this file.
00001 /* $Id: conf.c,v 1.1.1.1 2003/07/04 02:51:58 Mysid Exp $ */
00002 
00003 /*
00004  * Copyright (c) 1996-1997 Chip Norkus
00005  * Copyright (c) 1997 Max Byrd
00006  * Copyright (c) 1997 Greg Poma
00007  * Copyright (c) 2001 James Hess
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. Neither the name of the authors nor the names of its contributors
00019  *    may be used to endorse or promote products derived from this software
00020  *    without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
00023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00025  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
00026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00032  * SUCH DAMAGE.
00033  */
00034 
00042 #include "services.h"
00043 #include "hash.h"
00044 #include "nickserv.h"
00045 #include "memoserv.h"
00046 #include "infoserv.h"
00047 #include "db.h"
00048 #include "log.h"
00049 
00050 int svcOptFork = 0;
00051 
00055 extern int ipcPort;
00056 
00057 /* --------------------------------------------------------------------- */
00058 
00072 void readConf(void)
00073 {
00074     /*
00075      * read services.conf
00076      */
00077 
00078     FILE *fp;
00079     char buffer[257];
00080 
00081     fp = fopen("services.conf", "r");
00082 
00083     if (fp == 0) {
00084         perror("Unable to open services.conf");
00085         sshutdown(-1);
00086     }
00087 
00088     while (sfgets(buffer, 256, fp) != NULL) {
00089         if (buffer[0] == '#') {
00090     } else if (!strncmp(buffer, "H:", 2))
00091         strcpy(myname, &(buffer[2]));
00092       else if (!strncmp(buffer, "P:", 2))
00093         port = atoi(&(buffer[2]));
00094       else if (!strncmp(buffer, "W:", 2))
00095         strcpy(mypass, &(buffer[2]));
00096       else if (!strncmp(buffer, "C:", 2))
00097         strcpy(hostname, &(buffer[2]));
00098       else if (!strncmp(buffer, "ON:", 3))
00099         strcpy(services[0].name, &(buffer[3]));
00100       else if (!strncmp(buffer, "OU:", 3))
00101         strcpy(services[0].uname, &(buffer[3]));
00102       else if (!strncmp(buffer, "OH:", 3))
00103         strcpy(services[0].host, &(buffer[3]));
00104       else if (!strncmp(buffer, "OR:", 3))
00105         strcpy(services[0].rname, &(buffer[3]));
00106       else if (!strncmp(buffer, "OM:", 3))
00107         strcpy(services[0].mode, &(buffer[3]));
00108       else if (!strncmp(buffer, "NN:", 3))
00109         strcpy(services[1].name, &(buffer[3]));
00110       else if (!strncmp(buffer, "NU:", 3))
00111         strcpy(services[1].uname, &(buffer[3]));
00112       else if (!strncmp(buffer, "NH:", 3))
00113         strcpy(services[1].host, &(buffer[3]));
00114       else if (!strncmp(buffer, "NR:", 3))
00115         strcpy(services[1].rname, &(buffer[3]));
00116       else if (!strncmp(buffer, "NM:", 3))
00117         strcpy(services[1].mode, &(buffer[3]));
00118       else if (!strncmp(buffer, "CN:", 3))
00119         strcpy(services[2].name, &(buffer[3]));
00120       else if (!strncmp(buffer, "CU:", 3))
00121         strcpy(services[2].uname, &(buffer[3]));
00122       else if (!strncmp(buffer, "CH:", 3))
00123         strcpy(services[2].host, &(buffer[3]));
00124       else if (!strncmp(buffer, "CR:", 3))
00125         strcpy(services[2].rname, &(buffer[3]));
00126       else if (!strncmp(buffer, "CM:", 3))
00127         strcpy(services[2].mode, &(buffer[3]));
00128       else if (!strncmp(buffer, "MN:", 3))
00129         strcpy(services[3].name, &(buffer[3]));
00130       else if (!strncmp(buffer, "MU:", 3))
00131         strcpy(services[3].uname, &(buffer[3]));
00132       else if (!strncmp(buffer, "MH:", 3))
00133         strcpy(services[3].host, &(buffer[3]));
00134       else if (!strncmp(buffer, "MR:", 3))
00135         strcpy(services[3].rname, &(buffer[3]));
00136       else if (!strncmp(buffer, "MM:", 3))
00137         strcpy(services[3].mode, &(buffer[3]));
00138       else if (!strncmp(buffer, "IN:", 3))
00139         strcpy(services[4].name, &(buffer[3]));
00140       else if (!strncmp(buffer, "IU:", 3))
00141         strcpy(services[4].uname, &(buffer[3]));
00142       else if (!strncmp(buffer, "IH:", 3))
00143         strcpy(services[4].host, &(buffer[3]));
00144       else if (!strncmp(buffer, "IR:", 3))
00145         strcpy(services[4].rname, &(buffer[3]));
00146       else if (!strncmp(buffer, "IM:", 3))
00147         strcpy(services[4].mode, &(buffer[3]));
00148 
00149       else if (!strncmp(buffer, "AN:", 3))
00150         strcpy(services[6].name, &(buffer[3]));
00151       else if (!strncmp(buffer, "AU:", 3))
00152         strcpy(services[6].uname, &(buffer[3]));
00153       else if (!strncmp(buffer, "AH:", 3))
00154         strcpy(services[6].host, &(buffer[3]));
00155       else if (!strncmp(buffer, "AR:", 3))
00156         strcpy(services[6].rname, &(buffer[3]));
00157       else if (!strncmp(buffer, "AM:", 3))
00158         strcpy(services[6].mode, &(buffer[3]));
00159     else if (!strncmp(buffer, "GN:", 3))
00160         strcpy(services[5].name, &(buffer[3]));
00161     else if (!strncmp(buffer, "GU:", 3))
00162         strcpy(services[5].uname, &(buffer[3]));
00163     else if (!strncmp(buffer, "GH:", 3))
00164         strcpy(services[5].host, &(buffer[3]));
00165     else if (!strncmp(buffer, "GR:", 3))
00166         strcpy(services[5].rname, &(buffer[3]));
00167     else if (!strncmp(buffer, "GM:", 3))
00168         strcpy(services[5].mode, &(buffer[3]));
00169     else if (!strncmp(buffer, "OL:", 3))
00170         OpLimit = atoi(&(buffer[3]));
00171     else if (!strncmp(buffer, "BL:", 3))
00172         AkickLimit = atoi(&(buffer[3]));
00173     else if (!strncmp(buffer, "LL:", 3))
00174         AccessLimit = atoi(&(buffer[3]));
00175     else if (!strncmp(buffer, "CL:", 3))
00176         ChanLimit = atoi(&(buffer[3]));
00177     else if (!strncmp(buffer, "NL:", 3))
00178         NickLimit = atoi(&(buffer[3]));
00179     else if (!strncmp(buffer, "IPCPORT:", 8)) {
00180         if (ipcPort == 0)
00181             ipcPort = atoi(&(buffer[8]));
00182         }
00183     else if (!strncmp(buffer, "SRA:", 4)) {
00184         RegNickList *root;
00185 
00186         root = getRegNickData(&(buffer[4]));
00187 
00188         if (root) {
00189             root->flags |= NHOLD;
00190             root->opflags |= OROOT;
00191             delOpData(root);
00192             addOpData(root);
00193         }
00194 
00195     } else if (!strncmp(buffer, "REMSRA:", 7)) {
00196         RegNickList *root;
00197         root = getRegNickData(&(buffer[7]));
00198             if (root) {
00199                 root->opflags |= OREMROOT;
00200                 addOpData(root);
00201             }
00202         } else if (!strncmp(buffer, "-REMSRA:", 8)) {
00203             RegNickList *root;
00204 
00205             root = getRegNickData(&(buffer[8]));
00206             if (root) {
00207                 root->opflags &= ~(OREMROOT);
00208                 delOpData(root);
00209             }
00210         } else if (!strncmp(buffer, "SERVOP:", 7)) {
00211             RegNickList *servop;
00212 
00213             servop = getRegNickData(&(buffer[7]));
00214             if (servop) {
00215                 servop->opflags |= OSERVOP;
00216                 servop->opflags |=
00217                     OPFLAG_DEFAULT | ORAKILL | OAKILL | OSETFLAG |
00218                     ONBANDEL;
00219                 servop->opflags |= OCBANDEL | OIGNORE | OLIST | OCLONE;
00220                 servop->flags |= NHOLD;
00221                 addOpData(servop);
00222             }
00223         } else if (!strncmp(buffer, "AKILL:", 6)) {
00224             RegNickList *kline;
00225 
00226             kline = getRegNickData(buffer + 6);
00227 
00228             if (kline) {
00229                 kline->opflags |= OAKILL | OPFLAG_DEFAULT;
00230                 kline->flags |= NHOLD;
00231                 addOpData(kline);
00232             }
00233         }
00234     }
00235     fclose(fp);
00236 }
00237 
00238 /* --------------------------------------------------------------------- */
00239 
00240 /* $Id: conf.c,v 1.1.1.1 2003/07/04 02:51:58 Mysid Exp $ */

Generated at Sat Oct 25 20:56:07 2003 for Services using Doxygen.
Services Copyr. 1996-2001 Chip Norkus, Max Byrd, Greg Poma, Michael Graff, James Hess, Dafydd James. All rights reserved See LICENSE for licensing information.