summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL9
-rw-r--r--include/conf.h11
-rw-r--r--include/conf_db.h15
-rw-r--r--include/defaults.h10
-rw-r--r--include/resv.h2
-rw-r--r--modules/m_dline.c122
-rw-r--r--modules/m_gline.c21
-rw-r--r--modules/m_kline.c144
-rw-r--r--modules/m_resv.c2
-rw-r--r--modules/m_stats.c18
-rw-r--r--modules/m_testline.c12
-rw-r--r--modules/m_xline.c73
-rw-r--r--src/Makefile.am1
-rw-r--r--src/Makefile.in33
-rw-r--r--src/conf.c97
-rw-r--r--src/conf_db.c489
-rw-r--r--src/conf_parser.c314
-rw-r--r--src/conf_parser.y10
-rw-r--r--src/csvlib.c671
-rw-r--r--src/hostmask.c4
-rw-r--r--src/ircd.c12
-rw-r--r--src/messages.tab6
-rw-r--r--src/resv.c7
23 files changed, 876 insertions, 1207 deletions
diff --git a/INSTALL b/INSTALL
index f048e14..3602e8f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -106,15 +106,6 @@
5. If you wish to install the contrib modules, run 'make install' in the
contrib/ folder to compile and install the modules and help pages.
- 6. If you are upgrading from Hybrid 5 or Hybrid 6, the config files
- have changed drastically.
-
- By default, the kline file is named kline.conf, the dline file is
- named dline.conf, and the xline file is called xline.conf.
-
- The nick resv file is named nresv.conf, channel resv file is named
- cresv.conf.
-
----------------------------------------------------------------------
HOW TO GET HELP
diff --git a/include/conf.h b/include/conf.h
index 4cb80e7..b6f2a6f 100644
--- a/include/conf.h
+++ b/include/conf.h
@@ -108,6 +108,7 @@ struct MatchItem
int ref_count; /* How many times is this matchitem in use */
int illegal; /* Should it be deleted when possible? */
time_t hold; /* Hold action until this time (calendar time) */
+ time_t setat;
};
struct AccessItem
@@ -128,9 +129,9 @@ struct AccessItem
char * passwd;
char * spasswd; /* Password to send. */
char * reason;
- char * oper_reason;
char * user; /* user part of user@host */
time_t hold; /* Hold action until this time (calendar time) */
+ time_t setat;
struct ConfItem *class_ptr; /* Class of connection */
int aftype;
#ifdef HAVE_LIBCRYPTO
@@ -229,6 +230,7 @@ struct CidrItem
#define CONF_FLAGS_TEMPORARY 0x00008000
#define CONF_FLAGS_EXEMPTRESV 0x00010000
#define CONF_FLAGS_SSL 0x00020000
+#define CONF_FLAGS_MAINCONF 0x00040000
/* Macros for struct AccessItem */
#define IsLimitIp(x) ((x)->flags & CONF_FLAGS_LIMIT_IP)
@@ -256,6 +258,9 @@ struct CidrItem
#define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
#define SetConfSSL(x) ((x)->flags |= CONF_FLAGS_SSL)
#define ClearConfSSL(x) ((x)->flags &= ~CONF_FLAGS_SSL)
+#define IsConfMain(x) ((x)->flags & CONF_FLAGS_MAINCONF)
+#define SetConfMain(x) ((x)->flags |= CONF_FLAGS_MAINCONF)
+#define ClearConfMain(x) ((x)->flags &= ~CONF_FLAGS_MAINCONF)
/* shared/cluster server entry types
* These defines are used for both shared and cluster.
@@ -404,6 +409,7 @@ extern dlink_list class_items;
extern dlink_list server_items;
extern dlink_list cluster_items;
extern dlink_list hub_items;
+extern dlink_list xconf_items;
extern dlink_list rxconf_items;
extern dlink_list rkconf_items;
extern dlink_list leaf_items;
@@ -456,13 +462,10 @@ extern int remove_conf_line(ConfType, struct Client *, const char *,
const char *);
extern void add_temp_line(struct ConfItem *);
extern void cleanup_tklines(void *);
-extern const char *get_conf_name(ConfType);
extern int rehash(int);
extern int conf_add_server(struct ConfItem *, const char *);
extern void conf_add_class_to_conf(struct ConfItem *, const char *);
-/* XXX consider moving these into csvlib.h */
-extern void parse_csv_file(FILE *, ConfType);
extern int find_and_delete_temporary(const char *, const char *, int);
extern const char *get_oper_name(const struct Client *);
diff --git a/include/conf_db.h b/include/conf_db.h
index 9f0a731..c5dd1b2 100644
--- a/include/conf_db.h
+++ b/include/conf_db.h
@@ -64,6 +64,17 @@ extern int write_ptr(const void *, struct dbFILE *);
extern int read_string(char **, struct dbFILE *);
extern int write_string(const char *, struct dbFILE *);
+extern void load_kline_database(void);
+extern void save_kline_database(void);
+extern void load_dline_database(void);
+extern void save_dline_database(void);
+extern void load_gline_database(void);
+extern void save_gline_database(void);
+extern void load_xline_database(void);
+extern void save_xline_database(void);
+extern void load_resv_database(void);
+extern void save_resv_database(void);
+
#define read_buffer(buf,f) (read_db((f),(buf),sizeof(buf)) == sizeof(buf))
#define write_buffer(buf,f) (write_db((f),(buf),sizeof(buf)) == sizeof(buf))
@@ -71,4 +82,8 @@ extern int write_string(const char *, struct dbFILE *);
#define write_buflen(buf,len,f) (write_db((f),(buf),(len)) == (len))
#define read_variable(var,f) (read_db((f),&(var),sizeof(var)) == sizeof(var))
#define write_variable(var,f) (write_db((f),&(var),sizeof(var)) == sizeof(var))
+
+#define KLINE_DB_VERSION 1
+
+
#endif
diff --git a/include/defaults.h b/include/defaults.h
index 038bc87..09c325a 100644
--- a/include/defaults.h
+++ b/include/defaults.h
@@ -62,11 +62,11 @@
/* files */
#define SPATH SBINPATH "/ircd" /* ircd executable */
#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */
-#define KPATH ETCPATH "/kline.conf" /* kline file */
-#define CRESVPATH ETCPATH "/cresv.conf" /* channel resvs file */
-#define NRESVPATH ETCPATH "/nresv.conf" /* nick resvs file */
-#define DLPATH ETCPATH "/dline.conf" /* dline file */
-#define XPATH ETCPATH "/xline.conf" /* xline file */
+#define KPATH ETCPATH "/kline.db" /* kline file */
+#define RESVPATH ETCPATH "/resv.db" /* resv file */
+#define DLPATH ETCPATH "/dline.db" /* dline file */
+#define XPATH ETCPATH "/xline.db" /* xline file */
+#define GPATH ETCPATH "/gline.db" /* gline file */
#define MPATH ETCPATH "/ircd.motd" /* MOTD file */
#define LPATH LOGPATH "/ircd.log" /* ircd logfile */
#define PPATH LOCALSTATEDIR "/ircd.pid" /* pid file */
diff --git a/include/resv.h b/include/resv.h
index 87bbe85..d40c2ea 100644
--- a/include/resv.h
+++ b/include/resv.h
@@ -30,7 +30,7 @@ struct ResvChannel
dlink_node node;
struct ResvChannel *hnext;
time_t hold; /* Hold action until this time (calendar time) */
- /* +1 for \0 */
+ time_t setat;
char name[CHANNELLEN + 1];
char *reason;
int conf; /* 1 if set from ircd.conf, 0 if from elsewhere */
diff --git a/modules/m_dline.c b/modules/m_dline.c
index 8c4c33d..b17a6fc 100644
--- a/modules/m_dline.c
+++ b/modules/m_dline.c
@@ -39,9 +39,9 @@
#include "send.h"
#include "hash.h"
#include "s_serv.h"
-#include "s_gline.h"
#include "parse.h"
#include "modules.h"
+#include "conf_db.h"
/* apply_tdline()
@@ -51,28 +51,39 @@
* side effects - tkline as given is placed
*/
static void
-apply_tdline(struct Client *source_p, struct ConfItem *conf,
- const char *current_date, int tkline_time)
+apply_dline(struct Client *source_p, struct AccessItem *aconf,
+ time_t tkline_time)
{
- struct AccessItem *aconf;
-
- aconf = map_to_conf(conf);
- aconf->hold = CurrentTime + tkline_time;
- SetConfTemporary(aconf);
- add_conf_by_address(CONF_DLINE, aconf);
-
-
- 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);
+ if (tkline_time)
+ {
+ aconf->hold = CurrentTime + tkline_time;
+ SetConfTemporary(aconf);
+ 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);
+ 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);
+ 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);
+ }
+ 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);
+ 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);
+ ilog(LOG_TYPE_DLINE, "%s added D-Line for [%s] [%s]",
+ get_oper_name(source_p), aconf->host, aconf->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);
- ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]",
- source_p->name, tkline_time/60, aconf->host, aconf->reason);
+ }
+ aconf->setat = CurrentTime;
+ add_conf_by_address(CONF_DLINE, aconf);
+ save_dline_database();
rehashed_klines = 1;
}
@@ -82,7 +93,7 @@ apply_tdline(struct Client *source_p, struct ConfItem *conf,
* Side effects: Any matching tdlines are removed.
*/
static int
-remove_tdline_match(const char *host)
+remove_dline_match(const char *host)
{
struct irc_ssaddr iphost, *piphost;
struct AccessItem *aconf;
@@ -106,9 +117,10 @@ remove_tdline_match(const char *host)
if ((aconf = find_conf_by_address(host, piphost, CONF_DLINE, t, NULL, NULL, 0)))
{
- if (IsConfTemporary(aconf))
+ if (!IsConfMain(aconf))
{
delete_one_address_conf(host, aconf);
+ save_dline_database();
return 1;
}
}
@@ -131,7 +143,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
char def_reason[] = "<No reason specified>";
- char *dlhost = NULL, *oper_reason = NULL, *reason = NULL;
+ char *dlhost = NULL, *reason = NULL;
char *target_server = NULL;
const char *creason;
const struct Client *target_p = NULL;
@@ -246,10 +258,6 @@ mo_dline(struct Client *client_p, struct Client *source_p,
cur_time = CurrentTime;
current_date = smalldate(cur_time);
- /* Look for an oper reason */
- if ((oper_reason = strchr(reason, '|')) != NULL)
- *oper_reason++ = '\0';
-
if (!valid_comment(source_p, reason, 1))
return;
@@ -262,18 +270,13 @@ mo_dline(struct Client *client_p, struct Client *source_p,
snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)",
(int)(tkline_time/60), reason, current_date);
DupString(aconf->reason, buffer);
- if (oper_reason != NULL)
- DupString(aconf->oper_reason, oper_reason);
- apply_tdline(source_p, conf, current_date, tkline_time);
+ apply_dline(source_p, aconf, tkline_time);
}
else
{
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
DupString(aconf->reason, buffer);
- if (oper_reason != NULL)
- DupString(aconf->oper_reason, oper_reason);
- add_conf_by_address(CONF_DLINE, aconf);
- write_conf_line(source_p, conf, current_date, cur_time);
+ apply_dline(source_p, aconf, 0);
}
rehashed_klines = 1;
@@ -284,7 +287,7 @@ ms_dline(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
char def_reason[] = "<No reason specified>";
- char *dlhost, *oper_reason, *reason;
+ char *dlhost, *reason;
const char *creason;
const struct Client *target_p = NULL;
struct irc_ssaddr daddr;
@@ -382,10 +385,6 @@ ms_dline(struct Client *client_p, struct Client *source_p,
cur_time = CurrentTime;
current_date = smalldate(cur_time);
- /* Look for an oper reason */
- if ((oper_reason = strchr(reason, '|')) != NULL)
- *oper_reason++ = '\0';
-
if (!valid_comment(source_p, reason, 1))
return;
@@ -398,18 +397,13 @@ ms_dline(struct Client *client_p, struct Client *source_p,
snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)",
(int)(tkline_time/60), reason, current_date);
DupString(aconf->reason, buffer);
- if (oper_reason != NULL)
- DupString(aconf->oper_reason, oper_reason);
- apply_tdline(source_p, conf, current_date, tkline_time);
+ apply_dline(source_p, aconf, tkline_time);
}
else
{
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
DupString(aconf->reason, buffer);
- if (oper_reason != NULL)
- DupString(aconf->oper_reason, oper_reason);
- add_conf_by_address(CONF_DLINE, aconf);
- write_conf_line(source_p, conf, current_date, cur_time);
+ apply_dline(source_p, aconf, 0);
}
rehashed_klines = 1;
@@ -463,26 +457,14 @@ mo_undline(struct Client *client_p, struct Client *source_p,
cluster_a_line(source_p, "UNDLINE", CAP_UNDLN, SHARED_UNDLINE,
"%s", addr);
- if (remove_tdline_match(addr))
+ if (remove_dline_match(addr))
{
sendto_one(source_p,
- ":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines",
+ ":%s NOTICE %s :D-Line for [%s] is removed",
me.name, source_p->name, addr);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "%s has removed the temporary D-Line for: [%s]",
+ "%s has removed the D-Line for: [%s]",
get_oper_name(source_p), addr);
- ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
- source_p->name, addr);
- return;
- }
-
- if (remove_conf_line(DLINE_TYPE, source_p, addr, NULL) > 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
- me.name, source_p->name, addr);
- sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "%s has removed the D-Line for: [%s]",
- get_oper_name(source_p), addr);
ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",
get_oper_name(source_p), addr);
}
@@ -510,27 +492,15 @@ me_undline(struct Client *client_p, struct Client *source_p,
source_p->username, source_p->host,
SHARED_UNDLINE))
{
- if (remove_tdline_match(addr))
+ if (remove_dline_match(addr))
{
sendto_one(source_p,
- ":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines",
- me.name, source_p->name, addr);
- sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "%s has removed the temporary D-Line for: [%s]",
- get_oper_name(source_p), addr);
- ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
- source_p->name, addr);
- return;
- }
-
- if (remove_conf_line(DLINE_TYPE, source_p, addr, NULL) > 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
+ ":%s NOTICE %s :D-Line for [%s] is removed",
me.name, source_p->name, addr);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s has removed the D-Line for: [%s]",
get_oper_name(source_p), addr);
- ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",
+ ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
get_oper_name(source_p), addr);
}
else
diff --git a/modules/m_gline.c b/modules/m_gline.c
index a1acdfd..8f8835b 100644
--- a/modules/m_gline.c
+++ b/modules/m_gline.c
@@ -43,6 +43,7 @@
#include "parse.h"
#include "modules.h"
#include "log.h"
+#include "conf_db.h"
#define GLINE_NOT_PLACED 0
#define GLINE_ALREADY_VOTED -1
@@ -61,21 +62,16 @@ set_local_gline(const struct Client *source_p, const char *user,
const char *host, const char *reason)
{
char buffer[IRCD_BUFSIZE];
- struct ConfItem *conf;
- struct AccessItem *aconf;
-
-
- conf = make_conf_item(GLINE_TYPE);
- aconf = map_to_conf(conf);
+ struct AccessItem *aconf = map_to_conf(make_conf_item(GLINE_TYPE));
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, smalldate(CurrentTime));
DupString(aconf->reason, buffer);
DupString(aconf->user, user);
DupString(aconf->host, host);
+ aconf->setat = CurrentTime;
aconf->hold = CurrentTime + ConfigFileEntry.gline_time;
SetConfTemporary(aconf);
- add_conf_by_address(CONF_GLINE, aconf);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s added G-Line for [%s@%s] [%s]",
@@ -84,7 +80,8 @@ set_local_gline(const struct Client *source_p, const char *user,
ilog(LOG_TYPE_GLINE, "%s added G-Line for [%s@%s] [%s]",
get_oper_name(source_p), aconf->user, aconf->host, aconf->reason);
- /* Now, activate gline against current online clients */
+ add_conf_by_address(CONF_GLINE, aconf);
+ save_gline_database();
rehashed_klines = 1;
}
@@ -118,11 +115,9 @@ remove_gline_match(const char *user, const char *host)
if ((aconf = find_conf_by_address(host, piphost, CONF_GLINE, t, user, NULL, 0)))
{
- if (IsConfTemporary(aconf))
- {
- delete_one_address_conf(host, aconf);
- return 1;
- }
+ delete_one_address_conf(host, aconf);
+ save_gline_database();
+ return 1;
}
return 0;
diff --git a/modules/m_kline.c b/modules/m_kline.c
index 9270d0f..315c5e8 100644
--- a/modules/m_kline.c
+++ b/modules/m_kline.c
@@ -42,14 +42,14 @@
#include "s_gline.h"
#include "parse.h"
#include "modules.h"
+#include "conf_db.h"
static int already_placed_kline(struct Client *, const char *, const char *, int);
-static void apply_kline(struct Client *, struct ConfItem *, const char *, time_t);
-static void apply_tkline(struct Client *, struct ConfItem *, int);
+static void m_kline_add_kline(struct Client *, struct AccessItem *, time_t);
static char buffer[IRCD_BUFSIZE];
-static int remove_tkline_match(const char *, const char *);
+static int remove_kline_match(const char *, const char *);
/* mo_kline()
@@ -66,7 +66,6 @@ mo_kline(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
char *reason = NULL;
- char *oper_reason;
char *user = NULL;
char *host = NULL;
const char *current_date;
@@ -117,10 +116,6 @@ mo_kline(struct Client *client_p, struct Client *source_p,
if (already_placed_kline(source_p, user, host, 1))
return;
- /* Look for an oper reason */
- if ((oper_reason = strchr(reason, '|')) != NULL)
- *oper_reason++ = '\0';
-
cur_time = CurrentTime;
current_date = smalldate(cur_time);
conf = make_conf_item(KLINE_TYPE);
@@ -135,18 +130,14 @@ mo_kline(struct Client *client_p, struct Client *source_p,
(int)(tkline_time/60), reason, current_date);
DupString(aconf->reason, buffer);
- if (oper_reason != NULL)
- DupString(aconf->oper_reason, oper_reason);
- apply_tkline(source_p, conf, tkline_time);
+ m_kline_add_kline(source_p, aconf, tkline_time);
}
else
{
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
DupString(aconf->reason, buffer);
- if (oper_reason != NULL)
- DupString(aconf->oper_reason, oper_reason);
- apply_kline(source_p, conf, current_date, cur_time);
+ m_kline_add_kline(source_p, aconf, 0);
}
}
@@ -160,7 +151,7 @@ me_kline(struct Client *client_p, struct Client *source_p,
int tkline_time;
const char* current_date;
time_t cur_time;
- char *kuser, *khost, *kreason, *oper_reason;
+ char *kuser, *khost, *kreason;
if (parc != 6 || EmptyString(parv[5]))
return;
@@ -173,9 +164,6 @@ me_kline(struct Client *client_p, struct Client *source_p,
khost = parv[4];
kreason = parv[5];
- if ((oper_reason = strchr(kreason, '|')) != NULL)
- *oper_reason++ = '\0';
-
cur_time = CurrentTime;
current_date = smalldate(cur_time);
@@ -198,18 +186,14 @@ me_kline(struct Client *client_p, struct Client *source_p,
(int)(tkline_time/60), kreason, current_date);
DupString(aconf->reason, buffer);
- if (oper_reason != NULL)
- DupString(aconf->oper_reason, oper_reason);
- apply_tkline(source_p, conf, tkline_time);
+ m_kline_add_kline(source_p, aconf, tkline_time);
}
else
{
snprintf(buffer, sizeof(buffer), "%s (%s)", kreason, current_date);
DupString(aconf->reason, buffer);
- if (oper_reason != NULL)
- DupString(aconf->oper_reason, oper_reason);
- apply_kline(source_p, conf, current_date, cur_time);
+ m_kline_add_kline(source_p, aconf, 0);
}
}
}
@@ -230,25 +214,6 @@ ms_kline(struct Client *client_p, struct Client *source_p,
me_kline(client_p, source_p, parc, parv);
}
-/* apply_kline()
- *
- * inputs -
- * output - NONE
- * side effects - kline as given, is added to the hashtable
- * and conf file
- */
-static void
-apply_kline(struct Client *source_p, struct ConfItem *conf,
- const char *current_date, time_t cur_time)
-{
- struct AccessItem *aconf = map_to_conf(conf);
-
- add_conf_by_address(CONF_KLINE, aconf);
- write_conf_line(source_p, conf, current_date, cur_time);
- /* Now, activate kline against current online clients */
- rehashed_klines = 1;
-}
-
/* apply_tkline()
*
* inputs -
@@ -256,28 +221,43 @@ apply_kline(struct Client *source_p, struct ConfItem *conf,
* side effects - tkline as given is placed
*/
static void
-apply_tkline(struct Client *source_p, struct ConfItem *conf,
- int tkline_time)
+m_kline_add_kline(struct Client *source_p, struct AccessItem *aconf,
+ time_t tkline_time)
{
- struct AccessItem *aconf;
+ aconf->setat = CurrentTime;
- aconf = (struct AccessItem *)map_to_conf(conf);
- aconf->hold = CurrentTime + tkline_time;
- SetConfTemporary(aconf);
- add_conf_by_address(CONF_KLINE, aconf);
+ if (tkline_time)
+ {
+ aconf->hold = CurrentTime + tkline_time;
+ SetConfTemporary(aconf);
- 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);
- 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);
- 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);
+ 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);
+ 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);
+ 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);
+ }
+ 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);
+ 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);
+ ilog(LOG_TYPE_KLINE, "%s added K-Line for [%s@%s] [%s]",
+ source_p->name, aconf->user, aconf->host, aconf->reason);
+ }
+ add_conf_by_address(CONF_KLINE, aconf);
+ save_kline_database();
rehashed_klines = 1;
}
@@ -356,7 +336,7 @@ mo_unkline(struct Client *client_p,struct Client *source_p,
return;
}
- if (parc < 2 || EmptyString(parv[1]))
+ if (EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "UNKLINE");
@@ -381,24 +361,12 @@ mo_unkline(struct Client *client_p,struct Client *source_p,
cluster_a_line(source_p, "UNKLINE", CAP_UNKLN, SHARED_UNKLINE,
"%s %s", user, host);
- if (remove_tkline_match(host, user))
+ if (remove_kline_match(host, user))
{
sendto_one(source_p,
- ":%s NOTICE %s :Un-klined [%s@%s] from temporary K-Lines",
+ ":%s NOTICE %s :K-Line for [%s@%s] is removed",
me.name, source_p->name, user, host);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "%s has removed the temporary K-Line for: [%s@%s]",
- get_oper_name(source_p), user, host);
- ilog(LOG_TYPE_KLINE, "%s removed temporary K-Line for [%s@%s]",
- source_p->name, user, host);
- return;
- }
-
- if (remove_conf_line(KLINE_TYPE, source_p, user, host) > 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :K-Line for [%s@%s] is removed",
- me.name, source_p->name, user,host);
- sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s has removed the K-Line for: [%s@%s]",
get_oper_name(source_p), user, host);
ilog(LOG_TYPE_KLINE, "%s removed K-Line for [%s@%s]",
@@ -439,27 +407,14 @@ me_unkline(struct Client *client_p, struct Client *source_p,
source_p->username, source_p->host,
SHARED_UNKLINE))
{
- if (remove_tkline_match(khost, kuser))
+ if (remove_kline_match(khost, kuser))
{
sendto_one(source_p,
- ":%s NOTICE %s :Un-klined [%s@%s] from temporary K-Lines",
- me.name, source_p->name, kuser, khost);
- sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "%s has removed the temporary K-Line for: [%s@%s]",
- get_oper_name(source_p), kuser, khost);
- ilog(LOG_TYPE_KLINE, "%s removed temporary K-Line for [%s@%s]",
- source_p->name, kuser, khost);
- return;
- }
-
- if (remove_conf_line(KLINE_TYPE, source_p, kuser, khost) > 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :K-Line for [%s@%s] is removed",
+ ":%s NOTICE %s :K-Line for [%s@%s] is removed",
me.name, source_p->name, kuser, khost);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s has removed the K-Line for: [%s@%s]",
- get_oper_name(source_p), kuser, khost);
-
+ get_oper_name(source_p), kuser, khost);
ilog(LOG_TYPE_KLINE, "%s removed K-Line for [%s@%s]",
source_p->name, kuser, khost);
}
@@ -490,7 +445,7 @@ ms_unkline(struct Client *client_p, struct Client *source_p,
* Side effects: Any matching tklines are removed.
*/
static int
-remove_tkline_match(const char *host, const char *user)
+remove_kline_match(const char *host, const char *user)
{
struct irc_ssaddr iphost, *piphost;
struct AccessItem *aconf;
@@ -514,9 +469,10 @@ remove_tkline_match(const char *host, const char *user)
if ((aconf = find_conf_by_address(host, piphost, CONF_KLINE, t, user, NULL, 0)))
{
- if (IsConfTemporary(aconf))
+ if (!IsConfMain(aconf))
{
delete_one_address_conf(host, aconf);
+ save_kline_database();
return 1;
}
}
diff --git a/modules/m_resv.c b/modules/m_resv.c
index e57a67e..e2546b7 100644
--- a/modules/m_resv.c
+++ b/modules/m_resv.c
@@ -232,6 +232,7 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
}
resv_p = map_to_conf(conf);
+ resv_p->setat = CurrentTime;
if (tkline_time != 0)
{
@@ -293,6 +294,7 @@ parse_resv(struct Client *source_p, char *name, int tkline_time, char *reason)
}
resv_p = map_to_conf(conf);
+ resv_p->setat = CurrentTime;
if (tkline_time != 0)
{
diff --git a/modules/m_stats.c b/modules/m_stats.c
index 938b068..e995d4f 100644
--- a/modules/m_stats.c
+++ b/modules/m_stats.c
@@ -416,8 +416,7 @@ stats_deny(struct Client *source_p, int parc, char *parv[])
conf = unmap_conf_item(aconf);
sendto_one(source_p, form_str(RPL_STATSDLINE),
- from, to, 'D', aconf->host, aconf->reason,
- aconf->oper_reason ? aconf->oper_reason : "");
+ from, to, 'D', aconf->host, aconf->reason);
}
}
}
@@ -455,8 +454,7 @@ stats_tdeny(struct Client *source_p, int parc, char *parv[])
conf = unmap_conf_item(aconf);
sendto_one(source_p, form_str(RPL_STATSDLINE),
- from, to, 'd', aconf->host, aconf->reason,
- aconf->oper_reason ? aconf->oper_reason : "");
+ from, to, 'd', aconf->host, aconf->reason);
}
}
}
@@ -498,7 +496,7 @@ stats_exempt(struct Client *source_p, int parc, char *parv[])
sendto_one(source_p, form_str(RPL_STATSDLINE),
from, to, 'e', aconf->host,
- aconf->reason, aconf->oper_reason ? aconf->oper_reason : "");
+ aconf->reason);
}
}
}
@@ -632,7 +630,7 @@ stats_glines(struct Client *source_p, int parc, char *parv[])
from, to, "G",
aconf->host ? aconf->host : "*",
aconf->user ? aconf->user : "*",
- aconf->reason ? aconf->reason : "No reason", "" );
+ aconf->reason ? aconf->reason : "No reason");
}
}
}
@@ -812,11 +810,11 @@ report_Klines(struct Client *client_p, int tkline)
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, aconf->oper_reason ? aconf->oper_reason : "");
+ aconf->reason);
else
sendto_one(client_p, form_str(RPL_STATSKLINE), me.name,
client_p->name, p, aconf->host, aconf->user,
- aconf->reason, "");
+ aconf->reason);
}
}
}
@@ -853,7 +851,7 @@ stats_tklines(struct Client *source_p, int parc, char *parv[])
return;
sendto_one(source_p, form_str(RPL_STATSKLINE), from,
- to, "k", aconf->host, aconf->user, aconf->reason, "");
+ to, "k", aconf->host, aconf->user, aconf->reason);
}
/* Theyre opered, or allowed to see all klines */
else {
@@ -893,7 +891,7 @@ stats_klines(struct Client *source_p, int parc, char *parv[])
return;
sendto_one(source_p, form_str(RPL_STATSKLINE), from,
- to, "K", aconf->host, aconf->user, aconf->reason, "");
+ to, "K", aconf->host, aconf->user, aconf->reason);
}
/* Theyre opered, or allowed to see all klines */
else {
diff --git a/modules/m_testline.c b/modules/m_testline.c
index f9a8e67..2d26658 100644
--- a/modules/m_testline.c
+++ b/modules/m_testline.c
@@ -125,8 +125,7 @@ mo_testline(struct Client *client_p, struct Client *source_p,
IsConfTemporary(aconf) ? 'd' : 'D',
IsConfTemporary(aconf) ? ((aconf->hold - CurrentTime) / 60)
: 0L,
- aconf->host, aconf->reason,
- aconf->oper_reason ? aconf->oper_reason : "");
+ aconf->host, aconf->reason);
}
}
@@ -159,8 +158,7 @@ mo_testline(struct Client *client_p, struct Client *source_p,
IsConfTemporary(aconf) ? 'k' : 'K',
IsConfTemporary(aconf) ? ((aconf->hold - CurrentTime) / 60)
: 0L,
- userhost, aconf->reason? aconf->reason : "No reason",
- aconf->oper_reason ? aconf->oper_reason : "");
+ userhost, aconf->reason? aconf->reason : "No reason");
++matches;
}
}
@@ -174,8 +172,7 @@ mo_testline(struct Client *client_p, struct Client *source_p,
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, 'Q', 0L,
conf->name,
- mconf->reason ? mconf->reason : "No reason",
- mconf->oper_reason ? mconf->oper_reason : "");
+ mconf->reason ? mconf->reason : "No reason");;
++matches;
}
@@ -215,8 +212,7 @@ mo_testgecos(struct Client *client_p, struct Client *source_p,
const struct MatchItem *xconf = map_to_conf(conf);
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, 'X', 0L,
- conf->name, xconf->reason ? xconf->reason : "X-lined",
- xconf->oper_reason ? xconf->oper_reason : "");
+ conf->name, xconf->reason ? xconf->reason : "X-lined");
}
else
sendto_one(source_p, form_str(RPL_NOTESTLINE),
diff --git a/modules/m_xline.c b/modules/m_xline.c
index 1020e09..c0413a7 100644
--- a/modules/m_xline.c
+++ b/modules/m_xline.c
@@ -42,12 +42,13 @@
#include "parse.h"
#include "modules.h"
#include "resv.h"
+#include "conf_db.h"
static int valid_xline(struct Client *, char *, char *, int);
static void write_xline(struct Client *, char *, char *, time_t);
static void remove_xline(struct Client *, char *);
-static int remove_txline_match(const char *);
+static int remove_xline_match(const char *);
static void relay_xline(struct Client *, char *[]);
@@ -307,13 +308,6 @@ valid_xline(struct Client *source_p, char *gecos, char *reason, int warn)
return 0;
}
- if (strchr(gecos, '"'))
- {
- sendto_one(source_p, ":%s NOTICE %s :Invalid character '\"'",
- me.name, source_p->name);
- return 0;
- }
-
if (!valid_wild_card_simple(gecos))
{
if (warn)
@@ -337,66 +331,68 @@ write_xline(struct Client *source_p, char *gecos, char *reason,
time_t tkline_time)
{
struct ConfItem *conf;
- struct MatchItem *match_item;
+ struct MatchItem *xconf;
const char *current_date;
time_t cur_time;
conf = make_conf_item(XLINE_TYPE);
- match_item = map_to_conf(conf);
+ xconf = map_to_conf(conf);
collapse(gecos);
DupString(conf->name, gecos);
- DupString(match_item->reason, reason);
- DupString(match_item->oper_reason, ""); /* XXX */
+ DupString(xconf->reason, reason);
cur_time = CurrentTime;
current_date = smalldate(cur_time);
+ xconf->setat = CurrentTime;
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, match_item->reason);
+ conf->name, xconf->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, match_item->reason);
- match_item->hold = CurrentTime + tkline_time;
- add_temp_line(conf);
+ conf->name, xconf->reason);
+ xconf->hold = CurrentTime + tkline_time;
+ SetConfTemporary(conf);
}
else
- write_conf_line(source_p, conf, current_date, cur_time);
+ {
+ 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);
+ 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);
+ ilog(LOG_TYPE_IRCD, "%s added X-Line for [%s] [%s]",
+ get_oper_name(source_p), conf->name, xconf->reason);
+ }
+
+ save_xline_database();
rehashed_klines = 1;
}
static void
remove_xline(struct Client *source_p, char *gecos)
{
- /* XXX use common temporary un function later */
- if (remove_txline_match(gecos))
+ if (remove_xline_match(gecos))
{
sendto_one(source_p,
- ":%s NOTICE %s :Un-xlined [%s] from temporary X-Lines",
- me.name, source_p->name, gecos);
- sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "%s has removed the temporary X-Line for: [%s]",
- get_oper_name(source_p), gecos);
- ilog(LOG_TYPE_KLINE, "%s removed temporary X-Line for [%s]",
- source_p->name, gecos);
- return;
- }
-
- if (remove_conf_line(XLINE_TYPE, source_p, gecos, NULL) > 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :X-Line for [%s] is removed",
+ ":%s NOTICE %s :X-Line for [%s] is removed",
me.name, source_p->name, gecos);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s has removed the X-Line for: [%s]",
get_oper_name(source_p), gecos);
ilog(LOG_TYPE_KLINE, "%s removed X-Line for [%s]",
- get_oper_name(source_p), gecos);
+ source_p->name, gecos);
+ save_xline_database();
}
else
sendto_one(source_p, ":%s NOTICE %s :No X-Line for %s",
@@ -410,21 +406,22 @@ remove_xline(struct Client *source_p, char *gecos)
* Side effects: Any matching tklines are removed.
*/
static int
-remove_txline_match(const char *gecos)
+remove_xline_match(const char *gecos)
{
dlink_node *ptr = NULL, *next_ptr = NULL;
struct ConfItem *conf = NULL;
- DLINK_FOREACH_SAFE(ptr, next_ptr, temporary_xlines.head)
+ DLINK_FOREACH_SAFE(ptr, next_ptr, xconf_items.head)
{
conf = ptr->data;
- if (irccmp(gecos, conf->name) == 0)
+ if (IsConfMain(conf))
+ continue;
+
+ if (!irccmp(gecos, conf->name))
{
- dlinkDelete(ptr, &temporary_xlines);
free_dlink_node(ptr);
delete_conf_item(conf);
-
return 1;
}
}
diff --git a/src/Makefile.am b/src/Makefile.am
index 08ccec6..b1418b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -17,7 +17,6 @@ ircd_SOURCES = balloc.c \
conf_db.c \
conf_parser.y \
conf_lexer.l \
- csvlib.c \
dbuf.c \
event.c \
fdlist.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 1343ee8..063d156 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -69,22 +69,21 @@ PROGRAMS = $(sbin_PROGRAMS)
am_ircd_OBJECTS = balloc.$(OBJEXT) channel.$(OBJEXT) \
channel_mode.$(OBJEXT) client.$(OBJEXT) conf.$(OBJEXT) \
conf_db.$(OBJEXT) conf_parser.$(OBJEXT) conf_lexer.$(OBJEXT) \
- csvlib.$(OBJEXT) dbuf.$(OBJEXT) event.$(OBJEXT) \
- fdlist.$(OBJEXT) getopt.$(OBJEXT) hash.$(OBJEXT) \
- hook.$(OBJEXT) hostmask.$(OBJEXT) irc_res.$(OBJEXT) \
- irc_reslib.$(OBJEXT) irc_string.$(OBJEXT) ircd.$(OBJEXT) \
- ircd_signal.$(OBJEXT) list.$(OBJEXT) listener.$(OBJEXT) \
- log.$(OBJEXT) match.$(OBJEXT) memory.$(OBJEXT) \
- modules.$(OBJEXT) motd.$(OBJEXT) rng_mt.$(OBJEXT) \
- numeric.$(OBJEXT) packet.$(OBJEXT) parse.$(OBJEXT) \
- s_bsd_epoll.$(OBJEXT) s_bsd_poll.$(OBJEXT) \
- s_bsd_sigio.$(OBJEXT) s_bsd_devpoll.$(OBJEXT) \
- s_bsd_kqueue.$(OBJEXT) s_bsd_select.$(OBJEXT) \
- restart.$(OBJEXT) resv.$(OBJEXT) rsa.$(OBJEXT) \
- s_auth.$(OBJEXT) s_bsd.$(OBJEXT) s_gline.$(OBJEXT) \
- s_misc.$(OBJEXT) s_serv.$(OBJEXT) s_user.$(OBJEXT) \
- send.$(OBJEXT) sprintf_irc.$(OBJEXT) version.$(OBJEXT) \
- watch.$(OBJEXT) whowas.$(OBJEXT)
+ dbuf.$(OBJEXT) event.$(OBJEXT) fdlist.$(OBJEXT) \
+ getopt.$(OBJEXT) hash.$(OBJEXT) hook.$(OBJEXT) \
+ hostmask.$(OBJEXT) irc_res.$(OBJEXT) irc_reslib.$(OBJEXT) \
+ irc_string.$(OBJEXT) ircd.$(OBJEXT) ircd_signal.$(OBJEXT) \
+ list.$(OBJEXT) listener.$(OBJEXT) log.$(OBJEXT) \
+ match.$(OBJEXT) memory.$(OBJEXT) modules.$(OBJEXT) \
+ motd.$(OBJEXT) rng_mt.$(OBJEXT) numeric.$(OBJEXT) \
+ packet.$(OBJEXT) parse.$(OBJEXT) s_bsd_epoll.$(OBJEXT) \
+ s_bsd_poll.$(OBJEXT) s_bsd_sigio.$(OBJEXT) \
+ s_bsd_devpoll.$(OBJEXT) s_bsd_kqueue.$(OBJEXT) \
+ s_bsd_select.$(OBJEXT) restart.$(OBJEXT) resv.$(OBJEXT) \
+ rsa.$(OBJEXT) s_auth.$(OBJEXT) s_bsd.$(OBJEXT) \
+ s_gline.$(OBJEXT) s_misc.$(OBJEXT) s_serv.$(OBJEXT) \
+ s_user.$(OBJEXT) send.$(OBJEXT) sprintf_irc.$(OBJEXT) \
+ version.$(OBJEXT) watch.$(OBJEXT) whowas.$(OBJEXT)
ircd_OBJECTS = $(am_ircd_OBJECTS)
am__DEPENDENCIES_1 =
ircd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -278,7 +277,6 @@ ircd_SOURCES = balloc.c \
conf_db.c \
conf_parser.y \
conf_lexer.l \
- csvlib.c \
dbuf.c \
event.c \
fdlist.c \
@@ -424,7 +422,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_db.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_lexer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_parser.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csvlib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbuf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdlist.Po@am__quote@
diff --git a/src/conf.c b/src/conf.c
index 98109d8..1590464 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -51,6 +51,7 @@
#include "channel_mode.h"
#include "parse.h"
#include "s_misc.h"
+#include "conf_db.h"
struct Callback *client_check_cb = NULL;
struct config_server_hide ConfigServerHide;
@@ -87,7 +88,6 @@ static int hash_ip(struct irc_ssaddr *);
static int verify_access(struct Client *, const char *);
static int attach_iline(struct Client *, struct ConfItem *);
static struct ip_entry *find_or_add_ip(struct irc_ssaddr *);
-static void parse_conf_file(int, int);
static dlink_list *map_to_list(ConfType);
static struct AccessItem *find_regexp_kline(const char *[]);
static int find_user_host(struct Client *, char *, char *, char *, unsigned int);
@@ -355,7 +355,6 @@ delete_conf_item(struct ConfItem *conf)
MyFree(aconf->passwd);
MyFree(aconf->spasswd);
MyFree(aconf->reason);
- MyFree(aconf->oper_reason);
MyFree(aconf->user);
MyFree(aconf->host);
#ifdef HAVE_LIBCRYPTO
@@ -414,7 +413,6 @@ delete_conf_item(struct ConfItem *conf)
MyFree(match_item->user);
MyFree(match_item->host);
MyFree(match_item->reason);
- MyFree(match_item->oper_reason);
dlinkDelete(&conf->node, &uconf_items);
MyFree(conf);
break;
@@ -424,7 +422,6 @@ delete_conf_item(struct ConfItem *conf)
MyFree(match_item->user);
MyFree(match_item->host);
MyFree(match_item->reason);
- MyFree(match_item->oper_reason);
dlinkDelete(&conf->node, &xconf_items);
MyFree(conf);
break;
@@ -436,7 +433,6 @@ delete_conf_item(struct ConfItem *conf)
MyFree(aconf->user);
MyFree(aconf->host);
MyFree(aconf->reason);
- MyFree(aconf->oper_reason);
dlinkDelete(&conf->node, &rkconf_items);
MyFree(conf);
break;
@@ -447,7 +443,6 @@ delete_conf_item(struct ConfItem *conf)
MyFree(match_item->user);
MyFree(match_item->host);
MyFree(match_item->reason);
- MyFree(match_item->oper_reason);
dlinkDelete(&conf->node, &rxconf_items);
MyFree(conf);
break;
@@ -457,7 +452,6 @@ delete_conf_item(struct ConfItem *conf)
MyFree(match_item->user);
MyFree(match_item->host);
MyFree(match_item->reason);
- MyFree(match_item->oper_reason);
dlinkDelete(&conf->node, &nresv_items);
if (conf->flags & CONF_FLAGS_TEMPORARY)
@@ -569,7 +563,7 @@ report_confitem_types(struct Client *source_p, ConfType type)
sendto_one(source_p, form_str(RPL_STATSKLINE), me.name,
source_p->name, "KR", aconf->host, aconf->user,
- aconf->reason, aconf->oper_reason ? aconf->oper_reason : "");
+ aconf->reason);
}
break;
#endif
@@ -2025,12 +2019,7 @@ find_gline(struct Client *client_p)
void
add_temp_line(struct ConfItem *conf)
{
- if (conf->type == XLINE_TYPE)
- {
- conf->flags |= CONF_FLAGS_TEMPORARY;
- dlinkAdd(conf, make_dlink_node(), &temporary_xlines);
- }
- else if ((conf->type == NRESV_TYPE) || (conf->type == CRESV_TYPE))
+ if ((conf->type == NRESV_TYPE) || (conf->type == CRESV_TYPE))
{
conf->flags |= CONF_FLAGS_TEMPORARY;
dlinkAdd(conf, make_dlink_node(), &temporary_resv);
@@ -2048,7 +2037,7 @@ void
cleanup_tklines(void *notused)
{
hostmask_expire_temporary();
- expire_tklines(&temporary_xlines);
+ expire_tklines(&xconf_items);
expire_tklines(&temporary_resv);
}
@@ -2074,14 +2063,15 @@ expire_tklines(dlink_list *tklist)
if (conf->type == XLINE_TYPE)
{
+ if (!IsConfTemporary(conf))
+ continue;
+
xconf = (struct MatchItem *)map_to_conf(conf);
if (xconf->hold <= CurrentTime)
{
if (ConfigFileEntry.tkline_expire_notices)
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"Temporary X-line for [%s] expired", conf->name);
- dlinkDelete(ptr, tklist);
- free_dlink_node(ptr);
delete_conf_item(conf);
}
}
@@ -2212,7 +2202,7 @@ read_conf_files(int cold)
char chanlimit[32];
conf_parser_ctx.boot = cold;
- filename = get_conf_name(CONF_TYPE);
+ filename = ConfigFileEntry.configfile;
/* We need to know the initial filename for the yyerror() to report
FIXME: The full path is in conffilenamebuf first time since we
@@ -2269,41 +2259,6 @@ read_conf_files(int cold)
* on strlen(form_str(RPL_ISUPPORT))
*/
rebuild_isupport_message_line();
-
- parse_conf_file(KLINE_TYPE, cold);
- parse_conf_file(DLINE_TYPE, cold);
- parse_conf_file(XLINE_TYPE, cold);
- parse_conf_file(NRESV_TYPE, cold);
- parse_conf_file(CRESV_TYPE, cold);
-}
-
-/* parse_conf_file()
- *
- * inputs - type of conf file to parse
- * output - none
- * side effects - conf file for givenconf type is opened and read then parsed
- */
-static void
-parse_conf_file(int type, int cold)
-{
- FILE *file = NULL;
- const char *filename = get_conf_name(type);
-
- if ((file = fopen(filename, "r")) == NULL)
- {
- if (cold)
- ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s",
- filename, strerror(errno));
- else
- sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "Unable to read configuration file '%s': %s",
- filename, strerror(errno));
- }
- else
- {
- parse_csv_file(file, type);
- fclose(file);
- }
}
/* clear_out_old_conf()
@@ -2495,42 +2450,6 @@ flush_deleted_I_P(void)
}
}
-/* get_conf_name()
- *
- * inputs - type of conf file to return name of file for
- * output - pointer to filename for type of conf
- * side effects - none
- */
-const char *
-get_conf_name(ConfType type)
-{
- switch (type)
- {
- case CONF_TYPE:
- return ConfigFileEntry.configfile;
- break;
- case KLINE_TYPE:
- return ConfigFileEntry.klinefile;
- break;
- case DLINE_TYPE:
- return ConfigFileEntry.dlinefile;
- break;
- case XLINE_TYPE:
- return ConfigFileEntry.xlinefile;
- break;
- case CRESV_TYPE:
- return ConfigFileEntry.cresvfile;
- break;
- case NRESV_TYPE:
- return ConfigFileEntry.nresvfile;
- break;
- default:
- return NULL; /* This should NEVER HAPPEN since we call this function
- only with the above values, this will cause us to core
- at some point if this happens so we know where it was */
- }
-}
-
#define BAD_PING (-1)
/* get_conf_ping()
diff --git a/src/conf_db.c b/src/conf_db.c
index 9c1a70c..a888b56 100644
--- a/src/conf_db.c
+++ b/src/conf_db.c
@@ -32,6 +32,9 @@
#include "log.h"
#include "send.h"
#include "irc_string.h"
+#include "conf.h"
+#include "hostmask.h"
+#include "resv.h"
/*! \brief Return the version number on the file. Return 0 if there is no version
@@ -101,7 +104,7 @@ open_db_read(const char *service, const char *filename)
int errno_save = errno;
if (errno != ENOENT)
- ilog(LOG_TYPE_IRCD, "Can not read %s database %s", service,
+ ilog(LOG_TYPE_IRCD, "Can't read %s database %s", service,
f->filename);
MyFree(f);
@@ -157,11 +160,11 @@ open_db_write(const char *service, const char *filename,
if (!walloped++)
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "Can not back up %s database %s",
+ "Can't back up %s database %s",
service, filename);
errno = errno_save;
- ilog(LOG_TYPE_IRCD, "Can not back up %s database %s", service, filename);
+ ilog(LOG_TYPE_IRCD, "Can't back up %s database %s", service, filename);
if (f->backupfp)
fclose(f->backupfp);
@@ -198,7 +201,7 @@ open_db_write(const char *service, const char *filename,
}
if (f->backupname[0] && rename(f->backupname, filename) < 0)
- ilog(LOG_TYPE_IRCD, "Cannot restore backup copy of %s",
+ ilog(LOG_TYPE_IRCD, "Can't restore backup copy of %s",
filename);
MyFree(f);
@@ -592,3 +595,481 @@ write_string(const char *s, struct dbFILE *f)
return 0;
}
+
+#define SAFE_READ(x) do { \
+ if ((x) < 0) { \
+ break; \
+ } \
+} while (0)
+
+#define SAFE_WRITE(x,db) do { \
+ if ((x) < 0) { \
+ restore_db(f); \
+ ilog(LOG_TYPE_IRCD, "Write error on %s", db); \
+ return; \
+ } \
+} while (0)
+
+void
+save_kline_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL;
+
+ if (!(f = open_db("kline", KPATH, "w", KLINE_DB_VERSION)))
+ return;
+
+ for (i = 0; i < ATABLE_SIZE; ++i)
+ {
+ DLINK_FOREACH(ptr, atable[i].head)
+ {
+ struct AddressRec *arec = ptr->data;
+
+ if (arec->type == CONF_KLINE && !IsConfMain(arec->aconf))
+ ++cnt;
+ }
+ }
+
+ SAFE_WRITE(write_uint32(cnt, f), KPATH);
+
+ for (i = 0; i < ATABLE_SIZE; ++i)
+ {
+ DLINK_FOREACH(ptr, atable[i].head)
+ {
+ struct AddressRec *arec = ptr->data;
+
+ if (arec->type == CONF_KLINE && !IsConfMain(arec->aconf))
+ {
+ SAFE_WRITE(write_string(arec->aconf->user, f), KPATH);
+ SAFE_WRITE(write_string(arec->aconf->host, f), KPATH);
+ SAFE_WRITE(write_string(arec->aconf->reason, f), KPATH);
+ SAFE_WRITE(write_uint64(arec->aconf->setat, f), KPATH);
+ SAFE_WRITE(write_uint64(arec->aconf->hold, f), KPATH);
+ }
+ }
+ }
+
+ close_db(f);
+}
+
+void
+load_kline_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ uint64_t tmp64 = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL, *ptr_next = NULL;
+
+ if (!(f = open_db("kline", KPATH, "r", KLINE_DB_VERSION)))
+ return;
+
+ if ((version = get_file_version(f) < 1))
+ {
+ close_db(f);
+ return;
+ }
+
+ read_uint32(&cnt, f);
+
+ for (i = 0; i < cnt; ++i)
+ {
+ struct AccessItem *aconf = map_to_conf(make_conf_item(KLINE_TYPE));
+
+ SAFE_READ(read_string(&aconf->user, f));
+ SAFE_READ(read_string(&aconf->host, f));
+ SAFE_READ(read_string(&aconf->reason, f));
+
+ SAFE_READ(read_uint64(&tmp64, f));
+ aconf->setat = tmp64;
+
+ SAFE_READ(read_uint64(&tmp64, f));
+ aconf->hold = tmp64;
+
+ if (aconf->hold)
+ SetConfTemporary(aconf);
+
+ add_conf_by_address(CONF_KLINE, aconf);
+ }
+
+ close_db(f);
+}
+
+void
+save_dline_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL;
+
+ if (!(f = open_db("dline", DLPATH, "w", KLINE_DB_VERSION)))
+ return;
+
+ for (i = 0; i < ATABLE_SIZE; ++i)
+ {
+ DLINK_FOREACH(ptr, atable[i].head)
+ {
+ struct AddressRec *arec = ptr->data;
+
+ if (arec->type == CONF_DLINE && !IsConfMain(arec->aconf))
+ ++cnt;
+ }
+ }
+
+ SAFE_WRITE(write_uint32(cnt, f), DLPATH);
+
+ for (i = 0; i < ATABLE_SIZE; ++i)
+ {
+ DLINK_FOREACH(ptr, atable[i].head)
+ {
+ struct AddressRec *arec = ptr->data;
+
+ if (arec->type == CONF_DLINE && !IsConfMain(arec->aconf))
+ {
+ SAFE_WRITE(write_string(arec->aconf->host, f), DLPATH);
+ SAFE_WRITE(write_string(arec->aconf->reason, f), DLPATH);
+ SAFE_WRITE(write_uint64(arec->aconf->setat, f), DLPATH);
+ SAFE_WRITE(write_uint64(arec->aconf->hold, f), DLPATH);
+ }
+ }
+ }
+
+ close_db(f);
+}
+
+void
+load_dline_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ uint64_t tmp64 = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL, *ptr_next = NULL;
+
+ if (!(f = open_db("dline", DLPATH, "r", KLINE_DB_VERSION)))
+ return;
+
+ if ((version = get_file_version(f) < 1))
+ {
+ close_db(f);
+ return;
+ }
+
+ read_uint32(&cnt, f);
+
+ for (i = 0; i < cnt; ++i)
+ {
+ struct AccessItem *aconf = map_to_conf(make_conf_item(DLINE_TYPE));
+
+ SAFE_READ(read_string(&aconf->host, f));
+ SAFE_READ(read_string(&aconf->reason, f));
+
+ SAFE_READ(read_uint64(&tmp64, f));
+ aconf->setat = tmp64;
+
+ SAFE_READ(read_uint64(&tmp64, f));
+ aconf->hold = tmp64;
+
+ if (aconf->hold)
+ SetConfTemporary(aconf);
+
+ add_conf_by_address(CONF_DLINE, aconf);
+ }
+
+ close_db(f);
+}
+
+void
+save_gline_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL;
+
+ if (!(f = open_db("gline", GPATH, "w", KLINE_DB_VERSION)))
+ return;
+
+ for (i = 0; i < ATABLE_SIZE; ++i)
+ {
+ DLINK_FOREACH(ptr, atable[i].head)
+ {
+ struct AddressRec *arec = ptr->data;
+
+ if (arec->type == CONF_GLINE && !IsConfMain(arec->aconf))
+ ++cnt;
+ }
+ }
+
+ SAFE_WRITE(write_uint32(cnt, f), GPATH);
+
+ for (i = 0; i < ATABLE_SIZE; ++i)
+ {
+ DLINK_FOREACH(ptr, atable[i].head)
+ {
+ struct AddressRec *arec = ptr->data;
+
+ if (arec->type == CONF_GLINE && !IsConfMain(arec->aconf))
+ {
+ SAFE_WRITE(write_string(arec->aconf->user, f), GPATH);
+ SAFE_WRITE(write_string(arec->aconf->host, f), GPATH);
+ SAFE_WRITE(write_string(arec->aconf->reason, f), GPATH);
+ SAFE_WRITE(write_uint64(arec->aconf->setat, f), GPATH);
+ SAFE_WRITE(write_uint64(arec->aconf->hold, f), GPATH);
+ }
+ }
+ }
+
+ close_db(f);
+}
+
+void
+load_gline_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ uint64_t tmp64 = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL, *ptr_next = NULL;
+
+ if (!(f = open_db("gline", GPATH, "r", KLINE_DB_VERSION)))
+ return;
+
+ if ((version = get_file_version(f) < 1))
+ {
+ close_db(f);
+ return;
+ }
+
+ read_uint32(&cnt, f);
+
+ for (i = 0; i < cnt; ++i)
+ {
+ struct AccessItem *aconf = map_to_conf(make_conf_item(GLINE_TYPE));
+
+ SAFE_READ(read_string(&aconf->user, f));
+ SAFE_READ(read_string(&aconf->host, f));
+ SAFE_READ(read_string(&aconf->reason, f));
+
+ SAFE_READ(read_uint64(&tmp64, f));
+ aconf->setat = tmp64;
+
+ SAFE_READ(read_uint64(&tmp64, f));
+ aconf->hold = tmp64;
+
+ if (aconf->hold)
+ SetConfTemporary(aconf);
+
+ add_conf_by_address(CONF_GLINE, aconf);
+ }
+
+ close_db(f);
+}
+
+void
+save_resv_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL;
+ struct ConfItem *conf;
+ struct ResvChannel *resv_cp;
+ struct MatchItem *resv_np;
+
+ if (!(f = open_db("resv", RESVPATH, "w", KLINE_DB_VERSION)))
+ return;
+
+ DLINK_FOREACH(ptr, resv_channel_list.head)
+ {
+ resv_cp = ptr->data;
+
+ if (!resv_cp->conf)
+ ++cnt;
+ }
+
+ DLINK_FOREACH(ptr, nresv_items.head)
+ {
+ resv_np = map_to_conf(ptr->data);
+
+ if (!resv_np->action)
+ ++cnt;
+ }
+
+ SAFE_WRITE(write_uint32(cnt, f), RESVPATH);
+
+
+ DLINK_FOREACH(ptr, resv_channel_list.head)
+ {
+ resv_cp = ptr->data;
+
+ SAFE_WRITE(write_string(resv_cp->name, f), RESVPATH);
+ SAFE_WRITE(write_string(resv_cp->reason, f), RESVPATH);
+ SAFE_WRITE(write_uint64(resv_cp->setat, f), RESVPATH);
+ SAFE_WRITE(write_uint64(resv_cp->hold, f), RESVPATH);
+ }
+
+ DLINK_FOREACH(ptr, nresv_items.head)
+ {
+ conf = ptr->data;
+ resv_np = map_to_conf(conf);
+
+ SAFE_WRITE(write_string(conf->name, f), RESVPATH);
+ SAFE_WRITE(write_string(resv_np->reason, f), RESVPATH);
+ SAFE_WRITE(write_uint64(resv_np->setat, f), RESVPATH);
+ SAFE_WRITE(write_uint64(resv_np->hold, f), RESVPATH);
+ }
+
+ close_db(f);
+}
+
+void
+load_resv_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ uint64_t tmp64_hold = 0, tmp64_setat = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL, *ptr_next = NULL;
+ char *name = NULL;
+ char *reason = NULL;
+ struct ConfItem *conf;
+ struct ResvChannel *resv_cp;
+ struct MatchItem *resv_np;
+
+ if (!(f = open_db("resv", RESVPATH, "r", KLINE_DB_VERSION)))
+ return;
+
+ if ((version = get_file_version(f) < 1))
+ {
+ close_db(f);
+ return;
+ }
+
+ read_uint32(&cnt, f);
+
+ for (i = 0; i < cnt; ++i)
+ {
+ SAFE_READ(read_string(&name, f));
+ SAFE_READ(read_string(&reason, f));
+ SAFE_READ(read_uint64(&tmp64_setat, f));
+ SAFE_READ(read_uint64(&tmp64_hold, f));
+
+ if (IsChanPrefix(*name))
+ {
+ if ((conf = create_channel_resv(name, reason, 0)) == NULL)
+ continue;
+
+ resv_cp = map_to_conf(conf);
+ resv_cp->setat = tmp64_setat;
+ resv_cp->hold = tmp64_hold;
+
+ if (resv_cp->hold)
+ add_temp_line(conf);
+ }
+ else
+ {
+ if ((conf = create_nick_resv(name, reason, 0)) == NULL)
+ continue;
+
+ resv_np = map_to_conf(conf);
+ resv_np->setat = tmp64_setat;
+ resv_np->hold = tmp64_hold;
+
+ if (resv_np->hold)
+ add_temp_line(conf);
+ }
+
+ MyFree(name);
+ MyFree(reason);
+ }
+
+ close_db(f);
+}
+
+void
+save_xline_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL;
+ struct ConfItem *conf = NULL;
+ struct MatchItem *xconf = NULL;
+
+ if (!(f = open_db("xline", XPATH, "w", KLINE_DB_VERSION)))
+ return;
+
+ DLINK_FOREACH(ptr, xconf_items.head)
+ {
+ conf = ptr->data;
+
+ if (!IsConfMain(conf))
+ ++cnt;
+ }
+
+ SAFE_WRITE(write_uint32(cnt, f), XPATH);
+
+
+ DLINK_FOREACH(ptr, xconf_items.head)
+ {
+ conf = ptr->data;
+ xconf = map_to_conf(conf);
+
+ SAFE_WRITE(write_string(conf->name, f), XPATH);
+ SAFE_WRITE(write_string(xconf->reason, f), XPATH);
+ SAFE_WRITE(write_uint64(xconf->setat, f), XPATH);
+ SAFE_WRITE(write_uint64(xconf->hold, f), XPATH);
+ }
+
+ close_db(f);
+}
+
+void
+load_xline_database(void)
+{
+ unsigned int i = 0;
+ uint32_t cnt = 0, version = 0;
+ uint64_t tmp64_hold = 0, tmp64_setat = 0;
+ struct dbFILE *f = NULL;
+ dlink_node *ptr = NULL, *ptr_next = NULL;
+ char *name = NULL;
+ char *reason = NULL;
+ struct ConfItem *conf = NULL;
+ struct MatchItem *xconf = NULL;
+
+ if (!(f = open_db("xline", XPATH, "r", KLINE_DB_VERSION)))
+ return;
+
+ if ((version = get_file_version(f) < 1))
+ {
+ close_db(f);
+ return;
+ }
+
+ read_uint32(&cnt, f);
+
+ for (i = 0; i < cnt; ++i)
+ {
+ SAFE_READ(read_string(&name, f));
+ SAFE_READ(read_string(&reason, f));
+ SAFE_READ(read_uint64(&tmp64_setat, f));
+ SAFE_READ(read_uint64(&tmp64_hold, f));
+
+ conf = make_conf_item(XLINE_TYPE);
+ xconf = map_to_conf(conf);
+
+ conf->name = name;
+ xconf->reason = reason;
+ xconf->setat = tmp64_setat;
+ xconf->hold = tmp64_hold;
+
+ if (xconf->hold)
+ SetConfTemporary(conf);
+ }
+
+ close_db(f);
+}
diff --git a/src/conf_parser.c b/src/conf_parser.c
index 28901a6..ae5874f 100644
--- a/src/conf_parser.c
+++ b/src/conf_parser.c
@@ -1251,31 +1251,31 @@ static const yytype_uint16 yyrline[] =
2059, 2059, 2060, 2060, 2060, 2061, 2061, 2062, 2062, 2062,
2063, 2063, 2063, 2064, 2064, 2065, 2067, 2076, 2085, 2111,
2129, 2147, 2153, 2157, 2166, 2165, 2169, 2169, 2170, 2174,
- 2180, 2191, 2202, 2213, 2222, 2241, 2240, 2306, 2305, 2309,
- 2309, 2310, 2316, 2316, 2317, 2317, 2317, 2317, 2319, 2338,
- 2348, 2347, 2372, 2372, 2373, 2373, 2373, 2375, 2381, 2390,
- 2392, 2392, 2393, 2393, 2395, 2414, 2413, 2461, 2460, 2464,
- 2464, 2465, 2471, 2471, 2472, 2472, 2472, 2472, 2474, 2480,
- 2489, 2492, 2492, 2493, 2493, 2494, 2494, 2495, 2495, 2496,
- 2496, 2497, 2497, 2498, 2499, 2500, 2500, 2501, 2501, 2502,
- 2502, 2503, 2503, 2504, 2504, 2505, 2505, 2506, 2507, 2507,
- 2508, 2508, 2509, 2509, 2510, 2510, 2511, 2511, 2512, 2513,
- 2513, 2514, 2515, 2516, 2516, 2517, 2517, 2518, 2519, 2520,
- 2521, 2521, 2522, 2525, 2530, 2536, 2542, 2548, 2553, 2558,
- 2563, 2568, 2573, 2578, 2583, 2588, 2593, 2598, 2603, 2608,
- 2613, 2618, 2624, 2635, 2640, 2645, 2650, 2655, 2660, 2663,
- 2668, 2671, 2676, 2681, 2686, 2691, 2696, 2701, 2706, 2711,
- 2716, 2727, 2732, 2737, 2742, 2751, 2760, 2765, 2770, 2776,
- 2775, 2780, 2780, 2781, 2784, 2787, 2790, 2793, 2796, 2799,
- 2802, 2805, 2808, 2811, 2814, 2817, 2820, 2823, 2826, 2829,
- 2832, 2835, 2838, 2844, 2843, 2848, 2848, 2849, 2852, 2855,
- 2858, 2861, 2864, 2867, 2870, 2873, 2876, 2879, 2882, 2885,
- 2888, 2891, 2894, 2897, 2900, 2903, 2906, 2911, 2916, 2921,
- 2930, 2933, 2933, 2934, 2935, 2935, 2936, 2936, 2937, 2937,
- 2938, 2939, 2939, 2940, 2941, 2941, 2942, 2942, 2944, 2949,
- 2954, 2959, 2964, 2969, 2974, 2979, 2984, 2989, 2994, 2999,
- 3004, 3009, 3017, 3020, 3020, 3021, 3021, 3022, 3023, 3023,
- 3024, 3025, 3027, 3033, 3039, 3048, 3062, 3068
+ 2180, 2191, 2202, 2213, 2222, 2241, 2240, 2308, 2307, 2311,
+ 2311, 2312, 2318, 2318, 2319, 2319, 2319, 2319, 2321, 2340,
+ 2350, 2349, 2373, 2373, 2374, 2374, 2374, 2376, 2382, 2391,
+ 2393, 2393, 2394, 2394, 2396, 2415, 2414, 2463, 2462, 2466,
+ 2466, 2467, 2473, 2473, 2474, 2474, 2474, 2474, 2476, 2482,
+ 2491, 2494, 2494, 2495, 2495, 2496, 2496, 2497, 2497, 2498,
+ 2498, 2499, 2499, 2500, 2501, 2502, 2502, 2503, 2503, 2504,
+ 2504, 2505, 2505, 2506, 2506, 2507, 2507, 2508, 2509, 2509,
+ 2510, 2510, 2511, 2511, 2512, 2512, 2513, 2513, 2514, 2515,
+ 2515, 2516, 2517, 2518, 2518, 2519, 2519, 2520, 2521, 2522,
+ 2523, 2523, 2524, 2527, 2532, 2538, 2544, 2550, 2555, 2560,
+ 2565, 2570, 2575, 2580, 2585, 2590, 2595, 2600, 2605, 2610,
+ 2615, 2620, 2626, 2637, 2642, 2647, 2652, 2657, 2662, 2665,
+ 2670, 2673, 2678, 2683, 2688, 2693, 2698, 2703, 2708, 2713,
+ 2718, 2729, 2734, 2739, 2744, 2753, 2762, 2767, 2772, 2778,
+ 2777, 2782, 2782, 2783, 2786, 2789, 2792, 2795, 2798, 2801,
+ 2804, 2807, 2810, 2813, 2816, 2819, 2822, 2825, 2828, 2831,
+ 2834, 2837, 2840, 2846, 2845, 2850, 2850, 2851, 2854, 2857,
+ 2860, 2863, 2866, 2869, 2872, 2875, 2878, 2881, 2884, 2887,
+ 2890, 2893, 2896, 2899, 2902, 2905, 2908, 2913, 2918, 2923,
+ 2932, 2935, 2935, 2936, 2937, 2937, 2938, 2938, 2939, 2939,
+ 2940, 2941, 2941, 2942, 2943, 2943, 2944, 2944, 2946, 2951,
+ 2956, 2961, 2966, 2971, 2976, 2981, 2986, 2991, 2996, 3001,
+ 3006, 3011, 3019, 3022, 3022, 3023, 3023, 3024, 3025, 3025,
+ 3026, 3027, 3029, 3035, 3041, 3050, 3064, 3070
};
#endif
@@ -5682,6 +5682,8 @@ yyreduce:
yy_aconf->regexuser = exp_user;
yy_aconf->regexhost = exp_host;
+ SetConfMain(yy_aconf);
+
DupString(yy_aconf->user, userbuf);
DupString(yy_aconf->host, hostbuf);
@@ -5696,10 +5698,10 @@ yyreduce:
}
else
{
- find_and_delete_temporary(userbuf, hostbuf, CONF_KLINE);
-
yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
+ SetConfMain(yy_aconf);
+
DupString(yy_aconf->user, userbuf);
DupString(yy_aconf->host, hostbuf);
@@ -5718,14 +5720,14 @@ yyreduce:
case 387:
/* Line 1813 of yacc.c */
-#line 2306 "conf_parser.y"
+#line 2308 "conf_parser.y"
{
}
break;
case 391:
/* Line 1813 of yacc.c */
-#line 2311 "conf_parser.y"
+#line 2313 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
regex_ban = 1;
@@ -5734,7 +5736,7 @@ yyreduce:
case 398:
/* Line 1813 of yacc.c */
-#line 2320 "conf_parser.y"
+#line 2322 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
@@ -5756,7 +5758,7 @@ yyreduce:
case 399:
/* Line 1813 of yacc.c */
-#line 2339 "conf_parser.y"
+#line 2341 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
@@ -5765,7 +5767,7 @@ yyreduce:
case 400:
/* Line 1813 of yacc.c */
-#line 2348 "conf_parser.y"
+#line 2350 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
hostbuf[0] = reasonbuf[0] = '\0';
@@ -5774,16 +5776,15 @@ yyreduce:
case 401:
/* Line 1813 of yacc.c */
-#line 2352 "conf_parser.y"
+#line 2354 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
{
- find_and_delete_temporary(NULL, hostbuf, CONF_DLINE);
-
yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
DupString(yy_aconf->host, hostbuf);
+ SetConfMain(yy_aconf);
if (reasonbuf[0])
DupString(yy_aconf->reason, reasonbuf);
@@ -5798,7 +5799,7 @@ yyreduce:
case 407:
/* Line 1813 of yacc.c */
-#line 2376 "conf_parser.y"
+#line 2377 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
strlcpy(hostbuf, yylval.string, sizeof(hostbuf));
@@ -5807,7 +5808,7 @@ yyreduce:
case 408:
/* Line 1813 of yacc.c */
-#line 2382 "conf_parser.y"
+#line 2383 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
@@ -5816,7 +5817,7 @@ yyreduce:
case 414:
/* Line 1813 of yacc.c */
-#line 2396 "conf_parser.y"
+#line 2397 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
@@ -5834,7 +5835,7 @@ yyreduce:
case 415:
/* Line 1813 of yacc.c */
-#line 2414 "conf_parser.y"
+#line 2415 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
@@ -5846,7 +5847,7 @@ yyreduce:
case 416:
/* Line 1813 of yacc.c */
-#line 2421 "conf_parser.y"
+#line 2422 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
@@ -5875,6 +5876,7 @@ yyreduce:
else
yy_conf = make_conf_item(XLINE_TYPE);
+ SetConfMain(yy_conf);
yy_match_item = map_to_conf(yy_conf);
DupString(yy_conf->name, gecos_name);
@@ -5889,14 +5891,14 @@ yyreduce:
case 417:
/* Line 1813 of yacc.c */
-#line 2461 "conf_parser.y"
+#line 2463 "conf_parser.y"
{
}
break;
case 421:
/* Line 1813 of yacc.c */
-#line 2466 "conf_parser.y"
+#line 2468 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
regex_ban = 1;
@@ -5905,7 +5907,7 @@ yyreduce:
case 428:
/* Line 1813 of yacc.c */
-#line 2475 "conf_parser.y"
+#line 2477 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
@@ -5914,7 +5916,7 @@ yyreduce:
case 429:
/* Line 1813 of yacc.c */
-#line 2481 "conf_parser.y"
+#line 2483 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
@@ -5923,7 +5925,7 @@ yyreduce:
case 483:
/* Line 1813 of yacc.c */
-#line 2526 "conf_parser.y"
+#line 2528 "conf_parser.y"
{
ConfigFileEntry.max_watch = (yyvsp[(3) - (4)].number);
}
@@ -5931,7 +5933,7 @@ yyreduce:
case 484:
/* Line 1813 of yacc.c */
-#line 2531 "conf_parser.y"
+#line 2533 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
ConfigFileEntry.glines = yylval.number;
@@ -5940,7 +5942,7 @@ yyreduce:
case 485:
/* Line 1813 of yacc.c */
-#line 2537 "conf_parser.y"
+#line 2539 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
ConfigFileEntry.gline_time = (yyvsp[(3) - (4)].number);
@@ -5949,7 +5951,7 @@ yyreduce:
case 486:
/* Line 1813 of yacc.c */
-#line 2543 "conf_parser.y"
+#line 2545 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
ConfigFileEntry.gline_request_time = (yyvsp[(3) - (4)].number);
@@ -5958,7 +5960,7 @@ yyreduce:
case 487:
/* Line 1813 of yacc.c */
-#line 2549 "conf_parser.y"
+#line 2551 "conf_parser.y"
{
ConfigFileEntry.gline_min_cidr = (yyvsp[(3) - (4)].number);
}
@@ -5966,7 +5968,7 @@ yyreduce:
case 488:
/* Line 1813 of yacc.c */
-#line 2554 "conf_parser.y"
+#line 2556 "conf_parser.y"
{
ConfigFileEntry.gline_min_cidr6 = (yyvsp[(3) - (4)].number);
}
@@ -5974,7 +5976,7 @@ yyreduce:
case 489:
/* Line 1813 of yacc.c */
-#line 2559 "conf_parser.y"
+#line 2561 "conf_parser.y"
{
ConfigFileEntry.tkline_expire_notices = yylval.number;
}
@@ -5982,7 +5984,7 @@ yyreduce:
case 490:
/* Line 1813 of yacc.c */
-#line 2564 "conf_parser.y"
+#line 2566 "conf_parser.y"
{
ConfigFileEntry.kill_chase_time_limit = (yyvsp[(3) - (4)].number);
}
@@ -5990,7 +5992,7 @@ yyreduce:
case 491:
/* Line 1813 of yacc.c */
-#line 2569 "conf_parser.y"
+#line 2571 "conf_parser.y"
{
ConfigFileEntry.hide_spoof_ips = yylval.number;
}
@@ -5998,7 +6000,7 @@ yyreduce:
case 492:
/* Line 1813 of yacc.c */
-#line 2574 "conf_parser.y"
+#line 2576 "conf_parser.y"
{
ConfigFileEntry.ignore_bogus_ts = yylval.number;
}
@@ -6006,7 +6008,7 @@ yyreduce:
case 493:
/* Line 1813 of yacc.c */
-#line 2579 "conf_parser.y"
+#line 2581 "conf_parser.y"
{
ConfigFileEntry.disable_remote = yylval.number;
}
@@ -6014,7 +6016,7 @@ yyreduce:
case 494:
/* Line 1813 of yacc.c */
-#line 2584 "conf_parser.y"
+#line 2586 "conf_parser.y"
{
ConfigFileEntry.failed_oper_notice = yylval.number;
}
@@ -6022,7 +6024,7 @@ yyreduce:
case 495:
/* Line 1813 of yacc.c */
-#line 2589 "conf_parser.y"
+#line 2591 "conf_parser.y"
{
ConfigFileEntry.anti_nick_flood = yylval.number;
}
@@ -6030,7 +6032,7 @@ yyreduce:
case 496:
/* Line 1813 of yacc.c */
-#line 2594 "conf_parser.y"
+#line 2596 "conf_parser.y"
{
ConfigFileEntry.max_nick_time = (yyvsp[(3) - (4)].number);
}
@@ -6038,7 +6040,7 @@ yyreduce:
case 497:
/* Line 1813 of yacc.c */
-#line 2599 "conf_parser.y"
+#line 2601 "conf_parser.y"
{
ConfigFileEntry.max_nick_changes = (yyvsp[(3) - (4)].number);
}
@@ -6046,7 +6048,7 @@ yyreduce:
case 498:
/* Line 1813 of yacc.c */
-#line 2604 "conf_parser.y"
+#line 2606 "conf_parser.y"
{
ConfigFileEntry.max_accept = (yyvsp[(3) - (4)].number);
}
@@ -6054,7 +6056,7 @@ yyreduce:
case 499:
/* Line 1813 of yacc.c */
-#line 2609 "conf_parser.y"
+#line 2611 "conf_parser.y"
{
ConfigFileEntry.anti_spam_exit_message_time = (yyvsp[(3) - (4)].number);
}
@@ -6062,7 +6064,7 @@ yyreduce:
case 500:
/* Line 1813 of yacc.c */
-#line 2614 "conf_parser.y"
+#line 2616 "conf_parser.y"
{
ConfigFileEntry.ts_warn_delta = (yyvsp[(3) - (4)].number);
}
@@ -6070,7 +6072,7 @@ yyreduce:
case 501:
/* Line 1813 of yacc.c */
-#line 2619 "conf_parser.y"
+#line 2621 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
ConfigFileEntry.ts_max_delta = (yyvsp[(3) - (4)].number);
@@ -6079,7 +6081,7 @@ yyreduce:
case 502:
/* Line 1813 of yacc.c */
-#line 2625 "conf_parser.y"
+#line 2627 "conf_parser.y"
{
if (((yyvsp[(3) - (4)].number) > 0) && conf_parser_ctx.pass == 1)
{
@@ -6093,7 +6095,7 @@ yyreduce:
case 503:
/* Line 1813 of yacc.c */
-#line 2636 "conf_parser.y"
+#line 2638 "conf_parser.y"
{
ConfigFileEntry.invisible_on_connect = yylval.number;
}
@@ -6101,7 +6103,7 @@ yyreduce:
case 504:
/* Line 1813 of yacc.c */
-#line 2641 "conf_parser.y"
+#line 2643 "conf_parser.y"
{
ConfigFileEntry.warn_no_nline = yylval.number;
}
@@ -6109,7 +6111,7 @@ yyreduce:
case 505:
/* Line 1813 of yacc.c */
-#line 2646 "conf_parser.y"
+#line 2648 "conf_parser.y"
{
ConfigFileEntry.stats_e_disabled = yylval.number;
}
@@ -6117,7 +6119,7 @@ yyreduce:
case 506:
/* Line 1813 of yacc.c */
-#line 2651 "conf_parser.y"
+#line 2653 "conf_parser.y"
{
ConfigFileEntry.stats_o_oper_only = yylval.number;
}
@@ -6125,7 +6127,7 @@ yyreduce:
case 507:
/* Line 1813 of yacc.c */
-#line 2656 "conf_parser.y"
+#line 2658 "conf_parser.y"
{
ConfigFileEntry.stats_P_oper_only = yylval.number;
}
@@ -6133,7 +6135,7 @@ yyreduce:
case 508:
/* Line 1813 of yacc.c */
-#line 2661 "conf_parser.y"
+#line 2663 "conf_parser.y"
{
ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
}
@@ -6141,7 +6143,7 @@ yyreduce:
case 509:
/* Line 1813 of yacc.c */
-#line 2664 "conf_parser.y"
+#line 2666 "conf_parser.y"
{
ConfigFileEntry.stats_k_oper_only = 1;
}
@@ -6149,7 +6151,7 @@ yyreduce:
case 510:
/* Line 1813 of yacc.c */
-#line 2669 "conf_parser.y"
+#line 2671 "conf_parser.y"
{
ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
}
@@ -6157,7 +6159,7 @@ yyreduce:
case 511:
/* Line 1813 of yacc.c */
-#line 2672 "conf_parser.y"
+#line 2674 "conf_parser.y"
{
ConfigFileEntry.stats_i_oper_only = 1;
}
@@ -6165,7 +6167,7 @@ yyreduce:
case 512:
/* Line 1813 of yacc.c */
-#line 2677 "conf_parser.y"
+#line 2679 "conf_parser.y"
{
ConfigFileEntry.pace_wait = (yyvsp[(3) - (4)].number);
}
@@ -6173,7 +6175,7 @@ yyreduce:
case 513:
/* Line 1813 of yacc.c */
-#line 2682 "conf_parser.y"
+#line 2684 "conf_parser.y"
{
ConfigFileEntry.caller_id_wait = (yyvsp[(3) - (4)].number);
}
@@ -6181,7 +6183,7 @@ yyreduce:
case 514:
/* Line 1813 of yacc.c */
-#line 2687 "conf_parser.y"
+#line 2689 "conf_parser.y"
{
ConfigFileEntry.opers_bypass_callerid = yylval.number;
}
@@ -6189,7 +6191,7 @@ yyreduce:
case 515:
/* Line 1813 of yacc.c */
-#line 2692 "conf_parser.y"
+#line 2694 "conf_parser.y"
{
ConfigFileEntry.pace_wait_simple = (yyvsp[(3) - (4)].number);
}
@@ -6197,7 +6199,7 @@ yyreduce:
case 516:
/* Line 1813 of yacc.c */
-#line 2697 "conf_parser.y"
+#line 2699 "conf_parser.y"
{
ConfigFileEntry.short_motd = yylval.number;
}
@@ -6205,7 +6207,7 @@ yyreduce:
case 517:
/* Line 1813 of yacc.c */
-#line 2702 "conf_parser.y"
+#line 2704 "conf_parser.y"
{
ConfigFileEntry.no_oper_flood = yylval.number;
}
@@ -6213,7 +6215,7 @@ yyreduce:
case 518:
/* Line 1813 of yacc.c */
-#line 2707 "conf_parser.y"
+#line 2709 "conf_parser.y"
{
ConfigFileEntry.true_no_oper_flood = yylval.number;
}
@@ -6221,7 +6223,7 @@ yyreduce:
case 519:
/* Line 1813 of yacc.c */
-#line 2712 "conf_parser.y"
+#line 2714 "conf_parser.y"
{
ConfigFileEntry.oper_pass_resv = yylval.number;
}
@@ -6229,7 +6231,7 @@ yyreduce:
case 520:
/* Line 1813 of yacc.c */
-#line 2717 "conf_parser.y"
+#line 2719 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
@@ -6243,7 +6245,7 @@ yyreduce:
case 521:
/* Line 1813 of yacc.c */
-#line 2728 "conf_parser.y"
+#line 2730 "conf_parser.y"
{
ConfigFileEntry.dots_in_ident = (yyvsp[(3) - (4)].number);
}
@@ -6251,7 +6253,7 @@ yyreduce:
case 522:
/* Line 1813 of yacc.c */
-#line 2733 "conf_parser.y"
+#line 2735 "conf_parser.y"
{
ConfigFileEntry.max_targets = (yyvsp[(3) - (4)].number);
}
@@ -6259,7 +6261,7 @@ yyreduce:
case 523:
/* Line 1813 of yacc.c */
-#line 2738 "conf_parser.y"
+#line 2740 "conf_parser.y"
{
ConfigFileEntry.use_egd = yylval.number;
}
@@ -6267,7 +6269,7 @@ yyreduce:
case 524:
/* Line 1813 of yacc.c */
-#line 2743 "conf_parser.y"
+#line 2745 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
@@ -6279,7 +6281,7 @@ yyreduce:
case 525:
/* Line 1813 of yacc.c */
-#line 2752 "conf_parser.y"
+#line 2754 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
{
@@ -6291,7 +6293,7 @@ yyreduce:
case 526:
/* Line 1813 of yacc.c */
-#line 2761 "conf_parser.y"
+#line 2763 "conf_parser.y"
{
ConfigFileEntry.ping_cookie = yylval.number;
}
@@ -6299,7 +6301,7 @@ yyreduce:
case 527:
/* Line 1813 of yacc.c */
-#line 2766 "conf_parser.y"
+#line 2768 "conf_parser.y"
{
ConfigFileEntry.disable_auth = yylval.number;
}
@@ -6307,7 +6309,7 @@ yyreduce:
case 528:
/* Line 1813 of yacc.c */
-#line 2771 "conf_parser.y"
+#line 2773 "conf_parser.y"
{
ConfigFileEntry.throttle_time = yylval.number;
}
@@ -6315,7 +6317,7 @@ yyreduce:
case 529:
/* Line 1813 of yacc.c */
-#line 2776 "conf_parser.y"
+#line 2778 "conf_parser.y"
{
ConfigFileEntry.oper_umodes = 0;
}
@@ -6323,7 +6325,7 @@ yyreduce:
case 533:
/* Line 1813 of yacc.c */
-#line 2782 "conf_parser.y"
+#line 2784 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_BOTS;
}
@@ -6331,7 +6333,7 @@ yyreduce:
case 534:
/* Line 1813 of yacc.c */
-#line 2785 "conf_parser.y"
+#line 2787 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_CCONN;
}
@@ -6339,7 +6341,7 @@ yyreduce:
case 535:
/* Line 1813 of yacc.c */
-#line 2788 "conf_parser.y"
+#line 2790 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
}
@@ -6347,7 +6349,7 @@ yyreduce:
case 536:
/* Line 1813 of yacc.c */
-#line 2791 "conf_parser.y"
+#line 2793 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_DEAF;
}
@@ -6355,7 +6357,7 @@ yyreduce:
case 537:
/* Line 1813 of yacc.c */
-#line 2794 "conf_parser.y"
+#line 2796 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
}
@@ -6363,7 +6365,7 @@ yyreduce:
case 538:
/* Line 1813 of yacc.c */
-#line 2797 "conf_parser.y"
+#line 2799 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_FULL;
}
@@ -6371,7 +6373,7 @@ yyreduce:
case 539:
/* Line 1813 of yacc.c */
-#line 2800 "conf_parser.y"
+#line 2802 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
}
@@ -6379,7 +6381,7 @@ yyreduce:
case 540:
/* Line 1813 of yacc.c */
-#line 2803 "conf_parser.y"
+#line 2805 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_SKILL;
}
@@ -6387,7 +6389,7 @@ yyreduce:
case 541:
/* Line 1813 of yacc.c */
-#line 2806 "conf_parser.y"
+#line 2808 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
}
@@ -6395,7 +6397,7 @@ yyreduce:
case 542:
/* Line 1813 of yacc.c */
-#line 2809 "conf_parser.y"
+#line 2811 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_REJ;
}
@@ -6403,7 +6405,7 @@ yyreduce:
case 543:
/* Line 1813 of yacc.c */
-#line 2812 "conf_parser.y"
+#line 2814 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
}
@@ -6411,7 +6413,7 @@ yyreduce:
case 544:
/* Line 1813 of yacc.c */
-#line 2815 "conf_parser.y"
+#line 2817 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_SPY;
}
@@ -6419,7 +6421,7 @@ yyreduce:
case 545:
/* Line 1813 of yacc.c */
-#line 2818 "conf_parser.y"
+#line 2820 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
}
@@ -6427,7 +6429,7 @@ yyreduce:
case 546:
/* Line 1813 of yacc.c */
-#line 2821 "conf_parser.y"
+#line 2823 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_OPERWALL;
}
@@ -6435,7 +6437,7 @@ yyreduce:
case 547:
/* Line 1813 of yacc.c */
-#line 2824 "conf_parser.y"
+#line 2826 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
}
@@ -6443,7 +6445,7 @@ yyreduce:
case 548:
/* Line 1813 of yacc.c */
-#line 2827 "conf_parser.y"
+#line 2829 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
}
@@ -6451,7 +6453,7 @@ yyreduce:
case 549:
/* Line 1813 of yacc.c */
-#line 2830 "conf_parser.y"
+#line 2832 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
}
@@ -6459,7 +6461,7 @@ yyreduce:
case 550:
/* Line 1813 of yacc.c */
-#line 2833 "conf_parser.y"
+#line 2835 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
}
@@ -6467,7 +6469,7 @@ yyreduce:
case 551:
/* Line 1813 of yacc.c */
-#line 2836 "conf_parser.y"
+#line 2838 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
}
@@ -6475,7 +6477,7 @@ yyreduce:
case 552:
/* Line 1813 of yacc.c */
-#line 2839 "conf_parser.y"
+#line 2841 "conf_parser.y"
{
ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
}
@@ -6483,7 +6485,7 @@ yyreduce:
case 553:
/* Line 1813 of yacc.c */
-#line 2844 "conf_parser.y"
+#line 2846 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes = 0;
}
@@ -6491,7 +6493,7 @@ yyreduce:
case 557:
/* Line 1813 of yacc.c */
-#line 2850 "conf_parser.y"
+#line 2852 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
}
@@ -6499,7 +6501,7 @@ yyreduce:
case 558:
/* Line 1813 of yacc.c */
-#line 2853 "conf_parser.y"
+#line 2855 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
}
@@ -6507,7 +6509,7 @@ yyreduce:
case 559:
/* Line 1813 of yacc.c */
-#line 2856 "conf_parser.y"
+#line 2858 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
}
@@ -6515,7 +6517,7 @@ yyreduce:
case 560:
/* Line 1813 of yacc.c */
-#line 2859 "conf_parser.y"
+#line 2861 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
}
@@ -6523,7 +6525,7 @@ yyreduce:
case 561:
/* Line 1813 of yacc.c */
-#line 2862 "conf_parser.y"
+#line 2864 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
}
@@ -6531,7 +6533,7 @@ yyreduce:
case 562:
/* Line 1813 of yacc.c */
-#line 2865 "conf_parser.y"
+#line 2867 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
}
@@ -6539,7 +6541,7 @@ yyreduce:
case 563:
/* Line 1813 of yacc.c */
-#line 2868 "conf_parser.y"
+#line 2870 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
}
@@ -6547,7 +6549,7 @@ yyreduce:
case 564:
/* Line 1813 of yacc.c */
-#line 2871 "conf_parser.y"
+#line 2873 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
}
@@ -6555,7 +6557,7 @@ yyreduce:
case 565:
/* Line 1813 of yacc.c */
-#line 2874 "conf_parser.y"
+#line 2876 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
}
@@ -6563,7 +6565,7 @@ yyreduce:
case 566:
/* Line 1813 of yacc.c */
-#line 2877 "conf_parser.y"
+#line 2879 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
}
@@ -6571,7 +6573,7 @@ yyreduce:
case 567:
/* Line 1813 of yacc.c */
-#line 2880 "conf_parser.y"
+#line 2882 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
}
@@ -6579,7 +6581,7 @@ yyreduce:
case 568:
/* Line 1813 of yacc.c */
-#line 2883 "conf_parser.y"
+#line 2885 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
}
@@ -6587,7 +6589,7 @@ yyreduce:
case 569:
/* Line 1813 of yacc.c */
-#line 2886 "conf_parser.y"
+#line 2888 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
}
@@ -6595,7 +6597,7 @@ yyreduce:
case 570:
/* Line 1813 of yacc.c */
-#line 2889 "conf_parser.y"
+#line 2891 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL;
}
@@ -6603,7 +6605,7 @@ yyreduce:
case 571:
/* Line 1813 of yacc.c */
-#line 2892 "conf_parser.y"
+#line 2894 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
}
@@ -6611,7 +6613,7 @@ yyreduce:
case 572:
/* Line 1813 of yacc.c */
-#line 2895 "conf_parser.y"
+#line 2897 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
}
@@ -6619,7 +6621,7 @@ yyreduce:
case 573:
/* Line 1813 of yacc.c */
-#line 2898 "conf_parser.y"
+#line 2900 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
}
@@ -6627,7 +6629,7 @@ yyreduce:
case 574:
/* Line 1813 of yacc.c */
-#line 2901 "conf_parser.y"
+#line 2903 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
}
@@ -6635,7 +6637,7 @@ yyreduce:
case 575:
/* Line 1813 of yacc.c */
-#line 2904 "conf_parser.y"
+#line 2906 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
}
@@ -6643,7 +6645,7 @@ yyreduce:
case 576:
/* Line 1813 of yacc.c */
-#line 2907 "conf_parser.y"
+#line 2909 "conf_parser.y"
{
ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
}
@@ -6651,7 +6653,7 @@ yyreduce:
case 577:
/* Line 1813 of yacc.c */
-#line 2912 "conf_parser.y"
+#line 2914 "conf_parser.y"
{
ConfigFileEntry.min_nonwildcard = (yyvsp[(3) - (4)].number);
}
@@ -6659,7 +6661,7 @@ yyreduce:
case 578:
/* Line 1813 of yacc.c */
-#line 2917 "conf_parser.y"
+#line 2919 "conf_parser.y"
{
ConfigFileEntry.min_nonwildcard_simple = (yyvsp[(3) - (4)].number);
}
@@ -6667,7 +6669,7 @@ yyreduce:
case 579:
/* Line 1813 of yacc.c */
-#line 2922 "conf_parser.y"
+#line 2924 "conf_parser.y"
{
ConfigFileEntry.default_floodcount = (yyvsp[(3) - (4)].number);
}
@@ -6675,7 +6677,7 @@ yyreduce:
case 598:
/* Line 1813 of yacc.c */
-#line 2945 "conf_parser.y"
+#line 2947 "conf_parser.y"
{
ConfigChannel.disable_fake_channels = yylval.number;
}
@@ -6683,7 +6685,7 @@ yyreduce:
case 599:
/* Line 1813 of yacc.c */
-#line 2950 "conf_parser.y"
+#line 2952 "conf_parser.y"
{
ConfigChannel.restrict_channels = yylval.number;
}
@@ -6691,7 +6693,7 @@ yyreduce:
case 600:
/* Line 1813 of yacc.c */
-#line 2955 "conf_parser.y"
+#line 2957 "conf_parser.y"
{
ConfigChannel.knock_delay = (yyvsp[(3) - (4)].number);
}
@@ -6699,7 +6701,7 @@ yyreduce:
case 601:
/* Line 1813 of yacc.c */
-#line 2960 "conf_parser.y"
+#line 2962 "conf_parser.y"
{
ConfigChannel.knock_delay_channel = (yyvsp[(3) - (4)].number);
}
@@ -6707,7 +6709,7 @@ yyreduce:
case 602:
/* Line 1813 of yacc.c */
-#line 2965 "conf_parser.y"
+#line 2967 "conf_parser.y"
{
ConfigChannel.max_chans_per_user = (yyvsp[(3) - (4)].number);
}
@@ -6715,7 +6717,7 @@ yyreduce:
case 603:
/* Line 1813 of yacc.c */
-#line 2970 "conf_parser.y"
+#line 2972 "conf_parser.y"
{
ConfigChannel.max_chans_per_oper = (yyvsp[(3) - (4)].number);
}
@@ -6723,7 +6725,7 @@ yyreduce:
case 604:
/* Line 1813 of yacc.c */
-#line 2975 "conf_parser.y"
+#line 2977 "conf_parser.y"
{
ConfigChannel.quiet_on_ban = yylval.number;
}
@@ -6731,7 +6733,7 @@ yyreduce:
case 605:
/* Line 1813 of yacc.c */
-#line 2980 "conf_parser.y"
+#line 2982 "conf_parser.y"
{
ConfigChannel.max_bans = (yyvsp[(3) - (4)].number);
}
@@ -6739,7 +6741,7 @@ yyreduce:
case 606:
/* Line 1813 of yacc.c */
-#line 2985 "conf_parser.y"
+#line 2987 "conf_parser.y"
{
ConfigChannel.default_split_user_count = (yyvsp[(3) - (4)].number);
}
@@ -6747,7 +6749,7 @@ yyreduce:
case 607:
/* Line 1813 of yacc.c */
-#line 2990 "conf_parser.y"
+#line 2992 "conf_parser.y"
{
ConfigChannel.default_split_server_count = (yyvsp[(3) - (4)].number);
}
@@ -6755,7 +6757,7 @@ yyreduce:
case 608:
/* Line 1813 of yacc.c */
-#line 2995 "conf_parser.y"
+#line 2997 "conf_parser.y"
{
ConfigChannel.no_create_on_split = yylval.number;
}
@@ -6763,7 +6765,7 @@ yyreduce:
case 609:
/* Line 1813 of yacc.c */
-#line 3000 "conf_parser.y"
+#line 3002 "conf_parser.y"
{
ConfigChannel.no_join_on_split = yylval.number;
}
@@ -6771,7 +6773,7 @@ yyreduce:
case 610:
/* Line 1813 of yacc.c */
-#line 3005 "conf_parser.y"
+#line 3007 "conf_parser.y"
{
GlobalSetOptions.joinfloodcount = yylval.number;
}
@@ -6779,7 +6781,7 @@ yyreduce:
case 611:
/* Line 1813 of yacc.c */
-#line 3010 "conf_parser.y"
+#line 3012 "conf_parser.y"
{
GlobalSetOptions.joinfloodtime = yylval.number;
}
@@ -6787,7 +6789,7 @@ yyreduce:
case 622:
/* Line 1813 of yacc.c */
-#line 3028 "conf_parser.y"
+#line 3030 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
ConfigServerHide.flatten_links = yylval.number;
@@ -6796,7 +6798,7 @@ yyreduce:
case 623:
/* Line 1813 of yacc.c */
-#line 3034 "conf_parser.y"
+#line 3036 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
ConfigServerHide.hide_servers = yylval.number;
@@ -6805,7 +6807,7 @@ yyreduce:
case 624:
/* Line 1813 of yacc.c */
-#line 3040 "conf_parser.y"
+#line 3042 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
@@ -6817,7 +6819,7 @@ yyreduce:
case 625:
/* Line 1813 of yacc.c */
-#line 3049 "conf_parser.y"
+#line 3051 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
{
@@ -6834,7 +6836,7 @@ yyreduce:
case 626:
/* Line 1813 of yacc.c */
-#line 3063 "conf_parser.y"
+#line 3065 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
ConfigServerHide.hidden = yylval.number;
@@ -6843,7 +6845,7 @@ yyreduce:
case 627:
/* Line 1813 of yacc.c */
-#line 3069 "conf_parser.y"
+#line 3071 "conf_parser.y"
{
if (conf_parser_ctx.pass == 2)
ConfigServerHide.hide_server_ips = yylval.number;
@@ -6852,7 +6854,7 @@ yyreduce:
/* Line 1813 of yacc.c */
-#line 6856 "conf_parser.c"
+#line 6858 "conf_parser.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
diff --git a/src/conf_parser.y b/src/conf_parser.y
index 1e5096b..a36cbaa 100644
--- a/src/conf_parser.y
+++ b/src/conf_parser.y
@@ -2269,6 +2269,8 @@ kill_entry: KILL
yy_aconf->regexuser = exp_user;
yy_aconf->regexhost = exp_host;
+ SetConfMain(yy_aconf);
+
DupString(yy_aconf->user, userbuf);
DupString(yy_aconf->host, hostbuf);
@@ -2283,10 +2285,10 @@ kill_entry: KILL
}
else
{
- find_and_delete_temporary(userbuf, hostbuf, CONF_KLINE);
-
yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
+ SetConfMain(yy_aconf);
+
DupString(yy_aconf->user, userbuf);
DupString(yy_aconf->host, hostbuf);
@@ -2354,10 +2356,9 @@ deny_entry: DENY
{
if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
{
- find_and_delete_temporary(NULL, hostbuf, CONF_DLINE);
-
yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
DupString(yy_aconf->host, hostbuf);
+ SetConfMain(yy_aconf);
if (reasonbuf[0])
DupString(yy_aconf->reason, reasonbuf);
@@ -2446,6 +2447,7 @@ gecos_entry: GECOS
else
yy_conf = make_conf_item(XLINE_TYPE);
+ SetConfMain(yy_conf);
yy_match_item = map_to_conf(yy_conf);
DupString(yy_conf->name, gecos_name);
diff --git a/src/csvlib.c b/src/csvlib.c
deleted file mode 100644
index cb43243..0000000
--- a/src/csvlib.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * csvlib.c - set of functions to deal with csv type of conf files
- *
- * Copyright (C) 2003 by Diane Bruce, Stuart Walsh
- * Use it anywhere you like, if you like it buy us a beer.
- * If it's broken, don't bother us with the lawyers.
- *
- * $Id$
- */
-
-#include "config.h"
-#include "stdinc.h"
-#include "list.h"
-#include "log.h"
-#include "conf.h"
-#include "hostmask.h"
-#include "client.h"
-#include "irc_string.h"
-#include "sprintf_irc.h"
-#include "memory.h"
-#include "send.h"
-#include "resv.h"
-#include "s_serv.h"
-
-/* Fix "statement not reached" warnings on Sun WorkShop C */
-#ifdef __SUNPRO_C
-# pragma error_messages(off, E_STATEMENT_NOT_REACHED)
-#endif
-
-
-static void parse_csv_line(char *, ...);
-static int write_csv_line(FILE *, const char *, ...);
-static int flush_write(struct Client *, FILE *, FILE *,
- const char *, const char *);
-static char *getfield(char *);
-
-int
-find_and_delete_temporary(const char *user, const char *host, int type)
-{
- struct irc_ssaddr iphost, *piphost;
- struct AccessItem *aconf;
- int t;
-
- if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
- {
-#ifdef IPV6
- if (t == HM_IPV6)
- t = AF_INET6;
- else
-#endif
- t = AF_INET;
- piphost = &iphost;
- }
- else
- {
- t = 0;
- piphost = NULL;
- }
-
- if ((aconf = find_conf_by_address(host, piphost, type, t, user, NULL, 0)))
- {
- if (IsConfTemporary(aconf))
- {
- delete_one_address_conf(host, aconf);
- return 1;
- }
- }
-
- return 0;
-}
-
-/* parse_csv_file()
- *
- * inputs - FILE pointer
- * - type of conf to parse
- * output - none
- * side effects -
- */
-void
-parse_csv_file(FILE *file, ConfType conf_type)
-{
- struct ConfItem *conf;
- struct AccessItem *aconf;
- struct MatchItem *match_item;
- char *name_field=NULL;
- char *user_field=NULL;
- char *reason_field=NULL;
- char *oper_reason=NULL;
- char *host_field=NULL;
- char line[IRCD_BUFSIZE];
- char *p;
-
- while (fgets(line, sizeof(line), file) != NULL)
- {
- if ((p = strchr(line, '\n')) != NULL)
- *p = '\0';
-
- if ((line[0] == '\0') || (line[0] == '#'))
- continue;
-
- switch(conf_type)
- {
- case KLINE_TYPE:
- parse_csv_line(line, &user_field, &host_field, &reason_field, NULL);
-
- find_and_delete_temporary(user_field, host_field, CONF_KLINE);
-
- conf = make_conf_item(KLINE_TYPE);
- aconf = map_to_conf(conf);
-
- if (host_field != NULL)
- DupString(aconf->host, host_field);
- if (reason_field != NULL)
- DupString(aconf->reason, reason_field);
- if (user_field != NULL)
- DupString(aconf->user, user_field);
- if (aconf->host != NULL)
- add_conf_by_address(CONF_KLINE, aconf);
- break;
- case DLINE_TYPE:
- parse_csv_line(line, &host_field, &reason_field, NULL);
-
- if (host_field && parse_netmask(host_field, NULL, NULL) != HM_HOST)
- {
- find_and_delete_temporary(NULL, host_field, CONF_DLINE);
-
- aconf = map_to_conf(make_conf_item(DLINE_TYPE));
- DupString(aconf->host, host_field);
-
- if (reason_field != NULL)
- DupString(aconf->reason, reason_field);
- else
- DupString(aconf->reason, "No reason");
- add_conf_by_address(CONF_DLINE, aconf);
- }
-
- break;
-
- case XLINE_TYPE:
- parse_csv_line(line, &name_field, &reason_field, &oper_reason, NULL);
- conf = make_conf_item(XLINE_TYPE);
- match_item = (struct MatchItem *)map_to_conf(conf);
- if (name_field != NULL)
- DupString(conf->name, name_field);
- if (reason_field != NULL)
- DupString(match_item->reason, reason_field);
- break;
- case CRESV_TYPE:
- parse_csv_line(line, &name_field, &reason_field, NULL);
- (void)create_channel_resv(name_field, reason_field, 0);
- break;
-
- case NRESV_TYPE:
- parse_csv_line(line, &name_field, &reason_field, NULL);
- (void)create_nick_resv(name_field, reason_field, 0);
- break;
-
- case GLINE_TYPE:
- case CONF_TYPE:
- case OPER_TYPE:
- case CLIENT_TYPE:
- case SERVER_TYPE:
- case CLUSTER_TYPE:
- case HUB_TYPE:
- case LEAF_TYPE:
- case ULINE_TYPE:
- case EXEMPTDLINE_TYPE:
- case CLASS_TYPE:
- default:
- break;
- }
- }
-}
-
-/*
- * parse_csv_line()
- *
- * inputs - pointer to line to parse
- * output -
- * side effects -
- */
-
-static void
-parse_csv_line(char *line, ...)
-{
- va_list args;
- char **dest;
- char *field = NULL;
-
- va_start(args, line);
-
- for (; ;)
- {
- dest = va_arg(args, char **);
- if ((dest == NULL) || ((field = getfield(field ? NULL : line)) == NULL))
- {
- va_end(args);
- return;
- }
- *dest = field;
- }
-}
-
-/* write_conf_line()
- *
- * inputs - pointer to struct AccessItem
- * - string current_date (small date)
- * - time_t cur_time
- * output - NONE
- * side effects - This function takes care of
- * finding right conf file, writing
- * the right lines to this file,
- * notifying the oper that their kline/dline etc. is in place
- * notifying the opers on the server about the k/d etc. line
- *
- * - Dianora
- */
-void
-write_conf_line(struct Client *source_p, struct ConfItem *conf,
- const char *current_date, time_t cur_time)
-{
- FILE *out;
- const char *filename, *from, *to;
- struct AccessItem *aconf;
- struct MatchItem *xconf;
- struct ResvChannel *cresv_p=NULL;
- struct MatchItem *nresv_p=NULL;
- ConfType type;
-
- type = conf->type;
- filename = get_conf_name(type);
-
- if (!MyConnect(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
- {
- from = me.id;
- to = source_p->id;
- }
- else
- {
- from = me.name;
- to = source_p->name;
- }
-
- if ((out = fopen(filename, "a")) == NULL)
- {
- sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "*** Problem opening %s ", filename);
- return;
- }
-
- switch(type)
- {
- case KLINE_TYPE:
- aconf = (struct AccessItem *)map_to_conf(conf);
- 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);
- sendto_one(source_p, ":%s NOTICE %s :Added K-Line [%s@%s]",
- from, to, aconf->user, aconf->host);
- ilog(LOG_TYPE_KLINE, "%s added K-Line for [%s@%s] [%s]",
- source_p->name, aconf->user, aconf->host, aconf->reason);
- write_csv_line(out, "%s%s%s%s%s%s%d",
- aconf->user, aconf->host,
- aconf->reason, aconf->oper_reason, current_date,
- get_oper_name(source_p), cur_time);
- break;
- case DLINE_TYPE:
- aconf = (struct AccessItem *)map_to_conf(conf);
- 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);
- sendto_one(source_p, ":%s NOTICE %s :Added D-Line [%s] to %s",
- from, to, aconf->host, filename);
- ilog(LOG_TYPE_DLINE, "%s added D-Line for [%s] [%s]",
- get_oper_name(source_p), aconf->host, aconf->reason);
- write_csv_line(out, "%s%s%s%s%s%d",
- aconf->host, aconf->reason, aconf->oper_reason,
- current_date,
- get_oper_name(source_p), cur_time);
- break;
-
- case XLINE_TYPE:
- xconf = (struct MatchItem *)map_to_conf(conf);
- 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);
- sendto_one(source_p,
- ":%s NOTICE %s :Added X-Line [%s] [%d] [%s] to %s",
- from, to, conf->name,
- xconf->action, xconf->reason, filename);
- ilog(LOG_TYPE_IRCD, "%s added X-Line for [%s] [%s]",
- get_oper_name(source_p), conf->name, xconf->reason);
- write_csv_line(out, "%s%s%s%s%s%d",
- conf->name, xconf->reason, xconf->oper_reason,
- current_date, get_oper_name(source_p), cur_time);
- break;
- case CRESV_TYPE:
- cresv_p = (struct ResvChannel *)map_to_conf(conf);
-
- write_csv_line(out, "%s%s",
- cresv_p->name, cresv_p->reason);
- break;
-
- case NRESV_TYPE:
- nresv_p = (struct MatchItem *)map_to_conf(conf);
-
- write_csv_line(out, "%s%s",
- conf->name, nresv_p->reason);
- break;
-
- default:
- fclose(out);
- return;
- }
-
- fclose(out);
-}
-
-/*
- * write_csv_line()
- *
- * inputs - pointer to FILE *
- * - formatted string
- * output -
- * side effects - single line is written to csv conf file
- */
-static int
-write_csv_line(FILE *out, const char *format, ...)
-{
- char c;
- size_t bytes = 0;
- va_list args;
- char tmp[1024];
- char *str = tmp;
- const char *null_string = "";
-
- if (out == NULL)
- return(0);
-
- va_start(args, format);
-
- while ((c = *format++))
- {
- if (c == '%')
- {
- c = *format++;
- if (c == 's')
- {
- const char *p1 = va_arg(args, const char *);
- if (p1 == NULL)
- p1 = null_string;
- *str++ = '\"';
- ++bytes;
- while (*p1 != '\0')
- {
- *str++ = *p1++;
- ++bytes;
- }
- *str++ = '\"';
- *str++ = ',';
-
- bytes += 2;
- continue;
- }
- if (c == 'c')
- {
- *str++ = '\"';
- ++bytes;
- *str++ = (char) va_arg(args, int);
- ++bytes;
- *str++ = '\"';
- *str++ = ',';
-
- bytes += 2;
- continue;
- }
-
- if (c == 'd')
- {
- int v = va_arg(args, int);
- char t[40];
- char *p=t;
-
- while (v > 10)
- {
- *p++ = (v % 10) + '0';
- v = v/10;
- }
- *p++ = (v % 10) + '0';
-
- *str++ = '\"';
- ++bytes;
- while (p != t)
- {
- *str++ = *--p;
- ++bytes;
- }
-
- *str++ = '\"';
- *str++ = ',';
- bytes += 2;
- continue;
- }
- if (c != '%')
- {
- int ret;
-
- format -= 2;
- ret = vsprintf(str, format, args);
- str += ret;
- bytes += ret;
- *str++ = ',';
-
- ++bytes;
- break;
- }
- }
- *str++ = c;
- ++bytes;
- }
-
- if (*(str-1) == ',')
- {
- *(str-1) = '\n';
- *str = '\0';
- }
- else
- {
- *str++ = '\n';
- ++bytes;
- *str = '\0';
- }
-
- va_end(args);
- str = tmp;
- fputs(str, out);
-
- return(bytes);
-}
-
-/*
- * getfield
- *
- * inputs - input buffer
- * output - next field
- * side effects - field breakup for ircd.conf file.
- */
-static char *
-getfield(char *newline)
-{
- static char *line = NULL;
- char *end, *field;
-
- if (newline != NULL)
- line = newline;
-
- if (line == NULL)
- return(NULL);
-
- field = line;
-
- /* skip everything that's not a starting quote */
- for(;;)
- {
- if (*field == '\0')
- return(NULL);
- else if (*field == '"')
- break;
- ++field;
- }
-
- /* skip over the beginning " */
- end = ++field;
-
- for (;;)
- {
- /* At end of string, mark it as end and return */
- if ((*end == '\0') || (*end == '\n'))
- {
- line = NULL;
- return(NULL);
- }
- else if (*end == '\\') /* found escape character ? */
- {
- end++;
- }
- else if (*end == '"') /* found terminating " */
- {
- *end++ = '\0';
- line = end;
- return(field);
- }
-
- end++;
- }
-
- return (NULL);
-}
-
-/* remove_conf_line()
- *
- * inputs - type of kline to remove
- * - pointer to oper removing
- * - pat1 pat2 patterns to match
- * output - -1 if unsuccessful 0 if no change 1 if change
- * side effects -
- */
-int
-remove_conf_line(ConfType type, struct Client *source_p, const char *pat1, const char *pat2)
-{
- const char *filename;
- FILE *in, *out;
- int pairme=0;
- char buf[IRCD_BUFSIZE], buff[IRCD_BUFSIZE], temppath[IRCD_BUFSIZE];
- char *found1;
- char *found2;
- int oldumask;
-
- filename = get_conf_name(type);
-
- if ((in = fopen(filename, "r")) == NULL)
- {
- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name,
- source_p->name, filename);
- return -1;
- }
-
- ircsprintf(temppath, "%s.tmp", filename);
- oldumask = umask(0);
-
- if ((out = fopen(temppath, "w")) == NULL)
- {
- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name,
- source_p->name, temppath);
- fclose(in);
- umask(oldumask);
- return -1;
- }
-
- umask(oldumask);
- oldumask = umask(0);
-
- while (fgets(buf, sizeof(buf), in) != NULL)
- {
- if ((*buf == '\0') || (*buf == '#'))
- {
- if (flush_write(source_p, in, out, buf, temppath) < 0)
- return -1;
- }
-
- /* Keep copy of original line, getfield trashes line as it goes */
- strlcpy(buff, buf, sizeof(buff));
-
- if ((found1 = getfield(buff)) == NULL)
- {
- if (flush_write(source_p, in, out, buf, temppath) < 0)
- return -1;
- continue;
- }
-
- if (pat2 != NULL)
- {
- if ((found2 = getfield(NULL)) == NULL)
- {
- if (flush_write(source_p, in, out, buf, temppath) < 0)
- return -1;
- continue;
- }
-
- if (!irccmp(pat1, found1) && !irccmp(pat2, found2))
- {
- pairme = 1;
- continue;
- }
- else
- {
- if(flush_write(source_p, in, out, buf, temppath) < 0)
- return -1;
- continue;
- }
- }
- else
- {
- if (!irccmp(pat1, found1))
- {
- pairme = 1;
- continue;
- }
- else
- {
- if(flush_write(source_p, in, out, buf, temppath) < 0)
- return -1;
- continue;
- }
- }
- }
-
- fclose(in);
- fclose(out);
-
-/* The result of the rename should be checked too... oh well */
-/* If there was an error on a write above, then its been reported
- * and I am not going to trash the original kline /conf file
- */
-
- if (pairme == 0)
- {
- if(temppath != NULL)
- (void)unlink(temppath);
- return 0;
- }
- else
- {
- (void)rename(temppath, filename);
-
- /* XXX
- * This is a very inefficient way of removing a kline/xline etc.
- * This next function call forces a complete re-read of all conf
- * files, instead of a re-read of the kline/dline etc. files modified
- * But, consider how often an /quote unkline etc. is done compared
- * to how often a /quote kline is done. Its not a biggie in
- * the grand scheme of things. If it does become a biggie,
- * we will rewrite it - Dianora
- */
-
- rehash(0);
- return 1;
- }
-}
-
-/*
- * flush_write()
- *
- * inputs - pointer to client structure of oper requesting unkline
- * - in is the input file descriptor
- * - out is the output file descriptor
- * - buf is the buffer to write
- * - ntowrite is the expected number of character to be written
- * - temppath is the temporary file name to be written
- * output - -1 for error on write
- * - 0 for ok
- * side effects - if successful, the buf is written to output file
- * if a write failure happesn, and the file pointed to
- * by temppath, if its non NULL, is removed.
- *
- * The idea here is, to be as robust as possible when writing to the
- * kline file.
- *
- * -Dianora
- */
-static int
-flush_write(struct Client *source_p, FILE *in, FILE* out,
- const char *buf, const char *temppath)
-{
- int error_on_write = fputs(buf, out) < 0 ? (-1) : (0);
-
- if (error_on_write)
- {
- sendto_one(source_p,":%s NOTICE %s :Unable to write to %s aborting",
- me.name, source_p->name, temppath);
- if(temppath != NULL)
- (void)unlink(temppath);
- fclose(in);
- fclose(out);
- }
-
- return (error_on_write);
-}
diff --git a/src/hostmask.c b/src/hostmask.c
index 368378b..2c74463 100644
--- a/src/hostmask.c
+++ b/src/hostmask.c
@@ -749,6 +749,10 @@ clear_out_address_conf(void)
*/
if (!(arec->aconf->flags & CONF_FLAGS_TEMPORARY))
{
+ /* XXX HACK */
+ if (arec->type == CONF_KLINE && !IsConfMain(arec->aconf))
+ continue;
+
dlinkDelete(&arec->node, &atable[i]);
/* unlink it from link list - Dianora */
arec->aconf->status |= CONF_ILLEGAL;
diff --git a/src/ircd.c b/src/ircd.c
index d7ac4a7..977841d 100644
--- a/src/ircd.c
+++ b/src/ircd.c
@@ -59,7 +59,7 @@
#include "motd.h"
#include "supported.h"
#include "watch.h"
-
+#include "conf_db.h"
/* /quote set variables */
struct SetOptions GlobalSetOptions;
@@ -506,8 +506,8 @@ main(int argc, char *argv[])
ConfigFileEntry.klinefile = KPATH; /* Server kline file */
ConfigFileEntry.xlinefile = XPATH; /* Server xline file */
ConfigFileEntry.dlinefile = DLPATH; /* dline file */
- ConfigFileEntry.cresvfile = CRESVPATH; /* channel resv file */
- ConfigFileEntry.nresvfile = NRESVPATH; /* nick resv file */
+// ConfigFileEntry.cresvfile = CRESVPATH; /* channel resv file */
+// ConfigFileEntry.nresvfile = NRESVPATH; /* nick resv file */
myargv = argv;
umask(077); /* better safe than sorry --SRB */
@@ -608,6 +608,12 @@ main(int argc, char *argv[])
/* add ourselves to global_serv_list */
dlinkAdd(&me, make_dlink_node(), &global_serv_list);
+ load_kline_database();
+ load_dline_database();
+ load_gline_database();
+ load_xline_database();
+ load_resv_database();
+
if (chdir(MODPATH))
{
ilog(LOG_TYPE_IRCD, "Could not load core modules. Terminating!");
diff --git a/src/messages.tab b/src/messages.tab
index 12e22c6..09f7f98 100644
--- a/src/messages.tab
+++ b/src/messages.tab
@@ -240,7 +240,7 @@ static struct NumericInfo replies[] = {
/* 213 */ {"RPL_STATSCLINE", ":%s 213 %s %c %s %s %s %d %s", NULL},
/* 214 */ {"RPL_STATSNLINE", ":%s 214 %s %c %s * %s %d %s", NULL},
/* 215 */ {"RPL_STATSILINE", ":%s 215 %s %c %s * %s@%s %d %s", NULL},
-/* 216 */ {"RPL_STATSKLINE", ":%s 216 %s %s %s * %s :%s | %s", NULL},
+/* 216 */ {"RPL_STATSKLINE", ":%s 216 %s %s %s * %s :%s", NULL},
/* 217 */ {"RPL_STATSQLINE", ":%s 217 %s %c %s :%s", NULL},
/* 218 */ {"RPL_STATSYLINE", ":%s 218 %s %c %s %d %d %d %lu %lu %d %d/%d %d/%d %s", NULL},
/* 219 */ {"RPL_ENDOFSTATS", ":%s 219 %s %c :End of /STATS report", NULL},
@@ -249,7 +249,7 @@ static struct NumericInfo replies[] = {
/* 222 */ {NULL, NULL, NULL},
/* 223 */ {NULL, NULL, NULL},
/* 224 */ {NULL, NULL, NULL},
-/* 225 */ {"RPL_STATSDLINE", ":%s 225 %s %c %s :%s | %s", NULL},
+/* 225 */ {"RPL_STATSDLINE", ":%s 225 %s %c %s :%s", NULL},
/* 226 */ {"RPL_STATSALINE", ":%s 226 %s %s", NULL},
/* 227 */ {NULL, NULL, NULL},
/* 228 */ {NULL, NULL, NULL},
@@ -751,7 +751,7 @@ static struct NumericInfo replies[] = {
/* 722 */ {NULL, NULL, NULL},
/* 723 */ {"ERR_NOPRIVS", ":%s 723 %s %s :Insufficient oper privs.", NULL },
/* 724 */ {"RPL_TESTMASK", ":%s 724 %s %s!%s@%s %u %u :Local/remote clients match.", NULL },
-/* 725 */ {"RPL_TESTLINE", ":%s 725 %s %c %ld %s :%s | %s", NULL },
+/* 725 */ {"RPL_TESTLINE", ":%s 725 %s %c %ld %s :%s", NULL },
/* 726 */ {"RPL_NOTESTLINE", ":%s 726 %s %s :No matches", NULL },
/* 727 */ {NULL, NULL, NULL},
/* 728 */ {NULL, NULL, NULL},
diff --git a/src/resv.c b/src/resv.c
index 6f4ec14..21d56b0 100644
--- a/src/resv.c
+++ b/src/resv.c
@@ -34,6 +34,7 @@
#include "irc_string.h"
#include "ircd_defs.h"
#include "conf.h"
+#include "conf_db.h"
dlink_list resv_channel_list = { NULL, NULL, 0 };
@@ -72,6 +73,9 @@ create_channel_resv(char *name, char *reason, int in_conf)
dlinkAdd(resv_p, &resv_p->node, &resv_channel_list);
hash_add_resv(resv_p);
+ if (!in_conf)
+ save_resv_database();
+
return conf;
}
@@ -105,6 +109,9 @@ create_nick_resv(char *name, char *reason, int in_conf)
DupString(resv_p->reason, reason);
resv_p->action = in_conf;
+ if (!in_conf)
+ save_resv_database();
+
return conf;
}