summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/Makefile.in2
-rw-r--r--doc/reference.conf9
-rw-r--r--include/resv.h7
-rw-r--r--modules/core/m_join.c3
-rw-r--r--modules/m_resv.c9
-rw-r--r--src/conf.c18
-rw-r--r--src/conf_db.c4
-rw-r--r--src/conf_parser.c4
-rw-r--r--src/conf_parser.y4
-rw-r--r--src/resv.c49
10 files changed, 28 insertions, 81 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in
index c473e36..41bdc33 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -258,7 +258,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
man_MANS = ircd.8
-dist_sysconf_DATA = example.conf
+dist_sysconf_DATA = reference.conf
all: all-am
.SUFFIXES:
diff --git a/doc/reference.conf b/doc/reference.conf
index 6f6f831..3269694 100644
--- a/doc/reference.conf
+++ b/doc/reference.conf
@@ -709,12 +709,7 @@ exempt {
/*
* resv {}: nicks and channels users may not use/join
*/
-resv {
- /* resv: wildcard masks are supported in nicks only */
- nick = "clone*";
- reason = "Clone bots";
-};
-
+resv { nick = "clone*"; reason = "Clone bots"; };
resv { nick = "NickServ"; reason = "Reserved for services"; };
resv { nick = "OperServ"; reason = "Reserved for services"; };
resv { nick = "MemoServ"; reason = "Reserved for services"; };
@@ -722,7 +717,7 @@ resv { nick = "BotServ"; reason = "Reserved for services"; };
resv { nick = "HelpServ"; reason = "Reserved for services"; };
resv { nick = "HostServ"; reason = "Reserved for services"; };
resv { nick = "StatServ"; reason = "Reserved for services"; };
-resv { channel = "#services"; reason = "Reserved for services"; };
+resv { channel = "#*services*"; reason = "Reserved for services"; };
/*
* gecos {}: The X: replacement, used for banning users based on
diff --git a/include/resv.h b/include/resv.h
index 986bb3a..85dd3cf 100644
--- a/include/resv.h
+++ b/include/resv.h
@@ -28,12 +28,9 @@
extern dlink_list nresv_items;
extern dlink_list resv_channel_list;
-extern struct MaskItem *create_channel_resv(char *, char *, int);
-extern struct MaskItem *create_nick_resv(char *, char *, int);
+extern struct MaskItem *create_channel_resv(const char *, const char *);
+extern struct MaskItem *create_nick_resv(const char *, const char *);
-extern int delete_channel_resv(struct MaskItem *);
-
-extern void clear_conf_resv(void);
extern void report_resv(struct Client *);
extern int valid_wild_card_simple(const char *);
diff --git a/modules/core/m_join.c b/modules/core/m_join.c
index 7937d0c..c5b21e4 100644
--- a/modules/core/m_join.c
+++ b/modules/core/m_join.c
@@ -36,6 +36,7 @@
#include "conf.h"
#include "parse.h"
#include "modules.h"
+#include "resv.h"
static void do_join_0(struct Client *, struct Client *);
@@ -134,7 +135,7 @@ m_join(struct Client *client_p, struct Client *source_p,
if (!IsExemptResv(source_p) &&
!(HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.oper_pass_resv) &&
- (!(conf = hash_find_resv(chan)) == ConfigChannel.restrict_channels))
+ (!(conf = match_find_resv(chan)) == ConfigChannel.restrict_channels))
{
if (conf)
++conf->count;
diff --git a/modules/m_resv.c b/modules/m_resv.c
index 785c068..6cdd293 100644
--- a/modules/m_resv.c
+++ b/modules/m_resv.c
@@ -221,7 +221,7 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
{
struct MaskItem *conf = NULL;
- if ((conf = create_channel_resv(name, reason, 0)) == NULL)
+ if ((conf = create_channel_resv(name, reason)) == NULL)
{
sendto_one(source_p,
":%s NOTICE %s :A RESV has already been placed on channel: %s",
@@ -281,7 +281,7 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
return;
}
- if ((conf = create_nick_resv(name, reason, 0)) == NULL)
+ if ((conf = create_nick_resv(name, reason)) == NULL)
{
sendto_one(source_p,
":%s NOTICE %s :A RESV has already been placed on nick %s",
@@ -334,8 +334,7 @@ remove_resv(struct Client *source_p, const char *name)
if (IsChanPrefix(*name))
{
- if (resv_channel_list.head == NULL ||
- !(conf = hash_find_resv(name)))
+ if ((conf = find_exact_name_conf(CONF_CRESV, NULL, name, NULL, NULL)) == NULL)
{
sendto_one(source_p,
":%s NOTICE %s :A RESV does not exist for channel: %s",
@@ -351,7 +350,7 @@ remove_resv(struct Client *source_p, const char *name)
return;
}
- delete_channel_resv(conf);
+ conf_free(conf);
sendto_one(source_p,
":%s NOTICE %s :The RESV has been removed on channel: %s",
me.name, source_p->name, name);
diff --git a/src/conf.c b/src/conf.c
index 3d30a86..af5c662 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -1036,6 +1036,8 @@ map_to_list(enum maskitem_type type)
case CONF_NRESV:
return(&nresv_items);
break;
+ case CONF_CRESV:
+ return(&resv_channel_list);
case CONF_OPER:
return(&oconf_items);
break;
@@ -1100,6 +1102,7 @@ find_matching_name_conf(enum maskitem_type type, const char *name, const char *u
case CONF_XLINE:
case CONF_ULINE:
case CONF_NRESV:
+ case CONF_CRESV:
DLINK_FOREACH(ptr, list_p->head)
{
conf = ptr->data;
@@ -1161,6 +1164,7 @@ find_exact_name_conf(enum maskitem_type type, const struct Client *who, const ch
case CONF_XLINE:
case CONF_ULINE:
case CONF_NRESV:
+ case CONF_CRESV:
DLINK_FOREACH(ptr, list_p->head)
{
@@ -1628,20 +1632,13 @@ expire_tklines(dlink_list *tklist)
"Temporary X-line for [%s] expired", conf->name);
conf_free(conf);
}
- else if (conf->type == CONF_NRESV)
+ else if (conf->type == CONF_NRESV || conf->type == CONF_CRESV)
{
if (ConfigFileEntry.tkline_expire_notices)
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"Temporary RESV for [%s] expired", conf->name);
conf_free(conf);
}
- else if (conf->type == CONF_CRESV)
- {
- if (ConfigFileEntry.tkline_expire_notices)
- sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "Temporary RESV for [%s] expired", conf->name);
- delete_channel_resv(conf);
- }
}
}
@@ -1816,7 +1813,7 @@ clear_out_old_conf(void)
dlink_list *free_items [] = {
&server_items, &oconf_items,
&uconf_items, &xconf_items, &rxconf_items, &rkconf_items,
- &nresv_items, &cluster_items, &service_items, NULL
+ &nresv_items, &cluster_items, &service_items, &resv_channel_list, NULL
};
dlink_list ** iterator = free_items; /* C is dumb */
@@ -1891,9 +1888,6 @@ clear_out_old_conf(void)
SSL_OP_NO_TLSv1);
#endif
- /* clean out old resvs from the conf */
- clear_conf_resv();
-
/* clean out AdminInfo */
MyFree(AdminInfo.name);
AdminInfo.name = NULL;
diff --git a/src/conf_db.c b/src/conf_db.c
index 798fd14..5fb74da 100644
--- a/src/conf_db.c
+++ b/src/conf_db.c
@@ -909,7 +909,7 @@ load_resv_database(void)
if (IsChanPrefix(*name))
{
- if ((conf = create_channel_resv(name, reason, 0)) == NULL)
+ if ((conf = create_channel_resv(name, reason)) == NULL)
continue;
conf->setat = tmp64_setat;
@@ -918,7 +918,7 @@ load_resv_database(void)
}
else
{
- if ((conf = create_nick_resv(name, reason, 0)) == NULL)
+ if ((conf = create_nick_resv(name, reason)) == NULL)
continue;
conf->setat = tmp64_setat;
diff --git a/src/conf_parser.c b/src/conf_parser.c
index ce63850..07c3b10 100644
--- a/src/conf_parser.c
+++ b/src/conf_parser.c
@@ -4990,9 +4990,9 @@ yyreduce:
#line 1714 "conf_parser.y"
{
if (IsChanPrefix(block_state.name.buf[0]))
- create_channel_resv(block_state.name.buf, block_state.rpass.buf, 1);
+ create_channel_resv(block_state.name.buf, block_state.rpass.buf);
else if (block_state.name.buf[0])
- create_nick_resv(block_state.name.buf, block_state.rpass.buf, 1);
+ create_nick_resv(block_state.name.buf, block_state.rpass.buf);
}
break;
diff --git a/src/conf_parser.y b/src/conf_parser.y
index 750a200..4f1a4db 100644
--- a/src/conf_parser.y
+++ b/src/conf_parser.y
@@ -1713,9 +1713,9 @@ resv_entry: RESV
} '{' resv_items '}' ';'
{
if (IsChanPrefix(block_state.name.buf[0]))
- create_channel_resv(block_state.name.buf, block_state.rpass.buf, 1);
+ create_channel_resv(block_state.name.buf, block_state.rpass.buf);
else if (block_state.name.buf[0])
- create_nick_resv(block_state.name.buf, block_state.rpass.buf, 1);
+ create_nick_resv(block_state.name.buf, block_state.rpass.buf);
};
resv_items: resv_items resv_item | resv_item;
diff --git a/src/resv.c b/src/resv.c
index ccb5c11..3ac0490 100644
--- a/src/resv.c
+++ b/src/resv.c
@@ -49,23 +49,20 @@ dlink_list resv_channel_list = { NULL, NULL, 0 };
* side effects -
*/
struct MaskItem *
-create_channel_resv(char *name, char *reason, int in_conf)
+create_channel_resv(const char *name, const char *reason)
{
struct MaskItem *conf = NULL;
if (name == NULL || reason == NULL)
return NULL;
- if (hash_find_resv(name))
+ if (find_exact_name_conf(CONF_CRESV, NULL, name, NULL, NULL))
return NULL;
conf = conf_make(CONF_CRESV);
conf->name = xstrdup(name);
conf->reason = xstrndup(reason, IRCD_MIN(strlen(reason), REASONLEN));
- dlinkAdd(conf, &conf->node, &resv_channel_list);
- hash_add_resv(conf);
-
return conf;
}
@@ -78,14 +75,14 @@ create_channel_resv(char *name, char *reason, int in_conf)
* side effects -
*/
struct MaskItem *
-create_nick_resv(char *name, char *reason, int in_conf)
+create_nick_resv(const char *name, const char *reason)
{
struct MaskItem *conf = NULL;
if (name == NULL || reason == NULL)
return NULL;
- if (find_matching_name_conf(CONF_NRESV, name, NULL, NULL, 0))
+ if (find_exact_name_conf(CONF_NRESV, NULL, name, NULL, NULL))
return NULL;
conf = conf_make(CONF_NRESV);
@@ -95,42 +92,6 @@ create_nick_resv(char *name, char *reason, int in_conf)
return conf;
}
-/* clear_conf_resv()
- *
- * inputs - none
- * output - none
- * side effects - All resvs are cleared out
- */
-void
-clear_conf_resv(void)
-{
- dlink_node *ptr = NULL, *next_ptr = NULL;
-
- DLINK_FOREACH_SAFE(ptr, next_ptr, resv_channel_list.head)
- {
- struct MaskItem *conf = ptr->data;
-
- if (!IsConfDatabase(conf))
- delete_channel_resv(conf);
- }
-}
-
-/* delete_channel_resv()
- *
- * inputs - pointer to channel resv to delete
- * output - none
- * side effects - given struct ResvChannel * is removed
- */
-int
-delete_channel_resv(struct MaskItem *conf)
-{
- hash_del_resv(conf);
- dlinkDelete(&conf->node, &resv_channel_list);
- conf_free(conf);
-
- return 1;
-}
-
/* match_find_resv()
*
* inputs - pointer to name
@@ -150,7 +111,7 @@ match_find_resv(const char *name)
{
struct MaskItem *conf = ptr->data;
- if (!match(name, conf->name))
+ if (!match(conf->name, name))
return conf;
}