X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/581fa5c4999f82a176e39e4edad2990759c94f56..fe2b1175ea2c9a51790005f0eea6432971cda40d:/modules/m_dline.c diff --git a/modules/m_dline.c b/modules/m_dline.c index 0f478a5..317bb24 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -25,7 +25,6 @@ */ #include "stdinc.h" -#include "tools.h" #include "channel.h" #include "class.h" #include "client.h" @@ -35,7 +34,6 @@ #include "ircd.h" #include "hostmask.h" #include "numeric.h" -#include "commio.h" #include "s_conf.h" #include "s_newconf.h" #include "s_log.h" @@ -45,6 +43,7 @@ #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 **); @@ -78,7 +77,6 @@ mo_dline(struct Client *client_p, struct Client *source_p, 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; @@ -151,36 +149,37 @@ mo_dline(struct Client *client_p, struct Client *source_p, } } - 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 : ""; - 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) + { + struct rb_sockaddr_storage daddr; + 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)) != NULL) + { + int bx; + parse_netmask(aconf->host, NULL, &bx); + if(b >= bx) + { + creason = aconf->passwd ? aconf->passwd : ""; + if(IsConfExemptKline(aconf)) + sendto_one_notice(source_p, + ":[%s] is (E)d-lined by [%s] - %s", + dlhost, aconf->host, creason); + else + sendto_one_notice(source_p, + ":[%s] already D-lined by [%s] - %s", + dlhost, aconf->host, creason); + return 0; + } + } } set_time(); @@ -188,7 +187,7 @@ mo_dline(struct Client *client_p, struct Client *source_p, 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) @@ -197,7 +196,7 @@ mo_dline(struct Client *client_p, struct Client *source_p, oper_reason++; if(!EmptyString(oper_reason)) - DupString(aconf->spasswd, oper_reason); + aconf->spasswd = rb_strdup(oper_reason); } if(tdline_time > 0) @@ -205,8 +204,8 @@ mo_dline(struct Client *client_p, struct Client *source_p, 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)) @@ -236,7 +235,7 @@ mo_dline(struct Client *client_p, struct Client *source_p, else { rb_snprintf(dlbuffer, sizeof(dlbuffer), "%s (%s)", reason, current_date); - DupString(aconf->passwd, dlbuffer); + 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); @@ -460,7 +459,7 @@ remove_temp_dline(struct ConfItem *aconf) { if (aconf == ptr->data) { - dlinkDestroy(ptr, &temp_dlines[i]); + rb_dlinkDestroy(ptr, &temp_dlines[i]); delete_one_address_conf(aconf->host, aconf); return YES; }