| 1 |
|
/* |
| 2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
< |
* hostmask.c: Code to efficiently find IP & hostmask based configs. |
| 2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (C) 2005 by the past and present ircd coders, and others. |
| 4 |
> |
* Copyright (c) 2001-2014 ircd-hybrid development team |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or modify |
| 7 |
|
* it under the terms of the GNU General Public License as published by |
| 17 |
|
* along with this program; if not, write to the Free Software |
| 18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 19 |
|
* USA |
| 20 |
< |
* |
| 21 |
< |
* $Id$ |
| 20 |
> |
*/ |
| 21 |
> |
|
| 22 |
> |
/*! \file hostmask.c |
| 23 |
> |
* \brief Code to efficiently find IP & hostmask based configs. |
| 24 |
> |
* \version $Id$ |
| 25 |
|
*/ |
| 26 |
|
|
| 27 |
|
#include "stdinc.h" |
| 53 |
|
* Side effects: None |
| 54 |
|
* Comments: Called from parse_netmask |
| 55 |
|
*/ |
| 56 |
< |
/* Fixed so ::/0 (any IPv6 address) is valid |
| 56 |
> |
/* Fixed so ::/0 (any IPv6 address) is valid |
| 57 |
|
Also a bug in DigitParse above. |
| 58 |
|
-Gozem 2002-07-19 gozem@linux.nu |
| 59 |
|
*/ |
| 479 |
|
{ |
| 480 |
|
DLINK_FOREACH(ptr, atable[hash_ipv6(addr, b)].head) |
| 481 |
|
{ |
| 482 |
< |
arec = ptr->data; |
| 482 |
> |
arec = ptr->data; |
| 483 |
|
|
| 484 |
|
if (arec->type == (type & ~0x1) && |
| 485 |
|
arec->precedence > hprecv && |
| 487 |
|
match_ipv6(addr, &arec->Mask.ipa.addr, |
| 488 |
|
arec->Mask.ipa.bits) && |
| 489 |
|
(type & 0x1 || !cmpfunc(arec->username, username)) && |
| 490 |
< |
(IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || |
| 491 |
< |
match_conf_password(password, arec->conf))) |
| 490 |
> |
(IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || |
| 491 |
> |
match_conf_password(password, arec->conf))) |
| 492 |
|
{ |
| 493 |
|
hprecv = arec->precedence; |
| 494 |
|
hprec = arec->conf; |
| 512 |
|
match_ipv4(addr, &arec->Mask.ipa.addr, |
| 513 |
|
arec->Mask.ipa.bits) && |
| 514 |
|
(type & 0x1 || !cmpfunc(arec->username, username)) && |
| 515 |
< |
(IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || |
| 516 |
< |
match_conf_password(password, arec->conf))) |
| 515 |
> |
(IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || |
| 516 |
> |
match_conf_password(password, arec->conf))) |
| 517 |
|
{ |
| 518 |
|
hprecv = arec->precedence; |
| 519 |
|
hprec = arec->conf; |
| 632 |
|
} |
| 633 |
|
|
| 634 |
|
/* void add_conf_by_address(int, struct MaskItem *aconf) |
| 635 |
< |
* Input: |
| 635 |
> |
* Input: |
| 636 |
|
* Output: None |
| 637 |
|
* Side-effects: Adds this entry to the hash table. |
| 638 |
|
*/ |
| 739 |
|
* Output: None |
| 740 |
|
* Side effects: Clears out all address records in the hash table, |
| 741 |
|
* frees them, and frees the MaskItems if nothing references |
| 742 |
< |
* them, otherwise sets them as illegal. |
| 742 |
> |
* them, otherwise sets them as illegal. |
| 743 |
|
*/ |
| 744 |
|
void |
| 745 |
|
clear_out_address_conf(void) |
| 746 |
|
{ |
| 747 |
|
unsigned int i = 0; |
| 748 |
|
dlink_node *ptr = NULL, *ptr_next = NULL; |
| 749 |
< |
|
| 749 |
> |
|
| 750 |
|
for (i = 0; i < ATABLE_SIZE; ++i) |
| 751 |
|
{ |
| 752 |
|
DLINK_FOREACH_SAFE(ptr, ptr_next, atable[i].head) |
| 790 |
|
break; |
| 791 |
|
default: break; |
| 792 |
|
} |
| 793 |
< |
|
| 793 |
> |
|
| 794 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 795 |
|
"Temporary %c-line for [%s@%s] expired", ban_type, |
| 796 |
|
(arec->conf->user) ? arec->conf->user : "*", |