fixing dline

This commit is contained in:
Valery Yatsko 2008-04-02 15:20:15 +04:00
parent 39bdbd3f7d
commit 6f24a013bf
3 changed files with 39 additions and 36 deletions

View file

@ -43,6 +43,7 @@
#include "msg.h" #include "msg.h"
#include "parse.h" #include "parse.h"
#include "modules.h" #include "modules.h"
#include "reject.h"
static int mo_dline(struct Client *, struct Client *, int, const char **); static int mo_dline(struct Client *, struct Client *, int, const char **);
static int mo_undline(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) if(ConfigFileEntry.non_redundant_klines)
{ {
const char *creason; struct rb_sockaddr_storage daddr;
int t = AF_INET, ty, b; const char *creason;
ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b); int t = AF_INET, ty, b;
#ifdef IPV6 ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b);
if(ty == HM_IPV6) #ifdef IPV6
t = AF_INET6; if(ty == HM_IPV6)
else t = AF_INET6;
#endif else
t = AF_INET; #endif
t = AF_INET;
if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL)
{ if((aconf = find_dline((struct sockaddr *)&daddr)) != NULL)
int bx; {
parse_netmask(aconf->host, NULL, &bx); int bx;
if(b >= bx) parse_netmask(aconf->host, NULL, &bx);
{ if(b >= bx)
creason = aconf->passwd ? aconf->passwd : "<No Reason>"; {
if(IsConfExemptKline(aconf)) creason = aconf->passwd ? aconf->passwd : "<No Reason>";
sendto_one(source_p, if(IsConfExemptKline(aconf))
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s", sendto_one_notice(source_p,
me.name, parv[0], dlhost, aconf->host, creason); ":[%s] is (E)d-lined by [%s] - %s",
else dlhost, aconf->host, creason);
sendto_one(source_p, else
":%s NOTICE %s :[%s] already D-lined by [%s] - %s", sendto_one_notice(source_p,
me.name, parv[0], dlhost, aconf->host, creason); ":[%s] already D-lined by [%s] - %s",
return 0; dlhost, aconf->host, creason);
} return 0;
} }
}
} }
set_time(); set_time();

View file

@ -40,6 +40,7 @@
#include "s_conf.h" #include "s_conf.h"
#include "s_newconf.h" #include "s_newconf.h"
#include "sprintf_irc.h" #include "sprintf_irc.h"
#include "reject.h"
static int mo_testline(struct Client *, struct Client *, int, const char **); static int mo_testline(struct Client *, struct Client *, int, const char **);
static int mo_testgecos(struct Client *, struct Client *, int, const char **); static int mo_testgecos(struct Client *, struct Client *, int, const char **);

View file

@ -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->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->sockhost); source_p->username, source_p->sockhost);
ServerStats->is_ref++; ServerStats.is_ref++;
exit_client(client_p, source_p, &me, "Too many host connections (local)"); exit_client(client_p, source_p, &me, "Too many host connections (local)");
break; 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->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->sockhost); source_p->username, source_p->sockhost);
ServerStats->is_ref++; ServerStats.is_ref++;
exit_client(client_p, source_p, &me, "Too many host connections (global)"); exit_client(client_p, source_p, &me, "Too many host connections (global)");
break; 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->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->sockhost); source_p->username, source_p->sockhost);
ServerStats->is_ref++; ServerStats.is_ref++;
exit_client(client_p, source_p, &me, "Too many user connections (global)"); exit_client(client_p, source_p, &me, "Too many user connections (global)");
break; 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->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->sockhost); source_p->username, source_p->sockhost);
ServerStats->is_ref++; ServerStats.is_ref++;
exit_client(client_p, source_p, &me, exit_client(client_p, source_p, &me,
"No more connections allowed in your connection class"); "No more connections allowed in your connection class");
break; break;
@ -253,7 +253,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
#endif #endif
port = ntohs(((struct sockaddr_in *)&source_p->localClient->listener->addr)->sin_port); 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 */ /* jdc - lists server name & port connections are on */
/* a purely cosmetical change */ /* a purely cosmetical change */
/* why ipaddr, and not just source_p->sockhost? --fl */ /* 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: case BANNED_CLIENT:
exit_client(client_p, client_p, &me, "*** Banned "); exit_client(client_p, client_p, &me, "*** Banned ");
ServerStats->is_ref++; ServerStats.is_ref++;
break; break;
case 0: case 0: