]> jfr.im git - irc/rqf/shadowircd.git/blob - src/hostmask.c
Add find_exact_conf_by_address() to find klines etc by exact mask.
[irc/rqf/shadowircd.git] / src / hostmask.c
1 /*
2 * charybdis: an advanced internet relay chat daemon (ircd).
3 * hostmask.c: Code to efficiently find IP & hostmask based configs.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
8 * Copyright (C) 2005-2006 charybdis development team
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * $Id: hostmask.c 2757 2006-11-10 22:58:15Z jilles $
26 */
27
28 #include "stdinc.h"
29 #include "memory.h"
30 #include "ircd_defs.h"
31 #include "s_conf.h"
32 #include "hostmask.h"
33 #include "numeric.h"
34 #include "send.h"
35 #include "irc_string.h"
36
37 #ifdef IPV6
38 static unsigned long hash_ipv6(struct sockaddr *, int);
39 #endif
40 static unsigned long hash_ipv4(struct sockaddr *, int);
41
42
43 /* int parse_netmask(const char *, struct irc_sockaddr_storage *, int *);
44 * Input: A hostmask, or an IPV4/6 address.
45 * Output: An integer describing whether it is an IPV4, IPV6 address or a
46 * hostmask, an address(if it is an IP mask),
47 * a bitlength(if it is IP mask).
48 * Side effects: None
49 */
50 int
51 parse_netmask(const char *text, struct sockaddr *naddr, int *nb)
52 {
53 char *ip = LOCAL_COPY(text);
54 char *ptr;
55 struct irc_sockaddr_storage *addr, xaddr;
56 int *b, xb;
57 if(nb == NULL)
58 b = &xb;
59 else
60 b = nb;
61
62 if(naddr == NULL)
63 addr = (struct irc_sockaddr_storage *)&xaddr;
64 else
65 addr = (struct irc_sockaddr_storage *)naddr;
66
67 #ifdef IPV6
68 if(strchr(ip, ':'))
69 {
70 if((ptr = strchr(ip, '/')))
71 {
72 *ptr = '\0';
73 ptr++;
74 *b = atoi(ptr);
75 if(*b > 128)
76 *b = 128;
77 } else
78 *b = 128;
79 if(inetpton_sock(ip, (struct sockaddr *)addr) > 0)
80 return HM_IPV6;
81 else
82 return HM_HOST;
83 } else
84 #endif
85 if(strchr(text, '.'))
86 {
87 if((ptr = strchr(ip, '/')))
88 {
89 *ptr = '\0';
90 ptr++;
91 *b = atoi(ptr);
92 if(*b > 32)
93 *b = 32;
94 } else
95 *b = 32;
96 if(inetpton_sock(ip, (struct sockaddr *)addr) > 0)
97 return HM_IPV4;
98 else
99 return HM_HOST;
100 }
101 return HM_HOST;
102 }
103
104 /* Hashtable stuff...now external as its used in m_stats.c */
105 struct AddressRec *atable[ATABLE_SIZE];
106
107 void
108 init_host_hash(void)
109 {
110 memset(&atable, 0, sizeof(atable));
111 }
112
113 /* unsigned long hash_ipv4(struct irc_sockaddr_storage*)
114 * Input: An IP address.
115 * Output: A hash value of the IP address.
116 * Side effects: None
117 */
118 static unsigned long
119 hash_ipv4(struct sockaddr *saddr, int bits)
120 {
121 struct sockaddr_in *addr = (struct sockaddr_in *) saddr;
122
123 if(bits != 0)
124 {
125 unsigned long av = ntohl(addr->sin_addr.s_addr) & ~((1 << (32 - bits)) - 1);
126 return (av ^ (av >> 12) ^ (av >> 24)) & (ATABLE_SIZE - 1);
127 }
128
129 return 0;
130 }
131
132 /* unsigned long hash_ipv6(struct irc_sockaddr_storage*)
133 * Input: An IP address.
134 * Output: A hash value of the IP address.
135 * Side effects: None
136 */
137 #ifdef IPV6
138 static unsigned long
139 hash_ipv6(struct sockaddr *saddr, int bits)
140 {
141 struct sockaddr_in6 *addr = (struct sockaddr_in6 *) saddr;
142 unsigned long v = 0, n;
143 for (n = 0; n < 16; n++)
144 {
145 if(bits >= 8)
146 {
147 v ^= addr->sin6_addr.s6_addr[n];
148 bits -= 8;
149 }
150 else if(bits)
151 {
152 v ^= addr->sin6_addr.s6_addr[n] & ~((1 << (8 - bits)) - 1);
153 return v & (ATABLE_SIZE - 1);
154 }
155 else
156 return v & (ATABLE_SIZE - 1);
157 }
158 return v & (ATABLE_SIZE - 1);
159 }
160 #endif
161
162 /* int hash_text(const char *start)
163 * Input: The start of the text to hash.
164 * Output: The hash of the string between 1 and (TH_MAX-1)
165 * Side-effects: None.
166 */
167 static int
168 hash_text(const char *start)
169 {
170 const char *p = start;
171 unsigned long h = 0;
172
173 while(*p)
174 {
175 h = (h << 4) - (h + (unsigned char) ToLower(*p++));
176 }
177
178 return (h & (ATABLE_SIZE - 1));
179 }
180
181 /* unsigned long get_hash_mask(const char *)
182 * Input: The text to hash.
183 * Output: The hash of the string right of the first '.' past the last
184 * wildcard in the string.
185 * Side-effects: None.
186 */
187 static unsigned long
188 get_mask_hash(const char *text)
189 {
190 const char *hp = "", *p;
191
192 for (p = text + strlen(text) - 1; p >= text; p--)
193 if(*p == '*' || *p == '?')
194 return hash_text(hp);
195 else if(*p == '.')
196 hp = p + 1;
197 return hash_text(text);
198 }
199
200 /* struct ConfItem* find_conf_by_address(const char*, struct irc_sockaddr_storage*,
201 * int type, int fam, const char *username)
202 * Input: The hostname, the address, the type of mask to find, the address
203 * family, the username.
204 * Output: The matching value with the highest precedence.
205 * Side-effects: None
206 * Note: Setting bit 0 of the type means that the username is ignored.
207 */
208 struct ConfItem *
209 find_conf_by_address(const char *name, const char *sockhost,
210 const char *orighost,
211 struct sockaddr *addr, int type, int fam,
212 const char *username)
213 {
214 unsigned long hprecv = 0;
215 struct ConfItem *hprec = NULL;
216 struct AddressRec *arec;
217 int b;
218
219 if(username == NULL)
220 username = "";
221
222 if(addr)
223 {
224 /* Check for IPV6 matches... */
225 #ifdef IPV6
226 if(fam == AF_INET6)
227 {
228
229 for (b = 128; b >= 0; b -= 16)
230 {
231 for (arec = atable[hash_ipv6(addr, b)]; arec; arec = arec->next)
232 if(arec->type == (type & ~0x1) &&
233 arec->masktype == HM_IPV6 &&
234 comp_with_mask_sock(addr, (struct sockaddr *)&arec->Mask.ipa.addr,
235 arec->Mask.ipa.bits) && (type & 0x1
236 ||
237 match(arec->
238 username,
239 username))
240 && arec->precedence > hprecv)
241 {
242 hprecv = arec->precedence;
243 hprec = arec->aconf;
244 }
245 }
246 }
247 else
248 #endif
249 if(fam == AF_INET)
250 {
251 for (b = 32; b >= 0; b -= 8)
252 {
253 for (arec = atable[hash_ipv4(addr, b)]; arec; arec = arec->next)
254 if(arec->type == (type & ~0x1) &&
255 arec->masktype == HM_IPV4 &&
256 arec->precedence > hprecv &&
257 comp_with_mask_sock(addr, (struct sockaddr *)&arec->Mask.ipa.addr,
258 arec->Mask.ipa.bits) &&
259 (type & 0x1 || match(arec->username, username)))
260 {
261 hprecv = arec->precedence;
262 hprec = arec->aconf;
263 }
264 }
265 }
266 }
267
268 if(orighost != NULL)
269 {
270 const char *p;
271
272 for (p = orighost; p != NULL;)
273 {
274 for (arec = atable[hash_text(p)]; arec; arec = arec->next)
275
276 if((arec->type == (type & ~0x1)) &&
277 (arec->masktype == HM_HOST) &&
278 arec->precedence > hprecv &&
279 match(arec->Mask.hostname, orighost) &&
280 (type & 0x1 || match(arec->username, username)))
281 {
282 hprecv = arec->precedence;
283 hprec = arec->aconf;
284 }
285 p = strchr(p, '.');
286 if(p != NULL)
287 p++;
288 else
289 break;
290 }
291 for (arec = atable[0]; arec; arec = arec->next)
292 {
293 if(arec->type == (type & ~0x1) &&
294 arec->masktype == HM_HOST &&
295 arec->precedence > hprecv &&
296 (match(arec->Mask.hostname, orighost) ||
297 (sockhost && match(arec->Mask.hostname, sockhost))) &&
298 (type & 0x1 || match(arec->username, username)))
299 {
300 hprecv = arec->precedence;
301 hprec = arec->aconf;
302 }
303 }
304 }
305
306 if(name != NULL)
307 {
308 const char *p;
309 /* And yes - we have to check p after strchr and p after increment for
310 * NULL -kre */
311 for (p = name; p != NULL;)
312 {
313 for (arec = atable[hash_text(p)]; arec; arec = arec->next)
314 if((arec->type == (type & ~0x1)) &&
315 (arec->masktype == HM_HOST) &&
316 arec->precedence > hprecv &&
317 match(arec->Mask.hostname, name) &&
318 (type & 0x1 || match(arec->username, username)))
319 {
320 hprecv = arec->precedence;
321 hprec = arec->aconf;
322 }
323 p = strchr(p, '.');
324 if(p != NULL)
325 p++;
326 else
327 break;
328 }
329 for (arec = atable[0]; arec; arec = arec->next)
330 {
331 if(arec->type == (type & ~0x1) &&
332 arec->masktype == HM_HOST &&
333 arec->precedence > hprecv &&
334 (match(arec->Mask.hostname, name) ||
335 (sockhost && match(arec->Mask.hostname, sockhost))) &&
336 (type & 0x1 || match(arec->username, username)))
337 {
338 hprecv = arec->precedence;
339 hprec = arec->aconf;
340 }
341 }
342 }
343 return hprec;
344 }
345
346 /* struct ConfItem* find_address_conf(const char*, const char*,
347 * struct irc_sockaddr_storage*, int);
348 * Input: The hostname, username, address, address family.
349 * Output: The applicable ConfItem.
350 * Side-effects: None
351 */
352 struct ConfItem *
353 find_address_conf(const char *host, const char *sockhost, const char *user,
354 const char *notildeuser, struct sockaddr *ip, int aftype)
355 {
356 struct ConfItem *iconf, *kconf;
357 const char *vuser;
358
359 /* Find the best I-line... If none, return NULL -A1kmm */
360 if(!(iconf = find_conf_by_address(host, sockhost, NULL, ip, CONF_CLIENT, aftype, user)))
361 return NULL;
362 /* Find what their visible username will be.
363 * Note that the username without tilde may contain one char more.
364 * -- jilles */
365 vuser = IsNoTilde(iconf) ? notildeuser : user;
366
367 /* If they are exempt from K-lines, return the best I-line. -A1kmm */
368 if(IsConfExemptKline(iconf))
369 return iconf;
370
371 /* Find the best K-line... -A1kmm */
372 kconf = find_conf_by_address(host, sockhost, NULL, ip, CONF_KILL, aftype, user);
373
374 /* If they are K-lined, return the K-line */
375 if(kconf)
376 return kconf;
377
378 /* if theres a spoof, check it against klines.. */
379 if(IsConfDoSpoofIp(iconf))
380 {
381 char *p = strchr(iconf->name, '@');
382
383 /* note, we dont need to pass sockhost here, as its
384 * guaranteed to not match by whats above.. --anfl
385 */
386 if(p)
387 {
388 *p = '\0';
389 kconf = find_conf_by_address(p+1, NULL, NULL, ip, CONF_KILL, aftype, iconf->name);
390 *p = '@';
391 }
392 else
393 kconf = find_conf_by_address(iconf->name, NULL, NULL, ip, CONF_KILL, aftype, vuser);
394
395 if(kconf)
396 return kconf;
397 }
398
399 /* if no_tilde, check the username without tilde against klines too
400 * -- jilles */
401 if(user != vuser)
402 {
403 kconf = find_conf_by_address(host, sockhost, NULL, ip, CONF_KILL, aftype, vuser);
404 if(kconf)
405 return kconf;
406 }
407
408 /* hunt for a gline */
409 if(ConfigFileEntry.glines)
410 {
411 kconf = find_conf_by_address(host, sockhost, NULL, ip, CONF_GLINE, aftype, user);
412
413 if((kconf != NULL) && !IsConfExemptGline(iconf))
414 return kconf;
415 }
416
417 return iconf;
418 }
419
420 /* struct ConfItem* find_dline(struct irc_sockaddr_storage*, int)
421 * Input: An address, an address family.
422 * Output: The best matching D-line or exempt line.
423 * Side effects: None.
424 */
425 struct ConfItem *
426 find_dline(struct sockaddr *addr, int aftype)
427 {
428 struct ConfItem *eline;
429 eline = find_conf_by_address(NULL, NULL, NULL, addr, CONF_EXEMPTDLINE | 1, aftype, NULL);
430 if(eline)
431 return eline;
432 return find_conf_by_address(NULL, NULL, NULL, addr, CONF_DLINE | 1, aftype, NULL);
433 }
434
435 /* void find_exact_conf_by_address(const char*, int, const char *,
436 * struct ConfItem *aconf)
437 * Input:
438 * Output: ConfItem if found
439 * Side-effects: None
440 */
441 struct ConfItem *
442 find_exact_conf_by_address(const char *address, int type, const char *username)
443 {
444 int masktype, bits;
445 unsigned long hv;
446 struct AddressRec *arec;
447 struct irc_sockaddr_storage addr;
448
449 if(address == NULL)
450 address = "/NOMATCH!/";
451 arec = MyMalloc(sizeof(struct AddressRec));
452 masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits);
453 #ifdef IPV6
454 if(masktype == HM_IPV6)
455 {
456 /* We have to do this, since we do not re-hash for every bit -A1kmm. */
457 hv = hash_ipv6((struct sockaddr *)&addr, bits - bits % 16);
458 }
459 else
460 #endif
461 if(masktype == HM_IPV4)
462 {
463 /* We have to do this, since we do not re-hash for every bit -A1kmm. */
464 hv = hash_ipv4((struct sockaddr *)&addr, bits - bits % 8);
465 }
466 else
467 {
468 hv = get_mask_hash(address);
469 }
470 for (arec = atable[hv]; arec; arec = arec->next)
471 {
472 if (arec->type == type &&
473 arec->masktype == masktype &&
474 !irccmp(arec->username, username))
475 {
476 if (masktype == HM_HOST)
477 {
478 if (!irccmp(arec->Mask.hostname, address))
479 return arec->aconf;
480 }
481 else
482 {
483 if (arec->Mask.ipa.bits == bits &&
484 comp_with_mask_sock((struct sockaddr *)&arec->Mask.ipa.addr, (struct sockaddr *)&addr, bits))
485 return arec->aconf;
486 }
487 }
488 }
489 return NULL;
490 }
491
492 /* void add_conf_by_address(const char*, int, const char *,
493 * struct ConfItem *aconf)
494 * Input:
495 * Output: None
496 * Side-effects: Adds this entry to the hash table.
497 */
498 void
499 add_conf_by_address(const char *address, int type, const char *username, struct ConfItem *aconf)
500 {
501 static unsigned long prec_value = 0xFFFFFFFF;
502 int masktype, bits;
503 unsigned long hv;
504 struct AddressRec *arec;
505
506 if(address == NULL)
507 address = "/NOMATCH!/";
508 arec = MyMalloc(sizeof(struct AddressRec));
509 masktype = parse_netmask(address, (struct sockaddr *)&arec->Mask.ipa.addr, &bits);
510 arec->Mask.ipa.bits = bits;
511 arec->masktype = masktype;
512 #ifdef IPV6
513 if(masktype == HM_IPV6)
514 {
515 /* We have to do this, since we do not re-hash for every bit -A1kmm. */
516 bits -= bits % 16;
517 arec->next = atable[(hv = hash_ipv6((struct sockaddr *)&arec->Mask.ipa.addr, bits))];
518 atable[hv] = arec;
519 }
520 else
521 #endif
522 if(masktype == HM_IPV4)
523 {
524 /* We have to do this, since we do not re-hash for every bit -A1kmm. */
525 bits -= bits % 8;
526 arec->next = atable[(hv = hash_ipv4((struct sockaddr *)&arec->Mask.ipa.addr, bits))];
527 atable[hv] = arec;
528 }
529 else
530 {
531 arec->Mask.hostname = address;
532 arec->next = atable[(hv = get_mask_hash(address))];
533 atable[hv] = arec;
534 }
535 arec->username = username;
536 arec->aconf = aconf;
537 arec->precedence = prec_value--;
538 arec->type = type;
539 }
540
541 /* void delete_one_address(const char*, struct ConfItem*)
542 * Input: An address string, the associated ConfItem.
543 * Output: None
544 * Side effects: Deletes an address record. Frees the ConfItem if there
545 * is nothing referencing it, sets it as illegal otherwise.
546 */
547 void
548 delete_one_address_conf(const char *address, struct ConfItem *aconf)
549 {
550 int masktype, bits;
551 unsigned long hv;
552 struct AddressRec *arec, *arecl = NULL;
553 struct irc_sockaddr_storage addr;
554 masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits);
555 #ifdef IPV6
556 if(masktype == HM_IPV6)
557 {
558 /* We have to do this, since we do not re-hash for every bit -A1kmm. */
559 bits -= bits % 16;
560 hv = hash_ipv6((struct sockaddr *)&addr, bits);
561 }
562 else
563 #endif
564 if(masktype == HM_IPV4)
565 {
566 /* We have to do this, since we do not re-hash for every bit -A1kmm. */
567 bits -= bits % 8;
568 hv = hash_ipv4((struct sockaddr *)&addr, bits);
569 }
570 else
571 hv = get_mask_hash(address);
572 for (arec = atable[hv]; arec; arec = arec->next)
573 {
574 if(arec->aconf == aconf)
575 {
576 if(arecl)
577 arecl->next = arec->next;
578 else
579 atable[hv] = arec->next;
580 aconf->status |= CONF_ILLEGAL;
581 if(!aconf->clients)
582 free_conf(aconf);
583 MyFree(arec);
584 return;
585 }
586 arecl = arec;
587 }
588 }
589
590 /* void clear_out_address_conf(void)
591 * Input: None
592 * Output: None
593 * Side effects: Clears out all address records in the hash table,
594 * frees them, and frees the ConfItems if nothing references
595 * them, otherwise sets them as illegal.
596 */
597 void
598 clear_out_address_conf(void)
599 {
600 int i;
601 struct AddressRec **store_next;
602 struct AddressRec *arec, *arecn;
603
604 for (i = 0; i < ATABLE_SIZE; i++)
605 {
606 store_next = &atable[i];
607 for (arec = atable[i]; arec; arec = arecn)
608 {
609 arecn = arec->next;
610 /* We keep the temporary K-lines and destroy the
611 * permanent ones, just to be confusing :) -A1kmm */
612 if(arec->aconf->flags & CONF_FLAGS_TEMPORARY ||
613 (arec->type != CONF_CLIENT && arec->type != CONF_EXEMPTDLINE))
614 {
615 *store_next = arec;
616 store_next = &arec->next;
617 }
618 else
619 {
620 arec->aconf->status |= CONF_ILLEGAL;
621 if(!arec->aconf->clients)
622 free_conf(arec->aconf);
623 MyFree(arec);
624 }
625 }
626 *store_next = NULL;
627 }
628 }
629
630 void
631 clear_out_address_conf_bans(void)
632 {
633 int i;
634 struct AddressRec **store_next;
635 struct AddressRec *arec, *arecn;
636
637 for (i = 0; i < ATABLE_SIZE; i++)
638 {
639 store_next = &atable[i];
640 for (arec = atable[i]; arec; arec = arecn)
641 {
642 arecn = arec->next;
643 /* We keep the temporary K-lines and destroy the
644 * permanent ones, just to be confusing :) -A1kmm */
645 if(arec->aconf->flags & CONF_FLAGS_TEMPORARY ||
646 (arec->type == CONF_CLIENT || arec->type == CONF_EXEMPTDLINE))
647 {
648 *store_next = arec;
649 store_next = &arec->next;
650 }
651 else
652 {
653 arec->aconf->status |= CONF_ILLEGAL;
654 if(!arec->aconf->clients)
655 free_conf(arec->aconf);
656 MyFree(arec);
657 }
658 }
659 *store_next = NULL;
660 }
661 }
662
663
664 /*
665 * show_iline_prefix()
666 *
667 * inputs - pointer to struct Client requesting output
668 * - pointer to struct ConfItem
669 * - name to which iline prefix will be prefixed to
670 * output - pointer to static string with prefixes listed in ascii form
671 * side effects - NONE
672 */
673 char *
674 show_iline_prefix(struct Client *sptr, struct ConfItem *aconf, char *name)
675 {
676 static char prefix_of_host[USERLEN + 15];
677 char *prefix_ptr;
678
679 prefix_ptr = prefix_of_host;
680 if(IsNoTilde(aconf))
681 *prefix_ptr++ = '-';
682 if(IsLimitIp(aconf))
683 *prefix_ptr++ = '!';
684 if(IsNeedIdentd(aconf))
685 *prefix_ptr++ = '+';
686 if(IsPassIdentd(aconf))
687 *prefix_ptr++ = '$';
688 if(IsNoMatchIp(aconf))
689 *prefix_ptr++ = '%';
690 if(IsConfDoSpoofIp(aconf))
691 *prefix_ptr++ = '=';
692 if(MyOper(sptr) && IsConfExemptKline(aconf))
693 *prefix_ptr++ = '^';
694 if(MyOper(sptr) && IsConfExemptLimits(aconf))
695 *prefix_ptr++ = '>';
696 if(MyOper(sptr) && IsConfIdlelined(aconf))
697 *prefix_ptr++ = '<';
698 *prefix_ptr = '\0';
699 strncpy(prefix_ptr, name, USERLEN);
700 return (prefix_of_host);
701 }
702
703 /* report_auth()
704 *
705 * Inputs: pointer to client to report to
706 * Output: None
707 * Side effects: Reports configured auth{} blocks to client_p
708 */
709 void
710 report_auth(struct Client *client_p)
711 {
712 char *name, *host, *pass, *user, *classname;
713 struct AddressRec *arec;
714 struct ConfItem *aconf;
715 int i, port;
716
717 for (i = 0; i < ATABLE_SIZE; i++)
718 for (arec = atable[i]; arec; arec = arec->next)
719 if(arec->type == CONF_CLIENT)
720 {
721 aconf = arec->aconf;
722
723 if(!MyOper(client_p) && IsConfDoSpoofIp(aconf))
724 continue;
725
726 get_printable_conf(aconf, &name, &host, &pass, &user, &port,
727 &classname);
728
729 sendto_one_numeric(client_p, RPL_STATSILINE,
730 form_str(RPL_STATSILINE),
731 name, show_iline_prefix(client_p, aconf, user),
732 show_ip_conf(aconf, client_p) ? host : "255.255.255.255",
733 port, classname);
734 }
735 }
736
737 /* report_Klines()
738 *
739 * inputs - Client to report to, mask
740 * outputs -
741 * side effects - Reports configured K-lines to client_p.
742 */
743 void
744 report_Klines(struct Client *source_p)
745 {
746 char *host, *pass, *user, *oper_reason;
747 struct AddressRec *arec;
748 struct ConfItem *aconf = NULL;
749 int i;
750
751 for (i = 0; i < ATABLE_SIZE; i++)
752 {
753 for (arec = atable[i]; arec; arec = arec->next)
754 {
755 if(arec->type == CONF_KILL)
756 {
757 aconf = arec->aconf;
758
759 /* its a tempkline, theyre reported elsewhere */
760 if(aconf->flags & CONF_FLAGS_TEMPORARY)
761 continue;
762
763 get_printable_kline(source_p, aconf, &host, &pass, &user, &oper_reason);
764 sendto_one_numeric(source_p, RPL_STATSKLINE,
765 form_str(RPL_STATSKLINE),
766 'K', host, user, pass,
767 oper_reason ? "|" : "",
768 oper_reason ? oper_reason : "");
769 }
770 }
771 }
772 }