X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/96d2a6f4378a47d8bb9dc20dcdd6d6f56f84648b..8bd5767b953efd089e0467b02f897f77581e589d:/src/ircd.c diff --git a/src/ircd.c b/src/ircd.c index 86aa1073..25dec90c 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -66,79 +66,79 @@ #include "serno.h" #include "sslproc.h" -/* /quote set variables */ +/* /quote set variables */ struct SetOptions GlobalSetOptions; - -/* configuration set from ircd.conf */ -struct config_file_entry ConfigFileEntry; -/* server info set from ircd.conf */ -struct server_info ServerInfo; -/* admin info set from ircd.conf */ + +/* configuration set from ircd.conf */ +struct config_file_entry ConfigFileEntry; +/* server info set from ircd.conf */ +struct server_info ServerInfo; +/* admin info set from ircd.conf */ struct admin_info AdminInfo; -struct Counter Count; +struct Counter Count; struct ServerStatistics ServerStats; int maxconnections; struct timeval SystemTime; -struct Client me; /* That's me */ +struct Client me; /* That's me */ struct LocalUser meLocalUser; /* That's also part of me */ -rb_dlink_list lclient_list = { NULL, NULL, 0 }; -rb_dlink_list global_client_list = { NULL, NULL, 0 }; -rb_dlink_list global_channel_list = { NULL, NULL, 0 }; - -rb_dlink_list unknown_list; /* unknown clients ON this server only */ -rb_dlink_list serv_list; /* local servers to this server ONLY */ -rb_dlink_list global_serv_list; /* global servers on the network */ -rb_dlink_list local_oper_list; /* our opers, duplicated in lclient_list */ +rb_dlink_list lclient_list = { NULL, NULL, 0 }; +rb_dlink_list global_client_list = { NULL, NULL, 0 }; +rb_dlink_list global_channel_list = { NULL, NULL, 0 }; + +rb_dlink_list unknown_list; /* unknown clients ON this server only */ +rb_dlink_list serv_list; /* local servers to this server ONLY */ +rb_dlink_list global_serv_list; /* global servers on the network */ +rb_dlink_list local_oper_list; /* our opers, duplicated in lclient_list */ rb_dlink_list oper_list; /* network opers */ -time_t startup_time; - -int default_server_capabs = CAP_MASK; - -int splitmode; -int splitchecking; -int split_users; -int split_servers; -int eob_count; - -unsigned long initialVMTop = 0; /* top of virtual memory at init */ -const char *logFileName = LPATH; +time_t startup_time; + +int default_server_capabs = CAP_MASK; + +int splitmode; +int splitchecking; +int split_users; +int split_servers; +int eob_count; + +unsigned long initialVMTop = 0; /* top of virtual memory at init */ +const char *logFileName = LPATH; const char *pidFileName = PPATH; char **myargv; -int dorehash = 0; -int dorehashbans = 0; -int doremotd = 0; -int kline_queued = 0; -int server_state_foreground = 0; -int opers_see_all_users = 0; -int ssl_ok = 0; -int zlib_ok = 1; - -int testing_conf = 0; - -struct config_channel_entry ConfigChannel; -rb_bh *channel_heap; -rb_bh *ban_heap; -rb_bh *topic_heap; -rb_bh *member_heap; - -rb_bh *client_heap = NULL; -rb_bh *lclient_heap = NULL; -rb_bh *pclient_heap = NULL; - -char current_uid[IDLEN]; - -/* patricia */ -rb_bh *prefix_heap; -rb_bh *node_heap; -rb_bh *patricia_heap; - -rb_bh *linebuf_heap; - +int dorehash = 0; +int dorehashbans = 0; +int doremotd = 0; +int kline_queued = 0; +int server_state_foreground = 0; +int opers_see_all_users = 0; +int ssl_ok = 0; +int zlib_ok = 1; + +int testing_conf = 0; + +struct config_channel_entry ConfigChannel; +rb_bh *channel_heap; +rb_bh *ban_heap; +rb_bh *topic_heap; +rb_bh *member_heap; + +rb_bh *client_heap = NULL; +rb_bh *lclient_heap = NULL; +rb_bh *pclient_heap = NULL; + +char current_uid[IDLEN]; + +/* patricia */ +rb_bh *prefix_heap; +rb_bh *node_heap; +rb_bh *patricia_heap; + +rb_bh *linebuf_heap; + rb_bh *dnode_heap; /* @@ -185,7 +185,7 @@ ircd_restart_cb(const char *str) static void ircd_die_cb(const char *str) { - if(str != NULL) + if(str != NULL) { /* Try to get the message out to currently logged in operators. */ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "Server panic! %s", str); @@ -206,21 +206,21 @@ ircd_die_cb(const char *str) static void init_sys(void) { -#if defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H) - struct rlimit limit; - - if(!getrlimit(RLIMIT_NOFILE, &limit)) - { - maxconnections = limit.rlim_cur; - if(maxconnections <= MAX_BUFFER) - { - fprintf(stderr, "ERROR: Shell FD limits are too low.\n"); - fprintf(stderr, "ERROR: ircd-ratbox reserves %d FDs, shell limits must be above this\n", MAX_BUFFER); - exit(EXIT_FAILURE); - } - return; - } -#endif /* RLIMIT_FD_MAX */ +#if defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H) + struct rlimit limit; + + if(!getrlimit(RLIMIT_NOFILE, &limit)) + { + maxconnections = limit.rlim_cur; + if(maxconnections <= MAX_BUFFER) + { + fprintf(stderr, "ERROR: Shell FD limits are too low.\n"); + fprintf(stderr, "ERROR: ircd-ratbox reserves %d FDs, shell limits must be above this\n", MAX_BUFFER); + exit(EXIT_FAILURE); + } + return; + } +#endif /* RLIMIT_FD_MAX */ maxconnections = MAXCONNECTIONS; } @@ -333,9 +333,9 @@ initialize_global_set_options(void) memset(&GlobalSetOptions, 0, sizeof(GlobalSetOptions)); /* memset( &ConfigFileEntry, 0, sizeof(ConfigFileEntry)); */ - GlobalSetOptions.maxclients = ServerInfo.default_max_clients; - - if(GlobalSetOptions.maxclients > (maxconnections - MAX_BUFFER) || (GlobalSetOptions.maxclients <= 0)) + GlobalSetOptions.maxclients = ServerInfo.default_max_clients; + + if(GlobalSetOptions.maxclients > (maxconnections - MAX_BUFFER) || (GlobalSetOptions.maxclients <= 0)) GlobalSetOptions.maxclients = maxconnections - MAX_BUFFER; GlobalSetOptions.autoconn = 1; @@ -645,16 +645,16 @@ main(int argc, char *argv[]) } strlcpy(me.info, ServerInfo.description, sizeof(me.info)); - if(ServerInfo.ssl_cert != NULL && ServerInfo.ssl_private_key != NULL) - { - /* just do the rb_setup_ssl_server to validate the config */ - if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params)) - { - ilog(L_MAIN, "WARNING: Unable to setup SSL."); - ssl_ok = 0; - } - else - ssl_ok = 1; + if(ServerInfo.ssl_cert != NULL && ServerInfo.ssl_private_key != NULL) + { + /* just do the rb_setup_ssl_server to validate the config */ + if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params)) + { + ilog(L_MAIN, "WARNING: Unable to setup SSL."); + ssl_ok = 0; + } + else + ssl_ok = 1; } if (testing_conf)