Automated merge with ssh://hg.atheme.org//hg/charybdis
This commit is contained in:
commit
f28d832416
21 changed files with 245 additions and 170 deletions
10
TODO
10
TODO
|
@ -19,10 +19,8 @@
|
||||||
[x] ssl channelmode (done by extban and chm_compat)
|
[x] ssl channelmode (done by extban and chm_compat)
|
||||||
[ ] acknowledgement message for SSL users like '* *** You are connected using SSL cipher "DHE RSA-AES 128 CBC-SHA"'
|
[ ] acknowledgement message for SSL users like '* *** You are connected using SSL cipher "DHE RSA-AES 128 CBC-SHA"'
|
||||||
[ ] ssl stuff files generator in ./configure time
|
[ ] ssl stuff files generator in ./configure time
|
||||||
[?] merge some stuff from ircd-seven directly (to be determined what)
|
[x] merge some stuff from ircd-seven directly (to be determined what)
|
||||||
[?] remote d:lines support?
|
[x] remote d:lines support
|
||||||
[?] PASS selector:password for auth{}? (useful for dynamic IPs)
|
|
||||||
[?] +C (noctcp) channel/usermode
|
|
||||||
[F] kline/xline/resv sync
|
[F] kline/xline/resv sync
|
||||||
[F] make an ability of using bandb instead of .conf files as bans storage
|
[F] make an ability of using bandb instead of .conf files as bans storage
|
||||||
[F] drop non-TS6 (legacy protocol) support
|
[F] drop non-TS6 (legacy protocol) support
|
||||||
|
@ -34,7 +32,9 @@
|
||||||
[F] auth checker module
|
[F] auth checker module
|
||||||
[F] resolver module
|
[F] resolver module
|
||||||
[x] Remove glines entirely
|
[x] Remove glines entirely
|
||||||
[ ] other stuff
|
--- other stuff
|
||||||
|
[?] PASS selector:password for auth{} from ircd-seven? (useful for dynamic IPs)
|
||||||
|
[?] +C (noctcp) channel/usermode from ircd-seven?
|
||||||
[?] internally split out +o/+v "ranks" into a series of permissions. this could allow for configure-defined
|
[?] internally split out +o/+v "ranks" into a series of permissions. this could allow for configure-defined
|
||||||
special access levels, halfops, etc. (would need to match globally, somehow. extra SVINFO param?)
|
special access levels, halfops, etc. (would need to match globally, somehow. extra SVINFO param?)
|
||||||
[?] somehow hide channel operators like ircnet can do?
|
[?] somehow hide channel operators like ircnet can do?
|
||||||
|
|
|
@ -580,6 +580,9 @@ shared {
|
||||||
* all - allow oper/server to do all of above.
|
* all - allow oper/server to do all of above.
|
||||||
* locops - allow locops - only used for servers who cluster
|
* locops - allow locops - only used for servers who cluster
|
||||||
* rehash - allow rehashing
|
* rehash - allow rehashing
|
||||||
|
* dline - allow setting perm/temp dlines
|
||||||
|
* tdline - allow setting temp dlines
|
||||||
|
* undline - allow removing dlines
|
||||||
* none - disallow everything
|
* none - disallow everything
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -398,6 +398,7 @@
|
||||||
<command>DLINE</command>
|
<command>DLINE</command>
|
||||||
<arg><replaceable>length</replaceable></arg>
|
<arg><replaceable>length</replaceable></arg>
|
||||||
<arg choice=plain><replaceable>a</replaceable>.<replaceable>b</replaceable>.<replaceable>c</replaceable>.<replaceable>d</replaceable></arg>
|
<arg choice=plain><replaceable>a</replaceable>.<replaceable>b</replaceable>.<replaceable>c</replaceable>.<replaceable>d</replaceable></arg>
|
||||||
|
<arg>ON <replaceable>servername</replaceable></arg>
|
||||||
<arg>:<replaceable>reason</replaceable></arg>
|
<arg>:<replaceable>reason</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
<para>
|
<para>
|
||||||
|
@ -424,7 +425,10 @@
|
||||||
connections.
|
connections.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
D:lines cannot be set remotely on other servers.
|
If the ON part is specified, the D:line is set on servers matching
|
||||||
|
the given mask (provided a matching shared{} block exists there,
|
||||||
|
which is not the case by default).
|
||||||
|
Otherwise, the D:Line will be set on the local server only.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Only exempt{} blocks exempt from D:lines.
|
Only exempt{} blocks exempt from D:lines.
|
||||||
|
@ -437,6 +441,7 @@
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>UNDLINE</command>
|
<command>UNDLINE</command>
|
||||||
<arg choice=plain><replaceable>a.b.c.d</replaceable></arg>
|
<arg choice=plain><replaceable>a.b.c.d</replaceable></arg>
|
||||||
|
<arg>ON <replaceable>servername</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
<para>
|
<para>
|
||||||
Will attempt to remove a D:line from <filename>dline.conf</filename>, and will flush
|
Will attempt to remove a D:line from <filename>dline.conf</filename>, and will flush
|
||||||
|
|
|
@ -1018,7 +1018,7 @@ shared {
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>all</term>
|
<term>all</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>All of the above; this does not include locops or rehash</para>
|
<para>All of the above; this does not include locops, rehash, dline, tdline or undline.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -1036,6 +1036,24 @@ shared {
|
||||||
<para>REHASH commands; all options can be used</para>
|
<para>REHASH commands; all options can be used</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>dline (D)</term>
|
||||||
|
<listitem>
|
||||||
|
<para>Permanent and temporary D:lines</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>tdline (d)</term>
|
||||||
|
<listitem>
|
||||||
|
<para>Temporary D:lines</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>undline (E)</term>
|
||||||
|
<listitem>
|
||||||
|
<para>D:line removals</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>none</term>
|
<term>none</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
|
@ -15,20 +15,20 @@ typedef struct
|
||||||
|
|
||||||
typedef void (*hookfn) (void *data);
|
typedef void (*hookfn) (void *data);
|
||||||
|
|
||||||
int h_iosend_id;
|
extern int h_iosend_id;
|
||||||
int h_iorecv_id;
|
extern int h_iorecv_id;
|
||||||
int h_iorecvctrl_id;
|
extern int h_iorecvctrl_id;
|
||||||
|
|
||||||
int h_burst_client;
|
extern int h_burst_client;
|
||||||
int h_burst_channel;
|
extern int h_burst_channel;
|
||||||
int h_burst_finished;
|
extern int h_burst_finished;
|
||||||
int h_server_introduced;
|
extern int h_server_introduced;
|
||||||
int h_server_eob;
|
extern int h_server_eob;
|
||||||
int h_client_exit;
|
extern int h_client_exit;
|
||||||
int h_umode_changed;
|
extern int h_umode_changed;
|
||||||
int h_new_local_user;
|
extern int h_new_local_user;
|
||||||
int h_new_remote_user;
|
extern int h_new_remote_user;
|
||||||
int h_introduce_client;
|
extern int h_introduce_client;
|
||||||
|
|
||||||
void init_hook(void);
|
void init_hook(void);
|
||||||
int register_hook(const char *name);
|
int register_hook(const char *name);
|
||||||
|
|
|
@ -150,6 +150,11 @@ extern void *irc_dictionary_retrieve(struct Dictionary *dtree, const char *key);
|
||||||
*/
|
*/
|
||||||
extern void *irc_dictionary_delete(struct Dictionary *dtree, const char *key);
|
extern void *irc_dictionary_delete(struct Dictionary *dtree, const char *key);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* irc_dictionary_size() returns the number of elements in a dictionary tree.
|
||||||
|
*/
|
||||||
|
extern unsigned int irc_dictionary_size(struct Dictionary *dtree);
|
||||||
|
|
||||||
void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata);
|
void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -99,6 +99,11 @@ extern rb_dlink_list local_oper_list;
|
||||||
extern rb_dlink_list oper_list;
|
extern rb_dlink_list oper_list;
|
||||||
extern rb_dlink_list dead_list;
|
extern rb_dlink_list dead_list;
|
||||||
|
|
||||||
|
extern rb_bh *channel_heap;
|
||||||
|
extern rb_bh *ban_heap;
|
||||||
|
extern rb_bh *topic_heap;
|
||||||
|
extern rb_bh *member_heap;
|
||||||
|
|
||||||
extern int testing_conf;
|
extern int testing_conf;
|
||||||
|
|
||||||
extern struct ev_entry *check_splitmode_ev;
|
extern struct ev_entry *check_splitmode_ev;
|
||||||
|
|
|
@ -115,4 +115,6 @@ extern void irc_ns_put16(unsigned int src, unsigned char *dst);
|
||||||
extern void irc_ns_put32(unsigned long src, unsigned char *dst);
|
extern void irc_ns_put32(unsigned long src, unsigned char *dst);
|
||||||
extern int irc_res_mkquery(const char *dname, int class, int type, unsigned char *buf, int buflen);
|
extern int irc_res_mkquery(const char *dname, int class, int type, unsigned char *buf, int buflen);
|
||||||
|
|
||||||
|
extern char irc_domain[HOSTLEN + 1];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -303,7 +303,7 @@ extern struct server_info ServerInfo; /* defined in ircd.c */
|
||||||
extern struct admin_info AdminInfo; /* defined in ircd.c */
|
extern struct admin_info AdminInfo; /* defined in ircd.c */
|
||||||
/* End GLOBAL section */
|
/* End GLOBAL section */
|
||||||
|
|
||||||
rb_dlink_list service_list;
|
extern rb_dlink_list service_list;
|
||||||
|
|
||||||
typedef enum temp_list
|
typedef enum temp_list
|
||||||
{
|
{
|
||||||
|
@ -314,8 +314,8 @@ typedef enum temp_list
|
||||||
LAST_TEMP_TYPE
|
LAST_TEMP_TYPE
|
||||||
} temp_list;
|
} temp_list;
|
||||||
|
|
||||||
rb_dlink_list temp_klines[LAST_TEMP_TYPE];
|
extern rb_dlink_list temp_klines[LAST_TEMP_TYPE];
|
||||||
rb_dlink_list temp_dlines[LAST_TEMP_TYPE];
|
extern rb_dlink_list temp_dlines[LAST_TEMP_TYPE];
|
||||||
|
|
||||||
extern void init_s_conf(void);
|
extern void init_s_conf(void);
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ extern rb_dlink_list resv_conf_list;
|
||||||
extern rb_dlink_list nd_list;
|
extern rb_dlink_list nd_list;
|
||||||
extern rb_dlink_list tgchange_list;
|
extern rb_dlink_list tgchange_list;
|
||||||
|
|
||||||
struct _rb_patricia_tree_t *tgchange_tree;
|
extern struct _rb_patricia_tree_t *tgchange_tree;
|
||||||
|
|
||||||
extern void init_s_newconf(void);
|
extern void init_s_newconf(void);
|
||||||
extern void clear_s_newconf(void);
|
extern void clear_s_newconf(void);
|
||||||
|
@ -95,6 +95,9 @@ struct remote_conf
|
||||||
#define SHARED_PRESV 0x0100
|
#define SHARED_PRESV 0x0100
|
||||||
#define SHARED_UNRESV 0x0200
|
#define SHARED_UNRESV 0x0200
|
||||||
#define SHARED_REHASH 0x0400
|
#define SHARED_REHASH 0x0400
|
||||||
|
#define SHARED_TDLINE 0x0800
|
||||||
|
#define SHARED_PDLINE 0x1000
|
||||||
|
#define SHARED_UNDLINE 0x2000
|
||||||
|
|
||||||
#define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\
|
#define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\
|
||||||
SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\
|
SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\
|
||||||
|
|
|
@ -44,15 +44,17 @@
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
static int mo_dline(struct Client *, struct Client *, int, const char **);
|
static int mo_dline(struct Client *, struct Client *, int, const char **);
|
||||||
|
static int me_dline(struct Client *, struct Client *, int, const char **);
|
||||||
static int mo_undline(struct Client *, struct Client *, int, const char **);
|
static int mo_undline(struct Client *, struct Client *, int, const char **);
|
||||||
|
static int me_undline(struct Client *, struct Client *, int, const char **);
|
||||||
|
|
||||||
struct Message dline_msgtab = {
|
struct Message dline_msgtab = {
|
||||||
"DLINE", 0, 0, 0, MFLG_SLOW,
|
"DLINE", 0, 0, 0, MFLG_SLOW,
|
||||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_dline, 2}}
|
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_dline, 3}, {mo_dline, 2}}
|
||||||
};
|
};
|
||||||
struct Message undline_msgtab = {
|
struct Message undline_msgtab = {
|
||||||
"UNDLINE", 0, 0, 0, MFLG_SLOW,
|
"UNDLINE", 0, 0, 0, MFLG_SLOW,
|
||||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_undline, 2}}
|
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_undline, 1}, {mo_undline, 2}}
|
||||||
};
|
};
|
||||||
|
|
||||||
mapi_clist_av1 dline_clist[] = { &dline_msgtab, &undline_msgtab, NULL };
|
mapi_clist_av1 dline_clist[] = { &dline_msgtab, &undline_msgtab, NULL };
|
||||||
|
@ -61,6 +63,8 @@ DECLARE_MODULE_AV1(dline, NULL, NULL, dline_clist, NULL, NULL, "$Revision: 3225
|
||||||
static int valid_comment(char *comment);
|
static int valid_comment(char *comment);
|
||||||
static int flush_write(struct Client *, FILE *, char *, char *);
|
static int flush_write(struct Client *, FILE *, char *, char *);
|
||||||
static int remove_temp_dline(struct ConfItem *);
|
static int remove_temp_dline(struct ConfItem *);
|
||||||
|
static int apply_dline(struct Client *, const char *, int, char *);
|
||||||
|
static int apply_undline(struct Client *, const char *);
|
||||||
|
|
||||||
/* mo_dline()
|
/* mo_dline()
|
||||||
*
|
*
|
||||||
|
@ -73,15 +77,10 @@ mo_dline(struct Client *client_p, struct Client *source_p,
|
||||||
{
|
{
|
||||||
char def[] = "No Reason";
|
char def[] = "No Reason";
|
||||||
const char *dlhost;
|
const char *dlhost;
|
||||||
char *oper_reason;
|
|
||||||
char *reason = def;
|
char *reason = def;
|
||||||
struct rb_sockaddr_storage daddr;
|
|
||||||
char cidr_form_host[HOSTLEN + 1];
|
char cidr_form_host[HOSTLEN + 1];
|
||||||
struct ConfItem *aconf;
|
|
||||||
int bits;
|
|
||||||
char dlbuffer[IRCD_BUFSIZE];
|
|
||||||
const char *current_date;
|
|
||||||
int tdline_time = 0;
|
int tdline_time = 0;
|
||||||
|
const char *target_server = NULL;
|
||||||
int loc = 1;
|
int loc = 1;
|
||||||
|
|
||||||
if(!IsOperK(source_p))
|
if(!IsOperK(source_p))
|
||||||
|
@ -94,29 +93,153 @@ mo_dline(struct Client *client_p, struct Client *source_p,
|
||||||
if((tdline_time = valid_temp_time(parv[loc])) >= 0)
|
if((tdline_time = valid_temp_time(parv[loc])) >= 0)
|
||||||
loc++;
|
loc++;
|
||||||
|
|
||||||
if(parc < loc + 1)
|
|
||||||
{
|
|
||||||
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
|
|
||||||
me.name, source_p->name, "DLINE");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dlhost = parv[loc];
|
dlhost = parv[loc];
|
||||||
rb_strlcpy(cidr_form_host, dlhost, sizeof(cidr_form_host));
|
rb_strlcpy(cidr_form_host, dlhost, sizeof(cidr_form_host));
|
||||||
|
|
||||||
if(!parse_netmask(dlhost, NULL, &bits))
|
loc++;
|
||||||
|
|
||||||
|
if(parc >= loc+2 && !irccmp(parv[loc], "ON"))
|
||||||
|
{
|
||||||
|
target_server = parv[loc+1];
|
||||||
|
loc += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(parc >= loc + 1 && !EmptyString(parv[loc]))
|
||||||
|
reason = LOCAL_COPY(parv[loc]);
|
||||||
|
|
||||||
|
if(target_server != NULL)
|
||||||
|
{
|
||||||
|
sendto_match_servs(source_p, target_server,
|
||||||
|
CAP_ENCAP, NOCAPS,
|
||||||
|
"ENCAP %s DLINE %d %s :%s",
|
||||||
|
target_server, tdline_time, dlhost, reason);
|
||||||
|
|
||||||
|
if(!match(target_server, me.name))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_dline(source_p, dlhost, tdline_time, reason);
|
||||||
|
|
||||||
|
check_dlines();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mo_undline()
|
||||||
|
*
|
||||||
|
* parv[1] = dline to remove
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
mo_undline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||||
|
{
|
||||||
|
const char *cidr;
|
||||||
|
const char *target_server = NULL;
|
||||||
|
|
||||||
|
if(!IsOperK(source_p))
|
||||||
|
{
|
||||||
|
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||||
|
me.name, source_p->name, "unkline");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
cidr = parv[1];
|
||||||
|
|
||||||
|
if(parc >= 4 && !irccmp(parv[2], "ON"))
|
||||||
|
{
|
||||||
|
target_server = parv[3];
|
||||||
|
sendto_match_servs(source_p, target_server,
|
||||||
|
CAP_ENCAP, NOCAPS,
|
||||||
|
"ENCAP %s UNDLINE %s",
|
||||||
|
target_server, cidr);
|
||||||
|
|
||||||
|
if(!match(target_server, me.name))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_undline(source_p, cidr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
me_dline(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
|
||||||
|
{
|
||||||
|
int tdline_time = atoi(parv[1]);
|
||||||
|
/* Since this is coming over a server link, assume that the originating
|
||||||
|
* server did the relevant permission/sanity checks...
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(!IsPerson(source_p))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if(!find_shared_conf(source_p->username, source_p->host,
|
||||||
|
source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3]));
|
||||||
|
|
||||||
|
check_dlines();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
me_undline(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
|
||||||
|
{
|
||||||
|
if(!IsPerson(source_p))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if(!find_shared_conf(source_p->username, source_p->host,
|
||||||
|
source_p->servptr->name, SHARED_UNDLINE))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
apply_undline(source_p, parv[1]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *reason)
|
||||||
|
{
|
||||||
|
struct ConfItem *aconf;
|
||||||
|
char *oper_reason;
|
||||||
|
char dlbuffer[IRCD_BUFSIZE];
|
||||||
|
const char *current_date;
|
||||||
|
struct rb_sockaddr_storage daddr;
|
||||||
|
int t = AF_INET, ty, b;
|
||||||
|
const char *creason;
|
||||||
|
|
||||||
|
ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b);
|
||||||
|
if(ty == HM_HOST)
|
||||||
{
|
{
|
||||||
sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line",
|
sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line",
|
||||||
me.name, source_p->name);
|
me.name, source_p->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifdef RB_IPV6
|
||||||
|
if(ty == HM_IPV6)
|
||||||
|
t = AF_INET6;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
t = AF_INET;
|
||||||
|
|
||||||
loc++;
|
/* This means dlines wider than /16 cannot be set remotely */
|
||||||
|
if(IsOperAdmin(source_p))
|
||||||
if(parc >= loc + 1) /* host :reason */
|
|
||||||
{
|
{
|
||||||
if(!EmptyString(parv[loc]))
|
if(b < 8)
|
||||||
reason = LOCAL_COPY(parv[loc]);
|
{
|
||||||
|
sendto_one_notice(source_p,
|
||||||
|
":For safety, bitmasks less than 8 require conf access.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(b < 16)
|
||||||
|
{
|
||||||
|
sendto_one_notice(source_p,
|
||||||
|
":Dline bitmasks less than 16 are for admins only.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!valid_comment(reason))
|
if(!valid_comment(reason))
|
||||||
{
|
{
|
||||||
|
@ -125,41 +248,19 @@ mo_dline(struct Client *client_p, struct Client *source_p,
|
||||||
me.name, source_p->name);
|
me.name, source_p->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(IsOperAdmin(source_p))
|
/* Look for an oper reason */
|
||||||
|
if((oper_reason = strchr(reason, '|')) != NULL)
|
||||||
{
|
{
|
||||||
if(bits < 8)
|
*oper_reason = '\0';
|
||||||
{
|
oper_reason++;
|
||||||
sendto_one(source_p,
|
|
||||||
":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.",
|
if(!EmptyString(oper_reason))
|
||||||
me.name, parv[0]);
|
aconf->spasswd = rb_strdup(oper_reason);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(bits < 16)
|
|
||||||
{
|
|
||||||
sendto_one(source_p,
|
|
||||||
":%s NOTICE %s :Dline bitmasks less than 16 are for admins only.",
|
|
||||||
me.name, parv[0]);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ConfigFileEntry.non_redundant_klines)
|
if(ConfigFileEntry.non_redundant_klines)
|
||||||
{
|
{
|
||||||
const char *creason;
|
|
||||||
int t = AF_INET, ty, b;
|
|
||||||
ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b);
|
|
||||||
#ifdef RB_IPV6
|
|
||||||
if(ty == HM_IPV6)
|
|
||||||
t = AF_INET6;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
t = AF_INET;
|
|
||||||
|
|
||||||
if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL)
|
if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL)
|
||||||
{
|
{
|
||||||
int bx;
|
int bx;
|
||||||
|
@ -170,11 +271,11 @@ mo_dline(struct Client *client_p, struct Client *source_p,
|
||||||
if(IsConfExemptKline(aconf))
|
if(IsConfExemptKline(aconf))
|
||||||
sendto_one(source_p,
|
sendto_one(source_p,
|
||||||
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
|
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
|
||||||
me.name, parv[0], dlhost, aconf->host, creason);
|
me.name, source_p->name, dlhost, aconf->host, creason);
|
||||||
else
|
else
|
||||||
sendto_one(source_p,
|
sendto_one(source_p,
|
||||||
":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
|
":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
|
||||||
me.name, parv[0], dlhost, aconf->host, creason);
|
me.name, source_p->name, dlhost, aconf->host, creason);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,16 +288,6 @@ mo_dline(struct Client *client_p, struct Client *source_p,
|
||||||
aconf->status = CONF_DLINE;
|
aconf->status = CONF_DLINE;
|
||||||
aconf->host = rb_strdup(dlhost);
|
aconf->host = rb_strdup(dlhost);
|
||||||
|
|
||||||
/* Look for an oper reason */
|
|
||||||
if((oper_reason = strchr(reason, '|')) != NULL)
|
|
||||||
{
|
|
||||||
*oper_reason = '\0';
|
|
||||||
oper_reason++;
|
|
||||||
|
|
||||||
if(!EmptyString(oper_reason))
|
|
||||||
aconf->spasswd = rb_strdup(oper_reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tdline_time > 0)
|
if(tdline_time > 0)
|
||||||
{
|
{
|
||||||
rb_snprintf(dlbuffer, sizeof(dlbuffer),
|
rb_snprintf(dlbuffer, sizeof(dlbuffer),
|
||||||
|
@ -239,36 +330,19 @@ mo_dline(struct Client *client_p, struct Client *source_p,
|
||||||
oper_reason, current_date, 0);
|
oper_reason, current_date, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_dlines();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mo_undline()
|
|
||||||
*
|
|
||||||
* parv[1] = dline to remove
|
|
||||||
*/
|
|
||||||
static int
|
static int
|
||||||
mo_undline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
apply_undline(struct Client *source_p, const char *cidr)
|
||||||
{
|
{
|
||||||
FILE *in;
|
FILE *in;
|
||||||
FILE *out;
|
FILE *out;
|
||||||
char buf[BUFSIZE], buff[BUFSIZE], temppath[BUFSIZE], *p;
|
char buf[BUFSIZE], buff[BUFSIZE], temppath[BUFSIZE], *p;
|
||||||
const char *filename, *found_cidr;
|
const char *filename, *found_cidr;
|
||||||
const char *cidr;
|
|
||||||
struct ConfItem *aconf;
|
|
||||||
int pairme = NO, error_on_write = NO;
|
int pairme = NO, error_on_write = NO;
|
||||||
mode_t oldumask;
|
mode_t oldumask;
|
||||||
|
struct ConfItem *aconf;
|
||||||
rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile);
|
|
||||||
|
|
||||||
if(!IsOperUnkline(source_p))
|
|
||||||
{
|
|
||||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
|
||||||
me.name, source_p->name, "unkline");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cidr = parv[1];
|
|
||||||
|
|
||||||
if(parse_netmask(cidr, NULL, NULL) == HM_HOST)
|
if(parse_netmask(cidr, NULL, NULL) == HM_HOST)
|
||||||
{
|
{
|
||||||
|
@ -276,6 +350,8 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile);
|
||||||
|
|
||||||
aconf = find_exact_conf_by_address(cidr, CONF_DLINE, NULL);
|
aconf = find_exact_conf_by_address(cidr, CONF_DLINE, NULL);
|
||||||
if(aconf == NULL)
|
if(aconf == NULL)
|
||||||
{
|
{
|
||||||
|
@ -288,7 +364,7 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
|
||||||
{
|
{
|
||||||
sendto_one(source_p,
|
sendto_one(source_p,
|
||||||
":%s NOTICE %s :Un-dlined [%s] from temporary D-lines",
|
":%s NOTICE %s :Un-dlined [%s] from temporary D-lines",
|
||||||
me.name, parv[0], buf);
|
me.name, source_p->name, buf);
|
||||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||||
"%s has removed the temporary D-Line for: [%s]",
|
"%s has removed the temporary D-Line for: [%s]",
|
||||||
get_oper_name(source_p), buf);
|
get_oper_name(source_p), buf);
|
||||||
|
@ -300,14 +376,14 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
|
||||||
|
|
||||||
if((in = fopen(filename, "r")) == 0)
|
if((in = fopen(filename, "r")) == 0)
|
||||||
{
|
{
|
||||||
sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], filename);
|
sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, source_p->name, filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldumask = umask(0);
|
oldumask = umask(0);
|
||||||
if((out = fopen(temppath, "w")) == 0)
|
if((out = fopen(temppath, "w")) == 0)
|
||||||
{
|
{
|
||||||
sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], temppath);
|
sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, source_p->name, temppath);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
umask(oldumask);
|
umask(oldumask);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -356,7 +432,7 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
|
||||||
{
|
{
|
||||||
sendto_one(source_p,
|
sendto_one(source_p,
|
||||||
":%s NOTICE %s :Couldn't write D-line file, aborted",
|
":%s NOTICE %s :Couldn't write D-line file, aborted",
|
||||||
me.name, parv[0]);
|
me.name, source_p->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(!pairme)
|
else if(!pairme)
|
||||||
|
@ -376,11 +452,10 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, parv[0], aconf->host);
|
sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, aconf->host);
|
||||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||||
"%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host);
|
"%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host);
|
||||||
ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host);
|
ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host);
|
||||||
|
|
||||||
delete_one_address_conf(aconf->host, aconf);
|
delete_one_address_conf(aconf->host, aconf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -951,6 +951,9 @@ static struct shared_flags shared_flagtable[] =
|
||||||
{ SHARED_UNRESV, 'R' },
|
{ SHARED_UNRESV, 'R' },
|
||||||
{ SHARED_LOCOPS, 'L' },
|
{ SHARED_LOCOPS, 'L' },
|
||||||
{ SHARED_REHASH, 'H' },
|
{ SHARED_REHASH, 'H' },
|
||||||
|
{ SHARED_TDLINE, 'd' },
|
||||||
|
{ SHARED_PDLINE, 'D' },
|
||||||
|
{ SHARED_UNDLINE, 'E' },
|
||||||
{ 0, '\0'}
|
{ 0, '\0'}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,14 +41,6 @@
|
||||||
#include "s_newconf.h"
|
#include "s_newconf.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
extern rb_dlink_list global_channel_list;
|
|
||||||
|
|
||||||
extern struct config_channel_entry ConfigChannel;
|
|
||||||
extern rb_bh *channel_heap;
|
|
||||||
extern rb_bh *ban_heap;
|
|
||||||
extern rb_bh *topic_heap;
|
|
||||||
extern rb_bh *member_heap;
|
|
||||||
|
|
||||||
static int channel_capabs[] = { CAP_EX, CAP_IE,
|
static int channel_capabs[] = { CAP_EX, CAP_IE,
|
||||||
CAP_SERVICE,
|
CAP_SERVICE,
|
||||||
CAP_TS6
|
CAP_TS6
|
||||||
|
|
|
@ -57,18 +57,12 @@
|
||||||
#define SM_ERR_RPL_Q 0x00000800
|
#define SM_ERR_RPL_Q 0x00000800
|
||||||
#define SM_ERR_RPL_F 0x00001000
|
#define SM_ERR_RPL_F 0x00001000
|
||||||
|
|
||||||
void set_channel_mode(struct Client *, struct Client *,
|
|
||||||
struct Channel *, struct membership *, int, const char **);
|
|
||||||
|
|
||||||
int add_id(struct Client *source_p, struct Channel *chptr,
|
|
||||||
const char *banid, rb_dlink_list * list, long mode_type);
|
|
||||||
|
|
||||||
static struct ChModeChange mode_changes[BUFSIZE];
|
static struct ChModeChange mode_changes[BUFSIZE];
|
||||||
static int mode_count;
|
static int mode_count;
|
||||||
static int mode_limit;
|
static int mode_limit;
|
||||||
static int mask_pos;
|
static int mask_pos;
|
||||||
|
|
||||||
int
|
static int
|
||||||
get_channel_access(struct Client *source_p, struct membership *msptr)
|
get_channel_access(struct Client *source_p, struct membership *msptr)
|
||||||
{
|
{
|
||||||
if(!MyClient(source_p) || is_chanop(msptr))
|
if(!MyClient(source_p) || is_chanop(msptr))
|
||||||
|
|
|
@ -59,6 +59,7 @@ int h_burst_finished;
|
||||||
int h_server_introduced;
|
int h_server_introduced;
|
||||||
int h_server_eob;
|
int h_server_eob;
|
||||||
int h_client_exit;
|
int h_client_exit;
|
||||||
|
int h_umode_changed;
|
||||||
int h_new_local_user;
|
int h_new_local_user;
|
||||||
int h_new_remote_user;
|
int h_new_remote_user;
|
||||||
int h_introduce_client;
|
int h_introduce_client;
|
||||||
|
|
|
@ -203,7 +203,7 @@ irc_dictionary_get_linear_index(struct Dictionary *dict, const char *key)
|
||||||
* Side Effects:
|
* Side Effects:
|
||||||
* - a new root node is nominated.
|
* - a new root node is nominated.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
irc_dictionary_retune(struct Dictionary *dict, const char *key)
|
irc_dictionary_retune(struct Dictionary *dict, const char *key)
|
||||||
{
|
{
|
||||||
struct DictionaryElement n, *tn, *left, *right, *node;
|
struct DictionaryElement n, *tn, *left, *right, *node;
|
||||||
|
@ -302,7 +302,7 @@ irc_dictionary_retune(struct Dictionary *dict, const char *key)
|
||||||
* Side Effects:
|
* Side Effects:
|
||||||
* - a node is linked to the dictionary tree
|
* - a node is linked to the dictionary tree
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
irc_dictionary_link(struct Dictionary *dict,
|
irc_dictionary_link(struct Dictionary *dict,
|
||||||
struct DictionaryElement *delem)
|
struct DictionaryElement *delem)
|
||||||
{
|
{
|
||||||
|
@ -382,7 +382,7 @@ irc_dictionary_link(struct Dictionary *dict,
|
||||||
* Side Effects:
|
* Side Effects:
|
||||||
* - the root node is unlinked from the dictionary tree
|
* - the root node is unlinked from the dictionary tree
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
irc_dictionary_unlink_root(struct Dictionary *dict)
|
irc_dictionary_unlink_root(struct Dictionary *dict)
|
||||||
{
|
{
|
||||||
struct DictionaryElement *delem, *nextnode, *parentofnext;
|
struct DictionaryElement *delem, *nextnode, *parentofnext;
|
||||||
|
@ -644,7 +644,7 @@ void irc_dictionary_foreach_next(struct Dictionary *dtree,
|
||||||
|
|
||||||
if (state->cur == NULL)
|
if (state->cur == NULL)
|
||||||
{
|
{
|
||||||
ilog(L_MAIN, "irc_dictionary_foreach_next(): called again after iteration finished on dtree<%p>", dtree);
|
ilog(L_MAIN, "irc_dictionary_foreach_next(): called again after iteration finished on dtree<%p>", (void *)dtree);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,7 +854,7 @@ void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line,
|
||||||
dict->id, dict->count);
|
dict->id, dict->count);
|
||||||
else
|
else
|
||||||
snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
|
snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
|
||||||
dict, dict->count);
|
(void *)dict, dict->count);
|
||||||
cb(str, privdata);
|
cb(str, privdata);
|
||||||
maxdepth = 0;
|
maxdepth = 0;
|
||||||
sum = stats_recurse(dict->root, 0, &maxdepth);
|
sum = stats_recurse(dict->root, 0, &maxdepth);
|
||||||
|
|
|
@ -373,6 +373,10 @@ static struct mode_table shared_table[] =
|
||||||
{ "kline", SHARED_PKLINE|SHARED_TKLINE },
|
{ "kline", SHARED_PKLINE|SHARED_TKLINE },
|
||||||
{ "xline", SHARED_PXLINE|SHARED_TXLINE },
|
{ "xline", SHARED_PXLINE|SHARED_TXLINE },
|
||||||
{ "resv", SHARED_PRESV|SHARED_TRESV },
|
{ "resv", SHARED_PRESV|SHARED_TRESV },
|
||||||
|
{ "dline", SHARED_PDLINE|SHARED_TDLINE },
|
||||||
|
{ "tdline", SHARED_TDLINE },
|
||||||
|
{ "pdline", SHARED_PDLINE },
|
||||||
|
{ "undline", SHARED_UNDLINE },
|
||||||
{ "tkline", SHARED_TKLINE },
|
{ "tkline", SHARED_TKLINE },
|
||||||
{ "unkline", SHARED_UNKLINE },
|
{ "unkline", SHARED_UNKLINE },
|
||||||
{ "txline", SHARED_TXLINE },
|
{ "txline", SHARED_TXLINE },
|
||||||
|
@ -1750,7 +1754,7 @@ conf_set_generic_string(void *data, int len, void *location)
|
||||||
char **loc = location;
|
char **loc = location;
|
||||||
char *input = data;
|
char *input = data;
|
||||||
|
|
||||||
if(len && strlen(input) > len)
|
if(len && strlen(input) > (unsigned int)len)
|
||||||
input[len] = '\0';
|
input[len] = '\0';
|
||||||
|
|
||||||
rb_free(*loc);
|
rb_free(*loc);
|
||||||
|
|
|
@ -46,8 +46,6 @@ struct reject_data
|
||||||
uint32_t mask_hashv;
|
uint32_t mask_hashv;
|
||||||
};
|
};
|
||||||
|
|
||||||
static rb_patricia_tree_t *unknown_tree;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reject_exit(void *unused)
|
reject_exit(void *unused)
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,11 +99,6 @@ static int proc_answer(struct reslist *request, HEADER * header, char *, char *)
|
||||||
static struct reslist *find_id(int id);
|
static struct reslist *find_id(int id);
|
||||||
static struct DNSReply *make_dnsreply(struct reslist *request);
|
static struct DNSReply *make_dnsreply(struct reslist *request);
|
||||||
|
|
||||||
extern struct rb_sockaddr_storage irc_nsaddr_list[IRCD_MAXNS];
|
|
||||||
extern int irc_nscount;
|
|
||||||
extern char irc_domain[HOSTLEN + 1];
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int
|
* int
|
||||||
* res_ourserver(inp)
|
* res_ourserver(inp)
|
||||||
|
|
31
src/s_conf.c
31
src/s_conf.c
|
@ -898,35 +898,6 @@ validate_conf(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* lookup_confhost - start DNS lookups of all hostnames in the conf
|
|
||||||
* line and convert an IP addresses in a.b.c.d number for to IP#s.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* conf_connect_allowed
|
|
||||||
*
|
|
||||||
* inputs - pointer to inaddr
|
|
||||||
* - int type ipv4 or ipv6
|
|
||||||
* output - ban info or NULL
|
|
||||||
* side effects - none
|
|
||||||
*/
|
|
||||||
struct ConfItem *
|
|
||||||
conf_connect_allowed(struct sockaddr *addr, int aftype)
|
|
||||||
{
|
|
||||||
struct ConfItem *aconf = find_dline(addr, aftype);
|
|
||||||
|
|
||||||
/* DLINE exempt also gets you out of static limits/pacing... */
|
|
||||||
if(aconf && (aconf->status & CONF_EXEMPTDLINE))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if(aconf != NULL)
|
|
||||||
return aconf;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add_temp_kline()
|
/* add_temp_kline()
|
||||||
*
|
*
|
||||||
* inputs - pointer to struct ConfItem
|
* inputs - pointer to struct ConfItem
|
||||||
|
@ -1538,7 +1509,7 @@ yyerror(const char *msg)
|
||||||
{
|
{
|
||||||
char newlinebuf[BUFSIZE];
|
char newlinebuf[BUFSIZE];
|
||||||
|
|
||||||
strip_tabs(newlinebuf, (const unsigned char *) linebuf, strlen(linebuf));
|
strip_tabs(newlinebuf, linebuf, strlen(linebuf));
|
||||||
|
|
||||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, "\"%s\", line %d: %s at '%s'",
|
sendto_realops_snomask(SNO_GENERAL, L_ALL, "\"%s\", line %d: %s at '%s'",
|
||||||
conffilebuf, lineno + 1, msg, newlinebuf);
|
conffilebuf, lineno + 1, msg, newlinebuf);
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "stdinc.h"
|
#include "stdinc.h"
|
||||||
#include "s_user.h"
|
#include "s_user.h"
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
|
#include "substitution.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple mappings for $foo -> 'bar'.
|
* Simple mappings for $foo -> 'bar'.
|
||||||
|
|
Loading…
Reference in a new issue