| 72 |
|
struct admin_info AdminInfo = { NULL, NULL, NULL }; |
| 73 |
|
struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 74 |
|
struct ServerState_t server_state = { 0 }; |
| 75 |
< |
struct logging_entry ConfigLoggingEntry = { 1, 1 }; |
| 75 |
> |
struct logging_entry ConfigLoggingEntry = { .use_logging = 1 }; |
| 76 |
|
struct ServerStatistics ServerStats; |
| 77 |
|
struct timeval SystemTime; |
| 78 |
|
struct Client me; /* That's me */ |
| 82 |
|
const char *pidFileName = PPATH; |
| 83 |
|
|
| 84 |
|
char **myargv; |
| 85 |
– |
char ircd_platform[PLATFORMLEN]; |
| 85 |
|
|
| 86 |
|
int dorehash = 0; |
| 87 |
|
int doremotd = 0; |
| 141 |
|
|
| 142 |
|
static int printVersion = 0; |
| 143 |
|
|
| 144 |
< |
struct lgetopt myopts[] = { |
| 144 |
> |
static struct lgetopt myopts[] = { |
| 145 |
|
{"dlinefile", &ConfigFileEntry.dlinefile, |
| 146 |
|
STRING, "File to use for dline.conf"}, |
| 147 |
|
{"configfile", &ConfigFileEntry.configfile, |
| 335 |
|
static void |
| 336 |
|
write_pidfile(const char *filename) |
| 337 |
|
{ |
| 338 |
< |
FBFILE *fb; |
| 338 |
> |
FILE *fb; |
| 339 |
|
|
| 340 |
< |
if ((fb = fbopen(filename, "w"))) |
| 340 |
> |
if ((fb = fopen(filename, "w"))) |
| 341 |
|
{ |
| 342 |
|
char buff[32]; |
| 343 |
|
unsigned int pid = (unsigned int)getpid(); |
| 345 |
– |
size_t nbytes = snprintf(buff, sizeof(buff), "%u\n", pid); |
| 344 |
|
|
| 345 |
< |
if ((fbputs(buff, fb, nbytes) == -1)) |
| 345 |
> |
snprintf(buff, sizeof(buff), "%u\n", pid); |
| 346 |
> |
|
| 347 |
> |
if ((fputs(buff, fb) == -1)) |
| 348 |
|
ilog(LOG_TYPE_IRCD, "Error writing %u to pid file %s (%s)", |
| 349 |
|
pid, filename, strerror(errno)); |
| 350 |
|
|
| 351 |
< |
fbclose(fb); |
| 352 |
< |
return; |
| 351 |
> |
fclose(fb); |
| 352 |
|
} |
| 353 |
|
else |
| 354 |
|
{ |
| 367 |
|
static void |
| 368 |
|
check_pidfile(const char *filename) |
| 369 |
|
{ |
| 370 |
< |
FBFILE *fb; |
| 370 |
> |
FILE *fb; |
| 371 |
|
char buff[32]; |
| 372 |
|
pid_t pidfromfile; |
| 373 |
|
|
| 374 |
|
/* Don't do logging here, since we don't have log() initialised */ |
| 375 |
< |
if ((fb = fbopen(filename, "r"))) |
| 375 |
> |
if ((fb = fopen(filename, "r"))) |
| 376 |
|
{ |
| 377 |
< |
if (fbgets(buff, 20, fb) == NULL) |
| 377 |
> |
if (fgets(buff, 20, fb) == NULL) |
| 378 |
|
{ |
| 379 |
|
/* log(L_ERROR, "Error reading from pid file %s (%s)", filename, |
| 380 |
|
* strerror(errno)); |
| 392 |
|
} |
| 393 |
|
} |
| 394 |
|
|
| 395 |
< |
fbclose(fb); |
| 395 |
> |
fclose(fb); |
| 396 |
|
} |
| 397 |
|
else if (errno != ENOENT) |
| 398 |
|
{ |
| 444 |
|
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Server context -- %s\n", s); |
| 445 |
|
} |
| 446 |
|
|
| 447 |
< |
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2); |
| 447 |
> |
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1); |
| 448 |
|
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL); |
| 449 |
|
SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_NONE, NULL); |
| 450 |
|
|
| 457 |
|
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Client context -- %s\n", s); |
| 458 |
|
} |
| 459 |
|
|
| 460 |
< |
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2); |
| 460 |
> |
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1); |
| 461 |
|
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL); |
| 462 |
|
SSL_CTX_set_verify(ServerInfo.client_ctx, SSL_VERIFY_NONE, NULL); |
| 463 |
|
#endif /* HAVE_LIBCRYPTO */ |
| 542 |
|
|
| 543 |
|
setup_signals(); |
| 544 |
|
|
| 546 |
– |
get_ircd_platform(ircd_platform); |
| 547 |
– |
|
| 545 |
|
/* Init the event subsystem */ |
| 546 |
|
eventInit(); |
| 547 |
|
/* We need this to initialise the fd array before anything else */ |
| 560 |
|
init_hash(); |
| 561 |
|
init_ip_hash_table(); /* client host ip hash table */ |
| 562 |
|
init_host_hash(); /* Host-hashtable. */ |
| 566 |
– |
clear_tree_parse(); |
| 563 |
|
init_client(); |
| 564 |
|
init_class(); |
| 565 |
< |
init_whowas(); |
| 565 |
> |
whowas_init(); |
| 566 |
|
watch_init(); |
| 567 |
|
init_auth(); /* Initialise the auth code */ |
| 568 |
|
init_resolver(); /* Needs to be setup before the io loop */ |
| 569 |
+ |
modules_init(); |
| 570 |
|
read_conf_files(1); /* cold start init conf files */ |
| 571 |
|
init_uid(); |
| 572 |
|
initialize_server_capabs(); /* Set up default_server_capabs */ |