| 51 |
|
#include "channel_mode.h" |
| 52 |
|
#include "parse.h" |
| 53 |
|
#include "s_misc.h" |
| 54 |
+ |
#include "conf_db.h" |
| 55 |
|
|
| 56 |
|
struct Callback *client_check_cb = NULL; |
| 57 |
|
struct config_server_hide ConfigServerHide; |
| 67 |
|
dlink_list rkconf_items = { NULL, NULL, 0 }; |
| 68 |
|
dlink_list nresv_items = { NULL, NULL, 0 }; |
| 69 |
|
dlink_list class_items = { NULL, NULL, 0 }; |
| 69 |
– |
dlink_list gdeny_items = { NULL, NULL, 0 }; |
| 70 |
|
|
| 71 |
|
dlink_list temporary_xlines = { NULL, NULL, 0 }; |
| 72 |
|
dlink_list temporary_resv = { NULL, NULL, 0 }; |
| 88 |
|
static int verify_access(struct Client *, const char *); |
| 89 |
|
static int attach_iline(struct Client *, struct ConfItem *); |
| 90 |
|
static struct ip_entry *find_or_add_ip(struct irc_ssaddr *); |
| 91 |
– |
static void parse_conf_file(int, int); |
| 91 |
|
static dlink_list *map_to_list(ConfType); |
| 92 |
|
static struct AccessItem *find_regexp_kline(const char *[]); |
| 93 |
|
static int find_user_host(struct Client *, char *, char *, char *, unsigned int); |
| 254 |
|
dlinkAdd(conf, &conf->node, &uconf_items); |
| 255 |
|
break; |
| 256 |
|
|
| 258 |
– |
case GDENY_TYPE: |
| 259 |
– |
conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem) + |
| 260 |
– |
sizeof(struct AccessItem)); |
| 261 |
– |
dlinkAdd(conf, &conf->node, &gdeny_items); |
| 262 |
– |
break; |
| 263 |
– |
|
| 257 |
|
case XLINE_TYPE: |
| 258 |
|
conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem) + |
| 259 |
|
sizeof(struct MatchItem)); |
| 307 |
|
aclass->ping_freq = DEFAULT_PINGFREQUENCY; |
| 308 |
|
aclass->max_total = MAXIMUM_LINKS_DEFAULT; |
| 309 |
|
aclass->max_sendq = DEFAULT_SENDQ; |
| 310 |
+ |
aclass->max_recvq = DEFAULT_RECVQ; |
| 311 |
|
|
| 312 |
|
break; |
| 313 |
|
|
| 355 |
|
MyFree(aconf->passwd); |
| 356 |
|
MyFree(aconf->spasswd); |
| 357 |
|
MyFree(aconf->reason); |
| 364 |
– |
MyFree(aconf->oper_reason); |
| 358 |
|
MyFree(aconf->user); |
| 359 |
|
MyFree(aconf->host); |
| 367 |
– |
MyFree(aconf->cipher_list); |
| 360 |
|
#ifdef HAVE_LIBCRYPTO |
| 361 |
+ |
MyFree(aconf->cipher_list); |
| 362 |
+ |
|
| 363 |
|
if (aconf->rsa_public_key) |
| 364 |
|
RSA_free(aconf->rsa_public_key); |
| 365 |
|
MyFree(aconf->rsa_public_key_file); |
| 413 |
|
MyFree(match_item->user); |
| 414 |
|
MyFree(match_item->host); |
| 415 |
|
MyFree(match_item->reason); |
| 422 |
– |
MyFree(match_item->oper_reason); |
| 416 |
|
dlinkDelete(&conf->node, &uconf_items); |
| 417 |
|
MyFree(conf); |
| 418 |
|
break; |
| 422 |
|
MyFree(match_item->user); |
| 423 |
|
MyFree(match_item->host); |
| 424 |
|
MyFree(match_item->reason); |
| 432 |
– |
MyFree(match_item->oper_reason); |
| 425 |
|
dlinkDelete(&conf->node, &xconf_items); |
| 426 |
|
MyFree(conf); |
| 427 |
|
break; |
| 433 |
|
MyFree(aconf->user); |
| 434 |
|
MyFree(aconf->host); |
| 435 |
|
MyFree(aconf->reason); |
| 444 |
– |
MyFree(aconf->oper_reason); |
| 436 |
|
dlinkDelete(&conf->node, &rkconf_items); |
| 437 |
|
MyFree(conf); |
| 438 |
|
break; |
| 443 |
|
MyFree(match_item->user); |
| 444 |
|
MyFree(match_item->host); |
| 445 |
|
MyFree(match_item->reason); |
| 455 |
– |
MyFree(match_item->oper_reason); |
| 446 |
|
dlinkDelete(&conf->node, &rxconf_items); |
| 447 |
|
MyFree(conf); |
| 448 |
|
break; |
| 452 |
|
MyFree(match_item->user); |
| 453 |
|
MyFree(match_item->host); |
| 454 |
|
MyFree(match_item->reason); |
| 465 |
– |
MyFree(match_item->oper_reason); |
| 455 |
|
dlinkDelete(&conf->node, &nresv_items); |
| 456 |
|
|
| 457 |
|
if (conf->flags & CONF_FLAGS_TEMPORARY) |
| 461 |
|
MyFree(conf); |
| 462 |
|
break; |
| 463 |
|
|
| 475 |
– |
case GDENY_TYPE: |
| 476 |
– |
aconf = map_to_conf(conf); |
| 477 |
– |
MyFree(aconf->user); |
| 478 |
– |
MyFree(aconf->host); |
| 479 |
– |
dlinkDelete(&conf->node, &gdeny_items); |
| 480 |
– |
MyFree(conf); |
| 481 |
– |
break; |
| 482 |
– |
|
| 464 |
|
case CLUSTER_TYPE: |
| 465 |
|
dlinkDelete(&conf->node, &cluster_items); |
| 466 |
|
MyFree(conf); |
| 529 |
|
|
| 530 |
|
switch (type) |
| 531 |
|
{ |
| 551 |
– |
case GDENY_TYPE: |
| 552 |
– |
DLINK_FOREACH(ptr, gdeny_items.head) |
| 553 |
– |
{ |
| 554 |
– |
conf = ptr->data; |
| 555 |
– |
aconf = map_to_conf(conf); |
| 556 |
– |
|
| 557 |
– |
p = buf; |
| 558 |
– |
|
| 559 |
– |
if (aconf->flags & GDENY_BLOCK) |
| 560 |
– |
*p++ = 'B'; |
| 561 |
– |
else |
| 562 |
– |
*p++ = 'b'; |
| 563 |
– |
|
| 564 |
– |
if (aconf->flags & GDENY_REJECT) |
| 565 |
– |
*p++ = 'R'; |
| 566 |
– |
else |
| 567 |
– |
*p++ = 'r'; |
| 568 |
– |
|
| 569 |
– |
*p = '\0'; |
| 570 |
– |
|
| 571 |
– |
sendto_one(source_p, ":%s %d %s V %s@%s %s %s", |
| 572 |
– |
me.name, RPL_STATSDEBUG, source_p->name, |
| 573 |
– |
aconf->user, aconf->host, conf->name, buf); |
| 574 |
– |
} |
| 575 |
– |
break; |
| 576 |
– |
|
| 532 |
|
case XLINE_TYPE: |
| 533 |
|
DLINK_FOREACH(ptr, xconf_items.head) |
| 534 |
|
{ |
| 563 |
|
|
| 564 |
|
sendto_one(source_p, form_str(RPL_STATSKLINE), me.name, |
| 565 |
|
source_p->name, "KR", aconf->host, aconf->user, |
| 566 |
< |
aconf->reason, aconf->oper_reason ? aconf->oper_reason : ""); |
| 566 |
> |
aconf->reason); |
| 567 |
|
} |
| 568 |
|
break; |
| 569 |
|
#endif |
| 634 |
|
conf->name, classitem->ping_freq, |
| 635 |
|
classitem->con_freq, |
| 636 |
|
classitem->max_total, classitem->max_sendq, |
| 637 |
+ |
classitem->max_recvq, |
| 638 |
|
classitem->curr_user_count, |
| 639 |
+ |
classitem->number_per_cidr, classitem->cidr_bitlen_ipv4, |
| 640 |
+ |
classitem->number_per_cidr, classitem->cidr_bitlen_ipv6, |
| 641 |
|
classitem->active ? "active" : "disabled"); |
| 642 |
|
} |
| 643 |
|
break; |
| 669 |
|
*p++ = 'A'; |
| 670 |
|
if (IsConfSSL(aconf)) |
| 671 |
|
*p++ = 'S'; |
| 714 |
– |
if (IsConfTopicBurst(aconf)) |
| 715 |
– |
*p++ = 'T'; |
| 672 |
|
if (buf[0] == '\0') |
| 673 |
|
*p++ = '*'; |
| 674 |
|
|
| 754 |
|
switch (i) |
| 755 |
|
{ |
| 756 |
|
case TOO_MANY: |
| 757 |
< |
sendto_realops_flags(UMODE_FULL, L_ALL, |
| 757 |
> |
sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE, |
| 758 |
|
"Too many on IP for %s (%s).", |
| 759 |
|
get_client_name(source_p, SHOW_IP), |
| 760 |
|
source_p->sockhost); |
| 765 |
|
break; |
| 766 |
|
|
| 767 |
|
case I_LINE_FULL: |
| 768 |
< |
sendto_realops_flags(UMODE_FULL, L_ALL, |
| 769 |
< |
"I-line is full for %s (%s).", |
| 768 |
> |
sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE, |
| 769 |
> |
"auth{} block is full for %s (%s).", |
| 770 |
|
get_client_name(source_p, SHOW_IP), |
| 771 |
|
source_p->sockhost); |
| 772 |
|
ilog(LOG_TYPE_IRCD, "Too many connections from %s.", |
| 780 |
|
++ServerStats.is_ref; |
| 781 |
|
/* jdc - lists server name & port connections are on */ |
| 782 |
|
/* a purely cosmetical change */ |
| 783 |
< |
sendto_realops_flags(UMODE_UNAUTH, L_ALL, |
| 783 |
> |
sendto_realops_flags(UMODE_UNAUTH, L_ALL, SEND_NOTICE, |
| 784 |
|
"Unauthorized client connection from %s [%s] on [%s/%u].", |
| 785 |
|
get_client_name(source_p, SHOW_IP), |
| 786 |
|
source_p->sockhost, |
| 792 |
|
source_p->localClient->listener->name, |
| 793 |
|
source_p->localClient->listener->port); |
| 794 |
|
|
| 795 |
< |
/* XXX It is prolematical whether it is better to use the |
| 840 |
< |
* capture reject code here or rely on the connecting too fast code. |
| 841 |
< |
* - Dianora |
| 842 |
< |
*/ |
| 843 |
< |
if (REJECT_HOLD_TIME > 0) |
| 844 |
< |
{ |
| 845 |
< |
sendto_one(source_p, ":%s NOTICE %s :You are not authorized to use this server", |
| 846 |
< |
me.name, source_p->name); |
| 847 |
< |
source_p->localClient->reject_delay = CurrentTime + REJECT_HOLD_TIME; |
| 848 |
< |
SetCaptured(source_p); |
| 849 |
< |
} |
| 850 |
< |
else |
| 851 |
< |
exit_client(source_p, &me, "You are not authorized to use this server"); |
| 795 |
> |
exit_client(source_p, &me, "You are not authorized to use this server"); |
| 796 |
|
break; |
| 797 |
|
|
| 798 |
|
case BANNED_CLIENT: |
| 799 |
< |
/* |
| 856 |
< |
* Don't exit them immediately, play with them a bit. |
| 857 |
< |
* - Dianora |
| 858 |
< |
*/ |
| 859 |
< |
if (REJECT_HOLD_TIME > 0) |
| 860 |
< |
{ |
| 861 |
< |
source_p->localClient->reject_delay = CurrentTime + REJECT_HOLD_TIME; |
| 862 |
< |
SetCaptured(source_p); |
| 863 |
< |
} |
| 864 |
< |
else |
| 865 |
< |
exit_client(source_p, &me, "Banned"); |
| 799 |
> |
exit_client(source_p, &me, "Banned"); |
| 800 |
|
++ServerStats.is_ref; |
| 801 |
|
break; |
| 802 |
|
|
| 869 |
|
conf = unmap_conf_item(aconf); |
| 870 |
|
|
| 871 |
|
if (!ConfigFileEntry.hide_spoof_ips && IsConfSpoofNotice(aconf)) |
| 872 |
< |
sendto_realops_flags(UMODE_ALL, L_ADMIN, "%s spoofing: %s as %s", |
| 872 |
> |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
| 873 |
> |
"%s spoofing: %s as %s", |
| 874 |
|
client_p->name, client_p->host, conf->name); |
| 875 |
|
strlcpy(client_p->host, conf->name, sizeof(client_p->host)); |
| 876 |
|
SetIPSpoof(client_p); |
| 885 |
|
if (IsConfGline(aconf)) |
| 886 |
|
sendto_one(client_p, ":%s NOTICE %s :*** G-lined", me.name, |
| 887 |
|
client_p->name); |
| 888 |
< |
if (ConfigFileEntry.kline_with_reason) |
| 889 |
< |
sendto_one(client_p, ":%s NOTICE %s :*** Banned %s", |
| 955 |
< |
me.name, client_p->name, aconf->reason); |
| 888 |
> |
sendto_one(client_p, ":%s NOTICE %s :*** Banned: %s", |
| 889 |
> |
me.name, client_p->name, aconf->reason); |
| 890 |
|
return(BANNED_CLIENT); |
| 891 |
|
} |
| 892 |
|
} |
| 1198 |
|
struct ClassItem *aclass; |
| 1199 |
|
struct AccessItem *aconf; |
| 1200 |
|
struct ConfItem *aclass_conf; |
| 1267 |
– |
struct MatchItem *match_item; |
| 1201 |
|
|
| 1202 |
|
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->confs.head) |
| 1203 |
|
{ |
| 1258 |
|
int |
| 1259 |
|
attach_conf(struct Client *client_p, struct ConfItem *conf) |
| 1260 |
|
{ |
| 1261 |
+ |
struct AccessItem *aconf = map_to_conf(conf); |
| 1262 |
+ |
struct ClassItem *aclass = map_to_conf(aconf->class_ptr); |
| 1263 |
+ |
|
| 1264 |
|
if (dlinkFind(&client_p->localClient->confs, conf) != NULL) |
| 1265 |
|
return 1; |
| 1266 |
|
|
| 1267 |
< |
if (conf->type == CLIENT_TYPE || |
| 1268 |
< |
conf->type == SERVER_TYPE || |
| 1333 |
< |
conf->type == OPER_TYPE) |
| 1334 |
< |
{ |
| 1335 |
< |
struct AccessItem *aconf = map_to_conf(conf); |
| 1336 |
< |
struct ClassItem *aclass = map_to_conf(aconf->class_ptr); |
| 1337 |
< |
|
| 1338 |
< |
if (IsConfIllegal(aconf)) |
| 1339 |
< |
return NOT_AUTHORIZED; |
| 1267 |
> |
if (IsConfIllegal(aconf)) /* TBV: can't happen */ |
| 1268 |
> |
return NOT_AUTHORIZED; |
| 1269 |
|
|
| 1270 |
< |
if (conf->type == CLIENT_TYPE) |
| 1271 |
< |
if (cidr_limit_reached(IsConfExemptLimits(aconf), |
| 1272 |
< |
&client_p->localClient->ip, aclass)) |
| 1273 |
< |
return TOO_MANY; /* Already at maximum allowed */ |
| 1270 |
> |
if (conf->type == CLIENT_TYPE) |
| 1271 |
> |
if (cidr_limit_reached(IsConfExemptLimits(aconf), |
| 1272 |
> |
&client_p->localClient->ip, aclass)) |
| 1273 |
> |
return TOO_MANY; /* Already at maximum allowed */ |
| 1274 |
|
|
| 1275 |
< |
aclass->curr_user_count++; |
| 1276 |
< |
aconf->clients++; |
| 1348 |
< |
} |
| 1275 |
> |
aclass->curr_user_count++; |
| 1276 |
> |
aconf->clients++; |
| 1277 |
|
|
| 1278 |
|
dlinkAdd(conf, make_dlink_node(), &client_p->localClient->confs); |
| 1279 |
|
|
| 1680 |
|
rehash(int sig) |
| 1681 |
|
{ |
| 1682 |
|
if (sig != 0) |
| 1683 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 1683 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 1684 |
|
"Got signal SIGHUP, reloading ircd.conf file"); |
| 1685 |
|
|
| 1686 |
|
restart_resolver(); |
| 1755 |
|
|
| 1756 |
|
ConfigChannel.disable_fake_channels = 0; |
| 1757 |
|
ConfigChannel.restrict_channels = 0; |
| 1830 |
– |
ConfigChannel.disable_local_channels = 0; |
| 1831 |
– |
ConfigChannel.use_invex = 1; |
| 1832 |
– |
ConfigChannel.use_except = 1; |
| 1833 |
– |
ConfigChannel.use_knock = 1; |
| 1758 |
|
ConfigChannel.knock_delay = 300; |
| 1759 |
|
ConfigChannel.knock_delay_channel = 60; |
| 1760 |
< |
ConfigChannel.max_chans_per_user = 15; |
| 1760 |
> |
ConfigChannel.max_chans_per_user = 25; |
| 1761 |
> |
ConfigChannel.max_chans_per_oper = 50; |
| 1762 |
|
ConfigChannel.quiet_on_ban = 1; |
| 1763 |
|
ConfigChannel.max_bans = 25; |
| 1764 |
|
ConfigChannel.default_split_user_count = 0; |
| 1765 |
|
ConfigChannel.default_split_server_count = 0; |
| 1766 |
|
ConfigChannel.no_join_on_split = 0; |
| 1767 |
|
ConfigChannel.no_create_on_split = 0; |
| 1843 |
– |
ConfigChannel.burst_topicwho = 1; |
| 1768 |
|
|
| 1769 |
|
ConfigServerHide.flatten_links = 0; |
| 1770 |
|
ConfigServerHide.links_delay = 300; |
| 1771 |
|
ConfigServerHide.hidden = 0; |
| 1848 |
– |
ConfigServerHide.disable_hidden = 0; |
| 1772 |
|
ConfigServerHide.hide_servers = 0; |
| 1773 |
|
DupString(ConfigServerHide.hidden_name, NETWORK_NAME_DEFAULT); |
| 1774 |
|
ConfigServerHide.hide_server_ips = 0; |
| 1776 |
|
|
| 1777 |
|
DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT); |
| 1778 |
|
ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT; |
| 1779 |
+ |
ConfigFileEntry.glines = 0; |
| 1780 |
+ |
ConfigFileEntry.gline_time = 12 * 3600; |
| 1781 |
+ |
ConfigFileEntry.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT; |
| 1782 |
|
ConfigFileEntry.gline_min_cidr = 16; |
| 1783 |
|
ConfigFileEntry.gline_min_cidr6 = 48; |
| 1784 |
|
ConfigFileEntry.invisible_on_connect = 1; |
| 1859 |
– |
ConfigFileEntry.burst_away = 0; |
| 1860 |
– |
ConfigFileEntry.use_whois_actually = 1; |
| 1785 |
|
ConfigFileEntry.tkline_expire_notices = 1; |
| 1786 |
|
ConfigFileEntry.hide_spoof_ips = 1; |
| 1787 |
|
ConfigFileEntry.ignore_bogus_ts = 0; |
| 1800 |
|
ConfigFileEntry.anti_spam_exit_message_time = 0; |
| 1801 |
|
ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT; |
| 1802 |
|
ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT; |
| 1879 |
– |
ConfigFileEntry.kline_with_reason = 1; |
| 1880 |
– |
ConfigFileEntry.kline_reason = NULL; |
| 1803 |
|
ConfigFileEntry.warn_no_nline = 1; |
| 1804 |
|
ConfigFileEntry.stats_o_oper_only = 0; |
| 1805 |
|
ConfigFileEntry.stats_k_oper_only = 1; /* masked */ |
| 1814 |
|
ConfigFileEntry.no_oper_flood = 0; |
| 1815 |
|
ConfigFileEntry.true_no_oper_flood = 0; |
| 1816 |
|
ConfigFileEntry.oper_pass_resv = 1; |
| 1895 |
– |
ConfigFileEntry.glines = 0; |
| 1896 |
– |
ConfigFileEntry.gline_time = 12 * 3600; |
| 1817 |
|
ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT; |
| 1898 |
– |
ConfigFileEntry.client_flood = CLIENT_FLOOD_DEFAULT; |
| 1818 |
|
ConfigFileEntry.oper_only_umodes = UMODE_DEBUG; |
| 1819 |
|
ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE | |
| 1820 |
|
UMODE_OPERWALL | UMODE_WALLOP; |
| 1841 |
|
if (ConfigFileEntry.service_name == NULL) |
| 1842 |
|
DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT); |
| 1843 |
|
|
| 1925 |
– |
if ((ConfigFileEntry.client_flood < CLIENT_FLOOD_MIN) || |
| 1926 |
– |
(ConfigFileEntry.client_flood > CLIENT_FLOOD_MAX)) |
| 1927 |
– |
ConfigFileEntry.client_flood = CLIENT_FLOOD_MAX; |
| 1928 |
– |
|
| 1844 |
|
ConfigFileEntry.max_watch = IRCD_MAX(ConfigFileEntry.max_watch, WATCHSIZE_MIN); |
| 1845 |
|
} |
| 1846 |
|
|
| 1881 |
|
|
| 1882 |
|
aconf = map_to_conf(conf); |
| 1883 |
|
|
| 1884 |
< |
if (EmptyString(aconf->host) || |
| 1970 |
< |
EmptyString(aconf->user)) |
| 1884 |
> |
if (has_wildcards(aconf->host)) |
| 1885 |
|
{ |
| 1886 |
|
ilog(LOG_TYPE_IRCD, "Host/server name error: (%s) (%s)", |
| 1887 |
|
aconf->host, conf->name); |
| 1888 |
|
return; |
| 1889 |
|
} |
| 1890 |
|
|
| 1977 |
– |
if (strchr(aconf->host, '*') || |
| 1978 |
– |
strchr(aconf->host, '?')) |
| 1979 |
– |
return; |
| 1980 |
– |
|
| 1891 |
|
/* Do name lookup now on hostnames given and store the |
| 1892 |
|
* ip numbers in conf structure. |
| 1893 |
|
*/ |
| 2019 |
|
void |
| 2020 |
|
add_temp_line(struct ConfItem *conf) |
| 2021 |
|
{ |
| 2022 |
< |
if (conf->type == XLINE_TYPE) |
| 2113 |
< |
{ |
| 2114 |
< |
conf->flags |= CONF_FLAGS_TEMPORARY; |
| 2115 |
< |
dlinkAdd(conf, make_dlink_node(), &temporary_xlines); |
| 2116 |
< |
} |
| 2117 |
< |
else if ((conf->type == NRESV_TYPE) || (conf->type == CRESV_TYPE)) |
| 2022 |
> |
if ((conf->type == NRESV_TYPE) || (conf->type == CRESV_TYPE)) |
| 2023 |
|
{ |
| 2024 |
|
conf->flags |= CONF_FLAGS_TEMPORARY; |
| 2025 |
|
dlinkAdd(conf, make_dlink_node(), &temporary_resv); |
| 2037 |
|
cleanup_tklines(void *notused) |
| 2038 |
|
{ |
| 2039 |
|
hostmask_expire_temporary(); |
| 2040 |
< |
expire_tklines(&temporary_xlines); |
| 2040 |
> |
expire_tklines(&xconf_items); |
| 2041 |
|
expire_tklines(&temporary_resv); |
| 2042 |
|
} |
| 2043 |
|
|
| 2063 |
|
|
| 2064 |
|
if (conf->type == XLINE_TYPE) |
| 2065 |
|
{ |
| 2066 |
+ |
if (!IsConfTemporary(conf)) |
| 2067 |
+ |
continue; |
| 2068 |
+ |
|
| 2069 |
|
xconf = (struct MatchItem *)map_to_conf(conf); |
| 2070 |
|
if (xconf->hold <= CurrentTime) |
| 2071 |
|
{ |
| 2072 |
|
if (ConfigFileEntry.tkline_expire_notices) |
| 2073 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2074 |
< |
"Temporary X-line for [%s] sexpired", conf->name); |
| 2167 |
< |
dlinkDelete(ptr, tklist); |
| 2168 |
< |
free_dlink_node(ptr); |
| 2073 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2074 |
> |
"Temporary X-line for [%s] expired", conf->name); |
| 2075 |
|
delete_conf_item(conf); |
| 2076 |
|
} |
| 2077 |
|
} |
| 2081 |
|
if (nconf->hold <= CurrentTime) |
| 2082 |
|
{ |
| 2083 |
|
if (ConfigFileEntry.tkline_expire_notices) |
| 2084 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2084 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2085 |
|
"Temporary RESV for [%s] expired", conf->name); |
| 2086 |
|
dlinkDelete(ptr, tklist); |
| 2087 |
|
free_dlink_node(ptr); |
| 2094 |
|
if (cconf->hold <= CurrentTime) |
| 2095 |
|
{ |
| 2096 |
|
if (ConfigFileEntry.tkline_expire_notices) |
| 2097 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2097 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2098 |
|
"Temporary RESV for [%s] expired", cconf->name); |
| 2099 |
|
delete_channel_resv(cconf); |
| 2100 |
|
} |
| 2202 |
|
char chanlimit[32]; |
| 2203 |
|
|
| 2204 |
|
conf_parser_ctx.boot = cold; |
| 2205 |
< |
filename = get_conf_name(CONF_TYPE); |
| 2205 |
> |
filename = ConfigFileEntry.configfile; |
| 2206 |
|
|
| 2207 |
|
/* We need to know the initial filename for the yyerror() to report |
| 2208 |
|
FIXME: The full path is in conffilenamebuf first time since we |
| 2222 |
|
} |
| 2223 |
|
else |
| 2224 |
|
{ |
| 2225 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2225 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2226 |
|
"Unable to read configuration file '%s': %s", |
| 2227 |
|
filename, strerror(errno)); |
| 2228 |
|
return; |
| 2236 |
|
fclose(conf_parser_ctx.conf_file); |
| 2237 |
|
|
| 2238 |
|
add_isupport("NETWORK", ServerInfo.network_name, -1); |
| 2239 |
< |
snprintf(chanmodes, sizeof(chanmodes), "b%s%s:%d", |
| 2240 |
< |
ConfigChannel.use_except ? "e" : "", |
| 2335 |
< |
ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans); |
| 2239 |
> |
snprintf(chanmodes, sizeof(chanmodes), "beI:%d", |
| 2240 |
> |
ConfigChannel.max_bans); |
| 2241 |
|
add_isupport("MAXLIST", chanmodes, -1); |
| 2242 |
|
add_isupport("MAXTARGETS", NULL, ConfigFileEntry.max_targets); |
| 2243 |
|
|
| 2244 |
< |
if (ConfigChannel.disable_local_channels) |
| 2340 |
< |
add_isupport("CHANTYPES", "#", -1); |
| 2341 |
< |
else |
| 2342 |
< |
add_isupport("CHANTYPES", "#&", -1); |
| 2244 |
> |
add_isupport("CHANTYPES", "#", -1); |
| 2245 |
|
|
| 2246 |
< |
snprintf(chanlimit, sizeof(chanlimit), "%s:%d", |
| 2345 |
< |
ConfigChannel.disable_local_channels ? "#" : "#&", |
| 2246 |
> |
snprintf(chanlimit, sizeof(chanlimit), "#:%d", |
| 2247 |
|
ConfigChannel.max_chans_per_user); |
| 2248 |
|
add_isupport("CHANLIMIT", chanlimit, -1); |
| 2249 |
< |
snprintf(chanmodes, sizeof(chanmodes), "%s%s%s", |
| 2250 |
< |
ConfigChannel.use_except ? "e" : "", |
| 2350 |
< |
ConfigChannel.use_invex ? "I" : "", "b,k,l,imnprstORS"); |
| 2249 |
> |
snprintf(chanmodes, sizeof(chanmodes), "%s", |
| 2250 |
> |
"beI,k,l,imnprstORS"); |
| 2251 |
|
add_isupport("CHANNELLEN", NULL, LOCAL_CHANNELLEN); |
| 2252 |
|
|
| 2253 |
< |
if (ConfigChannel.use_except) |
| 2254 |
< |
add_isupport("EXCEPTS", "e", -1); |
| 2355 |
< |
if (ConfigChannel.use_invex) |
| 2356 |
< |
add_isupport("INVEX", "I", -1); |
| 2253 |
> |
add_isupport("EXCEPTS", "e", -1); |
| 2254 |
> |
add_isupport("INVEX", "I", -1); |
| 2255 |
|
add_isupport("CHANMODES", chanmodes, -1); |
| 2256 |
|
|
| 2257 |
|
/* |
| 2259 |
|
* on strlen(form_str(RPL_ISUPPORT)) |
| 2260 |
|
*/ |
| 2261 |
|
rebuild_isupport_message_line(); |
| 2364 |
– |
|
| 2365 |
– |
#ifdef HAVE_LIBPCRE |
| 2366 |
– |
parse_conf_file(RKLINE_TYPE, cold); |
| 2367 |
– |
parse_conf_file(RXLINE_TYPE, cold); |
| 2368 |
– |
#endif |
| 2369 |
– |
parse_conf_file(KLINE_TYPE, cold); |
| 2370 |
– |
parse_conf_file(DLINE_TYPE, cold); |
| 2371 |
– |
parse_conf_file(XLINE_TYPE, cold); |
| 2372 |
– |
parse_conf_file(NRESV_TYPE, cold); |
| 2373 |
– |
parse_conf_file(CRESV_TYPE, cold); |
| 2374 |
– |
} |
| 2375 |
– |
|
| 2376 |
– |
/* parse_conf_file() |
| 2377 |
– |
* |
| 2378 |
– |
* inputs - type of conf file to parse |
| 2379 |
– |
* output - none |
| 2380 |
– |
* side effects - conf file for givenconf type is opened and read then parsed |
| 2381 |
– |
*/ |
| 2382 |
– |
static void |
| 2383 |
– |
parse_conf_file(int type, int cold) |
| 2384 |
– |
{ |
| 2385 |
– |
FILE *file = NULL; |
| 2386 |
– |
const char *filename = get_conf_name(type); |
| 2387 |
– |
|
| 2388 |
– |
if ((file = fopen(filename, "r")) == NULL) |
| 2389 |
– |
{ |
| 2390 |
– |
if (cold) |
| 2391 |
– |
ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s", |
| 2392 |
– |
filename, strerror(errno)); |
| 2393 |
– |
else |
| 2394 |
– |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2395 |
– |
"Unable to read configuration file '%s': %s", |
| 2396 |
– |
filename, strerror(errno)); |
| 2397 |
– |
} |
| 2398 |
– |
else |
| 2399 |
– |
{ |
| 2400 |
– |
parse_csv_file(file, type); |
| 2401 |
– |
fclose(file); |
| 2402 |
– |
} |
| 2262 |
|
} |
| 2263 |
|
|
| 2264 |
|
/* clear_out_old_conf() |
| 2274 |
|
struct ConfItem *conf; |
| 2275 |
|
struct AccessItem *aconf; |
| 2276 |
|
struct ClassItem *cltmp; |
| 2418 |
– |
struct MatchItem *match_item; |
| 2277 |
|
dlink_list *free_items [] = { |
| 2278 |
|
&server_items, &oconf_items, |
| 2279 |
|
&uconf_items, &xconf_items, &rxconf_items, &rkconf_items, |
| 2280 |
< |
&nresv_items, &cluster_items, &gdeny_items, &service_items, NULL |
| 2280 |
> |
&nresv_items, &cluster_items, &service_items, NULL |
| 2281 |
|
}; |
| 2282 |
|
|
| 2283 |
|
dlink_list ** iterator = free_items; /* C is dumb */ |
| 2450 |
|
} |
| 2451 |
|
} |
| 2452 |
|
|
| 2595 |
– |
/* get_conf_name() |
| 2596 |
– |
* |
| 2597 |
– |
* inputs - type of conf file to return name of file for |
| 2598 |
– |
* output - pointer to filename for type of conf |
| 2599 |
– |
* side effects - none |
| 2600 |
– |
*/ |
| 2601 |
– |
const char * |
| 2602 |
– |
get_conf_name(ConfType type) |
| 2603 |
– |
{ |
| 2604 |
– |
switch (type) |
| 2605 |
– |
{ |
| 2606 |
– |
case CONF_TYPE: |
| 2607 |
– |
return ConfigFileEntry.configfile; |
| 2608 |
– |
break; |
| 2609 |
– |
case KLINE_TYPE: |
| 2610 |
– |
return ConfigFileEntry.klinefile; |
| 2611 |
– |
break; |
| 2612 |
– |
case RKLINE_TYPE: |
| 2613 |
– |
return ConfigFileEntry.rklinefile; |
| 2614 |
– |
break; |
| 2615 |
– |
case DLINE_TYPE: |
| 2616 |
– |
return ConfigFileEntry.dlinefile; |
| 2617 |
– |
break; |
| 2618 |
– |
case XLINE_TYPE: |
| 2619 |
– |
return ConfigFileEntry.xlinefile; |
| 2620 |
– |
break; |
| 2621 |
– |
case RXLINE_TYPE: |
| 2622 |
– |
return ConfigFileEntry.rxlinefile; |
| 2623 |
– |
break; |
| 2624 |
– |
case CRESV_TYPE: |
| 2625 |
– |
return ConfigFileEntry.cresvfile; |
| 2626 |
– |
break; |
| 2627 |
– |
case NRESV_TYPE: |
| 2628 |
– |
return ConfigFileEntry.nresvfile; |
| 2629 |
– |
break; |
| 2630 |
– |
case GLINE_TYPE: |
| 2631 |
– |
return ConfigFileEntry.glinefile; |
| 2632 |
– |
break; |
| 2633 |
– |
|
| 2634 |
– |
default: |
| 2635 |
– |
return NULL; /* This should NEVER HAPPEN since we call this function |
| 2636 |
– |
only with the above values, this will cause us to core |
| 2637 |
– |
at some point if this happens so we know where it was */ |
| 2638 |
– |
} |
| 2639 |
– |
} |
| 2640 |
– |
|
| 2453 |
|
#define BAD_PING (-1) |
| 2454 |
|
|
| 2455 |
|
/* get_conf_ping() |
| 2597 |
|
aclass->ping_freq = DEFAULT_PINGFREQUENCY; |
| 2598 |
|
aclass->max_total = MAXIMUM_LINKS_DEFAULT; |
| 2599 |
|
aclass->max_sendq = DEFAULT_SENDQ; |
| 2600 |
+ |
aclass->max_recvq = DEFAULT_RECVQ; |
| 2601 |
|
|
| 2602 |
|
client_check_cb = register_callback("check_client", check_client); |
| 2603 |
|
} |
| 2643 |
|
return DEFAULT_SENDQ; |
| 2644 |
|
} |
| 2645 |
|
|
| 2646 |
+ |
unsigned int |
| 2647 |
+ |
get_recvq(struct Client *client_p) |
| 2648 |
+ |
{ |
| 2649 |
+ |
unsigned int recvq = DEFAULT_RECVQ; |
| 2650 |
+ |
dlink_node *cnode; |
| 2651 |
+ |
struct ConfItem *class_conf; |
| 2652 |
+ |
struct ClassItem *aclass; |
| 2653 |
+ |
struct AccessItem *aconf; |
| 2654 |
+ |
|
| 2655 |
+ |
assert(!IsMe(client_p)); |
| 2656 |
+ |
|
| 2657 |
+ |
if ((cnode = client_p->localClient->confs.head)) |
| 2658 |
+ |
{ |
| 2659 |
+ |
struct ConfItem *conf = cnode->data; |
| 2660 |
+ |
|
| 2661 |
+ |
assert((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) || |
| 2662 |
+ |
(conf->type == OPER_TYPE)); |
| 2663 |
+ |
|
| 2664 |
+ |
aconf = map_to_conf(conf); |
| 2665 |
+ |
|
| 2666 |
+ |
if ((class_conf = aconf->class_ptr) == NULL) |
| 2667 |
+ |
return DEFAULT_RECVQ; /* TBV: shouldn't be possible at all */ |
| 2668 |
+ |
|
| 2669 |
+ |
aclass = map_to_conf(class_conf); |
| 2670 |
+ |
recvq = aclass->max_recvq; |
| 2671 |
+ |
return recvq; |
| 2672 |
+ |
} |
| 2673 |
+ |
|
| 2674 |
+ |
/* XXX return a default? |
| 2675 |
+ |
* if here, then there wasn't an attached conf with a recvq |
| 2676 |
+ |
* that is very bad -Dianora |
| 2677 |
+ |
*/ |
| 2678 |
+ |
return DEFAULT_RECVQ; |
| 2679 |
+ |
} |
| 2680 |
+ |
|
| 2681 |
|
/* conf_add_class_to_conf() |
| 2682 |
|
* |
| 2683 |
|
* inputs - pointer to config item |
| 2695 |
|
aconf->class_ptr = class_default; |
| 2696 |
|
|
| 2697 |
|
if (conf->type == CLIENT_TYPE) |
| 2698 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2698 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2699 |
|
"Warning *** Defaulting to default class for %s@%s", |
| 2700 |
|
aconf->user, aconf->host); |
| 2701 |
|
else |
| 2702 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2702 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2703 |
|
"Warning *** Defaulting to default class for %s", |
| 2704 |
|
conf->name); |
| 2705 |
|
} |
| 2712 |
|
if (aconf->class_ptr == NULL || !class->active) |
| 2713 |
|
{ |
| 2714 |
|
if (conf->type == CLIENT_TYPE) |
| 2715 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2715 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2716 |
|
"Warning *** Defaulting to default class for %s@%s", |
| 2717 |
|
aconf->user, aconf->host); |
| 2718 |
|
else |
| 2719 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 2719 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2720 |
|
"Warning *** Defaulting to default class for %s", |
| 2721 |
|
conf->name); |
| 2722 |
|
aconf->class_ptr = class_default; |
| 2739 |
|
|
| 2740 |
|
if (!aconf->host || !conf->name) |
| 2741 |
|
{ |
| 2742 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, "Bad connect block"); |
| 2742 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2743 |
> |
"Bad connect block"); |
| 2744 |
|
ilog(LOG_TYPE_IRCD, "Bad connect block"); |
| 2745 |
|
return -1; |
| 2746 |
|
} |
| 2747 |
|
|
| 2748 |
|
if (EmptyString(aconf->passwd)) |
| 2749 |
|
{ |
| 2750 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, "Bad connect block, name %s", |
| 2750 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2751 |
> |
"Bad connect block, name %s", |
| 2752 |
|
conf->name); |
| 2753 |
|
ilog(LOG_TYPE_IRCD, "Bad connect block, host %s", conf->name); |
| 2754 |
|
return -1; |
| 2774 |
|
return; |
| 2775 |
|
|
| 2776 |
|
strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf)); |
| 2777 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, "\"%s\", line %u: %s: %s", |
| 2777 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2778 |
> |
"\"%s\", line %u: %s: %s", |
| 2779 |
|
conffilebuf, lineno + 1, msg, newlinebuf); |
| 2780 |
|
ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s", |
| 2781 |
|
conffilebuf, lineno + 1, msg, newlinebuf); |
| 3086 |
|
|
| 3087 |
|
return 1; |
| 3088 |
|
} |
| 3089 |
< |
else if (!(flags & NOUSERLOOKUP)) |
| 3089 |
> |
else |
| 3090 |
|
{ |
| 3091 |
|
/* Try to find user@host mask from nick */ |
| 3092 |
|
/* Okay to use source_p as the first param, because source_p == client_p */ |