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 |
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 |
442 |
|
|
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 |
|
if ((ServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL) |
449 |
|
{ |
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_NONE, NULL); |
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 |
465 |
|
main(int argc, char *argv[]) |
466 |
|
{ |
467 |
< |
/* Check to see if the user is running |
473 |
< |
* us as root, which is a nono |
474 |
< |
*/ |
467 |
> |
/* Check to see if the user is running us as root, which is a nono */ |
468 |
|
if (geteuid() == 0) |
469 |
|
{ |
470 |
|
fprintf(stderr, "Don't run ircd as root!!!\n"); |
481 |
|
init_genrand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20))); |
482 |
|
|
483 |
|
me.localClient = &meLocalUser; |
484 |
< |
dlinkAdd(&me, &me.node, &global_client_list); /* Pointer to beginning |
484 |
> |
dlinkAdd(&me, &me.node, &global_client_list); /* Pointer to beginning |
485 |
|
of Client list */ |
486 |
|
/* Initialise the channel capability usage counts... */ |
487 |
|
init_chcap_usage_counts(); |
525 |
|
|
526 |
|
/* Init the event subsystem */ |
527 |
|
eventInit(); |
528 |
+ |
|
529 |
|
/* We need this to initialise the fd array before anything else */ |
530 |
|
fdlist_init(); |
531 |
|
log_set_file(LOG_TYPE_IRCD, 0, logFileName); |
532 |
|
check_can_use_v6(); |
533 |
|
init_comm(); /* This needs to be setup early ! -- adrian */ |
534 |
+ |
|
535 |
|
/* Check if there is pidfile and daemon already running */ |
536 |
|
check_pidfile(pidFileName); |
537 |
|
|
538 |
|
mp_pool_init(); |
539 |
|
init_dlink_nodes(); |
540 |
< |
initialize_message_files(); |
540 |
> |
init_isupport(); |
541 |
|
dbuf_init(); |
542 |
|
hash_init(); |
543 |
|
init_ip_hash_table(); /* client host ip hash table */ |
554 |
|
initialize_server_capabs(); /* Set up default_server_capabs */ |
555 |
|
initialize_global_set_options(); |
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 (EmptyString(ServerInfo.sid)) |
564 |
|
{ |