ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/hostmask.c
(Generate patch)

Comparing ircd-hybrid-8/src/hostmask.c (file contents):
Revision 1367 by michael, Tue Apr 24 21:20:54 2012 UTC vs.
Revision 1369 by michael, Wed Apr 25 19:04:19 2012 UTC

# Line 31 | Line 31
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 *);
# Line 453 | Line 454 | get_mask_hash(const char *text)
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;
# Line 591 | Line 592 | find_address_conf(const char *host, cons
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 */
# Line 638 | Line 639 | find_kline_conf(const char *host, const
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)
# Line 801 | Line 802 | clear_out_address_conf(void)
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   *
# Line 928 | Line 989 | report_Klines(struct Client *client_p, i
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)))

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)