1 |
michael |
1058 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* m_dline.c: Bans a user. |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2002 by the past and present ircd coders, and others. |
6 |
|
|
* |
7 |
|
|
* This program is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License as published by |
9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
10 |
|
|
* (at your option) any later version. |
11 |
|
|
* |
12 |
|
|
* This program is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with this program; if not, write to the Free Software |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
|
|
* USA |
21 |
|
|
* |
22 |
|
|
* $Id$ |
23 |
|
|
*/ |
24 |
|
|
|
25 |
|
|
#include "stdinc.h" |
26 |
|
|
#include "list.h" |
27 |
|
|
#include "channel.h" |
28 |
|
|
#include "client.h" |
29 |
|
|
#include "irc_string.h" |
30 |
michael |
1632 |
#include "conf.h" |
31 |
michael |
1058 |
#include "ircd.h" |
32 |
|
|
#include "hostmask.h" |
33 |
|
|
#include "numeric.h" |
34 |
|
|
#include "fdlist.h" |
35 |
|
|
#include "s_bsd.h" |
36 |
michael |
1309 |
#include "log.h" |
37 |
michael |
1058 |
#include "s_misc.h" |
38 |
|
|
#include "send.h" |
39 |
|
|
#include "hash.h" |
40 |
|
|
#include "s_serv.h" |
41 |
|
|
#include "parse.h" |
42 |
|
|
#include "modules.h" |
43 |
michael |
1622 |
#include "conf_db.h" |
44 |
michael |
1666 |
#include "memory.h" |
45 |
michael |
1058 |
|
46 |
|
|
|
47 |
|
|
/* apply_tdline() |
48 |
|
|
* |
49 |
|
|
* inputs - |
50 |
|
|
* output - NONE |
51 |
|
|
* side effects - tkline as given is placed |
52 |
|
|
*/ |
53 |
|
|
static void |
54 |
michael |
1632 |
apply_dline(struct Client *source_p, struct MaskItem *conf, |
55 |
michael |
1622 |
time_t tkline_time) |
56 |
michael |
1058 |
{ |
57 |
michael |
1622 |
if (tkline_time) |
58 |
|
|
{ |
59 |
michael |
1649 |
conf->until = CurrentTime + tkline_time; |
60 |
michael |
1622 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
61 |
|
|
"%s added temporary %d min. D-Line for [%s] [%s]", |
62 |
|
|
get_oper_name(source_p), tkline_time/60, |
63 |
michael |
1632 |
conf->host, conf->reason); |
64 |
michael |
1622 |
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]", |
65 |
|
|
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
66 |
michael |
1632 |
source_p->name, tkline_time/60, conf->host); |
67 |
michael |
1622 |
ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]", |
68 |
michael |
1632 |
get_oper_name(source_p), tkline_time/60, conf->host, conf->reason); |
69 |
michael |
1622 |
} |
70 |
|
|
else |
71 |
|
|
{ |
72 |
|
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
73 |
|
|
"%s added D-Line for [%s] [%s]", |
74 |
michael |
1632 |
get_oper_name(source_p), conf->host, conf->reason); |
75 |
michael |
1622 |
sendto_one(source_p, ":%s NOTICE %s :Added D-Line [%s]", |
76 |
|
|
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
77 |
michael |
1632 |
source_p->name, conf->host); |
78 |
michael |
1622 |
ilog(LOG_TYPE_DLINE, "%s added D-Line for [%s] [%s]", |
79 |
michael |
1632 |
get_oper_name(source_p), conf->host, conf->reason); |
80 |
michael |
1058 |
|
81 |
michael |
1622 |
} |
82 |
|
|
|
83 |
michael |
1632 |
SetConfDatabase(conf); |
84 |
|
|
conf->setat = CurrentTime; |
85 |
|
|
add_conf_by_address(CONF_DLINE, conf); |
86 |
michael |
1058 |
rehashed_klines = 1; |
87 |
|
|
} |
88 |
|
|
|
89 |
michael |
1298 |
/* static int remove_tdline_match(const char *host, const char *user) |
90 |
|
|
* Input: An ip to undline. |
91 |
|
|
* Output: returns YES on success, NO if no tdline removed. |
92 |
|
|
* Side effects: Any matching tdlines are removed. |
93 |
|
|
*/ |
94 |
|
|
static int |
95 |
michael |
1622 |
remove_dline_match(const char *host) |
96 |
michael |
1298 |
{ |
97 |
michael |
1369 |
struct irc_ssaddr iphost, *piphost; |
98 |
michael |
1632 |
struct MaskItem *conf; |
99 |
michael |
1644 |
int t = 0; |
100 |
|
|
int aftype = 0; |
101 |
michael |
1298 |
|
102 |
michael |
1369 |
if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST) |
103 |
michael |
1298 |
{ |
104 |
|
|
#ifdef IPV6 |
105 |
michael |
1369 |
if (t == HM_IPV6) |
106 |
michael |
1644 |
aftype = AF_INET6; |
107 |
michael |
1369 |
else |
108 |
michael |
1298 |
#endif |
109 |
michael |
1644 |
aftype = AF_INET; |
110 |
michael |
1369 |
piphost = &iphost; |
111 |
|
|
} |
112 |
|
|
else |
113 |
|
|
piphost = NULL; |
114 |
|
|
|
115 |
michael |
1703 |
if ((conf = find_conf_by_address(host, piphost, CONF_DLINE | 1, aftype, NULL, NULL, 0))) |
116 |
michael |
1369 |
{ |
117 |
michael |
1632 |
if (IsConfDatabase(conf)) |
118 |
michael |
1298 |
{ |
119 |
michael |
1632 |
delete_one_address_conf(host, conf); |
120 |
michael |
1298 |
return 1; |
121 |
|
|
} |
122 |
|
|
} |
123 |
|
|
|
124 |
|
|
return 0; |
125 |
|
|
} |
126 |
|
|
|
127 |
michael |
1058 |
/* mo_dline() |
128 |
|
|
* |
129 |
|
|
* inputs - pointer to server |
130 |
|
|
* - pointer to client |
131 |
|
|
* - parameter count |
132 |
|
|
* - parameter list |
133 |
|
|
* output - |
134 |
|
|
* side effects - D line is added |
135 |
|
|
* |
136 |
|
|
*/ |
137 |
|
|
static void |
138 |
|
|
mo_dline(struct Client *client_p, struct Client *source_p, |
139 |
|
|
int parc, char *parv[]) |
140 |
|
|
{ |
141 |
michael |
1301 |
char def_reason[] = "<No reason specified>"; |
142 |
michael |
1622 |
char *dlhost = NULL, *reason = NULL; |
143 |
michael |
1301 |
char *target_server = NULL; |
144 |
michael |
1058 |
const char *creason; |
145 |
|
|
const struct Client *target_p = NULL; |
146 |
|
|
struct irc_ssaddr daddr; |
147 |
michael |
1632 |
struct MaskItem *conf=NULL; |
148 |
michael |
1058 |
time_t tkline_time=0; |
149 |
michael |
1644 |
int bits = 0, aftype = 0, t = 0; |
150 |
michael |
1058 |
const char *current_date = NULL; |
151 |
|
|
time_t cur_time; |
152 |
michael |
1398 |
char hostip[HOSTIPLEN + 1]; |
153 |
michael |
1230 |
char buffer[IRCD_BUFSIZE]; |
154 |
michael |
1058 |
|
155 |
michael |
1301 |
if (!HasOFlag(source_p, OPER_FLAG_DLINE)) |
156 |
michael |
1058 |
{ |
157 |
|
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
158 |
michael |
1515 |
me.name, source_p->name, "dline"); |
159 |
michael |
1058 |
return; |
160 |
|
|
} |
161 |
|
|
|
162 |
|
|
if (parse_aline("DLINE", source_p, parc, parv, AWILD, &dlhost, |
163 |
michael |
1301 |
NULL, &tkline_time, &target_server, &reason) < 0) |
164 |
michael |
1058 |
return; |
165 |
|
|
|
166 |
michael |
1301 |
if (target_server != NULL) |
167 |
|
|
{ |
168 |
|
|
if (HasID(source_p)) |
169 |
|
|
{ |
170 |
michael |
1474 |
sendto_server(NULL, CAP_DLN|CAP_TS6, NOCAPS, |
171 |
michael |
1301 |
":%s DLINE %s %lu %s :%s", |
172 |
|
|
source_p->id, target_server, (unsigned long)tkline_time, |
173 |
|
|
dlhost, reason); |
174 |
michael |
1474 |
sendto_server(NULL, CAP_DLN, CAP_TS6, |
175 |
michael |
1301 |
":%s DLINE %s %lu %s :%s", |
176 |
|
|
source_p->name, target_server, (unsigned long)tkline_time, |
177 |
|
|
dlhost, reason); |
178 |
|
|
} |
179 |
|
|
else |
180 |
michael |
1474 |
sendto_server(NULL, CAP_DLN, NOCAPS, |
181 |
michael |
1301 |
":%s DLINE %s %lu %s :%s", |
182 |
|
|
source_p->name, target_server, (unsigned long)tkline_time, |
183 |
|
|
dlhost, reason); |
184 |
|
|
|
185 |
|
|
/* Allow ON to apply local kline as well if it matches */ |
186 |
michael |
1652 |
if (match(target_server, me.name)) |
187 |
michael |
1301 |
return; |
188 |
|
|
} |
189 |
|
|
else |
190 |
|
|
cluster_a_line(source_p, "DLINE", CAP_DLN, SHARED_DLINE, |
191 |
|
|
"%d %s :%s", tkline_time, dlhost, reason); |
192 |
|
|
|
193 |
michael |
1058 |
if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST) |
194 |
|
|
{ |
195 |
|
|
if ((target_p = find_chasing(client_p, source_p, dlhost, NULL)) == NULL) |
196 |
|
|
return; |
197 |
|
|
|
198 |
|
|
if (!MyConnect(target_p)) |
199 |
|
|
{ |
200 |
|
|
sendto_one(source_p, |
201 |
|
|
":%s NOTICE %s :Can't DLINE nick on another server", |
202 |
|
|
me.name, source_p->name); |
203 |
|
|
return; |
204 |
|
|
} |
205 |
|
|
|
206 |
|
|
if (IsExemptKline(target_p)) |
207 |
|
|
{ |
208 |
|
|
sendto_one(source_p, |
209 |
|
|
":%s NOTICE %s :%s is E-lined", me.name, |
210 |
|
|
source_p->name, target_p->name); |
211 |
|
|
return; |
212 |
|
|
} |
213 |
|
|
|
214 |
michael |
1123 |
getnameinfo((struct sockaddr *)&target_p->localClient->ip, |
215 |
|
|
target_p->localClient->ip.ss_len, hostip, |
216 |
|
|
sizeof(hostip), NULL, 0, NI_NUMERICHOST); |
217 |
michael |
1058 |
dlhost = hostip; |
218 |
|
|
t = parse_netmask(dlhost, NULL, &bits); |
219 |
|
|
assert(t == HM_IPV4 || t == HM_IPV6); |
220 |
|
|
} |
221 |
|
|
|
222 |
|
|
if (bits < 8) |
223 |
|
|
{ |
224 |
|
|
sendto_one(source_p, |
225 |
|
|
":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.", |
226 |
|
|
me.name, source_p->name); |
227 |
|
|
return; |
228 |
|
|
} |
229 |
|
|
|
230 |
|
|
#ifdef IPV6 |
231 |
|
|
if (t == HM_IPV6) |
232 |
michael |
1644 |
aftype = AF_INET6; |
233 |
michael |
1058 |
else |
234 |
|
|
#endif |
235 |
michael |
1644 |
aftype = AF_INET; |
236 |
michael |
1058 |
|
237 |
|
|
parse_netmask(dlhost, &daddr, NULL); |
238 |
|
|
|
239 |
michael |
1644 |
if ((conf = find_dline_conf(&daddr, aftype)) != NULL) |
240 |
michael |
1058 |
{ |
241 |
michael |
1632 |
creason = conf->reason ? conf->reason : def_reason; |
242 |
|
|
if (IsConfExemptKline(conf)) |
243 |
michael |
1058 |
sendto_one(source_p, |
244 |
|
|
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s", |
245 |
michael |
1632 |
me.name, source_p->name, dlhost, conf->host, creason); |
246 |
michael |
1058 |
else |
247 |
|
|
sendto_one(source_p, |
248 |
|
|
":%s NOTICE %s :[%s] already D-lined by [%s] - %s", |
249 |
michael |
1632 |
me.name, source_p->name, dlhost, conf->host, creason); |
250 |
michael |
1058 |
return; |
251 |
|
|
} |
252 |
|
|
|
253 |
|
|
cur_time = CurrentTime; |
254 |
|
|
current_date = smalldate(cur_time); |
255 |
|
|
|
256 |
michael |
1243 |
if (!valid_comment(source_p, reason, 1)) |
257 |
michael |
1058 |
return; |
258 |
|
|
|
259 |
michael |
1632 |
conf = conf_make(CONF_DLINE); |
260 |
michael |
1646 |
conf->host = xstrdup(dlhost); |
261 |
michael |
1058 |
|
262 |
|
|
if (tkline_time != 0) |
263 |
michael |
1233 |
snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)", |
264 |
|
|
(int)(tkline_time/60), reason, current_date); |
265 |
michael |
1058 |
else |
266 |
michael |
1233 |
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); |
267 |
michael |
1058 |
|
268 |
michael |
1646 |
conf->reason = xstrdup(buffer); |
269 |
michael |
1632 |
apply_dline(source_p, conf, tkline_time); |
270 |
michael |
1058 |
rehashed_klines = 1; |
271 |
|
|
} |
272 |
|
|
|
273 |
michael |
1301 |
static void |
274 |
|
|
ms_dline(struct Client *client_p, struct Client *source_p, |
275 |
|
|
int parc, char *parv[]) |
276 |
|
|
{ |
277 |
|
|
char def_reason[] = "<No reason specified>"; |
278 |
michael |
1622 |
char *dlhost, *reason; |
279 |
michael |
1301 |
const char *creason; |
280 |
|
|
const struct Client *target_p = NULL; |
281 |
|
|
struct irc_ssaddr daddr; |
282 |
michael |
1632 |
struct MaskItem *conf=NULL; |
283 |
michael |
1301 |
time_t tkline_time=0; |
284 |
michael |
1644 |
int bits = 0, aftype = 0, t = 0; |
285 |
michael |
1301 |
const char *current_date = NULL; |
286 |
|
|
time_t cur_time; |
287 |
michael |
1398 |
char hostip[HOSTIPLEN + 1]; |
288 |
michael |
1301 |
char buffer[IRCD_BUFSIZE]; |
289 |
|
|
|
290 |
|
|
if (parc != 5 || EmptyString(parv[4])) |
291 |
|
|
return; |
292 |
|
|
|
293 |
|
|
/* parv[0] parv[1] parv[2] parv[3] parv[4] */ |
294 |
|
|
/* oper target_server tkline_time host reason */ |
295 |
|
|
sendto_match_servs(source_p, parv[1], CAP_DLN, |
296 |
|
|
"DLINE %s %s %s :%s", |
297 |
|
|
parv[1], parv[2], parv[3], parv[4]); |
298 |
|
|
|
299 |
michael |
1652 |
if (match(parv[1], me.name)) |
300 |
michael |
1301 |
return; |
301 |
|
|
|
302 |
|
|
tkline_time = valid_tkline(parv[2], TK_SECONDS); |
303 |
|
|
dlhost = parv[3]; |
304 |
|
|
reason = parv[4]; |
305 |
|
|
|
306 |
michael |
1632 |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name, |
307 |
michael |
1301 |
source_p->username, source_p->host, |
308 |
|
|
SHARED_DLINE)) |
309 |
|
|
{ |
310 |
|
|
if (!IsClient(source_p)) |
311 |
|
|
return; |
312 |
|
|
if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST) |
313 |
|
|
{ |
314 |
|
|
if ((target_p = find_chasing(client_p, source_p, dlhost, NULL)) == NULL) |
315 |
|
|
return; |
316 |
|
|
|
317 |
|
|
if (!MyConnect(target_p)) |
318 |
|
|
{ |
319 |
|
|
sendto_one(source_p, |
320 |
|
|
":%s NOTICE %s :Can't DLINE nick on another server", |
321 |
|
|
me.name, source_p->name); |
322 |
|
|
return; |
323 |
|
|
} |
324 |
|
|
|
325 |
|
|
if (IsExemptKline(target_p)) |
326 |
|
|
{ |
327 |
|
|
sendto_one(source_p, |
328 |
|
|
":%s NOTICE %s :%s is E-lined", me.name, |
329 |
|
|
source_p->name, target_p->name); |
330 |
|
|
return; |
331 |
|
|
} |
332 |
|
|
|
333 |
|
|
getnameinfo((struct sockaddr *)&target_p->localClient->ip, |
334 |
|
|
target_p->localClient->ip.ss_len, hostip, |
335 |
|
|
sizeof(hostip), NULL, 0, NI_NUMERICHOST); |
336 |
|
|
dlhost = hostip; |
337 |
|
|
t = parse_netmask(dlhost, NULL, &bits); |
338 |
|
|
assert(t == HM_IPV4 || t == HM_IPV6); |
339 |
|
|
} |
340 |
|
|
|
341 |
|
|
if (bits < 8) |
342 |
|
|
{ |
343 |
|
|
sendto_one(source_p, |
344 |
|
|
":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.", |
345 |
|
|
me.name, source_p->name); |
346 |
|
|
return; |
347 |
|
|
} |
348 |
|
|
|
349 |
|
|
#ifdef IPV6 |
350 |
|
|
if (t == HM_IPV6) |
351 |
michael |
1644 |
aftype= AF_INET6; |
352 |
michael |
1301 |
else |
353 |
|
|
#endif |
354 |
michael |
1644 |
aftype = AF_INET; |
355 |
michael |
1301 |
|
356 |
|
|
parse_netmask(dlhost, &daddr, NULL); |
357 |
|
|
|
358 |
michael |
1644 |
if ((conf = find_dline_conf(&daddr, aftype)) != NULL) |
359 |
michael |
1301 |
{ |
360 |
michael |
1632 |
creason = conf->reason ? conf->reason : def_reason; |
361 |
|
|
if (IsConfExemptKline(conf)) |
362 |
michael |
1301 |
sendto_one(source_p, |
363 |
|
|
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s", |
364 |
michael |
1632 |
me.name, source_p->name, dlhost, conf->host, creason); |
365 |
michael |
1301 |
else |
366 |
|
|
sendto_one(source_p, |
367 |
|
|
":%s NOTICE %s :[%s] already D-lined by [%s] - %s", |
368 |
michael |
1632 |
me.name, source_p->name, dlhost, conf->host, creason); |
369 |
michael |
1301 |
return; |
370 |
|
|
} |
371 |
|
|
|
372 |
|
|
cur_time = CurrentTime; |
373 |
|
|
current_date = smalldate(cur_time); |
374 |
|
|
|
375 |
|
|
if (!valid_comment(source_p, reason, 1)) |
376 |
|
|
return; |
377 |
|
|
|
378 |
michael |
1632 |
conf = conf_make(CONF_DLINE); |
379 |
michael |
1646 |
conf->host = xstrdup(dlhost); |
380 |
michael |
1301 |
|
381 |
|
|
if (tkline_time != 0) |
382 |
|
|
snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)", |
383 |
|
|
(int)(tkline_time/60), reason, current_date); |
384 |
|
|
else |
385 |
|
|
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); |
386 |
|
|
|
387 |
michael |
1646 |
conf->reason = xstrdup(buffer); |
388 |
michael |
1632 |
apply_dline(source_p, conf, tkline_time); |
389 |
michael |
1301 |
rehashed_klines = 1; |
390 |
|
|
} |
391 |
|
|
} |
392 |
|
|
|
393 |
michael |
1058 |
/* |
394 |
|
|
** m_undline |
395 |
|
|
** added May 28th 2000 by Toby Verrall <toot@melnet.co.uk> |
396 |
|
|
** based totally on m_unkline |
397 |
|
|
** added to hybrid-7 7/11/2000 --is |
398 |
|
|
** |
399 |
|
|
** parv[0] = sender nick |
400 |
|
|
** parv[1] = dline to remove |
401 |
|
|
*/ |
402 |
|
|
static void |
403 |
|
|
mo_undline(struct Client *client_p, struct Client *source_p, |
404 |
|
|
int parc, char *parv[]) |
405 |
|
|
{ |
406 |
michael |
1301 |
char *addr = NULL, *user = NULL; |
407 |
|
|
char *target_server = NULL; |
408 |
michael |
1058 |
|
409 |
michael |
1301 |
if (!HasOFlag(source_p, OPER_FLAG_UNDLINE)) |
410 |
michael |
1058 |
{ |
411 |
|
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
412 |
|
|
me.name, source_p->name, "undline"); |
413 |
|
|
return; |
414 |
|
|
} |
415 |
|
|
|
416 |
michael |
1301 |
if (parc < 2 || EmptyString(parv[1])) |
417 |
|
|
{ |
418 |
|
|
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
419 |
|
|
me.name, source_p->name, "UNDLINE"); |
420 |
|
|
return; |
421 |
|
|
} |
422 |
michael |
1058 |
|
423 |
michael |
1301 |
if (parse_aline("UNDLINE", source_p, parc, parv, 0, &user, |
424 |
|
|
&addr, NULL, &target_server, NULL) < 0) |
425 |
|
|
return; |
426 |
|
|
|
427 |
|
|
if (target_server != NULL) |
428 |
|
|
{ |
429 |
|
|
sendto_match_servs(source_p, target_server, CAP_UNDLN, |
430 |
|
|
"UNDLINE %s %s", target_server, addr); |
431 |
|
|
|
432 |
|
|
/* Allow ON to apply local unkline as well if it matches */ |
433 |
michael |
1652 |
if (match(target_server, me.name)) |
434 |
michael |
1301 |
return; |
435 |
|
|
} |
436 |
|
|
else |
437 |
|
|
cluster_a_line(source_p, "UNDLINE", CAP_UNDLN, SHARED_UNDLINE, |
438 |
|
|
"%s", addr); |
439 |
|
|
|
440 |
michael |
1622 |
if (remove_dline_match(addr)) |
441 |
michael |
1058 |
{ |
442 |
|
|
sendto_one(source_p, |
443 |
michael |
1622 |
":%s NOTICE %s :D-Line for [%s] is removed", |
444 |
michael |
1301 |
me.name, source_p->name, addr); |
445 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
446 |
michael |
1622 |
"%s has removed the D-Line for: [%s]", |
447 |
michael |
1298 |
get_oper_name(source_p), addr); |
448 |
michael |
1247 |
ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]", |
449 |
michael |
1298 |
get_oper_name(source_p), addr); |
450 |
michael |
1058 |
} |
451 |
|
|
else |
452 |
|
|
sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found", |
453 |
michael |
1298 |
me.name, source_p->name, addr); |
454 |
michael |
1058 |
} |
455 |
michael |
1230 |
|
456 |
michael |
1301 |
static void |
457 |
|
|
me_undline(struct Client *client_p, struct Client *source_p, |
458 |
|
|
int parc, char *parv[]) |
459 |
|
|
{ |
460 |
|
|
const char *addr = NULL; |
461 |
|
|
|
462 |
|
|
if (parc != 3 || EmptyString(parv[2])) |
463 |
|
|
return; |
464 |
|
|
|
465 |
|
|
addr = parv[2]; |
466 |
|
|
|
467 |
michael |
1652 |
if (!IsClient(source_p) || match(parv[1], me.name)) |
468 |
michael |
1301 |
return; |
469 |
|
|
|
470 |
michael |
1632 |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, |
471 |
michael |
1301 |
source_p->servptr->name, |
472 |
|
|
source_p->username, source_p->host, |
473 |
|
|
SHARED_UNDLINE)) |
474 |
|
|
{ |
475 |
michael |
1622 |
if (remove_dline_match(addr)) |
476 |
michael |
1301 |
{ |
477 |
|
|
sendto_one(source_p, |
478 |
michael |
1622 |
":%s NOTICE %s :D-Line for [%s] is removed", |
479 |
michael |
1301 |
me.name, source_p->name, addr); |
480 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
481 |
michael |
1622 |
"%s has removed the D-Line for: [%s]", |
482 |
michael |
1301 |
get_oper_name(source_p), addr); |
483 |
|
|
ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]", |
484 |
|
|
get_oper_name(source_p), addr); |
485 |
|
|
} |
486 |
|
|
else |
487 |
|
|
sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found", |
488 |
|
|
me.name, source_p->name, addr); |
489 |
|
|
} |
490 |
|
|
} |
491 |
|
|
|
492 |
|
|
static void |
493 |
|
|
ms_undline(struct Client *client_p, struct Client *source_p, |
494 |
|
|
int parc, char *parv[]) |
495 |
|
|
{ |
496 |
|
|
if (parc != 3 || EmptyString(parv[2])) |
497 |
|
|
return; |
498 |
|
|
|
499 |
|
|
sendto_match_servs(source_p, parv[1], CAP_UNDLN, |
500 |
michael |
1761 |
"UNDLINE %s %s", |
501 |
michael |
1301 |
parv[1], parv[2]); |
502 |
|
|
|
503 |
|
|
me_undline(client_p, source_p, parc, parv); |
504 |
|
|
} |
505 |
|
|
|
506 |
michael |
1230 |
static struct Message dline_msgtab = { |
507 |
|
|
"DLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
508 |
michael |
1301 |
{m_unregistered, m_not_oper, ms_dline, m_ignore, mo_dline, m_ignore} |
509 |
michael |
1230 |
}; |
510 |
|
|
|
511 |
|
|
static struct Message undline_msgtab = { |
512 |
|
|
"UNDLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
513 |
michael |
1301 |
{m_unregistered, m_not_oper, ms_undline, m_ignore, mo_undline, m_ignore} |
514 |
michael |
1230 |
}; |
515 |
|
|
|
516 |
|
|
static void |
517 |
|
|
module_init(void) |
518 |
|
|
{ |
519 |
|
|
mod_add_cmd(&dline_msgtab); |
520 |
|
|
mod_add_cmd(&undline_msgtab); |
521 |
michael |
1301 |
add_capability("DLN", CAP_DLN, 1); |
522 |
|
|
add_capability("UNDLN", CAP_UNDLN, 1); |
523 |
michael |
1230 |
} |
524 |
|
|
|
525 |
|
|
static void |
526 |
|
|
module_exit(void) |
527 |
|
|
{ |
528 |
|
|
mod_del_cmd(&dline_msgtab); |
529 |
|
|
mod_del_cmd(&undline_msgtab); |
530 |
michael |
1301 |
delete_capability("UNDLN"); |
531 |
|
|
delete_capability("DLN"); |
532 |
michael |
1230 |
} |
533 |
|
|
|
534 |
|
|
struct module module_entry = { |
535 |
|
|
.node = { NULL, NULL, NULL }, |
536 |
|
|
.name = NULL, |
537 |
|
|
.version = "$Revision$", |
538 |
|
|
.handle = NULL, |
539 |
|
|
.modinit = module_init, |
540 |
|
|
.modexit = module_exit, |
541 |
|
|
.flags = 0 |
542 |
|
|
}; |