*/
#include "stdinc.h"
-#include "tools.h"
#include "channel.h"
#include "class.h"
#include "client.h"
#include "ircd.h"
#include "hostmask.h"
#include "numeric.h"
-#include "commio.h"
#include "s_conf.h"
#include "s_newconf.h"
#include "s_log.h"
#include "msg.h"
#include "parse.h"
#include "modules.h"
+#include "reject.h"
static int mo_dline(struct Client *, struct Client *, int, const char **);
static int mo_undline(struct Client *, struct Client *, int, const char **);
const char *dlhost;
char *oper_reason;
char *reason = def;
- struct irc_sockaddr_storage daddr;
char cidr_form_host[HOSTLEN + 1];
struct ConfItem *aconf;
int bits;
}
}
- if(ConfigFileEntry.non_redundant_klines)
- {
- const char *creason;
- int t = AF_INET, ty, b;
- ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b);
-#ifdef IPV6
- if(ty == HM_IPV6)
- t = AF_INET6;
- else
-#endif
- t = AF_INET;
-
- if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL)
- {
- int bx;
- parse_netmask(aconf->host, NULL, &bx);
- if(b >= bx)
- {
- creason = aconf->passwd ? aconf->passwd : "<No Reason>";
- if(IsConfExemptKline(aconf))
- sendto_one(source_p,
- ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
- me.name, parv[0], dlhost, aconf->host, creason);
- else
- sendto_one(source_p,
- ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
- me.name, parv[0], dlhost, aconf->host, creason);
- return 0;
- }
- }
+ if(ConfigFileEntry.non_redundant_klines)\r
+ {\r
+ struct rb_sockaddr_storage daddr;\r
+ const char *creason;\r
+ int t = AF_INET, ty, b;\r
+ ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b);\r
+#ifdef IPV6\r
+ if(ty == HM_IPV6)\r
+ t = AF_INET6;\r
+ else\r
+#endif\r
+ t = AF_INET;\r
+ \r
+ if((aconf = find_dline((struct sockaddr *)&daddr)) != NULL)\r
+ {\r
+ int bx;\r
+ parse_netmask(aconf->host, NULL, &bx);\r
+ if(b >= bx)\r
+ {\r
+ creason = aconf->passwd ? aconf->passwd : "<No Reason>";\r
+ if(IsConfExemptKline(aconf))\r
+ sendto_one_notice(source_p, \r
+ ":[%s] is (E)d-lined by [%s] - %s",\r
+ dlhost, aconf->host, creason);\r
+ else\r
+ sendto_one_notice(source_p, \r
+ ":[%s] already D-lined by [%s] - %s",\r
+ dlhost, aconf->host, creason);\r
+ return 0;\r
+ }\r
+ }\r
}
set_time();
aconf = make_conf();
aconf->status = CONF_DLINE;
- DupString(aconf->host, dlhost);
+ aconf->host = rb_strdup(dlhost);
/* Look for an oper reason */
if((oper_reason = strchr(reason, '|')) != NULL)
oper_reason++;
if(!EmptyString(oper_reason))
- DupString(aconf->spasswd, oper_reason);
+ aconf->spasswd = rb_strdup(oper_reason);
}
if(tdline_time > 0)
{
- ircsnprintf(dlbuffer, sizeof(dlbuffer),
+ rb_snprintf(dlbuffer, sizeof(dlbuffer),
"Temporary D-line %d min. - %s (%s)",
(int) (tdline_time / 60), reason, current_date);
- DupString(aconf->passwd, dlbuffer);
- aconf->hold = CurrentTime + tdline_time;
+ aconf->passwd = rb_strdup(dlbuffer);
+ aconf->hold = rb_current_time() + tdline_time;
add_temp_dline(aconf);
if(EmptyString(oper_reason))
}
else
{
- ircsnprintf(dlbuffer, sizeof(dlbuffer), "%s (%s)", reason, current_date);
- DupString(aconf->passwd, dlbuffer);
+ 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);
write_confitem(DLINE_TYPE, source_p, NULL, aconf->host, reason,
oper_reason, current_date, 0);
int pairme = NO, error_on_write = NO;
mode_t oldumask;
- ircsnprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile);
+ rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile);
if(!IsOperUnkline(source_p))
{
static int
remove_temp_dline(struct ConfItem *aconf)
{
- dlink_node *ptr;
+ rb_dlink_node *ptr;
int i;
for (i = 0; i < LAST_TEMP_TYPE; i++)
{
- DLINK_FOREACH(ptr, temp_dlines[i].head)
+ RB_DLINK_FOREACH(ptr, temp_dlines[i].head)
{
if (aconf == ptr->data)
{
- dlinkDestroy(ptr, &temp_dlines[i]);
+ rb_dlinkDestroy(ptr, &temp_dlines[i]);
delete_one_address_conf(aconf->host, aconf);
return YES;
}