29 |
|
#include "ircd_defs.h" |
30 |
|
#include "conf.h" |
31 |
|
#include "conf_cluster.h" |
32 |
+ |
#include "conf_gecos.h" |
33 |
|
#include "conf_pseudo.h" |
34 |
+ |
#include "conf_resv.h" |
35 |
+ |
#include "conf_service.h" |
36 |
|
#include "conf_shared.h" |
37 |
|
#include "server.h" |
35 |
– |
#include "resv.h" |
38 |
|
#include "channel.h" |
39 |
|
#include "client.h" |
40 |
|
#include "event.h" |
71 |
|
struct conf_parser_context conf_parser_ctx; |
72 |
|
|
73 |
|
/* general conf items link list root, other than k lines etc. */ |
72 |
– |
dlink_list service_items; |
74 |
|
dlink_list server_items; |
75 |
|
dlink_list operator_items; |
75 |
– |
dlink_list gecos_items; |
76 |
– |
dlink_list nresv_items; |
77 |
– |
dlink_list cresv_items; |
76 |
|
|
77 |
|
extern unsigned int lineno; |
78 |
|
extern char linebuf[]; |
134 |
|
{ |
135 |
|
switch (type) |
136 |
|
{ |
139 |
– |
case CONF_XLINE: |
140 |
– |
return &gecos_items; |
141 |
– |
break; |
142 |
– |
case CONF_NRESV: |
143 |
– |
return &nresv_items; |
144 |
– |
break; |
145 |
– |
case CONF_CRESV: |
146 |
– |
return &cresv_items; |
147 |
– |
break; |
137 |
|
case CONF_OPER: |
138 |
|
return &operator_items; |
139 |
|
break; |
140 |
|
case CONF_SERVER: |
141 |
|
return &server_items; |
142 |
|
break; |
154 |
– |
case CONF_SERVICE: |
155 |
– |
return &service_items; |
156 |
– |
break; |
143 |
|
default: |
144 |
|
return NULL; |
145 |
|
} |
203 |
|
free_dlink_node(node); |
204 |
|
} |
205 |
|
|
220 |
– |
DLINK_FOREACH_SAFE(node, node_next, conf->exempt_list.head) |
221 |
– |
{ |
222 |
– |
struct exempt *exptr = node->data; |
223 |
– |
|
224 |
– |
dlinkDelete(node, &conf->exempt_list); |
225 |
– |
xfree(exptr->name); |
226 |
– |
xfree(exptr->user); |
227 |
– |
xfree(exptr->host); |
228 |
– |
xfree(exptr); |
229 |
– |
} |
230 |
– |
|
206 |
|
xfree(conf); |
207 |
|
} |
208 |
|
|
541 |
|
|
542 |
|
switch (type) |
543 |
|
{ |
569 |
– |
case CONF_SERVICE: |
570 |
– |
DLINK_FOREACH(node, list->head) |
571 |
– |
{ |
572 |
– |
conf = node->data; |
573 |
– |
|
574 |
– |
if (EmptyString(conf->name)) |
575 |
– |
continue; |
576 |
– |
if (name && !irccmp(name, conf->name)) |
577 |
– |
return conf; |
578 |
– |
} |
579 |
– |
break; |
580 |
– |
|
581 |
– |
case CONF_XLINE: |
582 |
– |
case CONF_NRESV: |
583 |
– |
case CONF_CRESV: |
584 |
– |
DLINK_FOREACH(node, list->head) |
585 |
– |
{ |
586 |
– |
conf = node->data; |
587 |
– |
|
588 |
– |
if (EmptyString(conf->name)) |
589 |
– |
continue; |
590 |
– |
if (name && !match(conf->name, name)) |
591 |
– |
{ |
592 |
– |
if ((user == NULL && (host == NULL))) |
593 |
– |
return conf; |
594 |
– |
if ((conf->modes & flags) != flags) |
595 |
– |
continue; |
596 |
– |
if (EmptyString(conf->user) || EmptyString(conf->host)) |
597 |
– |
return conf; |
598 |
– |
if (!match(conf->user, user) && !match(conf->host, host)) |
599 |
– |
return conf; |
600 |
– |
} |
601 |
– |
} |
602 |
– |
break; |
603 |
– |
|
544 |
|
case CONF_SERVER: |
545 |
|
DLINK_FOREACH(node, list->head) |
546 |
|
{ |
578 |
|
|
579 |
|
switch(type) |
580 |
|
{ |
641 |
– |
case CONF_XLINE: |
642 |
– |
case CONF_NRESV: |
643 |
– |
case CONF_CRESV: |
644 |
– |
|
645 |
– |
DLINK_FOREACH(node, list->head) |
646 |
– |
{ |
647 |
– |
conf = node->data; |
648 |
– |
|
649 |
– |
if (EmptyString(conf->name)) |
650 |
– |
continue; |
651 |
– |
|
652 |
– |
if (irccmp(conf->name, name) == 0) |
653 |
– |
{ |
654 |
– |
if ((user == NULL && (host == NULL))) |
655 |
– |
return conf; |
656 |
– |
if (EmptyString(conf->user) || EmptyString(conf->host)) |
657 |
– |
return conf; |
658 |
– |
if (!match(conf->user, user) && !match(conf->host, host)) |
659 |
– |
return conf; |
660 |
– |
} |
661 |
– |
} |
662 |
– |
break; |
663 |
– |
|
581 |
|
case CONF_OPER: |
582 |
|
DLINK_FOREACH(node, list->head) |
583 |
|
{ |
679 |
|
ConfigServerInfo.max_nick_length = 9; |
680 |
|
ConfigServerInfo.max_topic_length = 80; |
681 |
|
ConfigServerInfo.hub = 0; |
682 |
+ |
ConfigServerInfo.libgeoip_database_options = 0; |
683 |
|
|
684 |
|
log_del_all(); |
685 |
|
|
886 |
|
return 0; |
887 |
|
} |
888 |
|
|
971 |
– |
/* expire_tklines() |
972 |
– |
* |
973 |
– |
* inputs - tkline list pointer |
974 |
– |
* output - NONE |
975 |
– |
* side effects - expire tklines |
976 |
– |
*/ |
977 |
– |
static void |
978 |
– |
expire_tklines(dlink_list *list) |
979 |
– |
{ |
980 |
– |
dlink_node *node = NULL, *node_next = NULL; |
981 |
– |
|
982 |
– |
DLINK_FOREACH_SAFE(node, node_next, list->head) |
983 |
– |
{ |
984 |
– |
struct MaskItem *conf = node->data; |
985 |
– |
|
986 |
– |
if (!conf->until || conf->until > CurrentTime) |
987 |
– |
continue; |
988 |
– |
|
989 |
– |
if (ConfigGeneral.tkline_expire_notices) |
990 |
– |
sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE, "Temporary %s for [%s] expired", |
991 |
– |
(conf->type == CONF_XLINE) ? "X-line" : "RESV", conf->name); |
992 |
– |
conf_free(conf); |
993 |
– |
} |
994 |
– |
} |
995 |
– |
|
889 |
|
/* cleanup_tklines() |
890 |
|
* |
891 |
|
* inputs - NONE |
897 |
|
cleanup_tklines(void *unused) |
898 |
|
{ |
899 |
|
hostmask_expire_temporary(); |
900 |
< |
expire_tklines(&gecos_items); |
901 |
< |
expire_tklines(&nresv_items); |
1009 |
< |
expire_tklines(&cresv_items); |
900 |
> |
gecos_expire(); |
901 |
> |
resv_expire(); |
902 |
|
} |
903 |
|
|
904 |
|
/* oper_privs_as_string() |
1014 |
|
{ |
1015 |
|
dlink_node *node = NULL, *node_next = NULL; |
1016 |
|
dlink_list *free_items [] = { |
1017 |
< |
&server_items, &operator_items, |
1126 |
< |
&gecos_items, |
1127 |
< |
&nresv_items, &service_items, &cresv_items, NULL |
1017 |
> |
&server_items, &operator_items, NULL |
1018 |
|
}; |
1019 |
|
|
1020 |
|
dlink_list ** iterator = free_items; /* C is dumb */ |
1030 |
|
struct MaskItem *conf = node->data; |
1031 |
|
|
1032 |
|
conf->active = 0; |
1033 |
+ |
dlinkDelete(&conf->node, *iterator); |
1034 |
|
|
1035 |
< |
if (!IsConfDatabase(conf)) |
1036 |
< |
{ |
1146 |
< |
dlinkDelete(&conf->node, *iterator); |
1147 |
< |
|
1148 |
< |
if (!conf->ref_count) |
1149 |
< |
conf_free(conf); |
1150 |
< |
} |
1035 |
> |
if (!conf->ref_count) |
1036 |
> |
conf_free(conf); |
1037 |
|
} |
1038 |
|
} |
1039 |
|
|
1154 |
– |
motd_clear(); /* Clear motd {} items and re-cache default motd */ |
1155 |
– |
|
1040 |
|
/* |
1041 |
|
* Don't delete the class table, rather mark all entries for deletion. |
1042 |
|
* The table is cleaned up by class_delete_marked. - avalon |
1045 |
|
|
1046 |
|
clear_out_address_conf(); |
1047 |
|
|
1048 |
< |
mod_clear_paths(); /* Clear modules {} items */ |
1048 |
> |
modules_conf_clear(); /* Clear modules {} items */ |
1049 |
|
|
1050 |
|
motd_clear(); /* Clear motd {} items and re-cache default motd */ |
1051 |
|
|
1052 |
|
cluster_clear(); /* Clear cluster {} items */ |
1053 |
|
|
1054 |
+ |
gecos_clear(); /* Clear gecos {} items */ |
1055 |
+ |
|
1056 |
+ |
resv_clear(); /* Clear resv {} items */ |
1057 |
+ |
|
1058 |
+ |
service_clear(); /* Clear service {} items */ |
1059 |
+ |
|
1060 |
|
shared_clear(); /* Clear shared {} items */ |
1061 |
|
|
1062 |
|
pseudo_clear(); /* Clear pseudo {} items */ |
1063 |
|
|
1064 |
+ |
#ifdef HAVE_LIBGEOIP |
1065 |
+ |
GeoIP_delete(GeoIPv4_ctx); |
1066 |
+ |
GeoIPv4_ctx = NULL; |
1067 |
+ |
GeoIP_delete(GeoIPv6_ctx); |
1068 |
+ |
GeoIPv6_ctx = NULL; |
1069 |
+ |
#endif |
1070 |
+ |
|
1071 |
|
/* Clean out ConfigServerInfo */ |
1072 |
|
xfree(ConfigServerInfo.description); |
1073 |
|
ConfigServerInfo.description = NULL; |
1075 |
|
ConfigServerInfo.network_name = NULL; |
1076 |
|
xfree(ConfigServerInfo.network_desc); |
1077 |
|
ConfigServerInfo.network_desc = NULL; |
1078 |
< |
|
1078 |
> |
xfree(ConfigServerInfo.libgeoip_ipv6_database_file); |
1079 |
> |
ConfigServerInfo.libgeoip_ipv6_database_file = NULL; |
1080 |
> |
xfree(ConfigServerInfo.libgeoip_ipv4_database_file); |
1081 |
> |
ConfigServerInfo.libgeoip_ipv4_database_file = NULL; |
1082 |
|
xfree(ConfigServerInfo.rsa_private_key_file); |
1083 |
|
ConfigServerInfo.rsa_private_key_file = NULL; |
1084 |
|
xfree(ConfigServerInfo.ssl_certificate_file); |
1268 |
|
* side effects - none |
1269 |
|
* Originally written by Dianora (Diane, db@db.net) |
1270 |
|
*/ |
1271 |
< |
time_t |
1271 |
> |
uintmax_t |
1272 |
|
valid_tkline(const char *data, const int minutes) |
1273 |
|
{ |
1274 |
|
const unsigned char *p = (const unsigned char *)data; |
1275 |
|
unsigned char tmpch = '\0'; |
1276 |
< |
time_t result = 0; |
1276 |
> |
uintmax_t result = 0; |
1277 |
|
|
1278 |
|
while ((tmpch = *p++)) |
1279 |
|
{ |
1512 |
|
int |
1513 |
|
parse_aline(const char *cmd, struct Client *source_p, |
1514 |
|
int parc, char **parv, |
1515 |
< |
int parse_flags, char **up_p, char **h_p, time_t *tkline_time, |
1515 |
> |
int parse_flags, char **up_p, char **h_p, uintmax_t *tkline_time, |
1516 |
|
char **target_server, char **reason) |
1517 |
|
{ |
1518 |
|
int found_tkline_time=0; |