mirror of
https://github.com/matrix-construct/construct
synced 2024-11-11 12:31:07 +01:00
Upgrade newconf parser to boost::spirit.
This commit is contained in:
parent
edd8fa2ab0
commit
670990a215
13 changed files with 3233 additions and 3109 deletions
|
@ -27,14 +27,15 @@ using ircd::lgetopt;
|
|||
|
||||
bool printversion;
|
||||
bool testing_conf;
|
||||
const char *configfile;
|
||||
lgetopt opts[] =
|
||||
{
|
||||
{ "help", NULL, lgetopt::USAGE, "Print this text" },
|
||||
{ "version", &printversion, lgetopt::BOOL, "Print version and exit" },
|
||||
{ "configfile", &ircd::ConfigFileEntry.configfile, lgetopt::STRING, "File to use for ircd.conf" },
|
||||
{ "conftest", &testing_conf, lgetopt::YESNO, "Test the configuration files and exit" },
|
||||
{ "debug", &ircd::debugmode, lgetopt::BOOL, "Enable options for debugging" },
|
||||
{ NULL, NULL, lgetopt::STRING, NULL },
|
||||
{ "help", nullptr, lgetopt::USAGE, "Print this text" },
|
||||
{ "version", &printversion, lgetopt::BOOL, "Print version and exit" },
|
||||
{ "configfile", &configfile, lgetopt::STRING, "File to use for ircd.conf" },
|
||||
{ "conftest", &testing_conf, lgetopt::YESNO, "Test the configuration files and exit" },
|
||||
{ "debug", &ircd::debugmode, lgetopt::BOOL, "Enable options for debugging" },
|
||||
{ nullptr, nullptr, lgetopt::STRING, nullptr },
|
||||
};
|
||||
|
||||
const char *const fatalerrstr
|
||||
|
@ -67,10 +68,6 @@ try
|
|||
{
|
||||
umask(077); // better safe than sorry --SRB
|
||||
|
||||
ircd::ConfigFileEntry.dpath = path::get(path::PREFIX);
|
||||
ircd::ConfigFileEntry.configfile = path::get(path::IRCD_CONF); // Server configuration file
|
||||
ircd::ConfigFileEntry.connect_timeout = 30; // Default to 30
|
||||
|
||||
parseargs(&argc, &argv, opts);
|
||||
if(!startup_checks())
|
||||
return 1;
|
||||
|
@ -84,7 +81,9 @@ try
|
|||
sigs.add(SIGINT);
|
||||
sigs.add(SIGQUIT);
|
||||
sigs.async_wait(sigfd_handler);
|
||||
ircd::init(ios);
|
||||
|
||||
const std::string confpath(configfile?: path::get(path::IRCD_CONF));
|
||||
ircd::init(ios, confpath);
|
||||
ios.run(); // Blocks until a clean exit or an exception comes out of it.
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
|
@ -127,7 +126,7 @@ try
|
|||
throw ircd::error("Don't run ircd as root!!!");
|
||||
#endif
|
||||
|
||||
path::chdir(ircd::ConfigFileEntry.dpath);
|
||||
path::chdir(path::get(path::PREFIX));
|
||||
return true;
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
|
|
|
@ -1,75 +1,39 @@
|
|||
/*
|
||||
* charybdis: Advanced, scalable Internet Relay Chat.
|
||||
* s_conf.h: A header for the configuration functions.
|
||||
* Copyright (C) 2016 Charybdis Development Team
|
||||
* Copyright (C) 2016 Jason Volk <jason@zemos.net>
|
||||
*
|
||||
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
||||
* Copyright (C) 1996-2002 Hybrid Development Team
|
||||
* Copyright (C) 2002-2004 ircd-ratbox development team
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* 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 SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_S_CONF_H
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
#include <openssl/rsa.h>
|
||||
#endif
|
||||
#define HAVE_IRCD_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ircd {
|
||||
namespace conf {
|
||||
|
||||
struct DNSReply;
|
||||
struct hostent;
|
||||
|
||||
/* used by new parser */
|
||||
/* yacc/lex love globals!!! */
|
||||
|
||||
struct ip_value
|
||||
{
|
||||
struct rb_sockaddr_storage ip;
|
||||
int ip_mask;
|
||||
int type;
|
||||
};
|
||||
|
||||
extern FILE *conf_fbfile_in;
|
||||
extern char conf_line_in[256];
|
||||
|
||||
struct ConfItem
|
||||
{
|
||||
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
|
||||
unsigned int flags;
|
||||
int clients; /* Number of *LOCAL* clients using this */
|
||||
union
|
||||
{
|
||||
char *name; /* IRC name, nick, server name, or original u@h */
|
||||
const char *oper;
|
||||
} info;
|
||||
char *host; /* host part of user@host */
|
||||
char *passwd; /* doubles as kline reason *ugh* */
|
||||
char *spasswd; /* Password to send. */
|
||||
char *user; /* user part of user@host */
|
||||
int port;
|
||||
time_t hold; /* Hold action until this time (calendar time) */
|
||||
time_t created; /* Creation time (for klines etc) */
|
||||
time_t lifetime; /* Propagated lines: remember until this time */
|
||||
char *className; /* Name of class */
|
||||
struct Class *c_class; /* Class of connection */
|
||||
rb_patricia_node_t *pnode; /* Our patricia node */
|
||||
};
|
||||
#define NOT_AUTHORISED (-1)
|
||||
#define I_SOCKET_ERROR (-2)
|
||||
#define I_LINE_FULL (-3)
|
||||
#define BANNED_CLIENT (-4)
|
||||
#define TOO_MANY_LOCAL (-6)
|
||||
#define TOO_MANY_GLOBAL (-7)
|
||||
#define TOO_MANY_IDENT (-8)
|
||||
|
||||
#define CONF_ILLEGAL 0x80000000
|
||||
#define CONF_CLIENT 0x0002
|
||||
|
@ -110,6 +74,29 @@ struct ConfItem
|
|||
#define CONF_FLAGS_EXEMPTPROXY 0x08000000
|
||||
|
||||
|
||||
struct ConfItem
|
||||
{
|
||||
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
|
||||
unsigned int flags;
|
||||
int clients; /* Number of *LOCAL* clients using this */
|
||||
union
|
||||
{
|
||||
char *name; /* IRC name, nick, server name, or original u@h */
|
||||
const char *oper;
|
||||
} info;
|
||||
char *host; /* host part of user@host */
|
||||
char *passwd; /* doubles as kline reason *ugh* */
|
||||
char *spasswd; /* Password to send. */
|
||||
char *user; /* user part of user@host */
|
||||
int port;
|
||||
time_t hold; /* Hold action until this time (calendar time) */
|
||||
time_t created; /* Creation time (for klines etc) */
|
||||
time_t lifetime; /* Propagated lines: remember until this time */
|
||||
char *className; /* Name of class */
|
||||
struct Class *c_class; /* Class of connection */
|
||||
rb_patricia_node_t *pnode; /* Our patricia node */
|
||||
};
|
||||
|
||||
/* Macros for struct ConfItem */
|
||||
#define IsConfBan(x) ((x)->status & (CONF_KILL|CONF_XLINE|CONF_DLINE|\
|
||||
CONF_RESV_CHANNEL|CONF_RESV_NICK))
|
||||
|
@ -320,73 +307,53 @@ typedef enum temp_list
|
|||
|
||||
extern rb_dlink_list temp_klines[LAST_TEMP_TYPE];
|
||||
extern rb_dlink_list temp_dlines[LAST_TEMP_TYPE];
|
||||
extern unsigned long cidr_to_bitmask[];
|
||||
|
||||
extern void init_s_conf(void);
|
||||
void init_s_conf(void);
|
||||
|
||||
extern struct ConfItem *make_conf(void);
|
||||
extern void free_conf(struct ConfItem *);
|
||||
struct ConfItem *make_conf(void);
|
||||
void free_conf(struct ConfItem *);
|
||||
|
||||
extern rb_dlink_node *find_prop_ban(unsigned int status, const char *user, const char *host);
|
||||
extern void deactivate_conf(struct ConfItem *, rb_dlink_node *, time_t);
|
||||
extern void replace_old_ban(struct ConfItem *);
|
||||
rb_dlink_node *find_prop_ban(unsigned int status, const char *user, const char *host);
|
||||
void deactivate_conf(struct ConfItem *, rb_dlink_node *, time_t);
|
||||
void replace_old_ban(struct ConfItem *);
|
||||
|
||||
extern void read_conf_files(bool cold);
|
||||
void read_conf_files(bool cold);
|
||||
|
||||
extern int attach_conf(client::client *, struct ConfItem *);
|
||||
extern int check_client(client::client *client_p, client::client *source_p, const char *);
|
||||
int attach_conf(client::client *, struct ConfItem *);
|
||||
int check_client(client::client *client_p, client::client *source_p, const char *);
|
||||
|
||||
extern int detach_conf(client::client *);
|
||||
int detach_conf(client::client *);
|
||||
|
||||
extern struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *);
|
||||
extern char *show_iline_prefix(client::client *, struct ConfItem *, char *);
|
||||
extern void get_printable_conf(struct ConfItem *,
|
||||
struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *);
|
||||
char *show_iline_prefix(client::client *, struct ConfItem *, char *);
|
||||
void get_printable_conf(struct ConfItem *,
|
||||
char **, char **, const char **, char **, int *, char **);
|
||||
extern char *get_user_ban_reason(struct ConfItem *aconf);
|
||||
extern void get_printable_kline(client::client *, struct ConfItem *,
|
||||
char *get_user_ban_reason(struct ConfItem *aconf);
|
||||
void get_printable_kline(client::client *, struct ConfItem *,
|
||||
char **, char **, char **, char **);
|
||||
|
||||
int conf_yy_fatal_error(const char *);
|
||||
int conf_fgets(char *, int, FILE *);
|
||||
|
||||
extern int valid_wild_card(const char *, const char *);
|
||||
extern void add_temp_kline(struct ConfItem *);
|
||||
extern void add_temp_dline(struct ConfItem *);
|
||||
extern void report_temp_klines(client::client *);
|
||||
extern void show_temp_klines(client::client *, rb_dlink_list *);
|
||||
int valid_wild_card(const char *, const char *);
|
||||
void add_temp_kline(struct ConfItem *);
|
||||
void add_temp_dline(struct ConfItem *);
|
||||
void report_temp_klines(client::client *);
|
||||
void show_temp_klines(client::client *, rb_dlink_list *);
|
||||
|
||||
extern bool rehash(bool);
|
||||
extern void rehash_bans(void);
|
||||
bool rehash(bool);
|
||||
void rehash_bans(void);
|
||||
|
||||
extern int conf_add_server(struct ConfItem *, int);
|
||||
extern void conf_add_class_to_conf(struct ConfItem *);
|
||||
extern void conf_add_me(struct ConfItem *);
|
||||
extern void conf_add_class(struct ConfItem *, int);
|
||||
extern void conf_add_d_conf(struct ConfItem *);
|
||||
extern void flush_expired_ips(void *);
|
||||
int conf_add_server(struct ConfItem *, int);
|
||||
void conf_add_class_to_conf(struct ConfItem *);
|
||||
void conf_add_me(struct ConfItem *);
|
||||
void conf_add_class(struct ConfItem *, int);
|
||||
void conf_add_d_conf(struct ConfItem *);
|
||||
void flush_expired_ips(void *);
|
||||
|
||||
extern char *get_oper_name(client::client *client_p);
|
||||
|
||||
extern unsigned long cidr_to_bitmask[];
|
||||
|
||||
extern char conffilebuf[BUFSIZE + 1];
|
||||
extern int lineno;
|
||||
|
||||
void yyerror(const char *);
|
||||
char *get_oper_name(client::client *client_p);
|
||||
|
||||
} // namespace conf
|
||||
} // namespace ircd
|
||||
|
||||
inline
|
||||
void yyerror(const char *const c)
|
||||
{
|
||||
ircd::yyerror(c);
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#define NOT_AUTHORISED (-1)
|
||||
#define I_SOCKET_ERROR (-2)
|
||||
#define I_LINE_FULL (-3)
|
||||
#define BANNED_CLIENT (-4)
|
||||
#define TOO_MANY_LOCAL (-6)
|
||||
#define TOO_MANY_GLOBAL (-7)
|
||||
#define TOO_MANY_IDENT (-8)
|
|
@ -113,7 +113,7 @@ void restart(const char *) __attribute__((noreturn));
|
|||
void ircd_shutdown() __attribute__((noreturn));
|
||||
void server_reboot(void) __attribute__((noreturn));
|
||||
|
||||
void init(boost::asio::io_service &ios);
|
||||
void init(boost::asio::io_service &ios, const std::string &newconf_path);
|
||||
|
||||
} // namespace ircd
|
||||
#endif // __cplusplus
|
||||
|
|
|
@ -1,82 +1,50 @@
|
|||
/* This code is in the public domain.
|
||||
/*
|
||||
* Copyright (C) 2016 Charybdis Development Team
|
||||
* Copyright (C) 2016 Jason Volk <jason@zemos.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_NEWCONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ircd {
|
||||
namespace ircd {
|
||||
namespace conf {
|
||||
namespace newconf {
|
||||
|
||||
struct ConfEntry
|
||||
{
|
||||
const char *cf_name;
|
||||
int cf_type;
|
||||
void (*cf_func) (void *);
|
||||
int cf_len;
|
||||
void *cf_arg;
|
||||
};
|
||||
using key = std::string; // before the equals sign in an item
|
||||
using val = std::vector<std::string>; // Either one or more elems after '='
|
||||
using item = std::pair<key, val>; // Pairing of key/vals
|
||||
using block = std::pair<key, std::vector<item>>; // key is optional "label" { items };
|
||||
using topconf = std::multimap<key, block>; // key is type of block i.e admin { ... };
|
||||
|
||||
struct TopConf
|
||||
{
|
||||
const char *tc_name;
|
||||
int (*tc_sfunc) (struct TopConf *);
|
||||
int (*tc_efunc) (struct TopConf *);
|
||||
rb_dlink_list tc_items;
|
||||
struct ConfEntry *tc_entries;
|
||||
};
|
||||
|
||||
|
||||
#define CF_QSTRING 0x01 /* quoted string */
|
||||
#define CF_INT 0x02
|
||||
#define CF_STRING 0x03 /* unquoted string */
|
||||
#define CF_TIME 0x04
|
||||
#define CF_YESNO 0x05
|
||||
|
||||
#define CF_MTYPE 0xFF /* mask for type */
|
||||
|
||||
/* CF_FLIST is used to allow specifying that an option accepts a list of (type)
|
||||
* values. conf_parm_t.type will never actually have another type & CF_FLIST;
|
||||
* it's only used as a true flag in newconf.c (which only consumes conf_parm_t
|
||||
* structures and doesn't create them itself).
|
||||
/* Notes:
|
||||
* Some topconf entries are not blocks, but just key/values like "loadmodule." For this, the
|
||||
* topconf multimap contains keys of "loadmodule," and a block entry containing an empty key,
|
||||
* a vector of one item, with the item key also being "loadmodule" and the value being the
|
||||
* module to load.
|
||||
*/
|
||||
#define CF_FLIST 0x0100 /* flag for list */
|
||||
#define CF_MFLAG 0xFF00 /* mask for flags */
|
||||
|
||||
/* conf_parm_t.type must be either one type OR one flag. this is pretty easy to
|
||||
* enforce because lists always contain nested conf_parm_t structures whose
|
||||
* .type is the real type, so it doesn't need to be stored in the top-level one
|
||||
* anyway.
|
||||
*/
|
||||
typedef struct conf_parm_t_stru
|
||||
{
|
||||
struct conf_parm_t_stru *next;
|
||||
int type;
|
||||
union
|
||||
{
|
||||
char *string;
|
||||
int number;
|
||||
struct conf_parm_t_stru *list;
|
||||
}
|
||||
v;
|
||||
}
|
||||
conf_parm_t;
|
||||
|
||||
int read_config(char *);
|
||||
int conf_start_block(char *, char *);
|
||||
int conf_end_block(struct TopConf *);
|
||||
int conf_call_set(struct TopConf *, char *, conf_parm_t *);
|
||||
void conf_report_error(const char *, ...);
|
||||
void conf_report_warning(const char *, ...);
|
||||
void newconf_init(void);
|
||||
int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *));
|
||||
int remove_conf_item(const char *topconf, const char *name);
|
||||
int add_top_conf(const char *name, int (*sfunc) (struct TopConf *), int (*efunc) (struct TopConf *), struct ConfEntry *items);
|
||||
int remove_top_conf(const char *name);
|
||||
struct TopConf *find_top_conf(const char *name);
|
||||
struct ConfEntry *find_conf_item(const struct TopConf *top, const char *name);
|
||||
|
||||
extern struct TopConf *conf_cur_block;
|
||||
extern char *current_file;
|
||||
topconf parse(const std::string &str);
|
||||
topconf parse(std::ifstream &file);
|
||||
topconf parse_file(const std::string &path);
|
||||
|
||||
} // namespace newconf
|
||||
} // namespace conf
|
||||
} // namespace ircd
|
||||
#endif // __cplusplus
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_S_NEWCONF_H
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
#include <openssl/rsa.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ircd {
|
||||
|
||||
|
|
|
@ -89,6 +89,9 @@ namespace ircd
|
|||
#include "chmode.h"
|
||||
#include "channel.h"
|
||||
|
||||
#include "newconf.h"
|
||||
#include "conf.h"
|
||||
|
||||
#include "authproc.h"
|
||||
#include "bandbi.h"
|
||||
#include "capability.h"
|
||||
|
@ -103,14 +106,12 @@ namespace ircd
|
|||
#include "info.h"
|
||||
#include "modules.h"
|
||||
#include "monitor.h"
|
||||
#include "newconf.h"
|
||||
#include "operhash.h"
|
||||
#include "packet.h"
|
||||
#include "parse.h"
|
||||
#include "privilege.h"
|
||||
#include "ratelimit.h"
|
||||
#include "reject.h"
|
||||
#include "s_conf.h"
|
||||
#include "send.h"
|
||||
#include "s_newconf.h"
|
||||
#include "s_serv.h"
|
||||
|
|
100
ircd/Makefile.am
100
ircd/Makefile.am
|
@ -27,55 +27,57 @@ libircd_la_LIBADD = \
|
|||
-lrb \
|
||||
@BOOST_LIBS@
|
||||
|
||||
libircd_la_SOURCES = \
|
||||
authproc.cc \
|
||||
bandbi.cc \
|
||||
cache.cc \
|
||||
cache_serv.cc \
|
||||
capability.cc \
|
||||
channel.cc \
|
||||
chmode.cc \
|
||||
class.cc \
|
||||
client.cc \
|
||||
client_mode.cc \
|
||||
dns.cc \
|
||||
exception.cc \
|
||||
extban.cc \
|
||||
fs.cc \
|
||||
getopt.cc \
|
||||
hash.cc \
|
||||
hook.cc \
|
||||
mask.cc \
|
||||
info.cc \
|
||||
ircd.cc \
|
||||
listener.cc \
|
||||
logger.cc \
|
||||
match.cc \
|
||||
modules.cc \
|
||||
monitor.cc \
|
||||
msgbuf.cc \
|
||||
newconf.cc \
|
||||
operhash.cc \
|
||||
packet.cc \
|
||||
parse.cc \
|
||||
privilege.cc \
|
||||
ratelimit.cc \
|
||||
reject.cc \
|
||||
restart.cc \
|
||||
rfc1459.cc \
|
||||
s_conf.cc \
|
||||
s_newconf.cc \
|
||||
s_serv.cc \
|
||||
s_user.cc \
|
||||
send.cc \
|
||||
snomask.cc \
|
||||
sslproc.cc \
|
||||
stringops.cc \
|
||||
substitution.cc \
|
||||
supported.cc \
|
||||
tgchange.cc \
|
||||
whowas.cc \
|
||||
wsproc.cc
|
||||
libircd_la_SOURCES = \
|
||||
ircd.cc \
|
||||
exception.cc \
|
||||
rfc1459.cc \
|
||||
stringops.cc \
|
||||
match.cc \
|
||||
getopt.cc \
|
||||
logger.cc \
|
||||
fs.cc \
|
||||
conf.cc \
|
||||
newconf.cc \
|
||||
modules.cc \
|
||||
snomask.cc \
|
||||
info.cc
|
||||
|
||||
#authproc.cc \
|
||||
#bandbi.cc \
|
||||
#cache.cc \
|
||||
#cache_serv.cc \
|
||||
#capability.cc \
|
||||
#channel.cc \
|
||||
#client.cc \
|
||||
#client_mode.cc \
|
||||
#chmode.cc \
|
||||
#class.cc \
|
||||
#dns.cc \
|
||||
#extban.cc \
|
||||
#hash.cc \
|
||||
#hook.cc \
|
||||
#mask.cc \
|
||||
#ircd.cc \
|
||||
#listener.cc \
|
||||
#monitor.cc \
|
||||
#msgbuf.cc \
|
||||
#operhash.cc \
|
||||
#packet.cc \
|
||||
#parse.cc \
|
||||
#privilege.cc \
|
||||
#ratelimit.cc \
|
||||
#reject.cc \
|
||||
#restart.cc \
|
||||
#s_conf.cc \
|
||||
#s_newconf.cc \
|
||||
#s_serv.cc \
|
||||
#s_user.cc \
|
||||
#sslproc.cc \
|
||||
#substitution.cc \
|
||||
#supported.cc \
|
||||
#tgchange.cc \
|
||||
#whowas.cc \
|
||||
#wsproc.cc
|
||||
|
||||
install-data-local:
|
||||
test -d $(prefix)/@logdir@ || mkdir -p $(prefix)/@logdir@
|
||||
|
|
2865
ircd/conf.cc
Normal file
2865
ircd/conf.cc
Normal file
File diff suppressed because it is too large
Load diff
29
ircd/ircd.cc
29
ircd/ircd.cc
|
@ -30,20 +30,13 @@ namespace ircd {
|
|||
/* /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 */
|
||||
struct admin_info AdminInfo;
|
||||
|
||||
struct Counter Count;
|
||||
struct ServerStatistics ServerStats;
|
||||
|
||||
struct ev_entry *check_splitmode_ev;
|
||||
|
||||
int maxconnections;
|
||||
client::client me; /* That's me */
|
||||
//client::client me; /* That's me */
|
||||
struct LocalUser meLocalUser; /* That's also part of me */
|
||||
|
||||
rb_dlink_list global_client_list;
|
||||
|
@ -77,12 +70,10 @@ int split_users;
|
|||
int split_servers;
|
||||
int eob_count;
|
||||
|
||||
/*
|
||||
static void
|
||||
check_rehash(void *unused)
|
||||
{
|
||||
/*
|
||||
* Check to see whether we have to rehash the configuration ..
|
||||
*/
|
||||
if(dorehash)
|
||||
{
|
||||
rehash(true);
|
||||
|
@ -103,6 +94,7 @@ check_rehash(void *unused)
|
|||
doremotd = false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* initalialize_global_set_options
|
||||
|
@ -114,8 +106,9 @@ check_rehash(void *unused)
|
|||
static void
|
||||
initialize_global_set_options(void)
|
||||
{
|
||||
/*
|
||||
memset(&GlobalSetOptions, 0, sizeof(GlobalSetOptions));
|
||||
/* memset( &ConfigFileEntry, 0, sizeof(ConfigFileEntry)); */
|
||||
// memset( &ConfigFileEntry, 0, sizeof(ConfigFileEntry));
|
||||
|
||||
GlobalSetOptions.maxclients = ServerInfo.default_max_clients;
|
||||
|
||||
|
@ -147,10 +140,7 @@ initialize_global_set_options(void)
|
|||
rb_strlcpy(GlobalSetOptions.adminstring,
|
||||
ConfigFileEntry.default_adminstring,
|
||||
sizeof(GlobalSetOptions.adminstring));
|
||||
|
||||
/* memset( &ConfigChannel, 0, sizeof(ConfigChannel)); */
|
||||
|
||||
/* End of global set options */
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,7 +162,8 @@ static void init_sys();
|
|||
* An exception will be thrown on error.
|
||||
*/
|
||||
void
|
||||
ircd::init(boost::asio::io_service &io_service)
|
||||
ircd::init(boost::asio::io_service &io_service,
|
||||
const std::string &configfile)
|
||||
{
|
||||
ircd::ios = &io_service;
|
||||
|
||||
|
@ -183,10 +174,12 @@ ircd::init(boost::asio::io_service &io_service)
|
|||
log::init();
|
||||
log::mark("log started");
|
||||
|
||||
conf::newconf::parse_file(configfile);
|
||||
|
||||
// initialise operhash fairly early.
|
||||
//init_operhash();
|
||||
|
||||
me.localClient = &meLocalUser;
|
||||
//me.localClient = &meLocalUser;
|
||||
//rb_dlinkAddTail(&me, &me.node, &global_client_list);
|
||||
|
||||
//init_builtin_capabs();
|
||||
|
|
|
@ -52,6 +52,7 @@ std::array<bool, num_of<facility>()> console_err;
|
|||
std::array<const char *, num_of<facility>()> fname;
|
||||
std::array<std::ofstream, num_of<facility>()> file;
|
||||
|
||||
/*
|
||||
ConfEntry conf_log_table[] =
|
||||
{
|
||||
{ "file_critical", CF_QSTRING, NULL, PATH_MAX, &fname[CRITICAL] },
|
||||
|
@ -61,6 +62,7 @@ ConfEntry conf_log_table[] =
|
|||
{ "file_info", CF_QSTRING, NULL, PATH_MAX, &fname[INFO] },
|
||||
{ "file_debug", CF_QSTRING, NULL, PATH_MAX, &fname[DEBUG] },
|
||||
};
|
||||
*/
|
||||
|
||||
static void open(const facility &fac);
|
||||
static void prefix(const facility &fac, const char *const &date);
|
||||
|
@ -384,12 +386,13 @@ log::vlog(const facility &fac,
|
|||
{
|
||||
char buf[1024];
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
|
||||
/*
|
||||
if(snomask)
|
||||
sendto_realops_snomask(snomask, L_NETWIDE, "%s %s :%s",
|
||||
reflect(fac),
|
||||
name.size()? name.c_str() : "*",
|
||||
buf);
|
||||
*/
|
||||
|
||||
slog(fac, [&buf, &name]
|
||||
(std::ostream &s)
|
||||
|
|
2995
ircd/newconf.cc
2995
ircd/newconf.cc
File diff suppressed because it is too large
Load diff
|
@ -22,9 +22,6 @@
|
|||
* USA
|
||||
*/
|
||||
|
||||
int yyparse(void);
|
||||
extern char yy_linebuf[16384]; /* defined in ircd_lexer.l */
|
||||
|
||||
namespace ircd {
|
||||
|
||||
struct config_server_hide ConfigServerHide;
|
||||
|
@ -787,10 +784,10 @@ set_default_conf(void)
|
|||
static void
|
||||
read_conf(void)
|
||||
{
|
||||
lineno = 0;
|
||||
//lineno = 0;
|
||||
|
||||
set_default_conf(); /* Set default values prior to conf parsing */
|
||||
yyparse(); /* Load the values from the conf */
|
||||
//yyparse(); /* Load the values from the conf */
|
||||
validate_conf(); /* Check to make sure some values are still okay. */
|
||||
/* Some global values are also loaded here. */
|
||||
check_class(); /* Make sure classes are valid */
|
||||
|
@ -1333,7 +1330,7 @@ read_conf_files(bool cold)
|
|||
|
||||
|
||||
*/
|
||||
rb_strlcpy(conffilebuf, filename, sizeof(conffilebuf));
|
||||
//rb_strlcpy(conffilebuf, filename, sizeof(conffilebuf));
|
||||
|
||||
if((conf_fbfile_in = fopen(filename, "r")) == NULL)
|
||||
{
|
||||
|
@ -1500,9 +1497,11 @@ conf_add_class_to_conf(struct ConfItem *aconf)
|
|||
{
|
||||
if(aconf->status == CONF_CLIENT)
|
||||
{
|
||||
/*
|
||||
conf_report_error(
|
||||
"Using default class for missing class \"%s\" in auth{} for %s@%s",
|
||||
aconf->className, aconf->user, aconf->host);
|
||||
*/
|
||||
}
|
||||
|
||||
rb_free(aconf->className);
|
||||
|
@ -1579,12 +1578,12 @@ yyerror(const char *msg)
|
|||
{
|
||||
char newlinebuf[BUFSIZE];
|
||||
|
||||
/*
|
||||
strip_tabs(newlinebuf, yy_linebuf, strlen(yy_linebuf));
|
||||
|
||||
ierror("\"%s\", line %d: %s at '%s'", conffilebuf, lineno + 1, msg, newlinebuf);
|
||||
sendto_realops_snomask(sno::GENERAL, L_ALL, "\"%s\", line %d: %s at '%s'",
|
||||
conffilebuf, lineno + 1, msg, newlinebuf);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -436,8 +436,10 @@ add_server_conf(struct server_conf *server_p)
|
|||
|
||||
if(server_p->_class == default_class)
|
||||
{
|
||||
/*
|
||||
conf_report_error("Warning connect::class invalid for %s",
|
||||
server_p->name);
|
||||
*/
|
||||
|
||||
rb_free(server_p->class_name);
|
||||
server_p->class_name = rb_strdup("default");
|
||||
|
|
Loading…
Reference in a new issue