From 6f24a013bfa201c45cffaa95606fd76325bcb2f4 Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Wed, 2 Apr 2008 15:20:15 +0400 Subject: [PATCH] fixing dline --- modules/m_dline.c | 62 +++++++++++++++++++++++--------------------- modules/m_testline.c | 1 + src/s_conf.c | 12 ++++----- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/modules/m_dline.c b/modules/m_dline.c index 32cc408c..cdb1fe67 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -43,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 **); @@ -149,36 +150,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(); diff --git a/modules/m_testline.c b/modules/m_testline.c index a261d415..cfcf3ccd 100644 --- a/modules/m_testline.c +++ b/modules/m_testline.c @@ -40,6 +40,7 @@ #include "s_conf.h" #include "s_newconf.h" #include "sprintf_irc.h" +#include "reject.h" static int mo_testline(struct Client *, struct Client *, int, const char **); static int mo_testgecos(struct Client *, struct Client *, int, const char **); diff --git a/src/s_conf.c b/src/s_conf.c index f45601fc..76f1f794 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -195,7 +195,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost); - ServerStats->is_ref++; + ServerStats.is_ref++; exit_client(client_p, source_p, &me, "Too many host connections (local)"); break; @@ -209,7 +209,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost); - ServerStats->is_ref++; + ServerStats.is_ref++; exit_client(client_p, source_p, &me, "Too many host connections (global)"); break; @@ -223,7 +223,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost); - ServerStats->is_ref++; + ServerStats.is_ref++; exit_client(client_p, source_p, &me, "Too many user connections (global)"); break; @@ -238,7 +238,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost); - ServerStats->is_ref++; + ServerStats.is_ref++; exit_client(client_p, source_p, &me, "No more connections allowed in your connection class"); break; @@ -253,7 +253,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern #endif port = ntohs(((struct sockaddr_in *)&source_p->localClient->listener->addr)->sin_port); - ServerStats->is_ref++; + ServerStats.is_ref++; /* jdc - lists server name & port connections are on */ /* a purely cosmetical change */ /* why ipaddr, and not just source_p->sockhost? --fl */ @@ -281,7 +281,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern } case BANNED_CLIENT: exit_client(client_p, client_p, &me, "*** Banned "); - ServerStats->is_ref++; + ServerStats.is_ref++; break; case 0: