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 7105 by michael, Sat Jan 23 20:11:27 2016 UTC vs.
Revision 8314 by michael, Wed Feb 28 17:47:23 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->flags & 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 779 | Line 638 | set_default_conf(void)
638    ConfigChannel.invite_client_count = 10;
639    ConfigChannel.invite_client_time = 300;
640    ConfigChannel.invite_delay_channel = 5;
641 +  ConfigChannel.invite_expire_time = 1800;
642    ConfigChannel.knock_client_count = 1;
643    ConfigChannel.knock_client_time = 300;
644    ConfigChannel.knock_delay_channel = 60;
645    ConfigChannel.max_channels = 25;
646 <  ConfigChannel.max_bans = 25;
646 >  ConfigChannel.max_invites = 20;
647 >  ConfigChannel.max_bans = 100;
648 >  ConfigChannel.max_bans_large = 500;
649    ConfigChannel.default_join_flood_count = 18;
650    ConfigChannel.default_join_flood_time = 6;
651  
# Line 799 | Line 661 | set_default_conf(void)
661    ConfigGeneral.away_count = 2;
662    ConfigGeneral.away_time = 10;
663    ConfigGeneral.max_watch = 50;
664 +  ConfigGeneral.whowas_history_length = 15000;
665    ConfigGeneral.cycle_on_host_change = 1;
666    ConfigGeneral.dline_min_cidr = 16;
667    ConfigGeneral.dline_min_cidr6 = 48;
# Line 810 | Line 673 | set_default_conf(void)
673    ConfigGeneral.disable_auth = 0;
674    ConfigGeneral.kill_chase_time_limit = 90;
675    ConfigGeneral.default_floodcount = 8;
676 +  ConfigGeneral.default_floodtime = 1;
677    ConfigGeneral.failed_oper_notice = 1;
678    ConfigGeneral.dots_in_ident = 0;
679    ConfigGeneral.min_nonwildcard = 4;
# Line 830 | Line 694 | set_default_conf(void)
694    ConfigGeneral.stats_P_oper_only = 0;
695    ConfigGeneral.stats_u_oper_only = 0;
696    ConfigGeneral.caller_id_wait = 60;
697 <  ConfigGeneral.opers_bypass_callerid = 0;
697 >  ConfigGeneral.opers_bypass_callerid = 1;
698    ConfigGeneral.pace_wait = 10;
699    ConfigGeneral.pace_wait_simple = 1;
700    ConfigGeneral.short_motd = 0;
# Line 864 | Line 728 | validate_conf(void)
728   static void
729   read_conf(FILE *file)
730   {
731 <  lineno = 0;
731 >  lineno = 1;
732  
733    set_default_conf();  /* Set default values prior to conf parsing */
734    conf_parser_ctx.pass = 1;
# Line 876 | Line 740 | read_conf(FILE *file)
740    yyparse();  /* Load the values from the conf */
741    validate_conf();  /* Check to make sure some values are still okay. */
742                      /* Some global values are also loaded here. */
743 +  whowas_trim();  /* Attempt to trim whowas list if necessary */
744    class_delete_marked();  /* Delete unused classes that are marked for deletion */
745   }
746  
# Line 889 | Line 754 | void
754   conf_rehash(int sig)
755   {
756    if (sig)
757 +  {
758      sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
759                           "Got signal SIGHUP, reloading configuration file(s)");
760 +    ilog(LOG_TYPE_IRCD, "Got signal SIGHUP, reloading configuration file(s)");
761 +  }
762  
763    restart_resolver();
764  
# Line 976 | Line 844 | conf_connect_allowed(struct irc_ssaddr *
844    return 0;
845   }
846  
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
847   /* cleanup_tklines()
848   *
849   * inputs       - NONE
# Line 1012 | Line 855 | void
855   cleanup_tklines(void *unused)
856   {
857    hostmask_expire_temporary();
858 <  expire_tklines(&gecos_items);
859 <  expire_tklines(&nresv_items);
1017 <  expire_tklines(&cresv_items);
858 >  gecos_expire();
859 >  resv_expire();
860   }
861  
862   /* oper_privs_as_string()
# Line 1023 | Line 865 | cleanup_tklines(void *unused)
865   * output        - pointer to static string showing oper privs
866   * side effects  - return as string, the oper privs as derived from port
867   */
868 < static const struct oper_privs
868 > static const struct oper_flags
869   {
870    const unsigned int flag;
871    const unsigned char c;
872 < } flag_list[] = {
872 > } flag_table[] = {
873    { OPER_FLAG_ADMIN,          'A' },
874    { OPER_FLAG_CLOSE,          'B' },
875    { OPER_FLAG_CONNECT,        'C' },
# Line 1060 | Line 902 | static const struct oper_privs
902   };
903  
904   const char *
905 < oper_privs_as_string(const unsigned int port)
905 > oper_privs_as_string(const unsigned int flags)
906   {
907 <  static char privs_out[IRCD_BUFSIZE];
908 <  char *privs_ptr = privs_out;
907 >  static char buf[sizeof(flag_table) / sizeof(flag_table[0])];
908 >  char *p = buf;
909  
910 <  for (const struct oper_privs *opriv = flag_list; opriv->flag; ++opriv)
911 <    if (port & opriv->flag)
912 <      *privs_ptr++ = opriv->c;
910 >  for (const struct oper_flags *tab = flag_table; tab->flag; ++tab)
911 >    if (flags & tab->flag)
912 >      *p++ = tab->c;
913  
914 <  if (privs_ptr == privs_out)
915 <    *privs_ptr++ = '0';
914 >  if (p == buf)
915 >    *p++ = '0';
916  
917 <  *privs_ptr = '\0';
917 >  *p = '\0';
918  
919 <  return privs_out;
919 >  return buf;
920   }
921  
922   /*
# Line 1130 | Line 972 | clear_out_old_conf(void)
972   {
973    dlink_node *node = NULL, *node_next = NULL;
974    dlink_list *free_items [] = {
975 <    &server_items,   &operator_items,
1134 <     &shared_items,   &gecos_items,
1135 <     &nresv_items, &cluster_items,  &service_items, &cresv_items, NULL
975 >    &connect_items, &operator_items, NULL
976    };
977  
978    dlink_list ** iterator = free_items; /* C is dumb */
# Line 1148 | Line 988 | clear_out_old_conf(void)
988        struct MaskItem *conf = node->data;
989  
990        conf->active = 0;
991 +      dlinkDelete(&conf->node, *iterator);
992  
993 <      if (!IsConfDatabase(conf))
994 <      {
1154 <        dlinkDelete(&conf->node, *iterator);
1155 <
1156 <        if (!conf->ref_count)
1157 <          conf_free(conf);
1158 <      }
993 >      if (!conf->ref_count)
994 >        conf_free(conf);
995      }
996    }
997  
1162  motd_clear();
1163
998    /*
999     * Don't delete the class table, rather mark all entries for deletion.
1000     * The table is cleaned up by class_delete_marked. - avalon
# Line 1169 | Line 1003 | clear_out_old_conf(void)
1003  
1004    clear_out_address_conf();
1005  
1006 <  /* Clean out module paths */
1007 <  mod_clear_paths();
1006 >  modules_conf_clear();  /* Clear modules {} items */
1007 >
1008 >  motd_clear();  /* Clear motd {} items and re-cache default motd */
1009 >
1010 >  cluster_clear();  /* Clear cluster {} items */
1011 >
1012 >  gecos_clear();  /* Clear gecos {} items */
1013  
1014 <  pseudo_clear();
1014 >  resv_clear();  /* Clear resv {} items */
1015 >
1016 >  service_clear();  /* Clear service {} items */
1017 >
1018 >  shared_clear();  /* Clear shared {} items */
1019 >
1020 >  pseudo_clear();  /* Clear pseudo {} items */
1021  
1022    /* Clean out ConfigServerInfo */
1023    xfree(ConfigServerInfo.description);
# Line 1181 | Line 1026 | clear_out_old_conf(void)
1026    ConfigServerInfo.network_name = NULL;
1027    xfree(ConfigServerInfo.network_desc);
1028    ConfigServerInfo.network_desc = NULL;
1184 #ifdef HAVE_LIBCRYPTO
1185  if (ConfigServerInfo.rsa_private_key)
1186  {
1187    RSA_free(ConfigServerInfo.rsa_private_key);
1188    ConfigServerInfo.rsa_private_key = NULL;
1189  }
1190 #endif
1191
1029    xfree(ConfigServerInfo.rsa_private_key_file);
1030    ConfigServerInfo.rsa_private_key_file = NULL;
1031    xfree(ConfigServerInfo.ssl_certificate_file);
# Line 1225 | Line 1062 | conf_handle_tls(int cold)
1062      if (cold)
1063      {
1064        ilog(LOG_TYPE_IRCD, "Error while initializing TLS");
1065 <      exit(-1);
1065 >      exit(EXIT_FAILURE);
1066      }
1067      else
1068      {
# Line 1297 | Line 1134 | read_conf_files(int cold)
1134    snprintf(chanlimit, sizeof(chanlimit), "#:%u",
1135             ConfigChannel.max_channels);
1136    isupport_add("CHANLIMIT", chanlimit, -1);
1137 <  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstCMORST");
1137 >  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstuCLMORST");
1138    isupport_add("CHANNELLEN", NULL, CHANNELLEN);
1139    isupport_add("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1140    isupport_add("CHANMODES", chanmodes, -1);
1304
1305  /*
1306   * message_locale may have changed.  rebuild isupport since it relies
1307   * on strlen(form_str(RPL_ISUPPORT))
1308   */
1309  isupport_rebuild();
1141   }
1142  
1143   /* conf_add_class_to_conf()
# Line 1342 | Line 1173 | conf_add_class_to_conf(struct MaskItem *
1173   void
1174   yyerror(const char *msg)
1175   {
1345  char newlinebuf[IRCD_BUFSIZE];
1346
1176    if (conf_parser_ctx.pass != 1)
1177      return;
1178  
1179 <  strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1179 >  const char *p = stripws(linebuf);
1180    sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1181                         "\"%s\", line %u: %s: %s",
1182 <                       conffilebuf, lineno + 1, msg, newlinebuf);
1182 >                       conffilebuf, lineno, msg, p);
1183    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
1184 <       conffilebuf, lineno + 1, msg, newlinebuf);
1184 >       conffilebuf, lineno, msg, p);
1185   }
1186  
1187   void
1188   conf_error_report(const char *msg)
1189   {
1190 <  char newlinebuf[IRCD_BUFSIZE];
1362 <
1363 <  strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1190 >  const char *p = stripws(linebuf);
1191    sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1192                         "\"%s\", line %u: %s: %s",
1193 <                       conffilebuf, lineno + 1, msg, newlinebuf);
1193 >                       conffilebuf, lineno, msg, p);
1194    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
1195 <       conffilebuf, lineno + 1, msg, newlinebuf);
1195 >       conffilebuf, lineno, msg, p);
1196   }
1197  
1198   /*
# Line 1378 | Line 1205 | conf_error_report(const char *msg)
1205   * side effects - none
1206   * Originally written by Dianora (Diane, db@db.net)
1207   */
1208 < time_t
1208 > uintmax_t
1209   valid_tkline(const char *data, const int minutes)
1210   {
1211    const unsigned char *p = (const unsigned char *)data;
1212    unsigned char tmpch = '\0';
1213 <  time_t result = 0;
1213 >  uintmax_t result = 0;
1214  
1215    while ((tmpch = *p++))
1216    {
# Line 1459 | Line 1286 | valid_wild_card_simple(const char *data)
1286   * side effects - NOTICE is given to source_p if warn is 1
1287   */
1288   int
1289 < valid_wild_card(struct Client *source_p, int count, ...)
1289 > valid_wild_card(int count, ...)
1290   {
1291    unsigned char tmpch = '\0';
1292    unsigned int nonwild = 0;
# Line 1502 | Line 1329 | valid_wild_card(struct Client *source_p,
1329      }
1330    }
1331  
1505  if (IsClient(source_p))
1506    sendto_one_notice(source_p, &me,
1507                      ":Please include at least %u non-wildcard characters with the mask",
1508                      ConfigGeneral.min_nonwildcard);
1332    va_end(args);
1333    return 0;
1334   }
# Line 1622 | Line 1445 | find_user_host(struct Client *source_p,
1445   int
1446   parse_aline(const char *cmd, struct Client *source_p,
1447              int parc, char **parv,
1448 <            int parse_flags, char **up_p, char **h_p, time_t *tkline_time,
1448 >            char **up_p, char **h_p, uintmax_t *tkline_time,
1449              char **target_server, char **reason)
1450   {
1451 <  int found_tkline_time=0;
1451 >  uintmax_t found_tkline_time=0;
1452    static char default_reason[] = CONF_NOREASON;
1453    static char user[USERLEN*4+1];
1454    static char host[HOSTLEN*4+1];
# Line 1702 | Line 1525 | parse_aline(const char *cmd, struct Clie
1525      }
1526    }
1527  
1705  if (h_p)
1706  {
1707    if (strchr(user, '!'))
1708    {
1709      sendto_one_notice(source_p, &me, ":Invalid character '!' in kline");
1710      return 0;
1711    }
1712
1713    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 2, *up_p, *h_p))
1714      return 0;
1715  }
1716  else
1717    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, *up_p))
1718      return 0;
1719
1528    if (reason)
1529    {
1530      if (parc && !EmptyString(*parv))
# Line 1752 | Line 1560 | match_conf_password(const char *password
1560   }
1561  
1562   /*
1755 * cluster_a_line
1756 *
1757 * inputs       - client sending the cluster
1758 *              - command name "KLINE" "XLINE" etc.
1759 *              - capab -- CAPAB_KLN etc. from server.h
1760 *              - cluster type -- CLUSTER_KLINE etc. from conf.h
1761 *              - pattern and args to send along
1762 * output       - none
1763 * side effects - Take source_p send the pattern with args given
1764 *                along to all servers that match capab and cluster type
1765 */
1766 void
1767 cluster_a_line(struct Client *source_p, const char *command, unsigned int capab,
1768               unsigned int cluster_type, const char *pattern, ...)
1769 {
1770  va_list args;
1771  char buffer[IRCD_BUFSIZE] = "";
1772  const dlink_node *node = NULL;
1773
1774  va_start(args, pattern);
1775  vsnprintf(buffer, sizeof(buffer), pattern, args);
1776  va_end(args);
1777
1778  DLINK_FOREACH(node, cluster_items.head)
1779  {
1780    const struct MaskItem *conf = node->data;
1781
1782    if (conf->flags & cluster_type)
1783      sendto_match_servs(source_p, conf->name, CAPAB_CLUSTER | capab,
1784                         "%s %s %s", command, conf->name, buffer);
1785  }
1786 }
1787
1788 /*
1563   * split_nuh
1564   *
1565   * inputs       - pointer to original mask (modified in place)

Comparing ircd-hybrid/trunk/src/conf.c (property svn:keywords):
Revision 7105 by michael, Sat Jan 23 20:11:27 2016 UTC vs.
Revision 8314 by michael, Wed Feb 28 17:47:23 2018 UTC

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

Diff Legend

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