| 24 |
|
|
| 25 |
|
#ifdef IN_IRCD |
| 26 |
|
#include "stdinc.h" |
| 27 |
+ |
#include "conf/conf.h" |
| 28 |
|
#include "s_user.h" |
| 29 |
|
#include "ircd.h" |
| 30 |
|
#include "channel.h" |
| 33 |
|
#include "common.h" |
| 34 |
|
#include "hash.h" |
| 35 |
|
#include "ircd_signal.h" |
| 35 |
– |
#include "s_gline.h" |
| 36 |
|
#include "motd.h" |
| 37 |
|
#include "ircd_handler.h" |
| 38 |
|
#include "msg.h" /* msgtab */ |
| 39 |
– |
#include "hostmask.h" |
| 39 |
|
#include "numeric.h" |
| 40 |
|
#include "packet.h" |
| 41 |
|
#include "parse.h" |
| 42 |
|
#include "restart.h" |
| 43 |
|
#include "s_auth.h" |
| 45 |
– |
#include "s_conf.h" |
| 44 |
|
#include "parse_aline.h" |
| 45 |
|
#include "s_serv.h" |
| 46 |
|
#include "send.h" |
| 47 |
|
#include "whowas.h" |
| 50 |
– |
#include "conf/modules.h" |
| 51 |
– |
#include "ircd_getopt.h" |
| 48 |
|
#include "motd.h" |
| 53 |
– |
#include "supported.h" |
| 49 |
|
#include "watch.h" |
| 50 |
+ |
#include "patchlevel.h" |
| 51 |
+ |
#include "serno.h" |
| 52 |
|
|
| 56 |
– |
/* Try and find the correct name to use with getrlimit() for setting the max. |
| 57 |
– |
* number of files allowed to be open by this process. |
| 58 |
– |
*/ |
| 53 |
|
|
| 54 |
|
/* /quote set variables */ |
| 55 |
|
struct SetOptions GlobalSetOptions; |
| 56 |
|
struct ServerStatistics ServerStats; |
| 63 |
– |
/* configuration set from ircd.conf */ |
| 64 |
– |
struct config_file_entry ConfigFileEntry; |
| 65 |
– |
/* server info set from ircd.conf */ |
| 66 |
– |
struct server_info ServerInfo; |
| 57 |
|
/* admin info set from ircd.conf */ |
| 68 |
– |
struct admin_info AdminInfo = { NULL, NULL, NULL }; |
| 58 |
|
struct Counter Count = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 59 |
< |
struct ServerState_t server_state = { 0 }; |
| 71 |
< |
struct logging_entry ConfigLoggingEntry = { 1, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} }; |
| 59 |
> |
struct ServerState_t ServerState = { 0 }; |
| 60 |
|
struct Client me; /* That's me */ |
| 61 |
|
struct LocalUser meLocalUser; /* That's also part of me */ |
| 74 |
– |
unsigned long connect_id = 0; /* unique connect ID */ |
| 75 |
– |
|
| 76 |
– |
static unsigned long initialVMTop = 0; /* top of virtual memory at init */ |
| 77 |
– |
const char *logFileName = LPATH; |
| 78 |
– |
const char *pidFileName = PPATH; |
| 62 |
|
|
| 63 |
|
char **myargv; |
| 64 |
< |
char ircd_platform[PLATFORMLEN]; |
| 64 |
> |
const char *ircd_version = PATCHLEVEL; |
| 65 |
> |
const char *serno = SERIALNUM; |
| 66 |
> |
char ircd_platform[IRCD_BUFSIZE]; |
| 67 |
|
|
| 68 |
|
int dorehash = 0; |
| 69 |
|
int doremotd = 0; |
| 79 |
|
|
| 80 |
|
int splitmode; |
| 81 |
|
int splitchecking; |
| 97 |
– |
int split_users; |
| 98 |
– |
unsigned int split_servers; |
| 82 |
|
|
| 83 |
|
static dlink_node *fdlimit_hook; |
| 84 |
|
|
| 94 |
|
|
| 95 |
|
int rehashed_klines = 0; |
| 96 |
|
|
| 114 |
– |
/* |
| 115 |
– |
* get_vm_top - get the operating systems notion of the resident set size |
| 116 |
– |
*/ |
| 97 |
|
#ifndef _WIN32 |
| 118 |
– |
static unsigned long |
| 119 |
– |
get_vm_top(void) |
| 120 |
– |
{ |
| 121 |
– |
/* |
| 122 |
– |
* NOTE: sbrk is not part of the ANSI C library or the POSIX.1 standard |
| 123 |
– |
* however it seems that everyone defines it. Calling sbrk with a 0 |
| 124 |
– |
* argument will return a pointer to the top of the process virtual |
| 125 |
– |
* memory without changing the process size, so this call should be |
| 126 |
– |
* reasonably safe (sbrk returns the new value for the top of memory). |
| 127 |
– |
* This code relies on the notion that the address returned will be an |
| 128 |
– |
* offset from 0 (NULL), so the result of sbrk is cast to a size_t and |
| 129 |
– |
* returned. We really shouldn't be using it here but... |
| 130 |
– |
*/ |
| 131 |
– |
|
| 132 |
– |
void *vptr = sbrk(0); |
| 133 |
– |
return (unsigned long)vptr; |
| 134 |
– |
} |
| 135 |
– |
|
| 98 |
|
/* |
| 99 |
|
* print_startup - print startup information |
| 100 |
|
*/ |
| 103 |
|
{ |
| 104 |
|
printf("ircd: version %s\n", ircd_version); |
| 105 |
|
printf("ircd: pid %d\n", pid); |
| 106 |
< |
printf("ircd: running in %s mode from %s\n", !server_state.foreground ? "background" |
| 107 |
< |
: "foreground", ConfigFileEntry.dpath); |
| 106 |
> |
printf("ircd: running in %s mode from %s\n", |
| 107 |
> |
ServerState.foreground ? "foreground" : "background", DPATH); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
static void |
| 127 |
|
} |
| 128 |
|
#endif |
| 129 |
|
|
| 130 |
< |
/* |
| 131 |
< |
* get_maxrss - get the operating systems notion of the resident set size |
| 170 |
< |
*/ |
| 171 |
< |
unsigned long |
| 172 |
< |
get_maxrss(void) |
| 173 |
< |
{ |
| 174 |
< |
#ifdef _WIN32 |
| 175 |
< |
return (0); /* FIXME */ |
| 176 |
< |
#else |
| 177 |
< |
return (get_vm_top() - initialVMTop); |
| 178 |
< |
#endif |
| 179 |
< |
} |
| 180 |
< |
|
| 181 |
< |
static int printVersion = 0; |
| 182 |
< |
|
| 183 |
< |
struct lgetopt myopts[] = { |
| 184 |
< |
{"dlinefile", &ConfigFileEntry.dlinefile, |
| 185 |
< |
STRING, "File to use for dline.conf"}, |
| 186 |
< |
{"configfile", &ConfigFileEntry.configfile, |
| 130 |
> |
static struct lgetopt myopts[] = { |
| 131 |
> |
{"configfile", &ServerState.configfile, |
| 132 |
|
STRING, "File to use for ircd.conf"}, |
| 133 |
< |
{"klinefile", &ConfigFileEntry.klinefile, |
| 133 |
> |
{"klinefile", &ServerState.klinefile, |
| 134 |
|
STRING, "File to use for kline.conf"}, |
| 135 |
< |
{"xlinefile", &ConfigFileEntry.xlinefile, |
| 135 |
> |
{"rklinefile", &ServerState.rklinefile, |
| 136 |
> |
STRING, "File to use for rkline.conf"}, |
| 137 |
> |
{"dlinefile", &ServerState.dlinefile, |
| 138 |
> |
STRING, "File to use for dline.conf"}, |
| 139 |
> |
{"glinefile", &ServerState.glinefile, |
| 140 |
> |
STRING, "File to use for gline.conf"}, |
| 141 |
> |
{"xlinefile", &ServerState.xlinefile, |
| 142 |
|
STRING, "File to use for xline.conf"}, |
| 143 |
< |
{"logfile", &logFileName, |
| 143 |
> |
{"rxlinefile", &ServerState.rxlinefile, |
| 144 |
> |
STRING, "File to use for rxline.conf"}, |
| 145 |
> |
{"cresvfile", &ServerState.cresvfile, |
| 146 |
> |
STRING, "File to use for cresv.conf"}, |
| 147 |
> |
{"nresvfile", &ServerState.nresvfile, |
| 148 |
> |
STRING, "File to use for nresv.conf"}, |
| 149 |
> |
{"logfile", &ServerState.logfile, |
| 150 |
|
STRING, "File to use for ircd.log"}, |
| 151 |
< |
{"pidfile", &pidFileName, |
| 151 |
> |
{"pidfile", &ServerState.pidfile, |
| 152 |
|
STRING, "File to use for process ID"}, |
| 153 |
< |
{"foreground", &server_state.foreground, |
| 153 |
> |
{"foreground", &ServerState.foreground, |
| 154 |
|
YESNO, "Run in foreground (don't detach)"}, |
| 155 |
< |
{"version", &printVersion, |
| 155 |
> |
{"version", &ServerState.printversion, |
| 156 |
|
YESNO, "Print version and exit"}, |
| 157 |
|
{"help", NULL, USAGE, "Print this text"}, |
| 158 |
|
{NULL, NULL, STRING, NULL}, |
| 199 |
|
free_exited_clients(); |
| 200 |
|
send_queued_all(); |
| 201 |
|
|
| 202 |
< |
/* Check to see whether we have to rehash the configuration .. */ |
| 202 |
> |
// Check to see whether we have to rehash the configuration .. |
| 203 |
|
if (dorehash) |
| 204 |
|
{ |
| 205 |
< |
rehash(1); |
| 205 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 206 |
> |
"Got signal SIGHUP, reloading ircd configuration"); |
| 207 |
> |
read_conf_files(NO); |
| 208 |
|
dorehash = 0; |
| 209 |
|
} |
| 210 |
|
|
| 211 |
|
if (doremotd) |
| 212 |
|
{ |
| 213 |
< |
read_message_file(&ConfigFileEntry.motd); |
| 213 |
> |
read_message_file(&motd); |
| 214 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 215 |
< |
"Got signal SIGUSR1, reloading ircd motd file"); |
| 215 |
> |
"Got signal SIGUSR1, reloading ircd MOTD file"); |
| 216 |
|
doremotd = 0; |
| 217 |
|
} |
| 218 |
|
} |
| 234 |
|
GlobalSetOptions.spam_time = MIN_JOIN_LEAVE_TIME; |
| 235 |
|
GlobalSetOptions.spam_num = MAX_JOIN_LEAVE_COUNT; |
| 236 |
|
|
| 237 |
< |
if (ConfigFileEntry.default_floodcount) |
| 238 |
< |
GlobalSetOptions.floodcount = ConfigFileEntry.default_floodcount; |
| 237 |
> |
if (General.default_floodcount) |
| 238 |
> |
GlobalSetOptions.floodcount = General.default_floodcount; |
| 239 |
|
else |
| 240 |
|
GlobalSetOptions.floodcount = 10; |
| 241 |
|
|
| 242 |
< |
/* XXX I have no idea what to try here - Dianora */ |
| 242 |
> |
// XXX I have no idea what to try here - Dianora |
| 243 |
|
GlobalSetOptions.joinfloodcount = 16; |
| 244 |
|
GlobalSetOptions.joinfloodtime = 8; |
| 245 |
|
|
| 246 |
< |
split_servers = ConfigChannel.default_split_server_count; |
| 247 |
< |
split_users = ConfigChannel.default_split_user_count; |
| 246 |
> |
GlobalSetOptions.split_servers = Channel.default_split_server_count; |
| 247 |
> |
GlobalSetOptions.split_users = Channel.default_split_user_count; |
| 248 |
|
|
| 249 |
< |
if (split_users && split_servers && (ConfigChannel.no_create_on_split || |
| 250 |
< |
ConfigChannel.no_join_on_split)) |
| 249 |
> |
if (GlobalSetOptions.split_users && GlobalSetOptions.split_servers && |
| 250 |
> |
(Channel.no_create_on_split || Channel.no_join_on_split)) |
| 251 |
|
{ |
| 252 |
|
splitmode = 1; |
| 253 |
|
splitchecking = 1; |
| 254 |
|
} |
| 255 |
|
|
| 256 |
|
GlobalSetOptions.ident_timeout = IDENT_TIMEOUT; |
| 257 |
< |
GlobalSetOptions.idletime = ConfigFileEntry.idletime; |
| 257 |
> |
GlobalSetOptions.idletime = General.idletime; |
| 258 |
|
GlobalSetOptions.maxlisters = 10; /* XXX ya ya ya - db */ |
| 259 |
|
} |
| 260 |
|
|
| 302 |
– |
/* initialize_message_files() |
| 303 |
– |
* |
| 304 |
– |
* inputs - none |
| 305 |
– |
* output - none |
| 306 |
– |
* side effects - Set up all message files needed, motd etc. |
| 307 |
– |
*/ |
| 308 |
– |
static void |
| 309 |
– |
initialize_message_files(void) |
| 310 |
– |
{ |
| 311 |
– |
init_message_file(USER_MOTD, MPATH, &ConfigFileEntry.motd); |
| 312 |
– |
init_message_file(OPER_MOTD, OPATH, &ConfigFileEntry.opermotd); |
| 313 |
– |
init_message_file(USER_LINKS, LIPATH, &ConfigFileEntry.linksfile); |
| 314 |
– |
|
| 315 |
– |
read_message_file(&ConfigFileEntry.motd); |
| 316 |
– |
read_message_file(&ConfigFileEntry.opermotd); |
| 317 |
– |
read_message_file(&ConfigFileEntry.linksfile); |
| 318 |
– |
|
| 319 |
– |
init_isupport(); |
| 320 |
– |
} |
| 321 |
– |
|
| 322 |
– |
/* initialize_server_capabs() |
| 323 |
– |
* |
| 324 |
– |
* inputs - none |
| 325 |
– |
* output - none |
| 326 |
– |
*/ |
| 327 |
– |
static void |
| 328 |
– |
initialize_server_capabs(void) |
| 329 |
– |
{ |
| 330 |
– |
add_capability("QS", CAP_QS, 1); |
| 331 |
– |
add_capability("EOB", CAP_EOB, 1); |
| 332 |
– |
add_capability("HUB", CAP_HUB, 0); |
| 333 |
– |
add_capability("TS6", CAP_TS6, 0); |
| 334 |
– |
add_capability("ZIP", CAP_ZIP, 0); |
| 335 |
– |
add_capability("CLUSTER", CAP_CLUSTER, 1); |
| 336 |
– |
#ifdef HALFOPS |
| 337 |
– |
add_capability("HOPS", CAP_HOPS, 1); |
| 338 |
– |
#endif |
| 339 |
– |
} |
| 340 |
– |
|
| 261 |
|
/* write_pidfile() |
| 262 |
|
* |
| 263 |
|
* inputs - filename+path of pid file |
| 303 |
|
char buff[32]; |
| 304 |
|
pid_t pidfromfile; |
| 305 |
|
|
| 306 |
< |
/* Don't do logging here, since we don't have log() initialised */ |
| 306 |
> |
// Don't do logging here, since we don't have log() initialised |
| 307 |
|
if ((fb = fbopen(filename, "r"))) |
| 308 |
|
{ |
| 309 |
|
if (fbgets(buff, 20, fb) == NULL) |
| 318 |
|
|
| 319 |
|
if (!kill(pidfromfile, 0)) |
| 320 |
|
{ |
| 321 |
< |
/* log(L_ERROR, "Server is already running"); */ |
| 321 |
> |
// log(L_ERROR, "Server is already running"); |
| 322 |
|
printf("ircd: daemon is already running\n"); |
| 323 |
|
exit(-1); |
| 324 |
|
} |
| 328 |
|
} |
| 329 |
|
else if (errno != ENOENT) |
| 330 |
|
{ |
| 331 |
< |
/* log(L_ERROR, "Error opening pid file %s", filename); */ |
| 412 |
< |
} |
| 413 |
< |
#endif |
| 414 |
< |
} |
| 415 |
< |
|
| 416 |
< |
/* setup_corefile() |
| 417 |
< |
* |
| 418 |
< |
* inputs - nothing |
| 419 |
< |
* output - nothing |
| 420 |
< |
* side effects - setups corefile to system limits. |
| 421 |
< |
* -kre |
| 422 |
< |
*/ |
| 423 |
< |
static void |
| 424 |
< |
setup_corefile(void) |
| 425 |
< |
{ |
| 426 |
< |
#ifdef HAVE_SYS_RESOURCE_H |
| 427 |
< |
struct rlimit rlim; /* resource limits */ |
| 428 |
< |
|
| 429 |
< |
/* Set corefilesize to maximum */ |
| 430 |
< |
if (!getrlimit(RLIMIT_CORE, &rlim)) |
| 431 |
< |
{ |
| 432 |
< |
rlim.rlim_cur = rlim.rlim_max; |
| 433 |
< |
setrlimit(RLIMIT_CORE, &rlim); |
| 331 |
> |
// log(L_ERROR, "Error opening pid file %s", filename); |
| 332 |
|
} |
| 333 |
|
#endif |
| 334 |
|
} |
| 340 |
|
* side effects - setups SSL context. |
| 341 |
|
*/ |
| 342 |
|
static void |
| 343 |
< |
init_ssl(void) |
| 343 |
> |
ssl_init(void) |
| 344 |
|
{ |
| 345 |
|
#ifdef HAVE_LIBCRYPTO |
| 346 |
|
SSL_library_init(); |
| 379 |
|
iosend_cb = register_callback("iosend", iosend_default); |
| 380 |
|
iorecvctrl_cb = register_callback("iorecvctrl", NULL); |
| 381 |
|
iosendctrl_cb = register_callback("iosendctrl", NULL); |
| 382 |
< |
uid_get_cb = register_callback("uid_get", uid_get); |
| 382 |
> |
authorize_client = register_callback("authorize_client", do_authorize_client); |
| 383 |
> |
uid_get = register_callback("uid_get", do_uid_get); |
| 384 |
|
umode_cb = register_callback("changing_umode", change_simple_umode); |
| 385 |
|
} |
| 386 |
|
|
| 390 |
|
int old_fdlimit = hard_fdlimit; |
| 391 |
|
int fdmax = va_arg(args, int); |
| 392 |
|
|
| 393 |
< |
/* allow MAXCLIENTS_MIN clients even at the cost of MAX_BUFFER and |
| 394 |
< |
* some not really LEAKED_FDS */ |
| 395 |
< |
fdmax = IRCD_MAX(fdmax, LEAKED_FDS + MAX_BUFFER + MAXCLIENTS_MIN); |
| 393 |
> |
/* |
| 394 |
> |
* allow MAXCLIENTS_MIN clients even at the cost of MAX_BUFFER and |
| 395 |
> |
* some not really LEAKED_FDS |
| 396 |
> |
*/ |
| 397 |
> |
fdmax = LIBIO_MAX(fdmax, LEAKED_FDS + MAX_BUFFER + MAXCLIENTS_MIN); |
| 398 |
|
|
| 399 |
|
pass_callback(fdlimit_hook, fdmax); |
| 400 |
|
|
| 424 |
|
return 1; |
| 425 |
|
} |
| 426 |
|
|
| 427 |
< |
/* Setup corefile size immediately after boot -kre */ |
| 427 |
> |
// Setup corefile size immediately after boot -kre |
| 428 |
|
setup_corefile(); |
| 528 |
– |
|
| 529 |
– |
/* set initialVMTop before we allocate any memory */ |
| 530 |
– |
initialVMTop = get_vm_top(); |
| 429 |
|
#endif |
| 430 |
|
|
| 431 |
|
memset(&ServerInfo, 0, sizeof(ServerInfo)); |
| 432 |
|
memset(&ServerStats, 0, sizeof(ServerStats)); |
| 433 |
|
|
| 434 |
< |
ConfigFileEntry.dpath = DPATH; |
| 435 |
< |
ConfigFileEntry.configfile = CPATH; /* Server configuration file */ |
| 436 |
< |
ConfigFileEntry.klinefile = KPATH; /* Server kline file */ |
| 437 |
< |
ConfigFileEntry.xlinefile = XPATH; /* Server xline file */ |
| 438 |
< |
ConfigFileEntry.rxlinefile = RXPATH; /* Server regex xline file */ |
| 439 |
< |
ConfigFileEntry.rklinefile = RKPATH; /* Server regex kline file */ |
| 440 |
< |
ConfigFileEntry.dlinefile = DLPATH; /* dline file */ |
| 441 |
< |
ConfigFileEntry.glinefile = GPATH; /* gline log file */ |
| 442 |
< |
ConfigFileEntry.cresvfile = CRESVPATH; /* channel resv file */ |
| 545 |
< |
ConfigFileEntry.nresvfile = NRESVPATH; /* nick resv file */ |
| 434 |
> |
ServerState.configfile = CPATH; // Server configuration file |
| 435 |
> |
ServerState.klinefile = KPATH; // Server kline file |
| 436 |
> |
ServerState.xlinefile = XPATH; // Server xline file |
| 437 |
> |
ServerState.rxlinefile = RXPATH; // Server regex xline file |
| 438 |
> |
ServerState.rklinefile = RKPATH; // Server regex kline file |
| 439 |
> |
ServerState.dlinefile = DLPATH; // dline file |
| 440 |
> |
ServerState.glinefile = GPATH; // gline log file |
| 441 |
> |
ServerState.cresvfile = CRESVPATH; // channel resv file |
| 442 |
> |
ServerState.nresvfile = NRESVPATH; // nick resv file |
| 443 |
|
myargv = argv; |
| 444 |
< |
umask(077); /* better safe than sorry --SRB */ |
| 444 |
> |
umask(077); // better safe than sorry --SRB |
| 445 |
|
|
| 446 |
|
parseargs(&argc, &argv, myopts); |
| 447 |
|
|
| 448 |
< |
if (printVersion) |
| 448 |
> |
if (ServerState.printversion) |
| 449 |
|
{ |
| 450 |
|
printf("ircd: version %s\n", ircd_version); |
| 451 |
|
exit(EXIT_SUCCESS); |
| 452 |
|
} |
| 453 |
|
|
| 454 |
< |
if (chdir(ConfigFileEntry.dpath)) |
| 454 |
> |
if (chdir(DPATH)) |
| 455 |
|
{ |
| 456 |
|
perror("chdir"); |
| 457 |
|
exit(EXIT_FAILURE); |
| 458 |
|
} |
| 459 |
|
|
| 460 |
< |
init_ssl(); |
| 460 |
> |
ssl_init(); |
| 461 |
|
|
| 462 |
|
#ifndef _WIN32 |
| 463 |
< |
if (!server_state.foreground) |
| 463 |
> |
if (!ServerState.foreground) |
| 464 |
|
make_daemon(); |
| 465 |
|
else |
| 466 |
|
print_startup(getpid()); |
| 467 |
|
#endif |
| 468 |
|
|
| 469 |
< |
libio_init(!server_state.foreground); |
| 469 |
> |
libio_init(!ServerState.foreground); |
| 470 |
|
outofmemory = ircd_outofmemory; |
| 471 |
|
fdlimit_hook = install_hook(fdlimit_cb, changing_fdlimit); |
| 472 |
|
|
| 473 |
< |
check_pidfile(pidFileName); |
| 473 |
> |
check_pidfile(ServerState.pidfile); |
| 474 |
|
setup_signals(); |
| 475 |
< |
get_ircd_platform(ircd_platform); |
| 476 |
< |
init_log(logFileName); |
| 477 |
< |
ServerInfo.can_use_v6 = check_can_use_v6(); |
| 475 |
> |
libio_get_platform(ircd_platform, sizeof(ircd_platform)); |
| 476 |
> |
init_log(ServerState.logfile); |
| 477 |
> |
ServerState.can_use_v6 = check_can_use_v6(); |
| 478 |
|
|
| 582 |
– |
/* make_dlink_node() cannot be called until after libio_init() */ |
| 479 |
|
memset(&me, 0, sizeof(me)); |
| 480 |
|
memset(&meLocalUser, 0, sizeof(meLocalUser)); |
| 585 |
– |
|
| 481 |
|
me.localClient = &meLocalUser; |
| 482 |
|
me.from = me.servptr = &me; |
| 483 |
|
me.lasttime = me.since = me.firsttime = CurrentTime; |
| 589 |
– |
|
| 484 |
|
SetMe(&me); |
| 485 |
|
make_server(&me); |
| 486 |
|
dlinkAdd(&me, &me.node, &global_client_list); |
| 487 |
|
dlinkAdd(&me, make_dlink_node(), &global_serv_list); |
| 488 |
|
|
| 489 |
|
init_callbacks(); |
| 490 |
< |
initialize_message_files(); |
| 491 |
< |
init_hash(); |
| 492 |
< |
init_ip_hash_table(); /* client host ip hash table */ |
| 493 |
< |
init_host_hash(); /* Host-hashtable. */ |
| 490 |
> |
init_motd(); |
| 491 |
> |
init_isupport(); |
| 492 |
> |
hash_init(); |
| 493 |
> |
init_ip_hash_table(); // client host ip hash table |
| 494 |
|
clear_tree_parse(); |
| 495 |
|
init_client(); |
| 496 |
< |
init_class(); |
| 497 |
< |
init_whowas(); |
| 498 |
< |
init_auth(); /* Initialise the auth code */ |
| 499 |
< |
init_channels(); |
| 496 |
> |
whowas_init(); |
| 497 |
> |
watch_init(); |
| 498 |
> |
init_auth(); |
| 499 |
> |
channel_init(); |
| 500 |
|
init_channel_modes(); |
| 501 |
< |
initialize_server_capabs(); /* Set up default_server_capabs */ |
| 502 |
< |
|
| 503 |
< |
read_conf_files(1); /* cold start init conf files */ |
| 610 |
< |
check_class(); |
| 611 |
< |
init_watch(); |
| 612 |
< |
|
| 613 |
< |
if (ServerInfo.name == NULL) |
| 614 |
< |
{ |
| 615 |
< |
ilog(L_CRIT, "ERROR: No server name specified in serverinfo block."); |
| 616 |
< |
exit(EXIT_FAILURE); |
| 617 |
< |
} |
| 618 |
< |
|
| 619 |
< |
strlcpy(me.name, ServerInfo.name, sizeof(me.name)); |
| 620 |
< |
|
| 621 |
< |
/* serverinfo{} description must exist. If not, error out.*/ |
| 622 |
< |
if (ServerInfo.description == NULL) |
| 623 |
< |
{ |
| 624 |
< |
ilog(L_CRIT, |
| 625 |
< |
"ERROR: No server description specified in serverinfo block."); |
| 626 |
< |
exit(EXIT_FAILURE); |
| 627 |
< |
} |
| 628 |
< |
|
| 629 |
< |
strlcpy(me.info, ServerInfo.description, sizeof(me.info)); |
| 501 |
> |
server_init(); |
| 502 |
> |
init_conf(); |
| 503 |
> |
read_conf_files(YES); // cold start init conf files |
| 504 |
|
|
| 505 |
|
hash_add_client(&me); |
| 506 |
+ |
if (me.id[0]) |
| 507 |
+ |
hash_add_id(&me); |
| 508 |
|
|
| 509 |
< |
init_uid(); /* XXX move this one up after inculcating new conf system */ |
| 510 |
< |
initialize_global_set_options(); /* and this one is going to be deleted */ |
| 509 |
> |
init_uid(); |
| 510 |
> |
initialize_global_set_options(); |
| 511 |
|
|
| 636 |
– |
#ifndef STATIC_MODULES |
| 637 |
– |
if (chdir(MODPATH)) |
| 638 |
– |
{ |
| 639 |
– |
ilog (L_CRIT, "Could not load core modules. Terminating!"); |
| 640 |
– |
exit(EXIT_FAILURE); |
| 641 |
– |
} |
| 642 |
– |
|
| 643 |
– |
boot_modules(1); |
| 644 |
– |
|
| 645 |
– |
/* Go back to DPATH after checking to see if we can chdir to MODPATH */ |
| 646 |
– |
chdir(ConfigFileEntry.dpath); |
| 647 |
– |
#else |
| 648 |
– |
load_all_modules(1); |
| 649 |
– |
#endif |
| 512 |
|
/* |
| 513 |
|
* assemble_umode_buffer() has to be called after |
| 514 |
|
* reading conf/loading modules. |
| 515 |
|
*/ |
| 516 |
|
assemble_umode_buffer(); |
| 517 |
|
|
| 518 |
< |
write_pidfile(pidFileName); |
| 518 |
> |
write_pidfile(ServerState.pidfile); |
| 519 |
|
|
| 520 |
|
ilog(L_NOTICE, "Server Ready"); |
| 521 |
|
|
| 522 |
< |
eventAddIsh("cleanup_glines", cleanup_glines, NULL, CLEANUP_GLINES_TIME); |
| 523 |
< |
eventAddIsh("cleanup_tklines", cleanup_tklines, NULL, CLEANUP_TKLINES_TIME); |
| 662 |
< |
|
| 663 |
< |
/* We want try_connections to be called as soon as possible now! -- adrian */ |
| 664 |
< |
/* No, 'cause after a restart it would cause all sorts of nick collides */ |
| 522 |
> |
// We want try_connections to be called as soon as possible now! -- adrian |
| 523 |
> |
// No, 'cause after a restart it would cause all sorts of nick collides |
| 524 |
|
eventAddIsh("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME); |
| 525 |
|
|
| 526 |
|
eventAddIsh("collect_zipstats", collect_zipstats, NULL, ZIPSTATS_TIME); |
| 527 |
|
|
| 528 |
< |
/* Setup the timeout check. I'll shift it later :) -- adrian */ |
| 528 |
> |
// Setup the timeout check. I'll shift it later :) -- adrian |
| 529 |
|
eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1); |
| 530 |
|
|
| 672 |
– |
/* XXX to be removed with old s_conf.c [superseded] */ |
| 673 |
– |
if (ConfigServerHide.links_delay > 0) |
| 674 |
– |
eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay); |
| 675 |
– |
else |
| 676 |
– |
ConfigServerHide.links_disabled = 1; |
| 677 |
– |
|
| 678 |
– |
if (splitmode) /* XXX */ |
| 679 |
– |
eventAddIsh("check_splitmode", check_splitmode, NULL, 60); |
| 680 |
– |
|
| 531 |
|
io_loop(); |
| 532 |
|
return 0; |
| 533 |
|
} |