]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* modules/m_xline.c |
2 | * | |
3 | * Copyright (C) 2002-2003 Lee Hardy <lee@leeh.co.uk> | |
4 | * Copyright (C) 2002-2005 ircd-ratbox development team | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are | |
8 | * met: | |
9 | * | |
10 | * 1.Redistributions of source code must retain the above copyright notice, | |
11 | * this list of conditions and the following disclaimer. | |
12 | * 2.Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * 3.The name of the author may not be used to endorse or promote products | |
16 | * derived from this software without specific prior written permission. | |
17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
22 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
26 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
27 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
28 | * POSSIBILITY OF SUCH DAMAGE. | |
29 | * | |
8bbeb278 | 30 | * $Id$ |
212380e3 AC |
31 | */ |
32 | ||
33 | #include "stdinc.h" | |
212380e3 AC |
34 | #include "send.h" |
35 | #include "channel.h" | |
36 | #include "client.h" | |
37 | #include "common.h" | |
38 | #include "config.h" | |
39 | #include "class.h" | |
40 | #include "ircd.h" | |
41 | #include "numeric.h" | |
4016731b | 42 | #include "logger.h" |
212380e3 AC |
43 | #include "s_serv.h" |
44 | #include "whowas.h" | |
4562c604 | 45 | #include "match.h" |
212380e3 AC |
46 | #include "hash.h" |
47 | #include "msg.h" | |
48 | #include "parse.h" | |
49 | #include "modules.h" | |
50 | #include "s_conf.h" | |
51 | #include "s_newconf.h" | |
35f6f850 | 52 | #include "reject.h" |
8bbeb278 | 53 | #include "bandbi.h" |
27f616dd | 54 | #include "operhash.h" |
212380e3 AC |
55 | |
56 | static int mo_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); | |
57 | static int ms_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); | |
58 | static int me_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); | |
8bbeb278 AC |
59 | static int mo_unxline(struct Client *client_p, struct Client *source_p, int parc, |
60 | const char *parv[]); | |
61 | static int ms_unxline(struct Client *client_p, struct Client *source_p, int parc, | |
62 | const char *parv[]); | |
63 | static int me_unxline(struct Client *client_p, struct Client *source_p, int parc, | |
64 | const char *parv[]); | |
212380e3 AC |
65 | |
66 | struct Message xline_msgtab = { | |
67 | "XLINE", 0, 0, 0, MFLG_SLOW, | |
68 | {mg_unreg, mg_not_oper, {ms_xline, 5}, {ms_xline, 5}, {me_xline, 5}, {mo_xline, 3}} | |
69 | }; | |
8bbeb278 | 70 | |
212380e3 AC |
71 | struct Message unxline_msgtab = { |
72 | "UNXLINE", 0, 0, 0, MFLG_SLOW, | |
73 | {mg_unreg, mg_not_oper, {ms_unxline, 3}, {ms_unxline, 3}, {me_unxline, 2}, {mo_unxline, 2}} | |
74 | }; | |
75 | ||
8bbeb278 AC |
76 | mapi_clist_av1 xline_clist[] = { &xline_msgtab, &unxline_msgtab, NULL }; |
77 | ||
78 | DECLARE_MODULE_AV1(xline, NULL, NULL, xline_clist, NULL, NULL, "$Revision$"); | |
212380e3 | 79 | |
8bbeb278 AC |
80 | static int valid_xline(struct Client *, const char *, const char *); |
81 | static void apply_xline(struct Client *client_p, const char *name, | |
3cbbfb25 | 82 | const char *reason, int temp_time, int propagated); |
212380e3 | 83 | static void propagate_xline(struct Client *source_p, const char *target, |
8bbeb278 | 84 | int temp_time, const char *name, const char *type, const char *reason); |
212380e3 | 85 | static void cluster_xline(struct Client *source_p, int temp_time, |
8bbeb278 | 86 | const char *name, const char *reason); |
212380e3 AC |
87 | |
88 | static void handle_remote_xline(struct Client *source_p, int temp_time, | |
89 | const char *name, const char *reason); | |
90 | static void handle_remote_unxline(struct Client *source_p, const char *name); | |
91 | ||
3cbbfb25 JT |
92 | static void remove_xline(struct Client *source_p, const char *name, |
93 | int propagated); | |
212380e3 AC |
94 | |
95 | ||
96 | /* m_xline() | |
97 | * | |
98 | * parv[1] - thing to xline | |
99 | * parv[2] - optional type/reason | |
100 | * parv[3] - reason | |
101 | */ | |
102 | static int | |
103 | mo_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
104 | { | |
105 | struct ConfItem *aconf; | |
106 | const char *name; | |
107 | const char *reason; | |
108 | const char *target_server = NULL; | |
109 | int temp_time; | |
110 | int loc = 1; | |
3cbbfb25 | 111 | int propagated = ConfigFileEntry.use_propagated_bans; |
212380e3 AC |
112 | |
113 | if(!IsOperXline(source_p)) | |
114 | { | |
8bbeb278 | 115 | sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "xline"); |
212380e3 AC |
116 | return 0; |
117 | } | |
118 | ||
119 | if((temp_time = valid_temp_time(parv[loc])) >= 0) | |
120 | loc++; | |
121 | /* we just set temp_time to -1! */ | |
122 | else | |
123 | temp_time = 0; | |
124 | ||
125 | name = parv[loc]; | |
126 | loc++; | |
127 | ||
128 | /* XLINE <gecos> ON <server> :<reason> */ | |
8bbeb278 | 129 | if(parc >= loc + 2 && !irccmp(parv[loc], "ON")) |
212380e3 AC |
130 | { |
131 | if(!IsOperRemoteBan(source_p)) | |
132 | { | |
133 | sendto_one(source_p, form_str(ERR_NOPRIVS), | |
8bbeb278 | 134 | me.name, source_p->name, "remoteban"); |
212380e3 AC |
135 | return 0; |
136 | } | |
137 | ||
8bbeb278 | 138 | target_server = parv[loc + 1]; |
212380e3 AC |
139 | loc += 2; |
140 | } | |
141 | ||
142 | if(parc <= loc || EmptyString(parv[loc])) | |
143 | { | |
144 | sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), | |
8bbeb278 | 145 | me.name, source_p->name, "XLINE"); |
212380e3 AC |
146 | return 0; |
147 | } | |
148 | ||
149 | reason = parv[loc]; | |
150 | ||
151 | if(target_server != NULL) | |
152 | { | |
8bbeb278 | 153 | propagate_xline(source_p, target_server, temp_time, name, "2", reason); |
212380e3 AC |
154 | |
155 | if(!match(target_server, me.name)) | |
156 | return 0; | |
3cbbfb25 JT |
157 | |
158 | /* Set as local-only. */ | |
159 | propagated = 0; | |
212380e3 | 160 | } |
3cbbfb25 | 161 | else if(!propagated && rb_dlink_list_length(&cluster_conf_list) > 0) |
8bbeb278 | 162 | cluster_xline(source_p, temp_time, name, reason); |
212380e3 | 163 | |
8bbeb278 | 164 | if((aconf = find_xline_mask(name)) != NULL) |
212380e3 AC |
165 | { |
166 | sendto_one(source_p, ":%s NOTICE %s :[%s] already X-Lined by [%s] - %s", | |
23959371 | 167 | me.name, source_p->name, name, aconf->host, aconf->passwd); |
212380e3 AC |
168 | return 0; |
169 | } | |
170 | ||
8bbeb278 | 171 | if(!valid_xline(source_p, name, reason)) |
212380e3 AC |
172 | return 0; |
173 | ||
3cbbfb25 JT |
174 | if(propagated && temp_time == 0) |
175 | { | |
176 | sendto_one_notice(source_p, ":Cannot set a permanent global ban"); | |
177 | return 0; | |
178 | } | |
179 | ||
180 | apply_xline(source_p, name, reason, temp_time, propagated); | |
212380e3 AC |
181 | |
182 | return 0; | |
183 | } | |
184 | ||
185 | /* ms_xline() | |
186 | * | |
187 | * handles a remote xline | |
188 | */ | |
189 | static int | |
190 | ms_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
191 | { | |
8bbeb278 AC |
192 | /* parv[0] parv[1] parv[2] parv[3] parv[4] |
193 | * oper target serv xline type reason | |
212380e3 AC |
194 | */ |
195 | propagate_xline(source_p, parv[1], 0, parv[2], parv[3], parv[4]); | |
196 | ||
197 | if(!IsPerson(source_p)) | |
198 | return 0; | |
199 | ||
200 | /* destined for me? */ | |
201 | if(!match(parv[1], me.name)) | |
202 | return 0; | |
203 | ||
204 | handle_remote_xline(source_p, 0, parv[2], parv[4]); | |
205 | return 0; | |
206 | } | |
207 | ||
208 | static int | |
209 | me_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
210 | { | |
211 | /* time name type :reason */ | |
212 | if(!IsPerson(source_p)) | |
213 | return 0; | |
214 | ||
215 | handle_remote_xline(source_p, atoi(parv[1]), parv[2], parv[4]); | |
216 | return 0; | |
217 | } | |
218 | ||
219 | static void | |
8bbeb278 | 220 | handle_remote_xline(struct Client *source_p, int temp_time, const char *name, const char *reason) |
212380e3 AC |
221 | { |
222 | struct ConfItem *aconf; | |
223 | ||
224 | if(!find_shared_conf(source_p->username, source_p->host, | |
8bbeb278 AC |
225 | source_p->servptr->name, |
226 | (temp_time > 0) ? SHARED_TXLINE : SHARED_PXLINE)) | |
212380e3 AC |
227 | return; |
228 | ||
8bbeb278 | 229 | if(!valid_xline(source_p, name, reason)) |
212380e3 AC |
230 | return; |
231 | ||
232 | /* already xlined */ | |
0fdb2570 | 233 | if((aconf = find_xline_mask(name)) != NULL) |
212380e3 | 234 | { |
23959371 | 235 | sendto_one_notice(source_p, ":[%s] already X-Lined by [%s] - %s", name, aconf->host, |
8bbeb278 | 236 | aconf->passwd); |
212380e3 AC |
237 | return; |
238 | } | |
239 | ||
3cbbfb25 | 240 | apply_xline(source_p, name, reason, temp_time, 0); |
212380e3 AC |
241 | } |
242 | ||
243 | /* valid_xline() | |
244 | * | |
8bbeb278 | 245 | * inputs - client xlining, gecos, reason and whether to warn |
212380e3 AC |
246 | * outputs - |
247 | * side effects - checks the xline for validity, erroring if needed | |
248 | */ | |
249 | static int | |
8bbeb278 | 250 | valid_xline(struct Client *source_p, const char *gecos, const char *reason) |
212380e3 AC |
251 | { |
252 | if(EmptyString(reason)) | |
253 | { | |
254 | sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), | |
8bbeb278 | 255 | get_id(&me, source_p), get_id(source_p, source_p), "XLINE"); |
cc169c94 JT |
256 | return 0; |
257 | } | |
258 | ||
212380e3 AC |
259 | if(strchr(reason, ':') != NULL) |
260 | { | |
8bbeb278 | 261 | sendto_one_notice(source_p, ":Invalid character ':' in comment"); |
212380e3 AC |
262 | return 0; |
263 | } | |
264 | ||
265 | if(strchr(reason, '"')) | |
266 | { | |
8bbeb278 | 267 | sendto_one_notice(source_p, ":Invalid character '\"' in comment"); |
212380e3 AC |
268 | return 0; |
269 | } | |
270 | ||
271 | if(!valid_wild_card_simple(gecos)) | |
272 | { | |
273 | sendto_one_notice(source_p, | |
274 | ":Please include at least %d non-wildcard " | |
275 | "characters with the xline", | |
276 | ConfigFileEntry.min_nonwildcard_simple); | |
277 | return 0; | |
278 | } | |
279 | ||
280 | return 1; | |
281 | } | |
282 | ||
283 | void | |
3cbbfb25 | 284 | apply_xline(struct Client *source_p, const char *name, const char *reason, int temp_time, int propagated) |
212380e3 AC |
285 | { |
286 | struct ConfItem *aconf; | |
287 | ||
288 | aconf = make_conf(); | |
289 | aconf->status = CONF_XLINE; | |
b52c2949 | 290 | aconf->created = rb_current_time(); |
4418166c | 291 | aconf->host = rb_strdup(name); |
8bbeb278 | 292 | aconf->passwd = rb_strdup(reason); |
23959371 | 293 | collapse(aconf->host); |
212380e3 | 294 | |
27f616dd JT |
295 | aconf->info.oper = operhash_add(get_oper_name(source_p)); |
296 | ||
3cbbfb25 JT |
297 | if(propagated) |
298 | { | |
299 | aconf->flags |= CONF_FLAGS_MYOPER | CONF_FLAGS_TEMPORARY; | |
300 | aconf->hold = rb_current_time() + temp_time; | |
301 | aconf->lifetime = aconf->hold; | |
302 | ||
303 | replace_old_ban(aconf); | |
304 | rb_dlinkAddAlloc(aconf, &prop_bans); | |
305 | ||
306 | sendto_realops_snomask(SNO_GENERAL, L_ALL, | |
307 | "%s added global %d min. X-Line for [%s] [%s]", | |
308 | get_oper_name(source_p), temp_time / 60, | |
309 | aconf->host, reason); | |
310 | ilog(L_KLINE, "X %s %d %s %s", | |
311 | get_oper_name(source_p), temp_time / 60, name, reason); | |
312 | sendto_one_notice(source_p, ":Added global %d min. X-Line [%s]", | |
313 | temp_time / 60, aconf->host); | |
314 | sendto_server(NULL, NULL, CAP_BAN|CAP_TS6, NOCAPS, | |
315 | ":%s BAN X * %s %lu %d %d * :%s", | |
316 | source_p->id, aconf->host, | |
317 | (unsigned long)aconf->created, | |
318 | (int)(aconf->hold - aconf->created), | |
319 | (int)(aconf->lifetime - aconf->created), | |
320 | reason); | |
321 | } | |
322 | else if(temp_time > 0) | |
212380e3 | 323 | { |
8bbeb278 | 324 | aconf->hold = rb_current_time() + temp_time; |
212380e3 | 325 | |
8bbeb278 AC |
326 | sendto_realops_snomask(SNO_GENERAL, L_ALL, |
327 | "%s added temporary %d min. X-Line for [%s] [%s]", | |
328 | get_oper_name(source_p), temp_time / 60, | |
23959371 | 329 | aconf->host, reason); |
8bbeb278 AC |
330 | ilog(L_KLINE, "X %s %d %s %s", |
331 | get_oper_name(source_p), temp_time / 60, name, reason); | |
332 | sendto_one_notice(source_p, ":Added temporary %d min. X-Line [%s]", | |
23959371 | 333 | temp_time / 60, aconf->host); |
8bbeb278 AC |
334 | } |
335 | else | |
212380e3 | 336 | { |
8bbeb278 | 337 | sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s added X-Line for [%s] [%s]", |
23959371 | 338 | get_oper_name(source_p), aconf->host, aconf->passwd); |
8bbeb278 | 339 | sendto_one_notice(source_p, ":Added X-Line for [%s] [%s]", |
23959371 | 340 | aconf->host, aconf->passwd); |
8bbeb278 | 341 | |
23959371 | 342 | bandb_add(BANDB_XLINE, source_p, aconf->host, NULL, aconf->passwd, NULL, 0); |
f36d4fdd | 343 | ilog(L_KLINE, "X %s 0 %s %s", get_oper_name(source_p), name, aconf->passwd); |
212380e3 | 344 | } |
8bbeb278 AC |
345 | |
346 | rb_dlinkAddAlloc(aconf, &xline_conf_list); | |
347 | check_xlines(); | |
212380e3 AC |
348 | } |
349 | ||
8bbeb278 | 350 | static void |
212380e3 | 351 | propagate_xline(struct Client *source_p, const char *target, |
8bbeb278 | 352 | int temp_time, const char *name, const char *type, const char *reason) |
212380e3 AC |
353 | { |
354 | if(!temp_time) | |
355 | { | |
356 | sendto_match_servs(source_p, target, CAP_CLUSTER, NOCAPS, | |
8bbeb278 | 357 | "XLINE %s %s %s :%s", target, name, type, reason); |
212380e3 | 358 | sendto_match_servs(source_p, target, CAP_ENCAP, CAP_CLUSTER, |
8bbeb278 | 359 | "ENCAP %s XLINE %d %s 2 :%s", target, temp_time, name, reason); |
212380e3 AC |
360 | } |
361 | else | |
362 | sendto_match_servs(source_p, target, CAP_ENCAP, NOCAPS, | |
8bbeb278 AC |
363 | "ENCAP %s XLINE %d %s %s :%s", |
364 | target, temp_time, name, type, reason); | |
212380e3 | 365 | } |
8bbeb278 | 366 | |
212380e3 | 367 | static void |
8bbeb278 | 368 | cluster_xline(struct Client *source_p, int temp_time, const char *name, const char *reason) |
212380e3 AC |
369 | { |
370 | struct remote_conf *shared_p; | |
5b96d9a6 | 371 | rb_dlink_node *ptr; |
212380e3 | 372 | |
5b96d9a6 | 373 | RB_DLINK_FOREACH(ptr, cluster_conf_list.head) |
212380e3 AC |
374 | { |
375 | shared_p = ptr->data; | |
376 | ||
377 | /* old protocol cant handle temps, and we dont really want | |
378 | * to convert them to perm.. --fl | |
379 | */ | |
380 | if(!temp_time) | |
381 | { | |
382 | if(!(shared_p->flags & SHARED_PXLINE)) | |
383 | continue; | |
384 | ||
385 | sendto_match_servs(source_p, shared_p->server, CAP_CLUSTER, NOCAPS, | |
8bbeb278 | 386 | "XLINE %s %s 2 :%s", shared_p->server, name, reason); |
212380e3 | 387 | sendto_match_servs(source_p, shared_p->server, CAP_ENCAP, CAP_CLUSTER, |
8bbeb278 AC |
388 | "ENCAP %s XLINE 0 %s 2 :%s", |
389 | shared_p->server, name, reason); | |
212380e3 AC |
390 | } |
391 | else if(shared_p->flags & SHARED_TXLINE) | |
392 | sendto_match_servs(source_p, shared_p->server, CAP_ENCAP, NOCAPS, | |
8bbeb278 AC |
393 | "ENCAP %s XLINE %d %s 2 :%s", |
394 | shared_p->server, temp_time, name, reason); | |
212380e3 AC |
395 | } |
396 | } | |
397 | ||
398 | /* mo_unxline() | |
399 | * | |
400 | * parv[1] - thing to unxline | |
401 | */ | |
402 | static int | |
403 | mo_unxline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
404 | { | |
3cbbfb25 JT |
405 | int propagated = 1; |
406 | ||
212380e3 AC |
407 | if(!IsOperXline(source_p)) |
408 | { | |
8bbeb278 | 409 | sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "xline"); |
212380e3 AC |
410 | return 0; |
411 | } | |
412 | ||
413 | if(parc == 4 && !(irccmp(parv[2], "ON"))) | |
414 | { | |
415 | if(!IsOperRemoteBan(source_p)) | |
416 | { | |
417 | sendto_one(source_p, form_str(ERR_NOPRIVS), | |
8bbeb278 | 418 | me.name, source_p->name, "remoteban"); |
212380e3 AC |
419 | return 0; |
420 | } | |
421 | ||
8bbeb278 | 422 | propagate_generic(source_p, "UNXLINE", parv[3], CAP_CLUSTER, "%s", parv[1]); |
212380e3 AC |
423 | |
424 | if(match(parv[3], me.name) == 0) | |
425 | return 0; | |
3cbbfb25 JT |
426 | |
427 | propagated = 0; | |
212380e3 | 428 | } |
3cbbfb25 | 429 | /* cluster{} moved to remove_xline */ |
212380e3 | 430 | |
3cbbfb25 | 431 | remove_xline(source_p, parv[1], propagated); |
212380e3 AC |
432 | |
433 | return 0; | |
434 | } | |
435 | ||
436 | /* ms_unxline() | |
437 | * | |
438 | * handles a remote unxline | |
439 | */ | |
440 | static int | |
441 | ms_unxline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
442 | { | |
8bbeb278 AC |
443 | /* parv[0] parv[1] parv[2] |
444 | * oper target server gecos | |
212380e3 | 445 | */ |
8bbeb278 | 446 | propagate_generic(source_p, "UNXLINE", parv[1], CAP_CLUSTER, "%s", parv[2]); |
212380e3 AC |
447 | |
448 | if(!match(parv[1], me.name)) | |
449 | return 0; | |
450 | ||
451 | if(!IsPerson(source_p)) | |
452 | return 0; | |
453 | ||
454 | handle_remote_unxline(source_p, parv[2]); | |
455 | return 0; | |
456 | } | |
457 | ||
458 | static int | |
459 | me_unxline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
460 | { | |
461 | /* name */ | |
462 | if(!IsPerson(source_p)) | |
463 | return 0; | |
464 | ||
465 | handle_remote_unxline(source_p, parv[1]); | |
466 | return 0; | |
467 | } | |
468 | ||
469 | static void | |
470 | handle_remote_unxline(struct Client *source_p, const char *name) | |
471 | { | |
472 | if(!find_shared_conf(source_p->username, source_p->host, | |
8bbeb278 | 473 | source_p->servptr->name, SHARED_UNXLINE)) |
212380e3 AC |
474 | return; |
475 | ||
3cbbfb25 | 476 | remove_xline(source_p, name, 0); |
212380e3 AC |
477 | |
478 | return; | |
479 | } | |
480 | ||
60c96e64 | 481 | static void |
3cbbfb25 | 482 | remove_xline(struct Client *source_p, const char *name, int propagated) |
212380e3 AC |
483 | { |
484 | struct ConfItem *aconf; | |
5b96d9a6 | 485 | rb_dlink_node *ptr; |
212380e3 | 486 | |
5b96d9a6 | 487 | RB_DLINK_FOREACH(ptr, xline_conf_list.head) |
212380e3 AC |
488 | { |
489 | aconf = ptr->data; | |
490 | ||
23959371 | 491 | if(!irccmp(aconf->host, name)) |
212380e3 | 492 | { |
3cbbfb25 JT |
493 | if(aconf->lifetime) |
494 | { | |
495 | if(!propagated) | |
496 | { | |
497 | sendto_one_notice(source_p, ":Cannot remove global X-Line %s on specific servers", name); | |
498 | return; | |
499 | } | |
500 | ptr = rb_dlinkFind(aconf, &prop_bans); | |
501 | if(ptr == NULL) | |
502 | return; | |
503 | sendto_one_notice(source_p, ":X-Line for [%s] is removed", name); | |
504 | sendto_realops_snomask(SNO_GENERAL, L_ALL, | |
505 | "%s has removed the global X-Line for: [%s]", | |
506 | get_oper_name(source_p), name); | |
507 | ilog(L_KLINE, "UX %s %s", get_oper_name(source_p), name); | |
508 | if(aconf->created < rb_current_time()) | |
509 | aconf->created = rb_current_time(); | |
510 | else | |
511 | aconf->created++; | |
512 | aconf->hold = aconf->created; | |
513 | operhash_delete(aconf->info.oper); | |
514 | aconf->info.oper = operhash_add(get_oper_name(source_p)); | |
515 | aconf->flags |= CONF_FLAGS_MYOPER | CONF_FLAGS_TEMPORARY; | |
516 | sendto_server(NULL, NULL, CAP_BAN|CAP_TS6, NOCAPS, | |
517 | ":%s BAN X * %s %lu %d %d * :*", | |
518 | source_p->id, aconf->host, | |
519 | (unsigned long)aconf->created, | |
520 | 0, | |
521 | (int)(aconf->lifetime - aconf->created)); | |
522 | remove_reject_mask(aconf->host, NULL); | |
523 | deactivate_conf(aconf, ptr); | |
524 | return; | |
525 | } | |
1b5d7c2e | 526 | else if(propagated && rb_dlink_list_length(&cluster_conf_list)) |
3cbbfb25 | 527 | cluster_generic(source_p, "UNXLINE", SHARED_UNXLINE, CAP_CLUSTER, "%s", name); |
8bbeb278 | 528 | if(!aconf->hold) |
5408b484 | 529 | { |
8bbeb278 AC |
530 | bandb_del(BANDB_XLINE, aconf->host, NULL); |
531 | ||
532 | sendto_one_notice(source_p, ":X-Line for [%s] is removed", aconf->host); | |
533 | sendto_realops_snomask(SNO_GENERAL, L_ALL, | |
534 | "%s has removed the X-Line for: [%s]", | |
535 | get_oper_name(source_p), aconf->host); | |
536 | ilog(L_KLINE, "UX %s %s", get_oper_name(source_p), aconf->host); | |
5408b484 JT |
537 | } |
538 | else | |
539 | { | |
8bbeb278 | 540 | sendto_one_notice(source_p, ":X-Line for [%s] is removed", name); |
5408b484 | 541 | sendto_realops_snomask(SNO_GENERAL, L_ALL, |
8bbeb278 AC |
542 | "%s has removed the temporary X-Line for: [%s]", |
543 | get_oper_name(source_p), name); | |
544 | ilog(L_KLINE, "UX %s %s", get_oper_name(source_p), name); | |
5408b484 | 545 | } |
8bbeb278 | 546 | |
23959371 | 547 | remove_reject_mask(aconf->host, NULL); |
212380e3 | 548 | free_conf(aconf); |
555ac41f | 549 | rb_dlinkDestroy(ptr, &xline_conf_list); |
60c96e64 | 550 | return; |
212380e3 AC |
551 | } |
552 | } | |
553 | ||
1b5d7c2e | 554 | if(propagated && rb_dlink_list_length(&cluster_conf_list)) |
3cbbfb25 JT |
555 | cluster_generic(source_p, "UNXLINE", SHARED_UNXLINE, CAP_CLUSTER, "%s", name); |
556 | ||
8bbeb278 | 557 | sendto_one_notice(source_p, ":No X-Line for %s", name); |
5408b484 | 558 | |
60c96e64 | 559 | return; |
212380e3 | 560 | } |