1 |
adx |
30 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* m_kline.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 |
knight |
31 |
* $Id$ |
23 |
adx |
30 |
*/ |
24 |
|
|
|
25 |
|
|
#include "stdinc.h" |
26 |
michael |
1011 |
#include "list.h" |
27 |
adx |
30 |
#include "channel.h" |
28 |
|
|
#include "client.h" |
29 |
|
|
#include "irc_string.h" |
30 |
|
|
#include "sprintf_irc.h" |
31 |
|
|
#include "ircd.h" |
32 |
|
|
#include "hostmask.h" |
33 |
|
|
#include "numeric.h" |
34 |
|
|
#include "fdlist.h" |
35 |
|
|
#include "s_bsd.h" |
36 |
michael |
1309 |
#include "conf.h" |
37 |
|
|
#include "log.h" |
38 |
adx |
30 |
#include "s_misc.h" |
39 |
|
|
#include "send.h" |
40 |
|
|
#include "hash.h" |
41 |
|
|
#include "s_serv.h" |
42 |
|
|
#include "s_gline.h" |
43 |
|
|
#include "parse.h" |
44 |
|
|
#include "modules.h" |
45 |
michael |
1622 |
#include "conf_db.h" |
46 |
adx |
30 |
|
47 |
michael |
611 |
|
48 |
michael |
1058 |
static int already_placed_kline(struct Client *, const char *, const char *, int); |
49 |
michael |
1622 |
static void m_kline_add_kline(struct Client *, struct AccessItem *, time_t); |
50 |
michael |
1058 |
|
51 |
|
|
static char buffer[IRCD_BUFSIZE]; |
52 |
michael |
1622 |
static int remove_kline_match(const char *, const char *); |
53 |
adx |
30 |
|
54 |
|
|
|
55 |
|
|
/* mo_kline() |
56 |
|
|
* |
57 |
|
|
* inputs - pointer to server |
58 |
|
|
* - pointer to client |
59 |
|
|
* - parameter count |
60 |
|
|
* - parameter list |
61 |
|
|
* output - |
62 |
|
|
* side effects - k line is added |
63 |
|
|
*/ |
64 |
|
|
static void |
65 |
|
|
mo_kline(struct Client *client_p, struct Client *source_p, |
66 |
michael |
1298 |
int parc, char *parv[]) |
67 |
adx |
30 |
{ |
68 |
|
|
char *reason = NULL; |
69 |
|
|
char *user = NULL; |
70 |
|
|
char *host = NULL; |
71 |
|
|
const char *current_date; |
72 |
|
|
char *target_server = NULL; |
73 |
|
|
struct ConfItem *conf; |
74 |
|
|
struct AccessItem *aconf; |
75 |
|
|
time_t tkline_time = 0; |
76 |
|
|
time_t cur_time; |
77 |
|
|
|
78 |
michael |
1219 |
if (!HasOFlag(source_p, OPER_FLAG_K)) |
79 |
adx |
30 |
{ |
80 |
|
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
81 |
|
|
me.name, source_p->name, "kline"); |
82 |
|
|
return; |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
if (parse_aline("KLINE", source_p, parc, parv, |
86 |
|
|
AWILD, &user, &host, &tkline_time, &target_server, &reason) < 0) |
87 |
|
|
return; |
88 |
|
|
|
89 |
|
|
if (target_server != NULL) |
90 |
|
|
{ |
91 |
|
|
if (HasID(source_p)) |
92 |
|
|
{ |
93 |
michael |
1474 |
sendto_server(NULL, CAP_KLN|CAP_TS6, NOCAPS, |
94 |
adx |
30 |
":%s KLINE %s %lu %s %s :%s", |
95 |
|
|
source_p->id, target_server, (unsigned long)tkline_time, |
96 |
|
|
user, host, reason); |
97 |
michael |
1474 |
sendto_server(NULL, CAP_KLN, CAP_TS6, |
98 |
adx |
30 |
":%s KLINE %s %lu %s %s :%s", |
99 |
|
|
source_p->name, target_server, (unsigned long)tkline_time, |
100 |
|
|
user, host, reason); |
101 |
|
|
} |
102 |
|
|
else |
103 |
michael |
1474 |
sendto_server(NULL, CAP_KLN, NOCAPS, |
104 |
adx |
30 |
":%s KLINE %s %lu %s %s :%s", |
105 |
|
|
source_p->name, target_server, (unsigned long)tkline_time, |
106 |
|
|
user, host, reason); |
107 |
|
|
|
108 |
|
|
/* Allow ON to apply local kline as well if it matches */ |
109 |
|
|
if (!match(target_server, me.name)) |
110 |
|
|
return; |
111 |
|
|
} |
112 |
|
|
else |
113 |
|
|
cluster_a_line(source_p, "KLINE", CAP_KLN, SHARED_KLINE, |
114 |
michael |
1058 |
"%d %s %s :%s", tkline_time, user, host, reason); |
115 |
adx |
30 |
|
116 |
michael |
1243 |
if (already_placed_kline(source_p, user, host, 1)) |
117 |
adx |
30 |
return; |
118 |
|
|
|
119 |
|
|
cur_time = CurrentTime; |
120 |
|
|
current_date = smalldate(cur_time); |
121 |
|
|
conf = make_conf_item(KLINE_TYPE); |
122 |
|
|
aconf = map_to_conf(conf); |
123 |
|
|
|
124 |
|
|
DupString(aconf->host, host); |
125 |
|
|
DupString(aconf->user, user); |
126 |
|
|
|
127 |
|
|
if (tkline_time != 0) |
128 |
|
|
{ |
129 |
michael |
1233 |
snprintf(buffer, sizeof(buffer), "Temporary K-line %d min. - %s (%s)", |
130 |
|
|
(int)(tkline_time/60), reason, current_date); |
131 |
adx |
30 |
DupString(aconf->reason, buffer); |
132 |
|
|
|
133 |
michael |
1622 |
m_kline_add_kline(source_p, aconf, tkline_time); |
134 |
adx |
30 |
} |
135 |
|
|
else |
136 |
|
|
{ |
137 |
michael |
1233 |
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); |
138 |
adx |
30 |
DupString(aconf->reason, buffer); |
139 |
|
|
|
140 |
michael |
1622 |
m_kline_add_kline(source_p, aconf, 0); |
141 |
adx |
30 |
} |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
/* me_kline - handle remote kline. no propagation */ |
145 |
|
|
static void |
146 |
|
|
me_kline(struct Client *client_p, struct Client *source_p, |
147 |
|
|
int parc, char *parv[]) |
148 |
|
|
{ |
149 |
|
|
struct ConfItem *conf=NULL; |
150 |
|
|
struct AccessItem *aconf=NULL; |
151 |
|
|
int tkline_time; |
152 |
|
|
const char* current_date; |
153 |
|
|
time_t cur_time; |
154 |
michael |
1622 |
char *kuser, *khost, *kreason; |
155 |
adx |
30 |
|
156 |
michael |
352 |
if (parc != 6 || EmptyString(parv[5])) |
157 |
adx |
30 |
return; |
158 |
|
|
|
159 |
|
|
if (!match(parv[1], me.name)) |
160 |
|
|
return; |
161 |
|
|
|
162 |
|
|
tkline_time = valid_tkline(parv[2], TK_SECONDS); |
163 |
|
|
kuser = parv[3]; |
164 |
|
|
khost = parv[4]; |
165 |
|
|
kreason = parv[5]; |
166 |
|
|
|
167 |
|
|
cur_time = CurrentTime; |
168 |
|
|
current_date = smalldate(cur_time); |
169 |
|
|
|
170 |
michael |
1275 |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name, |
171 |
adx |
30 |
source_p->username, source_p->host, |
172 |
|
|
SHARED_KLINE)) |
173 |
|
|
{ |
174 |
|
|
if (!IsClient(source_p) || |
175 |
michael |
1243 |
already_placed_kline(source_p, kuser, khost, 1)) |
176 |
adx |
30 |
return; |
177 |
|
|
|
178 |
|
|
conf = make_conf_item(KLINE_TYPE); |
179 |
|
|
aconf = map_to_conf(conf); |
180 |
|
|
DupString(aconf->host, khost); |
181 |
|
|
DupString(aconf->user, kuser); |
182 |
|
|
|
183 |
|
|
if (tkline_time != 0) |
184 |
|
|
{ |
185 |
michael |
1233 |
snprintf(buffer, sizeof(buffer), "Temporary K-line %d min. - %s (%s)", |
186 |
|
|
(int)(tkline_time/60), kreason, current_date); |
187 |
adx |
30 |
DupString(aconf->reason, buffer); |
188 |
|
|
|
189 |
michael |
1622 |
m_kline_add_kline(source_p, aconf, tkline_time); |
190 |
adx |
30 |
} |
191 |
|
|
else |
192 |
|
|
{ |
193 |
michael |
1233 |
snprintf(buffer, sizeof(buffer), "%s (%s)", kreason, current_date); |
194 |
adx |
30 |
DupString(aconf->reason, buffer); |
195 |
|
|
|
196 |
michael |
1622 |
m_kline_add_kline(source_p, aconf, 0); |
197 |
adx |
30 |
} |
198 |
|
|
} |
199 |
|
|
} |
200 |
|
|
|
201 |
|
|
static void |
202 |
|
|
ms_kline(struct Client *client_p, struct Client *source_p, |
203 |
michael |
1058 |
int parc, char *parv[]) |
204 |
adx |
30 |
{ |
205 |
michael |
352 |
if (parc != 6 || EmptyString(parv[5])) |
206 |
adx |
30 |
return; |
207 |
|
|
|
208 |
|
|
/* parv[0] parv[1] parv[2] parv[3] parv[4] parv[5] */ |
209 |
|
|
/* oper target_server tkline_time user host reason */ |
210 |
|
|
sendto_match_servs(source_p, parv[1], CAP_KLN, |
211 |
|
|
"KLINE %s %s %s %s :%s", |
212 |
|
|
parv[1], parv[2], parv[3], parv[4], parv[5]); |
213 |
|
|
|
214 |
|
|
me_kline(client_p, source_p, parc, parv); |
215 |
|
|
} |
216 |
|
|
|
217 |
|
|
/* apply_tkline() |
218 |
|
|
* |
219 |
|
|
* inputs - |
220 |
|
|
* output - NONE |
221 |
|
|
* side effects - tkline as given is placed |
222 |
|
|
*/ |
223 |
|
|
static void |
224 |
michael |
1622 |
m_kline_add_kline(struct Client *source_p, struct AccessItem *aconf, |
225 |
|
|
time_t tkline_time) |
226 |
adx |
30 |
{ |
227 |
michael |
1622 |
aconf->setat = CurrentTime; |
228 |
adx |
30 |
|
229 |
michael |
1622 |
if (tkline_time) |
230 |
|
|
{ |
231 |
|
|
aconf->hold = CurrentTime + tkline_time; |
232 |
|
|
SetConfTemporary(aconf); |
233 |
michael |
1369 |
|
234 |
michael |
1622 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
235 |
|
|
"%s added temporary %d min. K-Line for [%s@%s] [%s]", |
236 |
|
|
get_oper_name(source_p), tkline_time/60, |
237 |
|
|
aconf->user, aconf->host, |
238 |
|
|
aconf->reason); |
239 |
|
|
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. K-Line [%s@%s]", |
240 |
|
|
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
241 |
|
|
source_p->name, tkline_time/60, aconf->user, aconf->host); |
242 |
|
|
ilog(LOG_TYPE_KLINE, "%s added temporary %d min. K-Line for [%s@%s] [%s]", |
243 |
|
|
source_p->name, tkline_time/60, |
244 |
|
|
aconf->user, aconf->host, aconf->reason); |
245 |
|
|
} |
246 |
|
|
else |
247 |
|
|
{ |
248 |
|
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
249 |
|
|
"%s added K-Line for [%s@%s] [%s]", |
250 |
|
|
get_oper_name(source_p), |
251 |
|
|
aconf->user, aconf->host, aconf->reason); |
252 |
|
|
sendto_one(source_p, ":%s NOTICE %s :Added K-Line [%s@%s]", |
253 |
|
|
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
254 |
|
|
source_p->name, aconf->user, aconf->host); |
255 |
|
|
ilog(LOG_TYPE_KLINE, "%s added K-Line for [%s@%s] [%s]", |
256 |
|
|
source_p->name, aconf->user, aconf->host, aconf->reason); |
257 |
|
|
} |
258 |
michael |
1247 |
|
259 |
michael |
1622 |
add_conf_by_address(CONF_KLINE, aconf); |
260 |
adx |
30 |
rehashed_klines = 1; |
261 |
|
|
} |
262 |
|
|
|
263 |
|
|
/* already_placed_kline() |
264 |
|
|
* inputs - user to complain to, username & host to check for |
265 |
|
|
* outputs - returns 1 on existing K-line, 0 if doesn't exist |
266 |
|
|
* side effects - notifies source_p if the K-line already exists |
267 |
|
|
*/ |
268 |
|
|
/* |
269 |
|
|
* Note: This currently works if the new K-line is a special case of an |
270 |
|
|
* existing K-line, but not the other way round. To do that we would |
271 |
|
|
* have to walk the hash and check every existing K-line. -A1kmm. |
272 |
|
|
*/ |
273 |
|
|
static int |
274 |
|
|
already_placed_kline(struct Client *source_p, const char *luser, const char *lhost, int warn) |
275 |
|
|
{ |
276 |
|
|
const char *reason; |
277 |
|
|
struct irc_ssaddr iphost, *piphost; |
278 |
|
|
struct AccessItem *aconf; |
279 |
|
|
int t; |
280 |
|
|
|
281 |
|
|
if ((t = parse_netmask(lhost, &iphost, &t)) != HM_HOST) |
282 |
|
|
{ |
283 |
|
|
#ifdef IPV6 |
284 |
|
|
if (t == HM_IPV6) |
285 |
|
|
t = AF_INET6; |
286 |
|
|
else |
287 |
|
|
#endif |
288 |
|
|
t = AF_INET; |
289 |
|
|
piphost = &iphost; |
290 |
|
|
} |
291 |
|
|
else |
292 |
|
|
{ |
293 |
|
|
t = 0; |
294 |
|
|
piphost = NULL; |
295 |
|
|
} |
296 |
|
|
|
297 |
michael |
1371 |
if ((aconf = find_conf_by_address(lhost, piphost, CONF_KLINE, t, luser, NULL, 0))) |
298 |
adx |
30 |
{ |
299 |
|
|
if (warn) |
300 |
|
|
{ |
301 |
|
|
reason = aconf->reason ? aconf->reason : "No reason"; |
302 |
|
|
sendto_one(source_p, |
303 |
|
|
":%s NOTICE %s :[%s@%s] already K-Lined by [%s@%s] - %s", |
304 |
|
|
me.name, source_p->name, luser, lhost, aconf->user, |
305 |
|
|
aconf->host, reason); |
306 |
|
|
} |
307 |
michael |
1298 |
|
308 |
|
|
return 1; |
309 |
adx |
30 |
} |
310 |
|
|
|
311 |
michael |
1298 |
return 0; |
312 |
adx |
30 |
} |
313 |
|
|
|
314 |
|
|
/* |
315 |
|
|
** mo_unkline |
316 |
|
|
** Added Aug 31, 1997 |
317 |
|
|
** common (Keith Fralick) fralick@gate.net |
318 |
|
|
** |
319 |
|
|
** parv[0] = sender |
320 |
|
|
** parv[1] = address to remove |
321 |
|
|
* |
322 |
|
|
* |
323 |
|
|
*/ |
324 |
|
|
static void |
325 |
|
|
mo_unkline(struct Client *client_p,struct Client *source_p, |
326 |
|
|
int parc, char *parv[]) |
327 |
|
|
{ |
328 |
|
|
char *target_server = NULL; |
329 |
|
|
char *user, *host; |
330 |
|
|
|
331 |
michael |
1219 |
if (!HasOFlag(source_p, OPER_FLAG_UNKLINE)) |
332 |
adx |
30 |
{ |
333 |
|
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
334 |
|
|
me.name, source_p->name, "unkline"); |
335 |
|
|
return; |
336 |
|
|
} |
337 |
|
|
|
338 |
michael |
1622 |
if (EmptyString(parv[1])) |
339 |
adx |
30 |
{ |
340 |
|
|
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
341 |
|
|
me.name, source_p->name, "UNKLINE"); |
342 |
|
|
return; |
343 |
|
|
} |
344 |
|
|
|
345 |
|
|
if (parse_aline("UNKLINE", source_p, parc, parv, 0, &user, |
346 |
|
|
&host, NULL, &target_server, NULL) < 0) |
347 |
|
|
return; |
348 |
|
|
|
349 |
|
|
if (target_server != NULL) |
350 |
|
|
{ |
351 |
|
|
sendto_match_servs(source_p, target_server, CAP_UNKLN, |
352 |
|
|
"UNKLINE %s %s %s", |
353 |
|
|
target_server, user, host); |
354 |
|
|
|
355 |
|
|
/* Allow ON to apply local unkline as well if it matches */ |
356 |
|
|
if (!match(target_server, me.name)) |
357 |
|
|
return; |
358 |
|
|
} |
359 |
|
|
else |
360 |
|
|
cluster_a_line(source_p, "UNKLINE", CAP_UNKLN, SHARED_UNKLINE, |
361 |
michael |
1058 |
"%s %s", user, host); |
362 |
adx |
30 |
|
363 |
michael |
1622 |
if (remove_kline_match(host, user)) |
364 |
adx |
30 |
{ |
365 |
|
|
sendto_one(source_p, |
366 |
michael |
1622 |
":%s NOTICE %s :K-Line for [%s@%s] is removed", |
367 |
adx |
30 |
me.name, source_p->name, user, host); |
368 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
369 |
michael |
1058 |
"%s has removed the K-Line for: [%s@%s]", |
370 |
|
|
get_oper_name(source_p), user, host); |
371 |
michael |
1247 |
ilog(LOG_TYPE_KLINE, "%s removed K-Line for [%s@%s]", |
372 |
michael |
1058 |
source_p->name, user, host); |
373 |
adx |
30 |
} |
374 |
|
|
else |
375 |
|
|
sendto_one(source_p, ":%s NOTICE %s :No K-Line for [%s@%s] found", |
376 |
|
|
me.name, source_p->name, user, host); |
377 |
|
|
} |
378 |
|
|
|
379 |
|
|
/* me_unkline() |
380 |
|
|
* |
381 |
|
|
* inputs - server |
382 |
|
|
* - client |
383 |
|
|
* - parc |
384 |
|
|
* - parv |
385 |
|
|
* outputs - none |
386 |
|
|
* side effects - if server is authorized, kline is removed |
387 |
|
|
* does not propagate message |
388 |
|
|
*/ |
389 |
|
|
static void |
390 |
|
|
me_unkline(struct Client *client_p, struct Client *source_p, |
391 |
|
|
int parc, char *parv[]) |
392 |
|
|
{ |
393 |
|
|
const char *kuser, *khost; |
394 |
|
|
|
395 |
|
|
if (parc != 4) |
396 |
|
|
return; |
397 |
|
|
|
398 |
|
|
kuser = parv[2]; |
399 |
|
|
khost = parv[3]; |
400 |
|
|
|
401 |
|
|
if (!IsClient(source_p) || !match(parv[1], me.name)) |
402 |
|
|
return; |
403 |
|
|
|
404 |
michael |
1276 |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, |
405 |
adx |
30 |
source_p->servptr->name, |
406 |
|
|
source_p->username, source_p->host, |
407 |
|
|
SHARED_UNKLINE)) |
408 |
|
|
{ |
409 |
michael |
1622 |
if (remove_kline_match(khost, kuser)) |
410 |
adx |
30 |
{ |
411 |
|
|
sendto_one(source_p, |
412 |
michael |
1622 |
":%s NOTICE %s :K-Line for [%s@%s] is removed", |
413 |
adx |
30 |
me.name, source_p->name, kuser, khost); |
414 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
415 |
michael |
1622 |
"%s has removed the K-Line for: [%s@%s]", |
416 |
adx |
30 |
get_oper_name(source_p), kuser, khost); |
417 |
michael |
1247 |
ilog(LOG_TYPE_KLINE, "%s removed K-Line for [%s@%s]", |
418 |
adx |
30 |
source_p->name, kuser, khost); |
419 |
|
|
} |
420 |
|
|
else |
421 |
|
|
sendto_one(source_p, ":%s NOTICE %s :No K-Line for [%s@%s] found", |
422 |
|
|
me.name, source_p->name, kuser, khost); |
423 |
|
|
} |
424 |
|
|
} |
425 |
|
|
|
426 |
|
|
/* ms_unkline - propagates and handles a remote unkline message */ |
427 |
|
|
static void |
428 |
|
|
ms_unkline(struct Client *client_p, struct Client *source_p, |
429 |
|
|
int parc, char *parv[]) |
430 |
|
|
{ |
431 |
|
|
if (parc != 4) |
432 |
|
|
return; |
433 |
|
|
|
434 |
|
|
sendto_match_servs(source_p, parv[1], CAP_UNKLN, |
435 |
|
|
"UNKLINE %s %s %s", |
436 |
|
|
parv[1], parv[2], parv[3]); |
437 |
|
|
|
438 |
|
|
me_unkline(client_p, source_p, parc, parv); |
439 |
|
|
} |
440 |
|
|
|
441 |
|
|
/* static int remove_tkline_match(const char *host, const char *user) |
442 |
|
|
* Input: A hostname, a username to unkline. |
443 |
|
|
* Output: returns YES on success, NO if no tkline removed. |
444 |
|
|
* Side effects: Any matching tklines are removed. |
445 |
|
|
*/ |
446 |
|
|
static int |
447 |
michael |
1622 |
remove_kline_match(const char *host, const char *user) |
448 |
adx |
30 |
{ |
449 |
michael |
1369 |
struct irc_ssaddr iphost, *piphost; |
450 |
|
|
struct AccessItem *aconf; |
451 |
|
|
int t; |
452 |
michael |
1298 |
|
453 |
michael |
1369 |
if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST) |
454 |
adx |
30 |
{ |
455 |
|
|
#ifdef IPV6 |
456 |
michael |
1369 |
if (t == HM_IPV6) |
457 |
|
|
t = AF_INET6; |
458 |
|
|
else |
459 |
adx |
30 |
#endif |
460 |
michael |
1369 |
t = AF_INET; |
461 |
|
|
piphost = &iphost; |
462 |
adx |
30 |
} |
463 |
michael |
1369 |
else |
464 |
|
|
{ |
465 |
|
|
t = 0; |
466 |
|
|
piphost = NULL; |
467 |
|
|
} |
468 |
adx |
30 |
|
469 |
michael |
1371 |
if ((aconf = find_conf_by_address(host, piphost, CONF_KLINE, t, user, NULL, 0))) |
470 |
michael |
1369 |
{ |
471 |
michael |
1622 |
if (!IsConfMain(aconf)) |
472 |
michael |
1369 |
{ |
473 |
|
|
delete_one_address_conf(host, aconf); |
474 |
|
|
return 1; |
475 |
|
|
} |
476 |
|
|
} |
477 |
|
|
|
478 |
michael |
1058 |
return 0; |
479 |
adx |
30 |
} |
480 |
michael |
1230 |
|
481 |
|
|
static struct Message kline_msgtab = { |
482 |
|
|
"KLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
483 |
|
|
{m_unregistered, m_not_oper, ms_kline, me_kline, mo_kline, m_ignore} |
484 |
|
|
}; |
485 |
|
|
|
486 |
|
|
static struct Message unkline_msgtab = { |
487 |
|
|
"UNKLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
488 |
|
|
{m_unregistered, m_not_oper, ms_unkline, me_unkline, mo_unkline, m_ignore} |
489 |
|
|
}; |
490 |
|
|
|
491 |
|
|
static void |
492 |
|
|
module_init(void) |
493 |
|
|
{ |
494 |
|
|
mod_add_cmd(&kline_msgtab); |
495 |
|
|
mod_add_cmd(&unkline_msgtab); |
496 |
|
|
add_capability("KLN", CAP_KLN, 1); |
497 |
|
|
add_capability("UNKLN", CAP_UNKLN, 1); |
498 |
|
|
} |
499 |
|
|
|
500 |
|
|
static void |
501 |
|
|
module_exit(void) |
502 |
|
|
{ |
503 |
|
|
mod_del_cmd(&kline_msgtab); |
504 |
|
|
mod_del_cmd(&unkline_msgtab); |
505 |
|
|
delete_capability("UNKLN"); |
506 |
|
|
delete_capability("KLN"); |
507 |
|
|
} |
508 |
|
|
|
509 |
|
|
struct module module_entry = { |
510 |
|
|
.node = { NULL, NULL, NULL }, |
511 |
|
|
.name = NULL, |
512 |
|
|
.version = "$Revision$", |
513 |
|
|
.handle = NULL, |
514 |
|
|
.modinit = module_init, |
515 |
|
|
.modexit = module_exit, |
516 |
|
|
.flags = 0 |
517 |
|
|
}; |