2007-01-25 07:40:21 +01:00
|
|
|
/*
|
2008-07-28 21:02:54 +02:00
|
|
|
* charybdis: A slightly useful ircd.
|
2007-01-25 07:40:21 +01:00
|
|
|
* ircd.c: Starts up and runs the ircd.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
|
|
|
* Copyright (C) 1996-2002 Hybrid Development Team
|
2008-07-28 21:02:54 +02:00
|
|
|
* Copyright (C) 2002-2008 ircd-ratbox development team
|
2013-07-10 05:04:45 +02:00
|
|
|
* Copyright (C) 2005-2013 charybdis development team
|
2007-01-25 07:40:21 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA
|
|
|
|
*/
|
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
#include <ircd/socket.h>
|
2017-03-25 00:45:26 +01:00
|
|
|
#include <ircd/listen.h>
|
2016-11-29 16:23:38 +01:00
|
|
|
#include <ircd/ctx/continuation.h>
|
2016-09-06 22:11:55 +02:00
|
|
|
|
|
|
|
namespace ircd
|
|
|
|
{
|
2016-10-26 11:39:28 +02:00
|
|
|
bool debugmode; // set by command line
|
|
|
|
|
|
|
|
boost::asio::io_service *ios; // user's io service
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-10-26 08:25:04 +02:00
|
|
|
bool main_finish; // Set by stop() to request main context exit
|
2016-10-26 11:39:28 +02:00
|
|
|
bool main_exited; // Set when IRCd is finished
|
|
|
|
main_exit_cb main_exit_func; // Called when main context exits
|
2016-10-26 08:25:04 +02:00
|
|
|
ctx::ctx *main_context; // Reference to main context
|
|
|
|
|
2016-09-06 22:11:55 +02:00
|
|
|
void seed_random();
|
|
|
|
void init_system();
|
2016-09-09 19:48:33 +02:00
|
|
|
void main_exiting() noexcept;
|
2016-11-29 16:23:38 +01:00
|
|
|
void main();
|
2016-09-06 22:11:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ircd::init(boost::asio::io_service &io_service,
|
2016-09-09 19:48:33 +02:00
|
|
|
const std::string &configfile,
|
|
|
|
main_exit_cb main_exit_func)
|
2016-09-06 22:11:55 +02:00
|
|
|
{
|
|
|
|
ircd::ios = &io_service;
|
|
|
|
init_system();
|
|
|
|
|
|
|
|
// The log is available, but it is console-only until conf opens files.
|
|
|
|
log::init();
|
|
|
|
log::mark("log started");
|
|
|
|
|
2016-09-12 09:36:57 +02:00
|
|
|
// The configuration is parsed for grammatical errors only. It is not evaluated.
|
2016-09-08 22:29:02 +02:00
|
|
|
log::info("parsing your configuration");
|
|
|
|
|
2016-09-12 09:36:57 +02:00
|
|
|
// The caller has no other way to know IRCd has halted as everyone shares the
|
|
|
|
// same io_service, which may not return if the caller has their own tasks.
|
2016-09-09 19:48:33 +02:00
|
|
|
at_main_exit(std::move(main_exit_func));
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-09-12 09:36:57 +02:00
|
|
|
// The master of ceremonies runs the show after this function returns and ios.run().
|
2016-09-10 07:23:07 +02:00
|
|
|
log::debug("spawning main context");
|
2016-11-29 16:23:38 +01:00
|
|
|
context mc("main", 8_MiB, ircd::main); //TODO: optimize stack size
|
2016-10-26 08:25:04 +02:00
|
|
|
main_context = mc.detach();
|
2016-09-06 22:11:55 +02:00
|
|
|
|
|
|
|
log::debug("IRCd initialization completed.");
|
|
|
|
}
|
|
|
|
|
2016-10-26 08:25:04 +02:00
|
|
|
void
|
|
|
|
ircd::stop()
|
|
|
|
{
|
|
|
|
main_finish = true;
|
|
|
|
|
|
|
|
if(main_context)
|
|
|
|
ctx::notify(*main_context);
|
|
|
|
}
|
|
|
|
|
2016-09-12 09:36:57 +02:00
|
|
|
//
|
|
|
|
// Main context; Main program loop.
|
|
|
|
// This function is spawned by init(). Do not call this function.
|
|
|
|
//
|
2016-09-06 22:11:55 +02:00
|
|
|
void
|
2016-09-08 22:29:02 +02:00
|
|
|
ircd::main()
|
2016-11-29 16:23:38 +01:00
|
|
|
try
|
2016-09-06 22:11:55 +02:00
|
|
|
{
|
|
|
|
log::debug("IRCd entered main context.");
|
2016-09-23 08:53:31 +02:00
|
|
|
const scope main_exit(&main_exiting); // The user is notified when this function ends
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-09-23 08:53:31 +02:00
|
|
|
// These objects are the init()'s and fini()'s for each subsystem. Appearing here ties them
|
|
|
|
// to the main context. Initialization can also occur in ircd::init() if static initialization
|
|
|
|
// and destruction is not possible, but there is no complementary destruction up there.
|
2016-09-27 10:40:33 +02:00
|
|
|
ctx::ole::init _ole_;
|
2016-09-23 08:53:31 +02:00
|
|
|
mods::init _mods_;
|
2016-09-24 06:01:57 +02:00
|
|
|
db::init _db_;
|
2016-11-29 16:23:38 +01:00
|
|
|
//js::init _js_;
|
|
|
|
socket::init _sock_;
|
|
|
|
client::init _client_;
|
|
|
|
|
|
|
|
//json::test();
|
|
|
|
//exit(0);
|
|
|
|
|
|
|
|
module client_versions("client_versions.so");
|
|
|
|
module client_register("client_register.so");
|
2017-03-21 04:38:34 +01:00
|
|
|
module client_login("client_login.so");
|
2016-10-26 08:25:04 +02:00
|
|
|
|
2017-03-25 00:45:26 +01:00
|
|
|
listener matrics
|
|
|
|
{
|
|
|
|
std::string { json::obj
|
|
|
|
{
|
|
|
|
{ "name", "Chat Matrix" },
|
|
|
|
{ "host", "127.0.0.1" },
|
|
|
|
{ "port", 6667 },
|
|
|
|
{
|
|
|
|
"ssl",
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"certificate",
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"file",
|
|
|
|
{
|
|
|
|
{ "pem", "/home/jason/cdc.z.cert" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"private_key",
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"file",
|
|
|
|
{
|
|
|
|
{ "pem", "/home/jason/cdc.z.key" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
};
|
|
|
|
|
2016-10-26 08:25:04 +02:00
|
|
|
// This is the main program loop. Right now all it does is sleep until notified
|
|
|
|
// to shutdown, but it can do other things eventually. Other subsystems may have
|
|
|
|
// spawned their own main loops.
|
|
|
|
log::notice("IRCd ready"); do
|
2016-09-06 22:11:55 +02:00
|
|
|
{
|
2016-10-26 08:25:04 +02:00
|
|
|
ctx::wait();
|
2016-09-06 22:11:55 +02:00
|
|
|
}
|
2016-10-26 08:25:04 +02:00
|
|
|
while(!main_finish);
|
2016-09-06 22:11:55 +02:00
|
|
|
}
|
|
|
|
catch(const std::exception &e)
|
|
|
|
{
|
2016-09-09 19:48:33 +02:00
|
|
|
log::error("IRCd finished: %s", e.what());
|
2016-09-06 22:11:55 +02:00
|
|
|
}
|
|
|
|
|
2016-09-12 09:36:57 +02:00
|
|
|
//
|
|
|
|
// Cleanup function for the main context.
|
|
|
|
//
|
2016-09-09 19:48:33 +02:00
|
|
|
void
|
|
|
|
ircd::main_exiting()
|
|
|
|
noexcept try
|
|
|
|
{
|
|
|
|
if(main_exit_func)
|
|
|
|
{
|
2016-09-12 09:36:57 +02:00
|
|
|
// This function will notify the user of IRCd shutdown. The notification is
|
|
|
|
// posted to the io_service ensuring THERE IS NO CONTINUATION ON THIS STACK by
|
|
|
|
// the user, who is then free to destruct all elements of IRCd.
|
2016-09-09 19:48:33 +02:00
|
|
|
log::debug("Notifying user of IRCd completion");
|
2016-09-12 09:36:57 +02:00
|
|
|
ios->post(main_exit_func);
|
2016-09-09 19:48:33 +02:00
|
|
|
}
|
2016-09-13 10:31:12 +02:00
|
|
|
|
|
|
|
main_exited = true;
|
2016-10-26 08:25:04 +02:00
|
|
|
main_context = nullptr;
|
2016-09-09 19:48:33 +02:00
|
|
|
}
|
|
|
|
catch(const std::exception &e)
|
|
|
|
{
|
|
|
|
log::critical("main context exit: %s", e.what());
|
2016-09-12 09:36:57 +02:00
|
|
|
std::terminate();
|
2016-09-09 19:48:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ircd::at_main_exit(main_exit_cb main_exit_func)
|
|
|
|
{
|
|
|
|
ircd::main_exit_func = std::move(main_exit_func);
|
|
|
|
}
|
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
namespace ircd
|
|
|
|
{
|
|
|
|
void init_random();
|
|
|
|
void init_rlimit();
|
|
|
|
}
|
|
|
|
|
2016-09-06 22:11:55 +02:00
|
|
|
void
|
|
|
|
ircd::init_system()
|
|
|
|
{
|
2016-11-29 16:23:38 +01:00
|
|
|
init_rlimit();
|
|
|
|
init_random();
|
2016-09-06 22:11:55 +02:00
|
|
|
}
|
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
void
|
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
|
|
|
ircd::init_rlimit()
|
|
|
|
try
|
2016-09-06 22:11:55 +02:00
|
|
|
{
|
2016-11-29 16:23:38 +01:00
|
|
|
//
|
|
|
|
// Setup corefile size immediately after boot -kre
|
|
|
|
//
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
rlimit rlim; // resource limits
|
|
|
|
syscall(getrlimit, RLIMIT_CORE, &rlim);
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
// Set corefilesize to maximum
|
|
|
|
rlim.rlim_cur = rlim.rlim_max;
|
|
|
|
syscall(setrlimit, RLIMIT_CORE, &rlim);
|
|
|
|
}
|
|
|
|
catch(const std::exception &e)
|
2016-09-06 22:11:55 +02:00
|
|
|
{
|
2016-11-29 16:23:38 +01:00
|
|
|
std::cerr << "Failed to adjust rlimit: " << e.what() << std::endl;
|
2016-09-06 22:11:55 +02:00
|
|
|
}
|
2016-11-29 16:23:38 +01:00
|
|
|
#else
|
|
|
|
ircd::init_rlimit()
|
2016-09-06 22:11:55 +02:00
|
|
|
{
|
|
|
|
}
|
2016-11-29 16:23:38 +01:00
|
|
|
#endif
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
void
|
|
|
|
ircd::init_random()
|
|
|
|
{
|
2017-03-14 05:14:40 +01:00
|
|
|
union
|
|
|
|
{
|
|
|
|
char seed_char[4];
|
|
|
|
int seed_int;
|
|
|
|
};
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
std::ifstream s("/dev/urandom");
|
|
|
|
if(s.good())
|
2017-03-14 05:14:40 +01:00
|
|
|
s.read(seed_char, sizeof(seed_char));
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2017-03-14 05:14:40 +01:00
|
|
|
srand(seed_int);
|
2016-11-29 16:23:38 +01:00
|
|
|
}
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-07-13 07:17:21 +02:00
|
|
|
|
2016-09-11 08:05:38 +02:00
|
|
|
// namespace ircd {
|
2016-07-13 07:17:21 +02:00
|
|
|
|
2008-04-13 17:54:23 +02:00
|
|
|
/* /quote set variables */
|
2016-09-11 08:05:38 +02:00
|
|
|
/*
|
2008-04-05 20:02:59 +02:00
|
|
|
struct SetOptions GlobalSetOptions;
|
2008-04-13 17:54:23 +02:00
|
|
|
|
|
|
|
struct Counter Count;
|
2008-04-04 17:54:37 +02:00
|
|
|
struct ServerStatistics ServerStats;
|
|
|
|
|
2016-08-31 12:55:27 +02:00
|
|
|
struct ev_entry *check_splitmode_ev;
|
|
|
|
|
2008-04-08 13:50:39 +02:00
|
|
|
int maxconnections;
|
2016-09-10 21:57:33 +02:00
|
|
|
//struct LocalUser meLocalUser; // That's also part of me
|
2008-04-08 13:50:39 +02:00
|
|
|
|
2008-06-28 12:36:25 +02:00
|
|
|
rb_dlink_list global_client_list;
|
2016-09-11 08:05:38 +02:00
|
|
|
*/
|
2008-04-13 17:54:23 +02:00
|
|
|
|
2008-06-28 12:36:25 +02:00
|
|
|
/* unknown/client pointer lists */
|
2016-10-26 11:39:28 +02:00
|
|
|
//rb_dlink_list unknown_list; /* unknown clients ON this server only */
|
|
|
|
//rb_dlink_list lclient_list; /* local clients only ON this server */
|
|
|
|
//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 */
|
2008-04-08 14:01:16 +02:00
|
|
|
|
2016-09-11 08:05:38 +02:00
|
|
|
/*
|
2016-04-26 00:21:38 +02:00
|
|
|
char * const *myargv;
|
2016-03-28 02:05:38 +02:00
|
|
|
volatile sig_atomic_t dorehash = false;
|
|
|
|
volatile sig_atomic_t dorehashbans = false;
|
|
|
|
volatile sig_atomic_t doremotd = false;
|
2016-03-09 09:00:40 +01:00
|
|
|
bool kline_queued = false;
|
2016-08-26 06:37:06 +02:00
|
|
|
bool server_state_foreground = true;
|
2016-03-09 09:19:31 +01:00
|
|
|
bool opers_see_all_users = false;
|
2016-03-19 06:57:32 +01:00
|
|
|
bool ircd_ssl_ok = false;
|
|
|
|
bool ircd_zlib_ok = true;
|
2008-04-13 17:54:23 +02:00
|
|
|
|
|
|
|
int testing_conf = 0;
|
2016-08-16 01:21:01 +02:00
|
|
|
//time_t startup_time;
|
2008-04-13 17:54:23 +02:00
|
|
|
|
2012-02-04 08:47:46 +01:00
|
|
|
int default_server_capabs;
|
2008-04-13 17:54:23 +02:00
|
|
|
|
2008-07-27 14:25:00 +02:00
|
|
|
int splitmode;
|
|
|
|
int splitchecking;
|
|
|
|
int split_users;
|
|
|
|
int split_servers;
|
|
|
|
int eob_count;
|
2016-09-11 08:05:38 +02:00
|
|
|
*/
|
2008-04-06 16:52:42 +02:00
|
|
|
|
2016-09-11 08:05:38 +02:00
|
|
|
// }
|
2016-09-06 22:11:55 +02:00
|
|
|
|
2016-09-01 17:50:48 +02:00
|
|
|
/*
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
check_rehash(void *unused)
|
|
|
|
{
|
|
|
|
if(dorehash)
|
|
|
|
{
|
2016-03-23 14:52:32 +01:00
|
|
|
rehash(true);
|
2016-03-09 09:06:21 +01:00
|
|
|
dorehash = false;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(dorehashbans)
|
|
|
|
{
|
2016-03-23 14:52:32 +01:00
|
|
|
rehash_bans();
|
2016-03-09 09:06:21 +01:00
|
|
|
dorehashbans = false;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(doremotd)
|
|
|
|
{
|
2016-08-26 13:50:12 +02:00
|
|
|
sendto_realops_snomask(sno::GENERAL, L_ALL,
|
2007-01-25 07:40:21 +01:00
|
|
|
"Got signal SIGUSR1, reloading ircd motd file");
|
2016-08-14 01:42:12 +02:00
|
|
|
cache::motd::cache_user();
|
2016-03-09 09:06:21 +01:00
|
|
|
doremotd = false;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
}
|
2016-09-01 17:50:48 +02:00
|
|
|
*/
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* initalialize_global_set_options
|
|
|
|
*
|
|
|
|
* inputs - none
|
|
|
|
* output - none
|
2014-03-03 05:25:47 +01:00
|
|
|
* side effects - This sets all global set options needed
|
2007-01-25 07:40:21 +01:00
|
|
|
*/
|
2016-10-26 11:39:28 +02:00
|
|
|
/*
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
initialize_global_set_options(void)
|
|
|
|
{
|
|
|
|
memset(&GlobalSetOptions, 0, sizeof(GlobalSetOptions));
|
2016-09-01 17:50:48 +02:00
|
|
|
// memset( &ConfigFileEntry, 0, sizeof(ConfigFileEntry));
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-13 17:54:23 +02:00
|
|
|
GlobalSetOptions.maxclients = ServerInfo.default_max_clients;
|
|
|
|
|
|
|
|
if(GlobalSetOptions.maxclients > (maxconnections - MAX_BUFFER) || (GlobalSetOptions.maxclients <= 0))
|
2008-04-05 21:56:15 +02:00
|
|
|
GlobalSetOptions.maxclients = maxconnections - MAX_BUFFER;
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
GlobalSetOptions.autoconn = 1;
|
|
|
|
|
|
|
|
GlobalSetOptions.spam_time = MIN_JOIN_LEAVE_TIME;
|
|
|
|
GlobalSetOptions.spam_num = MAX_JOIN_LEAVE_COUNT;
|
|
|
|
|
2013-10-29 10:07:19 +01:00
|
|
|
GlobalSetOptions.floodcount = ConfigFileEntry.default_floodcount;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
split_servers = ConfigChannel.default_split_server_count;
|
|
|
|
split_users = ConfigChannel.default_split_user_count;
|
|
|
|
|
|
|
|
if(split_users && split_servers
|
|
|
|
&& (ConfigChannel.no_create_on_split || ConfigChannel.no_join_on_split))
|
|
|
|
{
|
|
|
|
splitmode = 1;
|
|
|
|
splitchecking = 1;
|
|
|
|
}
|
|
|
|
|
2013-10-29 10:07:19 +01:00
|
|
|
GlobalSetOptions.ident_timeout = ConfigFileEntry.default_ident_timeout;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-20 06:40:40 +02:00
|
|
|
rb_strlcpy(GlobalSetOptions.operstring,
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.default_operstring,
|
|
|
|
sizeof(GlobalSetOptions.operstring));
|
2008-04-20 06:40:40 +02:00
|
|
|
rb_strlcpy(GlobalSetOptions.adminstring,
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.default_adminstring,
|
|
|
|
sizeof(GlobalSetOptions.adminstring));
|
|
|
|
}
|
2016-10-26 11:39:28 +02:00
|
|
|
*/
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-31 12:55:27 +02:00
|
|
|
|
2016-09-01 17:50:48 +02:00
|
|
|
|
2016-08-31 12:55:27 +02:00
|
|
|
// initialise operhash fairly early.
|
|
|
|
//init_operhash();
|
|
|
|
|
2016-09-01 17:50:48 +02:00
|
|
|
//me.localClient = &meLocalUser;
|
2016-08-31 12:55:27 +02:00
|
|
|
//rb_dlinkAddTail(&me, &me.node, &global_client_list);
|
|
|
|
|
|
|
|
//init_builtin_capabs();
|
|
|
|
//default_server_capabs = CAP_MASK;
|
|
|
|
//newconf_init();
|
|
|
|
//init_s_conf();
|
|
|
|
//init_s_newconf();
|
|
|
|
//init_hash();
|
|
|
|
//init_host_hash();
|
|
|
|
//client::init();
|
|
|
|
//init_hook();
|
|
|
|
//chan::init();
|
|
|
|
//initclass();
|
|
|
|
//whowas::init();
|
|
|
|
//init_reject();
|
|
|
|
//cache::init();
|
|
|
|
//init_monitor();
|
|
|
|
//chan::mode::init();
|
|
|
|
//init_authd(); /* Start up authd. */
|
|
|
|
//init_dns(); /* Start up DNS query system */
|
|
|
|
|
|
|
|
//privilegeset_set_new("default", "", 0);
|
|
|
|
|
|
|
|
//read_conf_files(true); /* cold start init conf files */
|
|
|
|
|
|
|
|
//mods::autoload();
|
|
|
|
//supported::init();
|
|
|
|
//init_bandb();
|
|
|
|
//init_ssld();
|
|
|
|
//init_wsockd();
|
|
|
|
//rehash_bans();
|
|
|
|
|
|
|
|
//default_server_capabs &= ~CAP_ZIP; // Set up default_server_capabs
|
|
|
|
//initialize_global_set_options();
|
2007-01-25 07:40:21 +01:00
|
|
|
/*
|
2016-08-31 12:55:27 +02:00
|
|
|
if(ServerInfo.name == NULL)
|
|
|
|
throw error("no server name specified in serverinfo block.");
|
|
|
|
|
|
|
|
rb_strlcpy(me.name, ServerInfo.name, sizeof(me.name));
|
|
|
|
|
|
|
|
if(ServerInfo.sid[0] == '\0')
|
|
|
|
throw error("no server sid specified in serverinfo block.");
|
|
|
|
|
|
|
|
rb_strlcpy(me.id, ServerInfo.sid, sizeof(me.id));
|
|
|
|
//client::init_uid();
|
|
|
|
|
|
|
|
// serverinfo{} description must exist. If not, error out.
|
|
|
|
if(ServerInfo.description == NULL)
|
|
|
|
throw error("no server description specified in serverinfo block.");
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-31 12:55:27 +02:00
|
|
|
rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info));
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
if(ServerInfo.ssl_cert != NULL)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-31 12:55:27 +02:00
|
|
|
// 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))
|
|
|
|
{
|
|
|
|
ilog(L_MAIN, "WARNING: Unable to setup SSL.");
|
|
|
|
ircd_ssl_ok = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ircd_ssl_ok = true;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
2016-08-31 12:55:27 +02:00
|
|
|
*/
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-31 12:55:27 +02:00
|
|
|
//me.from = &me;
|
|
|
|
//me.servptr = &me;
|
|
|
|
//set_me(me);
|
|
|
|
//make_serv(me);
|
|
|
|
//add_to_client_hash(me.name, &me);
|
|
|
|
//add_to_id_hash(me.id, &me);
|
|
|
|
//nameinfo(serv(me)) = cache::serv::connect(me.name, me.info);
|
2008-07-28 21:02:54 +02:00
|
|
|
|
2016-08-31 12:55:27 +02:00
|
|
|
//rb_dlinkAddAlloc(&me, &global_serv_list);
|
|
|
|
|
|
|
|
//check_class();
|
|
|
|
//cache::help::load();
|
|
|
|
|
|
|
|
//configure_authd();
|
|
|
|
|
|
|
|
/* We want try_connections to be called as soon as possible now! -- adrian */
|
|
|
|
/* No, 'cause after a restart it would cause all sorts of nick collides */
|
|
|
|
/* um. by waiting even longer, that just means we have even *more*
|
|
|
|
* nick collisions. what a stupid idea. set an event for the IO loop --fl
|
|
|
|
*/
|
|
|
|
// rb_event_addish("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME);
|
|
|
|
// rb_event_addonce("try_connections_startup", try_connections, NULL, 2);
|
|
|
|
// rb_event_add("check_rehash", check_rehash, NULL, 3);
|
|
|
|
// rb_event_addish("reseed_srand", seed_random, NULL, 300); /* reseed every 10 minutes */
|
|
|
|
|
|
|
|
// if(splitmode)
|
|
|
|
// check_splitmode_ev = rb_event_add("check_splitmode", chan::check_splitmode, NULL, 5);
|