From: Matthew Mondor Date: Thu, 13 Jan 2005 08:04:03 +0000 (+0000) Subject: Cleaned up fake-host diff, and added missing preprocessor conditionals for X-Git-Tag: rubiks-ircd-1-0-6~45 X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=cbabd1048892c2a4a4b2d3aacf6699f26b6a0988;p=rubiks-ircd.git Cleaned up fake-host diff, and added missing preprocessor conditionals for FAKEHOST --- diff --git a/src/s_conf.c b/src/s_conf.c index e47d527..16c2dee 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -18,7 +18,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: s_conf.c,v 1.2 2005/01/13 06:19:56 mmondor Exp $ */ +/* $Id: s_conf.c,v 1.3 2005/01/13 08:04:03 mmondor Exp $ */ #include "struct.h" #include "common.h" @@ -166,7 +166,9 @@ free_allow(aAllow *ptr) MyFree(ptr->ipmask); MyFree(ptr->passwd); MyFree(ptr->hostmask); - MyFree(ptr->fakehost); +#ifdef FAKEHOST + MyFree(ptr->fakehost); +#endif MyFree(ptr->class_name); MyFree(ptr); return; @@ -183,7 +185,9 @@ free_oper(aOper *ptr) } MyFree(ptr->passwd); MyFree(ptr->nick); - MyFree(ptr->fakehost); +#ifdef FAKEHOST + MyFree(ptr->fakehost); +#endif MyFree(ptr->class_name); MyFree(ptr); return; @@ -687,17 +691,19 @@ confadd_oper(cVar *vars[], int lnum) tmp->type = NULL; DupString(x->class_name, tmp->value); } - else if(tmp->type && (tmp->type->flag & SCONFF_MASK)) - { - if (x->fakehost) - { - confparse_error("Multiple mask definitions", lnum); - free_oper(x); - return -1; - } - tmp->type = NULL; - DupString(x->fakehost, tmp->value); - } +#ifdef FAKEHOST + else if(tmp->type && (tmp->type->flag & SCONFF_MASK)) + { + if (x->fakehost) + { + confparse_error("Multiple mask definitions", lnum); + free_oper(x); + return -1; + } + tmp->type = NULL; + DupString(x->fakehost, tmp->value); + } +#endif } if(!x->nick) { @@ -1157,44 +1163,46 @@ confadd_allow(cVar *vars[], int lnum) tmp->type = NULL; } - else if(tmp->type && (tmp->type->flag & SCONFF_MASK)) +#ifdef FAKEHOST + else if(tmp->type && (tmp->type->flag & SCONFF_MASK)) + { + char *p = tmp->value; + int bad_dns = 0; + int dots = 0; + + if(x->fakehost) + { + confparse_error("Multiple hostmask definitions", lnum); + free_allow(x); + return -1; + } + while (*p) + { + if (!IsAlnum(*p)) { - char *p = tmp->value; - int bad_dns = 0; - int dots = 0; - if(x->fakehost) - { - confparse_error("Multiple hostmask definitions", lnum); - free_allow(x); - return -1; - } - while (*p) - { - if (!IsAlnum(*p)) - { #ifdef RFC1035_ANAL - if ((*p != '-') && (*p != '.')) + if ((*p != '-') && (*p != '.')) #else - if ((*p != '-') && (*p != '.') && - (*p != '_') && (*p != '/')) + if ((*p != '-') && (*p != '.') && + (*p != '_') && (*p != '/')) #endif - bad_dns = YES; - } - if (*p == '.') - dots++; - p++; - } - if (bad_dns || !dots) - { - confparse_error("Invalid hostmask encountered",lnum); - free_allow(x); - return -1; - } - tmp->type = NULL; - DupString(x->fakehost, tmp->value); - x->flags |= CONF_FLAGS_I_FAKE_HOST; - + bad_dns = YES; } + if (*p == '.') + dots++; + p++; + } + if (bad_dns || !dots) + { + confparse_error("Invalid hostmask encountered",lnum); + free_allow(x); + return -1; + } + tmp->type = NULL; + DupString(x->fakehost, tmp->value); + x->flags |= CONF_FLAGS_I_FAKE_HOST; + } +#endif } if(!x->ipmask && !x->hostmask) { @@ -2004,11 +2012,13 @@ merge_opers() old_oper->hosts[i] = aoper->hosts[i]; old_oper->hosts[i] = NULL; old_oper->passwd = aoper->passwd; - MyFree(old_oper->fakehost); - if (aoper->fakehost) - DupString(old_oper->fakehost, aoper->fakehost); - else - old_oper->fakehost = NULL; +#ifdef FAKEHOST + MyFree(old_oper->fakehost); + if (aoper->fakehost) + DupString(old_oper->fakehost, aoper->fakehost); + else + old_oper->fakehost = NULL; +#endif old_oper->class_name = aoper->class_name; old_oper->class = find_class(aoper->class_name); old_oper->class->refs++;