diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2012-11-04 15:37:10 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2012-11-04 15:37:10 +0000 |
commit | 90aeacbf12d63dcd628caed461bd744639603d76 (patch) | |
tree | 5eb5c2aa3fd576ac33d84d2911482a3f200c1bea /src | |
parent | 8daa0e2a6fe61e95dc2dd145ebbdb2b05c097196 (diff) |
- Initial rewrite of the configuration subsystem
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1632 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/Makefile.in | 35 | ||||
-rw-r--r-- | src/channel.c | 2 | ||||
-rw-r--r-- | src/channel_mode.c | 2 | ||||
-rw-r--r-- | src/client.c | 61 | ||||
-rw-r--r-- | src/conf.c | 1207 | ||||
-rw-r--r-- | src/conf_db.c | 171 | ||||
-rw-r--r-- | src/conf_parser.c | 1226 | ||||
-rw-r--r-- | src/conf_parser.h | 2 | ||||
-rw-r--r-- | src/conf_parser.y | 442 | ||||
-rw-r--r-- | src/hash.c | 22 | ||||
-rw-r--r-- | src/hostmask.c | 120 | ||||
-rw-r--r-- | src/ircd.c | 5 | ||||
-rw-r--r-- | src/packet.c | 2 | ||||
-rw-r--r-- | src/resv.c | 74 | ||||
-rw-r--r-- | src/s_bsd.c | 10 | ||||
-rw-r--r-- | src/s_gline.c | 10 | ||||
-rw-r--r-- | src/s_serv.c | 180 | ||||
-rw-r--r-- | src/s_user.c | 66 | ||||
-rw-r--r-- | src/send.c | 4 |
20 files changed, 1475 insertions, 2167 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index b1418b1..f79e405 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,6 +14,7 @@ ircd_SOURCES = balloc.c \ channel_mode.c \ client.c \ conf.c \ + conf_class.c \ conf_db.c \ conf_parser.y \ conf_lexer.l \ diff --git a/src/Makefile.in b/src/Makefile.in index 063d156..cabccfc 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -68,22 +68,23 @@ am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am_ircd_OBJECTS = balloc.$(OBJEXT) channel.$(OBJEXT) \ channel_mode.$(OBJEXT) client.$(OBJEXT) conf.$(OBJEXT) \ - conf_db.$(OBJEXT) conf_parser.$(OBJEXT) conf_lexer.$(OBJEXT) \ - dbuf.$(OBJEXT) event.$(OBJEXT) fdlist.$(OBJEXT) \ - getopt.$(OBJEXT) hash.$(OBJEXT) hook.$(OBJEXT) \ - hostmask.$(OBJEXT) irc_res.$(OBJEXT) irc_reslib.$(OBJEXT) \ - irc_string.$(OBJEXT) ircd.$(OBJEXT) ircd_signal.$(OBJEXT) \ - list.$(OBJEXT) listener.$(OBJEXT) log.$(OBJEXT) \ - match.$(OBJEXT) memory.$(OBJEXT) modules.$(OBJEXT) \ - motd.$(OBJEXT) rng_mt.$(OBJEXT) numeric.$(OBJEXT) \ - packet.$(OBJEXT) parse.$(OBJEXT) s_bsd_epoll.$(OBJEXT) \ - s_bsd_poll.$(OBJEXT) s_bsd_sigio.$(OBJEXT) \ - s_bsd_devpoll.$(OBJEXT) s_bsd_kqueue.$(OBJEXT) \ - s_bsd_select.$(OBJEXT) restart.$(OBJEXT) resv.$(OBJEXT) \ - rsa.$(OBJEXT) s_auth.$(OBJEXT) s_bsd.$(OBJEXT) \ - s_gline.$(OBJEXT) s_misc.$(OBJEXT) s_serv.$(OBJEXT) \ - s_user.$(OBJEXT) send.$(OBJEXT) sprintf_irc.$(OBJEXT) \ - version.$(OBJEXT) watch.$(OBJEXT) whowas.$(OBJEXT) + conf_class.$(OBJEXT) conf_db.$(OBJEXT) conf_parser.$(OBJEXT) \ + conf_lexer.$(OBJEXT) dbuf.$(OBJEXT) event.$(OBJEXT) \ + fdlist.$(OBJEXT) getopt.$(OBJEXT) hash.$(OBJEXT) \ + hook.$(OBJEXT) hostmask.$(OBJEXT) irc_res.$(OBJEXT) \ + irc_reslib.$(OBJEXT) irc_string.$(OBJEXT) ircd.$(OBJEXT) \ + ircd_signal.$(OBJEXT) list.$(OBJEXT) listener.$(OBJEXT) \ + log.$(OBJEXT) match.$(OBJEXT) memory.$(OBJEXT) \ + modules.$(OBJEXT) motd.$(OBJEXT) rng_mt.$(OBJEXT) \ + numeric.$(OBJEXT) packet.$(OBJEXT) parse.$(OBJEXT) \ + s_bsd_epoll.$(OBJEXT) s_bsd_poll.$(OBJEXT) \ + s_bsd_sigio.$(OBJEXT) s_bsd_devpoll.$(OBJEXT) \ + s_bsd_kqueue.$(OBJEXT) s_bsd_select.$(OBJEXT) \ + restart.$(OBJEXT) resv.$(OBJEXT) rsa.$(OBJEXT) \ + s_auth.$(OBJEXT) s_bsd.$(OBJEXT) s_gline.$(OBJEXT) \ + s_misc.$(OBJEXT) s_serv.$(OBJEXT) s_user.$(OBJEXT) \ + send.$(OBJEXT) sprintf_irc.$(OBJEXT) version.$(OBJEXT) \ + watch.$(OBJEXT) whowas.$(OBJEXT) ircd_OBJECTS = $(am_ircd_OBJECTS) am__DEPENDENCIES_1 = ircd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ @@ -274,6 +275,7 @@ ircd_SOURCES = balloc.c \ channel_mode.c \ client.c \ conf.c \ + conf_class.c \ conf_db.c \ conf_parser.y \ conf_lexer.l \ @@ -419,6 +421,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel_mode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_class.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_db.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_lexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_parser.Po@am__quote@ diff --git a/src/channel.c b/src/channel.c index 90d1548..28eade6 100644 --- a/src/channel.c +++ b/src/channel.c @@ -30,6 +30,7 @@ #include "channel_mode.h" #include "client.h" #include "hash.h" +#include "conf.h" #include "hostmask.h" #include "irc_string.h" #include "sprintf_irc.h" @@ -38,7 +39,6 @@ #include "s_serv.h" /* captab */ #include "s_user.h" #include "send.h" -#include "conf.h" /* ConfigFileEntry, ConfigChannel */ #include "event.h" #include "memory.h" #include "balloc.h" diff --git a/src/channel_mode.c b/src/channel_mode.c index 5607df2..b6810f3 100644 --- a/src/channel_mode.c +++ b/src/channel_mode.c @@ -28,6 +28,7 @@ #include "channel_mode.h" #include "client.h" #include "hash.h" +#include "conf.h" #include "hostmask.h" #include "irc_string.h" #include "sprintf_irc.h" @@ -37,7 +38,6 @@ #include "s_user.h" #include "send.h" #include "whowas.h" -#include "conf.h" /* ConfigFileEntry, ConfigChannel */ #include "event.h" #include "memory.h" #include "balloc.h" diff --git a/src/client.c b/src/client.c index 2d245ec..33f8dc6 100644 --- a/src/client.c +++ b/src/client.c @@ -74,7 +74,7 @@ static dlink_node *eac_next; /* next aborted client to exit */ static void check_pings_list(dlink_list *); static void check_unknowns_list(void); -static void ban_them(struct Client *, struct ConfItem *); +static void ban_them(struct Client *, struct MaskItem *); /* init_client() @@ -254,7 +254,7 @@ check_pings_list(dlink_list *list) if (!IsRegistered(client_p)) ping = CONNECTTIMEOUT, pingwarn = 0; else - ping = get_client_ping(client_p, &pingwarn); + ping = get_client_ping(&client_p->localClient->confs, &pingwarn); if (ping < CurrentTime - client_p->localClient->lasttime) { @@ -352,8 +352,7 @@ void check_conf_klines(void) { struct Client *client_p = NULL; /* current local client_p being examined */ - struct AccessItem *aconf = NULL; - struct ConfItem *conf = NULL; + struct MaskItem *conf = NULL; dlink_node *ptr, *next_ptr; DLINK_FOREACH_SAFE(ptr, next_ptr, local_client_list.head) @@ -365,19 +364,17 @@ check_conf_klines(void) if (IsDead(client_p) || !IsClient(client_p)) continue; - /* if there is a returned struct ConfItem then kill it */ - if ((aconf = find_dline_conf(&client_p->localClient->ip, + if ((conf = find_dline_conf(&client_p->localClient->ip, client_p->localClient->aftype)) != NULL) { - if (aconf->status & CONF_EXEMPTDLINE) + if (conf->status & CONF_EXEMPT) continue; - conf = unmap_conf_item(aconf); ban_them(client_p, conf); continue; /* and go examine next fd/client_p */ } - if (ConfigFileEntry.glines && (aconf = find_gline(client_p))) + if (ConfigFileEntry.glines && (conf = find_gline(client_p))) { if (IsExemptKline(client_p) || IsExemptGline(client_p)) @@ -388,16 +385,13 @@ check_conf_klines(void) continue; } - conf = unmap_conf_item(aconf); ban_them(client_p, conf); /* and go examine next fd/client_p */ continue; } - if ((aconf = find_kill(client_p)) != NULL) + if ((conf = find_kill(client_p)) != NULL) { - - /* if there is a returned struct AccessItem.. then kill it */ if (IsExemptKline(client_p)) { sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, @@ -406,15 +400,13 @@ check_conf_klines(void) continue; } - conf = unmap_conf_item(aconf); ban_them(client_p, conf); continue; } - /* if there is a returned struct MatchItem then kill it */ - if ((conf = find_matching_name_conf(XLINE_TYPE, client_p->info, + if ((conf = find_matching_name_conf(CONF_XLINE, client_p->info, NULL, NULL, 0)) != NULL || - (conf = find_matching_name_conf(RXLINE_TYPE, client_p->info, + (conf = find_matching_name_conf(CONF_RXLINE, client_p->info, NULL, NULL, 0)) != NULL) { ban_them(client_p, conf); @@ -427,10 +419,10 @@ check_conf_klines(void) { client_p = ptr->data; - if ((aconf = find_dline_conf(&client_p->localClient->ip, - client_p->localClient->aftype))) + if ((conf = find_dline_conf(&client_p->localClient->ip, + client_p->localClient->aftype))) { - if (aconf->status & CONF_EXEMPTDLINE) + if (conf->status & CONF_EXEMPT) continue; exit_client(client_p, &me, "D-lined"); @@ -442,16 +434,14 @@ check_conf_klines(void) * ban_them * * inputs - pointer to client to ban - * - pointer to ConfItem + * - pointer to MaskItem * output - NONE * side effects - given client_p is banned */ static void -ban_them(struct Client *client_p, struct ConfItem *conf) +ban_them(struct Client *client_p, struct MaskItem *conf) { const char *user_reason = NULL; /* What is sent to user */ - struct AccessItem *aconf = NULL; - struct MatchItem *xconf = NULL; const char *type_string = NULL; const char dline_string[] = "D-line"; const char kline_string[] = "K-line"; @@ -460,34 +450,27 @@ ban_them(struct Client *client_p, struct ConfItem *conf) switch (conf->type) { - case RKLINE_TYPE: - case KLINE_TYPE: + case CONF_RKLINE: + case CONF_KLINE: type_string = kline_string; - aconf = map_to_conf(conf); break; - case DLINE_TYPE: + case CONF_DLINE: type_string = dline_string; - aconf = map_to_conf(conf); break; - case GLINE_TYPE: + case CONF_GLINE: type_string = gline_string; - aconf = map_to_conf(conf); break; - case RXLINE_TYPE: - case XLINE_TYPE: + case CONF_RXLINE: + case CONF_XLINE: type_string = xline_string; - xconf = map_to_conf(conf); - ++xconf->count; + ++conf->count; break; default: assert(0); break; } - if (aconf != NULL) - user_reason = aconf->reason ? aconf->reason : type_string; - if (xconf != NULL) - user_reason = xconf->reason ? xconf->reason : type_string; + user_reason = conf->reason ? conf->reason : type_string; sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s active for %s", type_string, get_client_name(client_p, HIDE_IP)); @@ -52,6 +52,7 @@ #include "parse.h" #include "s_misc.h" #include "conf_db.h" +#include "conf_class.h" struct Callback *client_check_cb = NULL; struct config_server_hide ConfigServerHide; @@ -66,8 +67,6 @@ dlink_list xconf_items = { NULL, NULL, 0 }; dlink_list rxconf_items = { NULL, NULL, 0 }; dlink_list rkconf_items = { NULL, NULL, 0 }; dlink_list nresv_items = { NULL, NULL, 0 }; -dlink_list class_items = { NULL, NULL, 0 }; - dlink_list temporary_resv = { NULL, NULL, 0 }; extern unsigned int lineno; @@ -80,29 +79,21 @@ struct conf_parser_context conf_parser_ctx = { 0, 0, NULL }; /* internally defined functions */ static void read_conf(FILE *); static void clear_out_old_conf(void); -static void flush_deleted_I_P(void); static void expire_tklines(dlink_list *); static void garbage_collect_ip_entries(void); static int hash_ip(struct irc_ssaddr *); static int verify_access(struct Client *, const char *); -static int attach_iline(struct Client *, struct ConfItem *); +static int attach_iline(struct Client *, struct MaskItem *); static struct ip_entry *find_or_add_ip(struct irc_ssaddr *); -static dlink_list *map_to_list(ConfType); -static struct AccessItem *find_regexp_kline(const char *[]); +static dlink_list *map_to_list(enum maskitem_type); +static struct MaskItem *find_regexp_kline(const char *[]); static int find_user_host(struct Client *, char *, char *, char *, unsigned int); /* * bit_len */ -static int cidr_limit_reached(int, struct irc_ssaddr *, struct ClassItem *); -static void remove_from_cidr_check(struct irc_ssaddr *, struct ClassItem *); -static void destroy_cidr_class(struct ClassItem *); - static void flags_to_ascii(unsigned int, const unsigned int[], char *, int); -/* address of default class conf */ -static struct ConfItem *class_default; - /* usually, with hash tables, you use a prime number... * but in this case I am dealing with ip addresses, * not ascii strings. @@ -122,28 +113,9 @@ static BlockHeap *ip_entry_heap = NULL; static int ip_entries_count = 0; -void * -map_to_conf(struct ConfItem *aconf) -{ - void *conf; - conf = (void *)((uintptr_t)aconf + - (uintptr_t)sizeof(struct ConfItem)); - return(conf); -} - -struct ConfItem * -unmap_conf_item(void *aconf) -{ - struct ConfItem *conf; - - conf = (struct ConfItem *)((uintptr_t)aconf - - (uintptr_t)sizeof(struct ConfItem)); - return(conf); -} - /* conf_dns_callback() * - * inputs - pointer to struct AccessItem + * inputs - pointer to struct MaskItem * - pointer to DNSReply reply * output - none * side effects - called when resolver query finishes @@ -154,14 +126,14 @@ unmap_conf_item(void *aconf) static void conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name) { - struct AccessItem *aconf = vptr; + struct MaskItem *conf = vptr; - aconf->dns_pending = 0; + conf->dns_pending = 0; if (addr != NULL) - memcpy(&aconf->addr, addr, sizeof(aconf->addr)); + memcpy(&conf->addr, addr, sizeof(conf->addr)); else - aconf->dns_failed = 1; + conf->dns_failed = 1; } /* conf_dns_lookup() @@ -171,15 +143,72 @@ conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name) * allocate a dns_query and start ns lookup. */ static void -conf_dns_lookup(struct AccessItem *aconf) +conf_dns_lookup(struct MaskItem *conf) { - if (!aconf->dns_pending) + if (!conf->dns_pending) { - aconf->dns_pending = 1; - gethost_byname(conf_dns_callback, aconf, aconf->host); + conf->dns_pending = 1; + gethost_byname(conf_dns_callback, conf, conf->host); } } +struct MaskItem * +conf_make(enum maskitem_type type) +{ + struct MaskItem *conf = MyMalloc(sizeof(*conf)); + dlink_list *list = NULL; + + conf->type = type; + conf->active = 1; + conf->aftype = AF_INET; + + if ((list = map_to_list(type))) + dlinkAdd(conf, &conf->node, list); + return conf; +} + +void +conf_free(struct MaskItem *conf) +{ + dlink_node *ptr = NULL, *ptr_next = NULL; + + MyFree(conf->name); + + if (conf->dns_pending) + delete_resolver_queries(conf); + if (conf->passwd != NULL) + memset(conf->passwd, 0, strlen(conf->passwd)); + if (conf->spasswd != NULL) + memset(conf->spasswd, 0, strlen(conf->spasswd)); + + conf->class = NULL; + + MyFree(conf->passwd); + MyFree(conf->spasswd); + MyFree(conf->reason); + MyFree(conf->user); + MyFree(conf->host); +#ifdef HAVE_LIBCRYPTO + MyFree(conf->cipher_list); + + if (conf->rsa_public_key) + RSA_free(conf->rsa_public_key); + + MyFree(conf->rsa_public_key_file); +#endif + DLINK_FOREACH_SAFE(ptr, ptr_next, conf->hub_list.head) + { + MyFree(ptr->data); + free_dlink_node(ptr); + } + + DLINK_FOREACH_SAFE(ptr, ptr_next, conf->leaf_list.head) + { + MyFree(ptr->data); + free_dlink_node(ptr); + } +} +#if 0 /* make_conf_item() * * inputs - type of item @@ -295,7 +324,7 @@ make_conf_item(ConfType type) dlinkAdd(conf, &conf->node, &service_items); break; - case CLASS_TYPE: + case CONF_CLASS: conf = MyMalloc(sizeof(struct ConfItem) + sizeof(struct ClassItem)); dlinkAdd(conf, &conf->node, &class_items); @@ -495,6 +524,7 @@ free_access_item(struct AccessItem *aconf) conf = unmap_conf_item(aconf); delete_conf_item(conf); } +#endif static const unsigned int shared_bit_table[] = { 'K', 'k', 'U', 'X', 'x', 'Y', 'Q', 'q', 'R', 'L', 0}; @@ -507,62 +537,57 @@ static const unsigned int shared_bit_table[] = * side effects - */ void -report_confitem_types(struct Client *source_p, ConfType type) +report_confitem_types(struct Client *source_p, enum maskitem_type type) { dlink_node *ptr = NULL, *dptr = NULL; - struct ConfItem *conf = NULL; - struct AccessItem *aconf = NULL; - struct MatchItem *matchitem = NULL; - struct ClassItem *classitem = NULL; + struct MaskItem *conf = NULL; + const struct ClassItem *class = NULL; char buf[12]; char *p = NULL; switch (type) { - case XLINE_TYPE: + case CONF_XLINE: DLINK_FOREACH(ptr, xconf_items.head) { conf = ptr->data; - matchitem = map_to_conf(conf); sendto_one(source_p, form_str(RPL_STATSXLINE), me.name, source_p->name, - matchitem->hold ? "x": "X", matchitem->count, - conf->name, matchitem->reason); + conf->hold ? "x": "X", conf->count, + conf->name, conf->reason); } break; #ifdef HAVE_LIBPCRE - case RXLINE_TYPE: + case CONF_RXLINE: DLINK_FOREACH(ptr, rxconf_items.head) { conf = ptr->data; - matchitem = map_to_conf(conf); sendto_one(source_p, form_str(RPL_STATSXLINE), me.name, source_p->name, - "XR", matchitem->count, - conf->name, matchitem->reason); + "XR", conf->count, + conf->name, conf->reason); } break; - case RKLINE_TYPE: + case CONF_RKLINE: DLINK_FOREACH(ptr, rkconf_items.head) { - aconf = map_to_conf((conf = ptr->data)); + conf = ptr->data; sendto_one(source_p, form_str(RPL_STATSKLINE), me.name, - source_p->name, "KR", aconf->host, aconf->user, - aconf->reason); + source_p->name, "KR", conf->host, conf->user, + conf->reason); } break; #endif - case ULINE_TYPE: + case CONF_ULINE: DLINK_FOREACH(ptr, uconf_items.head) { conf = ptr->data; - matchitem = map_to_conf(conf); p = buf; @@ -570,12 +595,12 @@ report_confitem_types(struct Client *source_p, ConfType type) * consistency with cluster{} flags */ *p++ = 'c'; - flags_to_ascii(matchitem->action, shared_bit_table, p, 0); + flags_to_ascii(conf->action /* XXX XXX */, shared_bit_table, p, 0); sendto_one(source_p, form_str(RPL_STATSULINE), me.name, source_p->name, conf->name, - matchitem->user?matchitem->user: "*", - matchitem->host?matchitem->host: "*", buf); + conf->user?conf->user: "*", + conf->host?conf->host: "*", buf); } DLINK_FOREACH(ptr, cluster_items.head) @@ -585,7 +610,7 @@ report_confitem_types(struct Client *source_p, ConfType type) p = buf; *p++ = 'C'; - flags_to_ascii(conf->flags, shared_bit_table, p, 0); + flags_to_ascii(conf->flags /* XXX XXX */, shared_bit_table, p, 0); sendto_one(source_p, form_str(RPL_STATSULINE), me.name, source_p->name, conf->name, @@ -594,49 +619,43 @@ report_confitem_types(struct Client *source_p, ConfType type) break; - case OPER_TYPE: + case CONF_OPER: DLINK_FOREACH(ptr, oconf_items.head) { conf = ptr->data; - aconf = map_to_conf(conf); /* Don't allow non opers to see oper privs */ if (HasUMode(source_p, UMODE_OPER)) sendto_one(source_p, form_str(RPL_STATSOLINE), - me.name, source_p->name, 'O', aconf->user, aconf->host, - conf->name, oper_privs_as_string(aconf->port), - aconf->class_ptr ? aconf->class_ptr->name : "<default>"); + me.name, source_p->name, 'O', conf->user, conf->host, + conf->name, oper_privs_as_string(conf->port), + conf->class ? conf->class->name : "<default>"); else sendto_one(source_p, form_str(RPL_STATSOLINE), - me.name, source_p->name, 'O', aconf->user, aconf->host, + me.name, source_p->name, 'O', conf->user, conf->host, conf->name, "0", - aconf->class_ptr ? aconf->class_ptr->name : "<default>"); + conf->class ? conf->class->name : "<default>"); } break; - case CLASS_TYPE: - DLINK_FOREACH(ptr, class_items.head) + case CONF_CLASS: + DLINK_FOREACH(ptr, class_get_list()->head) { - conf = ptr->data; - classitem = map_to_conf(conf); + class = ptr->data; sendto_one(source_p, form_str(RPL_STATSYLINE), me.name, source_p->name, 'Y', - conf->name, classitem->ping_freq, - classitem->con_freq, - classitem->max_total, classitem->max_sendq, - classitem->max_recvq, - classitem->curr_user_count, - classitem->number_per_cidr, classitem->cidr_bitlen_ipv4, - classitem->number_per_cidr, classitem->cidr_bitlen_ipv6, - classitem->active ? "active" : "disabled"); + class->name, class->ping_freq, + class->con_freq, + class->max_total, class->max_sendq, + class->max_recvq, + class->ref_count, + class->number_per_cidr, class->cidr_bitlen_ipv4, + class->number_per_cidr, class->cidr_bitlen_ipv6, + class->active ? "active" : "disabled"); } break; - case CONF_TYPE: - case CLIENT_TYPE: - break; - - case SERVICE_TYPE: + case CONF_SERVICE: DLINK_FOREACH(ptr, service_items.head) { conf = ptr->data; @@ -645,19 +664,18 @@ report_confitem_types(struct Client *source_p, ConfType type) } break; - case SERVER_TYPE: + case CONF_SERVER: DLINK_FOREACH(ptr, server_items.head) { p = buf; conf = ptr->data; - aconf = map_to_conf(conf); buf[0] = '\0'; - if (IsConfAllowAutoConn(aconf)) + if (IsConfAllowAutoConn(conf)) *p++ = 'A'; - if (IsConfSSL(aconf)) + if (IsConfSSL(conf)) *p++ = 'S'; if (buf[0] == '\0') *p++ = '*'; @@ -669,48 +687,38 @@ report_confitem_types(struct Client *source_p, ConfType type) */ if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN)) sendto_one(source_p, form_str(RPL_STATSCLINE), - me.name, source_p->name, 'C', aconf->host, - buf, conf->name, aconf->port, - aconf->class_ptr ? aconf->class_ptr->name : "<default>"); + me.name, source_p->name, 'C', conf->host, + buf, conf->name, conf->port, + conf->class ? conf->class->name : "<default>"); else sendto_one(source_p, form_str(RPL_STATSCLINE), me.name, source_p->name, 'C', - "*@127.0.0.1", buf, conf->name, aconf->port, - aconf->class_ptr ? aconf->class_ptr->name : "<default>"); + "*@127.0.0.1", buf, conf->name, conf->port, + conf->class ? conf->class->name : "<default>"); } break; - case HUB_TYPE: + case CONF_HUB: DLINK_FOREACH(ptr, server_items.head) { conf = ptr->data; - aconf = map_to_conf(conf); - DLINK_FOREACH(dptr, aconf->hub_list.head) + DLINK_FOREACH(dptr, conf->hub_list.head) sendto_one(source_p, form_str(RPL_STATSHLINE), me.name, source_p->name, 'H', dptr->data, conf->name, 0, "*"); } - break; - case LEAF_TYPE: DLINK_FOREACH(ptr, server_items.head) { conf = ptr->data; - aconf = map_to_conf(conf); - DLINK_FOREACH(dptr, aconf->leaf_list.head) + DLINK_FOREACH(dptr, conf->leaf_list.head) sendto_one(source_p, form_str(RPL_STATSLLINE), me.name, source_p->name, 'L', dptr->data, conf->name, 0, "*"); } + break; - case GLINE_TYPE: - case KLINE_TYPE: - case DLINE_TYPE: - case EXEMPTDLINE_TYPE: - case CRESV_TYPE: - case NRESV_TYPE: - case CLUSTER_TYPE: default: break; } @@ -729,7 +737,7 @@ report_confitem_types(struct Client *source_p, ConfType type) * Look for conf lines which have the same * status as the flags passed. */ -static void * +void * check_client(va_list args) { struct Client *source_p = va_arg(args, struct Client *); @@ -808,14 +816,13 @@ check_client(va_list args) static int verify_access(struct Client *client_p, const char *username) { - struct AccessItem *aconf = NULL, *rkconf = NULL; - struct ConfItem *conf = NULL; + struct MaskItem *conf = NULL, *rkconf = NULL; char non_ident[USERLEN + 1] = { '~', '\0' }; const char *uhi[3]; if (IsGotId(client_p)) { - aconf = find_address_conf(client_p->host, client_p->username, + conf = find_address_conf(client_p->host, client_p->username, &client_p->localClient->ip, client_p->localClient->aftype, client_p->localClient->passwd); @@ -823,7 +830,7 @@ verify_access(struct Client *client_p, const char *username) else { strlcpy(non_ident+1, username, sizeof(non_ident)-1); - aconf = find_address_conf(client_p->host,non_ident, + conf = find_address_conf(client_p->host,non_ident, &client_p->localClient->ip, client_p->localClient->aftype, client_p->localClient->passwd); @@ -835,30 +842,26 @@ verify_access(struct Client *client_p, const char *username) rkconf = find_regexp_kline(uhi); - if (aconf != NULL) + if (conf != NULL) { - if (IsConfClient(aconf) && !rkconf) + if (IsConfClient(conf) && !rkconf) { - conf = unmap_conf_item(aconf); - - if (IsConfRedir(aconf)) + if (IsConfRedir(conf)) { sendto_one(client_p, form_str(RPL_REDIR), me.name, client_p->name, conf->name ? conf->name : "", - aconf->port); + conf->port); return(NOT_AUTHORIZED); } - if (IsConfDoIdentd(aconf)) + if (IsConfDoIdentd(conf)) SetNeedId(client_p); /* Thanks for spoof idea amm */ - if (IsConfDoSpoofIp(aconf)) + if (IsConfDoSpoofIp(conf)) { - conf = unmap_conf_item(aconf); - - if (!ConfigFileEntry.hide_spoof_ips && IsConfSpoofNotice(aconf)) + if (!ConfigFileEntry.hide_spoof_ips && IsConfSpoofNotice(conf)) sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, "%s spoofing: %s as %s", client_p->name, client_p->host, conf->name); @@ -868,15 +871,15 @@ verify_access(struct Client *client_p, const char *username) return(attach_iline(client_p, conf)); } - else if (rkconf || IsConfKill(aconf) || (ConfigFileEntry.glines && IsConfGline(aconf))) + else if (rkconf || IsConfKill(conf) || (ConfigFileEntry.glines && IsConfGline(conf))) { /* XXX */ - aconf = rkconf ? rkconf : aconf; - if (IsConfGline(aconf)) + conf = rkconf ? rkconf : conf; + if (IsConfGline(conf)) sendto_one(client_p, ":%s NOTICE %s :*** G-lined", me.name, client_p->name); sendto_one(client_p, ":%s NOTICE %s :*** Banned: %s", - me.name, client_p->name, aconf->reason); + me.name, client_p->name, conf->reason); return(BANNED_CLIENT); } } @@ -892,10 +895,10 @@ verify_access(struct Client *client_p, const char *username) * side effects - do actual attach */ static int -attach_iline(struct Client *client_p, struct ConfItem *conf) +attach_iline(struct Client *client_p, struct MaskItem *conf) { - struct AccessItem *aconf; - struct ClassItem *aclass; +// struct MaskItem *conf = NULL; + struct ClassItem *class = NULL; struct ip_entry *ip_found; int a_limit_reached = 0; int local = 0, global = 0, ident = 0; @@ -904,11 +907,10 @@ attach_iline(struct Client *client_p, struct ConfItem *conf) ip_found->count++; SetIpHash(client_p); - aconf = map_to_conf(conf); - if (aconf->class_ptr == NULL) + if (conf->class == NULL) return NOT_AUTHORIZED; /* If class is missing, this is best */ - aclass = map_to_conf(aconf->class_ptr); + class = conf->class; count_user_host(client_p->username, client_p->host, &global, &local, &ident); @@ -917,21 +919,21 @@ attach_iline(struct Client *client_p, struct ConfItem *conf) * setting a_limit_reached if any limit is reached. * - Dianora */ - if (aclass->max_total != 0 && aclass->curr_user_count >= aclass->max_total) + if (class->max_total != 0 && class->ref_count >= class->max_total) a_limit_reached = 1; - else if (aclass->max_perip != 0 && ip_found->count > aclass->max_perip) + else if (class->max_perip != 0 && ip_found->count > class->max_perip) a_limit_reached = 1; - else if (aclass->max_local != 0 && local >= aclass->max_local) + else if (class->max_local != 0 && local >= class->max_local) a_limit_reached = 1; - else if (aclass->max_global != 0 && global >= aclass->max_global) + else if (class->max_global != 0 && global >= class->max_global) a_limit_reached = 1; - else if (aclass->max_ident != 0 && ident >= aclass->max_ident && + else if (class->max_ident != 0 && ident >= class->max_ident && client_p->username[0] != '~') a_limit_reached = 1; if (a_limit_reached) { - if (!IsConfExemptLimits(aconf)) + if (!IsConfExemptLimits(conf)) return TOO_MANY; /* Already at maximum allowed */ sendto_one(client_p, @@ -1180,59 +1182,43 @@ garbage_collect_ip_entries(void) * side effects - Disassociate configuration from the client. * Also removes a class from the list if marked for deleting. */ -int -detach_conf(struct Client *client_p, ConfType type) +void +detach_conf(struct Client *client_p, enum maskitem_type type) { - dlink_node *ptr, *next_ptr; - struct ConfItem *conf; - struct ClassItem *aclass; - struct AccessItem *aconf; - struct ConfItem *aclass_conf; + dlink_node *ptr = NULL, *next_ptr = NULL; + struct MaskItem *conf = NULL; DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->confs.head) { conf = ptr->data; - if (type == CONF_TYPE || conf->type == type) + if (conf->type & type) { dlinkDelete(ptr, &client_p->localClient->confs); free_dlink_node(ptr); switch (conf->type) { - case CLIENT_TYPE: - case OPER_TYPE: - case SERVER_TYPE: - aconf = map_to_conf(conf); + case CONF_CLIENT: + case CONF_OPER: + case CONF_SERVER: + assert(conf->clients > 0); - assert(aconf->clients > 0); + assert(conf->class->ref_count > 0); - if ((aclass_conf = aconf->class_ptr) != NULL) - { - aclass = map_to_conf(aclass_conf); - - assert(aclass->curr_user_count > 0); - - if (conf->type == CLIENT_TYPE) - remove_from_cidr_check(&client_p->localClient->ip, aclass); - if (--aclass->curr_user_count == 0 && aclass->active == 0) - delete_conf_item(aclass_conf); - } - - if (--aconf->clients == 0 && IsConfIllegal(aconf)) - delete_conf_item(conf); + if (conf->type == CONF_CLIENT) + remove_from_cidr_check(&client_p->localClient->ip, conf->class); + if (--conf->class->ref_count == 0 && conf->class->active == 0) + class_free(conf->class); + if (--conf->clients == 0 && conf->active == 0) + conf_free(conf); break; default: break; } - - if (type != CONF_TYPE) - return 0; } } - - return -1; } /* attach_conf() @@ -1246,24 +1232,18 @@ detach_conf(struct Client *client_p, ConfType type) * attachment if there was an old one... */ int -attach_conf(struct Client *client_p, struct ConfItem *conf) +attach_conf(struct Client *client_p, struct MaskItem *conf) { - struct AccessItem *aconf = map_to_conf(conf); - struct ClassItem *aclass = map_to_conf(aconf->class_ptr); - if (dlinkFind(&client_p->localClient->confs, conf) != NULL) return 1; - if (IsConfIllegal(aconf)) /* TBV: can't happen */ - return NOT_AUTHORIZED; - - if (conf->type == CLIENT_TYPE) - if (cidr_limit_reached(IsConfExemptLimits(aconf), - &client_p->localClient->ip, aclass)) + if (conf->type == CONF_CLIENT) + if (cidr_limit_reached(IsConfExemptLimits(conf), + &client_p->localClient->ip, conf->class)) return TOO_MANY; /* Already at maximum allowed */ - aclass->curr_user_count++; - aconf->clients++; + conf->class->ref_count++; + conf->clients++; dlinkAdd(conf, make_dlink_node(), &client_p->localClient->confs); @@ -1283,8 +1263,7 @@ attach_connect_block(struct Client *client_p, const char *name, const char *host) { dlink_node *ptr; - struct ConfItem *conf; - struct AccessItem *aconf; + struct MaskItem *conf = NULL; assert(client_p != NULL); assert(host != NULL); @@ -1295,9 +1274,8 @@ attach_connect_block(struct Client *client_p, const char *name, DLINK_FOREACH(ptr, server_items.head) { conf = ptr->data; - aconf = map_to_conf(conf); - if (match(conf->name, name) == 0 || match(aconf->host, host) == 0) + if (match(conf->name, name) == 0 || match(conf->host, host) == 0) continue; attach_conf(client_p, conf); @@ -1309,7 +1287,7 @@ attach_connect_block(struct Client *client_p, const char *name, /* find_conf_exact() * - * inputs - type of ConfItem + * inputs - type of MaskItem * - pointer to name to find * - pointer to username to find * - pointer to host to find @@ -1317,14 +1295,13 @@ attach_connect_block(struct Client *client_p, const char *name, * side effects - find a conf entry which matches the hostname * and has the same name. */ -struct ConfItem * -find_conf_exact(ConfType type, const char *name, const char *user, +struct MaskItem * +find_conf_exact(enum maskitem_type type, const char *name, const char *user, const char *host) { dlink_node *ptr; dlink_list *list_p; - struct ConfItem *conf = NULL; - struct AccessItem *aconf; + struct MaskItem *conf = NULL; /* Only valid for OPER_TYPE and ...? */ list_p = map_to_list(type); @@ -1335,9 +1312,9 @@ find_conf_exact(ConfType type, const char *name, const char *user, if (conf->name == NULL) continue; - aconf = map_to_conf(conf); - if (aconf->host == NULL) + if (conf->host == NULL) continue; + if (irccmp(conf->name, name) != 0) continue; @@ -1346,15 +1323,11 @@ find_conf_exact(ConfType type, const char *name, const char *user, ** socket host) matches *either* host or name field ** of the configuration. */ - if (!match(aconf->host, host) || !match(aconf->user, user)) + if (!match(conf->host, host) || !match(conf->user, user)) continue; - if (type == OPER_TYPE) - { - struct ClassItem *aclass = map_to_conf(aconf->class_ptr); - - if (aconf->clients >= aclass->max_total) + if (type == CONF_OPER) + if (conf->clients >= conf->class->max_total) continue; - } return conf; } @@ -1371,11 +1344,11 @@ find_conf_exact(ConfType type, const char *name, const char *user, * side effects - find a conf entry which matches the name * and has the given mask. */ -struct ConfItem * -find_conf_name(dlink_list *list, const char *name, ConfType type) +struct MaskItem * +find_conf_name(dlink_list *list, const char *name, enum maskitem_type type) { dlink_node *ptr; - struct ConfItem* conf; + struct MaskItem* conf; DLINK_FOREACH(ptr, list->head) { @@ -1399,42 +1372,34 @@ find_conf_name(dlink_list *list, const char *name, ConfType type) * side effects - none */ static dlink_list * -map_to_list(ConfType type) +map_to_list(enum maskitem_type type) { switch(type) { - case RXLINE_TYPE: + case CONF_RXLINE: return(&rxconf_items); break; - case XLINE_TYPE: + case CONF_XLINE: return(&xconf_items); break; - case ULINE_TYPE: + case CONF_ULINE: return(&uconf_items); break; - case NRESV_TYPE: + case CONF_NRESV: return(&nresv_items); break; - case OPER_TYPE: + case CONF_OPER: return(&oconf_items); break; - case CLASS_TYPE: - return(&class_items); - break; - case SERVER_TYPE: + case CONF_SERVER: return(&server_items); break; - case SERVICE_TYPE: + case CONF_SERVICE: return(&service_items); break; - case CLUSTER_TYPE: + case CONF_CLUSTER: return(&cluster_items); break; - case CONF_TYPE: - case GLINE_TYPE: - case KLINE_TYPE: - case DLINE_TYPE: - case CRESV_TYPE: default: return NULL; } @@ -1447,34 +1412,32 @@ map_to_list(ConfType type) * - pointer to user * - pointer to host * - optional action to match on as well - * output - NULL or pointer to found struct MatchItem + * output - NULL or pointer to found struct MaskItem * side effects - looks for a match on name field */ -struct ConfItem * -find_matching_name_conf(ConfType type, const char *name, const char *user, - const char *host, int action) +struct MaskItem * +find_matching_name_conf(enum maskitem_type type, const char *name, const char *user, + const char *host, unsigned int action) { dlink_node *ptr=NULL; - struct ConfItem *conf=NULL; - struct AccessItem *aconf=NULL; - struct MatchItem *match_item=NULL; + struct MaskItem *conf=NULL; dlink_list *list_p = map_to_list(type); switch (type) { #ifdef HAVE_LIBPCRE - case RXLINE_TYPE: + case CONF_RXLINE: DLINK_FOREACH(ptr, list_p->head) { conf = ptr->data; assert(conf->regexpname); - if (!ircd_pcre_exec(conf->regexpname, name)) + if (!ircd_pcre_exec(conf->regexuser, name)) return conf; } break; #endif - case SERVICE_TYPE: + case CONF_SERVICE: DLINK_FOREACH(ptr, list_p->head) { conf = ptr->data; @@ -1486,39 +1449,37 @@ find_matching_name_conf(ConfType type, const char *name, const char *user, } break; - case XLINE_TYPE: - case ULINE_TYPE: - case NRESV_TYPE: + case CONF_XLINE: + case CONF_ULINE: + case CONF_NRESV: DLINK_FOREACH(ptr, list_p->head) { conf = ptr->data; - match_item = map_to_conf(conf); if (EmptyString(conf->name)) continue; if ((name != NULL) && match_esc(conf->name, name)) { if ((user == NULL && (host == NULL))) return conf; - if ((match_item->action & action) != action) + if ((conf->action & action) != action) continue; - if (EmptyString(match_item->user) || EmptyString(match_item->host)) + if (EmptyString(conf->user) || EmptyString(conf->host)) return conf; - if (match(match_item->user, user) && match(match_item->host, host)) + if (match(conf->user, user) && match(conf->host, host)) return conf; } } break; - case SERVER_TYPE: + case CONF_SERVER: DLINK_FOREACH(ptr, list_p->head) { conf = ptr->data; - aconf = map_to_conf(conf); - if ((name != NULL) && match_esc(name, conf->name)) + if ((name != NULL) && match(name, conf->name)) return conf; - else if ((host != NULL) && match_esc(host, aconf->host)) + else if ((host != NULL) && match(host, conf->host)) return conf; } break; @@ -1535,32 +1496,28 @@ find_matching_name_conf(ConfType type, const char *name, const char *user, * - pointer to name string to find * - pointer to user * - pointer to host - * output - NULL or pointer to found struct MatchItem + * output - NULL or pointer to found struct MaskItem * side effects - looks for an exact match on name field */ -struct ConfItem * -find_exact_name_conf(ConfType type, const struct Client *who, const char *name, +struct MaskItem * +find_exact_name_conf(enum maskitem_type type, const struct Client *who, const char *name, const char *user, const char *host) { dlink_node *ptr = NULL; - struct AccessItem *aconf; - struct ConfItem *conf; - struct MatchItem *match_item; - dlink_list *list_p; - - list_p = map_to_list(type); + struct MaskItem *conf; + dlink_list *list_p = map_to_list(type); switch(type) { - case RXLINE_TYPE: - case XLINE_TYPE: - case ULINE_TYPE: - case NRESV_TYPE: + case CONF_RXLINE: + case CONF_XLINE: + case CONF_ULINE: + case CONF_NRESV: DLINK_FOREACH(ptr, list_p->head) { conf = ptr->data; - match_item = (struct MatchItem *)map_to_conf(conf); + if (EmptyString(conf->name)) continue; @@ -1568,19 +1525,18 @@ find_exact_name_conf(ConfType type, const struct Client *who, const char *name, { if ((user == NULL && (host == NULL))) return (conf); - if (EmptyString(match_item->user) || EmptyString(match_item->host)) + if (EmptyString(conf->user) || EmptyString(conf->host)) return (conf); - if (match(match_item->user, user) && match(match_item->host, host)) + if (match(conf->user, user) && match(conf->host, host)) return (conf); } } break; - case OPER_TYPE: + case CONF_OPER: DLINK_FOREACH(ptr, list_p->head) { conf = ptr->data; - aconf = map_to_conf(conf); if (EmptyString(conf->name)) continue; @@ -1589,25 +1545,25 @@ find_exact_name_conf(ConfType type, const struct Client *who, const char *name, { if (!who) return conf; - if (EmptyString(aconf->user) || EmptyString(aconf->host)) + if (EmptyString(conf->user) || EmptyString(conf->host)) return conf; - if (match(aconf->user, who->username)) + if (match(conf->user, who->username)) { - switch (aconf->type) + switch (conf->htype) { case HM_HOST: - if (match(aconf->host, who->host) || match(aconf->host, who->sockhost)) + if (match(conf->host, who->host) || match(conf->host, who->sockhost)) return conf; break; case HM_IPV4: if (who->localClient->aftype == AF_INET) - if (match_ipv4(&who->localClient->ip, &aconf->addr, aconf->bits)) + if (match_ipv4(&who->localClient->ip, &conf->addr, conf->bits)) return conf; break; #ifdef IPV6 case HM_IPV6: if (who->localClient->aftype == AF_INET6) - if (match_ipv6(&who->localClient->ip, &aconf->addr, aconf->bits)) + if (match_ipv6(&who->localClient->ip, &conf->addr, conf->bits)) return conf; break; #endif @@ -1620,19 +1576,19 @@ find_exact_name_conf(ConfType type, const struct Client *who, const char *name, break; - case SERVER_TYPE: + case CONF_SERVER: DLINK_FOREACH(ptr, list_p->head) { conf = ptr->data; - aconf = (struct AccessItem *)map_to_conf(conf); + if (EmptyString(conf->name)) continue; if (name == NULL) { - if (EmptyString(aconf->host)) + if (EmptyString(conf->host)) continue; - if (irccmp(aconf->host, host) == 0) + if (irccmp(conf->host, host) == 0) return(conf); } else if (irccmp(conf->name, name) == 0) @@ -1642,18 +1598,6 @@ find_exact_name_conf(ConfType type, const struct Client *who, const char *name, } break; - case CLASS_TYPE: - DLINK_FOREACH(ptr, list_p->head) - { - conf = ptr->data; - if (EmptyString(conf->name)) - continue; - - if (irccmp(conf->name, name) == 0) - return (conf); - } - break; - default: break; } @@ -1687,8 +1631,6 @@ rehash(int sig) load_conf_modules(); - flush_deleted_I_P(); - rehashed_klines = 1; /* XXX */ if (ConfigLoggingEntry.use_logging) @@ -1712,7 +1654,7 @@ set_default_conf(void) /* verify init_class() ran, this should be an unnecessary check * but its not much work. */ - assert(class_default == (struct ConfItem *) class_items.tail->data); + assert(class_default == class_items.tail->data); #ifdef HAVE_LIBCRYPTO ServerInfo.rsa_private_key = NULL; @@ -1855,7 +1797,7 @@ read_conf(FILE *file) yyparse(); /* Load the values from the conf */ validate_conf(); /* Check to make sure some values are still okay. */ /* Some global values are also loaded here. */ - check_class(); /* Make sure classes are valid */ + class_delete_marked(); /* Make sure classes are valid */ } /* lookup_confhost() @@ -1864,17 +1806,14 @@ read_conf(FILE *file) * line and convert an IP addresses in a.b.c.d number for to IP#s. */ static void -lookup_confhost(struct ConfItem *conf) +lookup_confhost(struct MaskItem *conf) { - struct AccessItem *aconf; struct addrinfo hints, *res; - aconf = map_to_conf(conf); - - if (has_wildcards(aconf->host)) + if (has_wildcards(conf->host)) { ilog(LOG_TYPE_IRCD, "Host/server name error: (%s) (%s)", - aconf->host, conf->name); + conf->host, conf->name); return; } @@ -1889,17 +1828,18 @@ lookup_confhost(struct ConfItem *conf) /* Get us ready for a bind() and don't bother doing dns lookup */ hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; - if (getaddrinfo(aconf->host, NULL, &hints, &res)) + if (getaddrinfo(conf->host, NULL, &hints, &res)) { - conf_dns_lookup(aconf); + conf_dns_lookup(conf); return; } assert(res != NULL); - memcpy(&aconf->addr, res->ai_addr, res->ai_addrlen); - aconf->addr.ss_len = res->ai_addrlen; - aconf->addr.ss.ss_family = res->ai_family; + memcpy(&conf->addr, res->ai_addr, res->ai_addrlen); + conf->addr.ss_len = res->ai_addrlen; + conf->addr.ss.ss_family = res->ai_family; + freeaddrinfo(res); } @@ -1914,13 +1854,13 @@ int conf_connect_allowed(struct irc_ssaddr *addr, int aftype) { struct ip_entry *ip_found; - struct AccessItem *aconf = find_dline_conf(addr, aftype); + struct MaskItem *conf = find_dline_conf(addr, aftype); /* DLINE exempt also gets you out of static limits/pacing... */ - if (aconf && (aconf->status & CONF_EXEMPTDLINE)) + if (conf && (conf->status & CONF_EXEMPT)) return 0; - if (aconf != NULL) + if (conf != NULL) return BANNED_CLIENT; ip_found = find_or_add_ip(addr); @@ -1936,7 +1876,7 @@ conf_connect_allowed(struct irc_ssaddr *addr, int aftype) return 0; } -static struct AccessItem * +static struct MaskItem * find_regexp_kline(const char *uhi[]) { #ifdef HAVE_LIBPCRE @@ -1944,7 +1884,7 @@ find_regexp_kline(const char *uhi[]) DLINK_FOREACH(ptr, rkconf_items.head) { - struct AccessItem *aptr = map_to_conf(ptr->data); + struct MaskItem *aptr = ptr->data; assert(aptr->regexuser); assert(aptr->regexhost); @@ -1961,14 +1901,14 @@ find_regexp_kline(const char *uhi[]) /* find_kill() * * inputs - pointer to client structure - * output - pointer to struct AccessItem if found + * output - pointer to struct MaskItem if found * side effects - See if this user is klined already, - * and if so, return struct AccessItem pointer + * and if so, return struct MaskItem pointer */ -struct AccessItem * +struct MaskItem * find_kill(struct Client *client_p) { - struct AccessItem *aconf = NULL; + struct MaskItem *conf = NULL; const char *uhi[3]; uhi[0] = client_p->username; @@ -1977,26 +1917,26 @@ find_kill(struct Client *client_p) assert(client_p != NULL); - aconf = find_conf_by_address(client_p->host, &client_p->localClient->ip, - CONF_KLINE, client_p->localClient->aftype, - client_p->username, NULL, 1); - if (aconf == NULL) - aconf = find_regexp_kline(uhi); + conf = find_conf_by_address(client_p->host, &client_p->localClient->ip, + CONF_KLINE, client_p->localClient->aftype, + client_p->username, NULL, 1); + if (conf == NULL) + conf = find_regexp_kline(uhi); - return aconf; + return conf; } -struct AccessItem * +struct MaskItem * find_gline(struct Client *client_p) { - struct AccessItem *aconf; + struct MaskItem *conf; assert(client_p != NULL); - aconf = find_conf_by_address(client_p->host, &client_p->localClient->ip, - CONF_GLINE, client_p->localClient->aftype, - client_p->username, NULL, 1); - return aconf; + conf = find_conf_by_address(client_p->host, &client_p->localClient->ip, + CONF_GLINE, client_p->localClient->aftype, + client_p->username, NULL, 1); + return conf; } /* cleanup_tklines() @@ -2026,46 +1966,40 @@ expire_tklines(dlink_list *tklist) { dlink_node *ptr; dlink_node *next_ptr; - struct ConfItem *conf; - struct MatchItem *xconf; - struct MatchItem *nconf; - struct ResvChannel *cconf; + struct MaskItem *conf; DLINK_FOREACH_SAFE(ptr, next_ptr, tklist->head) { conf = ptr->data; - if (conf->type == XLINE_TYPE) + if (conf->type == CONF_XLINE) { - xconf = (struct MatchItem *)map_to_conf(conf); - if (xconf->hold && xconf->hold <= CurrentTime) + if (conf->hold && conf->hold <= CurrentTime) { if (ConfigFileEntry.tkline_expire_notices) sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Temporary X-line for [%s] expired", conf->name); - delete_conf_item(conf); + conf_free(conf); } } - else if (conf->type == NRESV_TYPE) + else if (conf->type == CONF_NRESV) { - nconf = (struct MatchItem *)map_to_conf(conf); - if (nconf->hold && nconf->hold <= CurrentTime) + if (conf->hold && conf->hold <= CurrentTime) { if (ConfigFileEntry.tkline_expire_notices) sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Temporary RESV for [%s] expired", conf->name); - delete_conf_item(conf); + conf_free(conf); } } - else if (conf->type == CRESV_TYPE) - { - cconf = ptr->data; - if (cconf->hold && cconf->hold <= CurrentTime) + else if (conf->type == CONF_CRESV) + { /* XXX XXX */ + if (conf->hold && conf->hold <= CurrentTime) { if (ConfigFileEntry.tkline_expire_notices) sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, - "Temporary RESV for [%s] expired", cconf->name); - delete_channel_resv(cconf); + "Temporary RESV for [%s] expired", conf->name); + delete_channel_resv(conf); } } } @@ -2135,10 +2069,9 @@ get_oper_name(const struct Client *client_p) { if ((cnode = client_p->localClient->confs.head)) { - struct ConfItem *conf = cnode->data; - const struct AccessItem *aconf = map_to_conf(conf); + struct MaskItem *conf = cnode->data; - if (IsConfOperator(aconf)) + if (IsConfOperator(conf)) { snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name, client_p->username, client_p->host, conf->name); @@ -2240,9 +2173,7 @@ static void clear_out_old_conf(void) { dlink_node *ptr = NULL, *next_ptr = NULL; - struct ConfItem *conf; - struct AccessItem *aconf; - struct ClassItem *cltmp; + struct MaskItem *conf; dlink_list *free_items [] = { &server_items, &oconf_items, &uconf_items, &xconf_items, &rxconf_items, &rkconf_items, @@ -2260,65 +2191,32 @@ clear_out_old_conf(void) DLINK_FOREACH_SAFE(ptr, next_ptr, (*iterator)->head) { conf = ptr->data; - /* XXX This is less than pretty */ - if (conf->type == SERVER_TYPE) - { - aconf = map_to_conf(conf); - if (aconf->clients != 0) - { - SetConfIllegal(aconf); - dlinkDelete(&conf->node, &server_items); - } - else - { - delete_conf_item(conf); - } - } - else if (conf->type == OPER_TYPE) - { - aconf = map_to_conf(conf); + dlinkDelete(&conf->node, map_to_list(conf->type)); - if (aconf->clients != 0) - { - SetConfIllegal(aconf); - dlinkDelete(&conf->node, &oconf_items); - } - else - { - delete_conf_item(conf); - } - } - else if (conf->type == XLINE_TYPE || - conf->type == RXLINE_TYPE || - conf->type == RKLINE_TYPE) + /* XXX This is less than pretty */ + if (conf->type == CONF_SERVER || conf->type == CONF_OPER) { - /* temporary (r)xlines are also on - * the (r)xconf items list */ - aconf = map_to_conf(conf); - if (aconf->hold) - continue; - - delete_conf_item(conf); + if (!conf->clients) + conf_free(conf); } - else + else if (conf->type == CONF_XLINE || + conf->type == CONF_RXLINE || + conf->type == CONF_RKLINE) { - delete_conf_item(conf); + if (!conf->hold) + conf_free(conf); } + else + conf_free(conf); } } /* * don't delete the class table, rather mark all entries - * for deletion. The table is cleaned up by check_class. - avalon + * for deletion. The table is cleaned up by class_delete_marked. - avalon */ - DLINK_FOREACH(ptr, class_items.head) - { - cltmp = map_to_conf(ptr->data); - - if (ptr != class_items.tail) /* never mark the "default" class */ - cltmp->active = 0; - } + class_mark_for_deletion(); clear_out_address_conf(); @@ -2381,273 +2279,30 @@ clear_out_old_conf(void) delete_isupport("EXCEPTS"); } -/* flush_deleted_I_P() - * - * inputs - none - * output - none - * side effects - This function removes I/P conf items - */ -static void -flush_deleted_I_P(void) -{ - dlink_node *ptr; - dlink_node *next_ptr; - struct ConfItem *conf; - struct AccessItem *aconf; - dlink_list * free_items [] = { - &server_items, &oconf_items, NULL - }; - dlink_list ** iterator = free_items; /* C is dumb */ - - /* flush out deleted I and P lines - * although still in use. - */ - for (; *iterator != NULL; iterator++) - { - DLINK_FOREACH_SAFE(ptr, next_ptr, (*iterator)->head) - { - conf = ptr->data; - aconf = (struct AccessItem *)map_to_conf(conf); - - if (IsConfIllegal(aconf)) - { - dlinkDelete(ptr, *iterator); - - if (aconf->clients == 0) - delete_conf_item(conf); - } - } - } -} - #define BAD_PING (-1) /* get_conf_ping() * - * inputs - pointer to struct AccessItem + * inputs - pointer to struct MaskItem * - pointer to a variable that receives ping warning time * output - ping frequency * side effects - NONE */ -static int -get_conf_ping(struct ConfItem *conf, int *pingwarn) +int +get_conf_ping(const struct MaskItem *conf, int *pingwarn) { - struct ClassItem *aclass; - struct AccessItem *aconf; - if (conf != NULL) { - aconf = (struct AccessItem *)map_to_conf(conf); - if (aconf->class_ptr != NULL) + if (conf->class) { - aclass = (struct ClassItem *)map_to_conf(aconf->class_ptr); - *pingwarn = aclass->ping_warning; - return aclass->ping_freq; + *pingwarn = conf->class->ping_warning; + return conf->class->ping_freq; } } return BAD_PING; } -/* get_client_class() - * - * inputs - pointer to client struct - * output - pointer to name of class - * side effects - NONE - */ -const char * -get_client_class(struct Client *target_p) -{ - dlink_node *cnode = NULL; - struct AccessItem *aconf = NULL; - - assert(!IsMe(target_p)); - - if ((cnode = target_p->localClient->confs.head)) - { - struct ConfItem *conf = cnode->data; - - assert((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) || - (conf->type == OPER_TYPE)); - - aconf = map_to_conf(conf); - if (aconf->class_ptr != NULL) - return aconf->class_ptr->name; - } - - return "default"; -} - -/* get_client_ping() - * - * inputs - pointer to client struct - * - pointer to a variable that receives ping warning time - * output - ping frequency - * side effects - NONE - */ -int -get_client_ping(struct Client *target_p, int *pingwarn) -{ - int ping = 0; - dlink_node *cnode = NULL; - - if ((cnode = target_p->localClient->confs.head)) - { - struct ConfItem *conf = cnode->data; - - assert((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) || - (conf->type == OPER_TYPE)); - - ping = get_conf_ping(conf, pingwarn); - if (ping > 0) - return ping; - } - - *pingwarn = 0; - return DEFAULT_PINGFREQUENCY; -} - -/* find_class() - * - * inputs - string name of class - * output - corresponding Class pointer - * side effects - NONE - */ -struct ConfItem * -find_class(const char *classname) -{ - struct ConfItem *conf; - - if ((conf = find_exact_name_conf(CLASS_TYPE, NULL, classname, NULL, NULL)) != NULL) - return conf; - - return class_default; -} - -/* check_class() - * - * inputs - NONE - * output - NONE - * side effects - - */ -void -check_class(void) -{ - dlink_node *ptr = NULL, *next_ptr = NULL; - - DLINK_FOREACH_SAFE(ptr, next_ptr, class_items.head) - { - struct ClassItem *aclass = map_to_conf(ptr->data); - - if (!aclass->active && !aclass->curr_user_count) - { - destroy_cidr_class(aclass); - delete_conf_item(ptr->data); - } - } -} - -/* init_class() - * - * inputs - NONE - * output - NONE - * side effects - - */ -void -init_class(void) -{ - struct ClassItem *aclass; - - class_default = make_conf_item(CLASS_TYPE); - - aclass = map_to_conf(class_default); - aclass->active = 1; - DupString(class_default->name, "default"); - aclass->con_freq = DEFAULT_CONNECTFREQUENCY; - aclass->ping_freq = DEFAULT_PINGFREQUENCY; - aclass->max_total = MAXIMUM_LINKS_DEFAULT; - aclass->max_sendq = DEFAULT_SENDQ; - aclass->max_recvq = DEFAULT_RECVQ; - - client_check_cb = register_callback("check_client", check_client); -} - -/* get_sendq() - * - * inputs - pointer to client - * output - sendq for this client as found from its class - * side effects - NONE - */ -unsigned int -get_sendq(struct Client *client_p) -{ - unsigned int sendq = DEFAULT_SENDQ; - dlink_node *cnode; - struct ConfItem *class_conf; - struct ClassItem *aclass; - struct AccessItem *aconf; - - assert(!IsMe(client_p)); - - if ((cnode = client_p->localClient->confs.head)) - { - struct ConfItem *conf = cnode->data; - - assert((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) || - (conf->type == OPER_TYPE)); - - aconf = map_to_conf(conf); - - if ((class_conf = aconf->class_ptr) == NULL) - return DEFAULT_SENDQ; /* TBV: shouldn't be possible at all */ - - aclass = map_to_conf(class_conf); - sendq = aclass->max_sendq; - return sendq; - } - - /* XXX return a default? - * if here, then there wasn't an attached conf with a sendq - * that is very bad -Dianora - */ - return DEFAULT_SENDQ; -} - -unsigned int -get_recvq(struct Client *client_p) -{ - unsigned int recvq = DEFAULT_RECVQ; - dlink_node *cnode; - struct ConfItem *class_conf; - struct ClassItem *aclass; - struct AccessItem *aconf; - - assert(!IsMe(client_p)); - - if ((cnode = client_p->localClient->confs.head)) - { - struct ConfItem *conf = cnode->data; - - assert((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) || - (conf->type == OPER_TYPE)); - - aconf = map_to_conf(conf); - - if ((class_conf = aconf->class_ptr) == NULL) - return DEFAULT_RECVQ; /* TBV: shouldn't be possible at all */ - - aclass = map_to_conf(class_conf); - recvq = aclass->max_recvq; - return recvq; - } - - /* XXX return a default? - * if here, then there wasn't an attached conf with a recvq - * that is very bad -Dianora - */ - return DEFAULT_RECVQ; -} - /* conf_add_class_to_conf() * * inputs - pointer to config item @@ -2655,41 +2310,37 @@ get_recvq(struct Client *client_p) * side effects - Add a class pointer to a conf */ void -conf_add_class_to_conf(struct ConfItem *conf, const char *class_name) +conf_add_class_to_conf(struct MaskItem *conf, const char *class_name) { - struct AccessItem *aconf = map_to_conf(conf); struct ClassItem *class = NULL; if (class_name == NULL) { - aconf->class_ptr = class_default; + conf->class = class_default; - if (conf->type == CLIENT_TYPE) + if (conf->type == CONF_CLIENT) sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Warning *** Defaulting to default class for %s@%s", - aconf->user, aconf->host); + conf->user, conf->host); else sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Warning *** Defaulting to default class for %s", conf->name); } else - aconf->class_ptr = find_class(class_name); + conf->class = class_find(class_name, 1); - if (aconf->class_ptr) - class = map_to_conf(aconf->class_ptr); - - if (aconf->class_ptr == NULL || !class->active) + if (conf->class == NULL) { - if (conf->type == CLIENT_TYPE) + if (conf->type == CONF_CLIENT) sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Warning *** Defaulting to default class for %s@%s", - aconf->user, aconf->host); + conf->user, conf->host); else sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Warning *** Defaulting to default class for %s", conf->name); - aconf->class_ptr = class_default; + conf->class = class_default; } } @@ -2701,13 +2352,11 @@ conf_add_class_to_conf(struct ConfItem *conf, const char *class_name) * side effects - Add a connect block */ int -conf_add_server(struct ConfItem *conf, const char *class_name) +conf_add_server(struct MaskItem *conf, const char *class_name) { - struct AccessItem *aconf = map_to_conf(conf); - conf_add_class_to_conf(conf, class_name); - if (!aconf->host || !conf->name) + if (!conf->host || !conf->name) { sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Bad connect block"); @@ -2715,7 +2364,7 @@ conf_add_server(struct ConfItem *conf, const char *class_name) return -1; } - if (EmptyString(aconf->passwd)) + if (EmptyString(conf->passwd)) { sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Bad connect block, name %s", @@ -3126,19 +2775,19 @@ valid_comment(struct Client *source_p, char *comment, int warn) * side effects - none */ int -match_conf_password(const char *password, const struct AccessItem *aconf) +match_conf_password(const char *password, const struct MaskItem *conf) { const char *encr = NULL; - if (EmptyString(password) || EmptyString(aconf->passwd)) + if (EmptyString(password) || EmptyString(conf->passwd)) return 0; - if (aconf->flags & CONF_FLAGS_ENCRYPTED) - encr = crypt(password, aconf->passwd); + if (conf->flags & CONF_FLAGS_ENCRYPTED) + encr = crypt(password, conf->passwd); else encr = password; - return !strcmp(encr, aconf->passwd); + return !strcmp(encr, conf->passwd); } /* @@ -3167,7 +2816,7 @@ cluster_a_line(struct Client *source_p, const char *command, DLINK_FOREACH(ptr, cluster_items.head) { - const struct ConfItem *conf = ptr->data; + const struct MaskItem *conf = ptr->data; if (conf->flags & cluster_type) sendto_match_servs(source_p, conf->name, CAP_CLUSTER|capab, @@ -3289,227 +2938,3 @@ flags_to_ascii(unsigned int flags, const unsigned int bit_table[], char *p, } *p = '\0'; } - -/* - * cidr_limit_reached - * - * inputs - int flag allowing over_rule of limits - * - pointer to the ip to be added - * - pointer to the class - * output - non zero if limit reached - * 0 if limit not reached - * side effects - - */ -static int -cidr_limit_reached(int over_rule, - struct irc_ssaddr *ip, struct ClassItem *aclass) -{ - dlink_node *ptr = NULL; - struct CidrItem *cidr; - - if (aclass->number_per_cidr <= 0) - return 0; - - if (ip->ss.ss_family == AF_INET) - { - if (aclass->cidr_bitlen_ipv4 <= 0) - return 0; - - DLINK_FOREACH(ptr, aclass->list_ipv4.head) - { - cidr = ptr->data; - if (match_ipv4(ip, &cidr->mask, aclass->cidr_bitlen_ipv4)) - { - if (!over_rule && (cidr->number_on_this_cidr >= aclass->number_per_cidr)) - return -1; - cidr->number_on_this_cidr++; - return 0; - } - } - cidr = MyMalloc(sizeof(struct CidrItem)); - cidr->number_on_this_cidr = 1; - cidr->mask = *ip; - mask_addr(&cidr->mask, aclass->cidr_bitlen_ipv4); - dlinkAdd(cidr, &cidr->node, &aclass->list_ipv4); - } -#ifdef IPV6 - else if (aclass->cidr_bitlen_ipv6 > 0) - { - DLINK_FOREACH(ptr, aclass->list_ipv6.head) - { - cidr = ptr->data; - if (match_ipv6(ip, &cidr->mask, aclass->cidr_bitlen_ipv6)) - { - if (!over_rule && (cidr->number_on_this_cidr >= aclass->number_per_cidr)) - return -1; - cidr->number_on_this_cidr++; - return 0; - } - } - cidr = MyMalloc(sizeof(struct CidrItem)); - cidr->number_on_this_cidr = 1; - cidr->mask = *ip; - mask_addr(&cidr->mask, aclass->cidr_bitlen_ipv6); - dlinkAdd(cidr, &cidr->node, &aclass->list_ipv6); - } -#endif - return 0; -} - -/* - * remove_from_cidr_check - * - * inputs - pointer to the ip to be removed - * - pointer to the class - * output - NONE - * side effects - - */ -static void -remove_from_cidr_check(struct irc_ssaddr *ip, struct ClassItem *aclass) -{ - dlink_node *ptr = NULL; - dlink_node *next_ptr = NULL; - struct CidrItem *cidr; - - if (aclass->number_per_cidr == 0) - return; - - if (ip->ss.ss_family == AF_INET) - { - if (aclass->cidr_bitlen_ipv4 <= 0) - return; - - DLINK_FOREACH_SAFE(ptr, next_ptr, aclass->list_ipv4.head) - { - cidr = ptr->data; - if (match_ipv4(ip, &cidr->mask, aclass->cidr_bitlen_ipv4)) - { - cidr->number_on_this_cidr--; - if (cidr->number_on_this_cidr == 0) - { - dlinkDelete(ptr, &aclass->list_ipv4); - MyFree(cidr); - return; - } - } - } - } -#ifdef IPV6 - else if (aclass->cidr_bitlen_ipv6 > 0) - { - DLINK_FOREACH_SAFE(ptr, next_ptr, aclass->list_ipv6.head) - { - cidr = ptr->data; - if (match_ipv6(ip, &cidr->mask, aclass->cidr_bitlen_ipv6)) - { - cidr->number_on_this_cidr--; - if (cidr->number_on_this_cidr == 0) - { - dlinkDelete(ptr, &aclass->list_ipv6); - MyFree(cidr); - return; - } - } - } - } -#endif -} - -static void -rebuild_cidr_list(int aftype, struct ConfItem *oldcl, struct ClassItem *newcl, - dlink_list *old_list, dlink_list *new_list, int changed) -{ - dlink_node *ptr; - struct Client *client_p; - struct ConfItem *conf; - struct AccessItem *aconf; - - if (!changed) - { - *new_list = *old_list; - old_list->head = old_list->tail = NULL; - old_list->length = 0; - return; - } - - DLINK_FOREACH(ptr, local_client_list.head) - { - client_p = ptr->data; - if (client_p->localClient->aftype != aftype) - continue; - if (dlink_list_length(&client_p->localClient->confs) == 0) - continue; - - conf = client_p->localClient->confs.tail->data; - if (conf->type == CLIENT_TYPE) - { - aconf = map_to_conf(conf); - if (aconf->class_ptr == oldcl) - cidr_limit_reached(1, &client_p->localClient->ip, newcl); - } - } -} - -/* - * rebuild_cidr_class - * - * inputs - pointer to old conf - * - pointer to new_class - * output - none - * side effects - rebuilds the class link list of cidr blocks - */ -void -rebuild_cidr_class(struct ConfItem *conf, struct ClassItem *new_class) -{ - struct ClassItem *old_class = map_to_conf(conf); - - if (old_class->number_per_cidr > 0 && new_class->number_per_cidr > 0) - { - if (old_class->cidr_bitlen_ipv4 > 0 && new_class->cidr_bitlen_ipv4 > 0) - rebuild_cidr_list(AF_INET, conf, new_class, - &old_class->list_ipv4, &new_class->list_ipv4, - old_class->cidr_bitlen_ipv4 != new_class->cidr_bitlen_ipv4); - -#ifdef IPV6 - if (old_class->cidr_bitlen_ipv6 > 0 && new_class->cidr_bitlen_ipv6 > 0) - rebuild_cidr_list(AF_INET6, conf, new_class, - &old_class->list_ipv6, &new_class->list_ipv6, - old_class->cidr_bitlen_ipv6 != new_class->cidr_bitlen_ipv6); -#endif - } - - destroy_cidr_class(old_class); -} - -/* - * destroy_cidr_list - * - * inputs - pointer to class dlink list of cidr blocks - * output - none - * side effects - completely destroys the class link list of cidr blocks - */ -static void -destroy_cidr_list(dlink_list *list) -{ - dlink_node *ptr = NULL, *next_ptr = NULL; - - DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) - { - dlinkDelete(ptr, list); - MyFree(ptr->data); - } -} - -/* - * destroy_cidr_class - * - * inputs - pointer to class - * output - none - * side effects - completely destroys the class link list of cidr blocks - */ -static void -destroy_cidr_class(struct ClassItem *aclass) -{ - destroy_cidr_list(&aclass->list_ipv4); - destroy_cidr_list(&aclass->list_ipv6); -} diff --git a/src/conf_db.c b/src/conf_db.c index 31725dc..560026a 100644 --- a/src/conf_db.c +++ b/src/conf_db.c @@ -627,7 +627,7 @@ save_kline_database(void) { struct AddressRec *arec = ptr->data; - if (arec->type == CONF_KLINE && IsConfDatabase(arec->aconf)) + if (arec->type == CONF_KLINE && IsConfDatabase(arec->conf)) ++records; } } @@ -640,13 +640,13 @@ save_kline_database(void) { struct AddressRec *arec = ptr->data; - if (arec->type == CONF_KLINE && IsConfDatabase(arec->aconf)) + if (arec->type == CONF_KLINE && IsConfDatabase(arec->conf)) { - SAFE_WRITE(write_string(arec->aconf->user, f), KPATH); - SAFE_WRITE(write_string(arec->aconf->host, f), KPATH); - SAFE_WRITE(write_string(arec->aconf->reason, f), KPATH); - SAFE_WRITE(write_uint64(arec->aconf->setat, f), KPATH); - SAFE_WRITE(write_uint64(arec->aconf->hold, f), KPATH); + SAFE_WRITE(write_string(arec->conf->user, f), KPATH); + SAFE_WRITE(write_string(arec->conf->host, f), KPATH); + SAFE_WRITE(write_string(arec->conf->reason, f), KPATH); + SAFE_WRITE(write_uint64(arec->conf->setat, f), KPATH); + SAFE_WRITE(write_uint64(arec->conf->hold, f), KPATH); } } } @@ -658,7 +658,7 @@ void load_kline_database(void) { struct dbFILE *f = NULL; - struct AccessItem *aconf = NULL; + struct MaskItem *conf = NULL; char *field_1 = NULL; char *field_2 = NULL; char *field_3 = NULL; @@ -686,15 +686,15 @@ load_kline_database(void) SAFE_READ(read_uint64(&field_4, f)); SAFE_READ(read_uint64(&field_5, f)); - aconf = map_to_conf(make_conf_item(KLINE_TYPE)); - aconf->user = field_1; - aconf->host = field_2; - aconf->reason = field_3; - aconf->setat = field_4; - aconf->hold = field_5; - SetConfDatabase(aconf); + conf = conf_make(CONF_KLINE); + conf->user = field_1; + conf->host = field_2; + conf->reason = field_3; + conf->setat = field_4; + conf->hold = field_5; + SetConfDatabase(conf); - add_conf_by_address(CONF_KLINE, aconf); + add_conf_by_address(CONF_KLINE, conf); } close_db(f); @@ -717,7 +717,7 @@ save_dline_database(void) { struct AddressRec *arec = ptr->data; - if (arec->type == CONF_DLINE && IsConfDatabase(arec->aconf)) + if (arec->type == CONF_DLINE && IsConfDatabase(arec->conf)) ++records; } } @@ -730,12 +730,12 @@ save_dline_database(void) { struct AddressRec *arec = ptr->data; - if (arec->type == CONF_DLINE && IsConfDatabase(arec->aconf)) + if (arec->type == CONF_DLINE && IsConfDatabase(arec->conf)) { - SAFE_WRITE(write_string(arec->aconf->host, f), DLPATH); - SAFE_WRITE(write_string(arec->aconf->reason, f), DLPATH); - SAFE_WRITE(write_uint64(arec->aconf->setat, f), DLPATH); - SAFE_WRITE(write_uint64(arec->aconf->hold, f), DLPATH); + SAFE_WRITE(write_string(arec->conf->host, f), DLPATH); + SAFE_WRITE(write_string(arec->conf->reason, f), DLPATH); + SAFE_WRITE(write_uint64(arec->conf->setat, f), DLPATH); + SAFE_WRITE(write_uint64(arec->conf->hold, f), DLPATH); } } } @@ -747,7 +747,7 @@ void load_dline_database(void) { struct dbFILE *f = NULL; - struct AccessItem *aconf = NULL; + struct MaskItem *conf = NULL; char *field_1 = NULL; char *field_2 = NULL; uint32_t i = 0; @@ -773,14 +773,14 @@ load_dline_database(void) SAFE_READ(read_uint64(&field_3, f)); SAFE_READ(read_uint64(&field_4, f)); - aconf = map_to_conf(make_conf_item(DLINE_TYPE)); - aconf->host = field_1; - aconf->reason = field_2; - aconf->setat = field_3; - aconf->hold = field_4; - SetConfDatabase(aconf); + conf = conf_make(CONF_DLINE); + conf->host = field_1; + conf->reason = field_2; + conf->setat = field_3; + conf->hold = field_4; + SetConfDatabase(conf); - add_conf_by_address(CONF_DLINE, aconf); + add_conf_by_address(CONF_DLINE, conf); } close_db(f); @@ -803,7 +803,7 @@ save_gline_database(void) { struct AddressRec *arec = ptr->data; - if (arec->type == CONF_GLINE && IsConfDatabase(arec->aconf)) + if (arec->type == CONF_GLINE && IsConfDatabase(arec->conf)) ++records; } } @@ -816,13 +816,13 @@ save_gline_database(void) { struct AddressRec *arec = ptr->data; - if (arec->type == CONF_GLINE && IsConfDatabase(arec->aconf)) + if (arec->type == CONF_GLINE && IsConfDatabase(arec->conf)) { - SAFE_WRITE(write_string(arec->aconf->user, f), GPATH); - SAFE_WRITE(write_string(arec->aconf->host, f), GPATH); - SAFE_WRITE(write_string(arec->aconf->reason, f), GPATH); - SAFE_WRITE(write_uint64(arec->aconf->setat, f), GPATH); - SAFE_WRITE(write_uint64(arec->aconf->hold, f), GPATH); + SAFE_WRITE(write_string(arec->conf->user, f), GPATH); + SAFE_WRITE(write_string(arec->conf->host, f), GPATH); + SAFE_WRITE(write_string(arec->conf->reason, f), GPATH); + SAFE_WRITE(write_uint64(arec->conf->setat, f), GPATH); + SAFE_WRITE(write_uint64(arec->conf->hold, f), GPATH); } } } @@ -834,7 +834,7 @@ void load_gline_database(void) { struct dbFILE *f = NULL; - struct AccessItem *aconf = NULL; + struct MaskItem *conf = NULL; char *field_1 = NULL; char *field_2 = NULL; char *field_3 = NULL; @@ -862,15 +862,15 @@ load_gline_database(void) SAFE_READ(read_uint64(&field_4, f)); SAFE_READ(read_uint64(&field_5, f)); - aconf = map_to_conf(make_conf_item(KLINE_TYPE)); - aconf->user = field_1; - aconf->host = field_2; - aconf->reason = field_3; - aconf->setat = field_4; - aconf->hold = field_5; - SetConfDatabase(aconf); + conf = conf_make(CONF_GLINE); + conf->user = field_1; + conf->host = field_2; + conf->reason = field_3; + conf->setat = field_4; + conf->hold = field_5; + SetConfDatabase(conf); - add_conf_by_address(CONF_GLINE, aconf); + add_conf_by_address(CONF_GLINE, conf); } close_db(f); @@ -882,26 +882,24 @@ save_resv_database(void) uint32_t records = 0; struct dbFILE *f = NULL; dlink_node *ptr = NULL; - struct ConfItem *conf; - struct ResvChannel *resv_cp; - struct MatchItem *resv_np; + struct MaskItem *conf = NULL; if (!(f = open_db("resv", RESVPATH, "w", KLINE_DB_VERSION))) return; DLINK_FOREACH(ptr, resv_channel_list.head) { - resv_cp = ptr->data; + conf = ptr->data; - if (IsConfDatabase(resv_cp)) + if (IsConfDatabase(conf)) ++records; } DLINK_FOREACH(ptr, nresv_items.head) { - resv_np = map_to_conf(ptr->data); + conf = ptr->data; - if (IsConfDatabase(resv_np)) + if (IsConfDatabase(conf)) ++records; } @@ -909,29 +907,28 @@ save_resv_database(void) DLINK_FOREACH(ptr, resv_channel_list.head) { - resv_cp = ptr->data; + conf = ptr->data; - if (!IsConfDatabase(resv_cp)) + if (!IsConfDatabase(conf)) continue; - SAFE_WRITE(write_string(resv_cp->name, f), RESVPATH); - SAFE_WRITE(write_string(resv_cp->reason, f), RESVPATH); - SAFE_WRITE(write_uint64(resv_cp->setat, f), RESVPATH); - SAFE_WRITE(write_uint64(resv_cp->hold, f), RESVPATH); + SAFE_WRITE(write_string(conf->name, f), RESVPATH); + SAFE_WRITE(write_string(conf->reason, f), RESVPATH); + SAFE_WRITE(write_uint64(conf->setat, f), RESVPATH); + SAFE_WRITE(write_uint64(conf->hold, f), RESVPATH); } DLINK_FOREACH(ptr, nresv_items.head) { conf = ptr->data; - resv_np = map_to_conf(conf); - if (!IsConfDatabase(resv_np)) + if (!IsConfDatabase(conf)) continue; SAFE_WRITE(write_string(conf->name, f), RESVPATH); - SAFE_WRITE(write_string(resv_np->reason, f), RESVPATH); - SAFE_WRITE(write_uint64(resv_np->setat, f), RESVPATH); - SAFE_WRITE(write_uint64(resv_np->hold, f), RESVPATH); + SAFE_WRITE(write_string(conf->reason, f), RESVPATH); + SAFE_WRITE(write_uint64(conf->setat, f), RESVPATH); + SAFE_WRITE(write_uint64(conf->hold, f), RESVPATH); } close_db(f); @@ -946,9 +943,7 @@ load_resv_database(void) struct dbFILE *f = NULL; char *name = NULL; char *reason = NULL; - struct ConfItem *conf; - struct ResvChannel *resv_cp; - struct MatchItem *resv_np; + struct MaskItem *conf = NULL; if (!(f = open_db("resv", RESVPATH, "r", KLINE_DB_VERSION))) return; @@ -973,20 +968,18 @@ load_resv_database(void) if ((conf = create_channel_resv(name, reason, 0)) == NULL) continue; - resv_cp = map_to_conf(conf); - resv_cp->setat = tmp64_setat; - resv_cp->hold = tmp64_hold; - SetConfDatabase(resv_cp); + conf->setat = tmp64_setat; + conf->hold = tmp64_hold; + SetConfDatabase(conf); } else { if ((conf = create_nick_resv(name, reason, 0)) == NULL) continue; - resv_np = map_to_conf(conf); - resv_np->setat = tmp64_setat; - resv_np->hold = tmp64_hold; - SetConfDatabase(resv_np); + conf->setat = tmp64_setat; + conf->hold = tmp64_hold; + SetConfDatabase(conf); } MyFree(name); @@ -1002,8 +995,7 @@ save_xline_database(void) uint32_t records = 0; struct dbFILE *f = NULL; dlink_node *ptr = NULL; - struct ConfItem *conf = NULL; - struct MatchItem *xconf = NULL; + struct MaskItem *conf = NULL; if (!(f = open_db("xline", XPATH, "w", KLINE_DB_VERSION))) return; @@ -1012,7 +1004,7 @@ save_xline_database(void) { conf = ptr->data; - if (IsConfDatabase(xconf)) + if (IsConfDatabase(conf)) ++records; } @@ -1021,15 +1013,14 @@ save_xline_database(void) DLINK_FOREACH(ptr, xconf_items.head) { conf = ptr->data; - xconf = map_to_conf(conf); - if (!IsConfDatabase(xconf)) + if (!IsConfDatabase(conf)) continue; SAFE_WRITE(write_string(conf->name, f), XPATH); - SAFE_WRITE(write_string(xconf->reason, f), XPATH); - SAFE_WRITE(write_uint64(xconf->setat, f), XPATH); - SAFE_WRITE(write_uint64(xconf->hold, f), XPATH); + SAFE_WRITE(write_string(conf->reason, f), XPATH); + SAFE_WRITE(write_uint64(conf->setat, f), XPATH); + SAFE_WRITE(write_uint64(conf->hold, f), XPATH); } close_db(f); @@ -1044,8 +1035,7 @@ load_xline_database(void) struct dbFILE *f = NULL; char *name = NULL; char *reason = NULL; - struct ConfItem *conf = NULL; - struct MatchItem *xconf = NULL; + struct MaskItem *conf = NULL; if (!(f = open_db("xline", XPATH, "r", KLINE_DB_VERSION))) return; @@ -1065,15 +1055,14 @@ load_xline_database(void) SAFE_READ(read_uint64(&tmp64_setat, f)); SAFE_READ(read_uint64(&tmp64_hold, f)); - conf = make_conf_item(XLINE_TYPE); - xconf = map_to_conf(conf); + conf = conf_make(CONF_XLINE); - SetConfDatabase(xconf); + SetConfDatabase(conf); conf->name = name; - xconf->reason = reason; - xconf->setat = tmp64_setat; - xconf->hold = tmp64_hold; + conf->reason = reason; + conf->setat = tmp64_setat; + conf->hold = tmp64_hold; } close_db(f); diff --git a/src/conf_parser.c b/src/conf_parser.c index ae2d2e3..68ec966 100644 --- a/src/conf_parser.c +++ b/src/conf_parser.c @@ -75,6 +75,7 @@ #include "ircd.h" #include "list.h" #include "conf.h" +#include "conf_class.h" #include "event.h" #include "log.h" #include "client.h" /* for UMODE_ALL only */ @@ -100,9 +101,7 @@ int yylex(void); static char *class_name = NULL; -static struct ConfItem *yy_conf = NULL; -static struct AccessItem *yy_aconf = NULL; -static struct MatchItem *yy_match_item = NULL; +static struct MaskItem *yy_conf = NULL; static struct ClassItem *yy_class = NULL; static char *yy_class_name = NULL; @@ -149,7 +148,7 @@ free_collect_item(struct CollectItem *item) /* Line 358 of yacc.c */ -#line 153 "conf_parser.c" +#line 152 "conf_parser.c" # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus @@ -619,14 +618,14 @@ extern int yydebug; typedef union YYSTYPE { /* Line 374 of yacc.c */ -#line 110 "conf_parser.y" +#line 109 "conf_parser.y" int number; char *string; /* Line 374 of yacc.c */ -#line 630 "conf_parser.c" +#line 629 "conf_parser.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -654,7 +653,7 @@ int yyparse (); /* Copy the second part of user declarations. */ /* Line 377 of yacc.c */ -#line 658 "conf_parser.c" +#line 657 "conf_parser.c" #ifdef short # undef short @@ -1213,69 +1212,69 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 330, 330, 331, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 359, 359, 360, 364, - 368, 372, 376, 380, 386, 386, 387, 388, 389, 390, - 397, 400, 400, 401, 401, 401, 403, 409, 416, 418, - 418, 419, 419, 420, 420, 421, 421, 422, 422, 423, - 423, 424, 424, 425, 425, 426, 427, 430, 431, 433, - 433, 434, 440, 448, 448, 449, 455, 463, 502, 561, - 589, 597, 612, 627, 636, 650, 659, 687, 717, 740, - 749, 751, 751, 752, 752, 753, 753, 755, 764, 773, - 785, 786, 786, 788, 788, 789, 791, 798, 798, 808, - 809, 811, 811, 812, 812, 814, 819, 822, 828, 827, - 833, 833, 834, 838, 842, 846, 850, 854, 858, 869, - 868, 966, 966, 967, 967, 967, 968, 968, 968, 969, - 969, 969, 971, 980, 1017, 1029, 1040, 1082, 1092, 1091, - 1097, 1097, 1098, 1102, 1106, 1110, 1114, 1118, 1122, 1126, - 1130, 1134, 1138, 1142, 1146, 1150, 1154, 1158, 1162, 1166, - 1170, 1174, 1181, 1180, 1186, 1186, 1187, 1191, 1195, 1199, - 1203, 1207, 1211, 1215, 1219, 1223, 1227, 1231, 1235, 1239, - 1243, 1247, 1251, 1255, 1259, 1270, 1269, 1319, 1319, 1320, - 1321, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, - 1330, 1331, 1331, 1332, 1334, 1343, 1349, 1355, 1361, 1367, - 1373, 1379, 1385, 1391, 1397, 1404, 1410, 1416, 1426, 1425, - 1442, 1441, 1446, 1446, 1447, 1451, 1455, 1463, 1463, 1464, - 1464, 1464, 1464, 1464, 1466, 1466, 1468, 1468, 1470, 1484, - 1504, 1513, 1526, 1525, 1594, 1594, 1595, 1595, 1595, 1595, - 1596, 1596, 1596, 1597, 1597, 1599, 1634, 1647, 1656, 1668, - 1667, 1671, 1671, 1672, 1676, 1680, 1684, 1688, 1692, 1696, - 1700, 1704, 1710, 1729, 1739, 1753, 1752, 1768, 1768, 1769, - 1769, 1769, 1769, 1771, 1780, 1795, 1808, 1810, 1810, 1811, - 1811, 1813, 1829, 1828, 1844, 1844, 1845, 1845, 1845, 1845, - 1847, 1856, 1879, 1878, 1884, 1884, 1885, 1889, 1893, 1897, - 1901, 1905, 1909, 1913, 1917, 1921, 1931, 1930, 1947, 1947, - 1948, 1948, 1948, 1950, 1957, 1956, 1962, 1962, 1963, 1967, - 1971, 1975, 1979, 1983, 1987, 1991, 1995, 1999, 2009, 2008, - 2059, 2059, 2060, 2060, 2060, 2061, 2061, 2062, 2062, 2062, - 2063, 2063, 2063, 2064, 2064, 2065, 2067, 2076, 2085, 2111, - 2129, 2147, 2153, 2157, 2166, 2165, 2169, 2169, 2170, 2174, - 2180, 2191, 2202, 2213, 2222, 2241, 2240, 2304, 2303, 2307, - 2307, 2308, 2314, 2314, 2315, 2315, 2315, 2315, 2317, 2336, - 2346, 2345, 2368, 2368, 2369, 2369, 2369, 2371, 2377, 2386, - 2388, 2388, 2389, 2389, 2391, 2410, 2409, 2457, 2456, 2460, - 2460, 2461, 2467, 2467, 2468, 2468, 2468, 2468, 2470, 2476, - 2485, 2488, 2488, 2489, 2489, 2490, 2490, 2491, 2491, 2492, - 2492, 2493, 2493, 2494, 2495, 2496, 2496, 2497, 2497, 2498, - 2498, 2499, 2499, 2500, 2500, 2501, 2501, 2502, 2503, 2503, - 2504, 2504, 2505, 2505, 2506, 2506, 2507, 2507, 2508, 2509, - 2509, 2510, 2511, 2512, 2512, 2513, 2513, 2514, 2515, 2516, - 2517, 2517, 2518, 2521, 2526, 2532, 2538, 2544, 2549, 2554, - 2559, 2564, 2569, 2574, 2579, 2584, 2589, 2594, 2599, 2604, - 2609, 2614, 2620, 2631, 2636, 2641, 2646, 2651, 2656, 2659, - 2664, 2667, 2672, 2677, 2682, 2687, 2692, 2697, 2702, 2707, - 2712, 2723, 2728, 2733, 2738, 2747, 2756, 2761, 2766, 2772, - 2771, 2776, 2776, 2777, 2780, 2783, 2786, 2789, 2792, 2795, - 2798, 2801, 2804, 2807, 2810, 2813, 2816, 2819, 2822, 2825, - 2828, 2831, 2834, 2840, 2839, 2844, 2844, 2845, 2848, 2851, - 2854, 2857, 2860, 2863, 2866, 2869, 2872, 2875, 2878, 2881, - 2884, 2887, 2890, 2893, 2896, 2899, 2902, 2907, 2912, 2917, - 2926, 2929, 2929, 2930, 2931, 2931, 2932, 2932, 2933, 2933, - 2934, 2935, 2935, 2936, 2937, 2937, 2938, 2938, 2940, 2945, - 2950, 2955, 2960, 2965, 2970, 2975, 2980, 2985, 2990, 2995, - 3000, 3005, 3013, 3016, 3016, 3017, 3017, 3018, 3019, 3019, - 3020, 3021, 3023, 3029, 3035, 3044, 3058, 3064 + 0, 329, 329, 330, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, 352, 353, 354, 358, 358, 359, 363, + 367, 371, 375, 379, 385, 385, 386, 387, 388, 389, + 396, 399, 399, 400, 400, 400, 402, 408, 415, 417, + 417, 418, 418, 419, 419, 420, 420, 421, 421, 422, + 422, 423, 423, 424, 424, 425, 426, 429, 430, 432, + 432, 433, 439, 447, 447, 448, 454, 462, 501, 560, + 588, 596, 611, 626, 635, 649, 658, 686, 716, 739, + 748, 750, 750, 751, 751, 752, 752, 754, 763, 772, + 784, 785, 785, 787, 787, 788, 790, 797, 797, 807, + 808, 810, 810, 811, 811, 813, 818, 821, 827, 826, + 832, 832, 833, 837, 841, 845, 849, 853, 857, 868, + 867, 959, 959, 960, 960, 960, 961, 961, 961, 962, + 962, 962, 964, 973, 1010, 1022, 1033, 1075, 1085, 1084, + 1090, 1090, 1091, 1095, 1099, 1103, 1107, 1111, 1115, 1119, + 1123, 1127, 1131, 1135, 1139, 1143, 1147, 1151, 1155, 1159, + 1163, 1167, 1174, 1173, 1179, 1179, 1180, 1184, 1188, 1192, + 1196, 1200, 1204, 1208, 1212, 1216, 1220, 1224, 1228, 1232, + 1236, 1240, 1244, 1248, 1252, 1263, 1262, 1308, 1308, 1309, + 1310, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, + 1319, 1320, 1320, 1321, 1323, 1332, 1338, 1344, 1350, 1356, + 1362, 1368, 1374, 1380, 1386, 1393, 1399, 1405, 1415, 1414, + 1431, 1430, 1435, 1435, 1436, 1440, 1444, 1452, 1452, 1453, + 1453, 1453, 1453, 1453, 1455, 1455, 1457, 1457, 1459, 1473, + 1493, 1502, 1515, 1514, 1577, 1577, 1578, 1578, 1578, 1578, + 1579, 1579, 1579, 1580, 1580, 1582, 1617, 1630, 1639, 1651, + 1650, 1654, 1654, 1655, 1659, 1663, 1667, 1671, 1675, 1679, + 1683, 1687, 1693, 1712, 1722, 1736, 1735, 1751, 1751, 1752, + 1752, 1752, 1752, 1754, 1763, 1778, 1791, 1793, 1793, 1794, + 1794, 1796, 1812, 1811, 1826, 1826, 1827, 1827, 1827, 1827, + 1829, 1838, 1861, 1860, 1866, 1866, 1867, 1871, 1875, 1879, + 1883, 1887, 1891, 1895, 1899, 1903, 1913, 1912, 1928, 1928, + 1929, 1929, 1929, 1931, 1938, 1937, 1943, 1943, 1944, 1948, + 1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1990, 1989, + 2038, 2038, 2039, 2039, 2039, 2040, 2040, 2041, 2041, 2041, + 2042, 2042, 2042, 2043, 2043, 2044, 2046, 2055, 2064, 2090, + 2108, 2126, 2132, 2136, 2145, 2144, 2148, 2148, 2149, 2153, + 2159, 2170, 2181, 2192, 2201, 2220, 2219, 2283, 2282, 2286, + 2286, 2287, 2293, 2293, 2294, 2294, 2294, 2294, 2296, 2315, + 2325, 2324, 2347, 2347, 2348, 2348, 2348, 2350, 2356, 2365, + 2367, 2367, 2368, 2368, 2370, 2389, 2388, 2435, 2434, 2438, + 2438, 2439, 2445, 2445, 2446, 2446, 2446, 2446, 2448, 2454, + 2463, 2466, 2466, 2467, 2467, 2468, 2468, 2469, 2469, 2470, + 2470, 2471, 2471, 2472, 2473, 2474, 2474, 2475, 2475, 2476, + 2476, 2477, 2477, 2478, 2478, 2479, 2479, 2480, 2481, 2481, + 2482, 2482, 2483, 2483, 2484, 2484, 2485, 2485, 2486, 2487, + 2487, 2488, 2489, 2490, 2490, 2491, 2491, 2492, 2493, 2494, + 2495, 2495, 2496, 2499, 2504, 2510, 2516, 2522, 2527, 2532, + 2537, 2542, 2547, 2552, 2557, 2562, 2567, 2572, 2577, 2582, + 2587, 2592, 2598, 2609, 2614, 2619, 2624, 2629, 2634, 2637, + 2642, 2645, 2650, 2655, 2660, 2665, 2670, 2675, 2680, 2685, + 2690, 2701, 2706, 2711, 2716, 2725, 2734, 2739, 2744, 2750, + 2749, 2754, 2754, 2755, 2758, 2761, 2764, 2767, 2770, 2773, + 2776, 2779, 2782, 2785, 2788, 2791, 2794, 2797, 2800, 2803, + 2806, 2809, 2812, 2818, 2817, 2822, 2822, 2823, 2826, 2829, + 2832, 2835, 2838, 2841, 2844, 2847, 2850, 2853, 2856, 2859, + 2862, 2865, 2868, 2871, 2874, 2877, 2880, 2885, 2890, 2895, + 2904, 2907, 2907, 2908, 2909, 2909, 2910, 2910, 2911, 2911, + 2912, 2913, 2913, 2914, 2915, 2915, 2916, 2916, 2918, 2923, + 2928, 2933, 2938, 2943, 2948, 2953, 2958, 2963, 2968, 2973, + 2978, 2983, 2991, 2994, 2994, 2995, 2995, 2996, 2997, 2997, + 2998, 2999, 3001, 3007, 3013, 3022, 3036, 3042 }; #endif @@ -3139,13 +3138,13 @@ yyreduce: { case 26: /* Line 1813 of yacc.c */ -#line 359 "conf_parser.y" +#line 358 "conf_parser.y" { (yyval.number) = 0; } break; case 28: /* Line 1813 of yacc.c */ -#line 361 "conf_parser.y" +#line 360 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (2)].number) + (yyvsp[(2) - (2)].number); } @@ -3153,7 +3152,7 @@ yyreduce: case 29: /* Line 1813 of yacc.c */ -#line 365 "conf_parser.y" +#line 364 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (3)].number) + (yyvsp[(3) - (3)].number); } @@ -3161,7 +3160,7 @@ yyreduce: case 30: /* Line 1813 of yacc.c */ -#line 369 "conf_parser.y" +#line 368 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (3)].number) * 60 + (yyvsp[(3) - (3)].number); } @@ -3169,7 +3168,7 @@ yyreduce: case 31: /* Line 1813 of yacc.c */ -#line 373 "conf_parser.y" +#line 372 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (3)].number) * 60 * 60 + (yyvsp[(3) - (3)].number); } @@ -3177,7 +3176,7 @@ yyreduce: case 32: /* Line 1813 of yacc.c */ -#line 377 "conf_parser.y" +#line 376 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (3)].number) * 60 * 60 * 24 + (yyvsp[(3) - (3)].number); } @@ -3185,7 +3184,7 @@ yyreduce: case 33: /* Line 1813 of yacc.c */ -#line 381 "conf_parser.y" +#line 380 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (3)].number) * 60 * 60 * 24 * 7 + (yyvsp[(3) - (3)].number); } @@ -3193,37 +3192,37 @@ yyreduce: case 34: /* Line 1813 of yacc.c */ -#line 386 "conf_parser.y" +#line 385 "conf_parser.y" { (yyval.number) = 0; } break; case 36: /* Line 1813 of yacc.c */ -#line 387 "conf_parser.y" +#line 386 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (2)].number) + (yyvsp[(2) - (2)].number); } break; case 37: /* Line 1813 of yacc.c */ -#line 388 "conf_parser.y" +#line 387 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (3)].number) + (yyvsp[(3) - (3)].number); } break; case 38: /* Line 1813 of yacc.c */ -#line 389 "conf_parser.y" +#line 388 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (3)].number) * 1024 + (yyvsp[(3) - (3)].number); } break; case 39: /* Line 1813 of yacc.c */ -#line 390 "conf_parser.y" +#line 389 "conf_parser.y" { (yyval.number) = (yyvsp[(1) - (3)].number) * 1024 * 1024 + (yyvsp[(3) - (3)].number); } break; case 46: /* Line 1813 of yacc.c */ -#line 404 "conf_parser.y" +#line 403 "conf_parser.y" { if (conf_parser_ctx.pass == 2) add_conf_module(libio_basename(yylval.string)); @@ -3232,7 +3231,7 @@ yyreduce: case 47: /* Line 1813 of yacc.c */ -#line 410 "conf_parser.y" +#line 409 "conf_parser.y" { if (conf_parser_ctx.pass == 2) mod_add_path(yylval.string); @@ -3241,7 +3240,7 @@ yyreduce: case 71: /* Line 1813 of yacc.c */ -#line 435 "conf_parser.y" +#line 434 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx) @@ -3252,7 +3251,7 @@ yyreduce: case 72: /* Line 1813 of yacc.c */ -#line 441 "conf_parser.y" +#line 440 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx) @@ -3263,7 +3262,7 @@ yyreduce: case 75: /* Line 1813 of yacc.c */ -#line 450 "conf_parser.y" +#line 449 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) @@ -3274,7 +3273,7 @@ yyreduce: case 76: /* Line 1813 of yacc.c */ -#line 456 "conf_parser.y" +#line 455 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) @@ -3285,7 +3284,7 @@ yyreduce: case 77: /* Line 1813 of yacc.c */ -#line 464 "conf_parser.y" +#line 463 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) @@ -3327,7 +3326,7 @@ yyreduce: case 78: /* Line 1813 of yacc.c */ -#line 503 "conf_parser.y" +#line 502 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 1) @@ -3389,7 +3388,7 @@ yyreduce: case 79: /* Line 1813 of yacc.c */ -#line 562 "conf_parser.y" +#line 561 "conf_parser.y" { /* TBD - XXX: error reporting */ #ifdef HAVE_LIBCRYPTO @@ -3420,7 +3419,7 @@ yyreduce: case 80: /* Line 1813 of yacc.c */ -#line 590 "conf_parser.y" +#line 589 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) @@ -3431,7 +3430,7 @@ yyreduce: case 81: /* Line 1813 of yacc.c */ -#line 598 "conf_parser.y" +#line 597 "conf_parser.y" { /* this isn't rehashable */ if (conf_parser_ctx.pass == 2 && !ServerInfo.name) @@ -3449,7 +3448,7 @@ yyreduce: case 82: /* Line 1813 of yacc.c */ -#line 613 "conf_parser.y" +#line 612 "conf_parser.y" { /* this isn't rehashable */ if (conf_parser_ctx.pass == 2 && !ServerInfo.sid) @@ -3467,7 +3466,7 @@ yyreduce: case 83: /* Line 1813 of yacc.c */ -#line 628 "conf_parser.y" +#line 627 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3479,7 +3478,7 @@ yyreduce: case 84: /* Line 1813 of yacc.c */ -#line 637 "conf_parser.y" +#line 636 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3496,7 +3495,7 @@ yyreduce: case 85: /* Line 1813 of yacc.c */ -#line 651 "conf_parser.y" +#line 650 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3508,7 +3507,7 @@ yyreduce: case 86: /* Line 1813 of yacc.c */ -#line 660 "conf_parser.y" +#line 659 "conf_parser.y" { if (conf_parser_ctx.pass == 2 && *yylval.string != '*') { @@ -3539,7 +3538,7 @@ yyreduce: case 87: /* Line 1813 of yacc.c */ -#line 688 "conf_parser.y" +#line 687 "conf_parser.y" { #ifdef IPV6 if (conf_parser_ctx.pass == 2 && *yylval.string != '*') @@ -3572,7 +3571,7 @@ yyreduce: case 88: /* Line 1813 of yacc.c */ -#line 718 "conf_parser.y" +#line 717 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3598,7 +3597,7 @@ yyreduce: case 89: /* Line 1813 of yacc.c */ -#line 741 "conf_parser.y" +#line 740 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ServerInfo.hub = yylval.number; @@ -3607,7 +3606,7 @@ yyreduce: case 97: /* Line 1813 of yacc.c */ -#line 756 "conf_parser.y" +#line 755 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3619,7 +3618,7 @@ yyreduce: case 98: /* Line 1813 of yacc.c */ -#line 765 "conf_parser.y" +#line 764 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3631,7 +3630,7 @@ yyreduce: case 99: /* Line 1813 of yacc.c */ -#line 774 "conf_parser.y" +#line 773 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3643,7 +3642,7 @@ yyreduce: case 106: /* Line 1813 of yacc.c */ -#line 792 "conf_parser.y" +#line 791 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigLoggingEntry.use_logging = yylval.number; @@ -3652,7 +3651,7 @@ yyreduce: case 107: /* Line 1813 of yacc.c */ -#line 798 "conf_parser.y" +#line 797 "conf_parser.y" { lfile[0] = '\0'; ltype = 0; @@ -3662,7 +3661,7 @@ yyreduce: case 108: /* Line 1813 of yacc.c */ -#line 803 "conf_parser.y" +#line 802 "conf_parser.y" { if (conf_parser_ctx.pass == 2 && ltype > 0) log_add_file(ltype, lsize, lfile); @@ -3671,7 +3670,7 @@ yyreduce: case 115: /* Line 1813 of yacc.c */ -#line 815 "conf_parser.y" +#line 814 "conf_parser.y" { strlcpy(lfile, yylval.string, sizeof(lfile)); } @@ -3679,7 +3678,7 @@ yyreduce: case 116: /* Line 1813 of yacc.c */ -#line 820 "conf_parser.y" +#line 819 "conf_parser.y" { lsize = (yyvsp[(3) - (4)].number); } @@ -3687,7 +3686,7 @@ yyreduce: case 117: /* Line 1813 of yacc.c */ -#line 823 "conf_parser.y" +#line 822 "conf_parser.y" { lsize = 0; } @@ -3695,7 +3694,7 @@ yyreduce: case 118: /* Line 1813 of yacc.c */ -#line 828 "conf_parser.y" +#line 827 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ltype = 0; @@ -3704,7 +3703,7 @@ yyreduce: case 122: /* Line 1813 of yacc.c */ -#line 835 "conf_parser.y" +#line 834 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ltype = LOG_TYPE_USER; @@ -3713,7 +3712,7 @@ yyreduce: case 123: /* Line 1813 of yacc.c */ -#line 839 "conf_parser.y" +#line 838 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ltype = LOG_TYPE_OPER; @@ -3722,7 +3721,7 @@ yyreduce: case 124: /* Line 1813 of yacc.c */ -#line 843 "conf_parser.y" +#line 842 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ltype = LOG_TYPE_GLINE; @@ -3731,7 +3730,7 @@ yyreduce: case 125: /* Line 1813 of yacc.c */ -#line 847 "conf_parser.y" +#line 846 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ltype = LOG_TYPE_DLINE; @@ -3740,7 +3739,7 @@ yyreduce: case 126: /* Line 1813 of yacc.c */ -#line 851 "conf_parser.y" +#line 850 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ltype = LOG_TYPE_KLINE; @@ -3749,7 +3748,7 @@ yyreduce: case 127: /* Line 1813 of yacc.c */ -#line 855 "conf_parser.y" +#line 854 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ltype = LOG_TYPE_KILL; @@ -3758,7 +3757,7 @@ yyreduce: case 128: /* Line 1813 of yacc.c */ -#line 859 "conf_parser.y" +#line 858 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ltype = LOG_TYPE_DEBUG; @@ -3767,13 +3766,12 @@ yyreduce: case 129: /* Line 1813 of yacc.c */ -#line 869 "conf_parser.y" +#line 868 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(OPER_TYPE); - yy_aconf = map_to_conf(yy_conf); - SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */ + yy_conf = conf_make(CONF_OPER); + SetConfEncrypted(yy_conf); /* Yes, the default is encrypted */ } else { @@ -3785,7 +3783,7 @@ yyreduce: case 130: /* Line 1813 of yacc.c */ -#line 882 "conf_parser.y" +#line 880 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3801,44 +3799,41 @@ yyreduce: DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) { - struct AccessItem *new_aconf; - struct ConfItem *new_conf; + struct MaskItem *new_conf; yy_tmp = ptr->data; - new_conf = make_conf_item(OPER_TYPE); - new_aconf = (struct AccessItem *)map_to_conf(new_conf); - - new_aconf->flags = yy_aconf->flags; + new_conf = conf_make(CONF_OPER); + new_conf->flags = yy_conf->flags; if (yy_conf->name != NULL) DupString(new_conf->name, yy_conf->name); if (yy_tmp->user != NULL) - DupString(new_aconf->user, yy_tmp->user); + DupString(new_conf->user, yy_tmp->user); else - DupString(new_aconf->user, "*"); + DupString(new_conf->user, "*"); if (yy_tmp->host != NULL) - DupString(new_aconf->host, yy_tmp->host); + DupString(new_conf->host, yy_tmp->host); else - DupString(new_aconf->host, "*"); + DupString(new_conf->host, "*"); - new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->addr, - &new_aconf->bits); + new_conf->htype = parse_netmask(new_conf->host, &new_conf->addr, + &new_conf->bits); conf_add_class_to_conf(new_conf, class_name); - if (yy_aconf->passwd != NULL) - DupString(new_aconf->passwd, yy_aconf->passwd); + if (yy_conf->passwd != NULL) + DupString(new_conf->passwd, yy_conf->passwd); - new_aconf->port = yy_aconf->port; + new_conf->port = yy_conf->port; #ifdef HAVE_LIBCRYPTO - if (yy_aconf->rsa_public_key_file != NULL) + if (yy_conf->rsa_public_key_file != NULL) { BIO *file; - DupString(new_aconf->rsa_public_key_file, - yy_aconf->rsa_public_key_file); + DupString(new_conf->rsa_public_key_file, + yy_conf->rsa_public_key_file); - file = BIO_new_file(yy_aconf->rsa_public_key_file, "r"); - new_aconf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, + file = BIO_new_file(yy_conf->rsa_public_key_file, "r"); + new_conf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); BIO_set_close(file, BIO_CLOSE); BIO_free(file); @@ -3846,7 +3841,7 @@ yyreduce: #endif #ifdef HAVE_LIBCRYPTO - if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key) + if (yy_tmp->name && (yy_tmp->passwd || yy_conf->rsa_public_key) && yy_tmp->host) #else if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host) @@ -3862,8 +3857,6 @@ yyreduce: } yy_conf = NULL; - yy_aconf = NULL; - MyFree(class_name); class_name = NULL; @@ -3873,7 +3866,7 @@ yyreduce: case 142: /* Line 1813 of yacc.c */ -#line 972 "conf_parser.y" +#line 965 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3885,7 +3878,7 @@ yyreduce: case 143: /* Line 1813 of yacc.c */ -#line 981 "conf_parser.y" +#line 974 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -3902,13 +3895,13 @@ yyreduce: split_nuh(&nuh); - if (yy_aconf->user == NULL) + if (yy_conf->user == NULL) { - DupString(yy_aconf->user, userbuf); - DupString(yy_aconf->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); - yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->addr, - &yy_aconf->bits); + yy_conf->htype = parse_netmask(yy_conf->host, &yy_conf->addr, + &yy_conf->bits); } else { @@ -3925,55 +3918,55 @@ yyreduce: case 144: /* Line 1813 of yacc.c */ -#line 1018 "conf_parser.y" +#line 1011 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - if (yy_aconf->passwd != NULL) - memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); + if (yy_conf->passwd != NULL) + memset(yy_conf->passwd, 0, strlen(yy_conf->passwd)); - MyFree(yy_aconf->passwd); - DupString(yy_aconf->passwd, yylval.string); + MyFree(yy_conf->passwd); + DupString(yy_conf->passwd, yylval.string); } } break; case 145: /* Line 1813 of yacc.c */ -#line 1030 "conf_parser.y" +#line 1023 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { if (yylval.number) - SetConfEncrypted(yy_aconf); + SetConfEncrypted(yy_conf); else - ClearConfEncrypted(yy_aconf); + ClearConfEncrypted(yy_conf); } } break; case 146: /* Line 1813 of yacc.c */ -#line 1041 "conf_parser.y" +#line 1034 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2) { BIO *file; - if (yy_aconf->rsa_public_key != NULL) + if (yy_conf->rsa_public_key != NULL) { - RSA_free(yy_aconf->rsa_public_key); - yy_aconf->rsa_public_key = NULL; + RSA_free(yy_conf->rsa_public_key); + yy_conf->rsa_public_key = NULL; } - if (yy_aconf->rsa_public_key_file != NULL) + if (yy_conf->rsa_public_key_file != NULL) { - MyFree(yy_aconf->rsa_public_key_file); - yy_aconf->rsa_public_key_file = NULL; + MyFree(yy_conf->rsa_public_key_file); + yy_conf->rsa_public_key_file = NULL; } - DupString(yy_aconf->rsa_public_key_file, yylval.string); + DupString(yy_conf->rsa_public_key_file, yylval.string); file = BIO_new_file(yylval.string, "r"); if (file == NULL) @@ -3982,9 +3975,9 @@ yyreduce: break; } - yy_aconf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); + yy_conf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); - if (yy_aconf->rsa_public_key == NULL) + if (yy_conf->rsa_public_key == NULL) { yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax."); break; @@ -3999,7 +3992,7 @@ yyreduce: case 147: /* Line 1813 of yacc.c */ -#line 1083 "conf_parser.y" +#line 1076 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4011,422 +4004,418 @@ yyreduce: case 148: /* Line 1813 of yacc.c */ -#line 1092 "conf_parser.y" +#line 1085 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes = 0; + yy_conf->modes = 0; } break; case 152: /* Line 1813 of yacc.c */ -#line 1099 "conf_parser.y" +#line 1092 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_BOTS; + yy_conf->modes |= UMODE_BOTS; } break; case 153: /* Line 1813 of yacc.c */ -#line 1103 "conf_parser.y" +#line 1096 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_CCONN; + yy_conf->modes |= UMODE_CCONN; } break; case 154: /* Line 1813 of yacc.c */ -#line 1107 "conf_parser.y" +#line 1100 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_CCONN_FULL; + yy_conf->modes |= UMODE_CCONN_FULL; } break; case 155: /* Line 1813 of yacc.c */ -#line 1111 "conf_parser.y" +#line 1104 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_DEAF; + yy_conf->modes |= UMODE_DEAF; } break; case 156: /* Line 1813 of yacc.c */ -#line 1115 "conf_parser.y" +#line 1108 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_DEBUG; + yy_conf->modes |= UMODE_DEBUG; } break; case 157: /* Line 1813 of yacc.c */ -#line 1119 "conf_parser.y" +#line 1112 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_FULL; + yy_conf->modes |= UMODE_FULL; } break; case 158: /* Line 1813 of yacc.c */ -#line 1123 "conf_parser.y" +#line 1116 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_HIDDEN; + yy_conf->modes |= UMODE_HIDDEN; } break; case 159: /* Line 1813 of yacc.c */ -#line 1127 "conf_parser.y" +#line 1120 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_SKILL; + yy_conf->modes |= UMODE_SKILL; } break; case 160: /* Line 1813 of yacc.c */ -#line 1131 "conf_parser.y" +#line 1124 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_NCHANGE; + yy_conf->modes |= UMODE_NCHANGE; } break; case 161: /* Line 1813 of yacc.c */ -#line 1135 "conf_parser.y" +#line 1128 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_REJ; + yy_conf->modes |= UMODE_REJ; } break; case 162: /* Line 1813 of yacc.c */ -#line 1139 "conf_parser.y" +#line 1132 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_UNAUTH; + yy_conf->modes |= UMODE_UNAUTH; } break; case 163: /* Line 1813 of yacc.c */ -#line 1143 "conf_parser.y" +#line 1136 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_SPY; + yy_conf->modes |= UMODE_SPY; } break; case 164: /* Line 1813 of yacc.c */ -#line 1147 "conf_parser.y" +#line 1140 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_EXTERNAL; + yy_conf->modes |= UMODE_EXTERNAL; } break; case 165: /* Line 1813 of yacc.c */ -#line 1151 "conf_parser.y" +#line 1144 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_OPERWALL; + yy_conf->modes |= UMODE_OPERWALL; } break; case 166: /* Line 1813 of yacc.c */ -#line 1155 "conf_parser.y" +#line 1148 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_SERVNOTICE; + yy_conf->modes |= UMODE_SERVNOTICE; } break; case 167: /* Line 1813 of yacc.c */ -#line 1159 "conf_parser.y" +#line 1152 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_INVISIBLE; + yy_conf->modes |= UMODE_INVISIBLE; } break; case 168: /* Line 1813 of yacc.c */ -#line 1163 "conf_parser.y" +#line 1156 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_WALLOP; + yy_conf->modes |= UMODE_WALLOP; } break; case 169: /* Line 1813 of yacc.c */ -#line 1167 "conf_parser.y" +#line 1160 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_SOFTCALLERID; + yy_conf->modes |= UMODE_SOFTCALLERID; } break; case 170: /* Line 1813 of yacc.c */ -#line 1171 "conf_parser.y" +#line 1164 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_CALLERID; + yy_conf->modes |= UMODE_CALLERID; } break; case 171: /* Line 1813 of yacc.c */ -#line 1175 "conf_parser.y" +#line 1168 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_LOCOPS; + yy_conf->modes |= UMODE_LOCOPS; } break; case 172: /* Line 1813 of yacc.c */ -#line 1181 "conf_parser.y" +#line 1174 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port = 0; + yy_conf->port = 0; } break; case 176: /* Line 1813 of yacc.c */ -#line 1188 "conf_parser.y" +#line 1181 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_GLOBAL_KILL; + yy_conf->port |= OPER_FLAG_GLOBAL_KILL; } break; case 177: /* Line 1813 of yacc.c */ -#line 1192 "conf_parser.y" +#line 1185 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_REMOTE; + yy_conf->port |= OPER_FLAG_REMOTE; } break; case 178: /* Line 1813 of yacc.c */ -#line 1196 "conf_parser.y" +#line 1189 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_K; + yy_conf->port |= OPER_FLAG_K; } break; case 179: /* Line 1813 of yacc.c */ -#line 1200 "conf_parser.y" +#line 1193 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_UNKLINE; + yy_conf->port |= OPER_FLAG_UNKLINE; } break; case 180: /* Line 1813 of yacc.c */ -#line 1204 "conf_parser.y" +#line 1197 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_DLINE; + yy_conf->port |= OPER_FLAG_DLINE; } break; case 181: /* Line 1813 of yacc.c */ -#line 1208 "conf_parser.y" +#line 1201 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_UNDLINE; + yy_conf->port |= OPER_FLAG_UNDLINE; } break; case 182: /* Line 1813 of yacc.c */ -#line 1212 "conf_parser.y" +#line 1205 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_X; + yy_conf->port |= OPER_FLAG_X; } break; case 183: /* Line 1813 of yacc.c */ -#line 1216 "conf_parser.y" +#line 1209 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_GLINE; + yy_conf->port |= OPER_FLAG_GLINE; } break; case 184: /* Line 1813 of yacc.c */ -#line 1220 "conf_parser.y" +#line 1213 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_DIE; + yy_conf->port |= OPER_FLAG_DIE; } break; case 185: /* Line 1813 of yacc.c */ -#line 1224 "conf_parser.y" +#line 1217 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_RESTART; + yy_conf->port |= OPER_FLAG_RESTART; } break; case 186: /* Line 1813 of yacc.c */ -#line 1228 "conf_parser.y" +#line 1221 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_REHASH; + yy_conf->port |= OPER_FLAG_REHASH; } break; case 187: /* Line 1813 of yacc.c */ -#line 1232 "conf_parser.y" +#line 1225 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_ADMIN; + yy_conf->port |= OPER_FLAG_ADMIN; } break; case 188: /* Line 1813 of yacc.c */ -#line 1236 "conf_parser.y" +#line 1229 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_N; + yy_conf->port |= OPER_FLAG_N; } break; case 189: /* Line 1813 of yacc.c */ -#line 1240 "conf_parser.y" +#line 1233 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_OPERWALL; + yy_conf->port |= OPER_FLAG_OPERWALL; } break; case 190: /* Line 1813 of yacc.c */ -#line 1244 "conf_parser.y" +#line 1237 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_GLOBOPS; + yy_conf->port |= OPER_FLAG_GLOBOPS; } break; case 191: /* Line 1813 of yacc.c */ -#line 1248 "conf_parser.y" +#line 1241 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_OPER_SPY; + yy_conf->port |= OPER_FLAG_OPER_SPY; } break; case 192: /* Line 1813 of yacc.c */ -#line 1252 "conf_parser.y" +#line 1245 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_REMOTEBAN; + yy_conf->port |= OPER_FLAG_REMOTEBAN; } break; case 193: /* Line 1813 of yacc.c */ -#line 1256 "conf_parser.y" +#line 1249 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_SET; + yy_conf->port |= OPER_FLAG_SET; } break; case 194: /* Line 1813 of yacc.c */ -#line 1260 "conf_parser.y" +#line 1253 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_MODULE; + yy_conf->port |= OPER_FLAG_MODULE; } break; case 195: /* Line 1813 of yacc.c */ -#line 1270 "conf_parser.y" +#line 1263 "conf_parser.y" { if (conf_parser_ctx.pass == 1) { - yy_conf = make_conf_item(CLASS_TYPE); - yy_class = map_to_conf(yy_conf); + yy_class = class_make(); } } break; case 196: /* Line 1813 of yacc.c */ -#line 1277 "conf_parser.y" +#line 1269 "conf_parser.y" { if (conf_parser_ctx.pass == 1) { - struct ConfItem *cconf = NULL; struct ClassItem *class = NULL; if (yy_class_name == NULL) - delete_conf_item(yy_conf); + class_free(yy_class); else { - cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL); + class = class_find(yy_class_name, 0); - if (cconf != NULL) /* The class existed already */ + if (class != NULL) /* The class existed already */ { int user_count = 0; - rebuild_cidr_class(cconf, yy_class); - - class = map_to_conf(cconf); + rebuild_cidr_class(class, yy_class); - user_count = class->curr_user_count; + user_count = class->ref_count; memcpy(class, yy_class, sizeof(*class)); - class->curr_user_count = user_count; + class->ref_count = user_count; class->active = 1; - delete_conf_item(yy_conf); + class_free(yy_class); - MyFree(cconf->name); /* Allows case change of class name */ - cconf->name = yy_class_name; + MyFree(class->name); /* Allows case change of class name */ + class->name = yy_class_name; } else /* Brand new class */ { - MyFree(yy_conf->name); /* just in case it was allocated */ - yy_conf->name = yy_class_name; + MyFree(yy_class->name); /* just in case it was allocated */ + yy_class->name = yy_class_name; yy_class->active = 1; } } @@ -4438,7 +4427,7 @@ yyreduce: case 214: /* Line 1813 of yacc.c */ -#line 1335 "conf_parser.y" +#line 1324 "conf_parser.y" { if (conf_parser_ctx.pass == 1) { @@ -4450,7 +4439,7 @@ yyreduce: case 215: /* Line 1813 of yacc.c */ -#line 1344 "conf_parser.y" +#line 1333 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->ping_freq = (yyvsp[(3) - (4)].number); @@ -4459,7 +4448,7 @@ yyreduce: case 216: /* Line 1813 of yacc.c */ -#line 1350 "conf_parser.y" +#line 1339 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->ping_warning = (yyvsp[(3) - (4)].number); @@ -4468,7 +4457,7 @@ yyreduce: case 217: /* Line 1813 of yacc.c */ -#line 1356 "conf_parser.y" +#line 1345 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->max_perip = (yyvsp[(3) - (4)].number); @@ -4477,7 +4466,7 @@ yyreduce: case 218: /* Line 1813 of yacc.c */ -#line 1362 "conf_parser.y" +#line 1351 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->con_freq = (yyvsp[(3) - (4)].number); @@ -4486,7 +4475,7 @@ yyreduce: case 219: /* Line 1813 of yacc.c */ -#line 1368 "conf_parser.y" +#line 1357 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->max_total = (yyvsp[(3) - (4)].number); @@ -4495,7 +4484,7 @@ yyreduce: case 220: /* Line 1813 of yacc.c */ -#line 1374 "conf_parser.y" +#line 1363 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->max_global = (yyvsp[(3) - (4)].number); @@ -4504,7 +4493,7 @@ yyreduce: case 221: /* Line 1813 of yacc.c */ -#line 1380 "conf_parser.y" +#line 1369 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->max_local = (yyvsp[(3) - (4)].number); @@ -4513,7 +4502,7 @@ yyreduce: case 222: /* Line 1813 of yacc.c */ -#line 1386 "conf_parser.y" +#line 1375 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->max_ident = (yyvsp[(3) - (4)].number); @@ -4522,7 +4511,7 @@ yyreduce: case 223: /* Line 1813 of yacc.c */ -#line 1392 "conf_parser.y" +#line 1381 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->max_sendq = (yyvsp[(3) - (4)].number); @@ -4531,7 +4520,7 @@ yyreduce: case 224: /* Line 1813 of yacc.c */ -#line 1398 "conf_parser.y" +#line 1387 "conf_parser.y" { if (conf_parser_ctx.pass == 1) if ((yyvsp[(3) - (4)].number) >= CLIENT_FLOOD_MIN && (yyvsp[(3) - (4)].number) <= CLIENT_FLOOD_MAX) @@ -4541,7 +4530,7 @@ yyreduce: case 225: /* Line 1813 of yacc.c */ -#line 1405 "conf_parser.y" +#line 1394 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->cidr_bitlen_ipv4 = (yyvsp[(3) - (4)].number) > 32 ? 32 : (yyvsp[(3) - (4)].number); @@ -4550,7 +4539,7 @@ yyreduce: case 226: /* Line 1813 of yacc.c */ -#line 1411 "conf_parser.y" +#line 1400 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->cidr_bitlen_ipv6 = (yyvsp[(3) - (4)].number) > 128 ? 128 : (yyvsp[(3) - (4)].number); @@ -4559,7 +4548,7 @@ yyreduce: case 227: /* Line 1813 of yacc.c */ -#line 1417 "conf_parser.y" +#line 1406 "conf_parser.y" { if (conf_parser_ctx.pass == 1) yy_class->number_per_cidr = (yyvsp[(3) - (4)].number); @@ -4568,7 +4557,7 @@ yyreduce: case 228: /* Line 1813 of yacc.c */ -#line 1426 "conf_parser.y" +#line 1415 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4580,7 +4569,7 @@ yyreduce: case 229: /* Line 1813 of yacc.c */ -#line 1433 "conf_parser.y" +#line 1422 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4592,7 +4581,7 @@ yyreduce: case 230: /* Line 1813 of yacc.c */ -#line 1442 "conf_parser.y" +#line 1431 "conf_parser.y" { listener_flags = 0; } @@ -4600,7 +4589,7 @@ yyreduce: case 234: /* Line 1813 of yacc.c */ -#line 1448 "conf_parser.y" +#line 1437 "conf_parser.y" { if (conf_parser_ctx.pass == 2) listener_flags |= LISTENER_SSL; @@ -4609,7 +4598,7 @@ yyreduce: case 235: /* Line 1813 of yacc.c */ -#line 1452 "conf_parser.y" +#line 1441 "conf_parser.y" { if (conf_parser_ctx.pass == 2) listener_flags |= LISTENER_HIDDEN; @@ -4618,7 +4607,7 @@ yyreduce: case 236: /* Line 1813 of yacc.c */ -#line 1456 "conf_parser.y" +#line 1445 "conf_parser.y" { if (conf_parser_ctx.pass == 2) listener_flags |= LISTENER_SERVER; @@ -4627,13 +4616,13 @@ yyreduce: case 244: /* Line 1813 of yacc.c */ -#line 1466 "conf_parser.y" +#line 1455 "conf_parser.y" { listener_flags = 0; } break; case 248: /* Line 1813 of yacc.c */ -#line 1471 "conf_parser.y" +#line 1460 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4652,7 +4641,7 @@ yyreduce: case 249: /* Line 1813 of yacc.c */ -#line 1485 "conf_parser.y" +#line 1474 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4675,7 +4664,7 @@ yyreduce: case 250: /* Line 1813 of yacc.c */ -#line 1505 "conf_parser.y" +#line 1494 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4687,7 +4676,7 @@ yyreduce: case 251: /* Line 1813 of yacc.c */ -#line 1514 "conf_parser.y" +#line 1503 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4699,12 +4688,11 @@ yyreduce: case 252: /* Line 1813 of yacc.c */ -#line 1526 "conf_parser.y" +#line 1515 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(CLIENT_TYPE); - yy_aconf = map_to_conf(yy_conf); + yy_conf = conf_make(CONF_CLIENT); } else { @@ -4716,52 +4704,48 @@ yyreduce: case 253: /* Line 1813 of yacc.c */ -#line 1538 "conf_parser.y" +#line 1526 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { struct CollectItem *yy_tmp = NULL; dlink_node *ptr = NULL, *next_ptr = NULL; - if (yy_aconf->user && yy_aconf->host) + if (yy_conf->user && yy_conf->host) { conf_add_class_to_conf(yy_conf, class_name); - add_conf_by_address(CONF_CLIENT, yy_aconf); + add_conf_by_address(CONF_CLIENT, yy_conf); } else - delete_conf_item(yy_conf); + conf_free(yy_conf); /* copy over settings from first struct */ DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) { - struct AccessItem *new_aconf; - struct ConfItem *new_conf; - - new_conf = make_conf_item(CLIENT_TYPE); - new_aconf = map_to_conf(new_conf); + struct MaskItem *new_conf = conf_make(CONF_CLIENT); yy_tmp = ptr->data; assert(yy_tmp->user && yy_tmp->host); - if (yy_aconf->passwd != NULL) - DupString(new_aconf->passwd, yy_aconf->passwd); + if (yy_conf->passwd != NULL) + DupString(new_conf->passwd, yy_conf->passwd); if (yy_conf->name != NULL) DupString(new_conf->name, yy_conf->name); - if (yy_aconf->passwd != NULL) - DupString(new_aconf->passwd, yy_aconf->passwd); + if (yy_conf->passwd != NULL) + DupString(new_conf->passwd, yy_conf->passwd); - new_aconf->flags = yy_aconf->flags; - new_aconf->port = yy_aconf->port; + new_conf->flags = yy_conf->flags; + new_conf->port = yy_conf->port; - DupString(new_aconf->user, yy_tmp->user); - collapse(new_aconf->user); + DupString(new_conf->user, yy_tmp->user); + collapse(new_conf->user); - DupString(new_aconf->host, yy_tmp->host); - collapse(new_aconf->host); + DupString(new_conf->host, yy_tmp->host); + collapse(new_conf->host); conf_add_class_to_conf(new_conf, class_name); - add_conf_by_address(CONF_CLIENT, new_aconf); + add_conf_by_address(CONF_CLIENT, new_conf); dlinkDelete(&yy_tmp->node, &col_conf_list); free_collect_item(yy_tmp); } @@ -4769,14 +4753,13 @@ yyreduce: MyFree(class_name); class_name = NULL; yy_conf = NULL; - yy_aconf = NULL; } } break; case 265: /* Line 1813 of yacc.c */ -#line 1600 "conf_parser.y" +#line 1583 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4794,10 +4777,10 @@ yyreduce: split_nuh(&nuh); - if (yy_aconf->user == NULL) + if (yy_conf->user == NULL) { - DupString(yy_aconf->user, userbuf); - DupString(yy_aconf->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); } else { @@ -4814,23 +4797,23 @@ yyreduce: case 266: /* Line 1813 of yacc.c */ -#line 1635 "conf_parser.y" +#line 1618 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { /* be paranoid */ - if (yy_aconf->passwd != NULL) - memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); + if (yy_conf->passwd != NULL) + memset(yy_conf->passwd, 0, strlen(yy_conf->passwd)); - MyFree(yy_aconf->passwd); - DupString(yy_aconf->passwd, yylval.string); + MyFree(yy_conf->passwd); + DupString(yy_conf->passwd, yylval.string); } } break; case 267: /* Line 1813 of yacc.c */ -#line 1648 "conf_parser.y" +#line 1631 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4842,109 +4825,109 @@ yyreduce: case 268: /* Line 1813 of yacc.c */ -#line 1657 "conf_parser.y" +#line 1640 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { if (yylval.number) - SetConfEncrypted(yy_aconf); + SetConfEncrypted(yy_conf); else - ClearConfEncrypted(yy_aconf); + ClearConfEncrypted(yy_conf); } } break; case 269: /* Line 1813 of yacc.c */ -#line 1668 "conf_parser.y" +#line 1651 "conf_parser.y" { } break; case 273: /* Line 1813 of yacc.c */ -#line 1673 "conf_parser.y" +#line 1656 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE; + yy_conf->flags |= CONF_FLAGS_SPOOF_NOTICE; } break; case 274: /* Line 1813 of yacc.c */ -#line 1677 "conf_parser.y" +#line 1660 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_NOLIMIT; + yy_conf->flags |= CONF_FLAGS_NOLIMIT; } break; case 275: /* Line 1813 of yacc.c */ -#line 1681 "conf_parser.y" +#line 1664 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE; + yy_conf->flags |= CONF_FLAGS_EXEMPTKLINE; } break; case 276: /* Line 1813 of yacc.c */ -#line 1685 "conf_parser.y" +#line 1668 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD; + yy_conf->flags |= CONF_FLAGS_NEED_IDENTD; } break; case 277: /* Line 1813 of yacc.c */ -#line 1689 "conf_parser.y" +#line 1672 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD; + yy_conf->flags |= CONF_FLAGS_CAN_FLOOD; } break; case 278: /* Line 1813 of yacc.c */ -#line 1693 "conf_parser.y" +#line 1676 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_NO_TILDE; + yy_conf->flags |= CONF_FLAGS_NO_TILDE; } break; case 279: /* Line 1813 of yacc.c */ -#line 1697 "conf_parser.y" +#line 1680 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE; + yy_conf->flags |= CONF_FLAGS_EXEMPTGLINE; } break; case 280: /* Line 1813 of yacc.c */ -#line 1701 "conf_parser.y" +#line 1684 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV; + yy_conf->flags |= CONF_FLAGS_EXEMPTRESV; } break; case 281: /* Line 1813 of yacc.c */ -#line 1705 "conf_parser.y" +#line 1688 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD; + yy_conf->flags |= CONF_FLAGS_NEED_PASSWORD; } break; case 282: /* Line 1813 of yacc.c */ -#line 1711 "conf_parser.y" +#line 1694 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -4953,7 +4936,7 @@ yyreduce: if (strlen(yylval.string) <= HOSTLEN && valid_hostname(yylval.string)) { DupString(yy_conf->name, yylval.string); - yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; + yy_conf->flags |= CONF_FLAGS_SPOOF_IP; } else { @@ -4966,11 +4949,11 @@ yyreduce: case 283: /* Line 1813 of yacc.c */ -#line 1730 "conf_parser.y" +#line 1713 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - yy_aconf->flags |= CONF_FLAGS_REDIR; + yy_conf->flags |= CONF_FLAGS_REDIR; MyFree(yy_conf->name); DupString(yy_conf->name, yylval.string); } @@ -4979,19 +4962,19 @@ yyreduce: case 284: /* Line 1813 of yacc.c */ -#line 1740 "conf_parser.y" +#line 1723 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - yy_aconf->flags |= CONF_FLAGS_REDIR; - yy_aconf->port = (yyvsp[(3) - (4)].number); + yy_conf->flags |= CONF_FLAGS_REDIR; + yy_conf->port = (yyvsp[(3) - (4)].number); } } break; case 285: /* Line 1813 of yacc.c */ -#line 1753 "conf_parser.y" +#line 1736 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5003,7 +4986,7 @@ yyreduce: case 286: /* Line 1813 of yacc.c */ -#line 1760 "conf_parser.y" +#line 1743 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5015,7 +4998,7 @@ yyreduce: case 293: /* Line 1813 of yacc.c */ -#line 1772 "conf_parser.y" +#line 1755 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5027,7 +5010,7 @@ yyreduce: case 294: /* Line 1813 of yacc.c */ -#line 1781 "conf_parser.y" +#line 1764 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5045,7 +5028,7 @@ yyreduce: case 295: /* Line 1813 of yacc.c */ -#line 1796 "conf_parser.y" +#line 1779 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5058,13 +5041,13 @@ yyreduce: case 301: /* Line 1813 of yacc.c */ -#line 1814 "conf_parser.y" +#line 1797 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { if (valid_servname(yylval.string)) { - yy_conf = make_conf_item(SERVICE_TYPE); + yy_conf = conf_make(CONF_SERVICE); DupString(yy_conf->name, yylval.string); } } @@ -5073,20 +5056,19 @@ yyreduce: case 302: /* Line 1813 of yacc.c */ -#line 1829 "conf_parser.y" +#line 1812 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(ULINE_TYPE); - yy_match_item = map_to_conf(yy_conf); - yy_match_item->action = SHARED_ALL; + yy_conf = conf_make(CONF_ULINE); + yy_conf->action = SHARED_ALL; } } break; case 303: /* Line 1813 of yacc.c */ -#line 1837 "conf_parser.y" +#line 1819 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5097,7 +5079,7 @@ yyreduce: case 310: /* Line 1813 of yacc.c */ -#line 1848 "conf_parser.y" +#line 1830 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5109,7 +5091,7 @@ yyreduce: case 311: /* Line 1813 of yacc.c */ -#line 1857 "conf_parser.y" +#line 1839 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5126,126 +5108,125 @@ yyreduce: split_nuh(&nuh); - DupString(yy_match_item->user, userbuf); - DupString(yy_match_item->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); } } break; case 312: /* Line 1813 of yacc.c */ -#line 1879 "conf_parser.y" +#line 1861 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action = 0; + yy_conf->action = 0; } break; case 316: /* Line 1813 of yacc.c */ -#line 1886 "conf_parser.y" +#line 1868 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_KLINE; + yy_conf->action |= SHARED_KLINE; } break; case 317: /* Line 1813 of yacc.c */ -#line 1890 "conf_parser.y" +#line 1872 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_UNKLINE; + yy_conf->action |= SHARED_UNKLINE; } break; case 318: /* Line 1813 of yacc.c */ -#line 1894 "conf_parser.y" +#line 1876 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_DLINE; + yy_conf->action |= SHARED_DLINE; } break; case 319: /* Line 1813 of yacc.c */ -#line 1898 "conf_parser.y" +#line 1880 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_UNDLINE; + yy_conf->action |= SHARED_UNDLINE; } break; case 320: /* Line 1813 of yacc.c */ -#line 1902 "conf_parser.y" +#line 1884 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_XLINE; + yy_conf->action |= SHARED_XLINE; } break; case 321: /* Line 1813 of yacc.c */ -#line 1906 "conf_parser.y" +#line 1888 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_UNXLINE; + yy_conf->action |= SHARED_UNXLINE; } break; case 322: /* Line 1813 of yacc.c */ -#line 1910 "conf_parser.y" +#line 1892 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_RESV; + yy_conf->action |= SHARED_RESV; } break; case 323: /* Line 1813 of yacc.c */ -#line 1914 "conf_parser.y" +#line 1896 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_UNRESV; + yy_conf->action |= SHARED_UNRESV; } break; case 324: /* Line 1813 of yacc.c */ -#line 1918 "conf_parser.y" +#line 1900 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_LOCOPS; + yy_conf->action |= SHARED_LOCOPS; } break; case 325: /* Line 1813 of yacc.c */ -#line 1922 "conf_parser.y" +#line 1904 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_match_item->action = SHARED_ALL; + yy_conf->action = SHARED_ALL; } break; case 326: /* Line 1813 of yacc.c */ -#line 1931 "conf_parser.y" +#line 1913 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(CLUSTER_TYPE); - yy_conf->flags = SHARED_ALL; + yy_conf = conf_make(CONF_CLUSTER); } } break; case 327: /* Line 1813 of yacc.c */ -#line 1938 "conf_parser.y" +#line 1919 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5258,7 +5239,7 @@ yyreduce: case 333: /* Line 1813 of yacc.c */ -#line 1951 "conf_parser.y" +#line 1932 "conf_parser.y" { if (conf_parser_ctx.pass == 2) DupString(yy_conf->name, yylval.string); @@ -5267,7 +5248,7 @@ yyreduce: case 334: /* Line 1813 of yacc.c */ -#line 1957 "conf_parser.y" +#line 1938 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags = 0; @@ -5276,7 +5257,7 @@ yyreduce: case 338: /* Line 1813 of yacc.c */ -#line 1964 "conf_parser.y" +#line 1945 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_KLINE; @@ -5285,7 +5266,7 @@ yyreduce: case 339: /* Line 1813 of yacc.c */ -#line 1968 "conf_parser.y" +#line 1949 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_UNKLINE; @@ -5294,7 +5275,7 @@ yyreduce: case 340: /* Line 1813 of yacc.c */ -#line 1972 "conf_parser.y" +#line 1953 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_DLINE; @@ -5303,7 +5284,7 @@ yyreduce: case 341: /* Line 1813 of yacc.c */ -#line 1976 "conf_parser.y" +#line 1957 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_UNDLINE; @@ -5312,7 +5293,7 @@ yyreduce: case 342: /* Line 1813 of yacc.c */ -#line 1980 "conf_parser.y" +#line 1961 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_XLINE; @@ -5321,7 +5302,7 @@ yyreduce: case 343: /* Line 1813 of yacc.c */ -#line 1984 "conf_parser.y" +#line 1965 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_UNXLINE; @@ -5330,7 +5311,7 @@ yyreduce: case 344: /* Line 1813 of yacc.c */ -#line 1988 "conf_parser.y" +#line 1969 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_RESV; @@ -5339,7 +5320,7 @@ yyreduce: case 345: /* Line 1813 of yacc.c */ -#line 1992 "conf_parser.y" +#line 1973 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_UNRESV; @@ -5348,7 +5329,7 @@ yyreduce: case 346: /* Line 1813 of yacc.c */ -#line 1996 "conf_parser.y" +#line 1977 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags |= SHARED_LOCOPS; @@ -5357,7 +5338,7 @@ yyreduce: case 347: /* Line 1813 of yacc.c */ -#line 2000 "conf_parser.y" +#line 1981 "conf_parser.y" { if (conf_parser_ctx.pass == 2) yy_conf->flags = SHARED_ALL; @@ -5366,15 +5347,14 @@ yyreduce: case 348: /* Line 1813 of yacc.c */ -#line 2009 "conf_parser.y" +#line 1990 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(SERVER_TYPE); - yy_aconf = map_to_conf(yy_conf); + yy_conf = conf_make(CONF_SERVER); /* defaults */ - yy_aconf->port = PORTNUM; + yy_conf->port = PORTNUM; } else { @@ -5386,22 +5366,22 @@ yyreduce: case 349: /* Line 1813 of yacc.c */ -#line 2024 "conf_parser.y" +#line 2004 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - if (yy_aconf->host && yy_aconf->passwd && yy_aconf->spasswd) + if (yy_conf->host && yy_conf->passwd && yy_conf->spasswd) { if (conf_add_server(yy_conf, class_name) == -1) - delete_conf_item(yy_conf); + conf_free(yy_conf); } else { if (yy_conf->name != NULL) { - if (yy_aconf->host == NULL) + if (yy_conf->host == NULL) yyerror("Ignoring connect block -- missing host"); - else if (!yy_aconf->passwd || !yy_aconf->spasswd) + else if (!yy_conf->passwd || !yy_conf->spasswd) yyerror("Ignoring connect block -- missing password"); } @@ -5412,20 +5392,19 @@ yyreduce: * rewrite ASAP. make_conf_item() shouldn't really add things onto * a doubly linked list immediately without any sanity checks! -Michael */ - delete_conf_item(yy_conf); + conf_free(yy_conf); } MyFree(class_name); class_name = NULL; yy_conf = NULL; - yy_aconf = NULL; } } break; case 366: /* Line 1813 of yacc.c */ -#line 2068 "conf_parser.y" +#line 2047 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5437,19 +5416,19 @@ yyreduce: case 367: /* Line 1813 of yacc.c */ -#line 2077 "conf_parser.y" +#line 2056 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { - MyFree(yy_aconf->host); - DupString(yy_aconf->host, yylval.string); + MyFree(yy_conf->host); + DupString(yy_conf->host, yylval.string); } } break; case 368: /* Line 1813 of yacc.c */ -#line 2086 "conf_parser.y" +#line 2065 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5467,9 +5446,9 @@ yyreduce: { assert(res != NULL); - memcpy(&yy_aconf->bind, res->ai_addr, res->ai_addrlen); - yy_aconf->bind.ss.ss_family = res->ai_family; - yy_aconf->bind.ss_len = res->ai_addrlen; + memcpy(&yy_conf->bind, res->ai_addr, res->ai_addrlen); + yy_conf->bind.ss.ss_family = res->ai_family; + yy_conf->bind.ss_len = res->ai_addrlen; freeaddrinfo(res); } } @@ -5478,7 +5457,7 @@ yyreduce: case 369: /* Line 1813 of yacc.c */ -#line 2112 "conf_parser.y" +#line 2091 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5487,11 +5466,11 @@ yyreduce: else if (strchr((yyvsp[(3) - (4)].string), ' ') != NULL) yyerror("Server passwords cannot contain spaces"); else { - if (yy_aconf->spasswd != NULL) - memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd)); + if (yy_conf->spasswd != NULL) + memset(yy_conf->spasswd, 0, strlen(yy_conf->spasswd)); - MyFree(yy_aconf->spasswd); - DupString(yy_aconf->spasswd, yylval.string); + MyFree(yy_conf->spasswd); + DupString(yy_conf->spasswd, yylval.string); } } } @@ -5499,7 +5478,7 @@ yyreduce: case 370: /* Line 1813 of yacc.c */ -#line 2130 "conf_parser.y" +#line 2109 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5508,11 +5487,11 @@ yyreduce: else if (strchr((yyvsp[(3) - (4)].string), ' ') != NULL) yyerror("Server passwords cannot contain spaces"); else { - if (yy_aconf->passwd != NULL) - memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); + if (yy_conf->passwd != NULL) + memset(yy_conf->passwd, 0, strlen(yy_conf->passwd)); - MyFree(yy_aconf->passwd); - DupString(yy_aconf->passwd, yylval.string); + MyFree(yy_conf->passwd); + DupString(yy_conf->passwd, yylval.string); } } } @@ -5520,103 +5499,103 @@ yyreduce: case 371: /* Line 1813 of yacc.c */ -#line 2148 "conf_parser.y" +#line 2127 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->port = (yyvsp[(3) - (4)].number); + yy_conf->port = (yyvsp[(3) - (4)].number); } break; case 372: /* Line 1813 of yacc.c */ -#line 2154 "conf_parser.y" +#line 2133 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - yy_aconf->aftype = AF_INET; + yy_conf->aftype = AF_INET; } break; case 373: /* Line 1813 of yacc.c */ -#line 2158 "conf_parser.y" +#line 2137 "conf_parser.y" { #ifdef IPV6 if (conf_parser_ctx.pass == 2) - yy_aconf->aftype = AF_INET6; + yy_conf->aftype = AF_INET6; #endif } break; case 374: /* Line 1813 of yacc.c */ -#line 2166 "conf_parser.y" +#line 2145 "conf_parser.y" { } break; case 378: /* Line 1813 of yacc.c */ -#line 2171 "conf_parser.y" +#line 2150 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - SetConfAllowAutoConn(yy_aconf); + SetConfAllowAutoConn(yy_conf); } break; case 379: /* Line 1813 of yacc.c */ -#line 2175 "conf_parser.y" +#line 2154 "conf_parser.y" { if (conf_parser_ctx.pass == 2) - SetConfSSL(yy_aconf); + SetConfSSL(yy_conf); } break; case 380: /* Line 1813 of yacc.c */ -#line 2181 "conf_parser.y" +#line 2160 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { if (yylval.number) - yy_aconf->flags |= CONF_FLAGS_ENCRYPTED; + yy_conf->flags |= CONF_FLAGS_ENCRYPTED; else - yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED; + yy_conf->flags &= ~CONF_FLAGS_ENCRYPTED; } } break; case 381: /* Line 1813 of yacc.c */ -#line 2192 "conf_parser.y" +#line 2171 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { char *mask; DupString(mask, yylval.string); - dlinkAdd(mask, make_dlink_node(), &yy_aconf->hub_list); + dlinkAdd(mask, make_dlink_node(), &yy_conf->hub_list); } } break; case 382: /* Line 1813 of yacc.c */ -#line 2203 "conf_parser.y" +#line 2182 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { char *mask; DupString(mask, yylval.string); - dlinkAdd(mask, make_dlink_node(), &yy_aconf->leaf_list); + dlinkAdd(mask, make_dlink_node(), &yy_conf->leaf_list); } } break; case 383: /* Line 1813 of yacc.c */ -#line 2214 "conf_parser.y" +#line 2193 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5628,13 +5607,13 @@ yyreduce: case 384: /* Line 1813 of yacc.c */ -#line 2223 "conf_parser.y" +#line 2202 "conf_parser.y" { #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2) { - MyFree(yy_aconf->cipher_list); - DupString(yy_aconf->cipher_list, yylval.string); + MyFree(yy_conf->cipher_list); + DupString(yy_conf->cipher_list, yylval.string); } #else if (conf_parser_ctx.pass == 2) @@ -5645,7 +5624,7 @@ yyreduce: case 385: /* Line 1813 of yacc.c */ -#line 2241 "conf_parser.y" +#line 2220 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5657,7 +5636,7 @@ yyreduce: case 386: /* Line 1813 of yacc.c */ -#line 2248 "conf_parser.y" +#line 2227 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5678,17 +5657,17 @@ yyreduce: break; } - yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE)); - yy_aconf->regexuser = exp_user; - yy_aconf->regexhost = exp_host; + yy_conf = conf_make(CONF_RKLINE); + yy_conf->regexuser = exp_user; + yy_conf->regexhost = exp_host; - DupString(yy_aconf->user, userbuf); - DupString(yy_aconf->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); if (reasonbuf[0]) - DupString(yy_aconf->reason, reasonbuf); + DupString(yy_conf->reason, reasonbuf); else - DupString(yy_aconf->reason, "No reason"); + DupString(yy_conf->reason, "No reason"); #else ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support"); break; @@ -5696,34 +5675,34 @@ yyreduce: } else { - yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE)); + yy_conf = conf_make(CONF_KLINE); - DupString(yy_aconf->user, userbuf); - DupString(yy_aconf->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); if (reasonbuf[0]) - DupString(yy_aconf->reason, reasonbuf); + DupString(yy_conf->reason, reasonbuf); else - DupString(yy_aconf->reason, "No reason"); - add_conf_by_address(CONF_KLINE, yy_aconf); + DupString(yy_conf->reason, "No reason"); + add_conf_by_address(CONF_KLINE, yy_conf); } } - yy_aconf = NULL; + yy_conf = NULL; } } break; case 387: /* Line 1813 of yacc.c */ -#line 2304 "conf_parser.y" +#line 2283 "conf_parser.y" { } break; case 391: /* Line 1813 of yacc.c */ -#line 2309 "conf_parser.y" +#line 2288 "conf_parser.y" { if (conf_parser_ctx.pass == 2) regex_ban = 1; @@ -5732,7 +5711,7 @@ yyreduce: case 398: /* Line 1813 of yacc.c */ -#line 2318 "conf_parser.y" +#line 2297 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5754,7 +5733,7 @@ yyreduce: case 399: /* Line 1813 of yacc.c */ -#line 2337 "conf_parser.y" +#line 2316 "conf_parser.y" { if (conf_parser_ctx.pass == 2) strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); @@ -5763,7 +5742,7 @@ yyreduce: case 400: /* Line 1813 of yacc.c */ -#line 2346 "conf_parser.y" +#line 2325 "conf_parser.y" { if (conf_parser_ctx.pass == 2) hostbuf[0] = reasonbuf[0] = '\0'; @@ -5772,21 +5751,21 @@ yyreduce: case 401: /* Line 1813 of yacc.c */ -#line 2350 "conf_parser.y" +#line 2329 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST) { - yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE)); - DupString(yy_aconf->host, hostbuf); + yy_conf = conf_make(CONF_DLINE); + DupString(yy_conf->host, hostbuf); if (reasonbuf[0]) - DupString(yy_aconf->reason, reasonbuf); + DupString(yy_conf->reason, reasonbuf); else - DupString(yy_aconf->reason, "No reason"); - add_conf_by_address(CONF_DLINE, yy_aconf); - yy_aconf = NULL; + DupString(yy_conf->reason, "No reason"); + add_conf_by_address(CONF_DLINE, yy_conf); + yy_conf = NULL; } } } @@ -5794,7 +5773,7 @@ yyreduce: case 407: /* Line 1813 of yacc.c */ -#line 2372 "conf_parser.y" +#line 2351 "conf_parser.y" { if (conf_parser_ctx.pass == 2) strlcpy(hostbuf, yylval.string, sizeof(hostbuf)); @@ -5803,7 +5782,7 @@ yyreduce: case 408: /* Line 1813 of yacc.c */ -#line 2378 "conf_parser.y" +#line 2357 "conf_parser.y" { if (conf_parser_ctx.pass == 2) strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); @@ -5812,17 +5791,17 @@ yyreduce: case 414: /* Line 1813 of yacc.c */ -#line 2392 "conf_parser.y" +#line 2371 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST) { - yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE)); - DupString(yy_aconf->host, yylval.string); + yy_conf = conf_make(CONF_EXEMPT); + DupString(yy_conf->host, yylval.string); - add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf); - yy_aconf = NULL; + add_conf_by_address(CONF_EXEMPT, yy_conf); + yy_conf = NULL; } } } @@ -5830,7 +5809,7 @@ yyreduce: case 415: /* Line 1813 of yacc.c */ -#line 2410 "conf_parser.y" +#line 2389 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5842,7 +5821,7 @@ yyreduce: case 416: /* Line 1813 of yacc.c */ -#line 2417 "conf_parser.y" +#line 2396 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -5861,23 +5840,22 @@ yyreduce: break; } - yy_conf = make_conf_item(RXLINE_TYPE); - yy_conf->regexpname = exp_p; + yy_conf = conf_make(CONF_RXLINE); + yy_conf->regexuser = exp_p; #else ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support"); break; #endif } else - yy_conf = make_conf_item(XLINE_TYPE); + yy_conf = conf_make(CONF_XLINE); - yy_match_item = map_to_conf(yy_conf); DupString(yy_conf->name, gecos_name); if (reasonbuf[0]) - DupString(yy_match_item->reason, reasonbuf); + DupString(yy_conf->reason, reasonbuf); else - DupString(yy_match_item->reason, "No reason"); + DupString(yy_conf->reason, "No reason"); } } } @@ -5885,14 +5863,14 @@ yyreduce: case 417: /* Line 1813 of yacc.c */ -#line 2457 "conf_parser.y" +#line 2435 "conf_parser.y" { } break; case 421: /* Line 1813 of yacc.c */ -#line 2462 "conf_parser.y" +#line 2440 "conf_parser.y" { if (conf_parser_ctx.pass == 2) regex_ban = 1; @@ -5901,7 +5879,7 @@ yyreduce: case 428: /* Line 1813 of yacc.c */ -#line 2471 "conf_parser.y" +#line 2449 "conf_parser.y" { if (conf_parser_ctx.pass == 2) strlcpy(gecos_name, yylval.string, sizeof(gecos_name)); @@ -5910,7 +5888,7 @@ yyreduce: case 429: /* Line 1813 of yacc.c */ -#line 2477 "conf_parser.y" +#line 2455 "conf_parser.y" { if (conf_parser_ctx.pass == 2) strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); @@ -5919,7 +5897,7 @@ yyreduce: case 483: /* Line 1813 of yacc.c */ -#line 2522 "conf_parser.y" +#line 2500 "conf_parser.y" { ConfigFileEntry.max_watch = (yyvsp[(3) - (4)].number); } @@ -5927,7 +5905,7 @@ yyreduce: case 484: /* Line 1813 of yacc.c */ -#line 2527 "conf_parser.y" +#line 2505 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigFileEntry.glines = yylval.number; @@ -5936,7 +5914,7 @@ yyreduce: case 485: /* Line 1813 of yacc.c */ -#line 2533 "conf_parser.y" +#line 2511 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigFileEntry.gline_time = (yyvsp[(3) - (4)].number); @@ -5945,7 +5923,7 @@ yyreduce: case 486: /* Line 1813 of yacc.c */ -#line 2539 "conf_parser.y" +#line 2517 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigFileEntry.gline_request_time = (yyvsp[(3) - (4)].number); @@ -5954,7 +5932,7 @@ yyreduce: case 487: /* Line 1813 of yacc.c */ -#line 2545 "conf_parser.y" +#line 2523 "conf_parser.y" { ConfigFileEntry.gline_min_cidr = (yyvsp[(3) - (4)].number); } @@ -5962,7 +5940,7 @@ yyreduce: case 488: /* Line 1813 of yacc.c */ -#line 2550 "conf_parser.y" +#line 2528 "conf_parser.y" { ConfigFileEntry.gline_min_cidr6 = (yyvsp[(3) - (4)].number); } @@ -5970,7 +5948,7 @@ yyreduce: case 489: /* Line 1813 of yacc.c */ -#line 2555 "conf_parser.y" +#line 2533 "conf_parser.y" { ConfigFileEntry.tkline_expire_notices = yylval.number; } @@ -5978,7 +5956,7 @@ yyreduce: case 490: /* Line 1813 of yacc.c */ -#line 2560 "conf_parser.y" +#line 2538 "conf_parser.y" { ConfigFileEntry.kill_chase_time_limit = (yyvsp[(3) - (4)].number); } @@ -5986,7 +5964,7 @@ yyreduce: case 491: /* Line 1813 of yacc.c */ -#line 2565 "conf_parser.y" +#line 2543 "conf_parser.y" { ConfigFileEntry.hide_spoof_ips = yylval.number; } @@ -5994,7 +5972,7 @@ yyreduce: case 492: /* Line 1813 of yacc.c */ -#line 2570 "conf_parser.y" +#line 2548 "conf_parser.y" { ConfigFileEntry.ignore_bogus_ts = yylval.number; } @@ -6002,7 +5980,7 @@ yyreduce: case 493: /* Line 1813 of yacc.c */ -#line 2575 "conf_parser.y" +#line 2553 "conf_parser.y" { ConfigFileEntry.disable_remote = yylval.number; } @@ -6010,7 +5988,7 @@ yyreduce: case 494: /* Line 1813 of yacc.c */ -#line 2580 "conf_parser.y" +#line 2558 "conf_parser.y" { ConfigFileEntry.failed_oper_notice = yylval.number; } @@ -6018,7 +5996,7 @@ yyreduce: case 495: /* Line 1813 of yacc.c */ -#line 2585 "conf_parser.y" +#line 2563 "conf_parser.y" { ConfigFileEntry.anti_nick_flood = yylval.number; } @@ -6026,7 +6004,7 @@ yyreduce: case 496: /* Line 1813 of yacc.c */ -#line 2590 "conf_parser.y" +#line 2568 "conf_parser.y" { ConfigFileEntry.max_nick_time = (yyvsp[(3) - (4)].number); } @@ -6034,7 +6012,7 @@ yyreduce: case 497: /* Line 1813 of yacc.c */ -#line 2595 "conf_parser.y" +#line 2573 "conf_parser.y" { ConfigFileEntry.max_nick_changes = (yyvsp[(3) - (4)].number); } @@ -6042,7 +6020,7 @@ yyreduce: case 498: /* Line 1813 of yacc.c */ -#line 2600 "conf_parser.y" +#line 2578 "conf_parser.y" { ConfigFileEntry.max_accept = (yyvsp[(3) - (4)].number); } @@ -6050,7 +6028,7 @@ yyreduce: case 499: /* Line 1813 of yacc.c */ -#line 2605 "conf_parser.y" +#line 2583 "conf_parser.y" { ConfigFileEntry.anti_spam_exit_message_time = (yyvsp[(3) - (4)].number); } @@ -6058,7 +6036,7 @@ yyreduce: case 500: /* Line 1813 of yacc.c */ -#line 2610 "conf_parser.y" +#line 2588 "conf_parser.y" { ConfigFileEntry.ts_warn_delta = (yyvsp[(3) - (4)].number); } @@ -6066,7 +6044,7 @@ yyreduce: case 501: /* Line 1813 of yacc.c */ -#line 2615 "conf_parser.y" +#line 2593 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigFileEntry.ts_max_delta = (yyvsp[(3) - (4)].number); @@ -6075,7 +6053,7 @@ yyreduce: case 502: /* Line 1813 of yacc.c */ -#line 2621 "conf_parser.y" +#line 2599 "conf_parser.y" { if (((yyvsp[(3) - (4)].number) > 0) && conf_parser_ctx.pass == 1) { @@ -6089,7 +6067,7 @@ yyreduce: case 503: /* Line 1813 of yacc.c */ -#line 2632 "conf_parser.y" +#line 2610 "conf_parser.y" { ConfigFileEntry.invisible_on_connect = yylval.number; } @@ -6097,7 +6075,7 @@ yyreduce: case 504: /* Line 1813 of yacc.c */ -#line 2637 "conf_parser.y" +#line 2615 "conf_parser.y" { ConfigFileEntry.warn_no_nline = yylval.number; } @@ -6105,7 +6083,7 @@ yyreduce: case 505: /* Line 1813 of yacc.c */ -#line 2642 "conf_parser.y" +#line 2620 "conf_parser.y" { ConfigFileEntry.stats_e_disabled = yylval.number; } @@ -6113,7 +6091,7 @@ yyreduce: case 506: /* Line 1813 of yacc.c */ -#line 2647 "conf_parser.y" +#line 2625 "conf_parser.y" { ConfigFileEntry.stats_o_oper_only = yylval.number; } @@ -6121,7 +6099,7 @@ yyreduce: case 507: /* Line 1813 of yacc.c */ -#line 2652 "conf_parser.y" +#line 2630 "conf_parser.y" { ConfigFileEntry.stats_P_oper_only = yylval.number; } @@ -6129,7 +6107,7 @@ yyreduce: case 508: /* Line 1813 of yacc.c */ -#line 2657 "conf_parser.y" +#line 2635 "conf_parser.y" { ConfigFileEntry.stats_k_oper_only = 2 * yylval.number; } @@ -6137,7 +6115,7 @@ yyreduce: case 509: /* Line 1813 of yacc.c */ -#line 2660 "conf_parser.y" +#line 2638 "conf_parser.y" { ConfigFileEntry.stats_k_oper_only = 1; } @@ -6145,7 +6123,7 @@ yyreduce: case 510: /* Line 1813 of yacc.c */ -#line 2665 "conf_parser.y" +#line 2643 "conf_parser.y" { ConfigFileEntry.stats_i_oper_only = 2 * yylval.number; } @@ -6153,7 +6131,7 @@ yyreduce: case 511: /* Line 1813 of yacc.c */ -#line 2668 "conf_parser.y" +#line 2646 "conf_parser.y" { ConfigFileEntry.stats_i_oper_only = 1; } @@ -6161,7 +6139,7 @@ yyreduce: case 512: /* Line 1813 of yacc.c */ -#line 2673 "conf_parser.y" +#line 2651 "conf_parser.y" { ConfigFileEntry.pace_wait = (yyvsp[(3) - (4)].number); } @@ -6169,7 +6147,7 @@ yyreduce: case 513: /* Line 1813 of yacc.c */ -#line 2678 "conf_parser.y" +#line 2656 "conf_parser.y" { ConfigFileEntry.caller_id_wait = (yyvsp[(3) - (4)].number); } @@ -6177,7 +6155,7 @@ yyreduce: case 514: /* Line 1813 of yacc.c */ -#line 2683 "conf_parser.y" +#line 2661 "conf_parser.y" { ConfigFileEntry.opers_bypass_callerid = yylval.number; } @@ -6185,7 +6163,7 @@ yyreduce: case 515: /* Line 1813 of yacc.c */ -#line 2688 "conf_parser.y" +#line 2666 "conf_parser.y" { ConfigFileEntry.pace_wait_simple = (yyvsp[(3) - (4)].number); } @@ -6193,7 +6171,7 @@ yyreduce: case 516: /* Line 1813 of yacc.c */ -#line 2693 "conf_parser.y" +#line 2671 "conf_parser.y" { ConfigFileEntry.short_motd = yylval.number; } @@ -6201,7 +6179,7 @@ yyreduce: case 517: /* Line 1813 of yacc.c */ -#line 2698 "conf_parser.y" +#line 2676 "conf_parser.y" { ConfigFileEntry.no_oper_flood = yylval.number; } @@ -6209,7 +6187,7 @@ yyreduce: case 518: /* Line 1813 of yacc.c */ -#line 2703 "conf_parser.y" +#line 2681 "conf_parser.y" { ConfigFileEntry.true_no_oper_flood = yylval.number; } @@ -6217,7 +6195,7 @@ yyreduce: case 519: /* Line 1813 of yacc.c */ -#line 2708 "conf_parser.y" +#line 2686 "conf_parser.y" { ConfigFileEntry.oper_pass_resv = yylval.number; } @@ -6225,7 +6203,7 @@ yyreduce: case 520: /* Line 1813 of yacc.c */ -#line 2713 "conf_parser.y" +#line 2691 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -6239,7 +6217,7 @@ yyreduce: case 521: /* Line 1813 of yacc.c */ -#line 2724 "conf_parser.y" +#line 2702 "conf_parser.y" { ConfigFileEntry.dots_in_ident = (yyvsp[(3) - (4)].number); } @@ -6247,7 +6225,7 @@ yyreduce: case 522: /* Line 1813 of yacc.c */ -#line 2729 "conf_parser.y" +#line 2707 "conf_parser.y" { ConfigFileEntry.max_targets = (yyvsp[(3) - (4)].number); } @@ -6255,7 +6233,7 @@ yyreduce: case 523: /* Line 1813 of yacc.c */ -#line 2734 "conf_parser.y" +#line 2712 "conf_parser.y" { ConfigFileEntry.use_egd = yylval.number; } @@ -6263,7 +6241,7 @@ yyreduce: case 524: /* Line 1813 of yacc.c */ -#line 2739 "conf_parser.y" +#line 2717 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -6275,7 +6253,7 @@ yyreduce: case 525: /* Line 1813 of yacc.c */ -#line 2748 "conf_parser.y" +#line 2726 "conf_parser.y" { if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string)) { @@ -6287,7 +6265,7 @@ yyreduce: case 526: /* Line 1813 of yacc.c */ -#line 2757 "conf_parser.y" +#line 2735 "conf_parser.y" { ConfigFileEntry.ping_cookie = yylval.number; } @@ -6295,7 +6273,7 @@ yyreduce: case 527: /* Line 1813 of yacc.c */ -#line 2762 "conf_parser.y" +#line 2740 "conf_parser.y" { ConfigFileEntry.disable_auth = yylval.number; } @@ -6303,7 +6281,7 @@ yyreduce: case 528: /* Line 1813 of yacc.c */ -#line 2767 "conf_parser.y" +#line 2745 "conf_parser.y" { ConfigFileEntry.throttle_time = yylval.number; } @@ -6311,7 +6289,7 @@ yyreduce: case 529: /* Line 1813 of yacc.c */ -#line 2772 "conf_parser.y" +#line 2750 "conf_parser.y" { ConfigFileEntry.oper_umodes = 0; } @@ -6319,7 +6297,7 @@ yyreduce: case 533: /* Line 1813 of yacc.c */ -#line 2778 "conf_parser.y" +#line 2756 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_BOTS; } @@ -6327,7 +6305,7 @@ yyreduce: case 534: /* Line 1813 of yacc.c */ -#line 2781 "conf_parser.y" +#line 2759 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_CCONN; } @@ -6335,7 +6313,7 @@ yyreduce: case 535: /* Line 1813 of yacc.c */ -#line 2784 "conf_parser.y" +#line 2762 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL; } @@ -6343,7 +6321,7 @@ yyreduce: case 536: /* Line 1813 of yacc.c */ -#line 2787 "conf_parser.y" +#line 2765 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_DEAF; } @@ -6351,7 +6329,7 @@ yyreduce: case 537: /* Line 1813 of yacc.c */ -#line 2790 "conf_parser.y" +#line 2768 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_DEBUG; } @@ -6359,7 +6337,7 @@ yyreduce: case 538: /* Line 1813 of yacc.c */ -#line 2793 "conf_parser.y" +#line 2771 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_FULL; } @@ -6367,7 +6345,7 @@ yyreduce: case 539: /* Line 1813 of yacc.c */ -#line 2796 "conf_parser.y" +#line 2774 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_HIDDEN; } @@ -6375,7 +6353,7 @@ yyreduce: case 540: /* Line 1813 of yacc.c */ -#line 2799 "conf_parser.y" +#line 2777 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_SKILL; } @@ -6383,7 +6361,7 @@ yyreduce: case 541: /* Line 1813 of yacc.c */ -#line 2802 "conf_parser.y" +#line 2780 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_NCHANGE; } @@ -6391,7 +6369,7 @@ yyreduce: case 542: /* Line 1813 of yacc.c */ -#line 2805 "conf_parser.y" +#line 2783 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_REJ; } @@ -6399,7 +6377,7 @@ yyreduce: case 543: /* Line 1813 of yacc.c */ -#line 2808 "conf_parser.y" +#line 2786 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_UNAUTH; } @@ -6407,7 +6385,7 @@ yyreduce: case 544: /* Line 1813 of yacc.c */ -#line 2811 "conf_parser.y" +#line 2789 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_SPY; } @@ -6415,7 +6393,7 @@ yyreduce: case 545: /* Line 1813 of yacc.c */ -#line 2814 "conf_parser.y" +#line 2792 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL; } @@ -6423,7 +6401,7 @@ yyreduce: case 546: /* Line 1813 of yacc.c */ -#line 2817 "conf_parser.y" +#line 2795 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_OPERWALL; } @@ -6431,7 +6409,7 @@ yyreduce: case 547: /* Line 1813 of yacc.c */ -#line 2820 "conf_parser.y" +#line 2798 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE; } @@ -6439,7 +6417,7 @@ yyreduce: case 548: /* Line 1813 of yacc.c */ -#line 2823 "conf_parser.y" +#line 2801 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE; } @@ -6447,7 +6425,7 @@ yyreduce: case 549: /* Line 1813 of yacc.c */ -#line 2826 "conf_parser.y" +#line 2804 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_WALLOP; } @@ -6455,7 +6433,7 @@ yyreduce: case 550: /* Line 1813 of yacc.c */ -#line 2829 "conf_parser.y" +#line 2807 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID; } @@ -6463,7 +6441,7 @@ yyreduce: case 551: /* Line 1813 of yacc.c */ -#line 2832 "conf_parser.y" +#line 2810 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_CALLERID; } @@ -6471,7 +6449,7 @@ yyreduce: case 552: /* Line 1813 of yacc.c */ -#line 2835 "conf_parser.y" +#line 2813 "conf_parser.y" { ConfigFileEntry.oper_umodes |= UMODE_LOCOPS; } @@ -6479,7 +6457,7 @@ yyreduce: case 553: /* Line 1813 of yacc.c */ -#line 2840 "conf_parser.y" +#line 2818 "conf_parser.y" { ConfigFileEntry.oper_only_umodes = 0; } @@ -6487,7 +6465,7 @@ yyreduce: case 557: /* Line 1813 of yacc.c */ -#line 2846 "conf_parser.y" +#line 2824 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_BOTS; } @@ -6495,7 +6473,7 @@ yyreduce: case 558: /* Line 1813 of yacc.c */ -#line 2849 "conf_parser.y" +#line 2827 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_CCONN; } @@ -6503,7 +6481,7 @@ yyreduce: case 559: /* Line 1813 of yacc.c */ -#line 2852 "conf_parser.y" +#line 2830 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL; } @@ -6511,7 +6489,7 @@ yyreduce: case 560: /* Line 1813 of yacc.c */ -#line 2855 "conf_parser.y" +#line 2833 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_DEAF; } @@ -6519,7 +6497,7 @@ yyreduce: case 561: /* Line 1813 of yacc.c */ -#line 2858 "conf_parser.y" +#line 2836 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG; } @@ -6527,7 +6505,7 @@ yyreduce: case 562: /* Line 1813 of yacc.c */ -#line 2861 "conf_parser.y" +#line 2839 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_FULL; } @@ -6535,7 +6513,7 @@ yyreduce: case 563: /* Line 1813 of yacc.c */ -#line 2864 "conf_parser.y" +#line 2842 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_SKILL; } @@ -6543,7 +6521,7 @@ yyreduce: case 564: /* Line 1813 of yacc.c */ -#line 2867 "conf_parser.y" +#line 2845 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN; } @@ -6551,7 +6529,7 @@ yyreduce: case 565: /* Line 1813 of yacc.c */ -#line 2870 "conf_parser.y" +#line 2848 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE; } @@ -6559,7 +6537,7 @@ yyreduce: case 566: /* Line 1813 of yacc.c */ -#line 2873 "conf_parser.y" +#line 2851 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_REJ; } @@ -6567,7 +6545,7 @@ yyreduce: case 567: /* Line 1813 of yacc.c */ -#line 2876 "conf_parser.y" +#line 2854 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH; } @@ -6575,7 +6553,7 @@ yyreduce: case 568: /* Line 1813 of yacc.c */ -#line 2879 "conf_parser.y" +#line 2857 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_SPY; } @@ -6583,7 +6561,7 @@ yyreduce: case 569: /* Line 1813 of yacc.c */ -#line 2882 "conf_parser.y" +#line 2860 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL; } @@ -6591,7 +6569,7 @@ yyreduce: case 570: /* Line 1813 of yacc.c */ -#line 2885 "conf_parser.y" +#line 2863 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL; } @@ -6599,7 +6577,7 @@ yyreduce: case 571: /* Line 1813 of yacc.c */ -#line 2888 "conf_parser.y" +#line 2866 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE; } @@ -6607,7 +6585,7 @@ yyreduce: case 572: /* Line 1813 of yacc.c */ -#line 2891 "conf_parser.y" +#line 2869 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE; } @@ -6615,7 +6593,7 @@ yyreduce: case 573: /* Line 1813 of yacc.c */ -#line 2894 "conf_parser.y" +#line 2872 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP; } @@ -6623,7 +6601,7 @@ yyreduce: case 574: /* Line 1813 of yacc.c */ -#line 2897 "conf_parser.y" +#line 2875 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID; } @@ -6631,7 +6609,7 @@ yyreduce: case 575: /* Line 1813 of yacc.c */ -#line 2900 "conf_parser.y" +#line 2878 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID; } @@ -6639,7 +6617,7 @@ yyreduce: case 576: /* Line 1813 of yacc.c */ -#line 2903 "conf_parser.y" +#line 2881 "conf_parser.y" { ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS; } @@ -6647,7 +6625,7 @@ yyreduce: case 577: /* Line 1813 of yacc.c */ -#line 2908 "conf_parser.y" +#line 2886 "conf_parser.y" { ConfigFileEntry.min_nonwildcard = (yyvsp[(3) - (4)].number); } @@ -6655,7 +6633,7 @@ yyreduce: case 578: /* Line 1813 of yacc.c */ -#line 2913 "conf_parser.y" +#line 2891 "conf_parser.y" { ConfigFileEntry.min_nonwildcard_simple = (yyvsp[(3) - (4)].number); } @@ -6663,7 +6641,7 @@ yyreduce: case 579: /* Line 1813 of yacc.c */ -#line 2918 "conf_parser.y" +#line 2896 "conf_parser.y" { ConfigFileEntry.default_floodcount = (yyvsp[(3) - (4)].number); } @@ -6671,7 +6649,7 @@ yyreduce: case 598: /* Line 1813 of yacc.c */ -#line 2941 "conf_parser.y" +#line 2919 "conf_parser.y" { ConfigChannel.disable_fake_channels = yylval.number; } @@ -6679,7 +6657,7 @@ yyreduce: case 599: /* Line 1813 of yacc.c */ -#line 2946 "conf_parser.y" +#line 2924 "conf_parser.y" { ConfigChannel.restrict_channels = yylval.number; } @@ -6687,7 +6665,7 @@ yyreduce: case 600: /* Line 1813 of yacc.c */ -#line 2951 "conf_parser.y" +#line 2929 "conf_parser.y" { ConfigChannel.knock_delay = (yyvsp[(3) - (4)].number); } @@ -6695,7 +6673,7 @@ yyreduce: case 601: /* Line 1813 of yacc.c */ -#line 2956 "conf_parser.y" +#line 2934 "conf_parser.y" { ConfigChannel.knock_delay_channel = (yyvsp[(3) - (4)].number); } @@ -6703,7 +6681,7 @@ yyreduce: case 602: /* Line 1813 of yacc.c */ -#line 2961 "conf_parser.y" +#line 2939 "conf_parser.y" { ConfigChannel.max_chans_per_user = (yyvsp[(3) - (4)].number); } @@ -6711,7 +6689,7 @@ yyreduce: case 603: /* Line 1813 of yacc.c */ -#line 2966 "conf_parser.y" +#line 2944 "conf_parser.y" { ConfigChannel.max_chans_per_oper = (yyvsp[(3) - (4)].number); } @@ -6719,7 +6697,7 @@ yyreduce: case 604: /* Line 1813 of yacc.c */ -#line 2971 "conf_parser.y" +#line 2949 "conf_parser.y" { ConfigChannel.quiet_on_ban = yylval.number; } @@ -6727,7 +6705,7 @@ yyreduce: case 605: /* Line 1813 of yacc.c */ -#line 2976 "conf_parser.y" +#line 2954 "conf_parser.y" { ConfigChannel.max_bans = (yyvsp[(3) - (4)].number); } @@ -6735,7 +6713,7 @@ yyreduce: case 606: /* Line 1813 of yacc.c */ -#line 2981 "conf_parser.y" +#line 2959 "conf_parser.y" { ConfigChannel.default_split_user_count = (yyvsp[(3) - (4)].number); } @@ -6743,7 +6721,7 @@ yyreduce: case 607: /* Line 1813 of yacc.c */ -#line 2986 "conf_parser.y" +#line 2964 "conf_parser.y" { ConfigChannel.default_split_server_count = (yyvsp[(3) - (4)].number); } @@ -6751,7 +6729,7 @@ yyreduce: case 608: /* Line 1813 of yacc.c */ -#line 2991 "conf_parser.y" +#line 2969 "conf_parser.y" { ConfigChannel.no_create_on_split = yylval.number; } @@ -6759,7 +6737,7 @@ yyreduce: case 609: /* Line 1813 of yacc.c */ -#line 2996 "conf_parser.y" +#line 2974 "conf_parser.y" { ConfigChannel.no_join_on_split = yylval.number; } @@ -6767,7 +6745,7 @@ yyreduce: case 610: /* Line 1813 of yacc.c */ -#line 3001 "conf_parser.y" +#line 2979 "conf_parser.y" { GlobalSetOptions.joinfloodcount = yylval.number; } @@ -6775,7 +6753,7 @@ yyreduce: case 611: /* Line 1813 of yacc.c */ -#line 3006 "conf_parser.y" +#line 2984 "conf_parser.y" { GlobalSetOptions.joinfloodtime = yylval.number; } @@ -6783,7 +6761,7 @@ yyreduce: case 622: /* Line 1813 of yacc.c */ -#line 3024 "conf_parser.y" +#line 3002 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigServerHide.flatten_links = yylval.number; @@ -6792,7 +6770,7 @@ yyreduce: case 623: /* Line 1813 of yacc.c */ -#line 3030 "conf_parser.y" +#line 3008 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigServerHide.hide_servers = yylval.number; @@ -6801,7 +6779,7 @@ yyreduce: case 624: /* Line 1813 of yacc.c */ -#line 3036 "conf_parser.y" +#line 3014 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -6813,7 +6791,7 @@ yyreduce: case 625: /* Line 1813 of yacc.c */ -#line 3045 "conf_parser.y" +#line 3023 "conf_parser.y" { if (conf_parser_ctx.pass == 2) { @@ -6830,7 +6808,7 @@ yyreduce: case 626: /* Line 1813 of yacc.c */ -#line 3059 "conf_parser.y" +#line 3037 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigServerHide.hidden = yylval.number; @@ -6839,7 +6817,7 @@ yyreduce: case 627: /* Line 1813 of yacc.c */ -#line 3065 "conf_parser.y" +#line 3043 "conf_parser.y" { if (conf_parser_ctx.pass == 2) ConfigServerHide.hide_server_ips = yylval.number; @@ -6848,7 +6826,7 @@ yyreduce: /* Line 1813 of yacc.c */ -#line 6852 "conf_parser.c" +#line 6830 "conf_parser.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/src/conf_parser.h b/src/conf_parser.h index ca2f469..c627256 100644 --- a/src/conf_parser.h +++ b/src/conf_parser.h @@ -480,7 +480,7 @@ extern int yydebug; typedef union YYSTYPE { /* Line 2077 of yacc.c */ -#line 110 "conf_parser.y" +#line 109 "conf_parser.y" int number; char *string; diff --git a/src/conf_parser.y b/src/conf_parser.y index 293376e..8080f77 100644 --- a/src/conf_parser.y +++ b/src/conf_parser.y @@ -33,6 +33,7 @@ #include "ircd.h" #include "list.h" #include "conf.h" +#include "conf_class.h" #include "event.h" #include "log.h" #include "client.h" /* for UMODE_ALL only */ @@ -58,9 +59,7 @@ int yylex(void); static char *class_name = NULL; -static struct ConfItem *yy_conf = NULL; -static struct AccessItem *yy_aconf = NULL; -static struct MatchItem *yy_match_item = NULL; +static struct MaskItem *yy_conf = NULL; static struct ClassItem *yy_class = NULL; static char *yy_class_name = NULL; @@ -869,9 +868,8 @@ oper_entry: OPERATOR { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(OPER_TYPE); - yy_aconf = map_to_conf(yy_conf); - SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */ + yy_conf = conf_make(CONF_OPER); + SetConfEncrypted(yy_conf); /* Yes, the default is encrypted */ } else { @@ -894,44 +892,41 @@ oper_entry: OPERATOR DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) { - struct AccessItem *new_aconf; - struct ConfItem *new_conf; + struct MaskItem *new_conf; yy_tmp = ptr->data; - new_conf = make_conf_item(OPER_TYPE); - new_aconf = (struct AccessItem *)map_to_conf(new_conf); - - new_aconf->flags = yy_aconf->flags; + new_conf = conf_make(CONF_OPER); + new_conf->flags = yy_conf->flags; if (yy_conf->name != NULL) DupString(new_conf->name, yy_conf->name); if (yy_tmp->user != NULL) - DupString(new_aconf->user, yy_tmp->user); + DupString(new_conf->user, yy_tmp->user); else - DupString(new_aconf->user, "*"); + DupString(new_conf->user, "*"); if (yy_tmp->host != NULL) - DupString(new_aconf->host, yy_tmp->host); + DupString(new_conf->host, yy_tmp->host); else - DupString(new_aconf->host, "*"); + DupString(new_conf->host, "*"); - new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->addr, - &new_aconf->bits); + new_conf->htype = parse_netmask(new_conf->host, &new_conf->addr, + &new_conf->bits); conf_add_class_to_conf(new_conf, class_name); - if (yy_aconf->passwd != NULL) - DupString(new_aconf->passwd, yy_aconf->passwd); + if (yy_conf->passwd != NULL) + DupString(new_conf->passwd, yy_conf->passwd); - new_aconf->port = yy_aconf->port; + new_conf->port = yy_conf->port; #ifdef HAVE_LIBCRYPTO - if (yy_aconf->rsa_public_key_file != NULL) + if (yy_conf->rsa_public_key_file != NULL) { BIO *file; - DupString(new_aconf->rsa_public_key_file, - yy_aconf->rsa_public_key_file); + DupString(new_conf->rsa_public_key_file, + yy_conf->rsa_public_key_file); - file = BIO_new_file(yy_aconf->rsa_public_key_file, "r"); - new_aconf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, + file = BIO_new_file(yy_conf->rsa_public_key_file, "r"); + new_conf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); BIO_set_close(file, BIO_CLOSE); BIO_free(file); @@ -939,7 +934,7 @@ oper_entry: OPERATOR #endif #ifdef HAVE_LIBCRYPTO - if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key) + if (yy_tmp->name && (yy_tmp->passwd || yy_conf->rsa_public_key) && yy_tmp->host) #else if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host) @@ -955,8 +950,6 @@ oper_entry: OPERATOR } yy_conf = NULL; - yy_aconf = NULL; - MyFree(class_name); class_name = NULL; @@ -994,13 +987,13 @@ oper_user: USER '=' QSTRING ';' split_nuh(&nuh); - if (yy_aconf->user == NULL) + if (yy_conf->user == NULL) { - DupString(yy_aconf->user, userbuf); - DupString(yy_aconf->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); - yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->addr, - &yy_aconf->bits); + yy_conf->htype = parse_netmask(yy_conf->host, &yy_conf->addr, + &yy_conf->bits); } else { @@ -1018,11 +1011,11 @@ oper_password: PASSWORD '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) { - if (yy_aconf->passwd != NULL) - memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); + if (yy_conf->passwd != NULL) + memset(yy_conf->passwd, 0, strlen(yy_conf->passwd)); - MyFree(yy_aconf->passwd); - DupString(yy_aconf->passwd, yylval.string); + MyFree(yy_conf->passwd); + DupString(yy_conf->passwd, yylval.string); } }; @@ -1031,9 +1024,9 @@ oper_encrypted: ENCRYPTED '=' TBOOL ';' if (conf_parser_ctx.pass == 2) { if (yylval.number) - SetConfEncrypted(yy_aconf); + SetConfEncrypted(yy_conf); else - ClearConfEncrypted(yy_aconf); + ClearConfEncrypted(yy_conf); } }; @@ -1044,19 +1037,19 @@ oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';' { BIO *file; - if (yy_aconf->rsa_public_key != NULL) + if (yy_conf->rsa_public_key != NULL) { - RSA_free(yy_aconf->rsa_public_key); - yy_aconf->rsa_public_key = NULL; + RSA_free(yy_conf->rsa_public_key); + yy_conf->rsa_public_key = NULL; } - if (yy_aconf->rsa_public_key_file != NULL) + if (yy_conf->rsa_public_key_file != NULL) { - MyFree(yy_aconf->rsa_public_key_file); - yy_aconf->rsa_public_key_file = NULL; + MyFree(yy_conf->rsa_public_key_file); + yy_conf->rsa_public_key_file = NULL; } - DupString(yy_aconf->rsa_public_key_file, yylval.string); + DupString(yy_conf->rsa_public_key_file, yylval.string); file = BIO_new_file(yylval.string, "r"); if (file == NULL) @@ -1065,9 +1058,9 @@ oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';' break; } - yy_aconf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); + yy_conf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); - if (yy_aconf->rsa_public_key == NULL) + if (yy_conf->rsa_public_key == NULL) { yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax."); break; @@ -1091,175 +1084,175 @@ oper_class: CLASS '=' QSTRING ';' oper_umodes: T_UMODES { if (conf_parser_ctx.pass == 2) - yy_aconf->modes = 0; + yy_conf->modes = 0; } '=' oper_umodes_items ';' ; oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item; oper_umodes_item: T_BOTS { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_BOTS; + yy_conf->modes |= UMODE_BOTS; } | T_CCONN { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_CCONN; + yy_conf->modes |= UMODE_CCONN; } | T_CCONN_FULL { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_CCONN_FULL; + yy_conf->modes |= UMODE_CCONN_FULL; } | T_DEAF { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_DEAF; + yy_conf->modes |= UMODE_DEAF; } | T_DEBUG { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_DEBUG; + yy_conf->modes |= UMODE_DEBUG; } | T_FULL { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_FULL; + yy_conf->modes |= UMODE_FULL; } | HIDDEN { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_HIDDEN; + yy_conf->modes |= UMODE_HIDDEN; } | T_SKILL { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_SKILL; + yy_conf->modes |= UMODE_SKILL; } | T_NCHANGE { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_NCHANGE; + yy_conf->modes |= UMODE_NCHANGE; } | T_REJ { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_REJ; + yy_conf->modes |= UMODE_REJ; } | T_UNAUTH { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_UNAUTH; + yy_conf->modes |= UMODE_UNAUTH; } | T_SPY { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_SPY; + yy_conf->modes |= UMODE_SPY; } | T_EXTERNAL { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_EXTERNAL; + yy_conf->modes |= UMODE_EXTERNAL; } | T_OPERWALL { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_OPERWALL; + yy_conf->modes |= UMODE_OPERWALL; } | T_SERVNOTICE { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_SERVNOTICE; + yy_conf->modes |= UMODE_SERVNOTICE; } | T_INVISIBLE { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_INVISIBLE; + yy_conf->modes |= UMODE_INVISIBLE; } | T_WALLOP { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_WALLOP; + yy_conf->modes |= UMODE_WALLOP; } | T_SOFTCALLERID { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_SOFTCALLERID; + yy_conf->modes |= UMODE_SOFTCALLERID; } | T_CALLERID { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_CALLERID; + yy_conf->modes |= UMODE_CALLERID; } | T_LOCOPS { if (conf_parser_ctx.pass == 2) - yy_aconf->modes |= UMODE_LOCOPS; + yy_conf->modes |= UMODE_LOCOPS; }; oper_flags: IRCD_FLAGS { if (conf_parser_ctx.pass == 2) - yy_aconf->port = 0; + yy_conf->port = 0; } '=' oper_flags_items ';'; oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item; oper_flags_item: GLOBAL_KILL { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_GLOBAL_KILL; + yy_conf->port |= OPER_FLAG_GLOBAL_KILL; } | REMOTE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_REMOTE; + yy_conf->port |= OPER_FLAG_REMOTE; } | KLINE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_K; + yy_conf->port |= OPER_FLAG_K; } | UNKLINE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_UNKLINE; + yy_conf->port |= OPER_FLAG_UNKLINE; } | T_DLINE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_DLINE; + yy_conf->port |= OPER_FLAG_DLINE; } | T_UNDLINE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_UNDLINE; + yy_conf->port |= OPER_FLAG_UNDLINE; } | XLINE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_X; + yy_conf->port |= OPER_FLAG_X; } | GLINE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_GLINE; + yy_conf->port |= OPER_FLAG_GLINE; } | DIE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_DIE; + yy_conf->port |= OPER_FLAG_DIE; } | T_RESTART { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_RESTART; + yy_conf->port |= OPER_FLAG_RESTART; } | REHASH { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_REHASH; + yy_conf->port |= OPER_FLAG_REHASH; } | ADMIN { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_ADMIN; + yy_conf->port |= OPER_FLAG_ADMIN; } | NICK_CHANGES { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_N; + yy_conf->port |= OPER_FLAG_N; } | T_OPERWALL { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_OPERWALL; + yy_conf->port |= OPER_FLAG_OPERWALL; } | T_GLOBOPS { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_GLOBOPS; + yy_conf->port |= OPER_FLAG_GLOBOPS; } | OPER_SPY_T { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_OPER_SPY; + yy_conf->port |= OPER_FLAG_OPER_SPY; } | REMOTEBAN { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_REMOTEBAN; + yy_conf->port |= OPER_FLAG_REMOTEBAN; } | T_SET { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_SET; + yy_conf->port |= OPER_FLAG_SET; } | MODULE { if (conf_parser_ctx.pass == 2) - yy_aconf->port |= OPER_FLAG_MODULE; + yy_conf->port |= OPER_FLAG_MODULE; }; @@ -1270,44 +1263,40 @@ class_entry: CLASS { if (conf_parser_ctx.pass == 1) { - yy_conf = make_conf_item(CLASS_TYPE); - yy_class = map_to_conf(yy_conf); + yy_class = class_make(); } } '{' class_items '}' ';' { if (conf_parser_ctx.pass == 1) { - struct ConfItem *cconf = NULL; struct ClassItem *class = NULL; if (yy_class_name == NULL) - delete_conf_item(yy_conf); + class_free(yy_class); else { - cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL); + class = class_find(yy_class_name, 0); - if (cconf != NULL) /* The class existed already */ + if (class != NULL) /* The class existed already */ { int user_count = 0; - rebuild_cidr_class(cconf, yy_class); - - class = map_to_conf(cconf); + rebuild_cidr_class(class, yy_class); - user_count = class->curr_user_count; + user_count = class->ref_count; memcpy(class, yy_class, sizeof(*class)); - class->curr_user_count = user_count; + class->ref_count = user_count; class->active = 1; - delete_conf_item(yy_conf); + class_free(yy_class); - MyFree(cconf->name); /* Allows case change of class name */ - cconf->name = yy_class_name; + MyFree(class->name); /* Allows case change of class name */ + class->name = yy_class_name; } else /* Brand new class */ { - MyFree(yy_conf->name); /* just in case it was allocated */ - yy_conf->name = yy_class_name; + MyFree(yy_class->name); /* just in case it was allocated */ + yy_class->name = yy_class_name; yy_class->active = 1; } } @@ -1526,8 +1515,7 @@ auth_entry: IRCD_AUTH { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(CLIENT_TYPE); - yy_aconf = map_to_conf(yy_conf); + yy_conf = conf_make(CONF_CLIENT); } else { @@ -1541,45 +1529,41 @@ auth_entry: IRCD_AUTH struct CollectItem *yy_tmp = NULL; dlink_node *ptr = NULL, *next_ptr = NULL; - if (yy_aconf->user && yy_aconf->host) + if (yy_conf->user && yy_conf->host) { conf_add_class_to_conf(yy_conf, class_name); - add_conf_by_address(CONF_CLIENT, yy_aconf); + add_conf_by_address(CONF_CLIENT, yy_conf); } else - delete_conf_item(yy_conf); + conf_free(yy_conf); /* copy over settings from first struct */ DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) { - struct AccessItem *new_aconf; - struct ConfItem *new_conf; - - new_conf = make_conf_item(CLIENT_TYPE); - new_aconf = map_to_conf(new_conf); + struct MaskItem *new_conf = conf_make(CONF_CLIENT); yy_tmp = ptr->data; assert(yy_tmp->user && yy_tmp->host); - if (yy_aconf->passwd != NULL) - DupString(new_aconf->passwd, yy_aconf->passwd); + if (yy_conf->passwd != NULL) + DupString(new_conf->passwd, yy_conf->passwd); if (yy_conf->name != NULL) DupString(new_conf->name, yy_conf->name); - if (yy_aconf->passwd != NULL) - DupString(new_aconf->passwd, yy_aconf->passwd); + if (yy_conf->passwd != NULL) + DupString(new_conf->passwd, yy_conf->passwd); - new_aconf->flags = yy_aconf->flags; - new_aconf->port = yy_aconf->port; + new_conf->flags = yy_conf->flags; + new_conf->port = yy_conf->port; - DupString(new_aconf->user, yy_tmp->user); - collapse(new_aconf->user); + DupString(new_conf->user, yy_tmp->user); + collapse(new_conf->user); - DupString(new_aconf->host, yy_tmp->host); - collapse(new_aconf->host); + DupString(new_conf->host, yy_tmp->host); + collapse(new_conf->host); conf_add_class_to_conf(new_conf, class_name); - add_conf_by_address(CONF_CLIENT, new_aconf); + add_conf_by_address(CONF_CLIENT, new_conf); dlinkDelete(&yy_tmp->node, &col_conf_list); free_collect_item(yy_tmp); } @@ -1587,7 +1571,6 @@ auth_entry: IRCD_AUTH MyFree(class_name); class_name = NULL; yy_conf = NULL; - yy_aconf = NULL; } }; @@ -1614,10 +1597,10 @@ auth_user: USER '=' QSTRING ';' split_nuh(&nuh); - if (yy_aconf->user == NULL) + if (yy_conf->user == NULL) { - DupString(yy_aconf->user, userbuf); - DupString(yy_aconf->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); } else { @@ -1636,11 +1619,11 @@ auth_passwd: PASSWORD '=' QSTRING ';' if (conf_parser_ctx.pass == 2) { /* be paranoid */ - if (yy_aconf->passwd != NULL) - memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); + if (yy_conf->passwd != NULL) + memset(yy_conf->passwd, 0, strlen(yy_conf->passwd)); - MyFree(yy_aconf->passwd); - DupString(yy_aconf->passwd, yylval.string); + MyFree(yy_conf->passwd); + DupString(yy_conf->passwd, yylval.string); } }; @@ -1658,9 +1641,9 @@ auth_encrypted: ENCRYPTED '=' TBOOL ';' if (conf_parser_ctx.pass == 2) { if (yylval.number) - SetConfEncrypted(yy_aconf); + SetConfEncrypted(yy_conf); else - ClearConfEncrypted(yy_aconf); + ClearConfEncrypted(yy_conf); } }; @@ -1672,39 +1655,39 @@ auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item; auth_flags_item: SPOOF_NOTICE { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE; + yy_conf->flags |= CONF_FLAGS_SPOOF_NOTICE; } | EXCEED_LIMIT { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_NOLIMIT; + yy_conf->flags |= CONF_FLAGS_NOLIMIT; } | KLINE_EXEMPT { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE; + yy_conf->flags |= CONF_FLAGS_EXEMPTKLINE; } | NEED_IDENT { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD; + yy_conf->flags |= CONF_FLAGS_NEED_IDENTD; } | CAN_FLOOD { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD; + yy_conf->flags |= CONF_FLAGS_CAN_FLOOD; } | NO_TILDE { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_NO_TILDE; + yy_conf->flags |= CONF_FLAGS_NO_TILDE; } | GLINE_EXEMPT { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE; + yy_conf->flags |= CONF_FLAGS_EXEMPTGLINE; } | RESV_EXEMPT { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV; + yy_conf->flags |= CONF_FLAGS_EXEMPTRESV; } | NEED_PASSWORD { if (conf_parser_ctx.pass == 2) - yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD; + yy_conf->flags |= CONF_FLAGS_NEED_PASSWORD; }; auth_spoof: SPOOF '=' QSTRING ';' @@ -1716,7 +1699,7 @@ auth_spoof: SPOOF '=' QSTRING ';' if (strlen(yylval.string) <= HOSTLEN && valid_hostname(yylval.string)) { DupString(yy_conf->name, yylval.string); - yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; + yy_conf->flags |= CONF_FLAGS_SPOOF_IP; } else { @@ -1730,7 +1713,7 @@ auth_redir_serv: REDIRSERV '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) { - yy_aconf->flags |= CONF_FLAGS_REDIR; + yy_conf->flags |= CONF_FLAGS_REDIR; MyFree(yy_conf->name); DupString(yy_conf->name, yylval.string); } @@ -1740,8 +1723,8 @@ auth_redir_port: REDIRPORT '=' NUMBER ';' { if (conf_parser_ctx.pass == 2) { - yy_aconf->flags |= CONF_FLAGS_REDIR; - yy_aconf->port = $3; + yy_conf->flags |= CONF_FLAGS_REDIR; + yy_conf->port = $3; } }; @@ -1816,7 +1799,7 @@ service_name: NAME '=' QSTRING ';' { if (valid_servname(yylval.string)) { - yy_conf = make_conf_item(SERVICE_TYPE); + yy_conf = conf_make(CONF_SERVICE); DupString(yy_conf->name, yylval.string); } } @@ -1829,9 +1812,8 @@ shared_entry: T_SHARED { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(ULINE_TYPE); - yy_match_item = map_to_conf(yy_conf); - yy_match_item->action = SHARED_ALL; + yy_conf = conf_make(CONF_ULINE); + yy_conf->action = SHARED_ALL; } } '{' shared_items '}' ';' { @@ -1870,58 +1852,58 @@ shared_user: USER '=' QSTRING ';' split_nuh(&nuh); - DupString(yy_match_item->user, userbuf); - DupString(yy_match_item->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); } }; shared_type: TYPE { if (conf_parser_ctx.pass == 2) - yy_match_item->action = 0; + yy_conf->action = 0; } '=' shared_types ';' ; shared_types: shared_types ',' shared_type_item | shared_type_item; shared_type_item: KLINE { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_KLINE; + yy_conf->action |= SHARED_KLINE; } | UNKLINE { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_UNKLINE; + yy_conf->action |= SHARED_UNKLINE; } | T_DLINE { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_DLINE; + yy_conf->action |= SHARED_DLINE; } | T_UNDLINE { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_UNDLINE; + yy_conf->action |= SHARED_UNDLINE; } | XLINE { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_XLINE; + yy_conf->action |= SHARED_XLINE; } | T_UNXLINE { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_UNXLINE; + yy_conf->action |= SHARED_UNXLINE; } | RESV { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_RESV; + yy_conf->action |= SHARED_RESV; } | T_UNRESV { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_UNRESV; + yy_conf->action |= SHARED_UNRESV; } | T_LOCOPS { if (conf_parser_ctx.pass == 2) - yy_match_item->action |= SHARED_LOCOPS; + yy_conf->action |= SHARED_LOCOPS; } | T_ALL { if (conf_parser_ctx.pass == 2) - yy_match_item->action = SHARED_ALL; + yy_conf->action = SHARED_ALL; }; /*************************************************************************** @@ -1931,8 +1913,7 @@ cluster_entry: T_CLUSTER { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(CLUSTER_TYPE); - yy_conf->flags = SHARED_ALL; + yy_conf = conf_make(CONF_CLUSTER); } } '{' cluster_items '}' ';' { @@ -2009,11 +1990,10 @@ connect_entry: CONNECT { if (conf_parser_ctx.pass == 2) { - yy_conf = make_conf_item(SERVER_TYPE); - yy_aconf = map_to_conf(yy_conf); + yy_conf = conf_make(CONF_SERVER); /* defaults */ - yy_aconf->port = PORTNUM; + yy_conf->port = PORTNUM; } else { @@ -2024,18 +2004,18 @@ connect_entry: CONNECT { if (conf_parser_ctx.pass == 2) { - if (yy_aconf->host && yy_aconf->passwd && yy_aconf->spasswd) + if (yy_conf->host && yy_conf->passwd && yy_conf->spasswd) { if (conf_add_server(yy_conf, class_name) == -1) - delete_conf_item(yy_conf); + conf_free(yy_conf); } else { if (yy_conf->name != NULL) { - if (yy_aconf->host == NULL) + if (yy_conf->host == NULL) yyerror("Ignoring connect block -- missing host"); - else if (!yy_aconf->passwd || !yy_aconf->spasswd) + else if (!yy_conf->passwd || !yy_conf->spasswd) yyerror("Ignoring connect block -- missing password"); } @@ -2046,13 +2026,12 @@ connect_entry: CONNECT * rewrite ASAP. make_conf_item() shouldn't really add things onto * a doubly linked list immediately without any sanity checks! -Michael */ - delete_conf_item(yy_conf); + conf_free(yy_conf); } MyFree(class_name); class_name = NULL; yy_conf = NULL; - yy_aconf = NULL; } }; @@ -2077,8 +2056,8 @@ connect_host: HOST '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) { - MyFree(yy_aconf->host); - DupString(yy_aconf->host, yylval.string); + MyFree(yy_conf->host); + DupString(yy_conf->host, yylval.string); } }; @@ -2100,9 +2079,9 @@ connect_vhost: VHOST '=' QSTRING ';' { assert(res != NULL); - memcpy(&yy_aconf->bind, res->ai_addr, res->ai_addrlen); - yy_aconf->bind.ss.ss_family = res->ai_family; - yy_aconf->bind.ss_len = res->ai_addrlen; + memcpy(&yy_conf->bind, res->ai_addr, res->ai_addrlen); + yy_conf->bind.ss.ss_family = res->ai_family; + yy_conf->bind.ss_len = res->ai_addrlen; freeaddrinfo(res); } } @@ -2117,11 +2096,11 @@ connect_send_password: SEND_PASSWORD '=' QSTRING ';' else if (strchr($3, ' ') != NULL) yyerror("Server passwords cannot contain spaces"); else { - if (yy_aconf->spasswd != NULL) - memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd)); + if (yy_conf->spasswd != NULL) + memset(yy_conf->spasswd, 0, strlen(yy_conf->spasswd)); - MyFree(yy_aconf->spasswd); - DupString(yy_aconf->spasswd, yylval.string); + MyFree(yy_conf->spasswd); + DupString(yy_conf->spasswd, yylval.string); } } }; @@ -2135,11 +2114,11 @@ connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';' else if (strchr($3, ' ') != NULL) yyerror("Server passwords cannot contain spaces"); else { - if (yy_aconf->passwd != NULL) - memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); + if (yy_conf->passwd != NULL) + memset(yy_conf->passwd, 0, strlen(yy_conf->passwd)); - MyFree(yy_aconf->passwd); - DupString(yy_aconf->passwd, yylval.string); + MyFree(yy_conf->passwd); + DupString(yy_conf->passwd, yylval.string); } } }; @@ -2147,18 +2126,18 @@ connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';' connect_port: PORT '=' NUMBER ';' { if (conf_parser_ctx.pass == 2) - yy_aconf->port = $3; + yy_conf->port = $3; }; connect_aftype: AFTYPE '=' T_IPV4 ';' { if (conf_parser_ctx.pass == 2) - yy_aconf->aftype = AF_INET; + yy_conf->aftype = AF_INET; } | AFTYPE '=' T_IPV6 ';' { #ifdef IPV6 if (conf_parser_ctx.pass == 2) - yy_aconf->aftype = AF_INET6; + yy_conf->aftype = AF_INET6; #endif }; @@ -2170,11 +2149,11 @@ connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_ connect_flags_item: AUTOCONN { if (conf_parser_ctx.pass == 2) - SetConfAllowAutoConn(yy_aconf); + SetConfAllowAutoConn(yy_conf); } | T_SSL { if (conf_parser_ctx.pass == 2) - SetConfSSL(yy_aconf); + SetConfSSL(yy_conf); }; connect_encrypted: ENCRYPTED '=' TBOOL ';' @@ -2182,9 +2161,9 @@ connect_encrypted: ENCRYPTED '=' TBOOL ';' if (conf_parser_ctx.pass == 2) { if (yylval.number) - yy_aconf->flags |= CONF_FLAGS_ENCRYPTED; + yy_conf->flags |= CONF_FLAGS_ENCRYPTED; else - yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED; + yy_conf->flags &= ~CONF_FLAGS_ENCRYPTED; } }; @@ -2195,7 +2174,7 @@ connect_hub_mask: HUB_MASK '=' QSTRING ';' char *mask; DupString(mask, yylval.string); - dlinkAdd(mask, make_dlink_node(), &yy_aconf->hub_list); + dlinkAdd(mask, make_dlink_node(), &yy_conf->hub_list); } }; @@ -2206,7 +2185,7 @@ connect_leaf_mask: LEAF_MASK '=' QSTRING ';' char *mask; DupString(mask, yylval.string); - dlinkAdd(mask, make_dlink_node(), &yy_aconf->leaf_list); + dlinkAdd(mask, make_dlink_node(), &yy_conf->leaf_list); } }; @@ -2224,8 +2203,8 @@ connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';' #ifdef HAVE_LIBCRYPTO if (conf_parser_ctx.pass == 2) { - MyFree(yy_aconf->cipher_list); - DupString(yy_aconf->cipher_list, yylval.string); + MyFree(yy_conf->cipher_list); + DupString(yy_conf->cipher_list, yylval.string); } #else if (conf_parser_ctx.pass == 2) @@ -2265,17 +2244,17 @@ kill_entry: KILL break; } - yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE)); - yy_aconf->regexuser = exp_user; - yy_aconf->regexhost = exp_host; + yy_conf = conf_make(CONF_RKLINE); + yy_conf->regexuser = exp_user; + yy_conf->regexhost = exp_host; - DupString(yy_aconf->user, userbuf); - DupString(yy_aconf->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); if (reasonbuf[0]) - DupString(yy_aconf->reason, reasonbuf); + DupString(yy_conf->reason, reasonbuf); else - DupString(yy_aconf->reason, "No reason"); + DupString(yy_conf->reason, "No reason"); #else ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support"); break; @@ -2283,20 +2262,20 @@ kill_entry: KILL } else { - yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE)); + yy_conf = conf_make(CONF_KLINE); - DupString(yy_aconf->user, userbuf); - DupString(yy_aconf->host, hostbuf); + DupString(yy_conf->user, userbuf); + DupString(yy_conf->host, hostbuf); if (reasonbuf[0]) - DupString(yy_aconf->reason, reasonbuf); + DupString(yy_conf->reason, reasonbuf); else - DupString(yy_aconf->reason, "No reason"); - add_conf_by_address(CONF_KLINE, yy_aconf); + DupString(yy_conf->reason, "No reason"); + add_conf_by_address(CONF_KLINE, yy_conf); } } - yy_aconf = NULL; + yy_conf = NULL; } }; @@ -2352,15 +2331,15 @@ deny_entry: DENY { if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST) { - yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE)); - DupString(yy_aconf->host, hostbuf); + yy_conf = conf_make(CONF_DLINE); + DupString(yy_conf->host, hostbuf); if (reasonbuf[0]) - DupString(yy_aconf->reason, reasonbuf); + DupString(yy_conf->reason, reasonbuf); else - DupString(yy_aconf->reason, "No reason"); - add_conf_by_address(CONF_DLINE, yy_aconf); - yy_aconf = NULL; + DupString(yy_conf->reason, "No reason"); + add_conf_by_address(CONF_DLINE, yy_conf); + yy_conf = NULL; } } }; @@ -2394,11 +2373,11 @@ exempt_ip: IP '=' QSTRING ';' { if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST) { - yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE)); - DupString(yy_aconf->host, yylval.string); + yy_conf = conf_make(CONF_EXEMPT); + DupString(yy_conf->host, yylval.string); - add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf); - yy_aconf = NULL; + add_conf_by_address(CONF_EXEMPT, yy_conf); + yy_conf = NULL; } } }; @@ -2432,23 +2411,22 @@ gecos_entry: GECOS break; } - yy_conf = make_conf_item(RXLINE_TYPE); - yy_conf->regexpname = exp_p; + yy_conf = conf_make(CONF_RXLINE); + yy_conf->regexuser = exp_p; #else ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support"); break; #endif } else - yy_conf = make_conf_item(XLINE_TYPE); + yy_conf = conf_make(CONF_XLINE); - yy_match_item = map_to_conf(yy_conf); DupString(yy_conf->name, gecos_name); if (reasonbuf[0]) - DupString(yy_match_item->reason, reasonbuf); + DupString(yy_conf->reason, reasonbuf); else - DupString(yy_match_item->reason, "No reason"); + DupString(yy_conf->reason, "No reason"); } } }; @@ -57,7 +57,7 @@ static struct Client *idTable[HASHSIZE]; static struct Client *clientTable[HASHSIZE]; static struct Channel *channelTable[HASHSIZE]; static struct UserHost *userhostTable[HASHSIZE]; -static struct ResvChannel *resvchannelTable[HASHSIZE]; +static struct MaskItem *resvchannelTable[HASHSIZE]; /* init_hash() @@ -153,12 +153,12 @@ hash_add_channel(struct Channel *chptr) } void -hash_add_resv(struct ResvChannel *chptr) +hash_add_resv(struct MaskItem *conf) { - unsigned int hashv = strhash(chptr->name); + unsigned int hashv = strhash(conf->name); - chptr->hnext = resvchannelTable[hashv]; - resvchannelTable[hashv] = chptr; + conf->hnext = resvchannelTable[hashv]; + resvchannelTable[hashv] = conf; } void @@ -305,10 +305,10 @@ hash_del_channel(struct Channel *chptr) } void -hash_del_resv(struct ResvChannel *chptr) +hash_del_resv(struct MaskItem *chptr) { unsigned int hashv = strhash(chptr->name); - struct ResvChannel *tmp = resvchannelTable[hashv]; + struct MaskItem *tmp = resvchannelTable[hashv]; if (tmp != NULL) { @@ -511,17 +511,17 @@ hash_get_bucket(int type, unsigned int hashv) * if can't find one returns NULL, if can find it moves * it to the top of the list and returns it. */ -struct ResvChannel * +struct MaskItem * hash_find_resv(const char *name) { unsigned int hashv = strhash(name); - struct ResvChannel *chptr; + struct MaskItem *chptr; if ((chptr = resvchannelTable[hashv]) != NULL) { if (irccmp(name, chptr->name)) { - struct ResvChannel *prev; + struct MaskItem *prev; while (prev = chptr, (chptr = chptr->hnext) != NULL) { @@ -769,7 +769,7 @@ delete_user_host(const char *user, const char *host, int global) static int exceeding_sendq(struct Client *to) { - if (dbuf_length(&to->localClient->buf_sendq) > (get_sendq(to) / 2)) + if (dbuf_length(&to->localClient->buf_sendq) > (get_sendq(&to->localClient->confs) / 2)) return 1; else return 0; diff --git a/src/hostmask.c b/src/hostmask.c index e7d014d..c033e2d 100644 --- a/src/hostmask.c +++ b/src/hostmask.c @@ -437,7 +437,7 @@ get_mask_hash(const char *text) return hash_text(text); } -/* struct AccessItem *find_conf_by_address(const char *, struct irc_ssaddr *, +/* struct MaskItem *find_conf_by_address(const char *, struct irc_ssaddr *, * int type, int fam, const char *username) * Input: The hostname, the address, the type of mask to find, the address * family, the username. @@ -445,16 +445,16 @@ get_mask_hash(const char *text) * Side-effects: None * Note: Setting bit 0 of the type means that the username is ignored. * Warning: IsNeedPassword for everything that is not an auth{} entry - * should always be true (i.e. aconf->flags & CONF_FLAGS_NEED_PASSWORD == 0) + * should always be true (i.e. conf->flags & CONF_FLAGS_NEED_PASSWORD == 0) */ -struct AccessItem * +struct MaskItem * find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int type, int fam, const char *username, const char *password, int do_match) { unsigned int hprecv = 0; dlink_node *ptr = NULL; - struct AccessItem *hprec = NULL; - struct AddressRec *arec; + struct MaskItem *hprec = NULL; + struct AddressRec *arec = NULL; int b; int (*cmpfunc)(const char *, const char *) = do_match ? match : irccmp; @@ -481,11 +481,11 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ match_ipv6(addr, &arec->Mask.ipa.addr, arec->Mask.ipa.bits) && (type & 0x1 || cmpfunc(arec->username, username) == do_match) && - (IsNeedPassword(arec->aconf) || arec->aconf->passwd == NULL || - match_conf_password(password, arec->aconf))) + (IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || + match_conf_password(password, arec->conf))) { hprecv = arec->precedence; - hprec = arec->aconf; + hprec = arec->conf; } } } @@ -506,11 +506,11 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ match_ipv4(addr, &arec->Mask.ipa.addr, arec->Mask.ipa.bits) && (type & 0x1 || cmpfunc(arec->username, username) == do_match) && - (IsNeedPassword(arec->aconf) || arec->aconf->passwd == NULL || - match_conf_password(password, arec->aconf))) + (IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || + match_conf_password(password, arec->conf))) { hprecv = arec->precedence; - hprec = arec->aconf; + hprec = arec->conf; } } } @@ -531,11 +531,11 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ (arec->masktype == HM_HOST) && cmpfunc(arec->Mask.hostname, name) == do_match && (type & 0x1 || cmpfunc(arec->username, username) == do_match) && - (IsNeedPassword(arec->aconf) || arec->aconf->passwd == NULL || - match_conf_password(password, arec->aconf))) + (IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || + match_conf_password(password, arec->conf))) { hprecv = arec->precedence; - hprec = arec->aconf; + hprec = arec->conf; } } p = strchr(p, '.'); @@ -553,11 +553,11 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ arec->masktype == HM_HOST && cmpfunc(arec->Mask.hostname, name) == do_match && (type & 0x1 || cmpfunc(arec->username, username) == do_match) && - (IsNeedPassword(arec->aconf) || arec->aconf->passwd == NULL || - match_conf_password(password, arec->aconf))) + (IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || + match_conf_password(password, arec->conf))) { hprecv = arec->precedence; - hprec = arec->aconf; + hprec = arec->conf; } } } @@ -565,56 +565,59 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ return hprec; } -/* struct AccessItem* find_address_conf(const char*, const char*, +/* struct MaskItem* find_address_conf(const char*, const char*, * struct irc_ssaddr*, int, char *); * Input: The hostname, username, address, address family. - * Output: The applicable AccessItem. + * Output: The applicable MaskItem. * Side-effects: None */ -struct AccessItem * +struct MaskItem * find_address_conf(const char *host, const char *user, struct irc_ssaddr *ip, int aftype, char *password) { - struct AccessItem *iconf, *kconf; + struct MaskItem *authcnf = NULL, *killcnf = NULL; /* Find the best auth{} block... If none, return NULL -A1kmm */ - if ((iconf = find_conf_by_address(host, ip, CONF_CLIENT, aftype, user, - password, 1)) == NULL) + if ((authcnf = find_conf_by_address(host, ip, CONF_CLIENT, aftype, user, + password, 1)) == NULL) return NULL; /* If they are exempt from K-lines, return the best auth{} block. -A1kmm */ - if (IsConfExemptKline(iconf)) - return iconf; + if (IsConfExemptKline(authcnf)) + return authcnf; /* Find the best K-line... -A1kmm */ - kconf = find_conf_by_address(host, ip, CONF_KLINE, aftype, user, NULL, 1); + killcnf = find_conf_by_address(host, ip, CONF_KLINE, aftype, user, NULL, 1); /* * If they are K-lined, return the K-line. Otherwise, return the * auth{} block. -A1kmm */ - if (kconf != NULL) - return kconf; + if (killcnf != NULL) + return killcnf; + + if (IsConfExemptGline(authcnf)) + return authcnf; - kconf = find_conf_by_address(host, ip, CONF_GLINE, aftype, user, NULL, 1); - if (kconf != NULL && !IsConfExemptGline(iconf)) - return kconf; + killcnf = find_conf_by_address(host, ip, CONF_GLINE, aftype, user, NULL, 1); + if (killcnf != NULL) + return killcnf; - return iconf; + return authcnf; } -/* struct AccessItem* find_dline_conf(struct irc_ssaddr*, int) +/* struct MaskItem* find_dline_conf(struct irc_ssaddr*, int) * * Input: An address, an address family. * Output: The best matching D-line or exempt line. * Side effects: None. */ -struct AccessItem * +struct MaskItem * find_dline_conf(struct irc_ssaddr *addr, int aftype) { - struct AccessItem *eline; + struct MaskItem *eline; - eline = find_conf_by_address(NULL, addr, CONF_EXEMPTDLINE | 1, aftype, + eline = find_conf_by_address(NULL, addr, CONF_EXEMPT | 1, aftype, NULL, NULL, 1); if (eline != NULL) return eline; @@ -622,13 +625,13 @@ find_dline_conf(struct irc_ssaddr *addr, int aftype) return find_conf_by_address(NULL, addr, CONF_DLINE | 1, aftype, NULL, NULL, 1); } -/* void add_conf_by_address(int, struct AccessItem *aconf) +/* void add_conf_by_address(int, struct MaskItem *aconf) * Input: * Output: None * Side-effects: Adds this entry to the hash table. */ void -add_conf_by_address(const unsigned int type, struct AccessItem *aconf) +add_conf_by_address(const unsigned int type, struct MaskItem *conf) { const char *address; const char *username; @@ -636,11 +639,10 @@ add_conf_by_address(const unsigned int type, struct AccessItem *aconf) int bits = 0; struct AddressRec *arec; - address = aconf->host; - username = aconf->user; + address = conf->host; + username = conf->user; - assert(type != 0); - assert(aconf != NULL); + assert(type); if (EmptyString(address)) address = "/NOMATCH!/"; @@ -649,7 +651,7 @@ add_conf_by_address(const unsigned int type, struct AccessItem *aconf) arec->masktype = parse_netmask(address, &arec->Mask.ipa.addr, &bits); arec->Mask.ipa.bits = bits; arec->username = username; - arec->aconf = aconf; + arec->conf = conf; arec->precedence = prec_value--; arec->type = type; @@ -674,14 +676,14 @@ add_conf_by_address(const unsigned int type, struct AccessItem *aconf) } } -/* void delete_one_address(const char*, struct AccessItem*) - * Input: An address string, the associated AccessItem. +/* void delete_one_address(const char*, struct MaskItem*) + * Input: An address string, the associated MaskItem. * Output: None - * Side effects: Deletes an address record. Frees the AccessItem if there + * Side effects: Deletes an address record. Frees the MaskItem if there * is nothing referencing it, sets it as illegal otherwise. */ void -delete_one_address_conf(const char *address, struct AccessItem *aconf) +delete_one_address_conf(const char *address, struct MaskItem *conf) { int bits = 0; uint32_t hv = 0; @@ -711,13 +713,12 @@ delete_one_address_conf(const char *address, struct AccessItem *aconf) { struct AddressRec *arec = ptr->data; - if (arec->aconf == aconf) + if (arec->conf == conf) { dlinkDelete(&arec->node, &atable[hv]); - aconf->status |= CONF_ILLEGAL; - if (!aconf->clients) - free_access_item(aconf); + if (!conf->clients) + conf_free(conf); MyFree(arec); return; @@ -729,7 +730,7 @@ delete_one_address_conf(const char *address, struct AccessItem *aconf) * Input: None * Output: None * Side effects: Clears out all address records in the hash table, - * frees them, and frees the AccessItems if nothing references + * frees them, and frees the MaskItems if nothing references * them, otherwise sets them as illegal. */ void @@ -748,14 +749,13 @@ clear_out_address_conf(void) * We keep the temporary K-lines and destroy the permanent ones, * just to be confusing :) -A1kmm */ - if (arec->aconf->hold || IsConfDatabase(arec->aconf)) + if (arec->conf->hold || IsConfDatabase(arec->conf)) continue; dlinkDelete(&arec->node, &atable[i]); - arec->aconf->status |= CONF_ILLEGAL; - if (!arec->aconf->clients) - free_access_item(arec->aconf); + if (!arec->conf->clients) + conf_free(arec->conf); MyFree(arec); } } @@ -784,8 +784,8 @@ hostmask_send_expiration(struct AddressRec *arec) sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Temporary %c-line for [%s@%s] expired", ban_type, - (arec->aconf->user) ? arec->aconf->user : "*", - (arec->aconf->host) ? arec->aconf->host : "*"); + (arec->conf->user) ? arec->conf->user : "*", + (arec->conf->host) ? arec->conf->host : "*"); } void @@ -800,7 +800,7 @@ hostmask_expire_temporary(void) { struct AddressRec *arec = ptr->data; - if (!arec->aconf->hold || arec->aconf->hold > CurrentTime) + if (!arec->conf->hold || arec->conf->hold > CurrentTime) continue; switch (arec->type) @@ -811,7 +811,7 @@ hostmask_expire_temporary(void) hostmask_send_expiration(arec); dlinkDelete(&arec->node, &atable[i]); - free_access_item(arec->aconf); + conf_free(arec->conf); MyFree(arec); break; } @@ -36,6 +36,7 @@ #include "ircd_signal.h" #include "s_gline.h" #include "motd.h" +#include "conf.h" #include "hostmask.h" #include "numeric.h" #include "packet.h" @@ -45,7 +46,6 @@ #include "rng_mt.h" #include "s_auth.h" #include "s_bsd.h" -#include "conf.h" #include "log.h" #include "s_misc.h" #include "s_serv.h" /* try_connections */ @@ -60,6 +60,7 @@ #include "supported.h" #include "watch.h" #include "conf_db.h" +#include "conf_class.h" /* /quote set variables */ struct SetOptions GlobalSetOptions; @@ -556,7 +557,7 @@ main(int argc, char *argv[]) init_ip_hash_table(); /* client host ip hash table */ init_host_hash(); /* Host-hashtable. */ init_client(); - init_class(); + class_init(); whowas_init(); watch_init(); init_auth(); /* Initialise the auth code */ diff --git a/src/packet.c b/src/packet.c index aeb4ac6..b6224e6 100644 --- a/src/packet.c +++ b/src/packet.c @@ -364,7 +364,7 @@ read_packet(fde_t *fd, void *data) /* Check to make sure we're not flooding */ if (!(IsServer(client_p) || IsHandshake(client_p) || IsConnecting(client_p)) && (dbuf_length(&client_p->localClient->buf_recvq) > - get_recvq(client_p))) + get_recvq(&client_p->localClient->confs))) { if (!(ConfigFileEntry.no_oper_flood && HasUMode(client_p, UMODE_OPER))) { @@ -47,11 +47,10 @@ dlink_list resv_channel_list = { NULL, NULL, 0 }; * output - pointer to struct ResvChannel * side effects - */ -struct ConfItem * +struct MaskItem * create_channel_resv(char *name, char *reason, int in_conf) { - struct ConfItem *conf = NULL; - struct ResvChannel *resv_p = NULL; + struct MaskItem *conf = NULL; if (name == NULL || reason == NULL) return NULL; @@ -62,15 +61,13 @@ create_channel_resv(char *name, char *reason, int in_conf) if (strlen(reason) > REASONLEN) reason[REASONLEN] = '\0'; - conf = make_conf_item(CRESV_TYPE); - resv_p = map_to_conf(conf); + conf = conf_make(CONF_CRESV); - strlcpy(resv_p->name, name, sizeof(resv_p->name)); DupString(conf->name, name); - DupString(resv_p->reason, reason); + DupString(conf->reason, reason); - dlinkAdd(resv_p, &resv_p->node, &resv_channel_list); - hash_add_resv(resv_p); + dlinkAdd(conf, &conf->node, &resv_channel_list); + hash_add_resv(conf); return conf; } @@ -83,26 +80,24 @@ create_channel_resv(char *name, char *reason, int in_conf) * output - pointer to struct ResvNick * side effects - */ -struct ConfItem * +struct MaskItem * create_nick_resv(char *name, char *reason, int in_conf) { - struct ConfItem *conf = NULL; - struct MatchItem *resv_p = NULL; + struct MaskItem *conf = NULL; if (name == NULL || reason == NULL) return NULL; - if (find_matching_name_conf(NRESV_TYPE, name, NULL, NULL, 0)) + if (find_matching_name_conf(CONF_NRESV, name, NULL, NULL, 0)) return NULL; if (strlen(reason) > REASONLEN) reason[REASONLEN] = '\0'; - conf = make_conf_item(NRESV_TYPE); - resv_p = map_to_conf(conf); + conf = conf_make(CONF_NRESV); DupString(conf->name, name); - DupString(resv_p->reason, reason); + DupString(conf->reason, reason); return conf; } @@ -120,10 +115,10 @@ clear_conf_resv(void) DLINK_FOREACH_SAFE(ptr, next_ptr, resv_channel_list.head) { - struct ResvChannel *resv_p = ptr->data; + struct MaskItem *conf = ptr->data; - if (!IsConfDatabase(resv_p)) - delete_channel_resv(resv_p); + if (!IsConfDatabase(conf)) + delete_channel_resv(conf); } } @@ -134,16 +129,11 @@ clear_conf_resv(void) * side effects - given struct ResvChannel * is removed */ int -delete_channel_resv(struct ResvChannel *resv_p) +delete_channel_resv(struct MaskItem *conf) { - struct ConfItem *conf = NULL; - assert(resv_p != NULL); - - hash_del_resv(resv_p); - dlinkDelete(&resv_p->node, &resv_channel_list); - MyFree(resv_p->reason); - conf = unmap_conf_item(resv_p); - delete_conf_item(conf); + hash_del_resv(conf); + dlinkDelete(&conf->node, &resv_channel_list); + conf_free(conf); return 1; } @@ -155,7 +145,7 @@ delete_channel_resv(struct ResvChannel *resv_p) * side effects - Finds a reserved channel whose name matches 'name', * if can't find one returns NULL. */ -struct ResvChannel * +struct MaskItem * match_find_resv(const char *name) { dlink_node *ptr = NULL; @@ -165,10 +155,10 @@ match_find_resv(const char *name) DLINK_FOREACH(ptr, resv_channel_list.head) { - struct ResvChannel *chptr = ptr->data; + struct MaskItem *conf = ptr->data; - if (match_chan(name, chptr->name)) - return chptr; + if (match_chan(name, conf->name)) + return conf; } return NULL; @@ -183,29 +173,25 @@ match_find_resv(const char *name) void report_resv(struct Client *source_p) { - dlink_node *ptr; - struct ConfItem *conf; - struct ResvChannel *resv_cp; - struct MatchItem *resv_np; + dlink_node *ptr = NULL; + struct MaskItem *conf = NULL; DLINK_FOREACH(ptr, resv_channel_list.head) { - resv_cp = ptr->data; + conf = ptr->data; sendto_one(source_p, form_str(RPL_STATSQLINE), me.name, source_p->name, - resv_cp->hold ? 'q' : 'Q', - resv_cp->name, resv_cp->reason); + conf->hold ? 'q' : 'Q', + conf->name, conf->reason); } DLINK_FOREACH(ptr, nresv_items.head) { - conf = ptr->data; - resv_np = map_to_conf(conf); - + conf = ptr->data;; sendto_one(source_p, form_str(RPL_STATSQLINE), me.name, source_p->name, - resv_np->hold ? 'q' : 'Q', - conf->name, resv_np->reason); + conf->hold ? 'q' : 'Q', + conf->name, conf->reason); } } diff --git a/src/s_bsd.c b/src/s_bsd.c index 5eaae02..b3ea5f1 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -177,8 +177,6 @@ init_comm(void) void close_connection(struct Client *client_p) { - struct AccessItem *aconf; - struct ClassItem *aclass; dlink_node *ptr = NULL; assert(client_p); @@ -210,7 +208,7 @@ close_connection(struct Client *client_p) DLINK_FOREACH(ptr, server_items.head) { - struct ConfItem *conf = ptr->data; + struct MaskItem *conf = ptr->data; if (irccmp(conf->name, client_p->name)) continue; @@ -219,9 +217,7 @@ close_connection(struct Client *client_p) * Reset next-connect cycle of all connect{} blocks that match * this servername. */ - aconf = map_to_conf(conf); - aclass = map_to_conf(aconf->class_ptr); - aconf->hold = CurrentTime + aclass->con_freq; + conf->hold = CurrentTime + conf->class->con_freq; } } else @@ -243,7 +239,7 @@ close_connection(struct Client *client_p) dbuf_clear(&client_p->localClient->buf_recvq); MyFree(client_p->localClient->passwd); - detach_conf(client_p, CONF_TYPE); + detach_conf(client_p, CONF_CLIENT|CONF_OPER|CONF_SERVER); client_p->from = NULL; /* ...this should catch them! >:) --msa */ } diff --git a/src/s_gline.c b/src/s_gline.c index aff7a05..3d563be 100644 --- a/src/s_gline.c +++ b/src/s_gline.c @@ -27,8 +27,8 @@ #include "client.h" #include "irc_string.h" #include "ircd.h" -#include "hostmask.h" #include "conf.h" +#include "hostmask.h" #include "s_misc.h" #include "send.h" #include "s_serv.h" @@ -42,11 +42,11 @@ dlink_list pending_glines[GLINE_PENDING_ADD_TYPE + 1] = { { NULL, NULL, 0 }, static void expire_pending_glines(struct gline_pending *); -struct AccessItem * +struct MaskItem * find_is_glined(const char *host, const char *user) { struct irc_ssaddr iphost, *piphost; - struct AccessItem *aconf; + struct MaskItem *conf = NULL; int t; if ((t = parse_netmask(host, &iphost, &t)) != HM_HOST) @@ -65,8 +65,8 @@ find_is_glined(const char *host, const char *user) piphost = NULL; } - aconf = find_conf_by_address(host, piphost, CONF_GLINE, t, user, NULL, 0); - return aconf; + conf = find_conf_by_address(host, piphost, CONF_GLINE, t, user, NULL, 0); + return conf; } /* cleanup_glines() diff --git a/src/s_serv.c b/src/s_serv.c index ea2da4e..69e40cb 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -271,10 +271,8 @@ hunt_server(struct Client *client_p, struct Client *source_p, const char *comman void try_connections(void *unused) { - dlink_node *ptr; - struct ConfItem *conf; - struct AccessItem *aconf; - struct ClassItem *cltmp; + dlink_node *ptr = NULL; + struct MaskItem *conf; int confrq; /* TODO: change this to set active flag to 0 when added to event! --Habeeb */ @@ -284,15 +282,14 @@ try_connections(void *unused) DLINK_FOREACH(ptr, server_items.head) { conf = ptr->data; - aconf = map_to_conf(conf); + + assert(conf->status & CONF_SERVER); /* Also when already connecting! (update holdtimes) --SRB */ - if (!(aconf->status & CONF_SERVER) || !aconf->port || - !(IsConfAllowAutoConn(aconf))) + if (!conf->port ||!IsConfAllowAutoConn(conf)) continue; - cltmp = map_to_conf(aconf->class_ptr); /* Skip this entry if the use of it is still on hold until * future. Otherwise handle this entry (and set it on hold @@ -300,19 +297,19 @@ try_connections(void *unused) * made one successfull connection... [this algorithm is * a bit fuzzy... -- msa >;) ] */ - if (aconf->hold > CurrentTime) + if (conf->hold > CurrentTime) continue; - if (cltmp == NULL) + if (conf->class == NULL) confrq = DEFAULT_CONNECTFREQUENCY; else { - confrq = cltmp->con_freq; + confrq = conf->class->con_freq; if (confrq < MIN_CONN_FREQ) confrq = MIN_CONN_FREQ; } - aconf->hold = CurrentTime + confrq; + conf->hold = CurrentTime + confrq; /* Found a CONNECT config with port specified, scan clients * and see if this server is already connected? @@ -320,7 +317,7 @@ try_connections(void *unused) if (hash_find_server(conf->name) != NULL) continue; - if (cltmp->curr_user_count < cltmp->max_total) + if (conf->class->ref_count < conf->class->max_total) { /* Go to the end of the list, if not already last */ if (ptr->next != NULL) @@ -347,9 +344,9 @@ try_connections(void *unused) else sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Connection to %s[%s] activated.", - conf->name, aconf->host); + conf->name, conf->host); - serv_connect(aconf, NULL); + serv_connect(conf, NULL); /* We connect only one at time... */ return; } @@ -381,10 +378,8 @@ int check_server(const char *name, struct Client *client_p) { dlink_node *ptr; - struct ConfItem *conf = NULL; - struct ConfItem *server_conf = NULL; - struct AccessItem *server_aconf = NULL; - struct AccessItem *aconf = NULL; + struct MaskItem *conf = NULL; + struct MaskItem *server_conf = NULL; int error = -1; assert(client_p != NULL); @@ -393,7 +388,6 @@ check_server(const char *name, struct Client *client_p) DLINK_FOREACH(ptr, server_items.head) { conf = ptr->data; - aconf = map_to_conf(conf); if (!match(name, conf->name)) continue; @@ -402,12 +396,12 @@ check_server(const char *name, struct Client *client_p) /* XXX: Fix me for IPv6 */ /* XXX sockhost is the IPv4 ip as a string */ - if (match(aconf->host, client_p->host) || - match(aconf->host, client_p->sockhost)) + if (match(conf->host, client_p->host) || + match(conf->host, client_p->sockhost)) { error = -2; - if (!match_conf_password(client_p->localClient->passwd, aconf)) + if (!match_conf_password(client_p->localClient->passwd, conf)) return -2; server_conf = conf; @@ -419,29 +413,28 @@ check_server(const char *name, struct Client *client_p) attach_conf(client_p, server_conf); - server_aconf = map_to_conf(server_conf); - if (aconf != NULL) + if (server_conf != NULL) { struct sockaddr_in *v4; #ifdef IPV6 struct sockaddr_in6 *v6; #endif - switch (aconf->aftype) + switch (server_conf->aftype) { #ifdef IPV6 case AF_INET6: - v6 = (struct sockaddr_in6 *)&aconf->addr; + v6 = (struct sockaddr_in6 *)&server_conf->addr; if (IN6_IS_ADDR_UNSPECIFIED(&v6->sin6_addr)) - memcpy(&aconf->addr, &client_p->localClient->ip, sizeof(struct irc_ssaddr)); + memcpy(&server_conf->addr, &client_p->localClient->ip, sizeof(struct irc_ssaddr)); break; #endif case AF_INET: - v4 = (struct sockaddr_in *)&aconf->addr; + v4 = (struct sockaddr_in *)&server_conf->addr; if (v4->sin_addr.s_addr == INADDR_NONE) - memcpy(&aconf->addr, &client_p->localClient->ip, sizeof(struct irc_ssaddr)); + memcpy(&server_conf->addr, &client_p->localClient->ip, sizeof(struct irc_ssaddr)); break; } } @@ -530,15 +523,13 @@ find_capability(const char *capab) /* send_capabilities() * * inputs - Client pointer to send to - * - Pointer to AccessItem (for crypt) * - int flag of capabilities that this server can send * output - NONE * side effects - send the CAPAB line to a server -orabidoo * */ void -send_capabilities(struct Client *client_p, struct AccessItem *aconf, - int cap_can_send) +send_capabilities(struct Client *client_p, int cap_can_send) { struct Capability *cap=NULL; char msgbuf[IRCD_BUFSIZE]; @@ -683,8 +674,7 @@ void server_estab(struct Client *client_p) { struct Client *target_p; - struct ConfItem *conf; - struct AccessItem *aconf=NULL; + struct MaskItem *conf = NULL; char *host; const char *inpath; static char inpath_ip[HOSTLEN * 2 + USERLEN + 6]; @@ -700,7 +690,7 @@ server_estab(struct Client *client_p) inpath = get_client_name(client_p, MASK_IP); /* "refresh" inpath with host */ host = client_p->name; - if ((conf = find_conf_name(&client_p->localClient->confs, host, SERVER_TYPE)) + if ((conf = find_conf_name(&client_p->localClient->confs, host, CONF_SERVER)) == NULL) { /* This shouldn't happen, better tell the ops... -A1kmm */ @@ -731,25 +721,16 @@ server_estab(struct Client *client_p) } } - aconf = map_to_conf(conf); - if (IsUnknown(client_p)) { /* jdc -- 1. Use EmptyString(), not [0] index reference. - * 2. Check aconf->spasswd, not aconf->passwd. + * 2. Check conf->spasswd, not conf->passwd. */ - if (!EmptyString(aconf->spasswd)) + if (!EmptyString(conf->spasswd)) sendto_one(client_p, "PASS %s TS %d %s", - aconf->spasswd, TS_CURRENT, me.id); + conf->spasswd, TS_CURRENT, me.id); - /* Pass my info to the new server - * - * Pass on ZIP if supported - * Pass on TB if supported. - * - Dianora - */ - - send_capabilities(client_p, aconf, 0); + send_capabilities(client_p, 0); sendto_one(client_p, "SERVER %s 1 :%s%s", me.name, ConfigServerHide.hidden ? "(H) " : "", me.info); @@ -763,7 +744,7 @@ server_estab(struct Client *client_p) hash_add_id(client_p); /* XXX Does this ever happen? I don't think so -db */ - detach_conf(client_p, OPER_TYPE); + detach_conf(client_p, CONF_OPER); /* *WARNING* ** In the following code in place of plain server's @@ -805,7 +786,7 @@ server_estab(struct Client *client_p) /* fixing eob timings.. -gnp */ client_p->localClient->firsttime = CurrentTime; - if (find_matching_name_conf(SERVICE_TYPE, client_p->name, NULL, NULL, 0)) + if (find_matching_name_conf(CONF_SERVICE, client_p->name, NULL, NULL, 0)) AddFlag(client_p, FLAGS_SERVICE); /* Show the real host/IP to admins */ @@ -1078,28 +1059,24 @@ burst_members(struct Client *client_p, struct Channel *chptr) * it suceeded or not, and 0 if it fails in here somewhere. */ int -serv_connect(struct AccessItem *aconf, struct Client *by) +serv_connect(struct MaskItem *conf, struct Client *by) { - struct ConfItem *conf; struct Client *client_p; char buf[HOSTIPLEN + 1]; /* conversion structs */ struct sockaddr_in *v4; - /* Make sure aconf is useful */ - assert(aconf != NULL); + /* Make sure conf is useful */ + assert(conf != NULL); - /* XXX should be passing struct ConfItem in the first place */ - conf = unmap_conf_item(aconf); - /* log */ - getnameinfo((struct sockaddr *)&aconf->addr, aconf->addr.ss_len, + getnameinfo((struct sockaddr *)&conf->addr, conf->addr.ss_len, buf, sizeof(buf), NULL, 0, NI_NUMERICHOST); - ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", conf->name, aconf->host, + ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", conf->name, conf->host, buf); /* Still processing a DNS lookup? -> exit */ - if (aconf->dns_pending) + if (conf->dns_pending) { sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Error connecting to %s: DNS lookup for connect{} in progress.", @@ -1107,7 +1084,7 @@ serv_connect(struct AccessItem *aconf, struct Client *by) return (0); } - if (aconf->dns_failed) + if (conf->dns_failed) { sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Error connecting to %s: DNS lookup for connect{} failed.", @@ -1116,7 +1093,7 @@ serv_connect(struct AccessItem *aconf, struct Client *by) } /* Make sure this server isn't already connected - * Note: aconf should ALWAYS be a valid C: line + * Note: conf should ALWAYS be a valid C: line */ if ((client_p = hash_find_server(conf->name)) != NULL) { @@ -1138,13 +1115,13 @@ serv_connect(struct AccessItem *aconf, struct Client *by) /* Copy in the server, hostname, fd */ strlcpy(client_p->name, conf->name, sizeof(client_p->name)); - strlcpy(client_p->host, aconf->host, sizeof(client_p->host)); + strlcpy(client_p->host, conf->host, sizeof(client_p->host)); /* We already converted the ip once, so lets use it - stu */ strlcpy(client_p->sockhost, buf, sizeof(client_p->sockhost)); /* create a socket for the server connection */ - if (comm_open(&client_p->localClient->fd, aconf->addr.ss.ss_family, + if (comm_open(&client_p->localClient->fd, conf->addr.ss.ss_family, SOCK_STREAM, 0, NULL) < 0) { /* Eek, failure to create the socket */ @@ -1161,7 +1138,7 @@ serv_connect(struct AccessItem *aconf, struct Client *by) /* Attach config entries to client here rather than in * serv_connect_callback(). This to avoid null pointer references. */ - if (!attach_connect_block(client_p, conf->name, aconf->host)) + if (!attach_connect_block(client_p, conf->name, conf->host)) { sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Host %s is not enabled for connecting: no connect{} block", @@ -1190,26 +1167,26 @@ serv_connect(struct AccessItem *aconf, struct Client *by) SetConnecting(client_p); dlinkAdd(client_p, &client_p->node, &global_client_list); /* from def_fam */ - client_p->localClient->aftype = aconf->aftype; + client_p->localClient->aftype = conf->aftype; /* Now, initiate the connection */ /* XXX assume that a non 0 type means a specific bind address * for this connect. */ - switch (aconf->aftype) + switch (conf->aftype) { case AF_INET: - v4 = (struct sockaddr_in*)&aconf->bind; + v4 = (struct sockaddr_in*)&conf->bind; if (v4->sin_addr.s_addr != 0) { struct irc_ssaddr ipn; memset(&ipn, 0, sizeof(struct irc_ssaddr)); ipn.ss.ss_family = AF_INET; ipn.ss_port = 0; - memcpy(&ipn, &aconf->bind, sizeof(struct irc_ssaddr)); - comm_connect_tcp(&client_p->localClient->fd, aconf->host, aconf->port, + memcpy(&ipn, &conf->bind, sizeof(struct irc_ssaddr)); + comm_connect_tcp(&client_p->localClient->fd, conf->host, conf->port, (struct sockaddr *)&ipn, ipn.ss_len, - serv_connect_callback, client_p, aconf->aftype, + serv_connect_callback, client_p, conf->aftype, CONNECTTIMEOUT); } else if (ServerInfo.specific_ipv4_vhost) @@ -1219,14 +1196,14 @@ serv_connect(struct AccessItem *aconf, struct Client *by) ipn.ss.ss_family = AF_INET; ipn.ss_port = 0; memcpy(&ipn, &ServerInfo.ip, sizeof(struct irc_ssaddr)); - comm_connect_tcp(&client_p->localClient->fd, aconf->host, aconf->port, + comm_connect_tcp(&client_p->localClient->fd, conf->host, conf->port, (struct sockaddr *)&ipn, ipn.ss_len, - serv_connect_callback, client_p, aconf->aftype, + serv_connect_callback, client_p, conf->aftype, CONNECTTIMEOUT); } else - comm_connect_tcp(&client_p->localClient->fd, aconf->host, aconf->port, - NULL, 0, serv_connect_callback, client_p, aconf->aftype, + comm_connect_tcp(&client_p->localClient->fd, conf->host, conf->port, + NULL, 0, serv_connect_callback, client_p, conf->aftype, CONNECTTIMEOUT); break; #ifdef IPV6 @@ -1237,20 +1214,20 @@ serv_connect(struct AccessItem *aconf, struct Client *by) struct sockaddr_in6 *v6conf; memset(&ipn, 0, sizeof(struct irc_ssaddr)); - v6conf = (struct sockaddr_in6 *)&aconf->bind; + v6conf = (struct sockaddr_in6 *)&conf->bind; v6 = (struct sockaddr_in6 *)&ipn; if (memcmp(&v6conf->sin6_addr, &v6->sin6_addr, sizeof(struct in6_addr)) != 0) { - memcpy(&ipn, &aconf->bind, sizeof(struct irc_ssaddr)); + memcpy(&ipn, &conf->bind, sizeof(struct irc_ssaddr)); ipn.ss.ss_family = AF_INET6; ipn.ss_port = 0; comm_connect_tcp(&client_p->localClient->fd, - aconf->host, aconf->port, + conf->host, conf->port, (struct sockaddr *)&ipn, ipn.ss_len, serv_connect_callback, client_p, - aconf->aftype, CONNECTTIMEOUT); + conf->aftype, CONNECTTIMEOUT); } else if (ServerInfo.specific_ipv6_vhost) { @@ -1258,16 +1235,16 @@ serv_connect(struct AccessItem *aconf, struct Client *by) ipn.ss.ss_family = AF_INET6; ipn.ss_port = 0; comm_connect_tcp(&client_p->localClient->fd, - aconf->host, aconf->port, + conf->host, conf->port, (struct sockaddr *)&ipn, ipn.ss_len, serv_connect_callback, client_p, - aconf->aftype, CONNECTTIMEOUT); + conf->aftype, CONNECTTIMEOUT); } else comm_connect_tcp(&client_p->localClient->fd, - aconf->host, aconf->port, + conf->host, conf->port, NULL, 0, serv_connect_callback, client_p, - aconf->aftype, CONNECTTIMEOUT); + conf->aftype, CONNECTTIMEOUT); } #endif } @@ -1278,11 +1255,10 @@ serv_connect(struct AccessItem *aconf, struct Client *by) static void finish_ssl_server_handshake(struct Client *client_p) { - struct ConfItem *conf=NULL; - struct AccessItem *aconf=NULL; + struct MaskItem *conf = NULL; conf = find_conf_name(&client_p->localClient->confs, - client_p->name, SERVER_TYPE); + client_p->name, CONF_SERVER); if (conf == NULL) { sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, @@ -1294,14 +1270,12 @@ finish_ssl_server_handshake(struct Client *client_p) return; } - aconf = map_to_conf(conf); - /* jdc -- Check and send spasswd, not passwd. */ - if (!EmptyString(aconf->spasswd)) + if (!EmptyString(conf->spasswd)) sendto_one(client_p, "PASS %s TS %d %s", - aconf->spasswd, TS_CURRENT, me.id); + conf->spasswd, TS_CURRENT, me.id); - send_capabilities(client_p, aconf, 0); + send_capabilities(client_p, 0); sendto_one(client_p, "SERVER %s 1 :%s%s", me.name, ConfigServerHide.hidden ? "(H) " : "", @@ -1362,7 +1336,7 @@ ssl_server_handshake(fde_t *fd, struct Client *client_p) } static void -ssl_connect_init(struct Client *client_p, struct AccessItem *aconf, fde_t *fd) +ssl_connect_init(struct Client *client_p, struct MaskItem *conf, fde_t *fd) { if ((client_p->localClient->fd.ssl = SSL_new(ServerInfo.client_ctx)) == NULL) { @@ -1375,8 +1349,8 @@ ssl_connect_init(struct Client *client_p, struct AccessItem *aconf, fde_t *fd) SSL_set_fd(fd->ssl, fd->fd); - if (!EmptyString(aconf->cipher_list)) - SSL_set_cipher_list(client_p->localClient->fd.ssl, aconf->cipher_list); + if (!EmptyString(conf->cipher_list)) + SSL_set_cipher_list(client_p->localClient->fd.ssl, conf->cipher_list); ssl_server_handshake(NULL, client_p); } @@ -1394,8 +1368,7 @@ static void serv_connect_callback(fde_t *fd, int status, void *data) { struct Client *client_p = data; - struct ConfItem *conf=NULL; - struct AccessItem *aconf=NULL; + struct MaskItem *conf = NULL; /* First, make sure its a real client! */ assert(client_p != NULL); @@ -1433,7 +1406,7 @@ serv_connect_callback(fde_t *fd, int status, void *data) /* COMM_OK, so continue the connection procedure */ /* Get the C/N lines */ conf = find_conf_name(&client_p->localClient->confs, - client_p->name, SERVER_TYPE); + client_p->name, CONF_SERVER); if (conf == NULL) { sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, @@ -1445,24 +1418,23 @@ serv_connect_callback(fde_t *fd, int status, void *data) return; } - aconf = map_to_conf(conf); /* Next, send the initial handshake */ SetHandshake(client_p); #ifdef HAVE_LIBCRYPTO - if (IsConfSSL(aconf)) + if (IsConfSSL(conf)) { - ssl_connect_init(client_p, aconf, fd); + ssl_connect_init(client_p, conf, fd); return; } #endif /* jdc -- Check and send spasswd, not passwd. */ - if (!EmptyString(aconf->spasswd)) + if (!EmptyString(conf->spasswd)) sendto_one(client_p, "PASS %s TS %d %s", - aconf->spasswd, TS_CURRENT, me.id); + conf->spasswd, TS_CURRENT, me.id); - send_capabilities(client_p, aconf, 0); + send_capabilities(client_p, 0); sendto_one(client_p, "SERVER %s 1 :%s%s", me.name, ConfigServerHide.hidden ? "(H) " : "", diff --git a/src/s_user.c b/src/s_user.c index cb8cc61..c711446 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -60,7 +60,7 @@ struct Callback *umode_cb = NULL; static char umode_buffer[IRCD_BUFSIZE]; static void user_welcome(struct Client *); -static void report_and_set_user_flags(struct Client *, const struct AccessItem *); +static void report_and_set_user_flags(struct Client *, const struct MaskItem *); static int check_xline(struct Client *); static void introduce_client(struct Client *); static const char *uid_get(void); @@ -280,8 +280,7 @@ void register_local_user(struct Client *source_p) { const char *id = NULL; - const struct AccessItem *aconf = NULL; - dlink_node *ptr = NULL; + const struct MaskItem *conf = NULL; assert(source_p != NULL); assert(source_p == source_p->from); @@ -323,8 +322,7 @@ register_local_user(struct Client *source_p) sizeof(source_p->host)); } - ptr = source_p->localClient->confs.head; - aconf = map_to_conf(ptr->data); + conf = source_p->localClient->confs.head->data; if (!IsGotId(source_p)) { @@ -332,7 +330,7 @@ register_local_user(struct Client *source_p) const char *p = username; unsigned int i = 0; - if (IsNeedIdentd(aconf)) + if (IsNeedIdentd(conf)) { ++ServerStats.is_ref; sendto_one(source_p, ":%s NOTICE %s :*** Notice -- You need to install " @@ -343,7 +341,7 @@ register_local_user(struct Client *source_p) strlcpy(username, source_p->username, sizeof(username)); - if (!IsNoTilde(aconf)) + if (!IsNoTilde(conf)) source_p->username[i++] = '~'; for (; *p && i < USERLEN; ++p) @@ -354,11 +352,11 @@ register_local_user(struct Client *source_p) } /* password check */ - if (!EmptyString(aconf->passwd)) + if (!EmptyString(conf->passwd)) { const char *pass = source_p->localClient->passwd; - if (!match_conf_password(pass, aconf)) + if (!match_conf_password(pass, conf)) { ++ServerStats.is_ref; sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), @@ -374,7 +372,7 @@ register_local_user(struct Client *source_p) */ /* report if user has &^>= etc. and set flags as needed in source_p */ - report_and_set_user_flags(source_p, aconf); + report_and_set_user_flags(source_p, conf); if (IsDead(source_p)) return; @@ -427,7 +425,7 @@ register_local_user(struct Client *source_p) source_p->name, source_p->username, source_p->host, ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? "255.255.255.255" : source_p->sockhost, - get_client_class(source_p), + get_client_class(&source_p->localClient->confs), source_p->info, source_p->id); sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, SEND_NOTICE, @@ -435,7 +433,7 @@ register_local_user(struct Client *source_p) source_p->name, source_p->username, source_p->host, ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? "255.255.255.255" : source_p->sockhost, - get_client_class(source_p), + get_client_class(&source_p->localClient->confs), ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? "<hidden>" : source_p->localClient->client_host, ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? @@ -737,16 +735,16 @@ valid_nickname(const char *nickname, const int local) /* report_and_set_user_flags() * * inputs - pointer to source_p - * - pointer to aconf for this user + * - pointer to conf for this user * output - NONE * side effects - Report to user any special flags * they are getting, and set them. */ static void -report_and_set_user_flags(struct Client *source_p, const struct AccessItem *aconf) +report_and_set_user_flags(struct Client *source_p, const struct MaskItem *conf) { /* If this user is being spoofed, tell them so */ - if (IsConfDoSpoofIp(aconf)) + if (IsConfDoSpoofIp(conf)) { sendto_one(source_p, ":%s NOTICE %s :*** Spoofing your IP. congrats.", @@ -754,7 +752,7 @@ report_and_set_user_flags(struct Client *source_p, const struct AccessItem *acon } /* If this user is in the exception class, Set it "E lined" */ - if (IsConfExemptKline(aconf)) + if (IsConfExemptKline(conf)) { SetExemptKline(source_p); sendto_one(source_p, @@ -765,14 +763,14 @@ report_and_set_user_flags(struct Client *source_p, const struct AccessItem *acon /* The else here is to make sure that G line exempt users * do not get noticed twice. */ - else if (IsConfExemptGline(aconf)) + else if (IsConfExemptGline(conf)) { SetExemptGline(source_p); sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from G lines.", me.name, source_p->name); } - if (IsConfExemptResv(aconf)) + if (IsConfExemptResv(conf)) { SetExemptResv(source_p); sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from resvs.", @@ -780,7 +778,7 @@ report_and_set_user_flags(struct Client *source_p, const struct AccessItem *acon } /* If this user is exempt from user limits set it "F lined" */ - if (IsConfExemptLimits(aconf)) + if (IsConfExemptLimits(conf)) { SetExemptLimits(source_p); sendto_one(source_p, @@ -788,7 +786,7 @@ report_and_set_user_flags(struct Client *source_p, const struct AccessItem *acon me.name,source_p->name); } - if (IsConfCanFlood(aconf)) + if (IsConfCanFlood(conf)) { SetCanFlood(source_p); sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from flood " @@ -921,7 +919,7 @@ set_user_mode(struct Client *client_p, struct Client *source_p, { dlink_node *dm; - detach_conf(source_p, OPER_TYPE); + detach_conf(source_p, CONF_OPER); ClrOFlag(source_p); DelUMode(source_p, ConfigFileEntry.oper_only_umodes); @@ -1158,18 +1156,16 @@ user_welcome(struct Client *source_p) static int check_xline(struct Client *source_p) { - struct ConfItem *conf = NULL; + struct MaskItem *conf = NULL; const char *reason = NULL; - if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, NULL, NULL, 0)) || - (conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) + if ((conf = find_matching_name_conf(CONF_XLINE, source_p->info, NULL, NULL, 0)) || + (conf = find_matching_name_conf(CONF_RXLINE, source_p->info, NULL, NULL, 0))) { - struct MatchItem *reg = map_to_conf(conf); - - ++reg->count; + ++conf->count; - if (reg->reason != NULL) - reason = reg->reason; + if (conf->reason != NULL) + reason = conf->reason; else reason = "No Reason"; @@ -1191,7 +1187,7 @@ check_xline(struct Client *source_p) * * inputs - pointer to given client to oper * output - NONE - * side effects - Blindly opers up given source_p, using aconf info + * side effects - Blindly opers up given source_p, using conf info * all checks on passwords have already been done. * This could also be used by rsa oper routines. */ @@ -1199,16 +1195,16 @@ void oper_up(struct Client *source_p) { const unsigned int old = source_p->umodes; - const struct AccessItem *oconf = NULL; + const struct MaskItem *conf = NULL; assert(source_p->localClient->confs.head); - oconf = map_to_conf((source_p->localClient->confs.head)->data); + conf = source_p->localClient->confs.head->data; ++Count.oper; SetOper(source_p); - if (oconf->modes) - AddUMode(source_p, oconf->modes); + if (conf->modes) + AddUMode(source_p, conf->modes); else if (ConfigFileEntry.oper_umodes) AddUMode(source_p, ConfigFileEntry.oper_umodes); @@ -1220,7 +1216,7 @@ oper_up(struct Client *source_p) assert(dlinkFind(&oper_list, source_p) == NULL); dlinkAdd(source_p, make_dlink_node(), &oper_list); - AddOFlag(source_p, oconf->port); + AddOFlag(source_p, conf->port); if (HasOFlag(source_p, OPER_FLAG_ADMIN)) AddUMode(source_p, UMODE_ADMIN); @@ -106,14 +106,14 @@ send_message(struct Client *to, char *buf, int len) assert(!IsMe(to)); assert(to != &me); - if (dbuf_length(&to->localClient->buf_sendq) + len > get_sendq(to)) + if (dbuf_length(&to->localClient->buf_sendq) + len > get_sendq(&to->localClient->confs)) { if (IsServer(to)) sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "Max SendQ limit exceeded for %s: %lu > %lu", get_client_name(to, HIDE_IP), (unsigned long)(dbuf_length(&to->localClient->buf_sendq) + len), - get_sendq(to)); + get_sendq(&to->localClient->confs)); if (IsClient(to)) SetSendQExceeded(to); dead_link_on_write(to, 0); |