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 7159 by michael, Thu Jan 28 11:26:51 2016 UTC vs.
Revision 8310 by michael, Wed Feb 28 16:46:13 2018 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2016 ircd-hybrid development team
4 > *  Copyright (c) 1997-2018 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 28 | Line 28
28   #include "list.h"
29   #include "ircd_defs.h"
30   #include "conf.h"
31 + #include "conf_cluster.h"
32 + #include "conf_gecos.h"
33   #include "conf_pseudo.h"
34 + #include "conf_resv.h"
35 + #include "conf_service.h"
36 + #include "conf_shared.h"
37   #include "server.h"
33 #include "resv.h"
38   #include "channel.h"
39   #include "client.h"
40   #include "event.h"
# Line 56 | Line 60
60   #include "motd.h"
61   #include "ipcache.h"
62   #include "isupport.h"
63 + #include "whowas.h"
64  
65  
66   struct config_channel_entry ConfigChannel;
# Line 67 | Line 72 | struct config_admin_entry ConfigAdminInf
72   struct conf_parser_context conf_parser_ctx;
73  
74   /* general conf items link list root, other than k lines etc. */
75 < dlink_list service_items;
71 < dlink_list server_items;
72 < dlink_list cluster_items;
75 > dlink_list connect_items;
76   dlink_list operator_items;
74 dlink_list shared_items;
75 dlink_list gecos_items;
76 dlink_list nresv_items;
77 dlink_list cresv_items;
77  
78   extern unsigned int lineno;
79   extern char linebuf[];
# Line 136 | Line 135 | map_to_list(enum maskitem_type type)
135   {
136    switch (type)
137    {
139    case CONF_XLINE:
140      return &gecos_items;
141      break;
142    case CONF_SHARED:
143      return &shared_items;
144      break;
145    case CONF_NRESV:
146      return &nresv_items;
147      break;
148    case CONF_CRESV:
149      return &cresv_items;
150      break;
138      case CONF_OPER:
139        return &operator_items;
140        break;
141      case CONF_SERVER:
142 <      return &server_items;
156 <      break;
157 <    case CONF_SERVICE:
158 <      return &service_items;
159 <      break;
160 <    case CONF_CLUSTER:
161 <      return &cluster_items;
142 >      return &connect_items;
143        break;
144      default:
145        return NULL;
# Line 223 | Line 204 | conf_free(struct MaskItem *conf)
204      free_dlink_node(node);
205    }
206  
226  DLINK_FOREACH_SAFE(node, node_next, conf->exempt_list.head)
227  {
228    struct exempt *exptr = node->data;
229
230    dlinkDelete(node, &conf->exempt_list);
231    xfree(exptr->name);
232    xfree(exptr->user);
233    xfree(exptr->host);
234    xfree(exptr);
235  }
236
207    xfree(conf);
208   }
209  
# Line 250 | Line 220 | attach_iline(struct Client *client_p, st
220    const struct ClassItem *const class = conf->class;
221    struct ip_entry *ip_found;
222    int a_limit_reached = 0;
223 <  unsigned int local = 0, global = 0, ident = 0;
223 >  unsigned int local = 0, global = 0;
224  
225    ip_found = ipcache_find_or_add_address(&client_p->connection->ip);
226    ip_found->count++;
227    AddFlag(client_p, FLAGS_IPHASH);
228  
229 <  userhost_count(client_p->username, client_p->host,
260 <                 &global, &local, &ident);
229 >  userhost_count(client_p->sockhost, &global, &local);
230  
231    /* XXX blah. go down checking the various silly limits
232     * setting a_limit_reached if any limit is reached.
# Line 267 | Line 236 | attach_iline(struct Client *client_p, st
236      a_limit_reached = 1;
237    else if (class->max_perip && ip_found->count > class->max_perip)
238      a_limit_reached = 1;
239 <  else if (class->max_local && local >= class->max_local)
239 >  else if (class->max_local && local >= class->max_local) /* XXX: redundant */
240      a_limit_reached = 1;
241    else if (class->max_global && global >= class->max_global)
242      a_limit_reached = 1;
274  else if (class->max_ident && ident >= class->max_ident &&
275           client_p->username[0] != '~')
276    a_limit_reached = 1;
243  
244    if (a_limit_reached)
245    {
# Line 374 | Line 340 | check_client(struct Client *source_p)
340      case TOO_MANY:
341        sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
342                             "Too many on IP for %s (%s).",
343 <                           get_client_name(source_p, SHOW_IP),
343 >                           client_get_name(source_p, SHOW_IP),
344                             source_p->sockhost);
345        ilog(LOG_TYPE_IRCD, "Too many connections on IP from %s.",
346 <           get_client_name(source_p, SHOW_IP));
346 >           client_get_name(source_p, SHOW_IP));
347        ++ServerStats.is_ref;
348        exit_client(source_p, "No more connections allowed on that IP");
349        break;
# Line 385 | Line 351 | check_client(struct Client *source_p)
351      case I_LINE_FULL:
352        sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
353                             "auth {} block is full for %s (%s).",
354 <                           get_client_name(source_p, SHOW_IP),
354 >                           client_get_name(source_p, SHOW_IP),
355                             source_p->sockhost);
356        ilog(LOG_TYPE_IRCD, "Too many connections from %s.",
357 <           get_client_name(source_p, SHOW_IP));
357 >           client_get_name(source_p, SHOW_IP));
358        ++ServerStats.is_ref;
359        exit_client(source_p, "No more connections allowed in your connection class");
360        break;
# Line 397 | Line 363 | check_client(struct Client *source_p)
363        /* jdc - lists server name & port connections are on */
364        /*       a purely cosmetical change */
365        sendto_realops_flags(UMODE_UNAUTH, L_ALL, SEND_NOTICE,
366 <                           "Unauthorized client connection from %s [%s] on [%s/%u].",
367 <                           get_client_name(source_p, SHOW_IP),
402 <                           source_p->sockhost,
366 >                           "Unauthorized client connection from %s on [%s/%u].",
367 >                           client_get_name(source_p, SHOW_IP),
368                             source_p->connection->listener->name,
369                             source_p->connection->listener->port);
370        ilog(LOG_TYPE_IRCD, "Unauthorized client connection from %s on [%s/%u].",
371 <           get_client_name(source_p, SHOW_IP),
371 >           client_get_name(source_p, SHOW_IP),
372             source_p->connection->listener->name,
373             source_p->connection->listener->port);
374  
# Line 510 | Line 475 | attach_connect_block(struct Client *clie
475  
476    assert(host);
477  
478 <  DLINK_FOREACH(node, server_items.head)
478 >  DLINK_FOREACH(node, connect_items.head)
479    {
480      struct MaskItem *conf = node->data;
481  
482 <    if (match(conf->name, name) || match(conf->host, host))
482 >    if (irccmp(conf->name, name) ||
483 >        irccmp(conf->host, host))
484        continue;
485  
486      attach_conf(client_p, conf);
# Line 563 | Line 529 | find_conf_name(dlink_list *list, const c
529   * side effects - looks for a match on name field
530   */
531   struct MaskItem *
532 < find_matching_name_conf(enum maskitem_type type, const char *name, const char *user,
567 <                        const char *host, unsigned int flags)
532 > connect_find(const char *name, const char *host, int (*compare)(const char *, const char *))
533   {
534    dlink_node *node = NULL;
570  dlink_list *list = map_to_list(type);
571  struct MaskItem *conf = NULL;
535  
536 <  switch (type)
536 >  DLINK_FOREACH(node, connect_items.head)
537    {
538 <  case CONF_SERVICE:
576 <    DLINK_FOREACH(node, list->head)
577 <    {
578 <      conf = node->data;
579 <
580 <      if (EmptyString(conf->name))
581 <        continue;
582 <      if (name && !irccmp(name, conf->name))
583 <        return conf;
584 <    }
585 <    break;
586 <
587 <  case CONF_XLINE:
588 <  case CONF_SHARED:
589 <  case CONF_NRESV:
590 <  case CONF_CRESV:
591 <    DLINK_FOREACH(node, list->head)
592 <    {
593 <      conf = node->data;
594 <
595 <      if (EmptyString(conf->name))
596 <        continue;
597 <      if (name && !match(conf->name, name))
598 <      {
599 <        if ((user == NULL && (host == NULL)))
600 <          return conf;
601 <        if ((conf->modes & flags) != flags)
602 <          continue;
603 <        if (EmptyString(conf->user) || EmptyString(conf->host))
604 <          return conf;
605 <        if (!match(conf->user, user) && !match(conf->host, host))
606 <          return conf;
607 <      }
608 <    }
609 <      break;
610 <
611 <  case CONF_SERVER:
612 <    DLINK_FOREACH(node, list->head)
613 <    {
614 <      conf = node->data;
615 <
616 <      if (name && !match(name, conf->name))
617 <        return conf;
618 <      if (host && !match(host, conf->host))
619 <        return conf;
620 <    }
621 <    break;
538 >    struct MaskItem *conf = node->data;
539  
540 <  default:
541 <    break;
540 >    if (name && !compare(name, conf->name))
541 >      return conf;
542 >    if (host && !compare(host, conf->host))
543 >      return conf;
544    }
545 +
546    return NULL;
547   }
548  
# Line 636 | Line 556 | find_matching_name_conf(enum maskitem_ty
556   * side effects - looks for an exact match on name field
557   */
558   struct MaskItem *
559 < find_exact_name_conf(enum maskitem_type type, const struct Client *who, const char *name,
640 <                     const char *user, const char *host)
559 > operator_find(const struct Client *who, const char *name)
560   {
561    dlink_node *node = NULL;
643  dlink_list *list = map_to_list(type);
644  struct MaskItem *conf = NULL;
562  
563 <  switch(type)
563 >  DLINK_FOREACH(node, operator_items.head)
564    {
565 <  case CONF_XLINE:
649 <  case CONF_SHARED:
650 <  case CONF_NRESV:
651 <  case CONF_CRESV:
652 <
653 <    DLINK_FOREACH(node, list->head)
654 <    {
655 <      conf = node->data;
656 <
657 <      if (EmptyString(conf->name))
658 <        continue;
659 <
660 <      if (irccmp(conf->name, name) == 0)
661 <      {
662 <        if ((user == NULL && (host == NULL)))
663 <          return conf;
664 <        if (EmptyString(conf->user) || EmptyString(conf->host))
665 <          return conf;
666 <        if (!match(conf->user, user) && !match(conf->host, host))
667 <          return conf;
668 <      }
669 <    }
670 <    break;
565 >    struct MaskItem *conf = node->data;
566  
567 <  case CONF_OPER:
673 <    DLINK_FOREACH(node, list->head)
567 >    if (!irccmp(conf->name, name))
568      {
569 <      conf = node->data;
570 <
677 <      if (EmptyString(conf->name))
678 <        continue;
569 >      if (!who)
570 >        return conf;
571  
572 <      if (!irccmp(conf->name, name))
572 >      if (!match(conf->user, who->username))
573        {
574 <        if (!who)
683 <          return conf;
684 <        if (EmptyString(conf->user) || EmptyString(conf->host))
685 <          return NULL;
686 <        if (!match(conf->user, who->username))
574 >        switch (conf->htype)
575          {
576 <          switch (conf->htype)
577 <          {
578 <            case HM_HOST:
579 <              if (!match(conf->host, who->host) || !match(conf->host, who->sockhost))
576 >          case HM_HOST:
577 >            if (!match(conf->host, who->host) || !match(conf->host, who->sockhost))
578 >              if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
579 >                return conf;
580 >            break;
581 >          case HM_IPV4:
582 >            if (who->connection->aftype == AF_INET)
583 >              if (match_ipv4(&who->connection->ip, &conf->addr, conf->bits))
584                  if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
585                    return conf;
586 <              break;
587 <            case HM_IPV4:
588 <              if (who->connection->aftype == AF_INET)
589 <                if (match_ipv4(&who->connection->ip, &conf->addr, conf->bits))
590 <                  if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
591 <                    return conf;
592 <              break;
593 <            case HM_IPV6:
594 <              if (who->connection->aftype == AF_INET6)
703 <                if (match_ipv6(&who->connection->ip, &conf->addr, conf->bits))
704 <                  if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
705 <                    return conf;
706 <              break;
707 <            default:
708 <              assert(0);
709 <          }
586 >            break;
587 >          case HM_IPV6:
588 >            if (who->connection->aftype == AF_INET6)
589 >              if (match_ipv6(&who->connection->ip, &conf->addr, conf->bits))
590 >                if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
591 >                  return conf;
592 >            break;
593 >          default:
594 >            assert(0);
595          }
596        }
597      }
713
714    break;
715
716  case CONF_SERVER:
717    DLINK_FOREACH(node, list->head)
718    {
719      conf = node->data;
720
721      if (EmptyString(conf->name))
722        continue;
723
724      if (name == NULL)
725      {
726        if (EmptyString(conf->host))
727          continue;
728        if (irccmp(conf->host, host) == 0)
729          return conf;
730      }
731      else if (irccmp(conf->name, name) == 0)
732        return conf;
733    }
734
735    break;
736
737  default:
738    break;
598    }
599  
600    return NULL;
# Line 770 | Line 629 | set_default_conf(void)
629    ConfigServerInfo.max_nick_length = 9;
630    ConfigServerInfo.max_topic_length = 80;
631    ConfigServerInfo.hub = 0;
632 +  ConfigServerInfo.libgeoip_database_options = 0;
633  
634    log_del_all();
635  
# Line 779 | Line 639 | set_default_conf(void)
639    ConfigChannel.invite_client_count = 10;
640    ConfigChannel.invite_client_time = 300;
641    ConfigChannel.invite_delay_channel = 5;
642 +  ConfigChannel.invite_expire_time = 1800;
643    ConfigChannel.knock_client_count = 1;
644    ConfigChannel.knock_client_time = 300;
645    ConfigChannel.knock_delay_channel = 60;
646    ConfigChannel.max_channels = 25;
647 <  ConfigChannel.max_bans = 25;
647 >  ConfigChannel.max_invites = 20;
648 >  ConfigChannel.max_bans = 100;
649 >  ConfigChannel.max_bans_large = 500;
650    ConfigChannel.default_join_flood_count = 18;
651    ConfigChannel.default_join_flood_time = 6;
652  
# Line 799 | Line 662 | set_default_conf(void)
662    ConfigGeneral.away_count = 2;
663    ConfigGeneral.away_time = 10;
664    ConfigGeneral.max_watch = 50;
665 +  ConfigGeneral.whowas_history_length = 15000;
666    ConfigGeneral.cycle_on_host_change = 1;
667    ConfigGeneral.dline_min_cidr = 16;
668    ConfigGeneral.dline_min_cidr6 = 48;
# Line 810 | Line 674 | set_default_conf(void)
674    ConfigGeneral.disable_auth = 0;
675    ConfigGeneral.kill_chase_time_limit = 90;
676    ConfigGeneral.default_floodcount = 8;
677 +  ConfigGeneral.default_floodtime = 1;
678    ConfigGeneral.failed_oper_notice = 1;
679    ConfigGeneral.dots_in_ident = 0;
680    ConfigGeneral.min_nonwildcard = 4;
# Line 830 | Line 695 | set_default_conf(void)
695    ConfigGeneral.stats_P_oper_only = 0;
696    ConfigGeneral.stats_u_oper_only = 0;
697    ConfigGeneral.caller_id_wait = 60;
698 <  ConfigGeneral.opers_bypass_callerid = 0;
698 >  ConfigGeneral.opers_bypass_callerid = 1;
699    ConfigGeneral.pace_wait = 10;
700    ConfigGeneral.pace_wait_simple = 1;
701    ConfigGeneral.short_motd = 0;
# Line 864 | Line 729 | validate_conf(void)
729   static void
730   read_conf(FILE *file)
731   {
732 <  lineno = 0;
732 >  lineno = 1;
733  
734    set_default_conf();  /* Set default values prior to conf parsing */
735    conf_parser_ctx.pass = 1;
# Line 876 | Line 741 | read_conf(FILE *file)
741    yyparse();  /* Load the values from the conf */
742    validate_conf();  /* Check to make sure some values are still okay. */
743                      /* Some global values are also loaded here. */
744 +  whowas_trim();  /* Attempt to trim whowas list if necessary */
745    class_delete_marked();  /* Delete unused classes that are marked for deletion */
746   }
747  
# Line 889 | Line 755 | void
755   conf_rehash(int sig)
756   {
757    if (sig)
758 +  {
759      sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
760                           "Got signal SIGHUP, reloading configuration file(s)");
761 +    ilog(LOG_TYPE_IRCD, "Got signal SIGHUP, reloading configuration file(s)");
762 +  }
763  
764    restart_resolver();
765  
# Line 976 | Line 845 | conf_connect_allowed(struct irc_ssaddr *
845    return 0;
846   }
847  
979 /* expire_tklines()
980 *
981 * inputs       - tkline list pointer
982 * output       - NONE
983 * side effects - expire tklines
984 */
985 static void
986 expire_tklines(dlink_list *list)
987 {
988  dlink_node *node = NULL, *node_next = NULL;
989
990  DLINK_FOREACH_SAFE(node, node_next, list->head)
991  {
992    struct MaskItem *conf = node->data;
993
994    if (!conf->until || conf->until > CurrentTime)
995      continue;
996
997    if (ConfigGeneral.tkline_expire_notices)
998      sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE, "Temporary %s for [%s] expired",
999                           (conf->type == CONF_XLINE) ? "X-line" : "RESV", conf->name);
1000    conf_free(conf);
1001  }
1002 }
1003
848   /* cleanup_tklines()
849   *
850   * inputs       - NONE
# Line 1012 | Line 856 | void
856   cleanup_tklines(void *unused)
857   {
858    hostmask_expire_temporary();
859 <  expire_tklines(&gecos_items);
860 <  expire_tklines(&nresv_items);
1017 <  expire_tklines(&cresv_items);
859 >  gecos_expire();
860 >  resv_expire();
861   }
862  
863   /* oper_privs_as_string()
# Line 1023 | Line 866 | cleanup_tklines(void *unused)
866   * output        - pointer to static string showing oper privs
867   * side effects  - return as string, the oper privs as derived from port
868   */
869 < static const struct oper_privs
869 > static const struct oper_flags
870   {
871    const unsigned int flag;
872    const unsigned char c;
873 < } flag_list[] = {
873 > } flag_table[] = {
874    { OPER_FLAG_ADMIN,          'A' },
875    { OPER_FLAG_CLOSE,          'B' },
876    { OPER_FLAG_CONNECT,        'C' },
# Line 1060 | Line 903 | static const struct oper_privs
903   };
904  
905   const char *
906 < oper_privs_as_string(const unsigned int port)
906 > oper_privs_as_string(const unsigned int flags)
907   {
908 <  static char privs_out[IRCD_BUFSIZE];
909 <  char *privs_ptr = privs_out;
908 >  static char buf[sizeof(flag_table) / sizeof(flag_table[0])];
909 >  char *p = buf;
910  
911 <  for (const struct oper_privs *opriv = flag_list; opriv->flag; ++opriv)
912 <    if (port & opriv->flag)
913 <      *privs_ptr++ = opriv->c;
911 >  for (const struct oper_flags *tab = flag_table; tab->flag; ++tab)
912 >    if (flags & tab->flag)
913 >      *p++ = tab->c;
914  
915 <  if (privs_ptr == privs_out)
916 <    *privs_ptr++ = '0';
915 >  if (p == buf)
916 >    *p++ = '0';
917  
918 <  *privs_ptr = '\0';
918 >  *p = '\0';
919  
920 <  return privs_out;
920 >  return buf;
921   }
922  
923   /*
# Line 1130 | Line 973 | clear_out_old_conf(void)
973   {
974    dlink_node *node = NULL, *node_next = NULL;
975    dlink_list *free_items [] = {
976 <    &server_items,   &operator_items,
1134 <     &shared_items,   &gecos_items,
1135 <     &nresv_items, &cluster_items,  &service_items, &cresv_items, NULL
976 >    &connect_items, &operator_items, NULL
977    };
978  
979    dlink_list ** iterator = free_items; /* C is dumb */
# Line 1148 | Line 989 | clear_out_old_conf(void)
989        struct MaskItem *conf = node->data;
990  
991        conf->active = 0;
992 +      dlinkDelete(&conf->node, *iterator);
993  
994 <      if (!IsConfDatabase(conf))
995 <      {
1154 <        dlinkDelete(&conf->node, *iterator);
1155 <
1156 <        if (!conf->ref_count)
1157 <          conf_free(conf);
1158 <      }
994 >      if (!conf->ref_count)
995 >        conf_free(conf);
996      }
997    }
998  
1162  motd_clear();
1163
999    /*
1000     * Don't delete the class table, rather mark all entries for deletion.
1001     * The table is cleaned up by class_delete_marked. - avalon
# Line 1169 | Line 1004 | clear_out_old_conf(void)
1004  
1005    clear_out_address_conf();
1006  
1007 <  /* Clean out module paths */
1008 <  mod_clear_paths();
1007 >  modules_conf_clear();  /* Clear modules {} items */
1008 >
1009 >  motd_clear();  /* Clear motd {} items and re-cache default motd */
1010 >
1011 >  cluster_clear();  /* Clear cluster {} items */
1012 >
1013 >  gecos_clear();  /* Clear gecos {} items */
1014  
1015 <  pseudo_clear();
1015 >  resv_clear();  /* Clear resv {} items */
1016 >
1017 >  service_clear();  /* Clear service {} items */
1018 >
1019 >  shared_clear();  /* Clear shared {} items */
1020 >
1021 >  pseudo_clear();  /* Clear pseudo {} items */
1022 >
1023 > #ifdef HAVE_LIBGEOIP
1024 >  GeoIP_delete(GeoIPv4_ctx);
1025 >  GeoIPv4_ctx = NULL;
1026 >  GeoIP_delete(GeoIPv6_ctx);
1027 >  GeoIPv6_ctx = NULL;
1028 > #endif
1029  
1030    /* Clean out ConfigServerInfo */
1031    xfree(ConfigServerInfo.description);
# Line 1181 | Line 1034 | clear_out_old_conf(void)
1034    ConfigServerInfo.network_name = NULL;
1035    xfree(ConfigServerInfo.network_desc);
1036    ConfigServerInfo.network_desc = NULL;
1037 <
1037 >  xfree(ConfigServerInfo.libgeoip_ipv6_database_file);
1038 >  ConfigServerInfo.libgeoip_ipv6_database_file = NULL;
1039 >  xfree(ConfigServerInfo.libgeoip_ipv4_database_file);
1040 >  ConfigServerInfo.libgeoip_ipv4_database_file = NULL;
1041    xfree(ConfigServerInfo.rsa_private_key_file);
1042    ConfigServerInfo.rsa_private_key_file = NULL;
1043    xfree(ConfigServerInfo.ssl_certificate_file);
# Line 1218 | Line 1074 | conf_handle_tls(int cold)
1074      if (cold)
1075      {
1076        ilog(LOG_TYPE_IRCD, "Error while initializing TLS");
1077 <      exit(-1);
1077 >      exit(EXIT_FAILURE);
1078      }
1079      else
1080      {
# Line 1290 | Line 1146 | read_conf_files(int cold)
1146    snprintf(chanlimit, sizeof(chanlimit), "#:%u",
1147             ConfigChannel.max_channels);
1148    isupport_add("CHANLIMIT", chanlimit, -1);
1149 <  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstCMORST");
1149 >  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstuCLMORST");
1150    isupport_add("CHANNELLEN", NULL, CHANNELLEN);
1151    isupport_add("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1152    isupport_add("CHANMODES", chanmodes, -1);
1297
1298  /*
1299   * message_locale may have changed.  rebuild isupport since it relies
1300   * on strlen(form_str(RPL_ISUPPORT))
1301   */
1302  isupport_rebuild();
1153   }
1154  
1155   /* conf_add_class_to_conf()
# Line 1335 | Line 1185 | conf_add_class_to_conf(struct MaskItem *
1185   void
1186   yyerror(const char *msg)
1187   {
1338  char newlinebuf[IRCD_BUFSIZE];
1339
1188    if (conf_parser_ctx.pass != 1)
1189      return;
1190  
1191 <  strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1191 >  const char *p = stripws(linebuf);
1192    sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1193                         "\"%s\", line %u: %s: %s",
1194 <                       conffilebuf, lineno + 1, msg, newlinebuf);
1194 >                       conffilebuf, lineno, msg, p);
1195    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
1196 <       conffilebuf, lineno + 1, msg, newlinebuf);
1196 >       conffilebuf, lineno, msg, p);
1197   }
1198  
1199   void
1200   conf_error_report(const char *msg)
1201   {
1202 <  char newlinebuf[IRCD_BUFSIZE];
1355 <
1356 <  strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1202 >  const char *p = stripws(linebuf);
1203    sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1204                         "\"%s\", line %u: %s: %s",
1205 <                       conffilebuf, lineno + 1, msg, newlinebuf);
1205 >                       conffilebuf, lineno, msg, p);
1206    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
1207 <       conffilebuf, lineno + 1, msg, newlinebuf);
1207 >       conffilebuf, lineno, msg, p);
1208   }
1209  
1210   /*
# Line 1371 | Line 1217 | conf_error_report(const char *msg)
1217   * side effects - none
1218   * Originally written by Dianora (Diane, db@db.net)
1219   */
1220 < time_t
1220 > uintmax_t
1221   valid_tkline(const char *data, const int minutes)
1222   {
1223    const unsigned char *p = (const unsigned char *)data;
1224    unsigned char tmpch = '\0';
1225 <  time_t result = 0;
1225 >  uintmax_t result = 0;
1226  
1227    while ((tmpch = *p++))
1228    {
# Line 1452 | Line 1298 | valid_wild_card_simple(const char *data)
1298   * side effects - NOTICE is given to source_p if warn is 1
1299   */
1300   int
1301 < valid_wild_card(struct Client *source_p, int count, ...)
1301 > valid_wild_card(int count, ...)
1302   {
1303    unsigned char tmpch = '\0';
1304    unsigned int nonwild = 0;
# Line 1495 | Line 1341 | valid_wild_card(struct Client *source_p,
1341      }
1342    }
1343  
1498  if (IsClient(source_p))
1499    sendto_one_notice(source_p, &me,
1500                      ":Please include at least %u non-wildcard characters with the mask",
1501                      ConfigGeneral.min_nonwildcard);
1344    va_end(args);
1345    return 0;
1346   }
# Line 1615 | Line 1457 | find_user_host(struct Client *source_p,
1457   int
1458   parse_aline(const char *cmd, struct Client *source_p,
1459              int parc, char **parv,
1460 <            int parse_flags, char **up_p, char **h_p, time_t *tkline_time,
1460 >            char **up_p, char **h_p, uintmax_t *tkline_time,
1461              char **target_server, char **reason)
1462   {
1463 <  int found_tkline_time=0;
1463 >  uintmax_t found_tkline_time=0;
1464    static char default_reason[] = CONF_NOREASON;
1465    static char user[USERLEN*4+1];
1466    static char host[HOSTLEN*4+1];
# Line 1695 | Line 1537 | parse_aline(const char *cmd, struct Clie
1537      }
1538    }
1539  
1698  if (h_p)
1699  {
1700    if (strchr(user, '!'))
1701    {
1702      sendto_one_notice(source_p, &me, ":Invalid character '!' in kline");
1703      return 0;
1704    }
1705
1706    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 2, *up_p, *h_p))
1707      return 0;
1708  }
1709  else
1710    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, *up_p))
1711      return 0;
1712
1540    if (reason)
1541    {
1542      if (parc && !EmptyString(*parv))
# Line 1745 | Line 1572 | match_conf_password(const char *password
1572   }
1573  
1574   /*
1748 * cluster_a_line
1749 *
1750 * inputs       - client sending the cluster
1751 *              - command name "KLINE" "XLINE" etc.
1752 *              - capab -- CAPAB_KLN etc. from server.h
1753 *              - cluster type -- CLUSTER_KLINE etc. from conf.h
1754 *              - pattern and args to send along
1755 * output       - none
1756 * side effects - Take source_p send the pattern with args given
1757 *                along to all servers that match capab and cluster type
1758 */
1759 void
1760 cluster_a_line(struct Client *source_p, const char *command, unsigned int capab,
1761               unsigned int cluster_type, const char *pattern, ...)
1762 {
1763  va_list args;
1764  char buffer[IRCD_BUFSIZE] = "";
1765  const dlink_node *node = NULL;
1766
1767  va_start(args, pattern);
1768  vsnprintf(buffer, sizeof(buffer), pattern, args);
1769  va_end(args);
1770
1771  DLINK_FOREACH(node, cluster_items.head)
1772  {
1773    const struct MaskItem *conf = node->data;
1774
1775    if (conf->flags & cluster_type)
1776      sendto_match_servs(source_p, conf->name, CAPAB_CLUSTER | capab,
1777                         "%s %s %s", command, conf->name, buffer);
1778  }
1779 }
1780
1781 /*
1575   * split_nuh
1576   *
1577   * inputs       - pointer to original mask (modified in place)

Comparing ircd-hybrid/trunk/src/conf.c (property svn:keywords):
Revision 7159 by michael, Thu Jan 28 11:26:51 2016 UTC vs.
Revision 8310 by michael, Wed Feb 28 16:46:13 2018 UTC

# Line 1 | Line 1
1 < Id Revision
1 > Id

Diff Legend

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