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-8/src/conf.c (file contents):
Revision 1389 by michael, Tue May 1 13:08:29 2012 UTC vs.
Revision 1490 by michael, Sat Jul 28 19:33:23 2012 UTC

# Line 66 | Line 66 | dlink_list rxconf_items  = { NULL, NULL,
66   dlink_list rkconf_items  = { NULL, NULL, 0 };
67   dlink_list nresv_items   = { NULL, NULL, 0 };
68   dlink_list class_items   = { NULL, NULL, 0 };
69 dlink_list gdeny_items   = { NULL, NULL, 0 };
69  
70   dlink_list temporary_xlines  = { NULL, NULL, 0 };
71   dlink_list temporary_resv = { NULL, NULL, 0 };
# Line 255 | Line 254 | make_conf_item(ConfType type)
254      dlinkAdd(conf, &conf->node, &uconf_items);
255      break;
256  
258  case GDENY_TYPE:
259    conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem) +
260                                       sizeof(struct AccessItem));
261    dlinkAdd(conf, &conf->node, &gdeny_items);
262    break;
263
257    case XLINE_TYPE:
258      conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem) +
259                                         sizeof(struct MatchItem));
# Line 364 | Line 357 | delete_conf_item(struct ConfItem *conf)
357      MyFree(aconf->oper_reason);
358      MyFree(aconf->user);
359      MyFree(aconf->host);
367    MyFree(aconf->cipher_list);
360   #ifdef HAVE_LIBCRYPTO
361 +    MyFree(aconf->cipher_list);
362 +
363      if (aconf->rsa_public_key)
364        RSA_free(aconf->rsa_public_key);
365      MyFree(aconf->rsa_public_key_file);
# Line 472 | Line 466 | delete_conf_item(struct ConfItem *conf)
466      MyFree(conf);
467      break;
468  
475  case GDENY_TYPE:
476    aconf = map_to_conf(conf);
477    MyFree(aconf->user);
478    MyFree(aconf->host);
479    dlinkDelete(&conf->node, &gdeny_items);
480    MyFree(conf);
481    break;
482
469    case CLUSTER_TYPE:
470      dlinkDelete(&conf->node, &cluster_items);
471      MyFree(conf);
# Line 548 | Line 534 | report_confitem_types(struct Client *sou
534  
535    switch (type)
536    {
551  case GDENY_TYPE:
552    DLINK_FOREACH(ptr, gdeny_items.head)
553    {
554      conf = ptr->data;
555      aconf = map_to_conf(conf);
556
557      p = buf;
558
559      if (aconf->flags & GDENY_BLOCK)
560        *p++ = 'B';
561      else
562        *p++ = 'b';
563
564      if (aconf->flags & GDENY_REJECT)
565        *p++ = 'R';
566      else
567        *p++ = 'r';
568
569      *p = '\0';
570
571      sendto_one(source_p, ":%s %d %s V %s@%s %s %s",
572                 me.name, RPL_STATSDEBUG, source_p->name,
573                 aconf->user, aconf->host, conf->name, buf);
574    }
575    break;
576
537    case XLINE_TYPE:
538      DLINK_FOREACH(ptr, xconf_items.head)
539      {
# Line 680 | Line 640 | report_confitem_types(struct Client *sou
640                   classitem->con_freq,
641                   classitem->max_total, classitem->max_sendq,
642                   classitem->curr_user_count,
643 +                 classitem->number_per_cidr, classitem->cidr_bitlen_ipv4,
644 +                 classitem->number_per_cidr, classitem->cidr_bitlen_ipv6,
645                   classitem->active ? "active" : "disabled");
646      }
647      break;
# Line 1325 | Line 1287 | detach_conf(struct Client *client_p, Con
1287   int
1288   attach_conf(struct Client *client_p, struct ConfItem *conf)
1289   {
1290 +  struct AccessItem *aconf = map_to_conf(conf);
1291 +  struct ClassItem *aclass = map_to_conf(aconf->class_ptr);
1292 +
1293    if (dlinkFind(&client_p->localClient->confs, conf) != NULL)
1294      return 1;
1295  
1296 <  if (conf->type == CLIENT_TYPE ||
1297 <      conf->type == SERVER_TYPE ||
1333 <      conf->type == OPER_TYPE)
1334 <  {
1335 <    struct AccessItem *aconf = map_to_conf(conf);
1336 <    struct ClassItem *aclass = map_to_conf(aconf->class_ptr);
1296 >  if (IsConfIllegal(aconf)) /* TBV: can't happen */
1297 >    return NOT_AUTHORIZED;
1298  
1299 <    if (IsConfIllegal(aconf))
1300 <      return NOT_AUTHORIZED;
1299 >  if (conf->type == CLIENT_TYPE)
1300 >    if (cidr_limit_reached(IsConfExemptLimits(aconf),
1301 >                           &client_p->localClient->ip, aclass))
1302 >      return TOO_MANY;    /* Already at maximum allowed */
1303  
1304 <    if (conf->type == CLIENT_TYPE)
1305 <      if (cidr_limit_reached(IsConfExemptLimits(aconf),
1343 <                             &client_p->localClient->ip, aclass))
1344 <        return TOO_MANY;    /* Already at maximum allowed */
1345 <
1346 <    aclass->curr_user_count++;
1347 <    aconf->clients++;
1348 <  }
1304 >  aclass->curr_user_count++;
1305 >  aconf->clients++;
1306  
1307    dlinkAdd(conf, make_dlink_node(), &client_p->localClient->confs);
1308  
# Line 1827 | Line 1784 | set_default_conf(void)
1784  
1785    ConfigChannel.disable_fake_channels = 0;
1786    ConfigChannel.restrict_channels = 0;
1830  ConfigChannel.disable_local_channels = 0;
1787    ConfigChannel.use_invex = 1;
1788    ConfigChannel.use_except = 1;
1789    ConfigChannel.use_knock = 1;
1790    ConfigChannel.knock_delay = 300;
1791    ConfigChannel.knock_delay_channel = 60;
1792 <  ConfigChannel.max_chans_per_user = 15;
1792 >  ConfigChannel.max_chans_per_user = 25;
1793 >  ConfigChannel.max_chans_per_oper = 50;
1794    ConfigChannel.quiet_on_ban = 1;
1795    ConfigChannel.max_bans = 25;
1796    ConfigChannel.default_split_user_count = 0;
1797    ConfigChannel.default_split_server_count = 0;
1798    ConfigChannel.no_join_on_split = 0;
1799    ConfigChannel.no_create_on_split = 0;
1843  ConfigChannel.burst_topicwho = 1;
1800  
1801    ConfigServerHide.flatten_links = 0;
1802    ConfigServerHide.links_delay = 300;
1803    ConfigServerHide.hidden = 0;
1848  ConfigServerHide.disable_hidden = 0;
1804    ConfigServerHide.hide_servers = 0;
1805    DupString(ConfigServerHide.hidden_name, NETWORK_NAME_DEFAULT);
1806    ConfigServerHide.hide_server_ips = 0;
# Line 1853 | Line 1808 | set_default_conf(void)
1808    
1809    DupString(ConfigFileEntry.service_name, SERVICE_NAME_DEFAULT);
1810    ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT;
1811 +  ConfigFileEntry.glines = 0;
1812 +  ConfigFileEntry.gline_time = 12 * 3600;
1813 +  ConfigFileEntry.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
1814    ConfigFileEntry.gline_min_cidr = 16;
1815    ConfigFileEntry.gline_min_cidr6 = 48;
1816    ConfigFileEntry.invisible_on_connect = 1;
# Line 1892 | Line 1850 | set_default_conf(void)
1850    ConfigFileEntry.no_oper_flood = 0;
1851    ConfigFileEntry.true_no_oper_flood = 0;
1852    ConfigFileEntry.oper_pass_resv = 1;
1895  ConfigFileEntry.glines = 0;
1896  ConfigFileEntry.gline_time = 12 * 3600;
1853    ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
1854    ConfigFileEntry.client_flood = CLIENT_FLOOD_DEFAULT;
1855    ConfigFileEntry.oper_only_umodes = UMODE_DEBUG;
# Line 1966 | Line 1922 | lookup_confhost(struct ConfItem *conf)
1922  
1923    aconf = map_to_conf(conf);
1924  
1925 <  if (EmptyString(aconf->host) ||
1970 <      EmptyString(aconf->user))
1925 >  if (has_wildcards(aconf->host))
1926    {
1927      ilog(LOG_TYPE_IRCD, "Host/server name error: (%s) (%s)",
1928           aconf->host, conf->name);
1929      return;
1930    }
1931  
1977  if (strchr(aconf->host, '*') ||
1978      strchr(aconf->host, '?'))
1979    return;
1980
1932    /* Do name lookup now on hostnames given and store the
1933     * ip numbers in conf structure.
1934     */
# Line 2077 | Line 2028 | find_kill(struct Client *client_p)
2028  
2029    assert(client_p != NULL);
2030  
2031 <  aconf = find_kline_conf(client_p->host, client_p->username,
2032 <                          &client_p->localClient->ip,
2033 <                          client_p->localClient->aftype);
2031 >  aconf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
2032 >                               CONF_KLINE, client_p->localClient->aftype,
2033 >                               client_p->username, NULL, 1);
2034    if (aconf == NULL)
2035      aconf = find_regexp_kline(uhi);
2036  
2037 <  if (aconf && (aconf->status & CONF_KLINE))
2087 <    return aconf;
2088 <
2089 <  return NULL;
2037 >  return aconf;
2038   }
2039  
2040   struct AccessItem *
# Line 2096 | Line 2044 | find_gline(struct Client *client_p)
2044  
2045    assert(client_p != NULL);
2046  
2047 <  aconf = find_gline_conf(client_p->host, client_p->username,
2048 <                          &client_p->localClient->ip,
2049 <                          client_p->localClient->aftype);
2050 <
2103 <  if (aconf && (aconf->status & CONF_GLINE))
2104 <    return aconf;
2105 <
2106 <  return NULL;
2047 >  aconf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
2048 >                               CONF_GLINE, client_p->localClient->aftype,
2049 >                               client_p->username, NULL, 1);
2050 >  return aconf;
2051   }
2052  
2053   /* add_temp_line()
# Line 2343 | Line 2287 | read_conf_files(int cold)
2287    add_isupport("MAXLIST", chanmodes, -1);
2288    add_isupport("MAXTARGETS", NULL, ConfigFileEntry.max_targets);
2289  
2290 <  if (ConfigChannel.disable_local_channels)
2347 <    add_isupport("CHANTYPES", "#", -1);
2348 <  else
2349 <    add_isupport("CHANTYPES", "#&", -1);
2290 >  add_isupport("CHANTYPES", "#", -1);
2291  
2292 <  snprintf(chanlimit, sizeof(chanlimit), "%s:%d",
2352 <           ConfigChannel.disable_local_channels ? "#" : "#&",
2292 >  snprintf(chanlimit, sizeof(chanlimit), "#:%d",
2293             ConfigChannel.max_chans_per_user);
2294    add_isupport("CHANLIMIT", chanlimit, -1);
2295    snprintf(chanmodes, sizeof(chanmodes), "%s%s%s",
# Line 2426 | Line 2366 | clear_out_old_conf(void)
2366    dlink_list *free_items [] = {
2367      &server_items,   &oconf_items,
2368       &uconf_items,   &xconf_items, &rxconf_items, &rkconf_items,
2369 <     &nresv_items, &cluster_items,  &gdeny_items, &service_items, NULL
2369 >     &nresv_items, &cluster_items,  &service_items, NULL
2370    };
2371  
2372    dlink_list ** iterator = free_items; /* C is dumb */
# Line 3316 | Line 3256 | match_conf_password(const char *password
3256   {
3257    const char *encr = NULL;
3258  
3259 <  if (password == NULL || aconf->passwd == NULL)
3259 >  if (EmptyString(password) || EmptyString(aconf->passwd))
3260      return 0;
3261  
3262    if (aconf->flags & CONF_FLAGS_ENCRYPTED)
3263 <  {
3324 <    /* use first two chars of the password they send in as salt */
3325 <    /* If the password in the conf is MD5, and ircd is linked
3326 <     * to scrypt on FreeBSD, or the standard crypt library on
3327 <     * glibc Linux, then this code will work fine on generating
3328 <     * the proper encrypted hash for comparison.
3329 <     */
3330 <    if (*aconf->passwd)
3331 <      encr = crypt(password, aconf->passwd);
3332 <    else
3333 <      encr = "";
3334 <  }
3263 >    encr = crypt(password, aconf->passwd);
3264    else
3265      encr = password;
3266  

Diff Legend

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