95 |
|
static void |
96 |
|
conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name, size_t namelength) |
97 |
|
{ |
98 |
< |
struct MaskItem *conf = vptr; |
98 |
> |
struct MaskItem *const conf = vptr; |
99 |
|
|
100 |
|
conf->dns_pending = 0; |
101 |
|
|
128 |
|
struct MaskItem * |
129 |
|
conf_make(enum maskitem_type type) |
130 |
|
{ |
131 |
< |
struct MaskItem *conf = MyCalloc(sizeof(*conf)); |
131 |
> |
struct MaskItem *const conf = MyCalloc(sizeof(*conf)); |
132 |
|
dlink_list *list = NULL; |
133 |
|
|
134 |
|
conf->type = type; |
143 |
|
void |
144 |
|
conf_free(struct MaskItem *conf) |
145 |
|
{ |
146 |
< |
dlink_node *ptr = NULL, *ptr_next = NULL; |
146 |
> |
dlink_node *node = NULL, *node_next = NULL; |
147 |
|
dlink_list *list = NULL; |
148 |
|
|
149 |
|
if ((list = map_to_list(conf->type))) |
172 |
|
if (conf->rsa_public_key) |
173 |
|
RSA_free(conf->rsa_public_key); |
174 |
|
#endif |
175 |
< |
DLINK_FOREACH_SAFE(ptr, ptr_next, conf->hub_list.head) |
175 |
> |
DLINK_FOREACH_SAFE(node, node_next, conf->hub_list.head) |
176 |
|
{ |
177 |
< |
MyFree(ptr->data); |
178 |
< |
dlinkDelete(ptr, &conf->hub_list); |
179 |
< |
free_dlink_node(ptr); |
177 |
> |
MyFree(node->data); |
178 |
> |
dlinkDelete(node, &conf->hub_list); |
179 |
> |
free_dlink_node(node); |
180 |
|
} |
181 |
|
|
182 |
< |
DLINK_FOREACH_SAFE(ptr, ptr_next, conf->leaf_list.head) |
182 |
> |
DLINK_FOREACH_SAFE(node, node_next, conf->leaf_list.head) |
183 |
|
{ |
184 |
< |
MyFree(ptr->data); |
185 |
< |
dlinkDelete(ptr, &conf->leaf_list); |
186 |
< |
free_dlink_node(ptr); |
184 |
> |
MyFree(node->data); |
185 |
> |
dlinkDelete(node, &conf->leaf_list); |
186 |
> |
free_dlink_node(node); |
187 |
|
} |
188 |
|
|
189 |
< |
DLINK_FOREACH_SAFE(ptr, ptr_next, conf->exempt_list.head) |
189 |
> |
DLINK_FOREACH_SAFE(node, node_next, conf->exempt_list.head) |
190 |
|
{ |
191 |
< |
struct exempt *exptr = ptr->data; |
191 |
> |
struct exempt *exptr = node->data; |
192 |
|
|
193 |
< |
dlinkDelete(ptr, &conf->exempt_list); |
193 |
> |
dlinkDelete(node, &conf->exempt_list); |
194 |
|
MyFree(exptr->name); |
195 |
|
MyFree(exptr->user); |
196 |
|
MyFree(exptr->host); |
318 |
|
return NOT_AUTHORIZED; |
319 |
|
} |
320 |
|
|
321 |
– |
if (IsConfDoIdentd(conf)) |
322 |
– |
SetNeedId(client_p); |
323 |
– |
|
321 |
|
/* Thanks for spoof idea amm */ |
322 |
|
if (IsConfDoSpoofIp(conf)) |
323 |
|
{ |
324 |
< |
if (!ConfigGeneral.hide_spoof_ips && IsConfSpoofNotice(conf)) |
324 |
> |
if (IsConfSpoofNotice(conf)) |
325 |
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
326 |
|
"%s spoofing: %s as %s", |
327 |
|
client_p->name, client_p->host, conf->name); |
328 |
|
strlcpy(client_p->host, conf->name, sizeof(client_p->host)); |
332 |
– |
AddFlag(client_p, FLAGS_IP_SPOOFING | FLAGS_AUTH_SPOOF); |
329 |
|
} |
330 |
|
|
331 |
|
return attach_iline(client_p, conf); |
352 |
|
static int |
353 |
|
attach_iline(struct Client *client_p, struct MaskItem *conf) |
354 |
|
{ |
355 |
< |
const struct ClassItem *class = conf->class; |
355 |
> |
const struct ClassItem *const class = conf->class; |
356 |
|
struct ip_entry *ip_found; |
357 |
|
int a_limit_reached = 0; |
358 |
|
unsigned int local = 0, global = 0, ident = 0; |
403 |
|
void |
404 |
|
detach_conf(struct Client *client_p, enum maskitem_type type) |
405 |
|
{ |
406 |
< |
dlink_node *ptr = NULL, *ptr_next = NULL; |
406 |
> |
dlink_node *node = NULL, *node_next = NULL; |
407 |
|
|
408 |
< |
DLINK_FOREACH_SAFE(ptr, ptr_next, client_p->connection->confs.head) |
408 |
> |
DLINK_FOREACH_SAFE(node, node_next, client_p->connection->confs.head) |
409 |
|
{ |
410 |
< |
struct MaskItem *conf = ptr->data; |
410 |
> |
struct MaskItem *conf = node->data; |
411 |
|
|
412 |
|
assert(conf->type & (CONF_CLIENT | CONF_OPER | CONF_SERVER)); |
413 |
|
assert(conf->ref_count > 0); |
416 |
|
if (!(conf->type & type)) |
417 |
|
continue; |
418 |
|
|
419 |
< |
dlinkDelete(ptr, &client_p->connection->confs); |
420 |
< |
free_dlink_node(ptr); |
419 |
> |
dlinkDelete(node, &client_p->connection->confs); |
420 |
> |
free_dlink_node(node); |
421 |
|
|
422 |
|
if (conf->type == CONF_CLIENT) |
423 |
|
remove_from_cidr_check(&client_p->connection->ip, conf->class); |
474 |
|
attach_connect_block(struct Client *client_p, const char *name, |
475 |
|
const char *host) |
476 |
|
{ |
477 |
< |
dlink_node *ptr; |
482 |
< |
struct MaskItem *conf = NULL; |
477 |
> |
dlink_node *node = NULL; |
478 |
|
|
479 |
|
assert(client_p != NULL); |
480 |
|
assert(host != NULL); |
482 |
|
if (client_p == NULL || host == NULL) |
483 |
|
return 0; |
484 |
|
|
485 |
< |
DLINK_FOREACH(ptr, server_items.head) |
485 |
> |
DLINK_FOREACH(node, server_items.head) |
486 |
|
{ |
487 |
< |
conf = ptr->data; |
487 |
> |
struct MaskItem *conf = node->data; |
488 |
|
|
489 |
|
if (match(conf->name, name) || match(conf->host, host)) |
490 |
|
continue; |
508 |
|
struct MaskItem * |
509 |
|
find_conf_name(dlink_list *list, const char *name, enum maskitem_type type) |
510 |
|
{ |
511 |
< |
dlink_node *ptr; |
517 |
< |
struct MaskItem* conf; |
511 |
> |
dlink_node *node = NULL; |
512 |
|
|
513 |
< |
DLINK_FOREACH(ptr, list->head) |
513 |
> |
DLINK_FOREACH(node, list->head) |
514 |
|
{ |
515 |
< |
conf = ptr->data; |
515 |
> |
struct MaskItem *conf = node->data; |
516 |
|
|
517 |
|
if (conf->type == type) |
518 |
|
{ |
577 |
|
find_matching_name_conf(enum maskitem_type type, const char *name, const char *user, |
578 |
|
const char *host, unsigned int flags) |
579 |
|
{ |
580 |
< |
dlink_node *ptr=NULL; |
581 |
< |
struct MaskItem *conf=NULL; |
582 |
< |
dlink_list *list_p = map_to_list(type); |
580 |
> |
dlink_node *node = NULL; |
581 |
> |
dlink_list *list = map_to_list(type); |
582 |
> |
struct MaskItem *conf = NULL; |
583 |
|
|
584 |
|
switch (type) |
585 |
|
{ |
586 |
|
case CONF_SERVICE: |
587 |
< |
DLINK_FOREACH(ptr, list_p->head) |
587 |
> |
DLINK_FOREACH(node, list->head) |
588 |
|
{ |
589 |
< |
conf = ptr->data; |
589 |
> |
conf = node->data; |
590 |
|
|
591 |
|
if (EmptyString(conf->name)) |
592 |
|
continue; |
599 |
|
case CONF_ULINE: |
600 |
|
case CONF_NRESV: |
601 |
|
case CONF_CRESV: |
602 |
< |
DLINK_FOREACH(ptr, list_p->head) |
602 |
> |
DLINK_FOREACH(node, list->head) |
603 |
|
{ |
604 |
< |
conf = ptr->data; |
604 |
> |
conf = node->data; |
605 |
|
|
606 |
|
if (EmptyString(conf->name)) |
607 |
|
continue; |
620 |
|
break; |
621 |
|
|
622 |
|
case CONF_SERVER: |
623 |
< |
DLINK_FOREACH(ptr, list_p->head) |
623 |
> |
DLINK_FOREACH(node, list->head) |
624 |
|
{ |
625 |
< |
conf = ptr->data; |
625 |
> |
conf = node->data; |
626 |
|
|
627 |
|
if ((name != NULL) && !match(name, conf->name)) |
628 |
|
return conf; |
650 |
|
find_exact_name_conf(enum maskitem_type type, const struct Client *who, const char *name, |
651 |
|
const char *user, const char *host) |
652 |
|
{ |
653 |
< |
dlink_node *ptr = NULL; |
654 |
< |
struct MaskItem *conf; |
655 |
< |
dlink_list *list_p = map_to_list(type); |
653 |
> |
dlink_node *node = NULL; |
654 |
> |
dlink_list *list = map_to_list(type); |
655 |
> |
struct MaskItem *conf = NULL; |
656 |
|
|
657 |
|
switch(type) |
658 |
|
{ |
661 |
|
case CONF_NRESV: |
662 |
|
case CONF_CRESV: |
663 |
|
|
664 |
< |
DLINK_FOREACH(ptr, list_p->head) |
664 |
> |
DLINK_FOREACH(node, list->head) |
665 |
|
{ |
666 |
< |
conf = ptr->data; |
666 |
> |
conf = node->data; |
667 |
|
|
668 |
|
if (EmptyString(conf->name)) |
669 |
|
continue; |
681 |
|
break; |
682 |
|
|
683 |
|
case CONF_OPER: |
684 |
< |
DLINK_FOREACH(ptr, list_p->head) |
684 |
> |
DLINK_FOREACH(node, list->head) |
685 |
|
{ |
686 |
< |
conf = ptr->data; |
686 |
> |
conf = node->data; |
687 |
|
|
688 |
|
if (EmptyString(conf->name)) |
689 |
|
continue; |
725 |
|
break; |
726 |
|
|
727 |
|
case CONF_SERVER: |
728 |
< |
DLINK_FOREACH(ptr, list_p->head) |
728 |
> |
DLINK_FOREACH(node, list->head) |
729 |
|
{ |
730 |
< |
conf = ptr->data; |
730 |
> |
conf = node->data; |
731 |
|
|
732 |
|
if (EmptyString(conf->name)) |
733 |
|
continue; |
809 |
|
SSL_CTX_set_options(ConfigServerInfo.server_ctx, SSL_OP_SINGLE_ECDH_USE); |
810 |
|
#endif |
811 |
|
|
812 |
+ |
SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, "EECDH+HIGH:EDH+HIGH:HIGH:!aNULL"); |
813 |
|
ConfigServerInfo.message_digest_algorithm = EVP_sha256(); |
814 |
|
ConfigServerInfo.rsa_private_key = NULL; |
815 |
|
ConfigServerInfo.rsa_private_key_file = NULL; |
872 |
|
ConfigGeneral.gline_min_cidr6 = 48; |
873 |
|
ConfigGeneral.invisible_on_connect = 1; |
874 |
|
ConfigGeneral.tkline_expire_notices = 1; |
880 |
– |
ConfigGeneral.hide_spoof_ips = 1; |
875 |
|
ConfigGeneral.ignore_bogus_ts = 0; |
876 |
|
ConfigGeneral.disable_auth = 0; |
877 |
|
ConfigGeneral.kill_chase_time_limit = 90; |
1000 |
|
conf_connect_allowed(struct irc_ssaddr *addr, int aftype) |
1001 |
|
{ |
1002 |
|
struct ip_entry *ip_found = NULL; |
1003 |
< |
struct MaskItem *conf = find_dline_conf(addr, aftype); |
1003 |
> |
struct MaskItem *const conf = find_dline_conf(addr, aftype); |
1004 |
|
|
1005 |
|
/* DLINE exempt also gets you out of static limits/pacing... */ |
1006 |
|
if (conf && (conf->type == CONF_EXEMPT)) |
1048 |
|
* side effects - expire tklines |
1049 |
|
*/ |
1050 |
|
static void |
1051 |
< |
expire_tklines(dlink_list *tklist) |
1051 |
> |
expire_tklines(dlink_list *list) |
1052 |
|
{ |
1053 |
< |
dlink_node *ptr = NULL, *ptr_next = NULL; |
1060 |
< |
struct MaskItem *conf = NULL; |
1053 |
> |
dlink_node *node = NULL, *node_next = NULL; |
1054 |
|
|
1055 |
< |
DLINK_FOREACH_SAFE(ptr, ptr_next, tklist->head) |
1055 |
> |
DLINK_FOREACH_SAFE(node, node_next, list->head) |
1056 |
|
{ |
1057 |
< |
conf = ptr->data; |
1057 |
> |
struct MaskItem *conf = node->data; |
1058 |
|
|
1059 |
|
if (!conf->until || conf->until > CurrentTime) |
1060 |
|
continue; |
1132 |
|
const char * |
1133 |
|
get_oper_name(const struct Client *client_p) |
1134 |
|
{ |
1142 |
– |
const dlink_node *cnode = NULL; |
1135 |
|
/* +5 for !,@,{,} and null */ |
1136 |
|
static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5]; |
1137 |
|
|
1140 |
|
|
1141 |
|
if (MyConnect(client_p)) |
1142 |
|
{ |
1143 |
< |
if ((cnode = client_p->connection->confs.head)) |
1143 |
> |
const dlink_node *const node = client_p->connection->confs.head; |
1144 |
> |
|
1145 |
> |
if (node) |
1146 |
|
{ |
1147 |
< |
const struct MaskItem *conf = cnode->data; |
1147 |
> |
const struct MaskItem *const conf = node->data; |
1148 |
|
|
1149 |
< |
if (IsConfOperator(conf)) |
1149 |
> |
if (conf->type == CONF_OPER) |
1150 |
|
{ |
1151 |
|
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name, |
1152 |
|
client_p->username, client_p->host, conf->name); |
1247 |
|
static void |
1248 |
|
clear_out_old_conf(void) |
1249 |
|
{ |
1250 |
< |
dlink_node *ptr = NULL, *next_ptr = NULL; |
1250 |
> |
dlink_node *node = NULL, *node_next = NULL; |
1251 |
|
dlink_list *free_items [] = { |
1252 |
|
&server_items, &oconf_items, |
1253 |
|
&uconf_items, &xconf_items, |
1262 |
|
|
1263 |
|
for (; *iterator != NULL; iterator++) |
1264 |
|
{ |
1265 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, (*iterator)->head) |
1265 |
> |
DLINK_FOREACH_SAFE(node, node_next, (*iterator)->head) |
1266 |
|
{ |
1267 |
< |
struct MaskItem *conf = ptr->data; |
1267 |
> |
struct MaskItem *conf = node->data; |
1268 |
|
|
1269 |
|
conf->active = 0; |
1270 |
|
dlinkDelete(&conf->node, *iterator); |
1343 |
|
{ |
1344 |
|
conf->class = class_default; |
1345 |
|
|
1346 |
< |
if (conf->type == CONF_CLIENT) |
1346 |
> |
if (conf->type == CONF_CLIENT || conf->type == CONF_OPER) |
1347 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
1348 |
|
"Warning *** Defaulting to default class for %s@%s", |
1349 |
|
conf->user, conf->host); |
1357 |
|
|
1358 |
|
if (conf->class == NULL) |
1359 |
|
{ |
1360 |
< |
if (conf->type == CONF_CLIENT) |
1360 |
> |
if (conf->type == CONF_CLIENT || conf->type == CONF_OPER) |
1361 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
1362 |
|
"Warning *** Defaulting to default class for %s@%s", |
1363 |
|
conf->user, conf->host); |
1833 |
|
{ |
1834 |
|
va_list args; |
1835 |
|
char buffer[IRCD_BUFSIZE] = ""; |
1836 |
< |
const dlink_node *ptr = NULL; |
1836 |
> |
const dlink_node *node = NULL; |
1837 |
|
|
1838 |
|
va_start(args, pattern); |
1839 |
|
vsnprintf(buffer, sizeof(buffer), pattern, args); |
1840 |
|
va_end(args); |
1841 |
|
|
1842 |
< |
DLINK_FOREACH(ptr, cluster_items.head) |
1842 |
> |
DLINK_FOREACH(node, cluster_items.head) |
1843 |
|
{ |
1844 |
< |
const struct MaskItem *conf = ptr->data; |
1844 |
> |
const struct MaskItem *conf = node->data; |
1845 |
|
|
1846 |
|
if (conf->flags & cluster_type) |
1847 |
|
sendto_match_servs(source_p, conf->name, CAP_CLUSTER|capab, |