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 3780 by michael, Mon Jun 2 20:43:29 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 1103 | Line 1101 | set_default_conf(void)
1101    ConfigLoggingEntry.use_logging = 1;
1102  
1103    ConfigChannel.disable_fake_channels = 0;
1104 +
1105 +  ConfigChannel.invite_delay = 300;
1106 +  ConfigChannel.invite_delay_channel = 60;
1107    ConfigChannel.knock_delay = 300;
1108    ConfigChannel.knock_delay_channel = 60;
1109    ConfigChannel.max_chans_per_user = 25;
# Line 1148 | Line 1149 | set_default_conf(void)
1149    ConfigFileEntry.anti_spam_exit_message_time = 0;
1150    ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
1151    ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
1152 <  ConfigFileEntry.warn_no_nline = 1;
1152 >  ConfigFileEntry.warn_no_connect_block = 1;
1153 >  ConfigFileEntry.stats_e_disabled = 0;
1154    ConfigFileEntry.stats_o_oper_only = 0;
1155 <  ConfigFileEntry.stats_k_oper_only = 1;  /* masked */
1156 <  ConfigFileEntry.stats_i_oper_only = 1;  /* masked */
1155 >  ConfigFileEntry.stats_k_oper_only = 1;  /* 1 = masked */
1156 >  ConfigFileEntry.stats_i_oper_only = 1;  /* 1 = masked */
1157    ConfigFileEntry.stats_P_oper_only = 0;
1158    ConfigFileEntry.stats_u_oper_only = 0;
1159    ConfigFileEntry.caller_id_wait = 60;
# Line 1204 | Line 1206 | read_conf(FILE *file)
1206   {
1207    lineno = 0;
1208  
1209 <  set_default_conf(); /* Set default values prior to conf parsing */
1209 >  set_default_conf();  /* Set default values prior to conf parsing */
1210    conf_parser_ctx.pass = 1;
1211 <  yyparse();          /* pick up the classes first */
1211 >  yyparse();  /* Pick up the classes first */
1212  
1213    rewind(file);
1214  
1215    conf_parser_ctx.pass = 2;
1216 <  yyparse();          /* Load the values from the conf */
1217 <  validate_conf();    /* Check to make sure some values are still okay. */
1218 <                      /* Some global values are also loaded here. */
1219 <  class_delete_marked();      /* Make sure classes are valid */
1216 >  yyparse();  /* Load the values from the conf */
1217 >  validate_conf();  /* Check to make sure some values are still okay. */
1218 >                    /* Some global values are also loaded here. */
1219 >  class_delete_marked();  /* Delete unused classes that are marked for deletion */
1220   }
1221  
1222   /* lookup_confhost()
# Line 1227 | Line 1229 | lookup_confhost(struct MaskItem *conf)
1229   {
1230    struct addrinfo hints, *res;
1231  
1232 <  /* Do name lookup now on hostnames given and store the
1232 >  /*
1233 >   * Do name lookup now on hostnames given and store the
1234     * ip numbers in conf structure.
1235     */
1236    memset(&hints, 0, sizeof(hints));
# Line 1433 | Line 1436 | get_oper_name(const struct Client *clien
1436   void
1437   read_conf_files(int cold)
1438   {
1439 <  const char *filename;
1440 <  char chanmodes[IRCD_BUFSIZE];
1441 <  char chanlimit[IRCD_BUFSIZE];
1439 >  const char *filename = NULL;
1440 >  char chanmodes[IRCD_BUFSIZE] = "";
1441 >  char chanlimit[IRCD_BUFSIZE] = "";
1442  
1443    conf_parser_ctx.boot = cold;
1444    filename = ConfigFileEntry.configfile;
# Line 1485 | Line 1488 | read_conf_files(int cold)
1488             ConfigChannel.max_chans_per_user);
1489    add_isupport("CHANLIMIT", chanlimit, -1);
1490    snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,imnprstORS");
1491 <  add_isupport("CHANNELLEN", NULL, LOCAL_CHANNELLEN);
1491 >  add_isupport("CHANNELLEN", NULL, CHANNELLEN);
1492    add_isupport("TOPICLEN", NULL, ServerInfo.max_topic_length);
1493    add_isupport("CHANMODES", chanmodes, -1);
1494  
# Line 1852 | Line 1855 | parse_aline(const char *cmd, struct Clie
1855              char **target_server, char **reason)
1856   {
1857    int found_tkline_time=0;
1858 <  static char def_reason[] = "No Reason";
1858 >  static char def_reason[] = CONF_NOREASON;
1859    static char user[USERLEN*4+1];
1860    static char host[HOSTLEN*4+1];
1861  
# Line 2018 | Line 2021 | find_user_host(struct Client *source_p,
2021      /* Okay to use source_p as the first param, because source_p == client_p */
2022      if ((target_p =
2023          find_chasing(source_p, user_host_or_nick)) == NULL)
2024 <      return 0;
2024 >      return 0;  /* find_chasing sends ERR_NOSUCHNICK */
2025  
2026      if (IsExemptKline(target_p))
2027      {
# Line 2104 | Line 2107 | cluster_a_line(struct Client *source_p,
2107                 int capab, int cluster_type, const char *pattern, ...)
2108   {
2109    va_list args;
2110 <  char buffer[IRCD_BUFSIZE];
2110 >  char buffer[IRCD_BUFSIZE] = "";
2111    const dlink_node *ptr = NULL;
2112  
2113    va_start(args, pattern);
# Line 2165 | Line 2168 | split_nuh(struct split_nuh_item *const i
2168    {
2169      *p = '\0';
2170  
2171 <    if (iptr->nickptr && *iptr->nuhmask != '\0')
2171 >    if (iptr->nickptr && *iptr->nuhmask)
2172        strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize);
2173  
2174      if ((q = strchr(++p, '@')))
2175      {
2176        *q++ = '\0';
2177  
2178 <      if (*p != '\0')
2178 >      if (*p)
2179          strlcpy(iptr->userptr, p, iptr->usersize);
2180  
2181 <      if (*q != '\0')
2181 >      if (*q)
2182          strlcpy(iptr->hostptr, q, iptr->hostsize);
2183      }
2184      else
2185      {
2186 <      if (*p != '\0')
2186 >      if (*p)
2187          strlcpy(iptr->userptr, p, iptr->usersize);
2188      }
2189    }
# Line 2192 | Line 2195 | split_nuh(struct split_nuh_item *const i
2195        /* if found a @ */
2196        *p++ = '\0';
2197  
2198 <      if (*iptr->nuhmask != '\0')
2198 >      if (*iptr->nuhmask)
2199          strlcpy(iptr->userptr, iptr->nuhmask, iptr->usersize);
2200  
2201 <      if (*p != '\0')
2201 >      if (*p)
2202          strlcpy(iptr->hostptr, p, iptr->hostsize);
2203      }
2204      else

Diff Legend

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