29 |
|
#include "channel.h" |
30 |
|
#include "channel_mode.h" |
31 |
|
#include "client.h" |
32 |
– |
#include "common.h" |
32 |
|
#include "event.h" |
33 |
|
#include "fdlist.h" |
34 |
|
#include "hash.h" |
35 |
|
#include "irc_string.h" |
37 |
– |
#include "sprintf_irc.h" |
36 |
|
#include "ircd_signal.h" |
37 |
|
#include "s_gline.h" |
38 |
|
#include "motd.h" |
39 |
< |
#include "ircd_handler.h" |
42 |
< |
#include "msg.h" /* msgtab */ |
39 |
> |
#include "conf.h" |
40 |
|
#include "hostmask.h" |
41 |
|
#include "numeric.h" |
42 |
|
#include "packet.h" |
46 |
|
#include "rng_mt.h" |
47 |
|
#include "s_auth.h" |
48 |
|
#include "s_bsd.h" |
49 |
< |
#include "s_conf.h" |
53 |
< |
#include "s_log.h" |
49 |
> |
#include "log.h" |
50 |
|
#include "s_misc.h" |
51 |
|
#include "s_serv.h" /* try_connections */ |
52 |
|
#include "send.h" |
53 |
|
#include "whowas.h" |
54 |
|
#include "modules.h" |
55 |
|
#include "memory.h" |
56 |
+ |
#include "mempool.h" |
57 |
|
#include "hook.h" |
58 |
|
#include "ircd_getopt.h" |
62 |
– |
#include "balloc.h" |
63 |
– |
#include "motd.h" |
59 |
|
#include "supported.h" |
60 |
|
#include "watch.h" |
61 |
+ |
#include "conf_db.h" |
62 |
+ |
#include "conf_class.h" |
63 |
|
|
67 |
– |
/* Try and find the correct name to use with getrlimit() for setting the max. |
68 |
– |
* number of files allowed to be open by this process. |
69 |
– |
*/ |
64 |
|
|
65 |
+ |
#ifdef HAVE_LIBGEOIP |
66 |
+ |
GeoIP *geoip_ctx; |
67 |
+ |
#endif |
68 |
|
/* /quote set variables */ |
69 |
|
struct SetOptions GlobalSetOptions; |
70 |
|
|
74 |
|
struct server_info ServerInfo; |
75 |
|
/* admin info set from ircd.conf */ |
76 |
|
struct admin_info AdminInfo = { NULL, NULL, NULL }; |
77 |
< |
struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
77 |
> |
struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
78 |
|
struct ServerState_t server_state = { 0 }; |
79 |
< |
struct logging_entry ConfigLoggingEntry = { 1, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} }; |
79 |
> |
struct logging_entry ConfigLoggingEntry = { .use_logging = 1 }; |
80 |
|
struct ServerStatistics ServerStats; |
81 |
|
struct timeval SystemTime; |
82 |
|
struct Client me; /* That's me */ |
86 |
|
const char *pidFileName = PPATH; |
87 |
|
|
88 |
|
char **myargv; |
92 |
– |
char ircd_platform[PLATFORMLEN]; |
89 |
|
|
90 |
|
int dorehash = 0; |
91 |
|
int doremotd = 0; |
94 |
|
* initialize_server_capabs |
95 |
|
*/ |
96 |
|
int default_server_capabs = 0; |
101 |
– |
|
102 |
– |
#ifdef HAVE_LIBCRYPTO |
103 |
– |
int bio_spare_fd = -1; |
104 |
– |
#endif |
105 |
– |
|
97 |
|
unsigned int splitmode; |
98 |
|
unsigned int splitchecking; |
99 |
|
unsigned int split_users; |
145 |
|
|
146 |
|
static int printVersion = 0; |
147 |
|
|
148 |
< |
struct lgetopt myopts[] = { |
158 |
< |
{"dlinefile", &ConfigFileEntry.dlinefile, |
159 |
< |
STRING, "File to use for dline.conf"}, |
148 |
> |
static struct lgetopt myopts[] = { |
149 |
|
{"configfile", &ConfigFileEntry.configfile, |
150 |
|
STRING, "File to use for ircd.conf"}, |
151 |
+ |
{"glinefile", &ConfigFileEntry.glinefile, |
152 |
+ |
STRING, "File to use for gline database"}, |
153 |
|
{"klinefile", &ConfigFileEntry.klinefile, |
154 |
< |
STRING, "File to use for kline.conf"}, |
154 |
> |
STRING, "File to use for kline database"}, |
155 |
> |
{"dlinefile", &ConfigFileEntry.dlinefile, |
156 |
> |
STRING, "File to use for dline database"}, |
157 |
|
{"xlinefile", &ConfigFileEntry.xlinefile, |
158 |
< |
STRING, "File to use for xline.conf"}, |
158 |
> |
STRING, "File to use for xline database"}, |
159 |
> |
{"resvfile", &ConfigFileEntry.resvfile, |
160 |
> |
STRING, "File to use for resv database"}, |
161 |
|
{"logfile", &logFileName, |
162 |
|
STRING, "File to use for ircd.log"}, |
163 |
|
{"pidfile", &pidFileName, |
180 |
|
|
181 |
|
if (gettimeofday(&newtime, NULL) == -1) |
182 |
|
{ |
183 |
< |
ilog(L_ERROR, "Clock Failure (%s), TS can be corrupted", |
183 |
> |
ilog(LOG_TYPE_IRCD, "Clock Failure (%s), TS can be corrupted", |
184 |
|
strerror(errno)); |
185 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
185 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
186 |
|
"Clock Failure (%s), TS can be corrupted", |
187 |
|
strerror(errno)); |
188 |
|
restart("Clock Failure"); |
190 |
|
|
191 |
|
if (newtime.tv_sec < CurrentTime) |
192 |
|
{ |
193 |
< |
ircsprintf(to_send, "System clock is running backwards - (%lu < %lu)", |
194 |
< |
(unsigned long)newtime.tv_sec, (unsigned long)CurrentTime); |
193 |
> |
snprintf(to_send, sizeof(to_send), |
194 |
> |
"System clock is running backwards - (%lu < %lu)", |
195 |
> |
(unsigned long)newtime.tv_sec, (unsigned long)CurrentTime); |
196 |
|
report_error(L_ALL, to_send, me.name, 0); |
197 |
|
set_back_events(CurrentTime - newtime.tv_sec); |
198 |
|
} |
250 |
|
} |
251 |
|
if (doremotd) |
252 |
|
{ |
253 |
< |
read_message_file(&ConfigFileEntry.motd); |
254 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
255 |
< |
"Got signal SIGUSR1, reloading ircd motd file"); |
253 |
> |
motd_recache(); |
254 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
255 |
> |
"Got signal SIGUSR1, reloading motd files"); |
256 |
|
doremotd = 0; |
257 |
|
} |
258 |
|
} |
293 |
|
} |
294 |
|
|
295 |
|
GlobalSetOptions.ident_timeout = IDENT_TIMEOUT; |
300 |
– |
GlobalSetOptions.idletime = ConfigFileEntry.idletime; |
296 |
|
/* End of global set options */ |
297 |
|
} |
298 |
|
|
304 |
– |
/* initialize_message_files() |
305 |
– |
* |
306 |
– |
* inputs - none |
307 |
– |
* output - none |
308 |
– |
* side effects - Set up all message files needed, motd etc. |
309 |
– |
*/ |
310 |
– |
static void |
311 |
– |
initialize_message_files(void) |
312 |
– |
{ |
313 |
– |
init_message_file(USER_MOTD, MPATH, &ConfigFileEntry.motd); |
314 |
– |
init_message_file(OPER_MOTD, OPATH, &ConfigFileEntry.opermotd); |
315 |
– |
init_message_file(USER_LINKS, LIPATH, &ConfigFileEntry.linksfile); |
316 |
– |
|
317 |
– |
read_message_file(&ConfigFileEntry.motd); |
318 |
– |
read_message_file(&ConfigFileEntry.opermotd); |
319 |
– |
read_message_file(&ConfigFileEntry.linksfile); |
320 |
– |
|
321 |
– |
init_isupport(); |
322 |
– |
} |
323 |
– |
|
299 |
|
/* initialize_server_capabs() |
300 |
|
* |
301 |
|
* inputs - none |
306 |
|
{ |
307 |
|
add_capability("QS", CAP_QS, 1); |
308 |
|
add_capability("EOB", CAP_EOB, 1); |
309 |
< |
|
335 |
< |
if (ServerInfo.sid != NULL) /* only enable TS6 if we have an SID */ |
336 |
< |
add_capability("TS6", CAP_TS6, 0); |
337 |
< |
|
338 |
< |
add_capability("ZIP", CAP_ZIP, 0); |
309 |
> |
add_capability("TS6", CAP_TS6, 0); |
310 |
|
add_capability("CLUSTER", CAP_CLUSTER, 1); |
311 |
+ |
add_capability("SVS", CAP_SVS, 1); |
312 |
|
#ifdef HALFOPS |
313 |
|
add_capability("HOPS", CAP_HOPS, 1); |
314 |
|
#endif |
323 |
|
static void |
324 |
|
write_pidfile(const char *filename) |
325 |
|
{ |
326 |
< |
FBFILE *fb; |
326 |
> |
FILE *fb; |
327 |
|
|
328 |
< |
if ((fb = fbopen(filename, "w"))) |
328 |
> |
if ((fb = fopen(filename, "w"))) |
329 |
|
{ |
330 |
|
char buff[32]; |
331 |
|
unsigned int pid = (unsigned int)getpid(); |
360 |
– |
size_t nbytes = ircsprintf(buff, "%u\n", pid); |
332 |
|
|
333 |
< |
if ((fbputs(buff, fb, nbytes) == -1)) |
334 |
< |
ilog(L_ERROR, "Error writing %u to pid file %s (%s)", |
333 |
> |
snprintf(buff, sizeof(buff), "%u\n", pid); |
334 |
> |
|
335 |
> |
if ((fputs(buff, fb) == -1)) |
336 |
> |
ilog(LOG_TYPE_IRCD, "Error writing %u to pid file %s (%s)", |
337 |
|
pid, filename, strerror(errno)); |
338 |
|
|
339 |
< |
fbclose(fb); |
367 |
< |
return; |
339 |
> |
fclose(fb); |
340 |
|
} |
341 |
|
else |
342 |
|
{ |
343 |
< |
ilog(L_ERROR, "Error opening pid file %s", filename); |
343 |
> |
ilog(LOG_TYPE_IRCD, "Error opening pid file %s", filename); |
344 |
|
} |
345 |
|
} |
346 |
|
|
355 |
|
static void |
356 |
|
check_pidfile(const char *filename) |
357 |
|
{ |
358 |
< |
FBFILE *fb; |
358 |
> |
FILE *fb; |
359 |
|
char buff[32]; |
360 |
|
pid_t pidfromfile; |
361 |
|
|
362 |
|
/* Don't do logging here, since we don't have log() initialised */ |
363 |
< |
if ((fb = fbopen(filename, "r"))) |
363 |
> |
if ((fb = fopen(filename, "r"))) |
364 |
|
{ |
365 |
< |
if (fbgets(buff, 20, fb) == NULL) |
365 |
> |
if (fgets(buff, 20, fb) == NULL) |
366 |
|
{ |
367 |
|
/* log(L_ERROR, "Error reading from pid file %s (%s)", filename, |
368 |
|
* strerror(errno)); |
380 |
|
} |
381 |
|
} |
382 |
|
|
383 |
< |
fbclose(fb); |
383 |
> |
fclose(fb); |
384 |
|
} |
385 |
|
else if (errno != ENOENT) |
386 |
|
{ |
410 |
|
#endif |
411 |
|
} |
412 |
|
|
413 |
+ |
#ifdef HAVE_LIBCRYPTO |
414 |
+ |
static int |
415 |
+ |
always_accept_verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx) |
416 |
+ |
{ |
417 |
+ |
return 1; |
418 |
+ |
} |
419 |
+ |
#endif |
420 |
+ |
|
421 |
|
/* init_ssl() |
422 |
|
* |
423 |
|
* inputs - nothing |
425 |
|
* side effects - setups SSL context. |
426 |
|
*/ |
427 |
|
static void |
428 |
< |
init_ssl(void) |
428 |
> |
ssl_init(void) |
429 |
|
{ |
430 |
|
#ifdef HAVE_LIBCRYPTO |
431 |
|
SSL_load_error_strings(); |
435 |
|
{ |
436 |
|
const char *s; |
437 |
|
|
438 |
< |
fprintf(stderr, "ERROR: Could not initialize the SSL context -- %s\n", |
438 |
> |
fprintf(stderr, "ERROR: Could not initialize the SSL Server context -- %s\n", |
439 |
|
s = ERR_lib_error_string(ERR_get_error())); |
440 |
< |
ilog(L_CRIT, "ERROR: Could not initialize the SSL context -- %s\n", s); |
440 |
> |
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Server context -- %s\n", s); |
441 |
|
} |
442 |
|
|
443 |
< |
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2); |
443 |
> |
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1); |
444 |
|
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL); |
445 |
< |
SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_NONE, NULL); |
445 |
> |
SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, |
446 |
> |
always_accept_verify_cb); |
447 |
|
|
448 |
< |
bio_spare_fd = save_spare_fd("SSL private key validation"); |
449 |
< |
#endif /* HAVE_LIBCRYPTO */ |
450 |
< |
} |
448 |
> |
if ((ServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL) |
449 |
> |
{ |
450 |
> |
const char *s; |
451 |
|
|
452 |
< |
/* init_callbacks() |
453 |
< |
* |
454 |
< |
* inputs - nothing |
455 |
< |
* output - nothing |
456 |
< |
* side effects - setups standard hook points |
457 |
< |
*/ |
458 |
< |
static void |
459 |
< |
init_callbacks(void) |
460 |
< |
{ |
461 |
< |
iorecv_cb = register_callback("iorecv", iorecv_default); |
481 |
< |
iosend_cb = register_callback("iosend", iosend_default); |
482 |
< |
iorecvctrl_cb = register_callback("iorecvctrl", NULL); |
483 |
< |
iosendctrl_cb = register_callback("iosendctrl", NULL); |
452 |
> |
fprintf(stderr, "ERROR: Could not initialize the SSL Client context -- %s\n", |
453 |
> |
s = ERR_lib_error_string(ERR_get_error())); |
454 |
> |
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Client context -- %s\n", s); |
455 |
> |
} |
456 |
> |
|
457 |
> |
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1); |
458 |
> |
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL); |
459 |
> |
SSL_CTX_set_verify(ServerInfo.client_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, |
460 |
> |
always_accept_verify_cb); |
461 |
> |
#endif /* HAVE_LIBCRYPTO */ |
462 |
|
} |
463 |
|
|
464 |
|
int |
482 |
|
/* It ain't random, but it ought to be a little harder to guess */ |
483 |
|
init_genrand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20))); |
484 |
|
|
507 |
– |
memset(&me, 0, sizeof(me)); |
508 |
– |
memset(&meLocalUser, 0, sizeof(meLocalUser)); |
485 |
|
me.localClient = &meLocalUser; |
486 |
|
dlinkAdd(&me, &me.node, &global_client_list); /* Pointer to beginning |
487 |
|
of Client list */ |
512 |
– |
|
513 |
– |
memset(&ServerInfo, 0, sizeof(ServerInfo)); |
514 |
– |
memset(&ServerStats, 0, sizeof(ServerStats)); |
515 |
– |
|
488 |
|
/* Initialise the channel capability usage counts... */ |
489 |
|
init_chcap_usage_counts(); |
490 |
|
|
491 |
|
ConfigFileEntry.dpath = DPATH; |
492 |
< |
ConfigFileEntry.configfile = CPATH; /* Server configuration file */ |
493 |
< |
ConfigFileEntry.klinefile = KPATH; /* Server kline file */ |
494 |
< |
ConfigFileEntry.xlinefile = XPATH; /* Server xline file */ |
495 |
< |
ConfigFileEntry.rxlinefile = RXPATH; /* Server regex xline file */ |
496 |
< |
ConfigFileEntry.rklinefile = RKPATH; /* Server regex kline file */ |
497 |
< |
ConfigFileEntry.dlinefile = DLPATH; /* dline file */ |
498 |
< |
ConfigFileEntry.glinefile = GPATH; /* gline log file */ |
527 |
< |
ConfigFileEntry.cresvfile = CRESVPATH; /* channel resv file */ |
528 |
< |
ConfigFileEntry.nresvfile = NRESVPATH; /* nick resv file */ |
492 |
> |
ConfigFileEntry.configfile = CPATH; /* Server configuration file */ |
493 |
> |
ConfigFileEntry.klinefile = KPATH; /* Server kline file */ |
494 |
> |
ConfigFileEntry.glinefile = GPATH; /* Server gline file */ |
495 |
> |
ConfigFileEntry.xlinefile = XPATH; /* Server xline file */ |
496 |
> |
ConfigFileEntry.dlinefile = DLPATH; /* dline file */ |
497 |
> |
ConfigFileEntry.resvfile = RESVPATH; /* resv file */ |
498 |
> |
|
499 |
|
myargv = argv; |
500 |
|
umask(077); /* better safe than sorry --SRB */ |
501 |
|
|
513 |
|
exit(EXIT_FAILURE); |
514 |
|
} |
515 |
|
|
516 |
< |
init_ssl(); |
516 |
> |
ssl_init(); |
517 |
|
|
518 |
|
if (!server_state.foreground) |
519 |
|
{ |
525 |
|
|
526 |
|
setup_signals(); |
527 |
|
|
558 |
– |
get_ircd_platform(ircd_platform); |
559 |
– |
|
528 |
|
/* Init the event subsystem */ |
529 |
|
eventInit(); |
530 |
|
/* We need this to initialise the fd array before anything else */ |
531 |
|
fdlist_init(); |
532 |
< |
init_log(logFileName); |
532 |
> |
log_set_file(LOG_TYPE_IRCD, 0, logFileName); |
533 |
|
check_can_use_v6(); |
534 |
|
init_comm(); /* This needs to be setup early ! -- adrian */ |
535 |
|
/* Check if there is pidfile and daemon already running */ |
536 |
|
check_pidfile(pidFileName); |
537 |
|
|
538 |
< |
initBlockHeap(); |
538 |
> |
mp_pool_init(); |
539 |
|
init_dlink_nodes(); |
540 |
< |
init_callbacks(); |
573 |
< |
initialize_message_files(); |
540 |
> |
init_isupport(); |
541 |
|
dbuf_init(); |
542 |
< |
init_hash(); |
542 |
> |
hash_init(); |
543 |
|
init_ip_hash_table(); /* client host ip hash table */ |
544 |
|
init_host_hash(); /* Host-hashtable. */ |
545 |
< |
clear_tree_parse(); |
546 |
< |
init_client(); |
547 |
< |
init_class(); |
581 |
< |
init_whowas(); |
545 |
> |
client_init(); |
546 |
> |
class_init(); |
547 |
> |
whowas_init(); |
548 |
|
watch_init(); |
549 |
< |
init_auth(); /* Initialise the auth code */ |
549 |
> |
auth_init(); /* Initialise the auth code */ |
550 |
|
init_resolver(); /* Needs to be setup before the io loop */ |
551 |
+ |
modules_init(); |
552 |
|
read_conf_files(1); /* cold start init conf files */ |
586 |
– |
me.id[0] = '\0'; |
553 |
|
init_uid(); |
554 |
|
initialize_server_capabs(); /* Set up default_server_capabs */ |
555 |
|
initialize_global_set_options(); |
556 |
< |
init_channels(); |
556 |
> |
channel_init(); |
557 |
> |
read_links_file(); |
558 |
> |
motd_init(); |
559 |
> |
#ifdef HAVE_LIBGEOIP |
560 |
> |
geoip_ctx = GeoIP_new(GEOIP_MEMORY_CACHE); |
561 |
> |
#endif |
562 |
|
|
563 |
< |
if (ServerInfo.name == NULL) |
563 |
> |
if (EmptyString(ServerInfo.sid)) |
564 |
|
{ |
565 |
< |
ilog(L_CRIT, "No server name specified in serverinfo block."); |
565 |
> |
ilog(LOG_TYPE_IRCD, "ERROR: No server id specified in serverinfo block."); |
566 |
> |
exit(EXIT_FAILURE); |
567 |
> |
} |
568 |
> |
|
569 |
> |
strlcpy(me.id, ServerInfo.sid, sizeof(me.id)); |
570 |
> |
|
571 |
> |
if (EmptyString(ServerInfo.name)) |
572 |
> |
{ |
573 |
> |
ilog(LOG_TYPE_IRCD, "ERROR: No server name specified in serverinfo block."); |
574 |
|
exit(EXIT_FAILURE); |
575 |
|
} |
576 |
|
|
577 |
|
strlcpy(me.name, ServerInfo.name, sizeof(me.name)); |
578 |
|
|
579 |
|
/* serverinfo{} description must exist. If not, error out.*/ |
580 |
< |
if (ServerInfo.description == NULL) |
580 |
> |
if (EmptyString(ServerInfo.description)) |
581 |
|
{ |
582 |
< |
ilog(L_CRIT, |
604 |
< |
"ERROR: No server description specified in serverinfo block."); |
582 |
> |
ilog(LOG_TYPE_IRCD, "ERROR: No server description specified in serverinfo block."); |
583 |
|
exit(EXIT_FAILURE); |
584 |
|
} |
585 |
|
|
586 |
|
strlcpy(me.info, ServerInfo.description, sizeof(me.info)); |
587 |
|
|
588 |
< |
me.from = &me; |
589 |
< |
me.servptr = &me; |
588 |
> |
me.from = &me; |
589 |
> |
me.servptr = &me; |
590 |
> |
me.localClient->lasttime = CurrentTime; |
591 |
> |
me.localClient->since = CurrentTime; |
592 |
> |
me.localClient->firsttime = CurrentTime; |
593 |
|
|
594 |
|
SetMe(&me); |
595 |
|
make_server(&me); |
596 |
|
|
597 |
< |
me.lasttime = me.since = me.firsttime = CurrentTime; |
597 |
> |
hash_add_id(&me); |
598 |
|
hash_add_client(&me); |
599 |
|
|
600 |
|
/* add ourselves to global_serv_list */ |
601 |
|
dlinkAdd(&me, make_dlink_node(), &global_serv_list); |
602 |
|
|
603 |
< |
#ifndef STATIC_MODULES |
603 |
> |
load_kline_database(); |
604 |
> |
load_dline_database(); |
605 |
> |
load_gline_database(); |
606 |
> |
load_xline_database(); |
607 |
> |
load_resv_database(); |
608 |
> |
|
609 |
|
if (chdir(MODPATH)) |
610 |
|
{ |
611 |
< |
ilog (L_CRIT, "Could not load core modules. Terminating!"); |
611 |
> |
ilog(LOG_TYPE_IRCD, "Could not load core modules. Terminating!"); |
612 |
|
exit(EXIT_FAILURE); |
613 |
|
} |
614 |
|
|
615 |
|
load_all_modules(1); |
616 |
|
load_conf_modules(); |
617 |
|
load_core_modules(1); |
618 |
+ |
|
619 |
|
/* Go back to DPATH after checking to see if we can chdir to MODPATH */ |
620 |
< |
chdir(ConfigFileEntry.dpath); |
621 |
< |
#else |
622 |
< |
load_all_modules(1); |
623 |
< |
#endif |
620 |
> |
if (chdir(ConfigFileEntry.dpath)) |
621 |
> |
{ |
622 |
> |
perror("chdir"); |
623 |
> |
exit(EXIT_FAILURE); |
624 |
> |
} |
625 |
> |
|
626 |
|
/* |
627 |
|
* assemble_umode_buffer() has to be called after |
628 |
|
* reading conf/loading modules. |
631 |
|
|
632 |
|
write_pidfile(pidFileName); |
633 |
|
|
634 |
< |
ilog(L_NOTICE, "Server Ready"); |
634 |
> |
ilog(LOG_TYPE_IRCD, "Server Ready"); |
635 |
|
|
636 |
|
eventAddIsh("cleanup_glines", cleanup_glines, NULL, CLEANUP_GLINES_TIME); |
637 |
|
eventAddIsh("cleanup_tklines", cleanup_tklines, NULL, CLEANUP_TKLINES_TIME); |
640 |
|
/* No, 'cause after a restart it would cause all sorts of nick collides */ |
641 |
|
eventAddIsh("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME); |
642 |
|
|
654 |
– |
eventAddIsh("collect_zipstats", collect_zipstats, NULL, ZIPSTATS_TIME); |
655 |
– |
|
643 |
|
/* Setup the timeout check. I'll shift it later :) -- adrian */ |
644 |
|
eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1); |
645 |
|
|
646 |
+ |
eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT); |
647 |
+ |
|
648 |
|
if (ConfigServerHide.links_delay > 0) |
649 |
|
eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay); |
650 |
|
else |