X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/5366977b4f3c7a50d170bf7a1e29b14c74944db7..91e46e62e5f9faf6735e0c41ce21113939cacb85:/src/s_newconf.c?ds=sidebyside diff --git a/src/s_newconf.c b/src/s_newconf.c index 66adbec..c93b57e 100644 --- a/src/s_newconf.c +++ b/src/s_newconf.c @@ -29,7 +29,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $Id: s_newconf.c 3161 2007-01-25 07:23:01Z nenolod $ + * $Id: s_newconf.c 3508 2007-06-04 16:04:49Z jilles $ */ #include "stdinc.h" @@ -48,6 +48,7 @@ #include "balloc.h" #include "event.h" #include "sprintf_irc.h" +#include "irc_dictionary.h" dlink_list shared_conf_list; dlink_list cluster_conf_list; @@ -330,6 +331,7 @@ static struct oper_flags oper_flagtable[] = { OPER_GLINE, 'G', 'g' }, { OPER_KLINE, 'K', 'k' }, { OPER_XLINE, 'X', 'x' }, + { OPER_RESV, 'Q', 'q' }, { OPER_GLOBKILL, 'O', 'o' }, { OPER_LOCKILL, 'C', 'c' }, { OPER_REMOTE, 'R', 'r' }, @@ -528,6 +530,23 @@ find_xline(const char *gecos, int counter) return NULL; } +struct ConfItem * +find_xline_mask(const char *gecos) +{ + struct ConfItem *aconf; + dlink_node *ptr; + + DLINK_FOREACH(ptr, xline_conf_list.head) + { + aconf = ptr->data; + + if(!irccmp(aconf->name, gecos)) + return aconf; + } + + return NULL; +} + struct ConfItem * find_nick_resv(const char *name) { @@ -548,6 +567,23 @@ find_nick_resv(const char *name) return NULL; } +struct ConfItem * +find_nick_resv_mask(const char *name) +{ + struct ConfItem *aconf; + dlink_node *ptr; + + DLINK_FOREACH(ptr, resv_conf_list.head) + { + aconf = ptr->data; + + if(!irccmp(aconf->name, name)) + return aconf; + } + + return NULL; +} + /* clean_resv_nick() * * inputs - nick @@ -595,6 +631,7 @@ valid_wild_card_simple(const char *data) const char *p; char tmpch; int nonwild = 0; + int wild = 0; /* check the string for minimum number of nonwildcard chars */ p = data; @@ -604,9 +641,11 @@ valid_wild_card_simple(const char *data) /* found an escape, p points to the char after it, so skip * that and move on. */ - if(tmpch == '\\') + if(tmpch == '\\' && *p) { p++; + if(++nonwild >= ConfigFileEntry.min_nonwildcard_simple) + return 1; } else if(!IsMWildChar(tmpch)) { @@ -614,9 +653,12 @@ valid_wild_card_simple(const char *data) if(++nonwild >= ConfigFileEntry.min_nonwildcard_simple) return 1; } + else + wild++; } - return 0; + /* strings without wilds are also ok */ + return wild == 0; } time_t @@ -704,13 +746,12 @@ get_nd_count(void) return(dlink_list_length(&nd_list)); } - void add_nd_entry(const char *name) { struct nd_entry *nd; - if(hash_find_nd(name) != NULL) + if(irc_dictionary_find(nd_dict, name) != NULL) return; nd = BlockHeapAlloc(nd_heap); @@ -720,14 +761,16 @@ add_nd_entry(const char *name) /* this list is ordered */ dlinkAddTail(nd, &nd->lnode, &nd_list); - add_to_nd_hash(name, nd); + + irc_dictionary_add(nd_dict, nd->name, nd); } void free_nd_entry(struct nd_entry *nd) { + irc_dictionary_delete(nd_dict, nd->name); + dlinkDelete(&nd->lnode, &nd_list); - dlinkDelete(&nd->hnode, &ndTable[nd->hashv]); BlockHeapFree(nd_heap, nd); }