| 31 |
|
#include "numeric.h" |
| 32 |
|
#include "send.h" |
| 33 |
|
#include "irc_string.h" |
| 34 |
+ |
#include "ircd.h" |
| 35 |
|
|
| 36 |
|
#ifdef IPV6 |
| 37 |
|
static int try_parse_v6_netmask(const char *, struct irc_ssaddr *, int *); |
| 454 |
|
* should always be true (i.e. aconf->flags & CONF_FLAGS_NEED_PASSWORD == 0) |
| 455 |
|
*/ |
| 456 |
|
struct AccessItem * |
| 457 |
< |
find_conf_by_address(const char *name, struct irc_ssaddr *addr, int type, |
| 457 |
> |
find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int type, |
| 458 |
|
int fam, const char *username, const char *password) |
| 459 |
|
{ |
| 460 |
|
unsigned int hprecv = 0; |
| 592 |
|
return iconf; |
| 593 |
|
|
| 594 |
|
/* Find the best K-line... -A1kmm */ |
| 595 |
< |
kconf = find_conf_by_address(host, ip, CONF_KILL, aftype, user, NULL); |
| 595 |
> |
kconf = find_conf_by_address(host, ip, CONF_KLINE, aftype, user, NULL); |
| 596 |
|
|
| 597 |
|
/* If they are K-lined, return the K-line. Otherwise, return the |
| 598 |
|
* I-line. -A1kmm */ |
| 639 |
|
if (eline != NULL) |
| 640 |
|
return eline; |
| 641 |
|
|
| 642 |
< |
return find_conf_by_address(host, ip, CONF_KILL, aftype, user, NULL); |
| 642 |
> |
return find_conf_by_address(host, ip, CONF_KLINE, aftype, user, NULL); |
| 643 |
|
} |
| 644 |
|
|
| 645 |
|
/* struct AccessItem* find_dline_conf(struct irc_ssaddr*, int) |
| 802 |
|
} |
| 803 |
|
} |
| 804 |
|
|
| 805 |
+ |
static void |
| 806 |
+ |
hostmask_send_expiration(struct AddressRec *arec) |
| 807 |
+ |
{ |
| 808 |
+ |
char ban_type = '\0'; |
| 809 |
+ |
|
| 810 |
+ |
if (!ConfigFileEntry.tkline_expire_notices) |
| 811 |
+ |
return; |
| 812 |
+ |
|
| 813 |
+ |
switch (arec->type) |
| 814 |
+ |
{ |
| 815 |
+ |
case CONF_KLINE: |
| 816 |
+ |
ban_type = 'K'; |
| 817 |
+ |
break; |
| 818 |
+ |
case CONF_DLINE: |
| 819 |
+ |
ban_type = 'D'; |
| 820 |
+ |
break; |
| 821 |
+ |
case CONF_GLINE: |
| 822 |
+ |
ban_type = 'G'; |
| 823 |
+ |
break; |
| 824 |
+ |
} |
| 825 |
+ |
|
| 826 |
+ |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 827 |
+ |
"Temporary %c-line for [%s@%s] expired", ban_type, |
| 828 |
+ |
(arec->aconf->user) ? arec->aconf->user : "*", |
| 829 |
+ |
(arec->aconf->host) ? arec->aconf->host : "*"); |
| 830 |
+ |
} |
| 831 |
+ |
|
| 832 |
+ |
void |
| 833 |
+ |
hostmask_expire_temporary(void) |
| 834 |
+ |
{ |
| 835 |
+ |
unsigned int i = 0; |
| 836 |
+ |
dlink_node *ptr = NULL, *ptr_next = NULL; |
| 837 |
+ |
|
| 838 |
+ |
for (i = 0; i < ATABLE_SIZE; ++i) |
| 839 |
+ |
{ |
| 840 |
+ |
ptr = ptr_next = NULL; |
| 841 |
+ |
|
| 842 |
+ |
DLINK_FOREACH_SAFE(ptr, ptr_next, atable[i].head) |
| 843 |
+ |
{ |
| 844 |
+ |
struct AddressRec *arec = ptr->data; |
| 845 |
+ |
|
| 846 |
+ |
if (!IsConfTemporary(arec->aconf) || arec->aconf->hold > CurrentTime) |
| 847 |
+ |
continue; |
| 848 |
+ |
|
| 849 |
+ |
switch (arec->type) |
| 850 |
+ |
{ |
| 851 |
+ |
case CONF_KLINE: |
| 852 |
+ |
case CONF_DLINE: |
| 853 |
+ |
case CONF_GLINE: |
| 854 |
+ |
hostmask_send_expiration(arec); |
| 855 |
+ |
|
| 856 |
+ |
dlinkDelete(&arec->node, &atable[i]); |
| 857 |
+ |
free_access_item(arec->aconf); |
| 858 |
+ |
MyFree(arec); |
| 859 |
+ |
break; |
| 860 |
+ |
} |
| 861 |
+ |
} |
| 862 |
+ |
} |
| 863 |
+ |
} |
| 864 |
+ |
|
| 865 |
|
/* |
| 866 |
|
* show_iline_prefix() |
| 867 |
|
* |
| 989 |
|
{ |
| 990 |
|
struct AddressRec *arec = ptr->data; |
| 991 |
|
|
| 992 |
< |
if (arec->type == CONF_KILL) |
| 992 |
> |
if (arec->type == CONF_KLINE) |
| 993 |
|
{ |
| 994 |
|
if ((tkline && !((aconf = arec->aconf)->flags & CONF_FLAGS_TEMPORARY)) || |
| 995 |
|
(!tkline && ((aconf = arec->aconf)->flags & CONF_FLAGS_TEMPORARY))) |