64 |
* side effects - complains to client, when warn != 0 |
* side effects - complains to client, when warn != 0 |
65 |
*/ |
*/ |
66 |
static int |
static int |
67 |
valid_xline(struct Client *source_p, const char *gecos, const char *reason) |
valid_xline(struct Client *source_p, const char *gecos) |
68 |
{ |
{ |
|
if (EmptyString(reason)) |
|
|
{ |
|
|
sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "XLINE"); |
|
|
return 0; |
|
|
} |
|
|
|
|
69 |
if (!valid_wild_card_simple(gecos)) |
if (!valid_wild_card_simple(gecos)) |
70 |
{ |
{ |
71 |
sendto_one_notice(source_p, &me, ":Please include at least %u non-wildcard characters with the xline", |
if (IsClient(source_p)) |
72 |
ConfigGeneral.min_nonwildcard_simple); |
sendto_one_notice(source_p, &me, ":Please include at least %u non-wildcard characters with the xline", |
73 |
|
ConfigGeneral.min_nonwildcard_simple); |
74 |
return 0; |
return 0; |
75 |
} |
} |
76 |
|
|
97 |
|
|
98 |
if (tkline_time) |
if (tkline_time) |
99 |
{ |
{ |
100 |
|
if (IsClient(source_p)) |
101 |
|
sendto_one_notice(source_p, &me, ":Added temporary %d min. X-Line [%s]", |
102 |
|
(int)tkline_time/60, conf->name); |
103 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
104 |
"%s added temporary %d min. X-Line for [%s] [%s]", |
"%s added temporary %d min. X-Line for [%s] [%s]", |
105 |
get_oper_name(source_p), (int)tkline_time/60, |
get_oper_name(source_p), (int)tkline_time/60, |
106 |
conf->name, conf->reason); |
conf->name, conf->reason); |
|
sendto_one_notice(source_p, &me, ":Added temporary %d min. X-Line [%s]", |
|
|
(int)tkline_time/60, conf->name); |
|
107 |
ilog(LOG_TYPE_XLINE, "%s added temporary %d min. X-Line for [%s] [%s]", |
ilog(LOG_TYPE_XLINE, "%s added temporary %d min. X-Line for [%s] [%s]", |
108 |
get_oper_name(source_p), (int)tkline_time/60, conf->name, conf->reason); |
get_oper_name(source_p), (int)tkline_time/60, conf->name, conf->reason); |
109 |
conf->until = CurrentTime + tkline_time; |
conf->until = CurrentTime + tkline_time; |
110 |
} |
} |
111 |
else |
else |
112 |
{ |
{ |
113 |
|
if (IsClient(source_p)) |
114 |
|
sendto_one_notice(source_p, &me, ":Added X-Line [%s] [%s]", |
115 |
|
conf->name, conf->reason); |
116 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
117 |
"%s added X-Line for [%s] [%s]", |
"%s added X-Line for [%s] [%s]", |
118 |
get_oper_name(source_p), conf->name, |
get_oper_name(source_p), conf->name, |
119 |
conf->reason); |
conf->reason); |
|
sendto_one_notice(source_p, &me, ":Added X-Line [%s] [%s]", |
|
|
conf->name, conf->reason); |
|
120 |
ilog(LOG_TYPE_XLINE, "%s added X-Line for [%s] [%s]", |
ilog(LOG_TYPE_XLINE, "%s added X-Line for [%s] [%s]", |
121 |
get_oper_name(source_p), conf->name, conf->reason); |
get_oper_name(source_p), conf->name, conf->reason); |
122 |
} |
} |
129 |
{ |
{ |
130 |
struct MaskItem *conf = NULL; |
struct MaskItem *conf = NULL; |
131 |
|
|
|
sendto_match_servs(source_p, parv[1], CAP_CLUSTER, |
|
|
"XLINE %s %s %s :%s", |
|
|
parv[1], parv[2], parv[3], parv[4]); |
|
|
|
|
|
if (match(parv[1], me.name)) |
|
|
return; |
|
|
|
|
132 |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name, |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name, |
133 |
source_p->username, source_p->host, |
source_p->username, source_p->host, |
134 |
SHARED_XLINE)) |
SHARED_XLINE)) |
135 |
{ |
{ |
136 |
if ((conf = find_matching_name_conf(CONF_XLINE, parv[2], NULL, NULL, 0))) |
if ((conf = find_matching_name_conf(CONF_XLINE, parv[2], NULL, NULL, 0))) |
137 |
{ |
{ |
138 |
sendto_one_notice(source_p, &me, ":[%s] already X-Lined by [%s] - %s", |
if (IsClient(source_p)) |
139 |
parv[2], conf->name, conf->reason); |
sendto_one_notice(source_p, &me, ":[%s] already X-Lined by [%s] - %s", |
140 |
|
parv[2], conf->name, conf->reason); |
141 |
return; |
return; |
142 |
} |
} |
143 |
|
|
204 |
"%s 0 :%s", gecos, reason); |
"%s 0 :%s", gecos, reason); |
205 |
} |
} |
206 |
|
|
207 |
if (!valid_xline(source_p, gecos, reason)) |
if (!valid_xline(source_p, gecos)) |
208 |
return 0; |
return 0; |
209 |
|
|
210 |
if ((conf = find_matching_name_conf(CONF_XLINE, gecos, NULL, NULL, 0))) |
if ((conf = find_matching_name_conf(CONF_XLINE, gecos, NULL, NULL, 0))) |
231 |
if (parc != 5 || EmptyString(parv[4])) |
if (parc != 5 || EmptyString(parv[4])) |
232 |
return 0; |
return 0; |
233 |
|
|
234 |
if (!IsClient(source_p)) |
sendto_match_servs(source_p, parv[1], CAP_CLUSTER, "XLINE %s %s %s :%s", |
235 |
|
parv[1], parv[2], parv[3], parv[4]); |
236 |
|
|
237 |
|
if (match(parv[1], me.name)) |
238 |
return 0; |
return 0; |
239 |
|
|
240 |
if (!valid_xline(source_p, parv[2], parv[4])) |
if (!valid_xline(source_p, parv[2])) |
241 |
return 0; |
return 0; |
242 |
|
|
243 |
relay_xline(source_p, parv); |
relay_xline(source_p, parv); |
262 |
static int |
static int |
263 |
me_xline(struct Client *source_p, int parc, char *parv[]) |
me_xline(struct Client *source_p, int parc, char *parv[]) |
264 |
{ |
{ |
265 |
if (!IsClient(source_p) || parc != 5) |
if (parc != 5 || EmptyString(parv[4])) |
266 |
|
return 0; |
267 |
|
|
268 |
|
if (!valid_xline(source_p, parv[2])) |
269 |
return 0; |
return 0; |
270 |
|
|
271 |
relay_xline(source_p, parv); |
relay_xline(source_p, parv); |