25 |
|
#include "stdinc.h" |
26 |
|
#include "list.h" |
27 |
|
#include "ircd_defs.h" |
28 |
– |
#include "balloc.h" |
28 |
|
#include "conf.h" |
29 |
|
#include "s_serv.h" |
30 |
|
#include "resv.h" |
44 |
|
#include "send.h" |
45 |
|
#include "s_gline.h" |
46 |
|
#include "memory.h" |
47 |
+ |
#include "mempool.h" |
48 |
|
#include "irc_res.h" |
49 |
|
#include "userhost.h" |
50 |
|
#include "s_user.h" |
104 |
|
}; |
105 |
|
|
106 |
|
static struct ip_entry *ip_hash_table[IP_HASH_SIZE]; |
107 |
< |
static BlockHeap *ip_entry_heap = NULL; |
107 |
> |
static mp_pool_t *ip_entry_pool = NULL; |
108 |
|
static int ip_entries_count = 0; |
109 |
|
|
110 |
|
|
654 |
|
void |
655 |
|
init_ip_hash_table(void) |
656 |
|
{ |
657 |
< |
ip_entry_heap = BlockHeapCreate("ip", sizeof(struct ip_entry), |
657 |
> |
ip_entry_pool = mp_pool_new(sizeof(struct ip_entry), |
658 |
|
2 * hard_fdlimit); |
659 |
|
memset(ip_hash_table, 0, sizeof(ip_hash_table)); |
660 |
|
} |
704 |
|
if (ip_entries_count >= 2 * hard_fdlimit) |
705 |
|
garbage_collect_ip_entries(); |
706 |
|
|
707 |
< |
newptr = BlockHeapAlloc(ip_entry_heap); |
707 |
> |
newptr = mp_pool_get(ip_entry_pool); |
708 |
> |
memset(newptr, 0, sizeof(*newptr)); |
709 |
|
ip_entries_count++; |
710 |
|
memcpy(&newptr->ip, ip_in, sizeof(struct irc_ssaddr)); |
711 |
|
|
763 |
|
else |
764 |
|
ip_hash_table[hash_index] = ptr->next; |
765 |
|
|
766 |
< |
BlockHeapFree(ip_entry_heap, ptr); |
766 |
> |
mp_pool_release(ptr); |
767 |
|
ip_entries_count--; |
768 |
|
return; |
769 |
|
} |
866 |
|
last_ptr->next = ptr->next; |
867 |
|
else |
868 |
|
ip_hash_table[i] = ptr->next; |
869 |
< |
BlockHeapFree(ip_entry_heap, ptr); |
869 |
> |
mp_pool_release(ptr); |
870 |
|
ip_entries_count--; |
871 |
|
} |
872 |
|
else |
970 |
|
{ |
971 |
|
conf = ptr->data; |
972 |
|
|
973 |
< |
if (match(conf->name, name) == 0 || match(conf->host, host) == 0) |
973 |
> |
if (match(conf->name, name) || match(conf->host, host)) |
974 |
|
continue; |
975 |
|
|
976 |
|
attach_conf(client_p, conf); |
1002 |
|
if (conf->type == type) |
1003 |
|
{ |
1004 |
|
if (conf->name && (irccmp(conf->name, name) == 0 || |
1005 |
< |
match(conf->name, name))) |
1005 |
> |
!match(conf->name, name))) |
1006 |
|
return conf; |
1007 |
|
} |
1008 |
|
} |
1078 |
|
DLINK_FOREACH(ptr, list_p->head) |
1079 |
|
{ |
1080 |
|
conf = ptr->data; |
1081 |
< |
assert(conf->regexpname); |
1081 |
> |
assert(conf->regexuser); |
1082 |
|
|
1083 |
|
if (!ircd_pcre_exec(conf->regexuser, name)) |
1084 |
|
return conf; |
1106 |
|
|
1107 |
|
if (EmptyString(conf->name)) |
1108 |
|
continue; |
1109 |
< |
if ((name != NULL) && match_esc(conf->name, name)) |
1109 |
> |
if ((name != NULL) && !match(conf->name, name)) |
1110 |
|
{ |
1111 |
|
if ((user == NULL && (host == NULL))) |
1112 |
|
return conf; |
1114 |
|
continue; |
1115 |
|
if (EmptyString(conf->user) || EmptyString(conf->host)) |
1116 |
|
return conf; |
1117 |
< |
if (match(conf->user, user) && match(conf->host, host)) |
1117 |
> |
if (!match(conf->user, user) && !match(conf->host, host)) |
1118 |
|
return conf; |
1119 |
|
} |
1120 |
|
} |
1125 |
|
{ |
1126 |
|
conf = ptr->data; |
1127 |
|
|
1128 |
< |
if ((name != NULL) && match(name, conf->name)) |
1128 |
> |
if ((name != NULL) && !match(name, conf->name)) |
1129 |
|
return conf; |
1130 |
< |
else if ((host != NULL) && match(host, conf->host)) |
1130 |
> |
else if ((host != NULL) && !match(host, conf->host)) |
1131 |
|
return conf; |
1132 |
|
} |
1133 |
|
break; |
1175 |
|
return (conf); |
1176 |
|
if (EmptyString(conf->user) || EmptyString(conf->host)) |
1177 |
|
return (conf); |
1178 |
< |
if (match(conf->user, user) && match(conf->host, host)) |
1178 |
> |
if (!match(conf->user, user) && !match(conf->host, host)) |
1179 |
|
return (conf); |
1180 |
|
} |
1181 |
|
} |
1195 |
|
return conf; |
1196 |
|
if (EmptyString(conf->user) || EmptyString(conf->host)) |
1197 |
|
return NULL; |
1198 |
< |
if (match(conf->user, who->username)) |
1198 |
> |
if (!match(conf->user, who->username)) |
1199 |
|
{ |
1200 |
|
switch (conf->htype) |
1201 |
|
{ |
1202 |
|
case HM_HOST: |
1203 |
< |
if (match(conf->host, who->host) || match(conf->host, who->sockhost)) |
1203 |
> |
if (!match(conf->host, who->host) || !match(conf->host, who->sockhost)) |
1204 |
|
if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total) |
1205 |
|
return conf; |
1206 |
|
break; |
1921 |
|
void |
1922 |
|
conf_add_class_to_conf(struct MaskItem *conf, const char *class_name) |
1923 |
|
{ |
1923 |
– |
struct ClassItem *class = NULL; |
1924 |
– |
|
1924 |
|
if (class_name == NULL) |
1925 |
|
{ |
1926 |
|
conf->class = class_default; |