| 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; |
| 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 *); |
| 90 |
– |
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); |
| 355 |
|
MyFree(aconf->passwd); |
| 356 |
|
MyFree(aconf->spasswd); |
| 357 |
|
MyFree(aconf->reason); |
| 358 |
– |
MyFree(aconf->oper_reason); |
| 358 |
|
MyFree(aconf->user); |
| 359 |
|
MyFree(aconf->host); |
| 360 |
|
#ifdef HAVE_LIBCRYPTO |
| 413 |
|
MyFree(match_item->user); |
| 414 |
|
MyFree(match_item->host); |
| 415 |
|
MyFree(match_item->reason); |
| 417 |
– |
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); |
| 427 |
– |
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); |
| 439 |
– |
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); |
| 450 |
– |
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); |
| 460 |
– |
MyFree(match_item->oper_reason); |
| 455 |
|
dlinkDelete(&conf->node, &nresv_items); |
| 456 |
|
|
| 457 |
|
if (conf->flags & CONF_FLAGS_TEMPORARY) |
| 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 |
| 2019 |
|
void |
| 2020 |
|
add_temp_line(struct ConfItem *conf) |
| 2021 |
|
{ |
| 2022 |
< |
if (conf->type == XLINE_TYPE) |
| 2029 |
< |
{ |
| 2030 |
< |
conf->flags |= CONF_FLAGS_TEMPORARY; |
| 2031 |
< |
dlinkAdd(conf, make_dlink_node(), &temporary_xlines); |
| 2032 |
< |
} |
| 2033 |
< |
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, SEND_NOTICE, |
| 2074 |
|
"Temporary X-line for [%s] expired", conf->name); |
| 2083 |
– |
dlinkDelete(ptr, tklist); |
| 2084 |
– |
free_dlink_node(ptr); |
| 2075 |
|
delete_conf_item(conf); |
| 2076 |
|
} |
| 2077 |
|
} |
| 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 |
| 2259 |
|
* on strlen(form_str(RPL_ISUPPORT)) |
| 2260 |
|
*/ |
| 2261 |
|
rebuild_isupport_message_line(); |
| 2272 |
– |
|
| 2273 |
– |
parse_conf_file(KLINE_TYPE, cold); |
| 2274 |
– |
parse_conf_file(DLINE_TYPE, cold); |
| 2275 |
– |
parse_conf_file(XLINE_TYPE, cold); |
| 2276 |
– |
parse_conf_file(NRESV_TYPE, cold); |
| 2277 |
– |
parse_conf_file(CRESV_TYPE, cold); |
| 2278 |
– |
} |
| 2279 |
– |
|
| 2280 |
– |
/* parse_conf_file() |
| 2281 |
– |
* |
| 2282 |
– |
* inputs - type of conf file to parse |
| 2283 |
– |
* output - none |
| 2284 |
– |
* side effects - conf file for givenconf type is opened and read then parsed |
| 2285 |
– |
*/ |
| 2286 |
– |
static void |
| 2287 |
– |
parse_conf_file(int type, int cold) |
| 2288 |
– |
{ |
| 2289 |
– |
FILE *file = NULL; |
| 2290 |
– |
const char *filename = get_conf_name(type); |
| 2291 |
– |
|
| 2292 |
– |
if ((file = fopen(filename, "r")) == NULL) |
| 2293 |
– |
{ |
| 2294 |
– |
if (cold) |
| 2295 |
– |
ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s", |
| 2296 |
– |
filename, strerror(errno)); |
| 2297 |
– |
else |
| 2298 |
– |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 2299 |
– |
"Unable to read configuration file '%s': %s", |
| 2300 |
– |
filename, strerror(errno)); |
| 2301 |
– |
} |
| 2302 |
– |
else |
| 2303 |
– |
{ |
| 2304 |
– |
parse_csv_file(file, type); |
| 2305 |
– |
fclose(file); |
| 2306 |
– |
} |
| 2262 |
|
} |
| 2263 |
|
|
| 2264 |
|
/* clear_out_old_conf() |
| 2450 |
|
} |
| 2451 |
|
} |
| 2452 |
|
|
| 2498 |
– |
/* get_conf_name() |
| 2499 |
– |
* |
| 2500 |
– |
* inputs - type of conf file to return name of file for |
| 2501 |
– |
* output - pointer to filename for type of conf |
| 2502 |
– |
* side effects - none |
| 2503 |
– |
*/ |
| 2504 |
– |
const char * |
| 2505 |
– |
get_conf_name(ConfType type) |
| 2506 |
– |
{ |
| 2507 |
– |
switch (type) |
| 2508 |
– |
{ |
| 2509 |
– |
case CONF_TYPE: |
| 2510 |
– |
return ConfigFileEntry.configfile; |
| 2511 |
– |
break; |
| 2512 |
– |
case KLINE_TYPE: |
| 2513 |
– |
return ConfigFileEntry.klinefile; |
| 2514 |
– |
break; |
| 2515 |
– |
case DLINE_TYPE: |
| 2516 |
– |
return ConfigFileEntry.dlinefile; |
| 2517 |
– |
break; |
| 2518 |
– |
case XLINE_TYPE: |
| 2519 |
– |
return ConfigFileEntry.xlinefile; |
| 2520 |
– |
break; |
| 2521 |
– |
case CRESV_TYPE: |
| 2522 |
– |
return ConfigFileEntry.cresvfile; |
| 2523 |
– |
break; |
| 2524 |
– |
case NRESV_TYPE: |
| 2525 |
– |
return ConfigFileEntry.nresvfile; |
| 2526 |
– |
break; |
| 2527 |
– |
default: |
| 2528 |
– |
return NULL; /* This should NEVER HAPPEN since we call this function |
| 2529 |
– |
only with the above values, this will cause us to core |
| 2530 |
– |
at some point if this happens so we know where it was */ |
| 2531 |
– |
} |
| 2532 |
– |
} |
| 2533 |
– |
|
| 2453 |
|
#define BAD_PING (-1) |
| 2454 |
|
|
| 2455 |
|
/* get_conf_ping() |