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 6367 by michael, Wed Aug 19 10:25:00 2015 UTC vs.
Revision 7006 by michael, Fri Jan 1 00:07:54 2016 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2015 ircd-hybrid development team
4 > *  Copyright (c) 1997-2016 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 70 | Line 70 | struct conf_parser_context conf_parser_c
70   dlink_list service_items;
71   dlink_list server_items;
72   dlink_list cluster_items;
73 < dlink_list oconf_items;
74 < dlink_list uconf_items;
75 < dlink_list xconf_items;
73 > dlink_list operator_items;
74 > dlink_list shared_items;
75 > dlink_list gecos_items;
76   dlink_list nresv_items;
77   dlink_list cresv_items;
78  
# Line 137 | Line 137 | map_to_list(enum maskitem_type type)
137    switch (type)
138    {
139      case CONF_XLINE:
140 <      return &xconf_items;
140 >      return &gecos_items;
141        break;
142 <    case CONF_ULINE:
143 <      return &uconf_items;
142 >    case CONF_SHARED:
143 >      return &shared_items;
144        break;
145      case CONF_NRESV:
146        return &nresv_items;
# Line 149 | Line 149 | map_to_list(enum maskitem_type type)
149        return &cresv_items;
150        break;
151      case CONF_OPER:
152 <      return &oconf_items;
152 >      return &operator_items;
153        break;
154      case CONF_SERVER:
155        return &server_items;
# Line 260 | Line 260 | attach_iline(struct Client *client_p, st
260    ip_found->count++;
261    AddFlag(client_p, FLAGS_IPHASH);
262  
263 <  count_user_host(client_p->username, client_p->host,
264 <                  &global, &local, &ident);
263 >  userhost_count(client_p->username, client_p->host,
264 >                 &global, &local, &ident);
265  
266    /* XXX blah. go down checking the various silly limits
267     * setting a_limit_reached if any limit is reached.
# Line 589 | Line 589 | find_matching_name_conf(enum maskitem_ty
589      break;
590  
591    case CONF_XLINE:
592 <  case CONF_ULINE:
592 >  case CONF_SHARED:
593    case CONF_NRESV:
594    case CONF_CRESV:
595      DLINK_FOREACH(node, list->head)
# Line 650 | Line 650 | find_exact_name_conf(enum maskitem_type
650    switch(type)
651    {
652    case CONF_XLINE:
653 <  case CONF_ULINE:
653 >  case CONF_SHARED:
654    case CONF_NRESV:
655    case CONF_CRESV:
656  
# Line 779 | Line 779 | set_default_conf(void)
779  
780    SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, "EECDH+HIGH:EDH+HIGH:HIGH:!aNULL");
781    ConfigServerInfo.message_digest_algorithm = EVP_sha256();
782  ConfigServerInfo.rsa_private_key = NULL;
783  ConfigServerInfo.rsa_private_key_file = NULL;
782   #endif
783  
786  /* ConfigServerInfo.name is not rehashable */
787  /* ConfigServerInfo.name = ConfigServerInfo.name; */
788  ConfigServerInfo.description = NULL;
784    ConfigServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
785    ConfigServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
786  
# Line 799 | Line 794 | set_default_conf(void)
794    ConfigServerInfo.max_topic_length = 80;
795    ConfigServerInfo.hub = 0;
796  
802  ConfigAdminInfo.name = NULL;
803  ConfigAdminInfo.email = NULL;
804  ConfigAdminInfo.description = NULL;
805
797    log_del_all();
798  
799    ConfigLog.use_logging = 1;
# Line 810 | Line 801 | set_default_conf(void)
801    ConfigChannel.disable_fake_channels = 0;
802    ConfigChannel.invite_client_count = 10;
803    ConfigChannel.invite_client_time = 300;
804 +  ConfigChannel.invite_delay_channel = 5;
805    ConfigChannel.knock_client_count = 1;
806    ConfigChannel.knock_client_time = 300;
807    ConfigChannel.knock_delay_channel = 60;
# Line 817 | Line 809 | set_default_conf(void)
809    ConfigChannel.max_bans = 25;
810    ConfigChannel.default_join_flood_count = 18;
811    ConfigChannel.default_join_flood_time = 6;
820  ConfigChannel.default_split_user_count = 0;
821  ConfigChannel.default_split_server_count = 0;
822  ConfigChannel.no_join_on_split = 0;
823  ConfigChannel.no_create_on_split = 0;
812  
813    ConfigServerHide.flatten_links = 0;
814 <  ConfigServerHide.links_delay = 300;
814 >  ConfigServerHide.flatten_links_delay = 300;
815    ConfigServerHide.hidden = 0;
816    ConfigServerHide.hide_servers = 0;
817    ConfigServerHide.hide_services = 0;
# Line 833 | Line 821 | set_default_conf(void)
821  
822    ConfigGeneral.away_count = 2;
823    ConfigGeneral.away_time = 10;
824 <  ConfigGeneral.max_watch = WATCHSIZE_DEFAULT;
824 >  ConfigGeneral.max_watch = 50;
825    ConfigGeneral.cycle_on_host_change = 1;
826    ConfigGeneral.dline_min_cidr = 16;
827    ConfigGeneral.dline_min_cidr6 = 48;
# Line 849 | Line 837 | set_default_conf(void)
837    ConfigGeneral.dots_in_ident = 0;
838    ConfigGeneral.min_nonwildcard = 4;
839    ConfigGeneral.min_nonwildcard_simple = 3;
840 <  ConfigGeneral.max_accept = 20;
840 >  ConfigGeneral.max_accept = 50;
841    ConfigGeneral.anti_nick_flood = 0;
842    ConfigGeneral.max_nick_time = 20;
843    ConfigGeneral.max_nick_changes = 5;
844    ConfigGeneral.anti_spam_exit_message_time = 0;
845 <  ConfigGeneral.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
846 <  ConfigGeneral.ts_max_delta = TS_MAX_DELTA_DEFAULT;
845 >  ConfigGeneral.ts_warn_delta = 30;
846 >  ConfigGeneral.ts_max_delta = 600;
847    ConfigGeneral.warn_no_connect_block = 1;
848    ConfigGeneral.stats_e_disabled = 0;
849    ConfigGeneral.stats_i_oper_only = 1;  /* 1 = masked */
# Line 871 | Line 859 | set_default_conf(void)
859    ConfigGeneral.short_motd = 0;
860    ConfigGeneral.ping_cookie = 0;
861    ConfigGeneral.no_oper_flood = 0;
874  ConfigGeneral.oper_pass_resv = 1;
862    ConfigGeneral.max_targets = MAX_TARGETS_DEFAULT;
863    ConfigGeneral.oper_only_umodes = UMODE_DEBUG | UMODE_LOCOPS | UMODE_HIDDEN | UMODE_FARCONNECT |
864                                     UMODE_UNAUTH | UMODE_EXTERNAL | UMODE_BOTS | UMODE_NCHANGE |
# Line 884 | Line 871 | set_default_conf(void)
871   static void
872   validate_conf(void)
873   {
887  if (ConfigGeneral.ts_warn_delta < TS_WARN_DELTA_MIN)
888    ConfigGeneral.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
889
890  if (ConfigGeneral.ts_max_delta < TS_MAX_DELTA_MIN)
891    ConfigGeneral.ts_max_delta = TS_MAX_DELTA_DEFAULT;
892
874    if (EmptyString(ConfigServerInfo.network_name))
875      ConfigServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
876  
877    if (EmptyString(ConfigServerInfo.network_desc))
878      ConfigServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
898
899  ConfigGeneral.max_watch = IRCD_MAX(ConfigGeneral.max_watch, WATCHSIZE_MIN);
879   }
880  
881   /* read_conf()
# Line 994 | Line 973 | int
973   conf_connect_allowed(struct irc_ssaddr *addr, int aftype)
974   {
975    struct ip_entry *ip_found = NULL;
976 <  struct MaskItem *const conf = find_dline_conf(addr, aftype);
998 <
999 <  /* DLINE exempt also gets you out of static limits/pacing... */
1000 <  if (conf && (conf->type == CONF_EXEMPT))
1001 <    return 0;
976 >  const struct MaskItem *conf = find_dline_conf(addr, aftype);
977  
978    if (conf)
979 +  {
980 +    /* DLINE exempt also gets you out of static limits/pacing... */
981 +    if (conf->type == CONF_EXEMPT)
982 +      return 0;
983      return BANNED_CLIENT;
984 +  }
985  
986    ip_found = ipcache_find_or_add_address(addr);
987  
# Line 1055 | Line 1035 | void
1035   cleanup_tklines(void *unused)
1036   {
1037    hostmask_expire_temporary();
1038 <  expire_tklines(&xconf_items);
1038 >  expire_tklines(&gecos_items);
1039    expire_tklines(&nresv_items);
1040    expire_tklines(&cresv_items);
1041   }
# Line 1072 | Line 1052 | static const struct oper_privs
1052    const unsigned char c;
1053   } flag_list[] = {
1054    { OPER_FLAG_ADMIN,          'A' },
1055 <  { OPER_FLAG_REMOTEBAN,      'B' },
1056 <  { OPER_FLAG_DIE,            'D' },
1057 <  { OPER_FLAG_REHASH,         'H' },
1055 >  { OPER_FLAG_CLOSE,          'B' },
1056 >  { OPER_FLAG_CONNECT,        'C' },
1057 >  { OPER_FLAG_CONNECT_REMOTE, 'D' },
1058 >  { OPER_FLAG_DIE,            'E' },
1059 >  { OPER_FLAG_DLINE,          'F' },
1060 >  { OPER_FLAG_GLOBOPS,        'G' },
1061 >  { OPER_FLAG_JOIN_RESV,      'H' },
1062 >  { OPER_FLAG_KILL,           'I' },
1063 >  { OPER_FLAG_KILL_REMOTE,    'J' },
1064    { OPER_FLAG_KLINE,          'K' },
1065 <  { OPER_FLAG_KILL,           'N' },
1066 <  { OPER_FLAG_KILL_REMOTE,    'O' },
1067 <  { OPER_FLAG_CONNECT,        'P' },
1068 <  { OPER_FLAG_CONNECT_REMOTE, 'Q' },
1069 <  { OPER_FLAG_SQUIT,          'R' },
1070 <  { OPER_FLAG_SQUIT_REMOTE,   'S' },
1071 <  { OPER_FLAG_UNKLINE,        'U' },
1072 <  { OPER_FLAG_XLINE,          'X' },
1065 >  { OPER_FLAG_LOCOPS,         'L' },
1066 >  { OPER_FLAG_MODULE,         'M' },
1067 >  { OPER_FLAG_NICK_RESV,      'N' },
1068 >  { OPER_FLAG_OPME,           'O' },
1069 >  { OPER_FLAG_REHASH,         'P' },
1070 >  { OPER_FLAG_REMOTEBAN,      'Q' },
1071 >  { OPER_FLAG_RESTART,        'R' },
1072 >  { OPER_FLAG_RESV,           'S' },
1073 >  { OPER_FLAG_SET,            'T' },
1074 >  { OPER_FLAG_SQUIT,          'U' },
1075 >  { OPER_FLAG_SQUIT_REMOTE,   'V' },
1076 >  { OPER_FLAG_UNDLINE,        'W' },
1077 >  { OPER_FLAG_UNKLINE,        'X' },
1078 >  { OPER_FLAG_UNRESV,         'Y' },
1079 >  { OPER_FLAG_UNXLINE,        'Z' },
1080 >  { OPER_FLAG_WALLOPS,        'a' },
1081 >  { OPER_FLAG_XLINE,          'b' },
1082    { 0, '\0' }
1083   };
1084  
# Line 1094 | Line 1089 | oper_privs_as_string(const unsigned int
1089    char *privs_ptr = privs_out;
1090  
1091    for (const struct oper_privs *opriv = flag_list; opriv->flag; ++opriv)
1097  {
1092      if (port & opriv->flag)
1093        *privs_ptr++ = opriv->c;
1094 <    else
1095 <      *privs_ptr++ = ToLower(opriv->c);
1096 <  }
1094 >
1095 >  if (privs_ptr == privs_out)
1096 >    *privs_ptr++ = '0';
1097  
1098    *privs_ptr = '\0';
1099  
# Line 1159 | Line 1153 | clear_out_old_conf(void)
1153   {
1154    dlink_node *node = NULL, *node_next = NULL;
1155    dlink_list *free_items [] = {
1156 <    &server_items,   &oconf_items,
1157 <     &uconf_items,   &xconf_items,
1156 >    &server_items,   &operator_items,
1157 >     &shared_items,   &gecos_items,
1158       &nresv_items, &cluster_items,  &service_items, &cresv_items, NULL
1159    };
1160  
# Line 1229 | Line 1223 | clear_out_old_conf(void)
1223    MyFree(ConfigAdminInfo.description);
1224    ConfigAdminInfo.description = NULL;
1225  
1226 +  MyFree(ConfigServerHide.flatten_links_file);
1227 +  ConfigServerHide.flatten_links_file = NULL;
1228 +
1229    /* Clean out listeners */
1230    listener_close_marked();
1231   }
# Line 1263 | Line 1260 | read_conf_files(int cold)
1260      {
1261        ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s",
1262             filename, strerror(errno));
1263 <      exit(-1);
1263 >      exit(EXIT_FAILURE);
1264      }
1265      else
1266      {
# Line 1285 | Line 1282 | read_conf_files(int cold)
1282    isupport_add("NICKLEN", NULL, ConfigServerInfo.max_nick_length);
1283    isupport_add("NETWORK", ConfigServerInfo.network_name, -1);
1284  
1285 <  snprintf(chanmodes, sizeof(chanmodes), "beI:%d", ConfigChannel.max_bans);
1285 >  snprintf(chanmodes, sizeof(chanmodes), "beI:%u", ConfigChannel.max_bans);
1286    isupport_add("MAXLIST", chanmodes, -1);
1287    isupport_add("MAXTARGETS", NULL, ConfigGeneral.max_targets);
1288    isupport_add("CHANTYPES", "#", -1);
1289  
1290 <  snprintf(chanlimit, sizeof(chanlimit), "#:%d",
1290 >  snprintf(chanlimit, sizeof(chanlimit), "#:%u",
1291             ConfigChannel.max_channels);
1292    isupport_add("CHANLIMIT", chanlimit, -1);
1293 <  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstCMORS");
1293 >  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstCMORST");
1294    isupport_add("CHANNELLEN", NULL, CHANNELLEN);
1295    isupport_add("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1296    isupport_add("CHANMODES", chanmodes, -1);
# Line 1578 | Line 1575 | find_user_host(struct Client *source_p,
1575      if (target_p->username[0] == '~')
1576        luser[0] = '*';
1577  
1578 <    if (!strcmp(target_p->sockhost, "0"))
1582 <      strlcpy(lhost, target_p->host, HOSTLEN*4 + 1);
1583 <    else
1584 <      strlcpy(lhost, target_p->sockhost, HOSTLEN*4 + 1);
1578 >    strlcpy(lhost, target_p->sockhost, HOSTLEN*4 + 1);
1579      return 1;
1580    }
1581  

Diff Legend

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