50 |
|
#define GLINE_PLACED 1 |
51 |
|
|
52 |
|
|
53 |
+ |
static void |
54 |
+ |
check_gline(struct AddressRec *arec) |
55 |
+ |
{ |
56 |
+ |
dlink_node *ptr = NULL, *ptr_next = NULL; |
57 |
+ |
|
58 |
+ |
DLINK_FOREACH_SAFE(ptr, ptr_next, local_client_list.head) |
59 |
+ |
{ |
60 |
+ |
struct Client *client_p = ptr->data; |
61 |
+ |
|
62 |
+ |
if (IsDead(client_p) || !IsClient(client_p)) |
63 |
+ |
continue; |
64 |
+ |
|
65 |
+ |
if (match(arec->username, client_p->username)) |
66 |
+ |
continue; |
67 |
+ |
|
68 |
+ |
switch (arec->masktype) |
69 |
+ |
{ |
70 |
+ |
case HM_IPV4: |
71 |
+ |
if (client_p->localClient->aftype == AF_INET) |
72 |
+ |
if (match_ipv4(&client_p->localClient->ip, &arec->Mask.ipa.addr, arec->Mask.ipa.bits)) |
73 |
+ |
ban_them(client_p, arec->conf); |
74 |
+ |
break; |
75 |
+ |
case HM_IPV6: |
76 |
+ |
if (client_p->localClient->aftype == AF_INET6) |
77 |
+ |
if (match_ipv6(&client_p->localClient->ip, &arec->Mask.ipa.addr, arec->Mask.ipa.bits)) |
78 |
+ |
ban_them(client_p, arec->conf); |
79 |
+ |
break; |
80 |
+ |
default: /* HM_HOST */ |
81 |
+ |
if (!match(arec->Mask.hostname, client_p->host)) |
82 |
+ |
ban_them(client_p, arec->conf); |
83 |
+ |
break; |
84 |
+ |
} |
85 |
+ |
} |
86 |
+ |
} |
87 |
+ |
|
88 |
|
/*! \brief Adds a GLINE to the configuration subsystem. |
89 |
|
* |
90 |
|
* \param source_p Operator requesting gline |
115 |
|
ilog(LOG_TYPE_GLINE, "%s added G-Line for [%s@%s] [%s]", |
116 |
|
get_oper_name(source_p), conf->user, conf->host, conf->reason); |
117 |
|
|
118 |
< |
add_conf_by_address(CONF_GLINE, conf); |
84 |
< |
rehashed_klines = 1; |
118 |
> |
check_gline(add_conf_by_address(CONF_GLINE, conf)); |
119 |
|
} |
120 |
|
|
121 |
|
/*! \brief Removes a GLINE from the configuration subsystem. |