static int valid_comment(char *comment);
static int flush_write(struct Client *, FILE *, char *, char *);
static int remove_temp_dline(struct ConfItem *);
-static int apply_dline(struct Client *, const char *, int, char *);\r
+static int apply_dline(struct Client *, const char *, int, char *);
static int apply_undline(struct Client *, const char *);
/* mo_dline()
if(parc >= loc+2 && !irccmp(parv[loc], "ON"))
{
+ if(!IsOperRemoteBan(source_p))
+ {
+ sendto_one(source_p, form_str(ERR_NOPRIVS),
+ me.name, source_p->name, "remoteban");
+ return 0;
+ }
+
target_server = parv[loc+1];
loc += 2;
}
if(parc >= 4 && !irccmp(parv[2], "ON"))
{
+ if(!IsOperRemoteBan(source_p))
+ {
+ sendto_one(source_p, form_str(ERR_NOPRIVS),
+ me.name, source_p->name, "remoteban");
+ return 0;
+ }
+
target_server = parv[3];
sendto_match_servs(source_p, target_server,
CAP_ENCAP, NOCAPS,
return 0;
}
-static int\r
-me_dline(struct Client *client_p, struct Client *source_p, int parc, const char **parv)\r
-{\r
- int tdline_time = atoi(parv[1]);\r
- /* Since this is coming over a server link, assume that the originating\r
- * server did the relevant permission/sanity checks...\r
- */\r
-\r
- if(!IsPerson(source_p))\r
- return 0;\r
-\r
- if(!find_shared_conf(source_p->username, source_p->host,\r
- source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE))\r
- {\r
- sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, "undline failed %s %s %s",\r
- source_p->name, parv[1], parv[2]);\r
- return 0;\r
- }\r
-\r
- apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3]));\r
-\r
- check_dlines();\r
- return 0;\r
-}\r
-\r
-static int\r
-me_undline(struct Client *client_p, struct Client *source_p, int parc, const char **parv)\r
-{\r
- if(!IsPerson(source_p))\r
- return 0;\r
-\r
- if(!find_shared_conf(source_p->username, source_p->host,\r
- source_p->servptr->name, SHARED_UNDLINE))\r
- return 0;\r
-\r
- apply_undline(source_p, parv[1]);\r
-\r
- return 0;\r
+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
return 0;
}
- /* 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(ConfigFileEntry.non_redundant_klines)
{
if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL)
aconf->status = CONF_DLINE;
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)
{
rb_snprintf(dlbuffer, sizeof(dlbuffer),
if(EmptyString(oper_reason))
{
- sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
+ sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added temporary %d min. D-Line for [%s] [%s]",
get_oper_name(source_p), tdline_time / 60,
aconf->host, reason);
}
else
{
- sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
+ sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added temporary %d min. D-Line for [%s] [%s|%s]",
get_oper_name(source_p), tdline_time / 60,
aconf->host, reason, oper_reason);
{
rb_snprintf(dlbuffer, sizeof(dlbuffer), "%s (%s)", reason, current_date);
aconf->passwd = rb_strdup(dlbuffer);
- add_conf_by_address(aconf->host, CONF_DLINE, NULL, aconf);
+ add_conf_by_address(aconf->host, CONF_DLINE, NULL, NULL, aconf);
write_confitem(DLINE_TYPE, source_p, NULL, aconf->host, reason,
oper_reason, current_date, 0);
}
continue;
}
- if(irccmp(found_cidr, cidr) == 0)
+ if(irccmp(found_cidr, aconf->host) == 0)
{
pairme++;
}
}
else if(!pairme)
{
- sendto_one(source_p, ":%s NOTICE %s :No D-Line for %s",
- me.name, source_p->name, cidr);
+ sendto_one_notice(source_p, ":Cannot find D-Line for %s in file",
+ aconf->host);
if(temppath != NULL)
(void) unlink(temppath);
sendto_one_notice(source_p, ":Couldn't rename temp file, aborted");
return 0;
}
- rehash_bans(0);
-
- sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, cidr);
- sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
- "%s has removed the D-Line for: [%s]", get_oper_name(source_p), cidr);
- ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), cidr);
+ 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,
+ "%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);
+ delete_one_address_conf(aconf->host, aconf);
return 0;
}