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 3347 by michael, Sun Apr 20 14:03:06 2014 UTC vs.
Revision 3737 by michael, Sun Jun 1 16:11:02 2014 UTC

# Line 154 | Line 154 | conf_dns_lookup(struct MaskItem *conf)
154   struct MaskItem *
155   conf_make(enum maskitem_type type)
156   {
157 <  struct MaskItem *conf = MyMalloc(sizeof(*conf));
157 >  struct MaskItem *conf = MyCalloc(sizeof(*conf));
158    dlink_list *list = NULL;
159  
160    conf->type   = type;
# Line 403 | Line 403 | attach_iline(struct Client *client_p, st
403     * setting a_limit_reached if any limit is reached.
404     * - Dianora
405     */
406 <  if (class->max_total != 0 && class->ref_count >= class->max_total)
406 >  if (class->max_total && class->ref_count >= class->max_total)
407      a_limit_reached = 1;
408 <  else if (class->max_perip != 0 && ip_found->count > class->max_perip)
408 >  else if (class->max_perip && ip_found->count > class->max_perip)
409      a_limit_reached = 1;
410 <  else if (class->max_local != 0 && local >= class->max_local)
410 >  else if (class->max_local && local >= class->max_local)
411      a_limit_reached = 1;
412 <  else if (class->max_global != 0 && global >= class->max_global)
412 >  else if (class->max_global && global >= class->max_global)
413      a_limit_reached = 1;
414 <  else if (class->max_ident != 0 && ident >= class->max_ident &&
414 >  else if (class->max_ident && ident >= class->max_ident &&
415             client_p->username[0] != '~')
416      a_limit_reached = 1;
417  
# Line 604 | Line 604 | void
604   count_ip_hash(unsigned int *number_ips_stored, uint64_t *mem_ips_stored)
605   {
606    struct ip_entry *ptr;
607 –  int i;
607  
608    *number_ips_stored = 0;
609    *mem_ips_stored    = 0;
610  
611 <  for (i = 0; i < IP_HASH_SIZE; i++)
611 >  for (unsigned int i = 0; i < IP_HASH_SIZE; ++i)
612    {
613      for (ptr = ip_hash_table[i]; ptr; ptr = ptr->next)
614      {
# Line 631 | Line 630 | garbage_collect_ip_entries(void)
630    struct ip_entry *ptr;
631    struct ip_entry *last_ptr;
632    struct ip_entry *next_ptr;
634 –  int i;
633  
634 <  for (i = 0; i < IP_HASH_SIZE; i++)
634 >  for (unsigned int i = 0; i < IP_HASH_SIZE; ++i)
635    {
636      last_ptr = NULL;
637  
# Line 783 | Line 781 | find_conf_name(dlink_list *list, const c
781  
782      if (conf->type == type)
783      {
784 <      if (conf->name && (irccmp(conf->name, name) == 0 ||
784 >      if (conf->name && (!irccmp(conf->name, name) ||
785                           !match(conf->name, name)))
786        return conf;
787      }
# Line 1148 | Line 1146 | set_default_conf(void)
1146    ConfigFileEntry.anti_spam_exit_message_time = 0;
1147    ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
1148    ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
1149 <  ConfigFileEntry.warn_no_nline = 1;
1149 >  ConfigFileEntry.warn_no_connect_block = 1;
1150    ConfigFileEntry.stats_o_oper_only = 0;
1151 <  ConfigFileEntry.stats_k_oper_only = 1;  /* masked */
1152 <  ConfigFileEntry.stats_i_oper_only = 1;  /* masked */
1151 >  ConfigFileEntry.stats_k_oper_only = 1;  /* 1 = masked */
1152 >  ConfigFileEntry.stats_i_oper_only = 1;  /* 1 = masked */
1153    ConfigFileEntry.stats_P_oper_only = 0;
1154    ConfigFileEntry.stats_u_oper_only = 0;
1155    ConfigFileEntry.caller_id_wait = 60;
# Line 1204 | Line 1202 | read_conf(FILE *file)
1202   {
1203    lineno = 0;
1204  
1205 <  set_default_conf(); /* Set default values prior to conf parsing */
1205 >  set_default_conf();  /* Set default values prior to conf parsing */
1206    conf_parser_ctx.pass = 1;
1207 <  yyparse();          /* pick up the classes first */
1207 >  yyparse();  /* Pick up the classes first */
1208  
1209    rewind(file);
1210  
1211    conf_parser_ctx.pass = 2;
1212 <  yyparse();          /* Load the values from the conf */
1213 <  validate_conf();    /* Check to make sure some values are still okay. */
1214 <                      /* Some global values are also loaded here. */
1215 <  class_delete_marked();      /* Make sure classes are valid */
1212 >  yyparse();  /* Load the values from the conf */
1213 >  validate_conf();  /* Check to make sure some values are still okay. */
1214 >                    /* Some global values are also loaded here. */
1215 >  class_delete_marked();  /* Delete unused classes that are marked for deletion */
1216   }
1217  
1218   /* lookup_confhost()
# Line 1227 | Line 1225 | lookup_confhost(struct MaskItem *conf)
1225   {
1226    struct addrinfo hints, *res;
1227  
1228 <  /* Do name lookup now on hostnames given and store the
1228 >  /*
1229 >   * Do name lookup now on hostnames given and store the
1230     * ip numbers in conf structure.
1231     */
1232    memset(&hints, 0, sizeof(hints));
# Line 1433 | Line 1432 | get_oper_name(const struct Client *clien
1432   void
1433   read_conf_files(int cold)
1434   {
1435 <  const char *filename;
1436 <  char chanmodes[IRCD_BUFSIZE];
1437 <  char chanlimit[IRCD_BUFSIZE];
1435 >  const char *filename = NULL;
1436 >  char chanmodes[IRCD_BUFSIZE] = "";
1437 >  char chanlimit[IRCD_BUFSIZE] = "";
1438  
1439    conf_parser_ctx.boot = cold;
1440    filename = ConfigFileEntry.configfile;
# Line 1485 | Line 1484 | read_conf_files(int cold)
1484             ConfigChannel.max_chans_per_user);
1485    add_isupport("CHANLIMIT", chanlimit, -1);
1486    snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,imnprstORS");
1487 <  add_isupport("CHANNELLEN", NULL, LOCAL_CHANNELLEN);
1487 >  add_isupport("CHANNELLEN", NULL, CHANNELLEN);
1488    add_isupport("TOPICLEN", NULL, ServerInfo.max_topic_length);
1489    add_isupport("CHANMODES", chanmodes, -1);
1490  
# Line 1852 | Line 1851 | parse_aline(const char *cmd, struct Clie
1851              char **target_server, char **reason)
1852   {
1853    int found_tkline_time=0;
1854 <  static char def_reason[] = "No Reason";
1854 >  static char def_reason[] = CONF_NOREASON;
1855    static char user[USERLEN*4+1];
1856    static char host[HOSTLEN*4+1];
1857  
# Line 2018 | Line 2017 | find_user_host(struct Client *source_p,
2017      /* Okay to use source_p as the first param, because source_p == client_p */
2018      if ((target_p =
2019          find_chasing(source_p, user_host_or_nick)) == NULL)
2020 <      return 0;
2020 >      return 0;  /* find_chasing sends ERR_NOSUCHNICK */
2021  
2022      if (IsExemptKline(target_p))
2023      {
# Line 2104 | Line 2103 | cluster_a_line(struct Client *source_p,
2103                 int capab, int cluster_type, const char *pattern, ...)
2104   {
2105    va_list args;
2106 <  char buffer[IRCD_BUFSIZE];
2106 >  char buffer[IRCD_BUFSIZE] = "";
2107    const dlink_node *ptr = NULL;
2108  
2109    va_start(args, pattern);
# Line 2165 | Line 2164 | split_nuh(struct split_nuh_item *const i
2164    {
2165      *p = '\0';
2166  
2167 <    if (iptr->nickptr && *iptr->nuhmask != '\0')
2167 >    if (iptr->nickptr && *iptr->nuhmask)
2168        strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize);
2169  
2170      if ((q = strchr(++p, '@')))
2171      {
2172        *q++ = '\0';
2173  
2174 <      if (*p != '\0')
2174 >      if (*p)
2175          strlcpy(iptr->userptr, p, iptr->usersize);
2176  
2177 <      if (*q != '\0')
2177 >      if (*q)
2178          strlcpy(iptr->hostptr, q, iptr->hostsize);
2179      }
2180      else
2181      {
2182 <      if (*p != '\0')
2182 >      if (*p)
2183          strlcpy(iptr->userptr, p, iptr->usersize);
2184      }
2185    }
# Line 2192 | Line 2191 | split_nuh(struct split_nuh_item *const i
2191        /* if found a @ */
2192        *p++ = '\0';
2193  
2194 <      if (*iptr->nuhmask != '\0')
2194 >      if (*iptr->nuhmask)
2195          strlcpy(iptr->userptr, iptr->nuhmask, iptr->usersize);
2196  
2197 <      if (*p != '\0')
2197 >      if (*p)
2198          strlcpy(iptr->hostptr, p, iptr->hostsize);
2199      }
2200      else

Diff Legend

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