summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2012-11-04 15:37:10 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2012-11-04 15:37:10 +0000
commit90aeacbf12d63dcd628caed461bd744639603d76 (patch)
tree5eb5c2aa3fd576ac33d84d2911482a3f200c1bea /modules
parent8daa0e2a6fe61e95dc2dd145ebbdb2b05c097196 (diff)
- Initial rewrite of the configuration subsystem
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1632 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules')
-rw-r--r--modules/core/m_nick.c4
-rw-r--r--modules/core/m_server.c22
-rw-r--r--modules/m_challenge.c27
-rw-r--r--modules/m_connect.c67
-rw-r--r--modules/m_dline.c76
-rw-r--r--modules/m_etrace.c3
-rw-r--r--modules/m_gline.c30
-rw-r--r--modules/m_hash.c4
-rw-r--r--modules/m_kline.c76
-rw-r--r--modules/m_locops.c2
-rw-r--r--modules/m_oper.c11
-rw-r--r--modules/m_resv.c60
-rw-r--r--modules/m_set.c9
-rw-r--r--modules/m_stats.c255
-rw-r--r--modules/m_svsmode.c2
-rw-r--r--modules/m_testline.c54
-rw-r--r--modules/m_trace.c21
-rw-r--r--modules/m_xline.c55
18 files changed, 359 insertions, 419 deletions
diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c
index 504f517..8c1d5a8 100644
--- a/modules/core/m_nick.c
+++ b/modules/core/m_nick.c
@@ -221,7 +221,7 @@ mr_nick(struct Client *client_p, struct Client *source_p,
}
/* check if the nick is resv'd */
- if (find_matching_name_conf(NRESV_TYPE, nick, NULL, NULL, 0) &&
+ if (find_matching_name_conf(CONF_NRESV, nick, NULL, NULL, 0) &&
!IsExemptResv(source_p))
{
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name,
@@ -286,7 +286,7 @@ m_nick(struct Client *client_p, struct Client *source_p,
return;
}
- if (find_matching_name_conf(NRESV_TYPE, nick,
+ if (find_matching_name_conf(CONF_NRESV, nick,
NULL, NULL, 0) && !IsExemptResv(source_p) &&
!(HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.oper_pass_resv))
{
diff --git a/modules/core/m_server.c b/modules/core/m_server.c
index 6a2bbf8..a1eb5e7 100644
--- a/modules/core/m_server.c
+++ b/modules/core/m_server.c
@@ -30,7 +30,7 @@
#include "irc_string.h"
#include "ircd.h" /* me */
#include "numeric.h" /* ERR_xxx */
-#include "conf.h" /* struct AccessItem */
+#include "conf.h" /* struct MaskItem */
#include "log.h" /* log level defines */
#include "s_serv.h" /* server_estab, check_server */
#include "s_user.h"
@@ -198,7 +198,7 @@ ms_server(struct Client *client_p, struct Client *source_p,
{
char *name;
struct Client *target_p;
- struct AccessItem *aconf;
+ struct MaskItem *conf = NULL;
int hop;
int hlined = 0;
int llined = 0;
@@ -268,19 +268,19 @@ ms_server(struct Client *client_p, struct Client *source_p,
if (target_p != client_p)
exit_client(target_p, &me, "Overridden");
- aconf = map_to_conf(client_p->localClient->confs.head->data);
+ conf = client_p->localClient->confs.head->data;
/* See if the newly found server is behind a guaranteed
* leaf. If so, close the link.
*/
- DLINK_FOREACH(ptr, aconf->leaf_list.head)
+ DLINK_FOREACH(ptr, conf->leaf_list.head)
if (match(ptr->data, name))
{
llined = 1;
break;
}
- DLINK_FOREACH(ptr, aconf->hub_list.head)
+ DLINK_FOREACH(ptr, conf->hub_list.head)
if (match(ptr->data, name))
{
hlined = 1;
@@ -355,7 +355,7 @@ ms_server(struct Client *client_p, struct Client *source_p,
set_server_gecos(target_p, parv[3]);
SetServer(target_p);
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(SERVICE_TYPE, target_p->name, NULL, NULL, 0))
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_SERVICE, target_p->name, NULL, NULL, 0))
AddFlag(target_p, FLAGS_SERVICE);
dlinkAdd(target_p, &target_p->node, &global_client_list);
@@ -385,7 +385,7 @@ ms_sid(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
struct Client *target_p;
- struct AccessItem *aconf = NULL;
+ struct MaskItem *conf = NULL;
int hlined = 0;
int llined = 0;
dlink_node *ptr = NULL;
@@ -465,19 +465,19 @@ ms_sid(struct Client *client_p, struct Client *source_p,
if (target_p != client_p)
exit_client(target_p, &me, "Overridden");
- aconf = map_to_conf(client_p->localClient->confs.head->data);
+ conf = client_p->localClient->confs.head->data;
/* See if the newly found server is behind a guaranteed
* leaf. If so, close the link.
*/
- DLINK_FOREACH(ptr, aconf->leaf_list.head)
+ DLINK_FOREACH(ptr, conf->leaf_list.head)
if (match(ptr->data, parv[1]))
{
llined = 1;
break;
}
- DLINK_FOREACH(ptr, aconf->hub_list.head)
+ DLINK_FOREACH(ptr, conf->hub_list.head)
if (match(ptr->data, parv[1]))
{
hlined = 1;
@@ -547,7 +547,7 @@ ms_sid(struct Client *client_p, struct Client *source_p,
set_server_gecos(target_p, parv[4]);
SetServer(target_p);
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(SERVICE_TYPE, target_p->name, NULL, NULL, 0))
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_SERVICE, target_p->name, NULL, NULL, 0))
AddFlag(target_p, FLAGS_SERVICE);
dlinkAdd(target_p, &target_p->node, &global_client_list);
diff --git a/modules/m_challenge.c b/modules/m_challenge.c
index 027d143..2327ee7 100644
--- a/modules/m_challenge.c
+++ b/modules/m_challenge.c
@@ -71,8 +71,7 @@ m_challenge(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
char *challenge = NULL;
- struct ConfItem *conf = NULL;
- struct AccessItem *aconf = NULL;
+ struct MaskItem *conf = NULL;
if (*parv[1] == '+')
{
@@ -89,7 +88,7 @@ m_challenge(struct Client *client_p, struct Client *source_p,
return;
}
- conf = find_exact_name_conf(OPER_TYPE, source_p,
+ conf = find_exact_name_conf(CONF_OPER, source_p,
source_p->localClient->auth_oper, NULL, NULL);
if (conf == NULL)
{
@@ -124,25 +123,23 @@ m_challenge(struct Client *client_p, struct Client *source_p,
source_p->localClient->response = NULL;
source_p->localClient->auth_oper = NULL;
- if ((conf = find_conf_exact(OPER_TYPE,
- parv[1], source_p->username, source_p->host
- )) != NULL)
- aconf = map_to_conf(conf);
- else if ((conf = find_conf_exact(OPER_TYPE,
- parv[1], source_p->username,
- source_p->sockhost)) != NULL)
- aconf = map_to_conf(conf);
+ if ((conf = find_conf_exact(CONF_OPER,
+ parv[1], source_p->username, source_p->host)))
+ ;
+ else if ((conf = find_conf_exact(CONF_OPER, parv[1], source_p->username,
+ source_p->sockhost)))
+ ;
- if (aconf == NULL)
+ if (!conf)
{
sendto_one (source_p, form_str(ERR_NOOPERHOST), me.name, source_p->name);
- conf = find_exact_name_conf(OPER_TYPE, NULL, parv[1], NULL, NULL);
+ conf = find_exact_name_conf(CONF_OPER, NULL, parv[1], NULL, NULL);
failed_challenge_notice(source_p, parv[1], (conf != NULL)
? "host mismatch" : "no oper {} block");
return;
}
- if (aconf->rsa_public_key == NULL)
+ if (conf->rsa_public_key == NULL)
{
sendto_one (source_p, ":%s NOTICE %s :I'm sorry, PK authentication "
"is not enabled for your oper{} block.", me.name,
@@ -151,7 +148,7 @@ m_challenge(struct Client *client_p, struct Client *source_p,
}
if (!generate_challenge(&challenge, &(source_p->localClient->response),
- aconf->rsa_public_key))
+ conf->rsa_public_key))
sendto_one(source_p, form_str(RPL_RSACHALLENGE),
me.name, source_p->name, challenge);
diff --git a/modules/m_connect.c b/modules/m_connect.c
index 10870e1..b769d8b 100644
--- a/modules/m_connect.c
+++ b/modules/m_connect.c
@@ -55,8 +55,7 @@ mo_connect(struct Client *client_p, struct Client *source_p,
{
int port;
int tmpport;
- struct ConfItem *conf = NULL;
- struct AccessItem *aconf = NULL;
+ struct MaskItem *conf = NULL;
const struct Client *target_p = NULL;
if (EmptyString(parv[1]))
@@ -91,14 +90,12 @@ mo_connect(struct Client *client_p, struct Client *source_p,
/*
* try to find the name, then host, if both fail notify ops and bail
*/
- if ((conf = find_matching_name_conf(SERVER_TYPE,
- parv[1], NULL, NULL, 0)) != NULL)
- aconf = (struct AccessItem *)map_to_conf(conf);
- else if ((conf = find_matching_name_conf(SERVER_TYPE,
- NULL, NULL, parv[1], 0)) != NULL)
- aconf = (struct AccessItem *)map_to_conf(conf);
-
- if (conf == NULL || aconf == NULL)
+ if ((conf = find_matching_name_conf(CONF_SERVER, parv[1], NULL, NULL, 0)))
+ ;
+ else if ((conf = find_matching_name_conf(CONF_SERVER, NULL, NULL, parv[1], 0)))
+ ;
+
+ if (!conf)
{
sendto_one(source_p,
":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
@@ -110,7 +107,7 @@ mo_connect(struct Client *client_p, struct Client *source_p,
* use the default form configuration structure. If missing
* from there, then use the precompiled default.
*/
- tmpport = port = aconf->port;
+ tmpport = port = conf->port;
if (parc > 2 && !EmptyString(parv[2]))
{
@@ -141,31 +138,31 @@ mo_connect(struct Client *client_p, struct Client *source_p,
ilog(LOG_TYPE_IRCD, "CONNECT From %s : %s %s",
source_p->name, parv[1], parv[2] ? parv[2] : "");
- aconf->port = port;
+ conf->port = port;
/* at this point we should be calling connect_server with a valid
* C:line and a valid port in the C:line
*/
- if (serv_connect(aconf, source_p))
+ if (serv_connect(conf, source_p))
{
if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN))
sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s[%s].%d",
- me.name, source_p->name, aconf->host,
- conf->name, aconf->port);
+ me.name, source_p->name, conf->host,
+ conf->name, conf->port);
else
sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s.%d",
- me.name, source_p->name, conf->name, aconf->port);
+ me.name, source_p->name, conf->name, conf->port);
}
else
{
sendto_one(source_p, ":%s NOTICE %s :*** Couldn't connect to %s.%d",
- me.name, source_p->name, conf->name, aconf->port);
+ me.name, source_p->name, conf->name, conf->port);
}
/* client is either connecting with all the data it needs or has been
* destroyed
*/
- aconf->port = tmpport;
+ conf->port = tmpport;
}
/*
@@ -185,8 +182,7 @@ ms_connect(struct Client *client_p, struct Client *source_p,
{
int port;
int tmpport;
- struct ConfItem *conf = NULL;
- struct AccessItem *aconf = NULL;
+ struct MaskItem *conf = NULL;
const struct Client *target_p = NULL;
if (hunt_server(client_p, source_p,
@@ -211,14 +207,13 @@ ms_connect(struct Client *client_p, struct Client *source_p,
/*
* try to find the name, then host, if both fail notify ops and bail
*/
- if ((conf = find_matching_name_conf(SERVER_TYPE,
- parv[1], NULL, NULL, 0)) != NULL)
- aconf = map_to_conf(conf);
- else if ((conf = find_matching_name_conf(SERVER_TYPE,
- NULL, NULL, parv[1], 0)) != NULL)
- aconf = map_to_conf(conf);
-
- if (conf == NULL || aconf == NULL)
+
+ if ((conf = find_matching_name_conf(CONF_SERVER, parv[1], NULL, NULL, 0)))
+ ;
+ else if ((conf = find_matching_name_conf(CONF_SERVER, NULL, NULL, parv[1], 0)))
+ ;
+
+ if (!conf)
{
sendto_one(source_p,
":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
@@ -230,15 +225,15 @@ ms_connect(struct Client *client_p, struct Client *source_p,
* use the default form configuration structure. If missing
* from there, then use the precompiled default.
*/
- tmpport = port = aconf->port;
+ tmpport = port = conf->port;
if (parc > 2 && !EmptyString(parv[2]))
{
port = atoi(parv[2]);
/* if someone sends port 0, and we have a config port.. use it */
- if (port == 0 && aconf->port)
- port = aconf->port;
+ if (port == 0 && conf->port)
+ port = conf->port;
else if (port <= 0)
{
sendto_one(source_p, ":%s NOTICE %s :Connect: Illegal port number",
@@ -275,23 +270,23 @@ ms_connect(struct Client *client_p, struct Client *source_p,
ilog(LOG_TYPE_IRCD, "CONNECT From %s : %s %d",
source_p->name, parv[1], port);
- aconf->port = port;
+ conf->port = port;
/*
* At this point we should be calling connect_server with a valid
* C:line and a valid port in the C:line
*/
- if (serv_connect(aconf, source_p))
+ if (serv_connect(conf, source_p))
sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s.%d",
- me.name, source_p->name, conf->name, aconf->port);
+ me.name, source_p->name, conf->name, conf->port);
else
sendto_one(source_p, ":%s NOTICE %s :*** Couldn't connect to %s.%d",
- me.name, source_p->name, conf->name, aconf->port);
+ me.name, source_p->name, conf->name, conf->port);
/*
* Client is either connecting with all the data it needs or has been
* destroyed
*/
- aconf->port = tmpport;
+ conf->port = tmpport;
}
static struct Message connect_msgtab = {
diff --git a/modules/m_dline.c b/modules/m_dline.c
index f66917c..c375707 100644
--- a/modules/m_dline.c
+++ b/modules/m_dline.c
@@ -28,12 +28,12 @@
#include "client.h"
#include "irc_string.h"
#include "sprintf_irc.h"
+#include "conf.h"
#include "ircd.h"
#include "hostmask.h"
#include "numeric.h"
#include "fdlist.h"
#include "s_bsd.h"
-#include "conf.h"
#include "log.h"
#include "s_misc.h"
#include "send.h"
@@ -51,38 +51,38 @@
* side effects - tkline as given is placed
*/
static void
-apply_dline(struct Client *source_p, struct AccessItem *aconf,
+apply_dline(struct Client *source_p, struct MaskItem *conf,
time_t tkline_time)
{
if (tkline_time)
{
- aconf->hold = CurrentTime + tkline_time;
+ conf->hold = CurrentTime + tkline_time;
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s added temporary %d min. D-Line for [%s] [%s]",
get_oper_name(source_p), tkline_time/60,
- aconf->host, aconf->reason);
+ conf->host, conf->reason);
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]",
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
- source_p->name, tkline_time/60, aconf->host);
+ source_p->name, tkline_time/60, conf->host);
ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]",
- get_oper_name(source_p), tkline_time/60, aconf->host, aconf->reason);
+ get_oper_name(source_p), tkline_time/60, conf->host, conf->reason);
}
else
{
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s added D-Line for [%s] [%s]",
- get_oper_name(source_p), aconf->host, aconf->reason);
+ get_oper_name(source_p), conf->host, conf->reason);
sendto_one(source_p, ":%s NOTICE %s :Added D-Line [%s]",
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
- source_p->name, aconf->host);
+ source_p->name, conf->host);
ilog(LOG_TYPE_DLINE, "%s added D-Line for [%s] [%s]",
- get_oper_name(source_p), aconf->host, aconf->reason);
+ get_oper_name(source_p), conf->host, conf->reason);
}
- SetConfDatabase(aconf);
- aconf->setat = CurrentTime;
- add_conf_by_address(CONF_DLINE, aconf);
+ SetConfDatabase(conf);
+ conf->setat = CurrentTime;
+ add_conf_by_address(CONF_DLINE, conf);
rehashed_klines = 1;
}
@@ -95,7 +95,7 @@ static int
remove_dline_match(const char *host)
{
struct irc_ssaddr iphost, *piphost;
- struct AccessItem *aconf;
+ struct MaskItem *conf;
int t;
if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
@@ -114,11 +114,11 @@ remove_dline_match(const char *host)
piphost = NULL;
}
- if ((aconf = find_conf_by_address(host, piphost, CONF_DLINE, t, NULL, NULL, 0)))
+ if ((conf = find_conf_by_address(host, piphost, CONF_DLINE, t, NULL, NULL, 0)))
{
- if (IsConfDatabase(aconf))
+ if (IsConfDatabase(conf))
{
- delete_one_address_conf(host, aconf);
+ delete_one_address_conf(host, conf);
return 1;
}
}
@@ -146,7 +146,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
const char *creason;
const struct Client *target_p = NULL;
struct irc_ssaddr daddr;
- struct AccessItem *aconf=NULL;
+ struct MaskItem *conf=NULL;
time_t tkline_time=0;
int bits, t;
const char *current_date = NULL;
@@ -238,17 +238,17 @@ mo_dline(struct Client *client_p, struct Client *source_p,
parse_netmask(dlhost, &daddr, NULL);
- if ((aconf = find_dline_conf(&daddr, t)) != NULL)
+ if ((conf = find_dline_conf(&daddr, t)) != NULL)
{
- creason = aconf->reason ? aconf->reason : def_reason;
- if (IsConfExemptKline(aconf))
+ creason = conf->reason ? conf->reason : def_reason;
+ if (IsConfExemptKline(conf))
sendto_one(source_p,
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
- me.name, source_p->name, dlhost, aconf->host, creason);
+ me.name, source_p->name, dlhost, conf->host, creason);
else
sendto_one(source_p,
":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
- me.name, source_p->name, dlhost, aconf->host, creason);
+ me.name, source_p->name, dlhost, conf->host, creason);
return;
}
@@ -258,8 +258,8 @@ mo_dline(struct Client *client_p, struct Client *source_p,
if (!valid_comment(source_p, reason, 1))
return;
- aconf = map_to_conf(make_conf_item(DLINE_TYPE));
- DupString(aconf->host, dlhost);
+ conf = conf_make(CONF_DLINE);
+ DupString(conf->host, dlhost);
if (tkline_time != 0)
snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)",
@@ -267,8 +267,8 @@ mo_dline(struct Client *client_p, struct Client *source_p,
else
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
- DupString(aconf->reason, buffer);
- apply_dline(source_p, aconf, tkline_time);
+ DupString(conf->reason, buffer);
+ apply_dline(source_p, conf, tkline_time);
rehashed_klines = 1;
}
@@ -281,7 +281,7 @@ ms_dline(struct Client *client_p, struct Client *source_p,
const char *creason;
const struct Client *target_p = NULL;
struct irc_ssaddr daddr;
- struct AccessItem *aconf=NULL;
+ struct MaskItem *conf=NULL;
time_t tkline_time=0;
int bits, t;
const char *current_date = NULL;
@@ -305,7 +305,7 @@ ms_dline(struct Client *client_p, struct Client *source_p,
dlhost = parv[3];
reason = parv[4];
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
source_p->username, source_p->host,
SHARED_DLINE))
{
@@ -357,17 +357,17 @@ ms_dline(struct Client *client_p, struct Client *source_p,
parse_netmask(dlhost, &daddr, NULL);
- if ((aconf = find_dline_conf(&daddr, t)) != NULL)
+ if ((conf = find_dline_conf(&daddr, t)) != NULL)
{
- creason = aconf->reason ? aconf->reason : def_reason;
- if (IsConfExemptKline(aconf))
+ creason = conf->reason ? conf->reason : def_reason;
+ if (IsConfExemptKline(conf))
sendto_one(source_p,
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
- me.name, source_p->name, dlhost, aconf->host, creason);
+ me.name, source_p->name, dlhost, conf->host, creason);
else
sendto_one(source_p,
":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
- me.name, source_p->name, dlhost, aconf->host, creason);
+ me.name, source_p->name, dlhost, conf->host, creason);
return;
}
@@ -377,8 +377,8 @@ ms_dline(struct Client *client_p, struct Client *source_p,
if (!valid_comment(source_p, reason, 1))
return;
- aconf = map_to_conf(make_conf_item(DLINE_TYPE));
- DupString(aconf->host, dlhost);
+ conf = conf_make(CONF_DLINE);
+ DupString(conf->host, dlhost);
if (tkline_time != 0)
snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)",
@@ -386,8 +386,8 @@ ms_dline(struct Client *client_p, struct Client *source_p,
else
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
- DupString(aconf->reason, buffer);
- apply_dline(source_p, aconf, tkline_time);
+ DupString(conf->reason, buffer);
+ apply_dline(source_p, conf, tkline_time);
rehashed_klines = 1;
}
}
@@ -469,7 +469,7 @@ me_undline(struct Client *client_p, struct Client *source_p,
if (!IsClient(source_p) || !match(parv[1], me.name))
return;
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE,
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE,
source_p->servptr->name,
source_p->username, source_p->host,
SHARED_UNDLINE))
diff --git a/modules/m_etrace.c b/modules/m_etrace.c
index 8a3421b..b98d8e3 100644
--- a/modules/m_etrace.c
+++ b/modules/m_etrace.c
@@ -36,6 +36,7 @@
#include "parse.h"
#include "modules.h"
#include "conf.h"
+#include "conf_class.h"
static void report_this_status(struct Client *, struct Client *, int);
@@ -142,7 +143,7 @@ report_this_status(struct Client *source_p, struct Client *target_p,
const char *class_name;
name = get_client_name(target_p, HIDE_IP);
- class_name = get_client_class(target_p);
+ class_name = get_client_class(&target_p->localClient->confs);
set_time();
diff --git a/modules/m_gline.c b/modules/m_gline.c
index 6e6b894..f0e18b5 100644
--- a/modules/m_gline.c
+++ b/modules/m_gline.c
@@ -32,10 +32,10 @@
#include "irc_string.h"
#include "sprintf_irc.h"
#include "ircd.h"
+#include "conf.h"
#include "hostmask.h"
#include "numeric.h"
#include "s_bsd.h"
-#include "conf.h"
#include "s_misc.h"
#include "send.h"
#include "s_serv.h"
@@ -62,25 +62,25 @@ set_local_gline(const struct Client *source_p, const char *user,
const char *host, const char *reason)
{
char buffer[IRCD_BUFSIZE];
- struct AccessItem *aconf = map_to_conf(make_conf_item(GLINE_TYPE));
+ struct MaskItem *conf = conf_make(CONF_GLINE);
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, smalldate(CurrentTime));
- DupString(aconf->reason, buffer);
- DupString(aconf->user, user);
- DupString(aconf->host, host);
+ DupString(conf->reason, buffer);
+ DupString(conf->user, user);
+ DupString(conf->host, host);
- aconf->setat = CurrentTime;
- aconf->hold = CurrentTime + ConfigFileEntry.gline_time;
- SetConfDatabase(aconf);
+ conf->setat = CurrentTime;
+ conf->hold = CurrentTime + ConfigFileEntry.gline_time;
+ SetConfDatabase(conf);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s added G-Line for [%s@%s] [%s]",
get_oper_name(source_p),
- aconf->user, aconf->host, aconf->reason);
+ conf->user, conf->host, conf->reason);
ilog(LOG_TYPE_GLINE, "%s added G-Line for [%s@%s] [%s]",
- get_oper_name(source_p), aconf->user, aconf->host, aconf->reason);
+ get_oper_name(source_p), conf->user, conf->host, conf->reason);
- add_conf_by_address(CONF_GLINE, aconf);
+ add_conf_by_address(CONF_GLINE, conf);
rehashed_klines = 1;
}
@@ -93,7 +93,7 @@ static int
remove_gline_match(const char *user, const char *host)
{
struct irc_ssaddr iphost, *piphost;
- struct AccessItem *aconf;
+ struct MaskItem *conf;
int t;
if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
@@ -112,11 +112,11 @@ remove_gline_match(const char *user, const char *host)
piphost = NULL;
}
- if ((aconf = find_conf_by_address(host, piphost, CONF_GLINE, t, user, NULL, 0)))
+ if ((conf = find_conf_by_address(host, piphost, CONF_GLINE, t, user, NULL, 0)))
{
- if (IsConfDatabase(aconf))
+ if (IsConfDatabase(conf))
{
- delete_one_address_conf(host, aconf);
+ delete_one_address_conf(host, conf);
return 1;
}
}
diff --git a/modules/m_hash.c b/modules/m_hash.c
index 89bc89b..ddf7d51 100644
--- a/modules/m_hash.c
+++ b/modules/m_hash.c
@@ -32,7 +32,7 @@
#include "parse.h"
#include "modules.h"
#include "s_user.h"
-#include "resv.h"
+#include "conf.h"
#include "userhost.h"
@@ -48,7 +48,7 @@ mo_hash(struct Client *client_p, struct Client *source_p,
struct Client *icl;
struct Channel *ch;
struct UserHost *ush;
- struct ResvChannel *rch;
+ struct MaskItem *rch;
for (i = 0; i < HASHSIZE; ++i)
{
diff --git a/modules/m_kline.c b/modules/m_kline.c
index 0964f93..513b860 100644
--- a/modules/m_kline.c
+++ b/modules/m_kline.c
@@ -29,11 +29,11 @@
#include "irc_string.h"
#include "sprintf_irc.h"
#include "ircd.h"
+#include "conf.h"
#include "hostmask.h"
#include "numeric.h"
#include "fdlist.h"
#include "s_bsd.h"
-#include "conf.h"
#include "log.h"
#include "s_misc.h"
#include "send.h"
@@ -46,7 +46,7 @@
static int already_placed_kline(struct Client *, const char *, const char *, int);
-static void m_kline_add_kline(struct Client *, struct AccessItem *, time_t);
+static void m_kline_add_kline(struct Client *, struct MaskItem *, time_t);
static char buffer[IRCD_BUFSIZE];
static int remove_kline_match(const char *, const char *);
@@ -70,7 +70,7 @@ mo_kline(struct Client *client_p, struct Client *source_p,
char *host = NULL;
const char *current_date;
char *target_server = NULL;
- struct AccessItem *aconf;
+ struct MaskItem *conf;
time_t tkline_time = 0;
time_t cur_time;
@@ -117,10 +117,10 @@ mo_kline(struct Client *client_p, struct Client *source_p,
cur_time = CurrentTime;
current_date = smalldate(cur_time);
- aconf = map_to_conf(make_conf_item(KLINE_TYPE));
+ conf = conf_make(CONF_KLINE);
- DupString(aconf->host, host);
- DupString(aconf->user, user);
+ DupString(conf->host, host);
+ DupString(conf->user, user);
if (tkline_time != 0)
snprintf(buffer, sizeof(buffer), "Temporary K-line %d min. - %s (%s)",
@@ -128,8 +128,8 @@ mo_kline(struct Client *client_p, struct Client *source_p,
else
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
- DupString(aconf->reason, buffer);
- m_kline_add_kline(source_p, aconf, tkline_time);
+ DupString(conf->reason, buffer);
+ m_kline_add_kline(source_p, conf, tkline_time);
}
/* me_kline - handle remote kline. no propagation */
@@ -137,7 +137,7 @@ static void
me_kline(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
- struct AccessItem *aconf = NULL;
+ struct MaskItem *conf = NULL;
int tkline_time = 0;
const char* current_date;
time_t cur_time;
@@ -157,7 +157,7 @@ me_kline(struct Client *client_p, struct Client *source_p,
cur_time = CurrentTime;
current_date = smalldate(cur_time);
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
source_p->username, source_p->host,
SHARED_KLINE))
{
@@ -165,9 +165,9 @@ me_kline(struct Client *client_p, struct Client *source_p,
already_placed_kline(source_p, kuser, khost, 1))
return;
- aconf = map_to_conf(make_conf_item(KLINE_TYPE));
- DupString(aconf->host, khost);
- DupString(aconf->user, kuser);
+ conf = conf_make(CONF_KLINE);
+ DupString(conf->host, khost);
+ DupString(conf->user, kuser);
if (tkline_time != 0)
snprintf(buffer, sizeof(buffer), "Temporary K-line %d min. - %s (%s)",
@@ -175,8 +175,8 @@ me_kline(struct Client *client_p, struct Client *source_p,
else
snprintf(buffer, sizeof(buffer), "%s (%s)", kreason, current_date);
- DupString(aconf->reason, buffer);
- m_kline_add_kline(source_p, aconf, tkline_time);
+ DupString(conf->reason, buffer);
+ m_kline_add_kline(source_p, conf, tkline_time);
}
}
@@ -203,41 +203,41 @@ ms_kline(struct Client *client_p, struct Client *source_p,
* side effects - tkline as given is placed
*/
static void
-m_kline_add_kline(struct Client *source_p, struct AccessItem *aconf,
+m_kline_add_kline(struct Client *source_p, struct MaskItem *conf,
time_t tkline_time)
{
if (tkline_time)
{
- aconf->hold = CurrentTime + tkline_time;
+ conf->hold = CurrentTime + tkline_time;
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s added temporary %d min. K-Line for [%s@%s] [%s]",
get_oper_name(source_p), tkline_time/60,
- aconf->user, aconf->host,
- aconf->reason);
+ conf->user, conf->host,
+ conf->reason);
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. K-Line [%s@%s]",
- MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
- source_p->name, tkline_time/60, aconf->user, aconf->host);
+ MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
+ source_p->name, tkline_time/60, conf->user, conf->host);
ilog(LOG_TYPE_KLINE, "%s added temporary %d min. K-Line for [%s@%s] [%s]",
source_p->name, tkline_time/60,
- aconf->user, aconf->host, aconf->reason);
+ conf->user, conf->host, conf->reason);
}
else
{
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s added K-Line for [%s@%s] [%s]",
get_oper_name(source_p),
- aconf->user, aconf->host, aconf->reason);
+ conf->user, conf->host, conf->reason);
sendto_one(source_p, ":%s NOTICE %s :Added K-Line [%s@%s]",
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
- source_p->name, aconf->user, aconf->host);
+ source_p->name, conf->user, conf->host);
ilog(LOG_TYPE_KLINE, "%s added K-Line for [%s@%s] [%s]",
- source_p->name, aconf->user, aconf->host, aconf->reason);
+ source_p->name, conf->user, conf->host, conf->reason);
}
- aconf->setat = CurrentTime;
- SetConfDatabase(aconf);
+ conf->setat = CurrentTime;
+ SetConfDatabase(conf);
- add_conf_by_address(CONF_KLINE, aconf);
+ add_conf_by_address(CONF_KLINE, conf);
rehashed_klines = 1;
}
@@ -256,7 +256,7 @@ already_placed_kline(struct Client *source_p, const char *luser, const char *lho
{
const char *reason;
struct irc_ssaddr iphost, *piphost;
- struct AccessItem *aconf;
+ struct MaskItem *conf = NULL;
int t;
if ((t = parse_netmask(lhost, &iphost, &t)) != HM_HOST)
@@ -275,15 +275,15 @@ already_placed_kline(struct Client *source_p, const char *luser, const char *lho
piphost = NULL;
}
- if ((aconf = find_conf_by_address(lhost, piphost, CONF_KLINE, t, luser, NULL, 0)))
+ if ((conf = find_conf_by_address(lhost, piphost, CONF_KLINE, t, luser, NULL, 0)))
{
if (warn)
{
- reason = aconf->reason ? aconf->reason : "No reason";
+ reason = conf->reason ? conf->reason : "No reason";
sendto_one(source_p,
":%s NOTICE %s :[%s@%s] already K-Lined by [%s@%s] - %s",
- me.name, source_p->name, luser, lhost, aconf->user,
- aconf->host, reason);
+ me.name, source_p->name, luser, lhost, conf->user,
+ conf->host, reason);
}
return 1;
@@ -382,7 +382,7 @@ me_unkline(struct Client *client_p, struct Client *source_p,
if (!IsClient(source_p) || !match(parv[1], me.name))
return;
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE,
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE,
source_p->servptr->name,
source_p->username, source_p->host,
SHARED_UNKLINE))
@@ -428,7 +428,7 @@ static int
remove_kline_match(const char *host, const char *user)
{
struct irc_ssaddr iphost, *piphost;
- struct AccessItem *aconf;
+ struct MaskItem *conf = NULL;
int t;
if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
@@ -447,11 +447,11 @@ remove_kline_match(const char *host, const char *user)
piphost = NULL;
}
- if ((aconf = find_conf_by_address(host, piphost, CONF_KLINE, t, user, NULL, 0)))
+ if ((conf = find_conf_by_address(host, piphost, CONF_KLINE, t, user, NULL, 0)))
{
- if (IsConfDatabase(aconf))
+ if (IsConfDatabase(conf))
{
- delete_one_address_conf(host, aconf);
+ delete_one_address_conf(host, conf);
return 1;
}
}
diff --git a/modules/m_locops.c b/modules/m_locops.c
index 534758f..99fe736 100644
--- a/modules/m_locops.c
+++ b/modules/m_locops.c
@@ -74,7 +74,7 @@ ms_locops(struct Client *client_p, struct Client *source_p,
if (!IsClient(source_p) || !match(parv[1], me.name))
return;
- if (find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
+ if (find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
"*", "*", SHARED_LOCOPS))
sendto_wallops_flags(UMODE_LOCOPS, source_p, "SLOCOPS - %s", parv[2]);
}
diff --git a/modules/m_oper.c b/modules/m_oper.c
index d58c11b..9aef1bc 100644
--- a/modules/m_oper.c
+++ b/modules/m_oper.c
@@ -71,8 +71,7 @@ static void
m_oper(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
- struct ConfItem *conf;
- struct AccessItem *aconf=NULL;
+ struct MaskItem *conf = NULL;
const char *name = parv[1];
const char *password = parv[2];
@@ -87,18 +86,16 @@ m_oper(struct Client *client_p, struct Client *source_p,
if (!IsFloodDone(source_p))
flood_endgrace(source_p);
- if ((conf = find_exact_name_conf(OPER_TYPE, source_p, name, NULL, NULL)) == NULL)
+ if ((conf = find_exact_name_conf(CONF_OPER, source_p, name, NULL, NULL)) == NULL)
{
sendto_one(source_p, form_str(ERR_NOOPERHOST), me.name, source_p->name);
- conf = find_exact_name_conf(OPER_TYPE, NULL, name, NULL, NULL);
+ conf = find_exact_name_conf(CONF_OPER, NULL, name, NULL, NULL);
failed_oper_notice(source_p, name, (conf != NULL) ?
"host mismatch" : "no oper {} block");
return;
}
- aconf = map_to_conf(conf);
-
- if (match_conf_password(password, aconf))
+ if (match_conf_password(password, conf))
{
if (attach_conf(source_p, conf) != 0)
{
diff --git a/modules/m_resv.c b/modules/m_resv.c
index ba0e540..2fcbf88 100644
--- a/modules/m_resv.c
+++ b/modules/m_resv.c
@@ -140,7 +140,7 @@ ms_resv(struct Client *client_p, struct Client *source_p,
if (!IsClient(source_p) || !match(parv[1], me.name))
return;
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
source_p->username, source_p->host,
SHARED_RESV))
parse_resv(source_p, parv[2], 0, parv[3]);
@@ -199,7 +199,7 @@ ms_unresv(struct Client *client_p, struct Client *source_p,
if (!IsClient(source_p) || !match(parv[1], me.name))
return;
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
source_p->username, source_p->host,
SHARED_UNRESV))
remove_resv(source_p, parv[2]);
@@ -217,11 +217,9 @@ ms_unresv(struct Client *client_p, struct Client *source_p,
static void
parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
{
- struct ConfItem *conf = NULL;
-
if (IsChanPrefix(*name))
{
- struct ResvChannel *resv_p;
+ struct MaskItem *conf = NULL;
if ((conf = create_channel_resv(name, reason, 0)) == NULL)
{
@@ -231,9 +229,8 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
return;
}
- resv_p = map_to_conf(conf);
- resv_p->setat = CurrentTime;
- SetConfDatabase(resv_p);
+ conf->setat = CurrentTime;
+ SetConfDatabase(conf);
if (tkline_time != 0)
{
@@ -247,11 +244,11 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
get_oper_name(source_p),
tkline_time/60,
(MyClient(source_p) ? "local" : "remote"),
- resv_p->name, resv_p->reason);
+ conf->name, conf->reason);
ilog(LOG_TYPE_IRCD, "%s added temporary %d min. RESV for [%s] [%s]",
source_p->name, (int)tkline_time/60,
- conf->name, resv_p->reason);
- resv_p->hold = CurrentTime + tkline_time;
+ conf->name, conf->reason);
+ conf->hold = CurrentTime + tkline_time;
}
else
{
@@ -263,12 +260,12 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
"%s has placed a %s RESV on channel %s : [%s]",
get_oper_name(source_p),
(MyClient(source_p) ? "local" : "remote"),
- resv_p->name, resv_p->reason);
+ conf->name, conf->reason);
}
}
else
{
- struct MatchItem *resv_p = NULL;
+ struct MaskItem *conf = NULL;
if (!valid_wild_card_simple(name))
{
@@ -292,9 +289,8 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
return;
}
- resv_p = map_to_conf(conf);
- resv_p->setat = CurrentTime;
- SetConfDatabase(resv_p);
+ conf->setat = CurrentTime;
+ SetConfDatabase(conf);
if (tkline_time != 0)
{
@@ -303,17 +299,17 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
me.name, source_p->name,
tkline_time/60,
(MyClient(source_p) ? "local" : "remote"),
- conf->name, resv_p->reason);
+ conf->name, conf->reason);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s has placed a %d minute %s RESV on nick %s : [%s]",
get_oper_name(source_p),
tkline_time/60,
(MyClient(source_p) ? "local" : "remote"),
- conf->name, resv_p->reason);
+ conf->name, conf->reason);
ilog(LOG_TYPE_IRCD, "%s added temporary %d min. RESV for [%s] [%s]",
source_p->name, (int)tkline_time/60,
- conf->name, resv_p->reason);
- resv_p->hold = CurrentTime + tkline_time;
+ conf->name, conf->reason);
+ conf->hold = CurrentTime + tkline_time;
}
else
{
@@ -321,12 +317,12 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
":%s NOTICE %s :A %s RESV has been placed on nick %s : [%s]",
me.name, source_p->name,
(MyClient(source_p) ? "local" : "remote"),
- conf->name, resv_p->reason);
+ conf->name, conf->reason);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s has placed a %s RESV on nick %s : [%s]",
get_oper_name(source_p),
(MyClient(source_p) ? "local" : "remote"),
- conf->name, resv_p->reason);
+ conf->name, conf->reason);
}
}
}
@@ -334,14 +330,12 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
static void
remove_resv(struct Client *source_p, const char *name)
{
- struct ConfItem *conf = NULL;
+ struct MaskItem *conf = NULL;
if (IsChanPrefix(*name))
{
- struct ResvChannel *resv_p;
-
if (resv_channel_list.head == NULL ||
- !(resv_p = hash_find_resv(name)))
+ !(conf = hash_find_resv(name)))
{
sendto_one(source_p,
":%s NOTICE %s :A RESV does not exist for channel: %s",
@@ -349,7 +343,7 @@ remove_resv(struct Client *source_p, const char *name)
return;
}
- if (!IsConfDatabase(resv_p))
+ if (!IsConfDatabase(conf))
{
sendto_one(source_p,
":%s NOTICE %s :The RESV for channel: %s is in ircd.conf and must be removed by hand.",
@@ -357,7 +351,7 @@ remove_resv(struct Client *source_p, const char *name)
return;
}
- delete_channel_resv(resv_p);
+ delete_channel_resv(conf);
sendto_one(source_p,
":%s NOTICE %s :The RESV has been removed on channel: %s",
me.name, source_p->name, name);
@@ -367,18 +361,14 @@ remove_resv(struct Client *source_p, const char *name)
}
else
{
- struct MatchItem *resv_p = NULL;
-
- if ((conf = find_exact_name_conf(NRESV_TYPE, NULL, name, NULL, NULL)) == NULL)
+ if ((conf = find_exact_name_conf(CONF_NRESV, NULL, name, NULL, NULL)) == NULL)
{
sendto_one(source_p, ":%s NOTICE %s :A RESV does not exist for nick: %s",
me.name, source_p->name, name);
return;
}
- resv_p = map_to_conf(conf);
-
- if (!IsConfDatabase(resv_p))
+ if (!IsConfDatabase(conf))
{
sendto_one(source_p,
":%s NOTICE %s :The RESV for nick: %s is in ircd.conf and must be removed by hand.",
@@ -386,7 +376,7 @@ remove_resv(struct Client *source_p, const char *name)
return;
}
- delete_conf_item(conf);
+ conf_free(conf);
sendto_one(source_p, ":%s NOTICE %s :The RESV has been removed on nick: %s",
me.name, source_p->name, name);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
diff --git a/modules/m_set.c b/modules/m_set.c
index 2623283..8c2e651 100644
--- a/modules/m_set.c
+++ b/modules/m_set.c
@@ -138,19 +138,16 @@ list_quote_commands(struct Client *source_p)
static void
quote_autoconn(struct Client *source_p, const char *arg, int newval)
{
- struct AccessItem *aconf;
-
if (arg != NULL)
{
- struct ConfItem *conf = find_exact_name_conf(SERVER_TYPE, NULL, arg, NULL, NULL);
+ struct MaskItem *conf = find_exact_name_conf(CONF_SERVER, NULL, arg, NULL, NULL);
if (conf != NULL)
{
- aconf = map_to_conf(conf);
if (newval)
- SetConfAllowAutoConn(aconf);
+ SetConfAllowAutoConn(conf);
else
- ClearConfAllowAutoConn(aconf);
+ ClearConfAllowAutoConn(conf);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s has changed AUTOCONN for %s to %i",
diff --git a/modules/m_stats.c b/modules/m_stats.c
index 2fd31ba..2c292e6 100644
--- a/modules/m_stats.c
+++ b/modules/m_stats.c
@@ -30,12 +30,12 @@
#include "ircd.h" /* me */
#include "listener.h" /* show_ports */
#include "s_gline.h"
+#include "conf.h"
#include "hostmask.h"
#include "numeric.h" /* ERR_xxx */
#include "send.h" /* sendto_one */
#include "fdlist.h" /* PF and friends */
#include "s_bsd.h" /* highest_fd */
-#include "conf.h" /* AccessItem, report_configured_links */
#include "s_misc.h" /* serv_info */
#include "s_serv.h" /* hunt_server */
#include "s_user.h" /* show_opers */
@@ -291,9 +291,9 @@ stats_memory(struct Client *source_p, int parc, char *parv[])
sendto_one(source_p, ":%s %d %s z :Resv channels %u(%lu) nicks %u(%lu)",
me.name, RPL_STATSDEBUG, source_p->name,
dlink_list_length(&resv_channel_list),
- dlink_list_length(&resv_channel_list) * sizeof(struct ResvChannel),
+ dlink_list_length(&resv_channel_list) * sizeof(struct MaskItem),
dlink_list_length(&nresv_items),
- dlink_list_length(&nresv_items) * sizeof(struct MatchItem));
+ dlink_list_length(&nresv_items) * sizeof(struct MaskItem));
sendto_one(source_p, ":%s %d %s z :Classes %u(%llu)",
me.name, RPL_STATSDEBUG, source_p->name,
@@ -381,7 +381,7 @@ stats_dns_servers(struct Client *source_p)
static void
stats_connect(struct Client *source_p, int parc, char *parv[])
{
- report_confitem_types(source_p, SERVER_TYPE);
+ report_confitem_types(source_p, CONF_SERVER);
}
/* stats_deny()
@@ -393,8 +393,7 @@ stats_connect(struct Client *source_p, int parc, char *parv[])
static void
stats_deny(struct Client *source_p, int parc, char *parv[])
{
- struct ConfItem *conf;
- struct AccessItem *aconf;
+ struct MaskItem *conf;
dlink_node *ptr = NULL;
unsigned int i = 0;
@@ -405,19 +404,17 @@ stats_deny(struct Client *source_p, int parc, char *parv[])
{
struct AddressRec *arec = ptr->data;
- if (arec->type == CONF_DLINE)
- {
- aconf = arec->aconf;
+ if (arec->type != CONF_DLINE)
+ continue;
- /* dont report a tdline as a dline */
- if (aconf->hold)
- continue;
+ conf = arec->conf;
- conf = unmap_conf_item(aconf);
+ /* dont report a tdline as a dline */
+ if (conf->hold)
+ continue;
- sendto_one(source_p, form_str(RPL_STATSDLINE),
- from, to, 'D', aconf->host, aconf->reason);
- }
+ sendto_one(source_p, form_str(RPL_STATSDLINE),
+ from, to, 'D', conf->host, conf->reason);
}
}
}
@@ -431,8 +428,7 @@ stats_deny(struct Client *source_p, int parc, char *parv[])
static void
stats_tdeny(struct Client *source_p, int parc, char *parv[])
{
- struct ConfItem *conf;
- struct AccessItem *aconf;
+ struct MaskItem *conf = NULL;
dlink_node *ptr = NULL;
unsigned int i = 0;
@@ -443,19 +439,17 @@ stats_tdeny(struct Client *source_p, int parc, char *parv[])
{
struct AddressRec *arec = ptr->data;
- if (arec->type == CONF_DLINE)
- {
- aconf = arec->aconf;
+ if (arec->type != CONF_DLINE)
+ continue;
- /* dont report a permanent dline as a tdline */
- if (!aconf->hold)
- continue;
+ conf = arec->conf;
- conf = unmap_conf_item(aconf);
+ /* dont report a permanent dline as a tdline */
+ if (!conf->hold)
+ continue;
- sendto_one(source_p, form_str(RPL_STATSDLINE),
- from, to, 'd', aconf->host, aconf->reason);
- }
+ sendto_one(source_p, form_str(RPL_STATSDLINE),
+ from, to, 'd', conf->host, conf->reason);
}
}
}
@@ -469,8 +463,7 @@ stats_tdeny(struct Client *source_p, int parc, char *parv[])
static void
stats_exempt(struct Client *source_p, int parc, char *parv[])
{
- struct ConfItem *conf;
- struct AccessItem *aconf;
+ struct MaskItem *conf;
dlink_node *ptr = NULL;
unsigned int i = 0;
@@ -488,16 +481,13 @@ stats_exempt(struct Client *source_p, int parc, char *parv[])
{
struct AddressRec *arec = ptr->data;
- if (arec->type == CONF_EXEMPTDLINE)
- {
- aconf = arec->aconf;
+ if (arec->type != CONF_EXEMPT)
+ continue;
- conf = unmap_conf_item(aconf);
+ conf = arec->conf;
- sendto_one(source_p, form_str(RPL_STATSDLINE),
- from, to, 'e', aconf->host,
- aconf->reason);
- }
+ sendto_one(source_p, form_str(RPL_STATSDLINE),
+ from, to, 'e', conf->host, conf->reason /* XXX */);
}
}
}
@@ -624,13 +614,13 @@ stats_glines(struct Client *source_p, int parc, char *parv[])
if (arec->type == CONF_GLINE)
{
- const struct AccessItem *aconf = arec->aconf;
+ const struct MaskItem *conf = arec->conf;
sendto_one(source_p, form_str(RPL_STATSKLINE),
from, to, "G",
- aconf->host ? aconf->host : "*",
- aconf->user ? aconf->user : "*",
- aconf->reason ? aconf->reason : "No reason");
+ conf->host ? conf->host : "*",
+ conf->user ? conf->user : "*",
+ conf->reason ? conf->reason : "No reason");
}
}
}
@@ -639,49 +629,48 @@ stats_glines(struct Client *source_p, int parc, char *parv[])
static void
stats_hubleaf(struct Client *source_p, int parc, char *parv[])
{
- report_confitem_types(source_p, HUB_TYPE);
- report_confitem_types(source_p, LEAF_TYPE);
+ report_confitem_types(source_p, CONF_HUB);
}
/*
* show_iline_prefix()
*
* inputs - pointer to struct Client requesting output
- * - pointer to struct AccessItem
+ * - pointer to struct MaskItem
* - name to which iline prefix will be prefixed to
* output - pointer to static string with prefixes listed in ascii form
* side effects - NONE
*/
static const char *
-show_iline_prefix(struct Client *sptr, struct AccessItem *aconf, const char *name)
+show_iline_prefix(const struct Client *sptr, const struct MaskItem *conf)
{
static char prefix_of_host[USERLEN + 14];
char *prefix_ptr = prefix_of_host;
- if (IsNoTilde(aconf))
+ if (IsNoTilde(conf))
*prefix_ptr++ = '-';
- if (IsLimitIp(aconf))
+ if (IsLimitIp(conf))
*prefix_ptr++ = '!';
- if (IsNeedIdentd(aconf))
+ if (IsNeedIdentd(conf))
*prefix_ptr++ = '+';
- if (!IsNeedPassword(aconf))
+ if (!IsNeedPassword(conf))
*prefix_ptr++ = '&';
- if (IsConfExemptResv(aconf))
+ if (IsConfExemptResv(conf))
*prefix_ptr++ = '$';
- if (IsNoMatchIp(aconf))
+ if (IsNoMatchIp(conf))
*prefix_ptr++ = '%';
- if (IsConfDoSpoofIp(aconf))
+ if (IsConfDoSpoofIp(conf))
*prefix_ptr++ = '=';
- if (MyOper(sptr) && IsConfExemptKline(aconf))
+ if (MyOper(sptr) && IsConfExemptKline(conf))
*prefix_ptr++ = '^';
- if (MyOper(sptr) && IsConfExemptGline(aconf))
+ if (MyOper(sptr) && IsConfExemptGline(conf))
*prefix_ptr++ = '_';
- if (MyOper(sptr) && IsConfExemptLimits(aconf))
+ if (MyOper(sptr) && IsConfExemptLimits(conf))
*prefix_ptr++ = '>';
- if (IsConfCanFlood(aconf))
+ if (IsConfCanFlood(conf))
*prefix_ptr++ = '|';
- strlcpy(prefix_ptr, name, USERLEN+1);
+ strlcpy(prefix_ptr, conf->user, USERLEN+1);
return prefix_of_host;
}
@@ -689,8 +678,7 @@ show_iline_prefix(struct Client *sptr, struct AccessItem *aconf, const char *nam
static void
report_auth(struct Client *client_p, int parc, char *parv[])
{
- struct ConfItem *conf;
- struct AccessItem *aconf;
+ struct MaskItem *conf = NULL;
dlink_node *ptr = NULL;
unsigned int i;
@@ -701,35 +689,33 @@ report_auth(struct Client *client_p, int parc, char *parv[])
{
struct AddressRec *arec = ptr->data;
- if (arec->type == CONF_CLIENT)
- {
- aconf = arec->aconf;
-
- if (!MyOper(client_p) && IsConfDoSpoofIp(aconf))
- continue;
-
- conf = unmap_conf_item(aconf);
-
- /* We are doing a partial list, based on what matches the u@h of the
- * sender, so prepare the strings for comparing --fl_
- */
- if (ConfigFileEntry.hide_spoof_ips)
- sendto_one(client_p, form_str(RPL_STATSILINE), me.name,
- client_p->name, 'I',
- conf->name == NULL ? "*" : conf->name,
- show_iline_prefix(client_p, aconf, aconf->user),
- IsConfDoSpoofIp(aconf) ? "255.255.255.255" :
- aconf->host, aconf->port,
- aconf->class_ptr ? aconf->class_ptr->name : "<default>");
-
- else
- sendto_one(client_p, form_str(RPL_STATSILINE), me.name,
- client_p->name, 'I',
- conf->name == NULL ? "*" : conf->name,
- show_iline_prefix(client_p, aconf, aconf->user),
- aconf->host, aconf->port,
- aconf->class_ptr ? aconf->class_ptr->name : "<default>");
- }
+ if (arec->type != CONF_CLIENT)
+ continue;
+
+ conf = arec->conf;
+
+ if (!MyOper(client_p) && IsConfDoSpoofIp(conf))
+ continue;
+
+ /* We are doing a partial list, based on what matches the u@h of the
+ * sender, so prepare the strings for comparing --fl_
+ */
+ if (ConfigFileEntry.hide_spoof_ips)
+ sendto_one(client_p, form_str(RPL_STATSILINE), me.name,
+ client_p->name, 'I',
+ conf->name == NULL ? "*" : conf->name,
+ show_iline_prefix(client_p, conf),
+ IsConfDoSpoofIp(conf) ? "255.255.255.255" :
+ conf->host, conf->port,
+ conf->class ? conf->class->name : "<default>");
+
+ else
+ sendto_one(client_p, form_str(RPL_STATSILINE), me.name,
+ client_p->name, 'I',
+ conf->name == NULL ? "*" : conf->name,
+ show_iline_prefix(client_p, conf),
+ conf->host, conf->port,
+ conf->class ? conf->class->name : "<default>");
}
}
}
@@ -745,30 +731,27 @@ stats_auth(struct Client *source_p, int parc, char *parv[])
/* If unopered, Only return matching auth blocks */
else if ((ConfigFileEntry.stats_i_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
{
- struct ConfItem *conf;
- struct AccessItem *aconf;
+ struct MaskItem *conf;
if (MyConnect(source_p))
- aconf = find_conf_by_address(source_p->host,
+ conf = find_conf_by_address(source_p->host,
&source_p->localClient->ip,
CONF_CLIENT,
source_p->localClient->aftype,
source_p->username,
source_p->localClient->passwd, 1);
else
- aconf = find_conf_by_address(source_p->host, NULL, CONF_CLIENT,
+ conf = find_conf_by_address(source_p->host, NULL, CONF_CLIENT,
0, source_p->username, NULL, 1);
- if (aconf == NULL)
+ if (conf == NULL)
return;
- conf = unmap_conf_item(aconf);
-
sendto_one(source_p, form_str(RPL_STATSILINE), from,
to, 'I',
- "*", show_iline_prefix(source_p, aconf, aconf->user),
- aconf->host, aconf->port,
- aconf->class_ptr ? aconf->class_ptr->name : "<default>");
+ "*", show_iline_prefix(source_p, conf),
+ conf->host, conf->port,
+ conf->class ? conf->class->name : "<default>");
}
/* They are opered, or allowed to see all auth blocks */
else
@@ -785,7 +768,7 @@ stats_auth(struct Client *source_p, int parc, char *parv[])
static void
report_Klines(struct Client *client_p, int tkline)
{
- struct AccessItem *aconf = NULL;
+ struct MaskItem *conf = NULL;
unsigned int i = 0;
const char *p = NULL;
dlink_node *ptr = NULL;
@@ -801,22 +784,22 @@ report_Klines(struct Client *client_p, int tkline)
{
struct AddressRec *arec = ptr->data;
- if (arec->type == CONF_KLINE)
- {
- aconf = arec->aconf;
-
- if (!tkline && aconf->hold)
- continue;
-
- if (HasUMode(client_p, UMODE_OPER))
- sendto_one(client_p, form_str(RPL_STATSKLINE), me.name,
- client_p->name, p, aconf->host, aconf->user,
- aconf->reason);
- else
- sendto_one(client_p, form_str(RPL_STATSKLINE), me.name,
- client_p->name, p, aconf->host, aconf->user,
- aconf->reason);
- }
+ if (arec->type != CONF_KLINE)
+ continue;
+
+ conf = arec->conf;
+
+ if (!tkline && conf->hold)
+ continue;
+
+ if (HasUMode(client_p, UMODE_OPER))
+ sendto_one(client_p, form_str(RPL_STATSKLINE), me.name,
+ client_p->name, p, conf->host, conf->user,
+ conf->reason);
+ else
+ sendto_one(client_p, form_str(RPL_STATSKLINE), me.name,
+ client_p->name, p, conf->host, conf->user,
+ conf->reason);
}
}
}
@@ -832,27 +815,27 @@ stats_tklines(struct Client *source_p, int parc, char *parv[])
/* If unopered, Only return matching klines */
else if ((ConfigFileEntry.stats_k_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
{
- struct AccessItem *aconf = NULL;
+ struct MaskItem *conf = NULL;
if (MyConnect(source_p))
- aconf = find_conf_by_address(source_p->host,
- &source_p->localClient->ip,
+ conf = find_conf_by_address(source_p->host,
+ &source_p->localClient->ip,
CONF_KLINE,
source_p->localClient->aftype,
source_p->username, NULL, 1);
else
- aconf = find_conf_by_address(source_p->host, NULL, CONF_KLINE,
+ conf = find_conf_by_address(source_p->host, NULL, CONF_KLINE,
0, source_p->username, NULL, 1);
- if (aconf == NULL)
+ if (!conf)
return;
/* dont report a permanent kline as a tkline */
- if (!aconf->hold)
+ if (!conf->hold)
return;
sendto_one(source_p, form_str(RPL_STATSKLINE), from,
- to, "k", aconf->host, aconf->user, aconf->reason);
+ to, "k", conf->host, conf->user, conf->reason);
}
/* Theyre opered, or allowed to see all klines */
else {
@@ -871,33 +854,33 @@ stats_klines(struct Client *source_p, int parc, char *parv[])
/* If unopered, Only return matching klines */
else if ((ConfigFileEntry.stats_k_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
{
- struct AccessItem *aconf = NULL;
+ struct MaskItem *conf = NULL;
/* search for a kline */
if (MyConnect(source_p))
- aconf = find_conf_by_address(source_p->host,
+ conf = find_conf_by_address(source_p->host,
&source_p->localClient->ip,
CONF_KLINE,
source_p->localClient->aftype,
source_p->username, NULL, 0);
else
- aconf = find_conf_by_address(source_p->host, NULL, CONF_KLINE,
+ conf = find_conf_by_address(source_p->host, NULL, CONF_KLINE,
0, source_p->username, NULL, 0);
- if (aconf == NULL)
+ if (!conf)
return;
/* dont report a tkline as a kline */
- if (aconf->hold)
+ if (conf->hold)
return;
sendto_one(source_p, form_str(RPL_STATSKLINE), from,
- to, "K", aconf->host, aconf->user, aconf->reason);
+ to, "K", conf->host, conf->user, conf->reason);
}
/* Theyre opered, or allowed to see all klines */
else {
report_Klines(source_p, 0);
- report_confitem_types(source_p, RKLINE_TYPE);
+ report_confitem_types(source_p, CONF_RKLINE);
}
}
@@ -914,7 +897,7 @@ stats_oper(struct Client *source_p, int parc, char *parv[])
sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
from, to);
else
- report_confitem_types(source_p, OPER_TYPE);
+ report_confitem_types(source_p, CONF_OPER);
}
/* stats_operedup()
@@ -973,7 +956,7 @@ stats_resv(struct Client *source_p, int parc, char *parv[])
static void
stats_service(struct Client *source_p, int parc, char *parv[])
{
- report_confitem_types(source_p, SERVICE_TYPE);
+ report_confitem_types(source_p, CONF_SERVICE);
}
static void
@@ -1063,7 +1046,7 @@ stats_uptime(struct Client *source_p, int parc, char *parv[])
static void
stats_shared(struct Client *source_p, int parc, char *parv[])
{
- report_confitem_types(source_p, ULINE_TYPE);
+ report_confitem_types(source_p, CONF_ULINE);
}
/* stats_servers()
@@ -1094,14 +1077,14 @@ stats_servers(struct Client *source_p, int parc, char *parv[])
static void
stats_gecos(struct Client *source_p, int parc, char *parv[])
{
- report_confitem_types(source_p, XLINE_TYPE);
- report_confitem_types(source_p, RXLINE_TYPE);
+ report_confitem_types(source_p, CONF_XLINE);
+ report_confitem_types(source_p, CONF_RXLINE);
}
static void
stats_class(struct Client *source_p, int parc, char *parv[])
{
- report_confitem_types(source_p, CLASS_TYPE);
+ report_confitem_types(source_p, CONF_CLASS);
}
static void
diff --git a/modules/m_svsmode.c b/modules/m_svsmode.c
index 34c4c71..3b3322f 100644
--- a/modules/m_svsmode.c
+++ b/modules/m_svsmode.c
@@ -115,7 +115,7 @@ ms_svsmode(struct Client *client_p, struct Client *source_p,
{
dlink_node *dm = NULL;
- detach_conf(target_p, OPER_TYPE);
+ detach_conf(target_p, CONF_OPER);
ClrOFlag(target_p);
DelUMode(target_p, ConfigFileEntry.oper_only_umodes);
diff --git a/modules/m_testline.c b/modules/m_testline.c
index 36c0cd3..4164b2d 100644
--- a/modules/m_testline.c
+++ b/modules/m_testline.c
@@ -59,8 +59,7 @@ mo_testline(struct Client *client_p, struct Client *source_p,
char given_name[IRCD_BUFSIZE];
char given_host[IRCD_BUFSIZE];
char parv1_copy[IRCD_BUFSIZE];
- struct ConfItem *conf;
- struct AccessItem *aconf;
+ struct MaskItem *conf = NULL;
struct irc_ssaddr ip;
int host_mask;
int t;
@@ -77,7 +76,7 @@ mo_testline(struct Client *client_p, struct Client *source_p,
if (IsChanPrefix(*parv[1])) /* Might be channel resv */
{
- const struct ResvChannel *chptr = NULL;
+ const struct MaskItem *chptr = NULL;
if ((chptr = match_find_resv(parv[1])))
{
@@ -105,32 +104,32 @@ mo_testline(struct Client *client_p, struct Client *source_p,
if (t != HM_HOST)
{
- aconf = find_dline_conf(&ip,
+ conf = find_dline_conf(&ip,
#ifdef IPV6
(t == HM_IPV6) ? AF_INET6 : AF_INET
#else
AF_INET
#endif
);
- if (aconf != NULL)
+ if (conf != NULL)
{
++matches;
- if (aconf->status & CONF_EXEMPTDLINE)
+ if (conf->status & CONF_EXEMPT)
sendto_one(source_p,
":%s NOTICE %s :Exempt D-line host [%s] reason [%s]",
- me.name, source_p->name, aconf->host, aconf->reason);
+ me.name, source_p->name, conf->host, conf->reason);
else
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name,
- aconf->hold ? 'd' : 'D',
- aconf->hold ? ((aconf->hold - CurrentTime) / 60)
+ conf->hold ? 'd' : 'D',
+ conf->hold ? ((conf->hold - CurrentTime) / 60)
: 0L,
- aconf->host, aconf->reason);
+ conf->host, conf->reason);
}
}
if (t != HM_HOST)
- aconf = find_address_conf(given_host, given_name, &ip,
+ conf = find_address_conf(given_host, given_name, &ip,
#ifdef IPV6
(t == HM_IPV6) ? AF_INET6 : AF_INET,
#else
@@ -138,41 +137,39 @@ mo_testline(struct Client *client_p, struct Client *source_p,
#endif
parv[2]);
else
- aconf = find_address_conf(given_host, given_name, NULL, 0, parv[2]);
+ conf = find_address_conf(given_host, given_name, NULL, 0, parv[2]);
- if (aconf != NULL)
+ if (conf != NULL)
{
- snprintf(userhost, sizeof(userhost), "%s@%s", aconf->user, aconf->host);
+ snprintf(userhost, sizeof(userhost), "%s@%s", conf->user, conf->host);
- if (aconf->status & CONF_CLIENT)
+ if (conf->status & CONF_CLIENT)
{
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, 'I', 0L, userhost,
- aconf->class_ptr ? aconf->class_ptr->name : "<default>", "");
+ conf->class ? conf->class->name : "<default>", "");
++matches;
}
- else if (aconf->status & CONF_KLINE)
+ else if (conf->status & CONF_KLINE)
{
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name,
- aconf->hold ? 'k' : 'K',
- aconf->hold ? ((aconf->hold - CurrentTime) / 60)
+ conf->hold ? 'k' : 'K',
+ conf->hold ? ((conf->hold - CurrentTime) / 60)
: 0L,
- userhost, aconf->reason? aconf->reason : "No reason");
+ userhost, conf->reason? conf->reason : "No reason");
++matches;
}
}
- conf = find_matching_name_conf(NRESV_TYPE, given_name, NULL, NULL, 0);
+ conf = find_matching_name_conf(CONF_NRESV, given_name, NULL, NULL, 0);
if (conf != NULL)
{
- const struct MatchItem *mconf = map_to_conf(conf);
-
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, 'Q', 0L,
conf->name,
- mconf->reason ? mconf->reason : "No reason");;
+ conf->reason ? conf->reason : "No reason");;
++matches;
}
@@ -198,7 +195,7 @@ static void
mo_testgecos(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
- struct ConfItem *conf = NULL;
+ struct MaskItem *conf = NULL;
if (EmptyString(parv[1]))
{
@@ -207,13 +204,10 @@ mo_testgecos(struct Client *client_p, struct Client *source_p,
return;
}
- if ((conf = find_matching_name_conf(XLINE_TYPE, parv[1], NULL, NULL, 0)))
- {
- const struct MatchItem *xconf = map_to_conf(conf);
+ if ((conf = find_matching_name_conf(CONF_XLINE, parv[1], NULL, NULL, 0)))
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, 'X', 0L,
- conf->name, xconf->reason ? xconf->reason : "X-lined");
- }
+ conf->name, conf->reason ? conf->reason : "X-lined");
else
sendto_one(source_p, form_str(RPL_NOTESTLINE),
me.name, source_p->name, parv[1]);
diff --git a/modules/m_trace.c b/modules/m_trace.c
index 3694140..6116a75 100644
--- a/modules/m_trace.c
+++ b/modules/m_trace.c
@@ -35,6 +35,7 @@
#include "parse.h"
#include "modules.h"
#include "conf.h"
+#include "conf_class.h"
static void do_actual_trace(struct Client *, int, char *[]);
@@ -163,8 +164,6 @@ static void
do_actual_trace(struct Client *source_p, int parc, char *parv[])
{
struct Client *target_p = NULL;
- struct ConfItem *conf;
- struct ClassItem *cltmp;
int doall = 0;
int wilds, dow;
dlink_node *ptr;
@@ -207,19 +206,16 @@ do_actual_trace(struct Client *source_p, int parc, char *parv[])
/* lets also do this for opers tracing nicks */
{
const char *name;
- const char *class_name;
-
target_p = hash_find_client(tname);
if (target_p && IsClient(target_p))
{
name = get_client_name(target_p, HIDE_IP);
- class_name = get_client_class(target_p);
if (HasUMode(target_p, UMODE_OPER))
{
sendto_one(source_p, form_str(RPL_TRACEOPERATOR),
- from, to, class_name, name,
+ from, to, get_client_class(&target_p->localClient->confs), name,
IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
CurrentTime - target_p->localClient->lasttime,
CurrentTime - target_p->localClient->last_privmsg);
@@ -227,7 +223,7 @@ do_actual_trace(struct Client *source_p, int parc, char *parv[])
else
{
sendto_one(source_p,form_str(RPL_TRACEUSER),
- from, to, class_name, name,
+ from, to, get_client_class(&target_p->localClient->confs), name,
IsIPSpoof(target_p) ? "255.255.255.255" : target_p->sockhost,
CurrentTime - target_p->localClient->lasttime,
CurrentTime - target_p->localClient->last_privmsg);
@@ -281,14 +277,13 @@ do_actual_trace(struct Client *source_p, int parc, char *parv[])
report_this_status(source_p, target_p, dow);
}
- DLINK_FOREACH(ptr, class_items.head)
+ DLINK_FOREACH(ptr, class_get_list()->head)
{
- conf = ptr->data;
- cltmp = map_to_conf(conf);
+ const struct ClassItem *class = ptr->data;
- if (cltmp->curr_user_count > 0)
+ if (class->ref_count > 0)
sendto_one(source_p, form_str(RPL_TRACECLASS),
- from, to, conf->name, cltmp->curr_user_count);
+ from, to, class->name, class->ref_count);
}
sendto_one(source_p, form_str(RPL_ENDOFTRACE), from, to, tname);
@@ -320,7 +315,7 @@ report_this_status(struct Client *source_p, struct Client *target_p, int dow)
}
name = get_client_name(target_p, HIDE_IP);
- class_name = get_client_class(target_p);
+ class_name = get_client_class(&target_p->localClient->confs);
set_time();
diff --git a/modules/m_xline.c b/modules/m_xline.c
index 9f1acc6..e512ac2 100644
--- a/modules/m_xline.c
+++ b/modules/m_xline.c
@@ -29,11 +29,11 @@
#include "irc_string.h"
#include "sprintf_irc.h"
#include "ircd.h"
+#include "conf.h"
#include "hostmask.h"
#include "numeric.h"
#include "fdlist.h"
#include "s_bsd.h"
-#include "conf.h"
#include "log.h"
#include "s_misc.h"
#include "send.h"
@@ -68,8 +68,7 @@ mo_xline(struct Client *client_p, struct Client *source_p,
{
char *reason = NULL;
char *gecos = NULL;
- struct ConfItem *conf = NULL;
- struct MatchItem *match_item = NULL;
+ struct MaskItem *conf = NULL;
char *target_server = NULL;
time_t tkline_time = 0;
@@ -117,14 +116,12 @@ mo_xline(struct Client *client_p, struct Client *source_p,
if (!valid_xline(source_p, gecos, reason, 0))
return;
- if ((conf = find_matching_name_conf(XLINE_TYPE, gecos,
+ if ((conf = find_matching_name_conf(CONF_XLINE, gecos,
NULL, NULL, 0)) != NULL)
{
- match_item = map_to_conf(conf);
-
sendto_one(source_p, ":%s NOTICE %s :[%s] already X-Lined by [%s] - %s",
me.name, source_p->name, gecos,
- conf->name, match_item->reason);
+ conf->name, conf->reason);
return;
}
@@ -184,8 +181,7 @@ me_xline(struct Client *client_p, struct Client *source_p,
static void
relay_xline(struct Client *source_p, char *parv[])
{
- struct ConfItem *conf;
- struct MatchItem *match_item;
+ struct MaskItem *conf = NULL;
int t_sec;
t_sec = atoi(parv[3]);
@@ -200,18 +196,17 @@ relay_xline(struct Client *source_p, char *parv[])
if (!match(parv[1], me.name))
return;
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
source_p->username, source_p->host,
SHARED_XLINE))
{
- if ((conf = find_matching_name_conf(XLINE_TYPE, parv[2],
+ if ((conf = find_matching_name_conf(CONF_XLINE, parv[2],
NULL, NULL, 0)) != NULL)
{
- match_item = map_to_conf(conf);
sendto_one(source_p, ":%s NOTICE %s :[%s] already X-Lined by [%s] - %s",
ID_or_name(&me, source_p->from),
ID_or_name(source_p, source_p->from),
- parv[2], conf->name, match_item->reason);
+ parv[2], conf->name, conf->reason);
return;
}
@@ -285,7 +280,7 @@ ms_unxline(struct Client *client_p, struct Client *source_p,
if (!match(parv[1], me.name))
return;
- if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
+ if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
source_p->username, source_p->host,
SHARED_UNXLINE))
remove_xline(source_p, parv[2]);
@@ -330,50 +325,48 @@ static void
write_xline(struct Client *source_p, char *gecos, char *reason,
time_t tkline_time)
{
- struct ConfItem *conf;
- struct MatchItem *xconf;
+ struct MaskItem *conf;
const char *current_date;
time_t cur_time;
- conf = make_conf_item(XLINE_TYPE);
- xconf = map_to_conf(conf);
+ conf = conf_make(CONF_XLINE);
collapse(gecos);
DupString(conf->name, gecos);
- DupString(xconf->reason, reason);
+ DupString(conf->reason, reason);
cur_time = CurrentTime;
current_date = smalldate(cur_time);
- xconf->setat = CurrentTime;
+ conf->setat = CurrentTime;
- SetConfDatabase(xconf);
+ SetConfDatabase(conf);
if (tkline_time != 0)
{
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s added temporary %d min. X-Line for [%s] [%s]",
get_oper_name(source_p), (int)tkline_time/60,
- conf->name, xconf->reason);
+ conf->name, conf->reason);
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. X-Line [%s]",
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
source_p->name, (int)tkline_time/60, conf->name);
ilog(LOG_TYPE_KLINE, "%s added temporary %d min. X-Line for [%s] [%s]",
source_p->name, (int)tkline_time/60,
- conf->name, xconf->reason);
- xconf->hold = CurrentTime + tkline_time;
+ conf->name, conf->reason);
+ conf->hold = CurrentTime + tkline_time;
}
else
{
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s added X-Line for [%s] [%s]",
get_oper_name(source_p), conf->name,
- xconf->reason);
+ conf->reason);
sendto_one(source_p,
":%s NOTICE %s :Added X-Line [%s] [%d] [%s]",
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
source_p->name, conf->name,
- xconf->action, xconf->reason);
+ conf->action, conf->reason);
ilog(LOG_TYPE_IRCD, "%s added X-Line for [%s] [%s]",
- get_oper_name(source_p), conf->name, xconf->reason);
+ get_oper_name(source_p), conf->name, conf->reason);
}
rehashed_klines = 1;
@@ -408,19 +401,17 @@ static int
remove_xline_match(const char *gecos)
{
dlink_node *ptr = NULL, *next_ptr = NULL;
- struct ConfItem *conf = NULL;
DLINK_FOREACH_SAFE(ptr, next_ptr, xconf_items.head)
{
- conf = ptr->data;
- struct MatchItem *xconf = map_to_conf(conf);
+ struct MaskItem *conf = ptr->data;
- if (!IsConfDatabase(xconf))
+ if (!IsConfDatabase(conf))
continue;
if (!irccmp(gecos, conf->name))
{
- delete_conf_item(conf);
+ conf_free(conf);
return 1;
}
}