0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

remove_temp_glines() without legacy api

This commit is contained in:
Valery Yatsko 2008-04-02 15:23:07 +04:00
parent d20d004550
commit 9168d56f1f

View file

@ -684,47 +684,46 @@ majority_gline(struct Client *source_p, const char *user,
return NO;
}
/* remove_temp_gline()
*
* inputs - username, hostname to ungline
* outputs -
* side effects - tries to ungline anything that matches
*/
static int
remove_temp_gline(const char *user, const char *host)
{
struct ConfItem *aconf;
rb_dlink_node *ptr;
struct rb_sockaddr_storage addr, caddr;
int bits, cbits;
int mtype, gtype;
mtype = parse_netmask(host, (struct sockaddr *)&addr, &bits);
RB_DLINK_FOREACH(ptr, glines.head)
{
aconf = ptr->data;
gtype = parse_netmask(aconf->host, (struct sockaddr *)&caddr, &cbits);
if(gtype != mtype || (user && irccmp(user, aconf->user)))
continue;
if(gtype == HM_HOST)
{
if(irccmp(aconf->host, host))
continue;
}
else if(bits != cbits ||
!comp_with_mask_sock((struct sockaddr *)&addr,
(struct sockaddr *)&caddr, bits))
continue;
rb_dlinkDestroy(ptr, &glines);
remove_reject_mask(aconf->user, aconf->host);
delete_one_address_conf(aconf->host, aconf);
return YES;
}
return NO;
/* remove_temp_gline()
*
* inputs - username, hostname to ungline
* outputs -
* side effects - tries to ungline anything that matches
*/
static int
remove_temp_gline(const char *user, const char *host)
{
struct ConfItem *aconf;
rb_dlink_node *ptr;
struct rb_sockaddr_storage addr, caddr;
int bits, cbits;
int mtype, gtype;
mtype = parse_netmask(host, (struct sockaddr *)&addr, &bits);
RB_DLINK_FOREACH(ptr, glines.head)
{
aconf = ptr->data;
gtype = parse_netmask(aconf->host, (struct sockaddr *)&caddr, &cbits);
if(gtype != mtype || (user && irccmp(user, aconf->user)))
continue;
if(gtype == HM_HOST)
{
if(irccmp(aconf->host, host))
continue;
}
else if(bits != cbits ||
!comp_with_mask_sock((struct sockaddr *)&addr,
(struct sockaddr *)&caddr, bits))
continue;
rb_dlinkDestroy(ptr, &glines);
delete_one_address_conf(aconf->host, aconf);
return YES;
}
return NO;
}