| 56 |
|
#include "mempool.h" |
| 57 |
|
#include "hook.h" |
| 58 |
|
#include "ircd_getopt.h" |
| 59 |
– |
#include "motd.h" |
| 59 |
|
#include "supported.h" |
| 60 |
|
#include "watch.h" |
| 61 |
|
#include "conf_db.h" |
| 62 |
|
#include "conf_class.h" |
| 63 |
|
|
| 64 |
+ |
|
| 65 |
+ |
#ifdef HAVE_LIBGEOIP |
| 66 |
+ |
GeoIP *geoip_ctx; |
| 67 |
+ |
#endif |
| 68 |
|
/* /quote set variables */ |
| 69 |
|
struct SetOptions GlobalSetOptions; |
| 70 |
|
|
| 250 |
|
} |
| 251 |
|
if (doremotd) |
| 252 |
|
{ |
| 253 |
< |
read_message_file(&ConfigFileEntry.motd); |
| 253 |
> |
motd_recache(); |
| 254 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 255 |
< |
"Got signal SIGUSR1, reloading ircd motd file"); |
| 255 |
> |
"Got signal SIGUSR1, reloading motd files"); |
| 256 |
|
doremotd = 0; |
| 257 |
|
} |
| 258 |
|
} |
| 296 |
|
/* End of global set options */ |
| 297 |
|
} |
| 298 |
|
|
| 296 |
– |
/* initialize_message_files() |
| 297 |
– |
* |
| 298 |
– |
* inputs - none |
| 299 |
– |
* output - none |
| 300 |
– |
* side effects - Set up all message files needed, motd etc. |
| 301 |
– |
*/ |
| 302 |
– |
static void |
| 303 |
– |
initialize_message_files(void) |
| 304 |
– |
{ |
| 305 |
– |
init_message_file(USER_MOTD, MPATH, &ConfigFileEntry.motd); |
| 306 |
– |
init_message_file(USER_LINKS, LIPATH, &ConfigFileEntry.linksfile); |
| 307 |
– |
|
| 308 |
– |
read_message_file(&ConfigFileEntry.motd); |
| 309 |
– |
read_message_file(&ConfigFileEntry.linksfile); |
| 310 |
– |
|
| 311 |
– |
init_isupport(); |
| 312 |
– |
} |
| 313 |
– |
|
| 299 |
|
/* initialize_server_capabs() |
| 300 |
|
* |
| 301 |
|
* inputs - none |
| 308 |
|
add_capability("EOB", CAP_EOB, 1); |
| 309 |
|
add_capability("TS6", CAP_TS6, 0); |
| 310 |
|
add_capability("CLUSTER", CAP_CLUSTER, 1); |
| 311 |
+ |
add_capability("FAKEHOST", CAP_FAKEHOST, 1); |
| 312 |
|
add_capability("SVS", CAP_SVS, 1); |
| 313 |
|
#ifdef HALFOPS |
| 314 |
|
add_capability("HOPS", CAP_HOPS, 1); |
| 411 |
|
#endif |
| 412 |
|
} |
| 413 |
|
|
| 414 |
+ |
#ifdef HAVE_LIBCRYPTO |
| 415 |
+ |
static int |
| 416 |
+ |
always_accept_verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx) |
| 417 |
+ |
{ |
| 418 |
+ |
return 1; |
| 419 |
+ |
} |
| 420 |
+ |
#endif |
| 421 |
+ |
|
| 422 |
|
/* init_ssl() |
| 423 |
|
* |
| 424 |
|
* inputs - nothing |
| 443 |
|
|
| 444 |
|
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1); |
| 445 |
|
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL); |
| 446 |
< |
SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_NONE, NULL); |
| 446 |
> |
SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, |
| 447 |
> |
always_accept_verify_cb); |
| 448 |
|
|
| 449 |
|
if ((ServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL) |
| 450 |
|
{ |
| 457 |
|
|
| 458 |
|
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1); |
| 459 |
|
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL); |
| 460 |
< |
SSL_CTX_set_verify(ServerInfo.client_ctx, SSL_VERIFY_NONE, NULL); |
| 460 |
> |
SSL_CTX_set_verify(ServerInfo.client_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, |
| 461 |
> |
always_accept_verify_cb); |
| 462 |
|
#endif /* HAVE_LIBCRYPTO */ |
| 463 |
|
} |
| 464 |
|
|
| 465 |
|
int |
| 466 |
|
main(int argc, char *argv[]) |
| 467 |
|
{ |
| 468 |
< |
/* Check to see if the user is running |
| 473 |
< |
* us as root, which is a nono |
| 474 |
< |
*/ |
| 468 |
> |
/* Check to see if the user is running us as root, which is a nono */ |
| 469 |
|
if (geteuid() == 0) |
| 470 |
|
{ |
| 471 |
|
fprintf(stderr, "Don't run ircd as root!!!\n"); |
| 482 |
|
init_genrand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20))); |
| 483 |
|
|
| 484 |
|
me.localClient = &meLocalUser; |
| 485 |
< |
dlinkAdd(&me, &me.node, &global_client_list); /* Pointer to beginning |
| 485 |
> |
dlinkAdd(&me, &me.node, &global_client_list); /* Pointer to beginning |
| 486 |
|
of Client list */ |
| 487 |
|
/* Initialise the channel capability usage counts... */ |
| 488 |
|
init_chcap_usage_counts(); |
| 526 |
|
|
| 527 |
|
/* Init the event subsystem */ |
| 528 |
|
eventInit(); |
| 529 |
+ |
|
| 530 |
|
/* We need this to initialise the fd array before anything else */ |
| 531 |
|
fdlist_init(); |
| 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 |
+ |
|
| 536 |
|
/* Check if there is pidfile and daemon already running */ |
| 537 |
|
check_pidfile(pidFileName); |
| 538 |
|
|
| 539 |
|
mp_pool_init(); |
| 540 |
|
init_dlink_nodes(); |
| 541 |
< |
initialize_message_files(); |
| 541 |
> |
init_isupport(); |
| 542 |
|
dbuf_init(); |
| 543 |
|
hash_init(); |
| 544 |
|
init_ip_hash_table(); /* client host ip hash table */ |
| 555 |
|
initialize_server_capabs(); /* Set up default_server_capabs */ |
| 556 |
|
initialize_global_set_options(); |
| 557 |
|
channel_init(); |
| 558 |
+ |
read_links_file(); |
| 559 |
+ |
motd_init(); |
| 560 |
+ |
#ifdef HAVE_LIBGEOIP |
| 561 |
+ |
geoip_ctx = GeoIP_new(GEOIP_MEMORY_CACHE); |
| 562 |
+ |
#endif |
| 563 |
|
|
| 564 |
|
if (EmptyString(ServerInfo.sid)) |
| 565 |
|
{ |