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 **);
@ -151,6 +152,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
if(ConfigFileEntry.non_redundant_klines) if(ConfigFileEntry.non_redundant_klines)
{ {
struct rb_sockaddr_storage daddr;
const char *creason; const char *creason;
int t = AF_INET, ty, b; int t = AF_INET, ty, b;
ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b); ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b);
@ -161,7 +163,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
#endif #endif
t = AF_INET; t = AF_INET;
if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL) if((aconf = find_dline((struct sockaddr *)&daddr)) != NULL)
{ {
int bx; int bx;
parse_netmask(aconf->host, NULL, &bx); parse_netmask(aconf->host, NULL, &bx);
@ -169,13 +171,13 @@ mo_dline(struct Client *client_p, struct Client *source_p,
{ {
creason = aconf->passwd ? aconf->passwd : "<No Reason>"; creason = aconf->passwd ? aconf->passwd : "<No Reason>";
if(IsConfExemptKline(aconf)) if(IsConfExemptKline(aconf))
sendto_one(source_p, sendto_one_notice(source_p,
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s", ":[%s] is (E)d-lined by [%s] - %s",
me.name, parv[0], dlhost, aconf->host, creason); dlhost, aconf->host, creason);
else else
sendto_one(source_p, sendto_one_notice(source_p,
":%s NOTICE %s :[%s] already D-lined by [%s] - %s", ":[%s] already D-lined by [%s] - %s",
me.name, parv[0], dlhost, aconf->host, creason); dlhost, aconf->host, creason);
return 0; return 0;
} }
} }

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: