#include "channel.h"
#include "class.h"
#include "client.h"
-#include "common.h"
#include "match.h"
#include "ircd.h"
#include "hostmask.h"
static const char dline_desc[] = "Provides the DLINE facility to ban users via IP address";
-static int mo_dline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
-static int me_dline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
-static int mo_undline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
-static int me_undline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void mo_dline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void me_dline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void mo_undline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void me_undline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message dline_msgtab = {
"DLINE", 0, 0, 0, 0,
mapi_clist_av1 dline_clist[] = { &dline_msgtab, &undline_msgtab, NULL };
-static const char dline_desc[] = "Provides the DLINE facility to ban users via IP address";
-
DECLARE_MODULE_AV2(dline, NULL, NULL, dline_clist, NULL, NULL, NULL, NULL, dline_desc);
-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 *);
+static bool remove_temp_dline(struct ConfItem *);
+static void apply_dline(struct Client *, const char *, int, char *);
+static void apply_undline(struct Client *, const char *);
/* mo_dline()
*
* parv[1] - dline to add
* parv[2] - reason
*/
-static int
+static void
mo_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char def[] = "No Reason";
if(!IsOperK(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "kline");
- return 0;
+ return;
}
if((tdline_time = valid_temp_time(parv[loc])) >= 0)
if (*dlhost == ':')
{
sendto_one_notice(source_p, ":Invalid D-Line");
- return 0;
+ return;
}
if(parc >= loc + 2 && !irccmp(parv[loc], "ON"))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban");
- return 0;
+ return;
}
target_server = parv[loc + 1];
target_server, tdline_time, dlhost, reason);
if(!match(target_server, me.name))
- return 0;
+ return;
}
apply_dline(source_p, dlhost, tdline_time, reason);
check_dlines();
- return 0;
}
/* mo_undline()
*
* parv[1] = dline to remove
*/
-static int
+static void
mo_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
const char *cidr;
if(!IsOperK(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "unkline");
- return 0;
+ return;
}
cidr = parv[1];
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban");
- return 0;
+ return;
}
target_server = parv[3];
CAP_ENCAP, NOCAPS, "ENCAP %s UNDLINE %s", target_server, cidr);
if(!match(target_server, me.name))
- return 0;
+ return;
}
apply_undline(source_p, cidr);
-
- return 0;
}
-static int
+static void
me_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
int tdline_time = atoi(parv[1]);
*/
if(!IsPerson(source_p))
- return 0;
+ return;
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name,
tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE))
- return 0;
+ return;
apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3]));
check_dlines();
- return 0;
}
-static int
+static void
me_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!IsPerson(source_p))
- return 0;
+ return;
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_UNDLINE))
- return 0;
+ return;
apply_undline(source_p, parv[1]);
-
- return 0;
}
-static int
+static void
apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *reason)
{
struct ConfItem *aconf;
if(ty == HM_HOST)
{
sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", me.name, source_p->name);
- return 0;
+ return;
}
-#ifdef RB_IPV6
if(ty == HM_IPV6)
t = AF_INET6;
else
-#endif
t = AF_INET;
/* This means dlines wider than /16 cannot be set remotely */
{
sendto_one_notice(source_p,
":For safety, bitmasks less than 8 require conf access.");
- return 0;
+ return;
}
}
else
{
sendto_one_notice(source_p,
":Dline bitmasks less than 16 are for admins only.");
- return 0;
+ return;
}
}
":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
me.name, source_p->name, dlhost, aconf->host,
creason);
- return 0;
+ return;
}
}
}
aconf->host, reason, oper_reason);
}
}
-
- return 0;
}
-static int
+static void
apply_undline(struct Client *source_p, const char *cidr)
{
char buf[BUFSIZE];
if(parse_netmask(cidr, NULL, NULL) == HM_HOST)
{
sendto_one_notice(source_p, ":Invalid D-Line");
- return 0;
+ return;
}
aconf = find_exact_conf_by_address(cidr, CONF_DLINE, NULL);
if(aconf == NULL)
{
sendto_one_notice(source_p, ":No D-Line for %s", cidr);
- return 0;
+ return;
}
rb_strlcpy(buf, aconf->host, sizeof buf);
"%s has removed the temporary D-Line for: [%s]",
get_oper_name(source_p), buf);
ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), buf);
- return 0;
+ return;
}
bandb_del(BANDB_DLINE, aconf->host, NULL);
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);
-
- return 0;
}
/* remove_temp_dline()
*
* inputs - confitem to undline
- * outputs -
+ * outputs - true if removed, false otherwise.
* side effects - tries to undline anything that matches
*/
-static int
+static bool
remove_temp_dline(struct ConfItem *aconf)
{
rb_dlink_node *ptr;
{
rb_dlinkDestroy(ptr, &temp_dlines[i]);
delete_one_address_conf(aconf->host, aconf);
- return YES;
+ return true;
}
}
}
- return NO;
+ return false;
}