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

Comparing ircd-hybrid/trunk/src/conf.c (file contents):
Revision 1649 by michael, Sat Nov 10 19:27:13 2012 UTC vs.
Revision 1666 by michael, Sun Nov 18 17:03:18 2012 UTC

# Line 25 | Line 25
25   #include "stdinc.h"
26   #include "list.h"
27   #include "ircd_defs.h"
28 #include "balloc.h"
28   #include "conf.h"
29   #include "s_serv.h"
30   #include "resv.h"
# Line 45 | Line 44
44   #include "send.h"
45   #include "s_gline.h"
46   #include "memory.h"
47 + #include "mempool.h"
48   #include "irc_res.h"
49   #include "userhost.h"
50   #include "s_user.h"
# Line 104 | Line 104 | struct ip_entry
104   };
105  
106   static struct ip_entry *ip_hash_table[IP_HASH_SIZE];
107 < static BlockHeap *ip_entry_heap = NULL;
107 > static mp_pool_t *ip_entry_pool = NULL;
108   static int ip_entries_count = 0;
109  
110  
# Line 654 | Line 654 | attach_iline(struct Client *client_p, st
654   void
655   init_ip_hash_table(void)
656   {
657 <  ip_entry_heap = BlockHeapCreate("ip", sizeof(struct ip_entry),
657 >  ip_entry_pool = mp_pool_new(sizeof(struct ip_entry),
658      2 * hard_fdlimit);
659    memset(ip_hash_table, 0, sizeof(ip_hash_table));
660   }
# Line 704 | Line 704 | find_or_add_ip(struct irc_ssaddr *ip_in)
704    if (ip_entries_count >= 2 * hard_fdlimit)
705      garbage_collect_ip_entries();
706  
707 <  newptr = BlockHeapAlloc(ip_entry_heap);
707 >  newptr = mp_pool_get(ip_entry_pool);
708 >  memset(newptr, 0, sizeof(*newptr));
709    ip_entries_count++;
710    memcpy(&newptr->ip, ip_in, sizeof(struct irc_ssaddr));
711  
# Line 762 | Line 763 | remove_one_ip(struct irc_ssaddr *ip_in)
763        else
764          ip_hash_table[hash_index] = ptr->next;
765  
766 <      BlockHeapFree(ip_entry_heap, ptr);
766 >      mp_pool_release(ptr);
767        ip_entries_count--;
768        return;
769      }
# Line 865 | Line 866 | garbage_collect_ip_entries(void)
866            last_ptr->next = ptr->next;
867          else
868            ip_hash_table[i] = ptr->next;
869 <        BlockHeapFree(ip_entry_heap, ptr);
869 >        mp_pool_release(ptr);
870          ip_entries_count--;
871        }
872        else
# Line 969 | Line 970 | attach_connect_block(struct Client *clie
970    {
971      conf = ptr->data;
972  
973 <    if (match(conf->name, name) == 0 || match(conf->host, host) == 0)
973 >    if (match(conf->name, name) || match(conf->host, host))
974        continue;
975  
976      attach_conf(client_p, conf);
# Line 1001 | Line 1002 | find_conf_name(dlink_list *list, const c
1002      if (conf->type == type)
1003      {
1004        if (conf->name && (irccmp(conf->name, name) == 0 ||
1005 <                         match(conf->name, name)))
1005 >                         !match(conf->name, name)))
1006        return conf;
1007      }
1008    }
# Line 1077 | Line 1078 | find_matching_name_conf(enum maskitem_ty
1078        DLINK_FOREACH(ptr, list_p->head)
1079        {
1080          conf = ptr->data;
1081 <        assert(conf->regexpname);
1081 >        assert(conf->regexuser);
1082  
1083          if (!ircd_pcre_exec(conf->regexuser, name))
1084            return conf;
# Line 1105 | Line 1106 | find_matching_name_conf(enum maskitem_ty
1106  
1107        if (EmptyString(conf->name))
1108          continue;
1109 <      if ((name != NULL) && match_esc(conf->name, name))
1109 >      if ((name != NULL) && !match(conf->name, name))
1110        {
1111          if ((user == NULL && (host == NULL)))
1112            return conf;
# Line 1113 | Line 1114 | find_matching_name_conf(enum maskitem_ty
1114            continue;
1115          if (EmptyString(conf->user) || EmptyString(conf->host))
1116            return conf;
1117 <        if (match(conf->user, user) && match(conf->host, host))
1117 >        if (!match(conf->user, user) && !match(conf->host, host))
1118            return conf;
1119        }
1120      }
# Line 1124 | Line 1125 | find_matching_name_conf(enum maskitem_ty
1125      {
1126        conf = ptr->data;
1127  
1128 <      if ((name != NULL) && match(name, conf->name))
1128 >      if ((name != NULL) && !match(name, conf->name))
1129          return conf;
1130 <      else if ((host != NULL) && match(host, conf->host))
1130 >      else if ((host != NULL) && !match(host, conf->host))
1131          return conf;
1132      }
1133      break;
# Line 1174 | Line 1175 | find_exact_name_conf(enum maskitem_type
1175            return (conf);
1176          if (EmptyString(conf->user) || EmptyString(conf->host))
1177            return (conf);
1178 <        if (match(conf->user, user) && match(conf->host, host))
1178 >        if (!match(conf->user, user) && !match(conf->host, host))
1179            return (conf);
1180        }
1181      }
# Line 1194 | Line 1195 | find_exact_name_conf(enum maskitem_type
1195            return conf;
1196          if (EmptyString(conf->user) || EmptyString(conf->host))
1197            return NULL;
1198 <        if (match(conf->user, who->username))
1198 >        if (!match(conf->user, who->username))
1199          {
1200            switch (conf->htype)
1201            {
1202              case HM_HOST:
1203 <              if (match(conf->host, who->host) || match(conf->host, who->sockhost))
1203 >              if (!match(conf->host, who->host) || !match(conf->host, who->sockhost))
1204                  if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
1205                    return conf;
1206                break;
# Line 1920 | Line 1921 | clear_out_old_conf(void)
1921   void
1922   conf_add_class_to_conf(struct MaskItem *conf, const char *class_name)
1923   {
1923  struct ClassItem *class = NULL;
1924
1924    if (class_name == NULL)
1925    {
1926      conf->class = class_default;

Diff Legend

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