X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/d3f6b808677ba8bd3fa48f9bd61b99a2292a8c3e..c51b77a3124f8dcd7746f244379194d52cfbc5f5:/ircd/ircd.c diff --git a/ircd/ircd.c b/ircd/ircd.c index 5c576fc8..a5fc7136 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -53,19 +53,22 @@ #include "ircd_getopt.h" #include "newconf.h" #include "reject.h" -#include "s_conf.h" #include "s_newconf.h" #include "cache.h" #include "monitor.h" #include "patchlevel.h" #include "serno.h" #include "sslproc.h" +#include "wsproc.h" #include "chmode.h" #include "privilege.h" #include "bandbi.h" -#include "authd.h" +#include "authproc.h" #include "operhash.h" +static void +ircd_die_cb(const char *str) __attribute__((noreturn)); + /* /quote set variables */ struct SetOptions GlobalSetOptions; @@ -93,10 +96,10 @@ 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 */ -char **myargv; -bool dorehash = false; -bool dorehashbans = false; -bool doremotd = false; +char * const *myargv; +volatile sig_atomic_t dorehash = false; +volatile sig_atomic_t dorehashbans = false; +volatile sig_atomic_t doremotd = false; bool kline_queued = false; bool server_state_foreground = false; bool opers_see_all_users = false; @@ -133,6 +136,25 @@ const char *ircd_paths[IRCD_PATH_COUNT] = { [IRCD_PATH_LIBEXEC] = PKGLIBEXECDIR, }; +const char *ircd_pathnames[IRCD_PATH_COUNT] = { + [IRCD_PATH_PREFIX] = "prefix", + [IRCD_PATH_MODULES] = "modules", + [IRCD_PATH_AUTOLOAD_MODULES] = "autoload modules", + [IRCD_PATH_ETC] = "config", + [IRCD_PATH_LOG] = "log", + [IRCD_PATH_USERHELP] = "user help", + [IRCD_PATH_OPERHELP] = "oper help", + [IRCD_PATH_IRCD_EXEC] = "ircd binary", + [IRCD_PATH_IRCD_CONF] = "ircd.conf", + [IRCD_PATH_IRCD_MOTD] = "ircd.motd", + [IRCD_PATH_IRCD_LOG] = "ircd.log", + [IRCD_PATH_IRCD_PID] = "ircd.pid", + [IRCD_PATH_IRCD_OMOTD] = "oper motd", + [IRCD_PATH_BANDB] = "bandb", + [IRCD_PATH_BIN] = "binary dir", + [IRCD_PATH_LIBEXEC] = "libexec dir", +}; + const char *logFileName = NULL; const char *pidFileName = NULL; @@ -185,7 +207,6 @@ print_startup(int pid) if (fd != 1) abort(); #endif - inotice("runtime path: %s", rb_path_to_self()); inotice("now running in %s mode from %s as pid %d ...", !server_state_foreground ? "background" : "foreground", ConfigFileEntry.dpath, pid); @@ -465,6 +486,12 @@ relocate_paths(void) snprintf(workbuf, sizeof workbuf, "%s%cbin", prefix, RB_PATH_SEPARATOR); ircd_paths[IRCD_PATH_BIN] = rb_strdup(workbuf); ircd_paths[IRCD_PATH_LIBEXEC] = rb_strdup(workbuf); + + inotice("runtime paths:") + for (int i = 0; i < IRCD_PATH_COUNT; i++) + { + inotice(" %s: %s", ircd_pathnames[i], ircd_paths[i]); + } } #endif @@ -644,7 +671,7 @@ seed_random(void *unused) * Side Effects - this is where the ircd gets going right now */ int -charybdis_main(int argc, char *argv[]) +charybdis_main(int argc, char * const argv[]) { int fd; @@ -657,9 +684,7 @@ charybdis_main(int argc, char *argv[]) } #endif -#ifdef _WIN32 relocate_paths(); -#endif logFileName = ircd_paths[IRCD_PATH_IRCD_LOG]; pidFileName = ircd_paths[IRCD_PATH_IRCD_PID]; @@ -778,9 +803,6 @@ charybdis_main(int argc, char *argv[]) construct_cflags_strings(); - load_all_modules(1); - load_core_modules(1); - init_authd(); /* Start up authd. */ init_dns(); /* Start up DNS query system */ @@ -792,11 +814,14 @@ charybdis_main(int argc, char *argv[]) mod_add_path(MODULE_DIR); mod_add_path(MODULE_DIR "/autoload"); + load_all_modules(1); + load_core_modules(1); init_isupport(); init_bandb(); init_ssld(); + init_wsockd(); rehash_bans(); @@ -815,7 +840,7 @@ charybdis_main(int argc, char *argv[]) ierror("no server sid specified in serverinfo block."); return -2; } - strcpy(me.id, ServerInfo.sid); + rb_strlcpy(me.id, ServerInfo.sid, sizeof(me.id)); init_uid(); /* serverinfo{} description must exist. If not, error out. */ @@ -826,7 +851,7 @@ charybdis_main(int argc, char *argv[]) } rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info)); - if(ServerInfo.ssl_cert != NULL && ServerInfo.ssl_private_key != NULL) + if(ServerInfo.ssl_cert != 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, ServerInfo.ssl_cipher_list)) @@ -845,8 +870,6 @@ charybdis_main(int argc, char *argv[]) return 0; /* Why? We want the launcher to exit out. */ } - configure_authd(); - me.from = &me; me.servptr = &me; SetMe(&me); @@ -865,6 +888,8 @@ charybdis_main(int argc, char *argv[]) load_help(); open_logfiles(); + configure_authd(); + ilog(L_MAIN, "Server Ready"); /* We want try_connections to be called as soon as possible now! -- adrian */