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 "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 : "<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)
{
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 : "<No Reason>";
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();

View file

@ -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 **);

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->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: