2007-01-25 07:40:21 +01:00
|
|
|
/* This code is in the public domain.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdinc.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBCRYPTO
|
|
|
|
#include <openssl/pem.h>
|
|
|
|
#include <openssl/rsa.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "newconf.h"
|
|
|
|
#include "ircd_defs.h"
|
2008-04-03 04:52:01 +02:00
|
|
|
#include "logger.h"
|
2007-01-25 07:40:21 +01:00
|
|
|
#include "s_conf.h"
|
|
|
|
#include "s_user.h"
|
|
|
|
#include "s_newconf.h"
|
|
|
|
#include "send.h"
|
|
|
|
#include "setup.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "listener.h"
|
|
|
|
#include "hostmask.h"
|
|
|
|
#include "s_serv.h"
|
|
|
|
#include "hash.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "ircd.h"
|
|
|
|
#include "snomask.h"
|
2008-04-06 16:52:42 +02:00
|
|
|
#include "sslproc.h"
|
2016-04-02 09:56:03 +02:00
|
|
|
#include "wsproc.h"
|
2008-08-17 14:10:23 +02:00
|
|
|
#include "privilege.h"
|
2015-12-11 22:36:53 +01:00
|
|
|
#include "chmode.h"
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
#define CF_TYPE(x) ((x) & CF_MTYPE)
|
|
|
|
|
2012-03-17 16:00:39 +01:00
|
|
|
static int yy_defer_accept = 1;
|
2016-04-02 09:56:03 +02:00
|
|
|
static int yy_wsock = 0;
|
2012-03-17 16:00:39 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
struct TopConf *conf_cur_block;
|
2014-03-03 00:31:13 +01:00
|
|
|
static char *conf_cur_block_name = NULL;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
static rb_dlink_list conf_items;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
static struct ConfItem *yy_aconf = NULL;
|
|
|
|
|
|
|
|
static struct Class *yy_class = NULL;
|
|
|
|
|
|
|
|
static struct remote_conf *yy_shared = NULL;
|
|
|
|
static struct server_conf *yy_server = NULL;
|
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
static rb_dlink_list yy_aconf_list;
|
|
|
|
static rb_dlink_list yy_oper_list;
|
|
|
|
static rb_dlink_list yy_shared_list;
|
|
|
|
static rb_dlink_list yy_cluster_list;
|
2007-01-25 07:40:21 +01:00
|
|
|
static struct oper_conf *yy_oper = NULL;
|
|
|
|
|
|
|
|
static struct alias_entry *yy_alias = NULL;
|
|
|
|
|
|
|
|
static char *yy_blacklist_host = NULL;
|
|
|
|
static char *yy_blacklist_reason = NULL;
|
2016-03-28 09:11:16 +02:00
|
|
|
static uint8_t yy_blacklist_iptype = 0;
|
2016-03-28 23:47:51 +02:00
|
|
|
static rb_dlink_list yy_blacklist_filters = { NULL, NULL, 0 };
|
2011-02-27 22:38:05 +01:00
|
|
|
|
2016-04-01 11:11:04 +02:00
|
|
|
static char *yy_opm_address_ipv4 = NULL;
|
|
|
|
static char *yy_opm_address_ipv6 = NULL;
|
|
|
|
static uint16_t yy_opm_port_ipv4 = 0;
|
|
|
|
static uint16_t yy_opm_port_ipv6 = 0;
|
2016-04-02 10:33:12 +02:00
|
|
|
static int yy_opm_timeout = 0;
|
2016-04-02 09:29:48 +02:00
|
|
|
static rb_dlink_list yy_opm_scanner_list;
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2008-08-17 14:10:23 +02:00
|
|
|
static char *yy_privset_extends = NULL;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
static const char *
|
|
|
|
conf_strtype(int type)
|
|
|
|
{
|
2014-02-28 08:02:49 +01:00
|
|
|
switch (CF_TYPE(type))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
case CF_INT:
|
|
|
|
return "integer value";
|
|
|
|
case CF_STRING:
|
|
|
|
return "unquoted string";
|
|
|
|
case CF_YESNO:
|
|
|
|
return "yes/no value";
|
|
|
|
case CF_QSTRING:
|
|
|
|
return "quoted string";
|
|
|
|
case CF_TIME:
|
|
|
|
return "time/size value";
|
|
|
|
default:
|
|
|
|
return "unknown type";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2014-03-03 00:34:32 +01:00
|
|
|
add_top_conf(const char *name, int (*sfunc) (struct TopConf *),
|
2007-01-25 07:40:21 +01:00
|
|
|
int (*efunc) (struct TopConf *), struct ConfEntry *items)
|
|
|
|
{
|
|
|
|
struct TopConf *tc;
|
|
|
|
|
2008-04-02 01:07:29 +02:00
|
|
|
tc = rb_malloc(sizeof(struct TopConf));
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2007-12-13 00:14:02 +01:00
|
|
|
tc->tc_name = name;
|
2007-01-25 07:40:21 +01:00
|
|
|
tc->tc_sfunc = sfunc;
|
|
|
|
tc->tc_efunc = efunc;
|
|
|
|
tc->tc_entries = items;
|
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAddAlloc(tc, &conf_items);
|
2007-01-25 07:40:21 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct TopConf *
|
|
|
|
find_top_conf(const char *name)
|
|
|
|
{
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlink_node *d;
|
2007-01-25 07:40:21 +01:00
|
|
|
struct TopConf *tc;
|
|
|
|
|
2008-04-01 22:43:10 +02:00
|
|
|
RB_DLINK_FOREACH(d, conf_items.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
tc = d->data;
|
2016-04-05 12:39:59 +02:00
|
|
|
if(rb_strcasecmp(tc->tc_name, name) == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
return tc;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ConfEntry *
|
|
|
|
find_conf_item(const struct TopConf *top, const char *name)
|
|
|
|
{
|
|
|
|
struct ConfEntry *cf;
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlink_node *d;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(top->tc_entries)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; top->tc_entries[i].cf_type; i++)
|
|
|
|
{
|
|
|
|
cf = &top->tc_entries[i];
|
|
|
|
|
2016-04-05 12:39:59 +02:00
|
|
|
if(!rb_strcasecmp(cf->cf_name, name))
|
2007-01-25 07:40:21 +01:00
|
|
|
return cf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-01 22:43:10 +02:00
|
|
|
RB_DLINK_FOREACH(d, top->tc_items.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
cf = d->data;
|
2016-04-05 12:39:59 +02:00
|
|
|
if(rb_strcasecmp(cf->cf_name, name) == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
return cf;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
remove_top_conf(char *name)
|
|
|
|
{
|
|
|
|
struct TopConf *tc;
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlink_node *ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if((tc = find_top_conf(name)) == NULL)
|
|
|
|
return -1;
|
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
if((ptr = rb_dlinkFind(tc, &conf_items)) == NULL)
|
2007-01-25 07:40:21 +01:00
|
|
|
return -1;
|
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkDestroy(ptr, &conf_items);
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(tc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_serverinfo_name(void *data)
|
|
|
|
{
|
|
|
|
if(ServerInfo.name == NULL)
|
|
|
|
{
|
|
|
|
const char *s;
|
|
|
|
int dots = 0;
|
|
|
|
|
|
|
|
for(s = data; *s != '\0'; s++)
|
|
|
|
{
|
|
|
|
if(!IsServChar(*s))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring serverinfo::name "
|
|
|
|
"-- bogus servername.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if(*s == '.')
|
|
|
|
++dots;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!dots)
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring serverinfo::name -- must contain '.'");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
s = data;
|
|
|
|
|
|
|
|
if(IsDigit(*s))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the ircd will exit() in main() if we dont set one */
|
|
|
|
if(strlen(s) <= HOSTLEN)
|
2008-04-02 01:26:34 +02:00
|
|
|
ServerInfo.name = rb_strdup((char *) data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_serverinfo_sid(void *data)
|
|
|
|
{
|
|
|
|
char *sid = data;
|
|
|
|
|
|
|
|
if(ServerInfo.sid[0] == '\0')
|
|
|
|
{
|
|
|
|
if(!IsDigit(sid[0]) || !IsIdChar(sid[1]) ||
|
|
|
|
!IsIdChar(sid[2]) || sid[3] != '\0')
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring serverinfo::sid "
|
|
|
|
"-- bogus sid.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(ServerInfo.sid, sid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_serverinfo_network_name(void *data)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if((p = strchr((char *) data, ' ')))
|
|
|
|
*p = '\0';
|
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(ServerInfo.network_name);
|
2008-04-02 01:26:34 +02:00
|
|
|
ServerInfo.network_name = rb_strdup((char *) data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_serverinfo_vhost(void *data)
|
|
|
|
{
|
2008-04-20 06:55:41 +02:00
|
|
|
if(rb_inet_pton(AF_INET, (char *) data, &ServerInfo.ip.sin_addr) <= 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-03-14 23:38:04 +01:00
|
|
|
conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data);
|
2007-01-25 07:40:21 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ServerInfo.ip.sin_family = AF_INET;
|
|
|
|
ServerInfo.specific_ipv4_vhost = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_serverinfo_vhost6(void *data)
|
|
|
|
{
|
2008-04-05 18:57:30 +02:00
|
|
|
#ifdef RB_IPV6
|
2008-04-20 06:55:41 +02:00
|
|
|
if(rb_inet_pton(AF_INET6, (char *) data, &ServerInfo.ip6.sin6_addr) <= 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-03-14 23:38:04 +01:00
|
|
|
conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data);
|
2007-01-25 07:40:21 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ServerInfo.specific_ipv6_vhost = 1;
|
|
|
|
ServerInfo.ip6.sin6_family = AF_INET6;
|
|
|
|
#else
|
|
|
|
conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-11-29 23:10:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_serverinfo_nicklen(void *data)
|
|
|
|
{
|
2011-11-29 23:16:38 +01:00
|
|
|
ConfigFileEntry.nicklen = (*(unsigned int *) data) + 1;
|
2011-11-29 23:10:21 +01:00
|
|
|
|
|
|
|
if (ConfigFileEntry.nicklen > NICKLEN)
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)",
|
2011-11-29 23:41:18 +01:00
|
|
|
ConfigFileEntry.nicklen - 1, NICKLEN - 1);
|
2011-11-29 23:10:21 +01:00
|
|
|
ConfigFileEntry.nicklen = NICKLEN;
|
|
|
|
}
|
2011-11-29 23:41:18 +01:00
|
|
|
else if (ConfigFileEntry.nicklen < 9 + 1)
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9",
|
2015-03-01 16:12:12 +01:00
|
|
|
ConfigFileEntry.nicklen - 1);
|
2011-11-29 23:41:18 +01:00
|
|
|
ConfigFileEntry.nicklen = 9 + 1;
|
|
|
|
}
|
2011-11-29 23:10:21 +01:00
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_modules_module(void *data)
|
|
|
|
{
|
|
|
|
char *m_bn;
|
|
|
|
|
2008-12-03 00:59:13 +01:00
|
|
|
m_bn = rb_basename((char *) data);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2014-02-23 22:20:43 +01:00
|
|
|
if(findmodule_byname(m_bn) == -1)
|
2016-04-03 08:51:26 +02:00
|
|
|
load_one_module((char *) data, MAPI_ORIGIN_EXTENSION, false);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(m_bn);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_modules_path(void *data)
|
|
|
|
{
|
|
|
|
mod_add_path((char *) data);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct mode_table
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
int mode;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
static struct mode_table umode_table[] = {
|
|
|
|
{"callerid", UMODE_CALLERID },
|
|
|
|
{"deaf", UMODE_DEAF },
|
|
|
|
{"invisible", UMODE_INVISIBLE },
|
|
|
|
{"locops", UMODE_LOCOPS },
|
|
|
|
{"noforward", UMODE_NOFORWARD },
|
|
|
|
{"regonlymsg", UMODE_REGONLYMSG},
|
|
|
|
{"servnotice", UMODE_SERVNOTICE},
|
|
|
|
{"wallop", UMODE_WALLOP },
|
|
|
|
{"operwall", UMODE_OPERWALL },
|
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
2008-01-05 22:51:09 +01:00
|
|
|
static struct mode_table oper_table[] = {
|
2007-01-25 07:40:21 +01:00
|
|
|
{"encrypted", OPER_ENCRYPTED },
|
2008-09-07 01:18:58 +02:00
|
|
|
{"need_ssl", OPER_NEEDSSL },
|
2007-01-25 07:40:21 +01:00
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mode_table auth_table[] = {
|
2016-04-02 09:42:11 +02:00
|
|
|
{"encrypted", CONF_FLAGS_ENCRYPTED },
|
|
|
|
{"spoof_notice", CONF_FLAGS_SPOOF_NOTICE },
|
|
|
|
{"exceed_limit", CONF_FLAGS_NOLIMIT },
|
|
|
|
{"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL },
|
|
|
|
{"proxy_exempt", CONF_FLAGS_EXEMPTPROXY },
|
|
|
|
{"kline_exempt", CONF_FLAGS_EXEMPTKLINE },
|
|
|
|
{"flood_exempt", CONF_FLAGS_EXEMPTFLOOD },
|
|
|
|
{"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT },
|
|
|
|
{"shide_exempt", CONF_FLAGS_EXEMPTSHIDE },
|
|
|
|
{"jupe_exempt", CONF_FLAGS_EXEMPTJUPE },
|
|
|
|
{"resv_exempt", CONF_FLAGS_EXEMPTRESV },
|
|
|
|
{"no_tilde", CONF_FLAGS_NO_TILDE },
|
|
|
|
{"need_ident", CONF_FLAGS_NEED_IDENTD },
|
|
|
|
{"have_ident", CONF_FLAGS_NEED_IDENTD },
|
|
|
|
{"need_ssl", CONF_FLAGS_NEED_SSL },
|
|
|
|
{"need_sasl", CONF_FLAGS_NEED_SASL },
|
|
|
|
{"extend_chans", CONF_FLAGS_EXTEND_CHANS },
|
2007-01-25 07:40:21 +01:00
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mode_table connect_table[] = {
|
|
|
|
{ "autoconn", SERVER_AUTOCONN },
|
|
|
|
{ "compressed", SERVER_COMPRESSED },
|
|
|
|
{ "encrypted", SERVER_ENCRYPTED },
|
|
|
|
{ "topicburst", SERVER_TB },
|
2008-04-06 16:52:42 +02:00
|
|
|
{ "ssl", SERVER_SSL },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ NULL, 0 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mode_table cluster_table[] = {
|
|
|
|
{ "kline", SHARED_PKLINE },
|
|
|
|
{ "tkline", SHARED_TKLINE },
|
|
|
|
{ "unkline", SHARED_UNKLINE },
|
|
|
|
{ "locops", SHARED_LOCOPS },
|
|
|
|
{ "xline", SHARED_PXLINE },
|
|
|
|
{ "txline", SHARED_TXLINE },
|
|
|
|
{ "unxline", SHARED_UNXLINE },
|
|
|
|
{ "resv", SHARED_PRESV },
|
|
|
|
{ "tresv", SHARED_TRESV },
|
|
|
|
{ "unresv", SHARED_UNRESV },
|
|
|
|
{ "all", CLUSTER_ALL },
|
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct mode_table shared_table[] =
|
|
|
|
{
|
|
|
|
{ "kline", SHARED_PKLINE|SHARED_TKLINE },
|
|
|
|
{ "xline", SHARED_PXLINE|SHARED_TXLINE },
|
|
|
|
{ "resv", SHARED_PRESV|SHARED_TRESV },
|
2016-04-02 10:33:12 +02:00
|
|
|
{ "dline", SHARED_PDLINE|SHARED_TDLINE },
|
|
|
|
{ "tdline", SHARED_TDLINE },
|
|
|
|
{ "pdline", SHARED_PDLINE },
|
2008-04-20 09:26:37 +02:00
|
|
|
{ "undline", SHARED_UNDLINE },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "tkline", SHARED_TKLINE },
|
|
|
|
{ "unkline", SHARED_UNKLINE },
|
|
|
|
{ "txline", SHARED_TXLINE },
|
|
|
|
{ "unxline", SHARED_UNXLINE },
|
|
|
|
{ "tresv", SHARED_TRESV },
|
|
|
|
{ "unresv", SHARED_UNRESV },
|
|
|
|
{ "locops", SHARED_LOCOPS },
|
|
|
|
{ "rehash", SHARED_REHASH },
|
2016-01-12 06:02:03 +01:00
|
|
|
{ "grant", SHARED_GRANT },
|
2016-01-12 07:04:54 +01:00
|
|
|
{ "die", SHARED_DIE },
|
2016-01-12 07:37:54 +01:00
|
|
|
{ "module", SHARED_MODULE },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "all", SHARED_ALL },
|
|
|
|
{ "none", 0 },
|
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
static int
|
|
|
|
find_umode(struct mode_table *tab, const char *name)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; tab[i].name; i++)
|
|
|
|
{
|
|
|
|
if(strcmp(tab[i].name, name) == 0)
|
|
|
|
return tab[i].mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_modes_from_table(int *modes, const char *whatis, struct mode_table *tab, conf_parm_t * args)
|
|
|
|
{
|
|
|
|
for (; args; args = args->next)
|
|
|
|
{
|
|
|
|
const char *umode;
|
|
|
|
int dir = 1;
|
|
|
|
int mode;
|
|
|
|
|
2014-02-28 08:02:49 +01:00
|
|
|
if(CF_TYPE(args->type) != CF_STRING)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
conf_report_error("Warning -- %s is not a string; ignoring.", whatis);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
umode = args->v.string;
|
|
|
|
|
|
|
|
if(*umode == '~')
|
|
|
|
{
|
|
|
|
dir = 0;
|
|
|
|
umode++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mode = find_umode(tab, umode);
|
|
|
|
|
|
|
|
if(mode == -1)
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- unknown %s %s.", whatis, args->v.string);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(mode)
|
|
|
|
{
|
|
|
|
if(dir)
|
|
|
|
*modes |= mode;
|
|
|
|
else
|
|
|
|
*modes &= ~mode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*modes = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-17 14:10:23 +02:00
|
|
|
static void
|
|
|
|
conf_set_privset_extends(void *data)
|
|
|
|
{
|
|
|
|
yy_privset_extends = rb_strdup((char *) data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_privset_privs(void *data)
|
|
|
|
{
|
|
|
|
char *privs = NULL;
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
|
|
|
|
for (; args; args = args->next)
|
|
|
|
{
|
|
|
|
if (privs == NULL)
|
|
|
|
privs = rb_strdup(args->v.string);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char *privs_old = privs;
|
|
|
|
|
|
|
|
privs = rb_malloc(strlen(privs_old) + 1 + strlen(args->v.string) + 1);
|
2008-08-17 14:46:18 +02:00
|
|
|
strcpy(privs, privs_old);
|
2008-08-17 14:10:23 +02:00
|
|
|
strcat(privs, " ");
|
|
|
|
strcat(privs, args->v.string);
|
|
|
|
|
|
|
|
rb_free(privs_old);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (privs)
|
|
|
|
{
|
|
|
|
if (yy_privset_extends)
|
|
|
|
{
|
|
|
|
struct PrivilegeSet *set = privilegeset_get(yy_privset_extends);
|
|
|
|
|
|
|
|
if (!set)
|
|
|
|
{
|
2008-08-17 15:08:23 +02:00
|
|
|
conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends, conf_cur_block_name);
|
2008-08-17 14:10:23 +02:00
|
|
|
|
2008-08-17 15:08:23 +02:00
|
|
|
set = privilegeset_get("default");
|
2008-08-17 14:10:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
privilegeset_extend(set, conf_cur_block_name != NULL ? conf_cur_block_name : "<unknown>", privs, 0);
|
|
|
|
|
|
|
|
rb_free(yy_privset_extends);
|
|
|
|
yy_privset_extends = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
privilegeset_set_new(conf_cur_block_name != NULL ? conf_cur_block_name : "<unknown>", privs, 0);
|
|
|
|
|
|
|
|
rb_free(privs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static int
|
|
|
|
conf_begin_oper(struct TopConf *tc)
|
|
|
|
{
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlink_node *ptr;
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_dlink_node *next_ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(yy_oper != NULL)
|
|
|
|
{
|
|
|
|
free_oper_conf(yy_oper);
|
|
|
|
yy_oper = NULL;
|
|
|
|
}
|
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_oper_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
free_oper_conf(ptr->data);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkDestroy(ptr, &yy_oper_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
yy_oper = make_oper_conf();
|
2008-09-09 21:51:26 +02:00
|
|
|
yy_oper->flags |= OPER_ENCRYPTED;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_end_oper(struct TopConf *tc)
|
|
|
|
{
|
|
|
|
struct oper_conf *yy_tmpoper;
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlink_node *ptr;
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_dlink_node *next_ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(conf_cur_block_name != NULL)
|
|
|
|
{
|
|
|
|
if(strlen(conf_cur_block_name) > OPERNICKLEN)
|
|
|
|
conf_cur_block_name[OPERNICKLEN] = '\0';
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_oper->name = rb_strdup(conf_cur_block_name);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(EmptyString(yy_oper->name))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring operator block -- missing name.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBCRYPTO
|
|
|
|
if(EmptyString(yy_oper->passwd) && EmptyString(yy_oper->rsa_pubkey_file))
|
|
|
|
#else
|
|
|
|
if(EmptyString(yy_oper->passwd))
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring operator block for %s -- missing password",
|
|
|
|
yy_oper->name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-18 00:55:12 +02:00
|
|
|
|
|
|
|
if (!yy_oper->privset)
|
|
|
|
yy_oper->privset = privilegeset_get("default");
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
/* now, yy_oper_list contains a stack of oper_conf's with just user
|
|
|
|
* and host in, yy_oper contains the rest of the information which
|
|
|
|
* we need to copy into each element in yy_oper_list
|
|
|
|
*/
|
2008-04-02 00:47:17 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_oper_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
yy_tmpoper = ptr->data;
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmpoper->name = rb_strdup(yy_oper->name);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/* could be an rsa key instead.. */
|
|
|
|
if(!EmptyString(yy_oper->passwd))
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmpoper->passwd = rb_strdup(yy_oper->passwd);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
yy_tmpoper->flags = yy_oper->flags;
|
|
|
|
yy_tmpoper->umodes = yy_oper->umodes;
|
|
|
|
yy_tmpoper->snomask = yy_oper->snomask;
|
2008-08-17 14:40:27 +02:00
|
|
|
yy_tmpoper->privset = yy_oper->privset;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBCRYPTO
|
|
|
|
if(yy_oper->rsa_pubkey_file)
|
|
|
|
{
|
|
|
|
BIO *file;
|
|
|
|
|
|
|
|
if((file = BIO_new_file(yy_oper->rsa_pubkey_file, "r")) == NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring operator block for %s -- "
|
|
|
|
"rsa_public_key_file cant be opened",
|
|
|
|
yy_tmpoper->name);
|
|
|
|
return 0;
|
|
|
|
}
|
2014-03-03 00:34:32 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
yy_tmpoper->rsa_pubkey =
|
|
|
|
(RSA *) PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
|
|
|
|
|
2007-12-13 00:20:06 +01:00
|
|
|
(void)BIO_set_close(file, BIO_CLOSE);
|
2007-01-25 07:40:21 +01:00
|
|
|
BIO_free(file);
|
|
|
|
|
|
|
|
if(yy_tmpoper->rsa_pubkey == NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring operator block for %s -- "
|
|
|
|
"rsa_public_key_file key invalid; check syntax",
|
|
|
|
yy_tmpoper->name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2011-01-23 22:12:32 +01:00
|
|
|
|
|
|
|
if(!EmptyString(yy_oper->certfp))
|
2011-01-25 00:39:07 +01:00
|
|
|
yy_tmpoper->certfp = rb_strdup(yy_oper->certfp);
|
2007-01-25 07:40:21 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* all is ok, put it on oper_conf_list */
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkMoveNode(ptr, &yy_oper_list, &oper_conf_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
free_oper_conf(yy_oper);
|
|
|
|
yy_oper = NULL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_oper_flags(void *data)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
|
2008-01-05 22:51:09 +01:00
|
|
|
set_modes_from_table(&yy_oper->flags, "flag", oper_table, args);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2010-02-17 13:41:41 +01:00
|
|
|
static void
|
|
|
|
conf_set_oper_fingerprint(void *data)
|
|
|
|
{
|
2011-01-25 00:39:07 +01:00
|
|
|
if (yy_oper->certfp)
|
|
|
|
rb_free(yy_oper->certfp);
|
2010-02-17 13:41:41 +01:00
|
|
|
yy_oper->certfp = rb_strdup((char *) data);
|
|
|
|
}
|
|
|
|
|
2008-08-17 14:40:27 +02:00
|
|
|
static void
|
|
|
|
conf_set_oper_privset(void *data)
|
|
|
|
{
|
|
|
|
yy_oper->privset = privilegeset_get((char *) data);
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_oper_user(void *data)
|
|
|
|
{
|
|
|
|
struct oper_conf *yy_tmpoper;
|
|
|
|
char *p;
|
|
|
|
char *host = (char *) data;
|
|
|
|
|
|
|
|
yy_tmpoper = make_oper_conf();
|
|
|
|
|
|
|
|
if((p = strchr(host, '@')))
|
|
|
|
{
|
|
|
|
*p++ = '\0';
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmpoper->username = rb_strdup(host);
|
|
|
|
yy_tmpoper->host = rb_strdup(p);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmpoper->username = rb_strdup("*");
|
|
|
|
yy_tmpoper->host = rb_strdup(host);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(EmptyString(yy_tmpoper->username) || EmptyString(yy_tmpoper->host))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring user -- missing username/host");
|
|
|
|
free_oper_conf(yy_tmpoper);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAddAlloc(yy_tmpoper, &yy_oper_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_oper_password(void *data)
|
|
|
|
{
|
|
|
|
if(yy_oper->passwd)
|
|
|
|
{
|
|
|
|
memset(yy_oper->passwd, 0, strlen(yy_oper->passwd));
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_oper->passwd);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_oper->passwd = rb_strdup((char *) data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_oper_rsa_public_key_file(void *data)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_LIBCRYPTO
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_oper->rsa_pubkey_file);
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_oper->rsa_pubkey_file = rb_strdup((char *) data);
|
2007-01-25 07:40:21 +01:00
|
|
|
#else
|
|
|
|
conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_oper_umodes(void *data)
|
|
|
|
{
|
|
|
|
set_modes_from_table(&yy_oper->umodes, "umode", umode_table, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_oper_snomask(void *data)
|
|
|
|
{
|
|
|
|
yy_oper->snomask = parse_snobuf_to_mask(0, (const char *) data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_begin_class(struct TopConf *tc)
|
|
|
|
{
|
|
|
|
if(yy_class)
|
|
|
|
free_class(yy_class);
|
|
|
|
|
|
|
|
yy_class = make_class();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_end_class(struct TopConf *tc)
|
|
|
|
{
|
|
|
|
if(conf_cur_block_name != NULL)
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_class->class_name = rb_strdup(conf_cur_block_name);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(EmptyString(yy_class->class_name))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring connect block -- missing name.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_class(yy_class);
|
|
|
|
yy_class = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_class_ping_time(void *data)
|
|
|
|
{
|
|
|
|
yy_class->ping_freq = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-11-30 13:31:59 +01:00
|
|
|
conf_set_class_cidr_ipv4_bitlen(void *data)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2008-11-30 13:31:59 +01:00
|
|
|
unsigned int maxsize = 32;
|
|
|
|
if(*(unsigned int *) data > maxsize)
|
|
|
|
conf_report_error
|
|
|
|
("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
|
|
|
|
*(unsigned int *) data, maxsize);
|
|
|
|
else
|
|
|
|
yy_class->cidr_ipv4_bitlen = *(unsigned int *) data;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-04-05 18:57:30 +02:00
|
|
|
#ifdef RB_IPV6
|
2008-11-30 13:31:59 +01:00
|
|
|
static void
|
|
|
|
conf_set_class_cidr_ipv6_bitlen(void *data)
|
|
|
|
{
|
2007-01-25 07:40:21 +01:00
|
|
|
unsigned int maxsize = 128;
|
|
|
|
if(*(unsigned int *) data > maxsize)
|
|
|
|
conf_report_error
|
2008-11-30 13:31:59 +01:00
|
|
|
("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
|
2007-01-25 07:40:21 +01:00
|
|
|
*(unsigned int *) data, maxsize);
|
|
|
|
else
|
2008-11-30 13:31:59 +01:00
|
|
|
yy_class->cidr_ipv6_bitlen = *(unsigned int *) data;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
}
|
2008-11-30 13:31:59 +01:00
|
|
|
#endif
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_class_number_per_cidr(void *data)
|
|
|
|
{
|
|
|
|
yy_class->cidr_amount = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_class_number_per_ip(void *data)
|
|
|
|
{
|
|
|
|
yy_class->max_local = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_class_number_per_ip_global(void *data)
|
|
|
|
{
|
|
|
|
yy_class->max_global = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_class_number_per_ident(void *data)
|
|
|
|
{
|
|
|
|
yy_class->max_ident = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_class_connectfreq(void *data)
|
|
|
|
{
|
|
|
|
yy_class->con_freq = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_class_max_number(void *data)
|
|
|
|
{
|
|
|
|
yy_class->max_total = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_class_sendq(void *data)
|
|
|
|
{
|
|
|
|
yy_class->max_sendq = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *listener_address;
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_begin_listen(struct TopConf *tc)
|
|
|
|
{
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(listener_address);
|
2007-01-25 07:40:21 +01:00
|
|
|
listener_address = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_end_listen(struct TopConf *tc)
|
|
|
|
{
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(listener_address);
|
2007-01-25 07:40:21 +01:00
|
|
|
listener_address = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-03-17 16:00:39 +01:00
|
|
|
static void
|
|
|
|
conf_set_listen_defer_accept(void *data)
|
|
|
|
{
|
|
|
|
yy_defer_accept = *(unsigned int *) data;
|
|
|
|
}
|
2008-04-06 16:52:42 +02:00
|
|
|
|
2016-04-02 09:56:03 +02:00
|
|
|
static void
|
|
|
|
conf_set_listen_wsock(void *data)
|
|
|
|
{
|
|
|
|
yy_wsock = *(unsigned int *) data;
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
2008-04-06 16:52:42 +02:00
|
|
|
conf_set_listen_port_both(void *data, int ssl)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
for (; args; args = args->next)
|
|
|
|
{
|
2014-02-28 08:02:49 +01:00
|
|
|
if(CF_TYPE(args->type) != CF_INT)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
conf_report_error
|
|
|
|
("listener::port argument is not an integer " "-- ignoring.");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(listener_address == NULL)
|
|
|
|
{
|
2016-01-29 17:35:05 +01:00
|
|
|
if (!ssl)
|
|
|
|
{
|
2016-02-20 00:11:06 +01:00
|
|
|
conf_report_warning("listener 'ANY/%d': support for plaintext listeners may be removed in a future release per RFC 7194. "
|
|
|
|
"It is suggested that users be migrated to SSL/TLS connections.", args->v.number);
|
2016-01-29 17:35:05 +01:00
|
|
|
}
|
2016-04-02 09:56:03 +02:00
|
|
|
add_listener(args->v.number, listener_address, AF_INET, ssl, ssl || yy_defer_accept, yy_wsock);
|
2008-04-05 18:57:30 +02:00
|
|
|
#ifdef RB_IPV6
|
2016-04-02 09:56:03 +02:00
|
|
|
add_listener(args->v.number, listener_address, AF_INET6, ssl, ssl || yy_defer_accept, yy_wsock);
|
2007-01-25 07:40:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int family;
|
2008-04-05 18:57:30 +02:00
|
|
|
#ifdef RB_IPV6
|
2007-01-25 07:40:21 +01:00
|
|
|
if(strchr(listener_address, ':') != NULL)
|
|
|
|
family = AF_INET6;
|
2014-03-03 00:34:32 +01:00
|
|
|
else
|
2007-01-25 07:40:21 +01:00
|
|
|
#endif
|
|
|
|
family = AF_INET;
|
2014-03-03 00:34:32 +01:00
|
|
|
|
2016-01-29 17:35:05 +01:00
|
|
|
if (!ssl)
|
|
|
|
{
|
2016-02-20 00:11:06 +01:00
|
|
|
conf_report_warning("listener '%s/%d': support for plaintext listeners may be removed in a future release per RFC 7194. "
|
|
|
|
"It is suggested that users be migrated to SSL/TLS connections.", listener_address, args->v.number);
|
2016-01-29 17:35:05 +01:00
|
|
|
}
|
2014-03-03 00:34:32 +01:00
|
|
|
|
2016-04-02 09:56:03 +02:00
|
|
|
add_listener(args->v.number, listener_address, family, ssl, ssl || yy_defer_accept, yy_wsock);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-13 17:54:23 +02:00
|
|
|
static void
|
|
|
|
conf_set_listen_port(void *data)
|
|
|
|
{
|
|
|
|
conf_set_listen_port_both(data, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_listen_sslport(void *data)
|
|
|
|
{
|
|
|
|
conf_set_listen_port_both(data, 1);
|
2008-04-06 16:52:42 +02:00
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_listen_address(void *data)
|
|
|
|
{
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(listener_address);
|
2008-04-02 01:26:34 +02:00
|
|
|
listener_address = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_begin_auth(struct TopConf *tc)
|
|
|
|
{
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlink_node *ptr;
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_dlink_node *next_ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(yy_aconf)
|
|
|
|
free_conf(yy_aconf);
|
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
free_conf(ptr->data);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkDestroy(ptr, &yy_aconf_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
yy_aconf = make_conf();
|
|
|
|
yy_aconf->status = CONF_CLIENT;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_end_auth(struct TopConf *tc)
|
|
|
|
{
|
2010-01-31 01:36:37 +01:00
|
|
|
struct ConfItem *yy_tmp, *found_conf;
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlink_node *ptr;
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_dlink_node *next_ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2010-03-01 01:23:22 +01:00
|
|
|
if(EmptyString(yy_aconf->info.name))
|
|
|
|
yy_aconf->info.name = rb_strdup("NOMATCH");
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/* didnt even get one ->host? */
|
|
|
|
if(EmptyString(yy_aconf->host))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring auth block -- missing user@host");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* so the stacking works in order.. */
|
|
|
|
collapse(yy_aconf->user);
|
|
|
|
collapse(yy_aconf->host);
|
|
|
|
conf_add_class_to_conf(yy_aconf);
|
2010-01-31 01:36:37 +01:00
|
|
|
if ((found_conf = find_exact_conf_by_address("*", CONF_CLIENT, "*")) && found_conf->spasswd == NULL)
|
2009-01-31 18:42:03 +01:00
|
|
|
conf_report_error("Ignoring redundant auth block (after *@*)");
|
2010-01-31 01:36:37 +01:00
|
|
|
else if ((found_conf = find_exact_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user)) &&
|
2010-01-31 01:40:43 +01:00
|
|
|
(!found_conf->spasswd || (yy_aconf->spasswd &&
|
2010-01-31 01:36:37 +01:00
|
|
|
0 == irccmp(found_conf->spasswd, yy_aconf->spasswd))))
|
2009-01-31 18:42:03 +01:00
|
|
|
conf_report_error("Ignoring duplicate auth block for %s@%s",
|
|
|
|
yy_aconf->user, yy_aconf->host);
|
|
|
|
else
|
|
|
|
add_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user, yy_aconf->spasswd, yy_aconf);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
yy_tmp = ptr->data;
|
|
|
|
|
|
|
|
if(yy_aconf->passwd)
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmp->passwd = rb_strdup(yy_aconf->passwd);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-06-26 08:18:58 +02:00
|
|
|
if(yy_aconf->spasswd)
|
|
|
|
yy_tmp->spasswd = rb_strdup(yy_aconf->spasswd);
|
2014-03-03 00:34:32 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
/* this will always exist.. */
|
2010-03-01 01:23:22 +01:00
|
|
|
yy_tmp->info.name = rb_strdup(yy_aconf->info.name);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(yy_aconf->className)
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmp->className = rb_strdup(yy_aconf->className);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
yy_tmp->flags = yy_aconf->flags;
|
|
|
|
yy_tmp->port = yy_aconf->port;
|
|
|
|
|
|
|
|
collapse(yy_tmp->user);
|
|
|
|
collapse(yy_tmp->host);
|
|
|
|
|
|
|
|
conf_add_class_to_conf(yy_tmp);
|
|
|
|
|
2014-01-17 00:22:47 +01:00
|
|
|
if ((found_conf = find_exact_conf_by_address("*", CONF_CLIENT, "*")) && found_conf->spasswd == NULL)
|
2009-01-31 18:42:03 +01:00
|
|
|
conf_report_error("Ignoring redundant auth block (after *@*)");
|
2014-01-17 00:22:47 +01:00
|
|
|
else if ((found_conf = find_exact_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user)) &&
|
|
|
|
(!found_conf->spasswd || (yy_tmp->spasswd &&
|
|
|
|
0 == irccmp(found_conf->spasswd, yy_tmp->spasswd))))
|
2009-01-31 18:42:03 +01:00
|
|
|
conf_report_error("Ignoring duplicate auth block for %s@%s",
|
|
|
|
yy_tmp->user, yy_tmp->host);
|
|
|
|
else
|
|
|
|
add_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user, yy_tmp->spasswd, yy_tmp);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkDestroy(ptr, &yy_aconf_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
yy_aconf = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_auth_user(void *data)
|
|
|
|
{
|
|
|
|
struct ConfItem *yy_tmp;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
/* The first user= line doesn't allocate a new conf */
|
|
|
|
if(!EmptyString(yy_aconf->host))
|
|
|
|
{
|
|
|
|
yy_tmp = make_conf();
|
|
|
|
yy_tmp->status = CONF_CLIENT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
yy_tmp = yy_aconf;
|
|
|
|
|
|
|
|
if((p = strchr(data, '@')))
|
|
|
|
{
|
|
|
|
*p++ = '\0';
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmp->user = rb_strdup(data);
|
|
|
|
yy_tmp->host = rb_strdup(p);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmp->user = rb_strdup("*");
|
|
|
|
yy_tmp->host = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(yy_aconf != yy_tmp)
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAddAlloc(yy_tmp, &yy_aconf_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2008-06-26 08:18:58 +02:00
|
|
|
static void
|
|
|
|
conf_set_auth_auth_user(void *data)
|
|
|
|
{
|
|
|
|
if(yy_aconf->spasswd)
|
|
|
|
memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
|
|
|
|
rb_free(yy_aconf->spasswd);
|
|
|
|
yy_aconf->spasswd = rb_strdup(data);
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_auth_passwd(void *data)
|
|
|
|
{
|
|
|
|
if(yy_aconf->passwd)
|
|
|
|
memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_aconf->passwd);
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_aconf->passwd = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_auth_spoof(void *data)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
char *user = NULL;
|
|
|
|
char *host = NULL;
|
|
|
|
|
|
|
|
host = data;
|
|
|
|
|
|
|
|
/* user@host spoof */
|
|
|
|
if((p = strchr(host, '@')) != NULL)
|
|
|
|
{
|
|
|
|
*p = '\0';
|
|
|
|
user = data;
|
|
|
|
host = p+1;
|
|
|
|
|
|
|
|
if(EmptyString(user))
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- spoof ident empty.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(strlen(user) > USERLEN)
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- spoof ident length invalid.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!valid_username(user))
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- invalid spoof (ident).");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this must be restored! */
|
|
|
|
*p = '@';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(EmptyString(host))
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- spoof host empty.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(strlen(host) > HOSTLEN)
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- spoof host length invalid.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!valid_hostname(host))
|
|
|
|
{
|
|
|
|
conf_report_error("Warning -- invalid spoof (host).");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-03-01 01:23:22 +01:00
|
|
|
rb_free(yy_aconf->info.name);
|
|
|
|
yy_aconf->info.name = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_auth_flags(void *data)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
|
|
|
|
set_modes_from_table((int *) &yy_aconf->flags, "flag", auth_table, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_auth_redir_serv(void *data)
|
|
|
|
{
|
|
|
|
yy_aconf->flags |= CONF_FLAGS_REDIR;
|
2010-03-01 01:23:22 +01:00
|
|
|
rb_free(yy_aconf->info.name);
|
|
|
|
yy_aconf->info.name = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_auth_redir_port(void *data)
|
|
|
|
{
|
|
|
|
int port = *(unsigned int *) data;
|
|
|
|
|
|
|
|
yy_aconf->flags |= CONF_FLAGS_REDIR;
|
|
|
|
yy_aconf->port = port;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_auth_class(void *data)
|
|
|
|
{
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_aconf->className);
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_aconf->className = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ok, shared_oper handles the stacking, shared_flags handles adding
|
|
|
|
* things.. so all we need to do when we start and end a shared block, is
|
|
|
|
* clean up anything thats been left over.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
conf_cleanup_shared(struct TopConf *tc)
|
|
|
|
{
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_dlink_node *ptr, *next_ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
free_remote_conf(ptr->data);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkDestroy(ptr, &yy_shared_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(yy_shared != NULL)
|
|
|
|
{
|
|
|
|
free_remote_conf(yy_shared);
|
|
|
|
yy_shared = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_shared_oper(void *data)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
const char *username;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if(yy_shared != NULL)
|
|
|
|
free_remote_conf(yy_shared);
|
|
|
|
|
|
|
|
yy_shared = make_remote_conf();
|
|
|
|
|
|
|
|
if(args->next != NULL)
|
|
|
|
{
|
2014-02-28 08:02:49 +01:00
|
|
|
if(CF_TYPE(args->type) != CF_QSTRING)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
conf_report_error("Ignoring shared::oper -- server is not a qstring");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_shared->server = rb_strdup(args->v.string);
|
2007-01-25 07:40:21 +01:00
|
|
|
args = args->next;
|
|
|
|
}
|
|
|
|
else
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_shared->server = rb_strdup("*");
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2014-02-28 08:02:49 +01:00
|
|
|
if(CF_TYPE(args->type) != CF_QSTRING)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
conf_report_error("Ignoring shared::oper -- oper is not a qstring");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if((p = strchr(args->v.string, '@')) == NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring shard::oper -- oper is not a user@host");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
username = args->v.string;
|
|
|
|
*p++ = '\0';
|
|
|
|
|
|
|
|
if(EmptyString(p))
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_shared->host = rb_strdup("*");
|
2007-01-25 07:40:21 +01:00
|
|
|
else
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_shared->host = rb_strdup(p);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(EmptyString(username))
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_shared->username = rb_strdup("*");
|
2007-01-25 07:40:21 +01:00
|
|
|
else
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_shared->username = rb_strdup(username);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAddAlloc(yy_shared, &yy_shared_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
yy_shared = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_shared_flags(void *data)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
int flags = 0;
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_dlink_node *ptr, *next_ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(yy_shared != NULL)
|
|
|
|
free_remote_conf(yy_shared);
|
|
|
|
|
|
|
|
set_modes_from_table(&flags, "flag", shared_table, args);
|
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
yy_shared = ptr->data;
|
|
|
|
|
|
|
|
yy_shared->flags = flags;
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkDestroy(ptr, &yy_shared_list);
|
|
|
|
rb_dlinkAddTail(yy_shared, &yy_shared->node, &shared_conf_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
yy_shared = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_begin_connect(struct TopConf *tc)
|
|
|
|
{
|
|
|
|
if(yy_server)
|
|
|
|
free_server_conf(yy_server);
|
|
|
|
|
|
|
|
yy_server = make_server_conf();
|
|
|
|
yy_server->port = PORTNUM;
|
2008-02-02 17:15:34 +01:00
|
|
|
yy_server->flags |= SERVER_TB;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(conf_cur_block_name != NULL)
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_server->name = rb_strdup(conf_cur_block_name);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_end_connect(struct TopConf *tc)
|
|
|
|
{
|
|
|
|
if(EmptyString(yy_server->name))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring connect block -- missing name.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ServerInfo.name != NULL && !irccmp(ServerInfo.name, yy_server->name))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
|
|
|
|
yy_server->name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-12-14 06:14:00 +01:00
|
|
|
if((EmptyString(yy_server->passwd) || EmptyString(yy_server->spasswd)) && EmptyString(yy_server->certfp))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2010-12-15 04:25:44 +01:00
|
|
|
conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
|
2007-01-25 07:40:21 +01:00
|
|
|
yy_server->name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(EmptyString(yy_server->host))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring connect block for %s -- missing host.",
|
|
|
|
yy_server->name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef HAVE_LIBZ
|
|
|
|
if(ServerConfCompressed(yy_server))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
|
|
|
|
yy_server->flags &= ~SERVER_COMPRESSED;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
add_server_conf(yy_server);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
yy_server = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_host(void *data)
|
|
|
|
{
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_server->host);
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_server->host = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
if (strchr(yy_server->host, ':'))
|
|
|
|
yy_server->aftype = AF_INET6;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_vhost(void *data)
|
|
|
|
{
|
2008-04-20 06:55:41 +02:00
|
|
|
if(rb_inet_pton_sock(data, (struct sockaddr *)&yy_server->my_ipnum) <= 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-03-14 23:38:04 +01:00
|
|
|
conf_report_error("Invalid IP address for server connect vhost (%s)",
|
2007-01-25 07:40:21 +01:00
|
|
|
(char *) data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
yy_server->flags |= SERVER_VHOSTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_send_password(void *data)
|
|
|
|
{
|
|
|
|
if(yy_server->spasswd)
|
|
|
|
{
|
|
|
|
memset(yy_server->spasswd, 0, strlen(yy_server->spasswd));
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_server->spasswd);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_server->spasswd = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_accept_password(void *data)
|
|
|
|
{
|
|
|
|
if(yy_server->passwd)
|
|
|
|
{
|
|
|
|
memset(yy_server->passwd, 0, strlen(yy_server->passwd));
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_server->passwd);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_server->passwd = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2010-12-14 06:14:00 +01:00
|
|
|
static void
|
|
|
|
conf_set_connect_fingerprint(void *data)
|
|
|
|
{
|
2011-01-25 00:39:07 +01:00
|
|
|
if (yy_server->certfp)
|
|
|
|
rb_free(yy_server->certfp);
|
2010-12-14 06:14:00 +01:00
|
|
|
yy_server->certfp = rb_strdup((char *) data);
|
|
|
|
|
|
|
|
/* force SSL to be enabled if fingerprint is enabled. */
|
|
|
|
yy_server->flags |= SERVER_SSL;
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_connect_port(void *data)
|
|
|
|
{
|
|
|
|
int port = *(unsigned int *) data;
|
|
|
|
|
|
|
|
if(port < 1)
|
|
|
|
port = PORTNUM;
|
|
|
|
|
|
|
|
yy_server->port = port;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_aftype(void *data)
|
|
|
|
{
|
|
|
|
char *aft = data;
|
|
|
|
|
2016-04-05 12:39:59 +02:00
|
|
|
if(rb_strcasecmp(aft, "ipv4") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
yy_server->aftype = AF_INET;
|
2008-04-05 18:57:30 +02:00
|
|
|
#ifdef RB_IPV6
|
2016-04-05 12:39:59 +02:00
|
|
|
else if(rb_strcasecmp(aft, "ipv6") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
yy_server->aftype = AF_INET6;
|
|
|
|
#endif
|
|
|
|
else
|
|
|
|
conf_report_error("connect::aftype '%s' is unknown.", aft);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_flags(void *data)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
|
|
|
|
/* note, we allow them to set compressed, then remove it later if
|
|
|
|
* they do and LIBZ isnt available
|
|
|
|
*/
|
|
|
|
set_modes_from_table(&yy_server->flags, "flag", connect_table, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_hub_mask(void *data)
|
|
|
|
{
|
|
|
|
struct remote_conf *yy_hub;
|
|
|
|
|
|
|
|
if(EmptyString(yy_server->name))
|
|
|
|
return;
|
|
|
|
|
|
|
|
yy_hub = make_remote_conf();
|
|
|
|
yy_hub->flags = CONF_HUB;
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_hub->host = rb_strdup(data);
|
|
|
|
yy_hub->server = rb_strdup(yy_server->name);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAdd(yy_hub, &yy_hub->node, &hubleaf_conf_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_leaf_mask(void *data)
|
|
|
|
{
|
|
|
|
struct remote_conf *yy_leaf;
|
|
|
|
|
|
|
|
if(EmptyString(yy_server->name))
|
|
|
|
return;
|
|
|
|
|
|
|
|
yy_leaf = make_remote_conf();
|
|
|
|
yy_leaf->flags = CONF_LEAF;
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_leaf->host = rb_strdup(data);
|
|
|
|
yy_leaf->server = rb_strdup(yy_server->name);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAdd(yy_leaf, &yy_leaf->node, &hubleaf_conf_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_connect_class(void *data)
|
|
|
|
{
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_server->class_name);
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_server->class_name = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_exempt_ip(void *data)
|
|
|
|
{
|
|
|
|
struct ConfItem *yy_tmp;
|
|
|
|
|
|
|
|
if(parse_netmask(data, NULL, NULL) == HM_HOST)
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring exempt -- invalid exempt::ip.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
yy_tmp = make_conf();
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_tmp->passwd = rb_strdup("*");
|
|
|
|
yy_tmp->host = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
yy_tmp->status = CONF_EXEMPTDLINE;
|
2008-06-26 08:18:58 +02:00
|
|
|
add_conf_by_address(yy_tmp->host, CONF_EXEMPTDLINE, NULL, NULL, yy_tmp);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_cleanup_cluster(struct TopConf *tc)
|
|
|
|
{
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_dlink_node *ptr, *next_ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_cluster_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
free_remote_conf(ptr->data);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkDestroy(ptr, &yy_cluster_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(yy_shared != NULL)
|
|
|
|
{
|
|
|
|
free_remote_conf(yy_shared);
|
|
|
|
yy_shared = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_cluster_name(void *data)
|
|
|
|
{
|
|
|
|
if(yy_shared != NULL)
|
|
|
|
free_remote_conf(yy_shared);
|
|
|
|
|
|
|
|
yy_shared = make_remote_conf();
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_shared->server = rb_strdup(data);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAddAlloc(yy_shared, &yy_cluster_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
yy_shared = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_cluster_flags(void *data)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
int flags = 0;
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_dlink_node *ptr, *next_ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(yy_shared != NULL)
|
|
|
|
free_remote_conf(yy_shared);
|
|
|
|
|
|
|
|
set_modes_from_table(&flags, "flag", cluster_table, args);
|
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_cluster_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
yy_shared = ptr->data;
|
|
|
|
yy_shared->flags = flags;
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAddTail(yy_shared, &yy_shared->node, &cluster_conf_list);
|
|
|
|
rb_dlinkDestroy(ptr, &yy_cluster_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
yy_shared = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_havent_read_conf(void *data)
|
|
|
|
{
|
|
|
|
if(*(unsigned int *) data)
|
|
|
|
{
|
|
|
|
conf_report_error("You haven't read your config file properly.");
|
|
|
|
conf_report_error
|
|
|
|
("There is a line in the example conf that will kill your server if not removed.");
|
|
|
|
conf_report_error
|
|
|
|
("Consider actually reading/editing the conf file, and removing this line.");
|
|
|
|
if (!testing_conf)
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_hide_error_messages(void *data)
|
|
|
|
{
|
|
|
|
char *val = data;
|
|
|
|
|
2016-04-05 12:39:59 +02:00
|
|
|
if(rb_strcasecmp(val, "yes") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.hide_error_messages = 2;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if(rb_strcasecmp(val, "opers") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.hide_error_messages = 1;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if(rb_strcasecmp(val, "no") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.hide_error_messages = 0;
|
|
|
|
else
|
|
|
|
conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_kline_delay(void *data)
|
|
|
|
{
|
|
|
|
ConfigFileEntry.kline_delay = *(unsigned int *) data;
|
|
|
|
|
|
|
|
/* THIS MUST BE HERE to stop us being unable to check klines */
|
2016-03-09 09:00:40 +01:00
|
|
|
kline_queued = false;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_stats_k_oper_only(void *data)
|
|
|
|
{
|
|
|
|
char *val = data;
|
|
|
|
|
2016-04-05 12:39:59 +02:00
|
|
|
if(rb_strcasecmp(val, "yes") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.stats_k_oper_only = 2;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if(rb_strcasecmp(val, "masked") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.stats_k_oper_only = 1;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if(rb_strcasecmp(val, "no") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.stats_k_oper_only = 0;
|
|
|
|
else
|
|
|
|
conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_stats_i_oper_only(void *data)
|
|
|
|
{
|
|
|
|
char *val = data;
|
|
|
|
|
2016-04-05 12:39:59 +02:00
|
|
|
if(rb_strcasecmp(val, "yes") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.stats_i_oper_only = 2;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if(rb_strcasecmp(val, "masked") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.stats_i_oper_only = 1;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if(rb_strcasecmp(val, "no") == 0)
|
2007-01-25 07:40:21 +01:00
|
|
|
ConfigFileEntry.stats_i_oper_only = 0;
|
|
|
|
else
|
|
|
|
conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_compression_level(void *data)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_LIBZ
|
|
|
|
ConfigFileEntry.compression_level = *(unsigned int *) data;
|
|
|
|
|
|
|
|
if((ConfigFileEntry.compression_level < 1) || (ConfigFileEntry.compression_level > 9))
|
|
|
|
{
|
|
|
|
conf_report_error
|
|
|
|
("Invalid general::compression_level %d -- using default.",
|
|
|
|
ConfigFileEntry.compression_level);
|
|
|
|
ConfigFileEntry.compression_level = 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
conf_report_error("Ignoring general::compression_level -- zlib not available.");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_default_umodes(void *data)
|
|
|
|
{
|
|
|
|
char *pm;
|
|
|
|
int what = MODE_ADD, flag;
|
|
|
|
|
|
|
|
ConfigFileEntry.default_umodes = 0;
|
|
|
|
for (pm = (char *) data; *pm; pm++)
|
|
|
|
{
|
|
|
|
switch (*pm)
|
|
|
|
{
|
|
|
|
case '+':
|
|
|
|
what = MODE_ADD;
|
|
|
|
break;
|
|
|
|
case '-':
|
|
|
|
what = MODE_DEL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* don't allow +o */
|
|
|
|
case 'o':
|
|
|
|
case 'S':
|
2011-03-11 14:12:40 +01:00
|
|
|
case 'Z':
|
2007-01-25 07:40:21 +01:00
|
|
|
case ' ':
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ((flag = user_modes[(unsigned char) *pm]))
|
|
|
|
{
|
|
|
|
/* Proper value has probably not yet been set
|
|
|
|
* so don't check oper_only_umodes -- jilles */
|
|
|
|
if (what == MODE_ADD)
|
|
|
|
ConfigFileEntry.default_umodes |= flag;
|
|
|
|
else
|
|
|
|
ConfigFileEntry.default_umodes &= ~flag;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2014-03-03 00:34:32 +01:00
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_oper_umodes(void *data)
|
|
|
|
{
|
|
|
|
set_modes_from_table(&ConfigFileEntry.oper_umodes, "umode", umode_table, data);
|
|
|
|
}
|
|
|
|
|
2015-12-07 08:49:30 +01:00
|
|
|
static void
|
|
|
|
conf_set_general_certfp_method(void *data)
|
|
|
|
{
|
|
|
|
char *method = data;
|
|
|
|
|
2016-04-05 12:39:59 +02:00
|
|
|
if (!rb_strcasecmp(method, "sha1"))
|
2015-12-07 08:49:30 +01:00
|
|
|
ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA1;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if (!rb_strcasecmp(method, "sha256"))
|
2015-12-07 08:49:30 +01:00
|
|
|
ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA256;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if (!rb_strcasecmp(method, "sha512"))
|
2015-12-07 08:49:30 +01:00
|
|
|
ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA512;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA1;
|
|
|
|
conf_report_error("Ignoring general::certfp_method -- bogus certfp method %s", method);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_general_oper_only_umodes(void *data)
|
|
|
|
{
|
|
|
|
set_modes_from_table(&ConfigFileEntry.oper_only_umodes, "umode", umode_table, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_general_oper_snomask(void *data)
|
|
|
|
{
|
|
|
|
char *pm;
|
|
|
|
int what = MODE_ADD, flag;
|
|
|
|
|
|
|
|
ConfigFileEntry.oper_snomask = 0;
|
|
|
|
for (pm = (char *) data; *pm; pm++)
|
|
|
|
{
|
|
|
|
switch (*pm)
|
|
|
|
{
|
|
|
|
case '+':
|
|
|
|
what = MODE_ADD;
|
|
|
|
break;
|
|
|
|
case '-':
|
|
|
|
what = MODE_DEL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ((flag = snomask_modes[(unsigned char) *pm]))
|
|
|
|
{
|
|
|
|
if (what == MODE_ADD)
|
|
|
|
ConfigFileEntry.oper_snomask |= flag;
|
|
|
|
else
|
|
|
|
ConfigFileEntry.oper_snomask &= ~flag;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_serverhide_links_delay(void *data)
|
|
|
|
{
|
|
|
|
int val = *(unsigned int *) data;
|
|
|
|
|
|
|
|
ConfigServerHide.links_delay = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_service_name(void *data)
|
|
|
|
{
|
|
|
|
const char *s;
|
|
|
|
char *tmp;
|
|
|
|
int dots = 0;
|
|
|
|
|
|
|
|
for(s = data; *s != '\0'; s++)
|
|
|
|
{
|
|
|
|
if(!IsServChar(*s))
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring service::name "
|
|
|
|
"-- bogus servername.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if(*s == '.')
|
|
|
|
dots++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!dots)
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring service::name -- must contain '.'");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
tmp = rb_strdup(data);
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAddAlloc(tmp, &service_list);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_begin_alias(struct TopConf *tc)
|
|
|
|
{
|
2008-04-02 01:07:29 +02:00
|
|
|
yy_alias = rb_malloc(sizeof(struct alias_entry));
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if (conf_cur_block_name != NULL)
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_alias->name = rb_strdup(conf_cur_block_name);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
yy_alias->flags = 0;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_end_alias(struct TopConf *tc)
|
|
|
|
{
|
|
|
|
if (yy_alias == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (yy_alias->name == NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring alias -- must have a name.");
|
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_alias);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yy_alias->target == NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("Ignoring alias -- must have a target.");
|
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(yy_alias);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-03-06 21:17:19 +01:00
|
|
|
rb_dictionary_add(alias_dict, yy_alias->name, yy_alias);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_alias_name(void *data)
|
|
|
|
{
|
|
|
|
if (data == NULL || yy_alias == NULL) /* this shouldn't ever happen */
|
|
|
|
return;
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_alias->name = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_alias_target(void *data)
|
|
|
|
{
|
|
|
|
if (data == NULL || yy_alias == NULL) /* this shouldn't ever happen */
|
|
|
|
return;
|
|
|
|
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_alias->target = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2015-12-11 22:36:53 +01:00
|
|
|
static void
|
|
|
|
conf_set_channel_autochanmodes(void *data)
|
|
|
|
{
|
|
|
|
char *pm;
|
|
|
|
int what = MODE_ADD;
|
|
|
|
|
|
|
|
ConfigChannel.autochanmodes = 0;
|
|
|
|
for (pm = (char *) data; *pm; pm++)
|
|
|
|
{
|
|
|
|
switch (*pm)
|
|
|
|
{
|
|
|
|
case '+':
|
|
|
|
what = MODE_ADD;
|
|
|
|
break;
|
|
|
|
case '-':
|
|
|
|
what = MODE_DEL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (chmode_table[(unsigned char) *pm].set_func == chm_simple)
|
|
|
|
{
|
|
|
|
if (what == MODE_ADD)
|
|
|
|
ConfigChannel.autochanmodes |= chmode_table[(unsigned char) *pm].mode_type;
|
|
|
|
else
|
|
|
|
ConfigChannel.autochanmodes &= ~chmode_table[(unsigned char) *pm].mode_type;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-12 07:33:46 +01:00
|
|
|
conf_report_error("channel::autochanmodes -- Invalid channel mode %c", *pm);
|
2015-12-11 22:36:53 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-20 23:17:29 +02:00
|
|
|
/* XXX for below */
|
|
|
|
static void conf_set_blacklist_reason(void *data);
|
|
|
|
|
2016-03-28 09:11:16 +02:00
|
|
|
#define IPTYPE_IPV4 1
|
|
|
|
#define IPTYPE_IPV6 2
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_blacklist_host(void *data)
|
|
|
|
{
|
2013-04-20 23:17:29 +02:00
|
|
|
if (yy_blacklist_host)
|
|
|
|
{
|
|
|
|
conf_report_error("blacklist::host %s overlaps existing host %s",
|
|
|
|
(char *)data, yy_blacklist_host);
|
|
|
|
|
|
|
|
/* Cleanup */
|
|
|
|
conf_set_blacklist_reason(NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-28 09:11:16 +02:00
|
|
|
yy_blacklist_iptype |= IPTYPE_IPV4;
|
2008-04-02 01:26:34 +02:00
|
|
|
yy_blacklist_host = rb_strdup(data);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2011-02-27 22:38:05 +01:00
|
|
|
static void
|
|
|
|
conf_set_blacklist_type(void *data)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
|
|
|
|
/* Don't assume we have either if we got here */
|
2016-03-28 09:11:16 +02:00
|
|
|
yy_blacklist_iptype = 0;
|
2011-02-27 22:38:05 +01:00
|
|
|
|
|
|
|
for (; args; args = args->next)
|
|
|
|
{
|
2016-04-05 12:39:59 +02:00
|
|
|
if (!rb_strcasecmp(args->v.string, "ipv4"))
|
2016-03-28 09:11:16 +02:00
|
|
|
yy_blacklist_iptype |= IPTYPE_IPV4;
|
2016-04-05 12:39:59 +02:00
|
|
|
else if (!rb_strcasecmp(args->v.string, "ipv6"))
|
2016-03-28 09:11:16 +02:00
|
|
|
yy_blacklist_iptype |= IPTYPE_IPV6;
|
2011-02-27 22:38:05 +01:00
|
|
|
else
|
|
|
|
conf_report_error("blacklist::type has unknown address family %s",
|
|
|
|
args->v.string);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we have neither, just default to IPv4 */
|
2016-03-28 09:11:16 +02:00
|
|
|
if (!yy_blacklist_iptype)
|
2011-02-27 22:38:05 +01:00
|
|
|
{
|
2016-03-29 00:45:35 +02:00
|
|
|
conf_report_warning("blacklist::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
|
2016-03-28 09:11:16 +02:00
|
|
|
yy_blacklist_iptype = IPTYPE_IPV4;
|
2011-02-27 22:38:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-20 23:17:29 +02:00
|
|
|
static void
|
|
|
|
conf_set_blacklist_matches(void *data)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
2016-03-28 09:11:16 +02:00
|
|
|
enum filter_t { FILTER_NONE, FILTER_ALL, FILTER_LAST };
|
2013-04-20 23:17:29 +02:00
|
|
|
|
|
|
|
for (; args; args = args->next)
|
|
|
|
{
|
|
|
|
char *str = args->v.string;
|
|
|
|
char *p;
|
2016-03-28 09:11:16 +02:00
|
|
|
enum filter_t type = FILTER_LAST;
|
2013-04-20 23:17:29 +02:00
|
|
|
|
|
|
|
if (CF_TYPE(args->type) != CF_QSTRING)
|
|
|
|
{
|
|
|
|
conf_report_error("blacklist::matches -- must be quoted string");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (str == NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("blacklist::matches -- invalid entry");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strlen(str) > HOSTIPLEN)
|
|
|
|
{
|
|
|
|
conf_report_error("blacklist::matches has an entry too long: %s",
|
|
|
|
str);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (p = str; *p != '\0'; p++)
|
|
|
|
{
|
|
|
|
/* Check for validity */
|
|
|
|
if (*p == '.')
|
2016-03-28 09:11:16 +02:00
|
|
|
type = FILTER_ALL;
|
|
|
|
else if (!isdigit((unsigned char)*p))
|
2013-04-20 23:17:29 +02:00
|
|
|
{
|
|
|
|
conf_report_error("blacklist::matches has invalid IP match entry %s",
|
|
|
|
str);
|
2016-03-28 09:11:16 +02:00
|
|
|
type = FILTER_NONE;
|
2013-04-20 23:17:29 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-28 09:11:16 +02:00
|
|
|
if (type == FILTER_ALL)
|
2013-04-20 23:17:29 +02:00
|
|
|
{
|
|
|
|
/* Basic IP sanity check */
|
|
|
|
struct rb_sockaddr_storage tmp;
|
|
|
|
if (rb_inet_pton(AF_INET, str, &tmp) <= 0)
|
|
|
|
{
|
|
|
|
conf_report_error("blacklist::matches has invalid IP match entry %s",
|
|
|
|
str);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2016-03-28 09:11:16 +02:00
|
|
|
else if (type == FILTER_LAST)
|
2013-04-20 23:17:29 +02:00
|
|
|
{
|
|
|
|
/* Verify it's the correct length */
|
|
|
|
if (strlen(str) > 3)
|
|
|
|
{
|
|
|
|
conf_report_error("blacklist::matches has invalid octet match entry %s",
|
|
|
|
str);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
continue; /* Invalid entry */
|
|
|
|
}
|
|
|
|
|
2016-03-28 09:11:16 +02:00
|
|
|
rb_dlinkAddAlloc(rb_strdup(str), &yy_blacklist_filters);
|
2013-04-20 23:17:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void
|
|
|
|
conf_set_blacklist_reason(void *data)
|
|
|
|
{
|
2013-04-20 23:17:29 +02:00
|
|
|
rb_dlink_node *ptr, *nptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2014-09-21 14:41:51 +02:00
|
|
|
if (yy_blacklist_host && data)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2014-09-21 14:41:51 +02:00
|
|
|
yy_blacklist_reason = rb_strdup(data);
|
2016-03-29 00:47:13 +02:00
|
|
|
if (yy_blacklist_iptype & IPTYPE_IPV6)
|
2011-02-27 22:38:05 +01:00
|
|
|
{
|
2016-03-29 00:55:54 +02:00
|
|
|
/* Make sure things fit (magic number 64 = alnum count + dots)
|
2016-03-29 00:54:01 +02:00
|
|
|
* Example: 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa
|
|
|
|
*/
|
2011-02-27 22:38:05 +01:00
|
|
|
if ((64 + strlen(yy_blacklist_host)) > IRCD_RES_HOSTLEN)
|
|
|
|
{
|
|
|
|
conf_report_error("blacklist::host %s results in IPv6 queries that are too long",
|
|
|
|
yy_blacklist_host);
|
|
|
|
goto cleanup_bl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
|
2016-03-28 09:11:16 +02:00
|
|
|
if ((yy_blacklist_iptype & IPTYPE_IPV4) && !(yy_blacklist_iptype & IPTYPE_IPV6))
|
2011-02-27 22:38:05 +01:00
|
|
|
{
|
2016-03-29 00:55:54 +02:00
|
|
|
/* Make sure things fit for worst case (magic number 16 = number of nums + dots)
|
|
|
|
* Example: 127.127.127.127.in-addr.arpa
|
2016-03-29 00:54:01 +02:00
|
|
|
*/
|
2011-02-27 22:38:05 +01:00
|
|
|
if ((16 + strlen(yy_blacklist_host)) > IRCD_RES_HOSTLEN)
|
|
|
|
{
|
|
|
|
conf_report_error("blacklist::host %s results in IPv4 queries that are too long",
|
|
|
|
yy_blacklist_host);
|
|
|
|
goto cleanup_bl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-28 09:11:16 +02:00
|
|
|
add_blacklist(yy_blacklist_host, yy_blacklist_reason, yy_blacklist_iptype, &yy_blacklist_filters);
|
2013-04-20 23:17:29 +02:00
|
|
|
}
|
2011-02-27 22:38:05 +01:00
|
|
|
|
|
|
|
cleanup_bl:
|
2016-03-28 09:11:16 +02:00
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, nptr, yy_blacklist_filters.head)
|
2013-04-21 18:10:19 +02:00
|
|
|
{
|
2016-03-28 09:11:16 +02:00
|
|
|
rb_free(ptr->data);
|
|
|
|
rb_dlinkDestroy(ptr, &yy_blacklist_filters);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
2013-04-20 23:17:29 +02:00
|
|
|
|
2016-03-28 09:11:16 +02:00
|
|
|
yy_blacklist_filters = (rb_dlink_list){ NULL, NULL, 0 };
|
|
|
|
|
2013-04-20 23:17:29 +02:00
|
|
|
rb_free(yy_blacklist_host);
|
|
|
|
rb_free(yy_blacklist_reason);
|
|
|
|
yy_blacklist_host = NULL;
|
|
|
|
yy_blacklist_reason = NULL;
|
2016-03-28 09:11:16 +02:00
|
|
|
yy_blacklist_iptype = 0;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
|
|
|
|
struct opm_scanner
|
|
|
|
{
|
|
|
|
const char *type;
|
|
|
|
uint16_t port;
|
|
|
|
|
|
|
|
rb_dlink_node node;
|
|
|
|
};
|
|
|
|
|
2016-04-01 11:11:04 +02:00
|
|
|
static int
|
|
|
|
conf_begin_opm(struct TopConf *tc)
|
|
|
|
{
|
|
|
|
yy_opm_address_ipv4 = yy_opm_address_ipv6 = NULL;
|
2016-04-02 10:33:12 +02:00
|
|
|
yy_opm_port_ipv4 = yy_opm_port_ipv6 = yy_opm_timeout = 0;
|
2016-04-03 05:30:54 +02:00
|
|
|
delete_opm_proxy_scanner_all();
|
2016-04-01 11:11:04 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
conf_end_opm(struct TopConf *tc)
|
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
rb_dlink_node *ptr, *nptr;
|
|
|
|
bool fail = false;
|
|
|
|
|
2016-04-03 05:45:52 +02:00
|
|
|
if(rb_dlink_list_length(&yy_opm_scanner_list) == 0)
|
2016-04-02 09:29:48 +02:00
|
|
|
{
|
2016-04-03 02:45:09 +02:00
|
|
|
conf_report_error("No opm scanners configured -- disabling opm.");
|
2016-04-02 09:29:48 +02:00
|
|
|
fail = true;
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
2016-04-01 11:11:04 +02:00
|
|
|
if(yy_opm_port_ipv4 > 0)
|
|
|
|
{
|
|
|
|
if(yy_opm_address_ipv4 != NULL)
|
|
|
|
create_opm_listener(yy_opm_address_ipv4, yy_opm_port_ipv4);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char ip[HOSTIPLEN];
|
|
|
|
if(!rb_inet_ntop_sock((struct sockaddr *)&ServerInfo.ip, ip, sizeof(ip)))
|
|
|
|
conf_report_error("No opm::listen_ipv4 nor serverinfo::vhost directive; cannot listen on IPv4");
|
|
|
|
else
|
|
|
|
create_opm_listener(ip, yy_opm_port_ipv4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(yy_opm_port_ipv6 > 0)
|
|
|
|
{
|
|
|
|
if(yy_opm_address_ipv6 != NULL)
|
|
|
|
create_opm_listener(yy_opm_address_ipv6, yy_opm_port_ipv6);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char ip[HOSTIPLEN];
|
|
|
|
if(!rb_inet_ntop_sock((struct sockaddr *)&ServerInfo.ip6, ip, sizeof(ip)))
|
|
|
|
conf_report_error("No opm::listen_ipv6 nor serverinfo::vhost directive; cannot listen on IPv6");
|
|
|
|
else
|
|
|
|
create_opm_listener(ip, yy_opm_port_ipv6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
/* If there's no listeners... */
|
|
|
|
fail = (yy_opm_port_ipv4 == 0 || yy_opm_port_ipv6 == 0);
|
2016-04-03 02:45:09 +02:00
|
|
|
if(!fail && yy_opm_timeout > 0 && yy_opm_timeout < 60)
|
2016-04-02 10:33:12 +02:00
|
|
|
/* Send timeout */
|
|
|
|
set_authd_timeout("opm_timeout", yy_opm_timeout);
|
2016-04-03 02:45:09 +02:00
|
|
|
else if(fail)
|
|
|
|
conf_report_error("No opm listeners -- disabling");
|
|
|
|
else if(yy_opm_timeout <= 0 || yy_opm_timeout >= 60)
|
|
|
|
conf_report_error("opm::timeout value is invalid -- ignoring");
|
2016-04-02 10:33:12 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
end:
|
|
|
|
RB_DLINK_FOREACH_SAFE(ptr, nptr, yy_opm_scanner_list.head)
|
|
|
|
{
|
|
|
|
struct opm_scanner *scanner = ptr->data;
|
|
|
|
|
|
|
|
if(!fail)
|
|
|
|
create_opm_proxy_scanner(scanner->type, scanner->port);
|
|
|
|
|
|
|
|
rb_dlinkDelete(&scanner->node, &yy_opm_scanner_list);
|
|
|
|
rb_free(scanner);
|
|
|
|
}
|
|
|
|
|
2016-04-03 05:33:19 +02:00
|
|
|
if(!fail)
|
|
|
|
opm_check_enable(true);
|
|
|
|
|
2016-04-01 11:11:04 +02:00
|
|
|
rb_free(yy_opm_address_ipv4);
|
|
|
|
rb_free(yy_opm_address_ipv6);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-04-02 10:33:12 +02:00
|
|
|
static void
|
|
|
|
conf_set_opm_timeout(void *data)
|
|
|
|
{
|
|
|
|
int timeout = *((int *)data);
|
|
|
|
|
|
|
|
if(timeout <= 0 || timeout > 60)
|
|
|
|
{
|
|
|
|
conf_report_error("opm::timeout value %d is bogus, ignoring", timeout);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
yy_opm_timeout = timeout;
|
|
|
|
}
|
2016-04-02 09:29:48 +02:00
|
|
|
|
2016-04-01 11:11:04 +02:00
|
|
|
static void
|
2016-04-02 09:29:48 +02:00
|
|
|
conf_set_opm_listen_address_both(void *data, bool ipv6)
|
2016-04-01 11:11:04 +02:00
|
|
|
{
|
|
|
|
struct rb_sockaddr_storage addr;
|
2016-04-02 09:29:48 +02:00
|
|
|
const char *confstr = (ipv6 ? "opm::listen_ipv6" : "opm::listen_ipv4");
|
2016-04-01 11:11:04 +02:00
|
|
|
char *ip = data;
|
|
|
|
|
|
|
|
if(!rb_inet_pton_sock(ip, (struct sockaddr *)&addr))
|
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
conf_report_error("%s is an invalid address: %s", confstr, ip);
|
2016-04-01 11:11:04 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
if(ipv6)
|
2016-04-01 11:11:04 +02:00
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
#ifdef RB_IPV6
|
|
|
|
if(GET_SS_FAMILY(&addr) != AF_INET6)
|
|
|
|
{
|
|
|
|
conf_report_error("%s is of the wrong address type: %s", confstr, ip);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(yy_opm_address_ipv6 != NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("%s overwrites previous address %s", confstr, ip);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
yy_opm_address_ipv6 = rb_strdup(ip);
|
|
|
|
#else
|
|
|
|
conf_report_error("%s requires IPv6 support in your ircd", confstr, ip);
|
2016-04-01 11:11:04 +02:00
|
|
|
return;
|
|
|
|
#endif
|
2016-04-02 09:29:48 +02:00
|
|
|
}
|
|
|
|
else
|
2016-04-01 11:11:04 +02:00
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
if(GET_SS_FAMILY(&addr) != AF_INET)
|
|
|
|
{
|
|
|
|
conf_report_error("%s is of the wrong address type: %s", confstr, ip);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(yy_opm_address_ipv4 != NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("%s overwrites previous address %s", confstr, ip);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
yy_opm_address_ipv4 = rb_strdup(ip);
|
2016-04-01 11:11:04 +02:00
|
|
|
}
|
2016-04-02 09:29:48 +02:00
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
static void
|
|
|
|
conf_set_opm_listen_address_ipv4(void *data)
|
|
|
|
{
|
|
|
|
conf_set_opm_listen_address_both(data, false);
|
2016-04-01 11:11:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_opm_listen_address_ipv6(void *data)
|
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
conf_set_opm_listen_address_both(data, true);
|
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
static void
|
|
|
|
conf_set_opm_listen_port_both(void *data, bool ipv6)
|
|
|
|
{
|
|
|
|
int port = *((int *)data);
|
|
|
|
const char *confstr = (ipv6 ? "opm::port_ipv6" : "opm::port_ipv4");
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
#ifndef RB_IPV6
|
|
|
|
if(ipv6)
|
2016-04-01 11:11:04 +02:00
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
conf_report_error("%s requires IPv6 support in your ircd", confstr);
|
2016-04-01 11:11:04 +02:00
|
|
|
return;
|
|
|
|
}
|
2016-04-02 09:29:48 +02:00
|
|
|
#endif
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
if(port > 65535 || port <= 0)
|
2016-04-01 11:11:04 +02:00
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
conf_report_error("%s is out of range: %d", confstr, port);
|
2016-04-01 11:11:04 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
if(ipv6)
|
2016-04-01 11:11:04 +02:00
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
if(yy_opm_port_ipv4)
|
|
|
|
{
|
|
|
|
conf_report_error("%s overwrites existing port %hu",
|
|
|
|
confstr, yy_opm_port_ipv4);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
yy_opm_port_ipv4 = port;
|
2016-04-01 11:11:04 +02:00
|
|
|
}
|
2016-04-02 09:29:48 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if(yy_opm_port_ipv6)
|
|
|
|
{
|
|
|
|
conf_report_error("%s overwrites existing port %hu",
|
|
|
|
confstr, yy_opm_port_ipv6);
|
|
|
|
return;
|
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
yy_opm_port_ipv6 = port;
|
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_opm_listen_port_ipv4(void *data)
|
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
conf_set_opm_listen_port_both(data, false);
|
2016-04-01 11:11:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_opm_listen_port_ipv6(void *data)
|
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
conf_set_opm_listen_port_both(data, true);
|
2016-04-01 11:11:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_opm_listen_port(void *data)
|
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
conf_set_opm_listen_port_both(data, true);
|
|
|
|
conf_set_opm_listen_port_both(data, false);
|
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
static void
|
|
|
|
conf_set_opm_scan_ports_all(void *data, const char *node, const char *type)
|
|
|
|
{
|
|
|
|
conf_parm_t *args = data;
|
|
|
|
for (; args; args = args->next)
|
2016-04-01 11:11:04 +02:00
|
|
|
{
|
2016-04-02 09:29:48 +02:00
|
|
|
rb_dlink_node *ptr;
|
|
|
|
bool dup = false;
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
if(CF_TYPE(args->type) != CF_INT)
|
|
|
|
{
|
|
|
|
conf_report_error("%s argument is not an integer -- ignoring.", node);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(args->v.number > 65535 || args->v.number <= 0)
|
|
|
|
{
|
|
|
|
conf_report_error("%s argument is not an integer between 1 and 65535 -- ignoring.", node);
|
|
|
|
continue;
|
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
/* Check for duplicates */
|
|
|
|
RB_DLINK_FOREACH(ptr, yy_opm_scanner_list.head)
|
|
|
|
{
|
|
|
|
struct opm_scanner *scanner = ptr->data;
|
|
|
|
|
|
|
|
if(scanner->port == args->v.number && strcmp(type, scanner->type) == 0)
|
|
|
|
{
|
|
|
|
conf_report_error("%s argument is duplicate", node);
|
|
|
|
dup = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!dup)
|
|
|
|
{
|
|
|
|
struct opm_scanner *scanner = rb_malloc(sizeof(struct opm_scanner));
|
|
|
|
scanner->port = args->v.number;
|
|
|
|
scanner->type = type;
|
|
|
|
rb_dlinkAdd(scanner, &scanner->node, &yy_opm_scanner_list);
|
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
}
|
2016-04-02 09:29:48 +02:00
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
static void
|
|
|
|
conf_set_opm_scan_ports_socks4(void *data)
|
|
|
|
{
|
|
|
|
conf_set_opm_scan_ports_all(data, "opm::socks4_ports", "socks4");
|
|
|
|
}
|
2016-04-01 11:11:04 +02:00
|
|
|
|
2016-04-02 09:29:48 +02:00
|
|
|
static void
|
|
|
|
conf_set_opm_scan_ports_socks5(void *data)
|
|
|
|
{
|
|
|
|
conf_set_opm_scan_ports_all(data, "opm::socks5_ports", "socks5");
|
2016-04-01 11:11:04 +02:00
|
|
|
}
|
|
|
|
|
2016-04-02 10:11:12 +02:00
|
|
|
static void
|
|
|
|
conf_set_opm_scan_ports_httpconnect(void *data)
|
|
|
|
{
|
|
|
|
conf_set_opm_scan_ports_all(data, "opm::httpconnect_ports", "httpconnect");
|
|
|
|
}
|
|
|
|
|
2016-04-03 01:37:59 +02:00
|
|
|
static void
|
|
|
|
conf_set_opm_scan_ports_httpsconnect(void *data)
|
|
|
|
{
|
|
|
|
conf_set_opm_scan_ports_all(data, "opm::httpsconnect_ports", "httpsconnect");
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
conf_report_error(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
2016-03-23 15:22:55 +01:00
|
|
|
char msg[BUFSIZE + 1] = { 0 };
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
va_start(ap, fmt);
|
2016-03-23 15:22:55 +01:00
|
|
|
vsnprintf(msg, BUFSIZE, fmt, ap);
|
2007-01-25 07:40:21 +01:00
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
if (testing_conf)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "\"%s\", line %d: %s\n", current_file, lineno + 1, msg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ierror("\"%s\", line %d: %s", current_file, lineno + 1, msg);
|
2016-02-20 00:11:06 +01:00
|
|
|
sendto_realops_snomask(SNO_GENERAL, L_ALL, "error: \"%s\", line %d: %s", current_file, lineno + 1, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
conf_report_warning(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
2016-03-23 15:22:55 +01:00
|
|
|
char msg[BUFSIZE + 1] = { 0 };
|
2016-02-20 00:11:06 +01:00
|
|
|
|
|
|
|
va_start(ap, fmt);
|
2016-03-23 15:22:55 +01:00
|
|
|
vsnprintf(msg, BUFSIZE, fmt, ap);
|
2016-02-20 00:11:06 +01:00
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
if (testing_conf)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "\"%s\", line %d: %s\n", current_file, lineno + 1, msg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
iwarn("\"%s\", line %d: %s", current_file, lineno + 1, msg);
|
|
|
|
sendto_realops_snomask(SNO_GENERAL, L_ALL, "warning: \"%s\", line %d: %s", current_file, lineno + 1, msg);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
conf_start_block(char *block, char *name)
|
|
|
|
{
|
|
|
|
if((conf_cur_block = find_top_conf(block)) == NULL)
|
|
|
|
{
|
|
|
|
conf_report_error("Configuration block '%s' is not defined.", block);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(name)
|
2008-04-02 01:26:34 +02:00
|
|
|
conf_cur_block_name = rb_strdup(name);
|
2007-01-25 07:40:21 +01:00
|
|
|
else
|
|
|
|
conf_cur_block_name = NULL;
|
|
|
|
|
|
|
|
if(conf_cur_block->tc_sfunc)
|
|
|
|
if(conf_cur_block->tc_sfunc(conf_cur_block) < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
conf_end_block(struct TopConf *tc)
|
|
|
|
{
|
2014-03-03 00:31:13 +01:00
|
|
|
int ret = 0;
|
2007-01-25 07:40:21 +01:00
|
|
|
if(tc->tc_efunc)
|
2014-03-03 00:31:13 +01:00
|
|
|
ret = tc->tc_efunc(tc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(conf_cur_block_name);
|
2014-03-03 00:31:13 +01:00
|
|
|
conf_cur_block_name = NULL;
|
|
|
|
return ret;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_generic_int(void *data, void *location)
|
|
|
|
{
|
|
|
|
*((int *) location) = *((unsigned int *) data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
conf_set_generic_string(void *data, int len, void *location)
|
|
|
|
{
|
|
|
|
char **loc = location;
|
|
|
|
char *input = data;
|
|
|
|
|
2008-04-20 15:20:10 +02:00
|
|
|
if(len && strlen(input) > (unsigned int)len)
|
2007-01-25 07:40:21 +01:00
|
|
|
input[len] = '\0';
|
|
|
|
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(*loc);
|
2008-04-02 01:26:34 +02:00
|
|
|
*loc = rb_strdup(input);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2014-02-28 08:02:49 +01:00
|
|
|
conf_call_set(struct TopConf *tc, char *item, conf_parm_t * value)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
struct ConfEntry *cf;
|
|
|
|
conf_parm_t *cp;
|
|
|
|
|
|
|
|
if(!tc)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if((cf = find_conf_item(tc, item)) == NULL)
|
|
|
|
{
|
|
|
|
conf_report_error
|
2016-04-03 05:45:52 +02:00
|
|
|
("Non-existent configuration setting %s::%s.", tc->tc_name, (char *) item);
|
2007-01-25 07:40:21 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if it takes one thing, make sure they only passed one thing,
|
|
|
|
and handle as needed. */
|
2011-01-23 22:56:36 +01:00
|
|
|
if((value->v.list->type & CF_FLIST) && !(cf->cf_type & CF_FLIST))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
conf_report_error
|
|
|
|
("Option %s::%s does not take a list of values.", tc->tc_name, item);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
cp = value->v.list;
|
|
|
|
|
|
|
|
|
|
|
|
if(CF_TYPE(value->v.list->type) != CF_TYPE(cf->cf_type))
|
|
|
|
{
|
2014-03-03 00:34:32 +01:00
|
|
|
/* if it expects a string value, but we got a yesno,
|
2007-01-25 07:40:21 +01:00
|
|
|
* convert it back
|
|
|
|
*/
|
|
|
|
if((CF_TYPE(value->v.list->type) == CF_YESNO) &&
|
|
|
|
(CF_TYPE(cf->cf_type) == CF_STRING))
|
|
|
|
{
|
|
|
|
value->v.list->type = CF_STRING;
|
|
|
|
|
|
|
|
if(cp->v.number == 1)
|
2008-04-02 01:26:34 +02:00
|
|
|
cp->v.string = rb_strdup("yes");
|
2007-01-25 07:40:21 +01:00
|
|
|
else
|
2008-04-02 01:26:34 +02:00
|
|
|
cp->v.string = rb_strdup("no");
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* maybe it's a CF_TIME and they passed CF_INT --
|
|
|
|
should still be valid */
|
|
|
|
else if(!((CF_TYPE(value->v.list->type) == CF_INT) &&
|
|
|
|
(CF_TYPE(cf->cf_type) == CF_TIME)))
|
|
|
|
{
|
|
|
|
conf_report_error
|
|
|
|
("Wrong type for %s::%s (expected %s, got %s)",
|
|
|
|
tc->tc_name, (char *) item,
|
|
|
|
conf_strtype(cf->cf_type), conf_strtype(value->v.list->type));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cf->cf_type & CF_FLIST)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
if(cf->cf_arg)
|
|
|
|
conf_set_generic_list(value->v.list, cf->cf_arg);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
/* just pass it the extended argument list */
|
|
|
|
cf->cf_func(value->v.list);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* it's old-style, needs only one arg */
|
|
|
|
switch (cf->cf_type)
|
|
|
|
{
|
|
|
|
case CF_INT:
|
|
|
|
case CF_TIME:
|
|
|
|
case CF_YESNO:
|
|
|
|
if(cf->cf_arg)
|
|
|
|
conf_set_generic_int(&cp->v.number, cf->cf_arg);
|
|
|
|
else
|
|
|
|
cf->cf_func(&cp->v.number);
|
|
|
|
break;
|
|
|
|
case CF_STRING:
|
|
|
|
case CF_QSTRING:
|
|
|
|
if(EmptyString(cp->v.string))
|
|
|
|
conf_report_error("Ignoring %s::%s -- empty field",
|
|
|
|
tc->tc_name, item);
|
|
|
|
else if(cf->cf_arg)
|
|
|
|
conf_set_generic_string(cp->v.string, cf->cf_len, cf->cf_arg);
|
|
|
|
else
|
|
|
|
cf->cf_func(cp->v.string);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *))
|
|
|
|
{
|
|
|
|
struct TopConf *tc;
|
|
|
|
struct ConfEntry *cf;
|
|
|
|
|
|
|
|
if((tc = find_top_conf(topconf)) == NULL)
|
|
|
|
return -1;
|
|
|
|
|
2014-02-23 23:04:52 +01:00
|
|
|
if(find_conf_item(tc, name) != NULL)
|
2007-01-25 07:40:21 +01:00
|
|
|
return -1;
|
|
|
|
|
2008-04-02 01:07:29 +02:00
|
|
|
cf = rb_malloc(sizeof(struct ConfEntry));
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2007-12-13 00:14:02 +01:00
|
|
|
cf->cf_name = name;
|
2007-01-25 07:40:21 +01:00
|
|
|
cf->cf_type = type;
|
|
|
|
cf->cf_func = func;
|
|
|
|
cf->cf_arg = NULL;
|
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkAddAlloc(cf, &tc->tc_items);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
remove_conf_item(const char *topconf, const char *name)
|
|
|
|
{
|
|
|
|
struct TopConf *tc;
|
|
|
|
struct ConfEntry *cf;
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlink_node *ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if((tc = find_top_conf(topconf)) == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if((cf = find_conf_item(tc, name)) == NULL)
|
|
|
|
return -1;
|
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
if((ptr = rb_dlinkFind(cf, &tc->tc_items)) == NULL)
|
2007-01-25 07:40:21 +01:00
|
|
|
return -1;
|
|
|
|
|
2008-04-01 22:41:52 +02:00
|
|
|
rb_dlinkDestroy(ptr, &tc->tc_items);
|
2008-04-02 00:47:17 +02:00
|
|
|
rb_free(cf);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
static struct ConfEntry conf_serverinfo_table[] =
|
|
|
|
{
|
|
|
|
{ "description", CF_QSTRING, NULL, 0, &ServerInfo.description },
|
|
|
|
|
|
|
|
{ "network_name", CF_QSTRING, conf_set_serverinfo_network_name, 0, NULL },
|
|
|
|
{ "name", CF_QSTRING, conf_set_serverinfo_name, 0, NULL },
|
|
|
|
{ "sid", CF_QSTRING, conf_set_serverinfo_sid, 0, NULL },
|
|
|
|
{ "vhost", CF_QSTRING, conf_set_serverinfo_vhost, 0, NULL },
|
|
|
|
{ "vhost6", CF_QSTRING, conf_set_serverinfo_vhost6, 0, NULL },
|
|
|
|
|
2008-04-13 17:54:23 +02:00
|
|
|
{ "ssl_private_key", CF_QSTRING, NULL, 0, &ServerInfo.ssl_private_key },
|
|
|
|
{ "ssl_ca_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_ca_cert },
|
2014-03-03 00:34:32 +01:00
|
|
|
{ "ssl_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_cert },
|
2008-04-13 17:54:23 +02:00
|
|
|
{ "ssl_dh_params", CF_QSTRING, NULL, 0, &ServerInfo.ssl_dh_params },
|
2015-12-12 14:50:48 +01:00
|
|
|
{ "ssl_cipher_list", CF_QSTRING, NULL, 0, &ServerInfo.ssl_cipher_list },
|
2008-04-06 16:52:42 +02:00
|
|
|
{ "ssld_count", CF_INT, NULL, 0, &ServerInfo.ssld_count },
|
|
|
|
|
2008-04-05 21:56:15 +02:00
|
|
|
{ "default_max_clients",CF_INT, NULL, 0, &ServerInfo.default_max_clients },
|
2007-03-05 19:58:38 +01:00
|
|
|
|
2011-11-29 23:10:21 +01:00
|
|
|
{ "nicklen", CF_INT, conf_set_serverinfo_nicklen, 0, NULL },
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ConfEntry conf_admin_table[] =
|
|
|
|
{
|
|
|
|
{ "name", CF_QSTRING, NULL, 200, &AdminInfo.name },
|
|
|
|
{ "description",CF_QSTRING, NULL, 200, &AdminInfo.description },
|
|
|
|
{ "email", CF_QSTRING, NULL, 200, &AdminInfo.email },
|
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ConfEntry conf_log_table[] =
|
|
|
|
{
|
2011-10-28 16:45:18 +02:00
|
|
|
{ "fname_userlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_userlog },
|
|
|
|
{ "fname_fuserlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_fuserlog },
|
|
|
|
{ "fname_operlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_operlog },
|
|
|
|
{ "fname_foperlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_foperlog },
|
|
|
|
{ "fname_serverlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_serverlog },
|
|
|
|
{ "fname_killlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_killlog },
|
|
|
|
{ "fname_klinelog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_klinelog },
|
|
|
|
{ "fname_operspylog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_operspylog },
|
|
|
|
{ "fname_ioerrorlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_ioerrorlog },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ConfEntry conf_operator_table[] =
|
|
|
|
{
|
|
|
|
{ "rsa_public_key_file", CF_QSTRING, conf_set_oper_rsa_public_key_file, 0, NULL },
|
|
|
|
{ "flags", CF_STRING | CF_FLIST, conf_set_oper_flags, 0, NULL },
|
|
|
|
{ "umodes", CF_STRING | CF_FLIST, conf_set_oper_umodes, 0, NULL },
|
2008-08-17 14:40:27 +02:00
|
|
|
{ "privset", CF_QSTRING, conf_set_oper_privset, 0, NULL },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "snomask", CF_QSTRING, conf_set_oper_snomask, 0, NULL },
|
|
|
|
{ "user", CF_QSTRING, conf_set_oper_user, 0, NULL },
|
|
|
|
{ "password", CF_QSTRING, conf_set_oper_password, 0, NULL },
|
2010-02-17 13:41:41 +01:00
|
|
|
{ "fingerprint", CF_QSTRING, conf_set_oper_fingerprint, 0, NULL },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
2008-08-17 14:10:23 +02:00
|
|
|
static struct ConfEntry conf_privset_table[] =
|
|
|
|
{
|
|
|
|
{ "extends", CF_QSTRING, conf_set_privset_extends, 0, NULL },
|
|
|
|
{ "privs", CF_STRING | CF_FLIST, conf_set_privset_privs, 0, NULL },
|
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static struct ConfEntry conf_class_table[] =
|
|
|
|
{
|
|
|
|
{ "ping_time", CF_TIME, conf_set_class_ping_time, 0, NULL },
|
2008-11-30 13:31:59 +01:00
|
|
|
{ "cidr_ipv4_bitlen", CF_INT, conf_set_class_cidr_ipv4_bitlen, 0, NULL },
|
|
|
|
#ifdef RB_IPV6
|
|
|
|
{ "cidr_ipv6_bitlen", CF_INT, conf_set_class_cidr_ipv6_bitlen, 0, NULL },
|
|
|
|
#endif
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "number_per_cidr", CF_INT, conf_set_class_number_per_cidr, 0, NULL },
|
|
|
|
{ "number_per_ip", CF_INT, conf_set_class_number_per_ip, 0, NULL },
|
|
|
|
{ "number_per_ip_global", CF_INT,conf_set_class_number_per_ip_global, 0, NULL },
|
|
|
|
{ "number_per_ident", CF_INT, conf_set_class_number_per_ident, 0, NULL },
|
|
|
|
{ "connectfreq", CF_TIME, conf_set_class_connectfreq, 0, NULL },
|
|
|
|
{ "max_number", CF_INT, conf_set_class_max_number, 0, NULL },
|
|
|
|
{ "sendq", CF_TIME, conf_set_class_sendq, 0, NULL },
|
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ConfEntry conf_auth_table[] =
|
|
|
|
{
|
|
|
|
{ "user", CF_QSTRING, conf_set_auth_user, 0, NULL },
|
2008-06-26 08:18:58 +02:00
|
|
|
{ "auth_user", CF_QSTRING, conf_set_auth_auth_user, 0, NULL },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "password", CF_QSTRING, conf_set_auth_passwd, 0, NULL },
|
|
|
|
{ "class", CF_QSTRING, conf_set_auth_class, 0, NULL },
|
|
|
|
{ "spoof", CF_QSTRING, conf_set_auth_spoof, 0, NULL },
|
|
|
|
{ "redirserv", CF_QSTRING, conf_set_auth_redir_serv, 0, NULL },
|
|
|
|
{ "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL },
|
|
|
|
{ "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL },
|
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ConfEntry conf_connect_table[] =
|
|
|
|
{
|
|
|
|
{ "send_password", CF_QSTRING, conf_set_connect_send_password, 0, NULL },
|
|
|
|
{ "accept_password", CF_QSTRING, conf_set_connect_accept_password, 0, NULL },
|
2010-12-14 06:14:00 +01:00
|
|
|
{ "fingerprint", CF_QSTRING, conf_set_connect_fingerprint, 0, NULL },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "flags", CF_STRING | CF_FLIST, conf_set_connect_flags, 0, NULL },
|
|
|
|
{ "host", CF_QSTRING, conf_set_connect_host, 0, NULL },
|
|
|
|
{ "vhost", CF_QSTRING, conf_set_connect_vhost, 0, NULL },
|
|
|
|
{ "port", CF_INT, conf_set_connect_port, 0, NULL },
|
|
|
|
{ "aftype", CF_STRING, conf_set_connect_aftype, 0, NULL },
|
|
|
|
{ "hub_mask", CF_QSTRING, conf_set_connect_hub_mask, 0, NULL },
|
|
|
|
{ "leaf_mask", CF_QSTRING, conf_set_connect_leaf_mask, 0, NULL },
|
|
|
|
{ "class", CF_QSTRING, conf_set_connect_class, 0, NULL },
|
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ConfEntry conf_general_table[] =
|
|
|
|
{
|
|
|
|
{ "oper_only_umodes", CF_STRING | CF_FLIST, conf_set_general_oper_only_umodes, 0, NULL },
|
|
|
|
{ "oper_umodes", CF_STRING | CF_FLIST, conf_set_general_oper_umodes, 0, NULL },
|
|
|
|
{ "oper_snomask", CF_QSTRING, conf_set_general_oper_snomask, 0, NULL },
|
|
|
|
{ "compression_level", CF_INT, conf_set_general_compression_level, 0, NULL },
|
|
|
|
{ "havent_read_conf", CF_YESNO, conf_set_general_havent_read_conf, 0, NULL },
|
|
|
|
{ "hide_error_messages",CF_STRING, conf_set_general_hide_error_messages,0, NULL },
|
|
|
|
{ "kline_delay", CF_TIME, conf_set_general_kline_delay, 0, NULL },
|
|
|
|
{ "stats_k_oper_only", CF_STRING, conf_set_general_stats_k_oper_only, 0, NULL },
|
|
|
|
{ "stats_i_oper_only", CF_STRING, conf_set_general_stats_i_oper_only, 0, NULL },
|
|
|
|
{ "default_umodes", CF_QSTRING, conf_set_general_default_umodes, 0, NULL },
|
|
|
|
|
|
|
|
{ "default_operstring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operstring },
|
|
|
|
{ "default_adminstring",CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_adminstring },
|
|
|
|
{ "servicestring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.servicestring },
|
|
|
|
{ "kline_reason", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.kline_reason },
|
|
|
|
{ "identify_service", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.identifyservice },
|
|
|
|
{ "identify_command", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.identifycommand },
|
2015-02-14 10:41:10 +01:00
|
|
|
{ "sasl_service", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.sasl_service },
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
{ "anti_spam_exit_message_time", CF_TIME, NULL, 0, &ConfigFileEntry.anti_spam_exit_message_time },
|
|
|
|
{ "disable_fake_channels", CF_YESNO, NULL, 0, &ConfigFileEntry.disable_fake_channels },
|
|
|
|
{ "min_nonwildcard_simple", CF_INT, NULL, 0, &ConfigFileEntry.min_nonwildcard_simple },
|
|
|
|
{ "non_redundant_klines", CF_YESNO, NULL, 0, &ConfigFileEntry.non_redundant_klines },
|
|
|
|
{ "tkline_expire_notices", CF_YESNO, NULL, 0, &ConfigFileEntry.tkline_expire_notices },
|
|
|
|
|
|
|
|
{ "anti_nick_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.anti_nick_flood },
|
|
|
|
{ "burst_away", CF_YESNO, NULL, 0, &ConfigFileEntry.burst_away },
|
|
|
|
{ "caller_id_wait", CF_TIME, NULL, 0, &ConfigFileEntry.caller_id_wait },
|
|
|
|
{ "client_exit", CF_YESNO, NULL, 0, &ConfigFileEntry.client_exit },
|
|
|
|
{ "collision_fnc", CF_YESNO, NULL, 0, &ConfigFileEntry.collision_fnc },
|
2012-03-25 03:34:45 +02:00
|
|
|
{ "resv_fnc", CF_YESNO, NULL, 0, &ConfigFileEntry.resv_fnc },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "connect_timeout", CF_TIME, NULL, 0, &ConfigFileEntry.connect_timeout },
|
|
|
|
{ "default_floodcount", CF_INT, NULL, 0, &ConfigFileEntry.default_floodcount },
|
2010-04-05 22:29:11 +02:00
|
|
|
{ "default_ident_timeout", CF_INT, NULL, 0, &ConfigFileEntry.default_ident_timeout },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "disable_auth", CF_YESNO, NULL, 0, &ConfigFileEntry.disable_auth },
|
|
|
|
{ "dots_in_ident", CF_INT, NULL, 0, &ConfigFileEntry.dots_in_ident },
|
|
|
|
{ "failed_oper_notice", CF_YESNO, NULL, 0, &ConfigFileEntry.failed_oper_notice },
|
|
|
|
{ "global_snotices", CF_YESNO, NULL, 0, &ConfigFileEntry.global_snotices },
|
|
|
|
{ "hide_spoof_ips", CF_YESNO, NULL, 0, &ConfigFileEntry.hide_spoof_ips },
|
|
|
|
{ "dline_with_reason", CF_YESNO, NULL, 0, &ConfigFileEntry.dline_with_reason },
|
|
|
|
{ "kline_with_reason", CF_YESNO, NULL, 0, &ConfigFileEntry.kline_with_reason },
|
|
|
|
{ "map_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.map_oper_only },
|
|
|
|
{ "max_accept", CF_INT, NULL, 0, &ConfigFileEntry.max_accept },
|
|
|
|
{ "max_monitor", CF_INT, NULL, 0, &ConfigFileEntry.max_monitor },
|
|
|
|
{ "max_nick_time", CF_TIME, NULL, 0, &ConfigFileEntry.max_nick_time },
|
|
|
|
{ "max_nick_changes", CF_INT, NULL, 0, &ConfigFileEntry.max_nick_changes },
|
|
|
|
{ "max_targets", CF_INT, NULL, 0, &ConfigFileEntry.max_targets },
|
|
|
|
{ "min_nonwildcard", CF_INT, NULL, 0, &ConfigFileEntry.min_nonwildcard },
|
|
|
|
{ "nick_delay", CF_TIME, NULL, 0, &ConfigFileEntry.nick_delay },
|
|
|
|
{ "no_oper_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.no_oper_flood },
|
|
|
|
{ "operspy_admin_only", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_admin_only },
|
|
|
|
{ "operspy_dont_care_user_info", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_dont_care_user_info },
|
|
|
|
{ "pace_wait", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait },
|
|
|
|
{ "pace_wait_simple", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait_simple },
|
|
|
|
{ "ping_cookie", CF_YESNO, NULL, 0, &ConfigFileEntry.ping_cookie },
|
|
|
|
{ "reject_after_count", CF_INT, NULL, 0, &ConfigFileEntry.reject_after_count },
|
|
|
|
{ "reject_ban_time", CF_TIME, NULL, 0, &ConfigFileEntry.reject_ban_time },
|
|
|
|
{ "reject_duration", CF_TIME, NULL, 0, &ConfigFileEntry.reject_duration },
|
2008-08-01 01:59:08 +02:00
|
|
|
{ "throttle_count", CF_INT, NULL, 0, &ConfigFileEntry.throttle_count },
|
|
|
|
{ "throttle_duration", CF_TIME, NULL, 0, &ConfigFileEntry.throttle_duration },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "short_motd", CF_YESNO, NULL, 0, &ConfigFileEntry.short_motd },
|
|
|
|
{ "stats_c_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_c_oper_only },
|
|
|
|
{ "stats_e_disabled", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_e_disabled },
|
|
|
|
{ "stats_h_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_h_oper_only },
|
|
|
|
{ "stats_o_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_o_oper_only },
|
|
|
|
{ "stats_P_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_P_oper_only },
|
|
|
|
{ "stats_y_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_y_oper_only },
|
|
|
|
{ "target_change", CF_YESNO, NULL, 0, &ConfigFileEntry.target_change },
|
|
|
|
{ "ts_max_delta", CF_TIME, NULL, 0, &ConfigFileEntry.ts_max_delta },
|
|
|
|
{ "ts_warn_delta", CF_TIME, NULL, 0, &ConfigFileEntry.ts_warn_delta },
|
|
|
|
{ "use_whois_actually", CF_YESNO, NULL, 0, &ConfigFileEntry.use_whois_actually },
|
|
|
|
{ "warn_no_nline", CF_YESNO, NULL, 0, &ConfigFileEntry.warn_no_nline },
|
2010-03-14 17:21:20 +01:00
|
|
|
{ "use_propagated_bans",CF_YESNO, NULL, 0, &ConfigFileEntry.use_propagated_bans },
|
2011-03-27 22:35:26 +02:00
|
|
|
{ "client_flood_max_lines", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_max_lines },
|
|
|
|
{ "client_flood_burst_rate", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_burst_rate },
|
|
|
|
{ "client_flood_burst_max", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_burst_max },
|
|
|
|
{ "client_flood_message_num", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_num },
|
|
|
|
{ "client_flood_message_time", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_time },
|
2012-02-18 04:54:44 +01:00
|
|
|
{ "max_ratelimit_tokens", CF_INT, NULL, 0, &ConfigFileEntry.max_ratelimit_tokens },
|
2012-02-18 16:32:57 +01:00
|
|
|
{ "away_interval", CF_INT, NULL, 0, &ConfigFileEntry.away_interval },
|
2016-01-15 20:38:40 +01:00
|
|
|
{ "hide_opers_in_whois", CF_YESNO, NULL, 0, &ConfigFileEntry.hide_opers_in_whois },
|
2015-12-07 08:49:30 +01:00
|
|
|
{ "certfp_method", CF_STRING, conf_set_general_certfp_method, 0, NULL },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ConfEntry conf_channel_table[] =
|
|
|
|
{
|
|
|
|
{ "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count },
|
|
|
|
{ "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count },
|
|
|
|
{ "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho },
|
|
|
|
{ "kick_on_split_riding", CF_YESNO, NULL, 0, &ConfigChannel.kick_on_split_riding },
|
|
|
|
{ "knock_delay", CF_TIME, NULL, 0, &ConfigChannel.knock_delay },
|
|
|
|
{ "knock_delay_channel",CF_TIME, NULL, 0, &ConfigChannel.knock_delay_channel },
|
|
|
|
{ "max_bans", CF_INT, NULL, 0, &ConfigChannel.max_bans },
|
|
|
|
{ "max_bans_large", CF_INT, NULL, 0, &ConfigChannel.max_bans_large },
|
|
|
|
{ "max_chans_per_user", CF_INT, NULL, 0, &ConfigChannel.max_chans_per_user },
|
2016-01-12 06:32:23 +01:00
|
|
|
{ "max_chans_per_user_large", CF_INT, NULL, 0, &ConfigChannel.max_chans_per_user_large },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "no_create_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_create_on_split },
|
|
|
|
{ "no_join_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_join_on_split },
|
2009-02-22 00:12:21 +01:00
|
|
|
{ "only_ascii_channels", CF_YESNO, NULL, 0, &ConfigChannel.only_ascii_channels },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except },
|
|
|
|
{ "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex },
|
2011-09-25 16:22:29 +02:00
|
|
|
{ "use_forward", CF_YESNO, NULL, 0, &ConfigChannel.use_forward },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock },
|
2009-09-19 21:24:35 +02:00
|
|
|
{ "resv_forcepart", CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart },
|
2010-08-29 01:26:00 +02:00
|
|
|
{ "channel_target_change", CF_YESNO, NULL, 0, &ConfigChannel.channel_target_change },
|
2010-12-21 21:38:04 +01:00
|
|
|
{ "disable_local_channels", CF_YESNO, NULL, 0, &ConfigChannel.disable_local_channels },
|
2015-12-11 22:36:53 +01:00
|
|
|
{ "autochanmodes", CF_QSTRING, conf_set_channel_autochanmodes, 0, NULL },
|
2015-12-27 05:23:28 +01:00
|
|
|
{ "displayed_usercount", CF_INT, NULL, 0, &ConfigChannel.displayed_usercount },
|
2016-01-14 00:03:40 +01:00
|
|
|
{ "strip_topic_colors", CF_YESNO, NULL, 0, &ConfigChannel.strip_topic_colors },
|
2007-01-25 07:40:21 +01:00
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ConfEntry conf_serverhide_table[] =
|
|
|
|
{
|
|
|
|
{ "disable_hidden", CF_YESNO, NULL, 0, &ConfigServerHide.disable_hidden },
|
|
|
|
{ "flatten_links", CF_YESNO, NULL, 0, &ConfigServerHide.flatten_links },
|
|
|
|
{ "hidden", CF_YESNO, NULL, 0, &ConfigServerHide.hidden },
|
|
|
|
{ "links_delay", CF_TIME, conf_set_serverhide_links_delay, 0, NULL },
|
|
|
|
{ "\0", 0, NULL, 0, NULL }
|
|
|
|
};
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
void
|
|
|
|
newconf_init()
|
|
|
|
{
|
|
|
|
add_top_conf("modules", NULL, NULL, NULL);
|
|
|
|
add_conf_item("modules", "path", CF_QSTRING, conf_set_modules_path);
|
|
|
|
add_conf_item("modules", "module", CF_QSTRING, conf_set_modules_module);
|
|
|
|
|
|
|
|
add_top_conf("serverinfo", NULL, NULL, conf_serverinfo_table);
|
|
|
|
add_top_conf("admin", NULL, NULL, conf_admin_table);
|
|
|
|
add_top_conf("log", NULL, NULL, conf_log_table);
|
|
|
|
add_top_conf("operator", conf_begin_oper, conf_end_oper, conf_operator_table);
|
|
|
|
add_top_conf("class", conf_begin_class, conf_end_class, conf_class_table);
|
2008-08-17 14:10:23 +02:00
|
|
|
add_top_conf("privset", NULL, NULL, conf_privset_table);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
add_top_conf("listen", conf_begin_listen, conf_end_listen, NULL);
|
2012-03-17 16:00:39 +01:00
|
|
|
add_conf_item("listen", "defer_accept", CF_YESNO, conf_set_listen_defer_accept);
|
2016-04-02 09:56:03 +02:00
|
|
|
add_conf_item("listen", "wsock", CF_YESNO, conf_set_listen_wsock);
|
2007-01-25 07:40:21 +01:00
|
|
|
add_conf_item("listen", "port", CF_INT | CF_FLIST, conf_set_listen_port);
|
2008-04-06 16:52:42 +02:00
|
|
|
add_conf_item("listen", "sslport", CF_INT | CF_FLIST, conf_set_listen_sslport);
|
2007-01-25 07:40:21 +01:00
|
|
|
add_conf_item("listen", "ip", CF_QSTRING, conf_set_listen_address);
|
|
|
|
add_conf_item("listen", "host", CF_QSTRING, conf_set_listen_address);
|
|
|
|
|
|
|
|
add_top_conf("auth", conf_begin_auth, conf_end_auth, conf_auth_table);
|
|
|
|
|
|
|
|
add_top_conf("shared", conf_cleanup_shared, conf_cleanup_shared, NULL);
|
2014-02-28 08:02:49 +01:00
|
|
|
add_conf_item("shared", "oper", CF_QSTRING | CF_FLIST, conf_set_shared_oper);
|
2007-01-25 07:40:21 +01:00
|
|
|
add_conf_item("shared", "flags", CF_STRING | CF_FLIST, conf_set_shared_flags);
|
|
|
|
|
|
|
|
add_top_conf("connect", conf_begin_connect, conf_end_connect, conf_connect_table);
|
|
|
|
|
|
|
|
add_top_conf("exempt", NULL, NULL, NULL);
|
|
|
|
add_conf_item("exempt", "ip", CF_QSTRING, conf_set_exempt_ip);
|
|
|
|
|
|
|
|
add_top_conf("cluster", conf_cleanup_cluster, conf_cleanup_cluster, NULL);
|
|
|
|
add_conf_item("cluster", "name", CF_QSTRING, conf_set_cluster_name);
|
|
|
|
add_conf_item("cluster", "flags", CF_STRING | CF_FLIST, conf_set_cluster_flags);
|
|
|
|
|
|
|
|
add_top_conf("general", NULL, NULL, conf_general_table);
|
|
|
|
add_top_conf("channel", NULL, NULL, conf_channel_table);
|
|
|
|
add_top_conf("serverhide", NULL, NULL, conf_serverhide_table);
|
|
|
|
|
2012-05-21 23:03:56 +02:00
|
|
|
add_top_conf("service", NULL, NULL, NULL);
|
2007-01-25 07:40:21 +01:00
|
|
|
add_conf_item("service", "name", CF_QSTRING, conf_set_service_name);
|
|
|
|
|
|
|
|
add_top_conf("alias", conf_begin_alias, conf_end_alias, NULL);
|
|
|
|
add_conf_item("alias", "name", CF_QSTRING, conf_set_alias_name);
|
|
|
|
add_conf_item("alias", "target", CF_QSTRING, conf_set_alias_target);
|
|
|
|
|
|
|
|
add_top_conf("blacklist", NULL, NULL, NULL);
|
|
|
|
add_conf_item("blacklist", "host", CF_QSTRING, conf_set_blacklist_host);
|
2011-02-27 22:38:05 +01:00
|
|
|
add_conf_item("blacklist", "type", CF_STRING | CF_FLIST, conf_set_blacklist_type);
|
2013-04-20 23:17:29 +02:00
|
|
|
add_conf_item("blacklist", "matches", CF_QSTRING | CF_FLIST, conf_set_blacklist_matches);
|
2007-01-25 07:40:21 +01:00
|
|
|
add_conf_item("blacklist", "reject_reason", CF_QSTRING, conf_set_blacklist_reason);
|
2016-04-01 11:11:04 +02:00
|
|
|
|
|
|
|
add_top_conf("opm", conf_begin_opm, conf_end_opm, NULL);
|
2016-04-02 10:33:12 +02:00
|
|
|
add_conf_item("opm", "timeout", CF_INT, conf_set_opm_timeout);
|
2016-04-01 11:11:04 +02:00
|
|
|
add_conf_item("opm", "listen_ipv4", CF_QSTRING, conf_set_opm_listen_address_ipv4);
|
|
|
|
add_conf_item("opm", "listen_ipv6", CF_QSTRING, conf_set_opm_listen_address_ipv6);
|
2016-04-02 09:29:48 +02:00
|
|
|
add_conf_item("opm", "port_v4", CF_INT, conf_set_opm_listen_port_ipv4);
|
2016-04-01 11:11:04 +02:00
|
|
|
add_conf_item("opm", "port_v6", CF_INT, conf_set_opm_listen_port_ipv6);
|
|
|
|
add_conf_item("opm", "listen_port", CF_INT, conf_set_opm_listen_port);
|
2016-04-02 09:29:48 +02:00
|
|
|
add_conf_item("opm", "socks4_ports", CF_INT | CF_FLIST, conf_set_opm_scan_ports_socks4);
|
|
|
|
add_conf_item("opm", "socks5_ports", CF_INT | CF_FLIST, conf_set_opm_scan_ports_socks5);
|
2016-04-02 10:11:12 +02:00
|
|
|
add_conf_item("opm", "httpconnect_ports", CF_INT | CF_FLIST, conf_set_opm_scan_ports_httpconnect);
|
2016-04-03 01:37:59 +02:00
|
|
|
add_conf_item("opm", "httpsconnect_ports", CF_INT | CF_FLIST, conf_set_opm_scan_ports_httpsconnect);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|