ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
(Generate patch)

Comparing:
ircd-hybrid-7.2/src/ircd_parser.y (file contents), Revision 34 by lusky, Sun Oct 2 21:05:51 2005 UTC vs.
ircd-hybrid-7.3/src/ircd_parser.y (file contents), Revision 1119 by michael, Fri Jan 7 22:01:47 2011 UTC

# Line 26 | Line 26
26  
27   #define YY_NO_UNPUT
28   #include <sys/types.h>
29 + #include <string.h>
30  
31 + #include "config.h"
32   #include "stdinc.h"
31 #include "dalloca.h"
33   #include "ircd.h"
33 #include "tools.h"
34   #include "list.h"
35   #include "s_conf.h"
36   #include "event.h"
37   #include "s_log.h"
38   #include "client.h"     /* for UMODE_ALL only */
39 #include "pcre.h"
39   #include "irc_string.h"
40   #include "irc_getaddrinfo.h"
41   #include "sprintf_irc.h"
42   #include "memory.h"
43   #include "modules.h"
44 < #include "s_serv.h" /* for CAP_LL / IsCapable */
44 > #include "s_serv.h"
45   #include "hostmask.h"
46   #include "send.h"
47   #include "listener.h"
# Line 73 | Line 72 | static char hostbuf[IRCD_BUFSIZE];
72   static char reasonbuf[REASONLEN + 1];
73   static char gecos_name[REALLEN * 4];
74  
76 extern dlink_list gdeny_items; /* XXX */
77
75   static char *resv_reason = NULL;
76   static char *listener_address = NULL;
77   static int not_atom = 0;
78  
79 < struct CollectItem {
79 > struct CollectItem
80 > {
81    dlink_node node;
82    char *name;
83    char *user;
# Line 169 | Line 167 | unhook_hub_leaf_confs(void)
167   %token  DESCRIPTION
168   %token  DIE
169   %token  DISABLE_AUTH
170 + %token  DISABLE_FAKE_CHANNELS
171   %token  DISABLE_HIDDEN
172   %token  DISABLE_LOCAL_CHANNELS
173   %token  DISABLE_REMOTE_COMMANDS
175 %token  DOT_IN_IP6_ADDR
174   %token  DOTS_IN_IDENT
175   %token  DURATION
176   %token  EGDPOOL_PATH
# Line 182 | Line 180 | unhook_hub_leaf_confs(void)
180   %token  EXCEED_LIMIT
181   %token  EXEMPT
182   %token  FAILED_OPER_NOTICE
185 %token  FAKENAME
183   %token  IRCD_FLAGS
184   %token  FLATTEN_LINKS
185   %token  FFAILED_OPERLOG
# Line 228 | Line 225 | unhook_hub_leaf_confs(void)
225   %token  KLINE_WITH_REASON
226   %token  KNOCK_DELAY
227   %token  KNOCK_DELAY_CHANNEL
231 %token  LAZYLINK
228   %token  LEAF_MASK
229   %token  LINKS_DELAY
230   %token  LISTEN
# Line 245 | Line 241 | unhook_hub_leaf_confs(void)
241   %token  MAX_NICK_TIME
242   %token  MAX_NUMBER
243   %token  MAX_TARGETS
244 + %token  MAX_WATCH
245   %token  MESSAGE_LOCALE
246   %token  MIN_NONWILDCARD
247   %token  MIN_NONWILDCARD_SIMPLE
# Line 273 | Line 270 | unhook_hub_leaf_confs(void)
270   %token  OPER_PASS_RESV
271   %token  OPER_SPY_T
272   %token  OPER_UMODES
276 %token  INVITE_OPS_ONLY
273   %token  JOIN_FLOOD_COUNT
274   %token  JOIN_FLOOD_TIME
275   %token  PACE_WAIT
# Line 299 | Line 295 | unhook_hub_leaf_confs(void)
295   %token  RSA_PRIVATE_KEY_FILE
296   %token  RSA_PUBLIC_KEY_FILE
297   %token  SSL_CERTIFICATE_FILE
298 + %token  T_SSL_CONNECTION_METHOD
299 + %token  T_SSLV3
300 + %token  T_TLSV1
301   %token  RESV
302   %token  RESV_EXEMPT
303   %token  SECONDS MINUTES HOURS DAYS WEEKS
# Line 316 | Line 315 | unhook_hub_leaf_confs(void)
315   %token  SILENT
316   %token  SPOOF
317   %token  SPOOF_NOTICE
318 + %token  STATS_E_DISABLED
319   %token  STATS_I_OPER_ONLY
320   %token  STATS_K_OPER_ONLY
321   %token  STATS_O_OPER_ONLY
# Line 331 | Line 331 | unhook_hub_leaf_confs(void)
331   %token  T_SOFTCALLERID
332   %token  T_CALLERID
333   %token  T_CCONN
334 + %token  T_CCONN_FULL
335   %token  T_CLIENT_FLOOD
336   %token  T_DEAF
337   %token  T_DEBUG
# Line 353 | Line 354 | unhook_hub_leaf_confs(void)
354   %token  T_NCHANGE
355   %token  T_OPERWALL
356   %token  T_REJ
357 + %token  T_SERVER
358   %token  T_SERVNOTICE
359   %token  T_SKILL
360   %token  T_SPY
361   %token  T_SSL
362 + %token  T_UMODES
363   %token  T_UNAUTH
364   %token  T_UNRESV
365   %token  T_UNXLINE
# Line 465 | Line 468 | modules_item:   modules_module | modules
468   modules_module: MODULE '=' QSTRING ';'
469   {
470   #ifndef STATIC_MODULES /* NOOP in the static case */
471 <  if (ypass == 2)
472 <  {
470 <    char *m_bn;
471 <
472 <    m_bn = basename(yylval.string);
473 <
474 <    /* I suppose we should just ignore it if it is already loaded(since
475 <     * otherwise we would flood the opers on rehash) -A1kmm.
476 <     */
477 <    add_conf_module(yylval.string);
478 <  }
471 >  if (conf_parser_ctx.pass == 2)
472 >    add_conf_module(libio_basename(yylval.string));
473   #endif
474   };
475  
476   modules_path: PATH '=' QSTRING ';'
477   {
478   #ifndef STATIC_MODULES
479 <  if (ypass == 2)
479 >  if (conf_parser_ctx.pass == 2)
480      mod_add_path(yylval.string);
481   #endif
482   };
483  
490 /***************************************************************************
491 *  section serverinfo
492 ***************************************************************************/
493 serverinfo_entry: SERVERINFO
494  '{' serverinfo_items '}' ';';
484  
485 < serverinfo_items:       serverinfo_items serverinfo_item |
486 <                        serverinfo_item ;
485 > serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
486 >
487 > serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
488   serverinfo_item:        serverinfo_name | serverinfo_vhost |
489                          serverinfo_hub | serverinfo_description |
490                          serverinfo_network_name | serverinfo_network_desc |
491                          serverinfo_max_clients |
492                          serverinfo_rsa_private_key_file | serverinfo_vhost6 |
493                          serverinfo_sid | serverinfo_ssl_certificate_file |
494 +                        serverinfo_ssl_connection_method |
495                          error ';' ;
496  
497 +
498 + serverinfo_ssl_connection_method: T_SSL_CONNECTION_METHOD
499 + {
500 + #ifdef HAVE_LIBCRYPTO
501 +  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
502 +    ServerInfo.tls_version = 0;
503 + #endif
504 + } '=' method_types ';'
505 + {
506 + #ifdef HAVE_LIBCRYPTO
507 +  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
508 +  {
509 +    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3))
510 +      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
511 +    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1))
512 +      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
513 +  }
514 + #endif
515 + };
516 +
517 + method_types: method_types ',' method_type_item | method_type_item;
518 + method_type_item: T_SSLV3
519 + {
520 + #ifdef HAVE_LIBCRYPTO
521 +  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
522 +    ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_SSLV3;
523 + #endif
524 + } | T_TLSV1
525 + {
526 + #ifdef HAVE_LIBCRYPTO
527 +  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
528 +    ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_TLSV1;
529 + #endif
530 + };
531 +
532   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
533   {
534   #ifdef HAVE_LIBCRYPTO
535 <  if (ypass == 2 && ServerInfo.ctx)
535 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
536    {
537      if (!ServerInfo.rsa_private_key_file)
538      {
# Line 514 | Line 540 | serverinfo_ssl_certificate_file: SSL_CER
540        break;
541      }
542  
543 <    if (SSL_CTX_use_certificate_file(ServerInfo.ctx,
544 <      yylval.string, SSL_FILETYPE_PEM) <= 0)
543 >    if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
544 >                                     SSL_FILETYPE_PEM) <= 0)
545      {
546        yyerror(ERR_lib_error_string(ERR_get_error()));
547        break;
548      }
549  
550 <    if (SSL_CTX_use_PrivateKey_file(ServerInfo.ctx,
551 <      ServerInfo.rsa_private_key_file, SSL_FILETYPE_PEM) <= 0)
550 >    if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
551 >                                    SSL_FILETYPE_PEM) <= 0)
552      {
553        yyerror(ERR_lib_error_string(ERR_get_error()));
554        break;
555      }
556  
557 <    if (!SSL_CTX_check_private_key(ServerInfo.ctx))
557 >    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx))
558      {
559 <      yyerror("RSA private key does not match the SSL certificate public key!");
559 >      yyerror(ERR_lib_error_string(ERR_get_error()));
560        break;
561      }
562    }
# Line 540 | Line 566 | serverinfo_ssl_certificate_file: SSL_CER
566   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
567   {
568   #ifdef HAVE_LIBCRYPTO
569 <  if (ypass == 1)
569 >  if (conf_parser_ctx.pass == 1)
570    {
571      BIO *file;
572  
# Line 600 | Line 626 | serverinfo_rsa_private_key_file: RSA_PRI
626   serverinfo_name: NAME '=' QSTRING ';'
627   {
628    /* this isn't rehashable */
629 <  if (ypass == 2)
629 >  if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
630    {
631 <    if (ServerInfo.name == NULL)
631 >    if (valid_servname(yylval.string))
632 >      DupString(ServerInfo.name, yylval.string);
633 >    else
634      {
635 <      /* the ircd will exit() in main() if we dont set one */
636 <      if (strlen(yylval.string) <= HOSTLEN)
609 <        DupString(ServerInfo.name, yylval.string);
635 >      ilog(L_ERROR, "Ignoring serverinfo::name -- invalid name. Aborting.");
636 >      exit(0);
637      }
638    }
639   };
# Line 614 | Line 641 | serverinfo_name: NAME '=' QSTRING ';'
641   serverinfo_sid: IRCD_SID '=' QSTRING ';'
642   {
643    /* this isn't rehashable */
644 <  if (ypass == 2 && !ServerInfo.sid)
644 >  if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
645    {
646 <    if ((strlen(yylval.string) == IRC_MAXSID) && IsDigit(yylval.string[0])
620 <        && IsAlNum(yylval.string[1]) && IsAlNum(yylval.string[2]))
621 <    {
646 >    if (valid_sid(yylval.string))
647        DupString(ServerInfo.sid, yylval.string);
623    }
648      else
649      {
650 <      ilog(L_ERROR, "Ignoring config file entry SID -- invalid SID. Aborting.");
650 >      ilog(L_ERROR, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
651        exit(0);
652      }
653    }
# Line 631 | Line 655 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
655  
656   serverinfo_description: DESCRIPTION '=' QSTRING ';'
657   {
658 <  if (ypass == 2)
658 >  if (conf_parser_ctx.pass == 2)
659    {
660      MyFree(ServerInfo.description);
661      DupString(ServerInfo.description,yylval.string);
# Line 640 | Line 664 | serverinfo_description: DESCRIPTION '='
664  
665   serverinfo_network_name: NETWORK_NAME '=' QSTRING ';'
666   {
667 <  if (ypass == 2)
667 >  if (conf_parser_ctx.pass == 2)
668    {
669      char *p;
670  
# Line 654 | Line 678 | serverinfo_network_name: NETWORK_NAME '=
678  
679   serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
680   {
681 <  if (ypass == 2)
681 >  if (conf_parser_ctx.pass == 2)
682    {
683      MyFree(ServerInfo.network_desc);
684      DupString(ServerInfo.network_desc, yylval.string);
# Line 663 | Line 687 | serverinfo_network_desc: NETWORK_DESC '=
687  
688   serverinfo_vhost: VHOST '=' QSTRING ';'
689   {
690 <  if (ypass == 2 && *yylval.string != '*')
690 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
691    {
692      struct addrinfo hints, *res;
693  
# Line 692 | Line 716 | serverinfo_vhost: VHOST '=' QSTRING ';'
716   serverinfo_vhost6: VHOST6 '=' QSTRING ';'
717   {
718   #ifdef IPV6
719 <  if (ypass == 2 && *yylval.string != '*')
719 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
720    {
721      struct addrinfo hints, *res;
722  
# Line 721 | Line 745 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
745  
746   serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
747   {
748 <  if (ypass == 2)
748 >  if (conf_parser_ctx.pass == 2)
749    {
750      recalc_fdlimit(NULL);
751  
# Line 744 | Line 768 | serverinfo_max_clients: T_MAX_CLIENTS '=
768  
769   serverinfo_hub: HUB '=' TBOOL ';'
770   {
771 <  if (ypass == 2)
772 <  {
749 <    if (yylval.number)
750 <    {
751 <      /* Don't become a hub if we have a lazylink active. */
752 <      if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL))
753 <      {
754 <        sendto_realops_flags(UMODE_ALL, L_ALL,
755 <                             "Ignoring config file line hub=yes; "
756 <                             "due to active LazyLink (%s)", uplink->name);
757 <      }
758 <      else
759 <      {
760 <        ServerInfo.hub = 1;
761 <        uplink = NULL;
762 <        delete_capability("HUB");
763 <        add_capability("HUB", CAP_HUB, 1);
764 <      }
765 <    }
766 <    else if (ServerInfo.hub)
767 <    {
768 <      dlink_node *ptr = NULL;
769 <
770 <      ServerInfo.hub = 0;
771 <      delete_capability("HUB");
772 <
773 <      /* Don't become a leaf if we have a lazylink active. */
774 <      DLINK_FOREACH(ptr, serv_list.head)
775 <      {
776 <        const struct Client *acptr = ptr->data;
777 <        if (MyConnect(acptr) && IsCapable(acptr, CAP_LL))
778 <        {
779 <          sendto_realops_flags(UMODE_ALL, L_ALL,
780 <                               "Ignoring config file line hub=no; "
781 <                               "due to active LazyLink (%s)",
782 <                               acptr->name);
783 <          add_capability("HUB", CAP_HUB, 1);
784 <          ServerInfo.hub = 1;
785 <          break;
786 <        }
787 <      }
788 <    }
789 <  }
771 >  if (conf_parser_ctx.pass == 2)
772 >    ServerInfo.hub = yylval.number;
773   };
774  
775   /***************************************************************************
# Line 800 | Line 783 | admin_item:  admin_name | admin_descript
783  
784   admin_name: NAME '=' QSTRING ';'
785   {
786 <  if (ypass == 2)
786 >  if (conf_parser_ctx.pass == 2)
787    {
788      MyFree(AdminInfo.name);
789      DupString(AdminInfo.name, yylval.string);
# Line 809 | Line 792 | admin_name: NAME '=' QSTRING ';'
792  
793   admin_email: EMAIL '=' QSTRING ';'
794   {
795 <  if (ypass == 2)
795 >  if (conf_parser_ctx.pass == 2)
796    {
797      MyFree(AdminInfo.email);
798      DupString(AdminInfo.email, yylval.string);
# Line 818 | Line 801 | admin_email: EMAIL '=' QSTRING ';'
801  
802   admin_description: DESCRIPTION '=' QSTRING ';'
803   {
804 <  if (ypass == 2)
804 >  if (conf_parser_ctx.pass == 2)
805    {
806      MyFree(AdminInfo.description);
807      DupString(AdminInfo.description, yylval.string);
# Line 853 | Line 836 | logging_oper_log:      OPER_LOG '=' QSTRING '
836  
837   logging_fuserlog: FUSERLOG '=' QSTRING ';'
838   {
839 <  if (ypass == 2)
839 >  if (conf_parser_ctx.pass == 2)
840      strlcpy(ConfigLoggingEntry.userlog, yylval.string,
841              sizeof(ConfigLoggingEntry.userlog));
842   };
843  
844   logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
845   {
846 <  if (ypass == 2)
846 >  if (conf_parser_ctx.pass == 2)
847      strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
848              sizeof(ConfigLoggingEntry.failed_operlog));
849   };
850  
851   logging_foperlog: FOPERLOG '=' QSTRING ';'
852   {
853 <  if (ypass == 2)
853 >  if (conf_parser_ctx.pass == 2)
854      strlcpy(ConfigLoggingEntry.operlog, yylval.string,
855              sizeof(ConfigLoggingEntry.operlog));
856   };
857  
858   logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
859   {
860 <  if (ypass == 2)
860 >  if (conf_parser_ctx.pass == 2)
861      strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
862              sizeof(ConfigLoggingEntry.operspylog));
863   };
864  
865   logging_fglinelog: FGLINELOG '=' QSTRING ';'
866   {
867 <  if (ypass == 2)
867 >  if (conf_parser_ctx.pass == 2)
868      strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
869              sizeof(ConfigLoggingEntry.glinelog));
870   };
871  
872   logging_fklinelog: FKLINELOG '=' QSTRING ';'
873   {
874 <  if (ypass == 2)
874 >  if (conf_parser_ctx.pass == 2)
875      strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
876              sizeof(ConfigLoggingEntry.klinelog));
877   };
878  
879   logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
880   {
881 <  if (ypass == 2)
881 >  if (conf_parser_ctx.pass == 2)
882      strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
883              sizeof(ConfigLoggingEntry.ioerrlog));
884   };
885  
886   logging_killlog: FKILLLOG '=' QSTRING ';'
887   {
888 <  if (ypass == 2)
888 >  if (conf_parser_ctx.pass == 2)
889      strlcpy(ConfigLoggingEntry.killlog, yylval.string,
890              sizeof(ConfigLoggingEntry.killlog));
891   };
892  
893   logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
894   {
895 <  if (ypass == 2)
895 >  if (conf_parser_ctx.pass == 2)
896      set_log_level(L_CRIT);
897   } | LOG_LEVEL '=' T_L_ERROR ';'
898   {
899 <  if (ypass == 2)
899 >  if (conf_parser_ctx.pass == 2)
900      set_log_level(L_ERROR);
901   } | LOG_LEVEL '=' T_L_WARN ';'
902   {
903 <  if (ypass == 2)
903 >  if (conf_parser_ctx.pass == 2)
904      set_log_level(L_WARN);
905   } | LOG_LEVEL '=' T_L_NOTICE ';'
906   {
907 <  if (ypass == 2)
907 >  if (conf_parser_ctx.pass == 2)
908      set_log_level(L_NOTICE);
909   } | LOG_LEVEL '=' T_L_TRACE ';'
910   {
911 <  if (ypass == 2)
911 >  if (conf_parser_ctx.pass == 2)
912      set_log_level(L_TRACE);
913   } | LOG_LEVEL '=' T_L_INFO ';'
914   {
915 <  if (ypass == 2)
915 >  if (conf_parser_ctx.pass == 2)
916      set_log_level(L_INFO);
917   } | LOG_LEVEL '=' T_L_DEBUG ';'
918   {
919 <  if (ypass == 2)
919 >  if (conf_parser_ctx.pass == 2)
920      set_log_level(L_DEBUG);
921   };
922  
923   logging_use_logging: USE_LOGGING '=' TBOOL ';'
924   {
925 <  if (ypass == 2)
925 >  if (conf_parser_ctx.pass == 2)
926      ConfigLoggingEntry.use_logging = yylval.number;
927   };
928  
# Line 948 | Line 931 | logging_use_logging: USE_LOGGING '=' TBO
931   ***************************************************************************/
932   oper_entry: OPERATOR
933   {
934 <  if (ypass == 2)
934 >  if (conf_parser_ctx.pass == 2)
935    {
936      yy_conf = make_conf_item(OPER_TYPE);
937      yy_aconf = map_to_conf(yy_conf);
# Line 961 | Line 944 | oper_entry: OPERATOR
944    }
945   } oper_name_b '{' oper_items '}' ';'
946   {
947 <  if (ypass == 2)
947 >  if (conf_parser_ctx.pass == 2)
948    {
949      struct CollectItem *yy_tmp;
950      dlink_node *ptr;
# Line 1042 | Line 1025 | oper_entry: OPERATOR
1025  
1026   oper_name_b: | oper_name_t;
1027   oper_items:     oper_items oper_item | oper_item;
1028 < oper_item:      oper_name | oper_user | oper_password | oper_hidden_admin |
1029 <                oper_hidden_oper |
1030 <                oper_class | oper_global_kill | oper_remote |
1048 <                oper_kline | oper_xline | oper_unkline |
1049 <                oper_gline | oper_nick_changes | oper_remoteban |
1050 <                oper_die | oper_rehash | oper_admin | oper_operwall |
1051 <                oper_encrypted | oper_rsa_public_key_file |
1052 <                oper_flags | error ';' ;
1028 > oper_item:      oper_name | oper_user | oper_password |
1029 >                oper_umodes | oper_class | oper_encrypted |
1030 >                oper_rsa_public_key_file | oper_flags | error ';' ;
1031  
1032   oper_name: NAME '=' QSTRING ';'
1033   {
1034 <  if (ypass == 2)
1034 >  if (conf_parser_ctx.pass == 2)
1035    {
1036      if (strlen(yylval.string) > OPERNICKLEN)
1037        yylval.string[OPERNICKLEN] = '\0';
# Line 1065 | Line 1043 | oper_name: NAME '=' QSTRING ';'
1043  
1044   oper_name_t: QSTRING
1045   {
1046 <  if (ypass == 2)
1046 >  if (conf_parser_ctx.pass == 2)
1047    {
1048      if (strlen(yylval.string) > OPERNICKLEN)
1049        yylval.string[OPERNICKLEN] = '\0';
# Line 1077 | Line 1055 | oper_name_t: QSTRING
1055  
1056   oper_user: USER '=' QSTRING ';'
1057   {
1058 <  if (ypass == 2)
1058 >  if (conf_parser_ctx.pass == 2)
1059    {
1060 <    struct CollectItem *yy_tmp;
1060 >    struct split_nuh_item nuh;
1061 >
1062 >    nuh.nuhmask  = yylval.string;
1063 >    nuh.nickptr  = NULL;
1064 >    nuh.userptr  = userbuf;
1065 >    nuh.hostptr  = hostbuf;
1066 >
1067 >    nuh.nicksize = 0;
1068 >    nuh.usersize = sizeof(userbuf);
1069 >    nuh.hostsize = sizeof(hostbuf);
1070 >
1071 >    split_nuh(&nuh);
1072  
1073      if (yy_aconf->user == NULL)
1074      {
1075 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1075 >      DupString(yy_aconf->user, userbuf);
1076 >      DupString(yy_aconf->host, hostbuf);
1077      }
1078      else
1079      {
1080 <      yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
1081 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1080 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1081 >
1082 >      DupString(yy_tmp->user, userbuf);
1083 >      DupString(yy_tmp->host, hostbuf);
1084 >
1085        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1086      }
1087    }
# Line 1096 | Line 1089 | oper_user: USER '=' QSTRING ';'
1089  
1090   oper_password: PASSWORD '=' QSTRING ';'
1091   {
1092 <  if (ypass == 2)
1092 >  if (conf_parser_ctx.pass == 2)
1093    {
1094      if (yy_aconf->passwd != NULL)
1095        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
# Line 1108 | Line 1101 | oper_password: PASSWORD '=' QSTRING ';'
1101  
1102   oper_encrypted: ENCRYPTED '=' TBOOL ';'
1103   {
1104 <  if (ypass == 2)
1104 >  if (conf_parser_ctx.pass == 2)
1105    {
1106      if (yylval.number)
1107        SetConfEncrypted(yy_aconf);
# Line 1120 | Line 1113 | oper_encrypted: ENCRYPTED '=' TBOOL ';'
1113   oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1114   {
1115   #ifdef HAVE_LIBCRYPTO
1116 <  if (ypass == 2)
1116 >  if (conf_parser_ctx.pass == 2)
1117    {
1118      BIO *file;
1119  
# Line 1161 | Line 1154 | oper_rsa_public_key_file: RSA_PUBLIC_KEY
1154  
1155   oper_class: CLASS '=' QSTRING ';'
1156   {
1157 <  if (ypass == 2)
1157 >  if (conf_parser_ctx.pass == 2)
1158    {
1159      MyFree(class_name);
1160      DupString(class_name, yylval.string);
1161    }
1162   };
1163  
1164 < oper_global_kill: GLOBAL_KILL '=' TBOOL ';'
1164 > oper_umodes: T_UMODES
1165   {
1166 <  if (ypass == 2)
1167 <  {
1168 <    if (yylval.number)
1176 <      yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1177 <    else
1178 <      yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1179 <  }
1180 < };
1166 >  if (conf_parser_ctx.pass == 2)
1167 >    yy_aconf->modes = 0;
1168 > } '='  oper_umodes_items ';' ;
1169  
1170 < oper_remote: REMOTE '=' TBOOL ';'
1170 > oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1171 > oper_umodes_item:  T_BOTS
1172   {
1173 <  if (ypass == 2)
1174 <  {
1175 <    if (yylval.number)
1187 <      yy_aconf->port |= OPER_FLAG_REMOTE;
1188 <    else
1189 <      yy_aconf->port &= ~OPER_FLAG_REMOTE;
1190 <  }
1191 < };
1192 <
1193 < oper_remoteban: REMOTEBAN '=' TBOOL ';'
1173 >  if (conf_parser_ctx.pass == 2)
1174 >    yy_aconf->modes |= UMODE_BOTS;
1175 > } | T_CCONN
1176   {
1177 <  if (ypass == 2)
1178 <  {
1179 <    if (yylval.number)
1198 <      yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1199 <    else
1200 <      yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1201 <  }
1202 < };
1203 <
1204 < oper_kline: KLINE '=' TBOOL ';'
1177 >  if (conf_parser_ctx.pass == 2)
1178 >    yy_aconf->modes |= UMODE_CCONN;
1179 > } | T_CCONN_FULL
1180   {
1181 <  if (ypass == 2)
1182 <  {
1183 <    if (yylval.number)
1209 <      yy_aconf->port |= OPER_FLAG_K;
1210 <    else
1211 <      yy_aconf->port &= ~OPER_FLAG_K;
1212 <  }
1213 < };
1214 <
1215 < oper_xline: XLINE '=' TBOOL ';'
1181 >  if (conf_parser_ctx.pass == 2)
1182 >    yy_aconf->modes |= UMODE_CCONN_FULL;
1183 > } | T_DEAF
1184   {
1185 <  if (ypass == 2)
1186 <  {
1187 <    if (yylval.number)
1220 <      yy_aconf->port |= OPER_FLAG_X;
1221 <    else
1222 <      yy_aconf->port &= ~OPER_FLAG_X;
1223 <  }
1224 < };
1225 <
1226 < oper_unkline: UNKLINE '=' TBOOL ';'
1185 >  if (conf_parser_ctx.pass == 2)
1186 >    yy_aconf->modes |= UMODE_DEAF;
1187 > } | T_DEBUG
1188   {
1189 <  if (ypass == 2)
1190 <  {
1191 <    if (yylval.number)
1231 <      yy_aconf->port |= OPER_FLAG_UNKLINE;
1232 <    else
1233 <      yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1234 <  }
1235 < };
1236 <
1237 < oper_gline: GLINE '=' TBOOL ';'
1189 >  if (conf_parser_ctx.pass == 2)
1190 >    yy_aconf->modes |= UMODE_DEBUG;
1191 > } | T_FULL
1192   {
1193 <  if (ypass == 2)
1194 <  {
1195 <    if (yylval.number)
1242 <      yy_aconf->port |= OPER_FLAG_GLINE;
1243 <    else
1244 <      yy_aconf->port &= ~OPER_FLAG_GLINE;
1245 <  }
1246 < };
1247 <
1248 < oper_nick_changes: NICK_CHANGES '=' TBOOL ';'
1193 >  if (conf_parser_ctx.pass == 2)
1194 >    yy_aconf->modes |= UMODE_FULL;
1195 > } | T_SKILL
1196   {
1197 <  if (ypass == 2)
1198 <  {
1199 <    if (yylval.number)
1253 <      yy_aconf->port |= OPER_FLAG_N;
1254 <    else
1255 <      yy_aconf->port &= ~OPER_FLAG_N;
1256 <  }
1257 < };
1258 <
1259 < oper_die: DIE '=' TBOOL ';'
1197 >  if (conf_parser_ctx.pass == 2)
1198 >    yy_aconf->modes |= UMODE_SKILL;
1199 > } | T_NCHANGE
1200   {
1201 <  if (ypass == 2)
1202 <  {
1203 <    if (yylval.number)
1264 <      yy_aconf->port |= OPER_FLAG_DIE;
1265 <    else
1266 <      yy_aconf->port &= ~OPER_FLAG_DIE;
1267 <  }
1268 < };
1269 <
1270 < oper_rehash: REHASH '=' TBOOL ';'
1201 >  if (conf_parser_ctx.pass == 2)
1202 >    yy_aconf->modes |= UMODE_NCHANGE;
1203 > } | T_REJ
1204   {
1205 <  if (ypass == 2)
1206 <  {
1207 <    if (yylval.number)
1275 <      yy_aconf->port |= OPER_FLAG_REHASH;
1276 <    else
1277 <      yy_aconf->port &= ~OPER_FLAG_REHASH;
1278 <  }
1279 < };
1280 <
1281 < oper_admin: ADMIN '=' TBOOL ';'
1205 >  if (conf_parser_ctx.pass == 2)
1206 >    yy_aconf->modes |= UMODE_REJ;
1207 > } | T_UNAUTH
1208   {
1209 <  if (ypass == 2)
1210 <  {
1211 <    if (yylval.number)
1286 <      yy_aconf->port |= OPER_FLAG_ADMIN;
1287 <    else
1288 <      yy_aconf->port &= ~OPER_FLAG_ADMIN;
1289 <  }
1290 < };
1291 <
1292 < oper_hidden_admin: HIDDEN_ADMIN '=' TBOOL ';'
1209 >  if (conf_parser_ctx.pass == 2)
1210 >    yy_aconf->modes |= UMODE_UNAUTH;
1211 > } | T_SPY
1212   {
1213 <  if (ypass == 2)
1214 <  {
1215 <    if (yylval.number)
1297 <      yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1298 <    else
1299 <      yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1300 <  }
1301 < };
1302 <
1303 < oper_hidden_oper: HIDDEN_OPER '=' TBOOL ';'
1213 >  if (conf_parser_ctx.pass == 2)
1214 >    yy_aconf->modes |= UMODE_SPY;
1215 > } | T_EXTERNAL
1216   {
1217 <  if (ypass == 2)
1218 <  {
1219 <    if (yylval.number)
1308 <      yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1309 <    else
1310 <      yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1311 <  }
1312 < };
1313 <
1314 < oper_operwall: T_OPERWALL '=' TBOOL ';'
1217 >  if (conf_parser_ctx.pass == 2)
1218 >    yy_aconf->modes |= UMODE_EXTERNAL;
1219 > } | T_OPERWALL
1220   {
1221 <  if (ypass == 2)
1222 <  {
1223 <    if (yylval.number)
1224 <      yy_aconf->port |= OPER_FLAG_OPERWALL;
1225 <    else
1226 <      yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1227 <  }
1221 >  if (conf_parser_ctx.pass == 2)
1222 >    yy_aconf->modes |= UMODE_OPERWALL;
1223 > } | T_SERVNOTICE
1224 > {
1225 >  if (conf_parser_ctx.pass == 2)
1226 >    yy_aconf->modes |= UMODE_SERVNOTICE;
1227 > } | T_INVISIBLE
1228 > {
1229 >  if (conf_parser_ctx.pass == 2)
1230 >    yy_aconf->modes |= UMODE_INVISIBLE;
1231 > } | T_WALLOP
1232 > {
1233 >  if (conf_parser_ctx.pass == 2)
1234 >    yy_aconf->modes |= UMODE_WALLOP;
1235 > } | T_SOFTCALLERID
1236 > {
1237 >  if (conf_parser_ctx.pass == 2)
1238 >    yy_aconf->modes |= UMODE_SOFTCALLERID;
1239 > } | T_CALLERID
1240 > {
1241 >  if (conf_parser_ctx.pass == 2)
1242 >    yy_aconf->modes |= UMODE_CALLERID;
1243 > } | T_LOCOPS
1244 > {
1245 >  if (conf_parser_ctx.pass == 2)
1246 >    yy_aconf->modes |= UMODE_LOCOPS;
1247   };
1248  
1249   oper_flags: IRCD_FLAGS
# Line 1327 | Line 1251 | oper_flags: IRCD_FLAGS
1251   } '='  oper_flags_items ';';
1252  
1253   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1254 < oper_flags_item: NOT oper_flags_item_atom { not_atom = 1; }
1255 <                | oper_flags_item_atom { not_atom = 0; };
1254 > oper_flags_item: NOT { not_atom = 1; } oper_flags_item_atom
1255 >                | { not_atom = 0; } oper_flags_item_atom;
1256  
1257   oper_flags_item_atom: GLOBAL_KILL
1258   {
1259 <  if (ypass == 2)
1259 >  if (conf_parser_ctx.pass == 2)
1260    {
1261      if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1262      else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1263    }
1264   } | REMOTE
1265   {
1266 <  if (ypass == 2)
1266 >  if (conf_parser_ctx.pass == 2)
1267    {
1268      if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE;
1269      else yy_aconf->port |= OPER_FLAG_REMOTE;
1270    }
1271   } | KLINE
1272   {
1273 <  if (ypass == 2)
1273 >  if (conf_parser_ctx.pass == 2)
1274    {
1275      if (not_atom) yy_aconf->port &= ~OPER_FLAG_K;
1276      else yy_aconf->port |= OPER_FLAG_K;
1277    }
1278   } | UNKLINE
1279   {
1280 <  if (ypass == 2)
1280 >  if (conf_parser_ctx.pass == 2)
1281    {
1282      if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1283      else yy_aconf->port |= OPER_FLAG_UNKLINE;
1284    }
1285   } | XLINE
1286   {
1287 <  if (ypass == 2)
1287 >  if (conf_parser_ctx.pass == 2)
1288    {
1289      if (not_atom) yy_aconf->port &= ~OPER_FLAG_X;
1290      else yy_aconf->port |= OPER_FLAG_X;
1291    }
1292   } | GLINE
1293   {
1294 <  if (ypass == 2)
1294 >  if (conf_parser_ctx.pass == 2)
1295    {
1296      if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE;
1297      else yy_aconf->port |= OPER_FLAG_GLINE;
1298    }
1299   } | DIE
1300   {
1301 <  if (ypass == 2)
1301 >  if (conf_parser_ctx.pass == 2)
1302    {
1303      if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE;
1304      else yy_aconf->port |= OPER_FLAG_DIE;
1305    }
1306   } | REHASH
1307   {
1308 <  if (ypass == 2)
1308 >  if (conf_parser_ctx.pass == 2)
1309    {
1310      if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH;
1311      else yy_aconf->port |= OPER_FLAG_REHASH;
1312    }
1313   } | ADMIN
1314   {
1315 <  if (ypass == 2)
1315 >  if (conf_parser_ctx.pass == 2)
1316    {
1317      if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN;
1318      else yy_aconf->port |= OPER_FLAG_ADMIN;
1319    }
1320   } | HIDDEN_ADMIN
1321   {
1322 <  if (ypass == 2)
1322 >  if (conf_parser_ctx.pass == 2)
1323    {
1324      if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1325      else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1326    }
1327   } | NICK_CHANGES
1328   {
1329 <  if (ypass == 2)
1329 >  if (conf_parser_ctx.pass == 2)
1330    {
1331      if (not_atom) yy_aconf->port &= ~OPER_FLAG_N;
1332      else yy_aconf->port |= OPER_FLAG_N;
1333    }
1334   } | T_OPERWALL
1335   {
1336 <  if (ypass == 2)
1336 >  if (conf_parser_ctx.pass == 2)
1337    {
1338      if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1339      else yy_aconf->port |= OPER_FLAG_OPERWALL;
1340    }
1341   } | OPER_SPY_T
1342   {
1343 <  if (ypass == 2)
1343 >  if (conf_parser_ctx.pass == 2)
1344    {
1345      if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY;
1346      else yy_aconf->port |= OPER_FLAG_OPER_SPY;
1347    }
1348   } | HIDDEN_OPER
1349   {
1350 <  if (ypass == 2)
1350 >  if (conf_parser_ctx.pass == 2)
1351    {
1352      if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1353      else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1354    }
1355   } | REMOTEBAN
1356   {
1357 <  if (ypass == 2)
1357 >  if (conf_parser_ctx.pass == 2)
1358    {
1359      if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1360      else yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1361    }
1362   } | ENCRYPTED
1363   {
1364 <  if (ypass == 2)
1364 >  if (conf_parser_ctx.pass == 2)
1365    {
1366      if (not_atom) ClearConfEncrypted(yy_aconf);
1367      else SetConfEncrypted(yy_aconf);
# Line 1450 | Line 1374 | oper_flags_item_atom: GLOBAL_KILL
1374   ***************************************************************************/
1375   class_entry: CLASS
1376   {
1377 <  if (ypass == 1)
1377 >  if (conf_parser_ctx.pass == 1)
1378    {
1379      yy_conf = make_conf_item(CLASS_TYPE);
1380 <    yy_class = (struct ClassItem *)map_to_conf(yy_conf);
1380 >    yy_class = map_to_conf(yy_conf);
1381    }
1382   } class_name_b '{' class_items '}' ';'
1383   {
1384 <  if (ypass == 1)
1384 >  if (conf_parser_ctx.pass == 1)
1385    {
1386 <    struct ConfItem *cconf;
1386 >    struct ConfItem *cconf = NULL;
1387      struct ClassItem *class = NULL;
1388  
1389      if (yy_class_name == NULL)
1466    {
1390        delete_conf_item(yy_conf);
1468    }
1391      else
1392      {
1393        cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1394  
1395        if (cconf != NULL)                /* The class existed already */
1396        {
1397 +        int user_count = 0;
1398 +
1399          rebuild_cidr_class(cconf, yy_class);
1400 <        class = (struct ClassItem *) map_to_conf(cconf);
1401 <        *class = *yy_class;
1400 >
1401 >        class = map_to_conf(cconf);
1402 >
1403 >        user_count = class->curr_user_count;
1404 >        memcpy(class, yy_class, sizeof(*class));
1405 >        class->curr_user_count = user_count;
1406 >        class->active = 1;
1407 >
1408          delete_conf_item(yy_conf);
1409  
1410          MyFree(cconf->name);            /* Allows case change of class name */
# Line 1484 | Line 1414 | class_entry: CLASS
1414        {
1415          MyFree(yy_conf->name);          /* just in case it was allocated */
1416          yy_conf->name = yy_class_name;
1417 +        yy_class->active = 1;
1418        }
1419      }
1420 +
1421      yy_class_name = NULL;
1422    }
1423   };
# Line 1509 | Line 1441 | class_item:     class_name |
1441  
1442   class_name: NAME '=' QSTRING ';'
1443   {
1444 <  if (ypass == 1)
1444 >  if (conf_parser_ctx.pass == 1)
1445    {
1446      MyFree(yy_class_name);
1447      DupString(yy_class_name, yylval.string);
# Line 1518 | Line 1450 | class_name: NAME '=' QSTRING ';'
1450  
1451   class_name_t: QSTRING
1452   {
1453 <  if (ypass == 1)
1453 >  if (conf_parser_ctx.pass == 1)
1454    {
1455      MyFree(yy_class_name);
1456      DupString(yy_class_name, yylval.string);
# Line 1527 | Line 1459 | class_name_t: QSTRING
1459  
1460   class_ping_time: PING_TIME '=' timespec ';'
1461   {
1462 <  if (ypass == 1)
1462 >  if (conf_parser_ctx.pass == 1)
1463      PingFreq(yy_class) = $3;
1464   };
1465  
1466   class_ping_warning: PING_WARNING '=' timespec ';'
1467   {
1468 <  if (ypass == 1)
1468 >  if (conf_parser_ctx.pass == 1)
1469      PingWarning(yy_class) = $3;
1470   };
1471  
1472   class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1473   {
1474 <  if (ypass == 1)
1474 >  if (conf_parser_ctx.pass == 1)
1475      MaxPerIp(yy_class) = $3;
1476   };
1477  
1478   class_connectfreq: CONNECTFREQ '=' timespec ';'
1479   {
1480 <  if (ypass == 1)
1480 >  if (conf_parser_ctx.pass == 1)
1481      ConFreq(yy_class) = $3;
1482   };
1483  
1484   class_max_number: MAX_NUMBER '=' NUMBER ';'
1485   {
1486 <  if (ypass == 1)
1486 >  if (conf_parser_ctx.pass == 1)
1487      MaxTotal(yy_class) = $3;
1488   };
1489  
1490   class_max_global: MAX_GLOBAL '=' NUMBER ';'
1491   {
1492 <  if (ypass == 1)
1492 >  if (conf_parser_ctx.pass == 1)
1493      MaxGlobal(yy_class) = $3;
1494   };
1495  
1496   class_max_local: MAX_LOCAL '=' NUMBER ';'
1497   {
1498 <  if (ypass == 1)
1498 >  if (conf_parser_ctx.pass == 1)
1499      MaxLocal(yy_class) = $3;
1500   };
1501  
1502   class_max_ident: MAX_IDENT '=' NUMBER ';'
1503   {
1504 <  if (ypass == 1)
1504 >  if (conf_parser_ctx.pass == 1)
1505      MaxIdent(yy_class) = $3;
1506   };
1507  
1508   class_sendq: SENDQ '=' sizespec ';'
1509   {
1510 <  if (ypass == 1)
1510 >  if (conf_parser_ctx.pass == 1)
1511      MaxSendq(yy_class) = $3;
1512   };
1513  
1514   class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1515   {
1516 <  if (ypass == 1)
1516 >  if (conf_parser_ctx.pass == 1)
1517      CidrBitlenIPV4(yy_class) = $3;
1518   };
1519  
1520   class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1521   {
1522 <  if (ypass == 1)
1522 >  if (conf_parser_ctx.pass == 1)
1523      CidrBitlenIPV6(yy_class) = $3;
1524   };
1525  
1526   class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1527   {
1528 <  if (ypass == 1)
1528 >  if (conf_parser_ctx.pass == 1)
1529      NumberPerCidr(yy_class) = $3;
1530   };
1531  
# Line 1602 | Line 1534 | class_number_per_cidr: NUMBER_PER_CIDR '
1534   ***************************************************************************/
1535   listen_entry: LISTEN
1536   {
1537 <  if (ypass == 2)
1537 >  if (conf_parser_ctx.pass == 2)
1538    {
1539      listener_address = NULL;
1540      listener_flags = 0;
1541    }
1542   } '{' listen_items '}' ';'
1543   {
1544 <  if (ypass == 2)
1544 >  if (conf_parser_ctx.pass == 2)
1545    {
1546      MyFree(listener_address);
1547      listener_address = NULL;
# Line 1618 | Line 1550 | listen_entry: LISTEN
1550  
1551   listen_flags: IRCD_FLAGS
1552   {
1553 +  listener_flags = 0;
1554   } '='  listen_flags_items ';';
1555  
1556   listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1557   listen_flags_item: T_SSL
1558   {
1559 <  if (ypass == 2)
1559 >  if (conf_parser_ctx.pass == 2)
1560      listener_flags |= LISTENER_SSL;
1561   } | HIDDEN
1562   {
1563 <  if (ypass == 2)
1563 >  if (conf_parser_ctx.pass == 2)
1564      listener_flags |= LISTENER_HIDDEN;
1565 + } | T_SERVER
1566 + {
1567 +  if (conf_parser_ctx.pass == 2)
1568 +    listener_flags |= LISTENER_SERVER;
1569   };
1570  
1571 +
1572 +
1573   listen_items:   listen_items listen_item | listen_item;
1574 < listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';' ;
1574 > listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';';
1575  
1576 < listen_port: PORT '=' port_items ';' ;
1576 > listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1577  
1578   port_items: port_items ',' port_item | port_item;
1579  
1580   port_item: NUMBER
1581   {
1582 <  if (ypass == 2)
1582 >  if (conf_parser_ctx.pass == 2)
1583    {
1584      if ((listener_flags & LISTENER_SSL))
1585   #ifdef HAVE_LIBCRYPTO
1586 <      if (!ServerInfo.ctx)
1586 >      if (!ServerInfo.server_ctx)
1587   #endif
1588        {
1589          yyerror("SSL not available - port closed");
1590          break;
1591        }
1592      add_listener($1, listener_address, listener_flags);
1654    listener_flags = 0;
1593    }
1594   } | NUMBER TWODOTS NUMBER
1595   {
1596 <  if (ypass == 2)
1596 >  if (conf_parser_ctx.pass == 2)
1597    {
1598      int i;
1599  
1600      if ((listener_flags & LISTENER_SSL))
1601   #ifdef HAVE_LIBCRYPTO
1602 <      if (!ServerInfo.ctx)
1602 >      if (!ServerInfo.server_ctx)
1603   #endif
1604        {
1605          yyerror("SSL not available - port closed");
# Line 1670 | Line 1608 | port_item: NUMBER
1608  
1609      for (i = $1; i <= $3; ++i)
1610        add_listener(i, listener_address, listener_flags);
1673
1674    listener_flags = 0;
1611    }
1612   };
1613  
1614   listen_address: IP '=' QSTRING ';'
1615   {
1616 <  if (ypass == 2)
1616 >  if (conf_parser_ctx.pass == 2)
1617    {
1618      MyFree(listener_address);
1619      DupString(listener_address, yylval.string);
# Line 1686 | Line 1622 | listen_address: IP '=' QSTRING ';'
1622  
1623   listen_host: HOST '=' QSTRING ';'
1624   {
1625 <  if (ypass == 2)
1625 >  if (conf_parser_ctx.pass == 2)
1626    {
1627      MyFree(listener_address);
1628      DupString(listener_address, yylval.string);
# Line 1698 | Line 1634 | listen_host: HOST '=' QSTRING ';'
1634   ***************************************************************************/
1635   auth_entry: IRCD_AUTH
1636   {
1637 <  if (ypass == 2)
1637 >  if (conf_parser_ctx.pass == 2)
1638    {
1639      yy_conf = make_conf_item(CLIENT_TYPE);
1640      yy_aconf = map_to_conf(yy_conf);
# Line 1710 | Line 1646 | auth_entry: IRCD_AUTH
1646    }
1647   } '{' auth_items '}' ';'
1648   {
1649 <  if (ypass == 2)
1649 >  if (conf_parser_ctx.pass == 2)
1650    {
1651      struct CollectItem *yy_tmp = NULL;
1652      dlink_node *ptr = NULL, *next_ptr = NULL;
# Line 1767 | Line 1703 | auth_entry: IRCD_AUTH
1703  
1704   auth_items:     auth_items auth_item | auth_item;
1705   auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
1706 <                auth_kline_exempt | auth_need_ident |
1707 <                auth_exceed_limit | auth_no_tilde | auth_gline_exempt |
1772 <                auth_spoof | auth_spoof_notice |
1773 <                auth_redir_serv | auth_redir_port | auth_can_flood |
1774 <                auth_need_password | auth_encrypted | error ';' ;
1706 >                auth_spoof | auth_redir_serv | auth_redir_port |
1707 >                auth_encrypted | error ';' ;
1708  
1709   auth_user: USER '=' QSTRING ';'
1710   {
1711 <  if (ypass == 2)
1711 >  if (conf_parser_ctx.pass == 2)
1712    {
1713 <    struct CollectItem *yy_tmp;
1713 >    struct CollectItem *yy_tmp = NULL;
1714 >    struct split_nuh_item nuh;
1715 >
1716 >    nuh.nuhmask  = yylval.string;
1717 >    nuh.nickptr  = NULL;
1718 >    nuh.userptr  = userbuf;
1719 >    nuh.hostptr  = hostbuf;
1720 >
1721 >    nuh.nicksize = 0;
1722 >    nuh.usersize = sizeof(userbuf);
1723 >    nuh.hostsize = sizeof(hostbuf);
1724 >
1725 >    split_nuh(&nuh);
1726  
1727      if (yy_aconf->user == NULL)
1728 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1728 >    {
1729 >      DupString(yy_aconf->user, userbuf);
1730 >      DupString(yy_aconf->host, hostbuf);
1731 >    }
1732      else
1733      {
1734        yy_tmp = MyMalloc(sizeof(struct CollectItem));
1735 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1735 >
1736 >      DupString(yy_tmp->user, userbuf);
1737 >      DupString(yy_tmp->host, hostbuf);
1738 >
1739        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1740      }
1741    }
# Line 1794 | Line 1745 | auth_user: USER '=' QSTRING ';'
1745  
1746   auth_passwd: PASSWORD '=' QSTRING ';'
1747   {
1748 <  if (ypass == 2)
1748 >  if (conf_parser_ctx.pass == 2)
1749    {
1750      /* be paranoid */
1751      if (yy_aconf->passwd != NULL)
# Line 1805 | Line 1756 | auth_passwd: PASSWORD '=' QSTRING ';'
1756    }
1757   };
1758  
1808 auth_spoof_notice: SPOOF_NOTICE '=' TBOOL ';'
1809 {
1810  if (ypass == 2)
1811  {
1812    if (yylval.number)
1813      yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1814    else
1815      yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1816  }
1817 };
1818
1759   auth_class: CLASS '=' QSTRING ';'
1760   {
1761 <  if (ypass == 2)
1761 >  if (conf_parser_ctx.pass == 2)
1762    {
1763      MyFree(class_name);
1764      DupString(class_name, yylval.string);
# Line 1827 | Line 1767 | auth_class: CLASS '=' QSTRING ';'
1767  
1768   auth_encrypted: ENCRYPTED '=' TBOOL ';'
1769   {
1770 <  if (ypass == 2)
1770 >  if (conf_parser_ctx.pass == 2)
1771    {
1772      if (yylval.number)
1773        SetConfEncrypted(yy_aconf);
# Line 1841 | Line 1781 | auth_flags: IRCD_FLAGS
1781   } '='  auth_flags_items ';';
1782  
1783   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1784 < auth_flags_item: NOT auth_flags_item_atom { not_atom = 1; }
1785 <                | auth_flags_item_atom { not_atom = 0; };
1784 > auth_flags_item: NOT { not_atom = 1; } auth_flags_item_atom
1785 >                | { not_atom = 0; } auth_flags_item_atom;
1786  
1787   auth_flags_item_atom: SPOOF_NOTICE
1788   {
1789 <  if (ypass == 2)
1789 >  if (conf_parser_ctx.pass == 2)
1790    {
1791      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1792      else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1793    }
1854
1794   } | EXCEED_LIMIT
1795   {
1796 <  if (ypass == 2)
1796 >  if (conf_parser_ctx.pass == 2)
1797    {
1798      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1799      else yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1800    }
1801   } | KLINE_EXEMPT
1802   {
1803 <  if (ypass == 2)
1803 >  if (conf_parser_ctx.pass == 2)
1804    {
1805      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1806      else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1807    }
1808   } | NEED_IDENT
1809   {
1810 <  if (ypass == 2)
1810 >  if (conf_parser_ctx.pass == 2)
1811    {
1812      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1813      else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1814    }
1815   } | CAN_FLOOD
1816   {
1817 <  if (ypass == 2)
1817 >  if (conf_parser_ctx.pass == 2)
1818    {
1819      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
1820      else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1821    }
1822   } | CAN_IDLE
1823   {
1824 <  if (ypass == 2)
1824 >  if (conf_parser_ctx.pass == 2)
1825    {
1826      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED;
1827      else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED;
1828    }
1829   } | NO_TILDE
1830   {
1831 <  if (ypass == 2)
1831 >  if (conf_parser_ctx.pass == 2)
1832    {
1833      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
1834      else yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1835    }
1836   } | GLINE_EXEMPT
1837   {
1838 <  if (ypass == 2)
1838 >  if (conf_parser_ctx.pass == 2)
1839    {
1840      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
1841      else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1842    }
1843   } | RESV_EXEMPT
1844   {
1845 <  if (ypass == 2)
1845 >  if (conf_parser_ctx.pass == 2)
1846    {
1847      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV;
1848      else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1849    }
1850   } | NEED_PASSWORD
1851   {
1852 <  if (ypass == 2)
1852 >  if (conf_parser_ctx.pass == 2)
1853    {
1854      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
1855      else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1856    }
1857   };
1858  
1920 auth_kline_exempt: KLINE_EXEMPT '=' TBOOL ';'
1921 {
1922  if (ypass == 2)
1923  {
1924    if (yylval.number)
1925      yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1926    else
1927      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1928  }
1929 };
1930
1931 auth_need_ident: NEED_IDENT '=' TBOOL ';'
1932 {
1933  if (ypass == 2)
1934  {
1935    if (yylval.number)
1936      yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1937    else
1938      yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1939  }
1940 };
1941
1942 auth_exceed_limit: EXCEED_LIMIT '=' TBOOL ';'
1943 {
1944  if (ypass == 2)
1945  {
1946    if (yylval.number)
1947      yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1948    else
1949      yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1950  }
1951 };
1952
1953 auth_can_flood: CAN_FLOOD '=' TBOOL ';'
1954 {
1955  if (ypass == 2)
1956  {
1957    if (yylval.number)
1958      yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1959    else
1960      yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
1961  }
1962 };
1963
1964 auth_no_tilde: NO_TILDE '=' TBOOL ';'
1965 {
1966  if (ypass == 2)
1967  {
1968    if (yylval.number)
1969      yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1970    else
1971      yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
1972  }
1973 };
1974
1975 auth_gline_exempt: GLINE_EXEMPT '=' TBOOL ';'
1976 {
1977  if (ypass == 2)
1978  {
1979    if (yylval.number)
1980      yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1981    else
1982      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
1983  }
1984 };
1985
1859   /* XXX - need check for illegal hostnames here */
1860   auth_spoof: SPOOF '=' QSTRING ';'
1861   {
1862 <  if (ypass == 2)
1862 >  if (conf_parser_ctx.pass == 2)
1863    {
1864      MyFree(yy_conf->name);
1865  
# Line 2005 | Line 1878 | auth_spoof: SPOOF '=' QSTRING ';'
1878  
1879   auth_redir_serv: REDIRSERV '=' QSTRING ';'
1880   {
1881 <  if (ypass == 2)
1881 >  if (conf_parser_ctx.pass == 2)
1882    {
1883      yy_aconf->flags |= CONF_FLAGS_REDIR;
1884      MyFree(yy_conf->name);
# Line 2015 | Line 1888 | auth_redir_serv: REDIRSERV '=' QSTRING '
1888  
1889   auth_redir_port: REDIRPORT '=' NUMBER ';'
1890   {
1891 <  if (ypass == 2)
1891 >  if (conf_parser_ctx.pass == 2)
1892    {
1893      yy_aconf->flags |= CONF_FLAGS_REDIR;
1894      yy_aconf->port = $3;
1895    }
1896   };
1897  
2025 auth_need_password: NEED_PASSWORD '=' TBOOL ';'
2026 {
2027  if (ypass == 2)
2028  {
2029    if (yylval.number)
2030      yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
2031    else
2032      yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2033  }
2034 };
2035
1898  
1899   /***************************************************************************
1900   *  section resv
1901   ***************************************************************************/
1902   resv_entry: RESV
1903   {
1904 <  if (ypass == 2)
1904 >  if (conf_parser_ctx.pass == 2)
1905    {
1906      MyFree(resv_reason);
1907      resv_reason = NULL;
1908    }
1909   } '{' resv_items '}' ';'
1910   {
1911 <  if (ypass == 2)
1911 >  if (conf_parser_ctx.pass == 2)
1912    {
1913      MyFree(resv_reason);
1914      resv_reason = NULL;
# Line 2058 | Line 1920 | resv_item:     resv_creason | resv_channel |
1920  
1921   resv_creason: REASON '=' QSTRING ';'
1922   {
1923 <  if (ypass == 2)
1923 >  if (conf_parser_ctx.pass == 2)
1924    {
1925      MyFree(resv_reason);
1926      DupString(resv_reason, yylval.string);
# Line 2067 | Line 1929 | resv_creason: REASON '=' QSTRING ';'
1929  
1930   resv_channel: CHANNEL '=' QSTRING ';'
1931   {
1932 <  if (ypass == 2)
1932 >  if (conf_parser_ctx.pass == 2)
1933    {
1934      if (IsChanPrefix(*yylval.string))
1935      {
# Line 2082 | Line 1944 | resv_channel: CHANNEL '=' QSTRING ';'
1944  
1945   resv_nick: NICK '=' QSTRING ';'
1946   {
1947 <  if (ypass == 2)
1947 >  if (conf_parser_ctx.pass == 2)
1948    {
1949      char def_reason[] = "No reason";
1950  
# Line 2095 | Line 1957 | resv_nick: NICK '=' QSTRING ';'
1957   ***************************************************************************/
1958   shared_entry: T_SHARED
1959   {
1960 <  if (ypass == 2)
1960 >  if (conf_parser_ctx.pass == 2)
1961    {
1962      yy_conf = make_conf_item(ULINE_TYPE);
1963      yy_match_item = map_to_conf(yy_conf);
# Line 2103 | Line 1965 | shared_entry: T_SHARED
1965    }
1966   } '{' shared_items '}' ';'
1967   {
1968 <  if (ypass == 2)
1968 >  if (conf_parser_ctx.pass == 2)
1969    {
1970      yy_conf = NULL;
1971    }
# Line 2114 | Line 1976 | shared_item:  shared_name | shared_user
1976  
1977   shared_name: NAME '=' QSTRING ';'
1978   {
1979 <  if (ypass == 2)
1979 >  if (conf_parser_ctx.pass == 2)
1980    {
1981      MyFree(yy_conf->name);
1982      DupString(yy_conf->name, yylval.string);
# Line 2123 | Line 1985 | shared_name: NAME '=' QSTRING ';'
1985  
1986   shared_user: USER '=' QSTRING ';'
1987   {
1988 <  if (ypass == 2)
1988 >  if (conf_parser_ctx.pass == 2)
1989    {
1990 <    split_nuh(yylval.string, NULL, &yy_match_item->user, &yy_match_item->host);
1990 >    struct split_nuh_item nuh;
1991 >
1992 >    nuh.nuhmask  = yylval.string;
1993 >    nuh.nickptr  = NULL;
1994 >    nuh.userptr  = userbuf;
1995 >    nuh.hostptr  = hostbuf;
1996 >
1997 >    nuh.nicksize = 0;
1998 >    nuh.usersize = sizeof(userbuf);
1999 >    nuh.hostsize = sizeof(hostbuf);
2000 >
2001 >    split_nuh(&nuh);
2002 >
2003 >    DupString(yy_match_item->user, userbuf);
2004 >    DupString(yy_match_item->host, hostbuf);
2005    }
2006   };
2007  
2008   shared_type: TYPE
2009   {
2010 <  if (ypass == 2)
2010 >  if (conf_parser_ctx.pass == 2)
2011      yy_match_item->action = 0;
2012   } '=' shared_types ';' ;
2013  
2014   shared_types: shared_types ',' shared_type_item | shared_type_item;
2015   shared_type_item: KLINE
2016   {
2017 <  if (ypass == 2)
2017 >  if (conf_parser_ctx.pass == 2)
2018      yy_match_item->action |= SHARED_KLINE;
2019   } | TKLINE
2020   {
2021 <  if (ypass == 2)
2021 >  if (conf_parser_ctx.pass == 2)
2022      yy_match_item->action |= SHARED_TKLINE;
2023   } | UNKLINE
2024   {
2025 <  if (ypass == 2)
2025 >  if (conf_parser_ctx.pass == 2)
2026      yy_match_item->action |= SHARED_UNKLINE;
2027   } | XLINE
2028   {
2029 <  if (ypass == 2)
2029 >  if (conf_parser_ctx.pass == 2)
2030      yy_match_item->action |= SHARED_XLINE;
2031   } | TXLINE
2032   {
2033 <  if (ypass == 2)
2033 >  if (conf_parser_ctx.pass == 2)
2034      yy_match_item->action |= SHARED_TXLINE;
2035   } | T_UNXLINE
2036   {
2037 <  if (ypass == 2)
2037 >  if (conf_parser_ctx.pass == 2)
2038      yy_match_item->action |= SHARED_UNXLINE;
2039   } | RESV
2040   {
2041 <  if (ypass == 2)
2041 >  if (conf_parser_ctx.pass == 2)
2042      yy_match_item->action |= SHARED_RESV;
2043   } | TRESV
2044   {
2045 <  if (ypass == 2)
2045 >  if (conf_parser_ctx.pass == 2)
2046      yy_match_item->action |= SHARED_TRESV;
2047   } | T_UNRESV
2048   {
2049 <  if (ypass == 2)
2049 >  if (conf_parser_ctx.pass == 2)
2050      yy_match_item->action |= SHARED_UNRESV;
2051   } | T_LOCOPS
2052   {
2053 <  if (ypass == 2)
2053 >  if (conf_parser_ctx.pass == 2)
2054      yy_match_item->action |= SHARED_LOCOPS;
2055   } | T_ALL
2056   {
2057 <  if (ypass == 2)
2057 >  if (conf_parser_ctx.pass == 2)
2058      yy_match_item->action = SHARED_ALL;
2059   };
2060  
# Line 2187 | Line 2063 | shared_type_item: KLINE
2063   ***************************************************************************/
2064   cluster_entry: T_CLUSTER
2065   {
2066 <  if (ypass == 2)
2066 >  if (conf_parser_ctx.pass == 2)
2067    {
2068      yy_conf = make_conf_item(CLUSTER_TYPE);
2069      yy_conf->flags = SHARED_ALL;
2070    }
2071   } '{' cluster_items '}' ';'
2072   {
2073 <  if (ypass == 2)
2073 >  if (conf_parser_ctx.pass == 2)
2074    {
2075      if (yy_conf->name == NULL)
2076        DupString(yy_conf->name, "*");
# Line 2207 | Line 2083 | cluster_item:  cluster_name | cluster_typ
2083  
2084   cluster_name: NAME '=' QSTRING ';'
2085   {
2086 <  if (ypass == 2)
2086 >  if (conf_parser_ctx.pass == 2)
2087      DupString(yy_conf->name, yylval.string);
2088   };
2089  
2090   cluster_type: TYPE
2091   {
2092 <  if (ypass == 2)
2092 >  if (conf_parser_ctx.pass == 2)
2093      yy_conf->flags = 0;
2094   } '=' cluster_types ';' ;
2095  
2096   cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2097   cluster_type_item: KLINE
2098   {
2099 <  if (ypass == 2)
2099 >  if (conf_parser_ctx.pass == 2)
2100      yy_conf->flags |= SHARED_KLINE;
2101   } | TKLINE
2102   {
2103 <  if (ypass == 2)
2103 >  if (conf_parser_ctx.pass == 2)
2104      yy_conf->flags |= SHARED_TKLINE;
2105   } | UNKLINE
2106   {
2107 <  if (ypass == 2)
2107 >  if (conf_parser_ctx.pass == 2)
2108      yy_conf->flags |= SHARED_UNKLINE;
2109   } | XLINE
2110   {
2111 <  if (ypass == 2)
2111 >  if (conf_parser_ctx.pass == 2)
2112      yy_conf->flags |= SHARED_XLINE;
2113   } | TXLINE
2114   {
2115 <  if (ypass == 2)
2115 >  if (conf_parser_ctx.pass == 2)
2116      yy_conf->flags |= SHARED_TXLINE;
2117   } | T_UNXLINE
2118   {
2119 <  if (ypass == 2)
2119 >  if (conf_parser_ctx.pass == 2)
2120      yy_conf->flags |= SHARED_UNXLINE;
2121   } | RESV
2122   {
2123 <  if (ypass == 2)
2123 >  if (conf_parser_ctx.pass == 2)
2124      yy_conf->flags |= SHARED_RESV;
2125   } | TRESV
2126   {
2127 <  if (ypass == 2)
2127 >  if (conf_parser_ctx.pass == 2)
2128      yy_conf->flags |= SHARED_TRESV;
2129   } | T_UNRESV
2130   {
2131 <  if (ypass == 2)
2131 >  if (conf_parser_ctx.pass == 2)
2132      yy_conf->flags |= SHARED_UNRESV;
2133   } | T_LOCOPS
2134   {
2135 <  if (ypass == 2)
2135 >  if (conf_parser_ctx.pass == 2)
2136      yy_conf->flags |= SHARED_LOCOPS;
2137   } | T_ALL
2138   {
2139 <  if (ypass == 2)
2139 >  if (conf_parser_ctx.pass == 2)
2140      yy_conf->flags = SHARED_ALL;
2141   };
2142  
# Line 2269 | Line 2145 | cluster_type_item: KLINE
2145   ***************************************************************************/
2146   connect_entry: CONNECT  
2147   {
2148 <  if (ypass == 2)
2148 >  if (conf_parser_ctx.pass == 2)
2149    {
2150      yy_conf = make_conf_item(SERVER_TYPE);
2151      yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
# Line 2287 | Line 2163 | connect_entry: CONNECT
2163    }
2164   } connect_name_b '{' connect_items '}' ';'
2165   {
2166 <  if (ypass == 2)
2166 >  if (conf_parser_ctx.pass == 2)
2167    {
2168      struct CollectItem *yy_hconf=NULL;
2169      struct CollectItem *yy_lconf=NULL;
# Line 2302 | Line 2178 | connect_entry: CONNECT
2178            yy_aconf->passwd && yy_aconf->spasswd)
2179   #endif /* !HAVE_LIBCRYPTO */
2180          {
2181 <          if (conf_add_server(yy_conf, scount, class_name) >= 0)
2306 <          {
2307 <            ++scount;
2308 <          }
2309 <          else
2181 >          if (conf_add_server(yy_conf, class_name) == -1)
2182            {
2183              delete_conf_item(yy_conf);
2184              yy_conf = NULL;
# Line 2422 | Line 2294 | connect_items:  connect_items connect_it
2294   connect_item:   connect_name | connect_host | connect_vhost |
2295                  connect_send_password | connect_accept_password |
2296                  connect_aftype | connect_port |
2297 <                connect_fakename | connect_flags | connect_hub_mask |
2298 <                connect_leaf_mask | connect_class | connect_auto |
2427 <                connect_encrypted | connect_compressed | connect_cryptlink |
2297 >                connect_flags | connect_hub_mask | connect_leaf_mask |
2298 >                connect_class | connect_encrypted |
2299                  connect_rsa_public_key_file | connect_cipher_preference |
2300                  error ';' ;
2301  
2302   connect_name: NAME '=' QSTRING ';'
2303   {
2304 <  if (ypass == 2)
2304 >  if (conf_parser_ctx.pass == 2)
2305    {
2306      if (yy_conf->name != NULL)
2307        yyerror("Multiple connect name entry");
# Line 2442 | Line 2313 | connect_name: NAME '=' QSTRING ';'
2313  
2314   connect_name_t: QSTRING
2315   {
2316 <  if (ypass == 2)
2316 >  if (conf_parser_ctx.pass == 2)
2317    {
2318      if (yy_conf->name != NULL)
2319        yyerror("Multiple connect name entry");
# Line 2454 | Line 2325 | connect_name_t: QSTRING
2325  
2326   connect_host: HOST '=' QSTRING ';'
2327   {
2328 <  if (ypass == 2)
2328 >  if (conf_parser_ctx.pass == 2)
2329    {
2330      MyFree(yy_aconf->host);
2331      DupString(yy_aconf->host, yylval.string);
# Line 2463 | Line 2334 | connect_host: HOST '=' QSTRING ';'
2334  
2335   connect_vhost: VHOST '=' QSTRING ';'
2336   {
2337 <  if (ypass == 2)
2337 >  if (conf_parser_ctx.pass == 2)
2338    {
2339      struct addrinfo hints, *res;
2340  
# Line 2489 | Line 2360 | connect_vhost: VHOST '=' QSTRING ';'
2360  
2361   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2362   {
2363 <  if (ypass == 2)
2363 >  if (conf_parser_ctx.pass == 2)
2364    {
2365 <    if (yy_aconf->spasswd != NULL)
2366 <      memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2365 >    if ($3[0] == ':')
2366 >      yyerror("Server passwords cannot begin with a colon");
2367 >    else if (strchr($3, ' ') != NULL)
2368 >      yyerror("Server passwords cannot contain spaces");
2369 >    else {
2370 >      if (yy_aconf->spasswd != NULL)
2371 >        memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2372  
2373 <    MyFree(yy_aconf->spasswd);
2374 <    DupString(yy_aconf->spasswd, yylval.string);
2373 >      MyFree(yy_aconf->spasswd);
2374 >      DupString(yy_aconf->spasswd, yylval.string);
2375 >    }
2376    }
2377   };
2378  
2379   connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2380   {
2381 <  if (ypass == 2)
2381 >  if (conf_parser_ctx.pass == 2)
2382    {
2383 <    if (yy_aconf->passwd != NULL)
2384 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2383 >    if ($3[0] == ':')
2384 >      yyerror("Server passwords cannot begin with a colon");
2385 >    else if (strchr($3, ' ') != NULL)
2386 >      yyerror("Server passwords cannot contain spaces");
2387 >    else {
2388 >      if (yy_aconf->passwd != NULL)
2389 >        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2390  
2391 <    MyFree(yy_aconf->passwd);
2392 <    DupString(yy_aconf->passwd, yylval.string);
2391 >      MyFree(yy_aconf->passwd);
2392 >      DupString(yy_aconf->passwd, yylval.string);
2393 >    }
2394    }
2395   };
2396  
2397   connect_port: PORT '=' NUMBER ';'
2398   {
2399 <  if (ypass == 2)
2399 >  if (conf_parser_ctx.pass == 2)
2400      yy_aconf->port = $3;
2401   };
2402  
2403   connect_aftype: AFTYPE '=' T_IPV4 ';'
2404   {
2405 <  if (ypass == 2)
2405 >  if (conf_parser_ctx.pass == 2)
2406      yy_aconf->aftype = AF_INET;
2407   } | AFTYPE '=' T_IPV6 ';'
2408   {
2409   #ifdef IPV6
2410 <  if (ypass == 2)
2410 >  if (conf_parser_ctx.pass == 2)
2411      yy_aconf->aftype = AF_INET6;
2412   #endif
2413   };
2414  
2532 connect_fakename: FAKENAME '=' QSTRING ';'
2533 {
2534  if (ypass == 2)
2535  {
2536    MyFree(yy_aconf->fakename);
2537    DupString(yy_aconf->fakename, yylval.string);
2538  }
2539 };
2540
2415   connect_flags: IRCD_FLAGS
2416   {
2417   } '='  connect_flags_items ';';
2418  
2419   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2420 < connect_flags_item: NOT connect_flags_item_atom { not_atom = 1; }
2421 <                        | connect_flags_item_atom { not_atom = 0; };
2420 > connect_flags_item: NOT  { not_atom = 1; } connect_flags_item_atom
2421 >                        |  { not_atom = 0; } connect_flags_item_atom;
2422  
2423 < connect_flags_item_atom: LAZYLINK
2423 > connect_flags_item_atom: COMPRESSED
2424   {
2425 <  if (ypass == 2)
2552 <  {
2553 <    if (not_atom)ClearConfLazyLink(yy_aconf);
2554 <    else SetConfLazyLink(yy_aconf);
2555 <  }
2556 < } | COMPRESSED
2557 < {
2558 <  if (ypass == 2)
2425 >  if (conf_parser_ctx.pass == 2)
2426   #ifndef HAVE_LIBZ
2427      yyerror("Ignoring flags = compressed; -- no zlib support");
2428   #else
# Line 2566 | Line 2433 | connect_flags_item_atom: LAZYLINK
2433   #endif
2434   } | CRYPTLINK
2435   {
2436 <  if (ypass == 2)
2436 >  if (conf_parser_ctx.pass == 2)
2437    {
2438      if (not_atom)ClearConfCryptLink(yy_aconf);
2439      else SetConfCryptLink(yy_aconf);
2440    }
2441   } | AUTOCONN
2442   {
2443 <  if (ypass == 2)
2443 >  if (conf_parser_ctx.pass == 2)
2444    {
2445      if (not_atom)ClearConfAllowAutoConn(yy_aconf);
2446      else SetConfAllowAutoConn(yy_aconf);
2447    }
2448   } | BURST_AWAY
2449   {
2450 <  if (ypass == 2)
2450 >  if (conf_parser_ctx.pass == 2)
2451    {
2452      if (not_atom)ClearConfAwayBurst(yy_aconf);
2453      else SetConfAwayBurst(yy_aconf);
2454    }
2455   } | TOPICBURST
2456   {
2457 <  if (ypass == 2)
2457 >  if (conf_parser_ctx.pass == 2)
2458    {
2459      if (not_atom)ClearConfTopicBurst(yy_aconf);
2460      else SetConfTopicBurst(yy_aconf);
# Line 2598 | Line 2465 | connect_flags_item_atom: LAZYLINK
2465   connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2466   {
2467   #ifdef HAVE_LIBCRYPTO
2468 <  if (ypass == 2)
2468 >  if (conf_parser_ctx.pass == 2)
2469    {
2470      BIO *file;
2471  
# Line 2638 | Line 2505 | connect_rsa_public_key_file: RSA_PUBLIC_
2505  
2506   connect_encrypted: ENCRYPTED '=' TBOOL ';'
2507   {
2508 <  if (ypass == 2)
2508 >  if (conf_parser_ctx.pass == 2)
2509    {
2510      if (yylval.number)
2511        yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
# Line 2647 | Line 2514 | connect_encrypted: ENCRYPTED '=' TBOOL '
2514    }
2515   };
2516  
2650 connect_cryptlink: CRYPTLINK '=' TBOOL ';'
2651 {
2652  if (ypass == 2)
2653  {
2654    if (yylval.number)
2655      yy_aconf->flags |= CONF_FLAGS_CRYPTLINK;
2656    else
2657      yy_aconf->flags &= ~CONF_FLAGS_CRYPTLINK;
2658  }
2659 };
2660
2661 connect_compressed: COMPRESSED '=' TBOOL ';'
2662 {
2663  if (ypass == 2)
2664  {
2665    if (yylval.number)
2666 #ifndef HAVE_LIBZ
2667      yyerror("Ignoring compressed=yes; -- no zlib support");
2668 #else
2669      yy_aconf->flags |= CONF_FLAGS_COMPRESSED;
2670 #endif
2671    else
2672      yy_aconf->flags &= ~CONF_FLAGS_COMPRESSED;
2673  }
2674 };
2675
2676 connect_auto: AUTOCONN '=' TBOOL ';'
2677 {
2678  if (ypass == 2)
2679  {
2680    if (yylval.number)
2681      yy_aconf->flags |= CONF_FLAGS_ALLOW_AUTO_CONN;
2682    else
2683      yy_aconf->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN;
2684  }
2685 };
2686
2517   connect_hub_mask: HUB_MASK '=' QSTRING ';'
2518   {
2519 <  if (ypass == 2)
2519 >  if (conf_parser_ctx.pass == 2)
2520    {
2521      struct CollectItem *yy_tmp;
2522  
# Line 2699 | Line 2529 | connect_hub_mask: HUB_MASK '=' QSTRING '
2529  
2530   connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2531   {
2532 <  if (ypass == 2)
2532 >  if (conf_parser_ctx.pass == 2)
2533    {
2534      struct CollectItem *yy_tmp;
2535  
# Line 2712 | Line 2542 | connect_leaf_mask: LEAF_MASK '=' QSTRING
2542  
2543   connect_class: CLASS '=' QSTRING ';'
2544   {
2545 <  if (ypass == 2)
2545 >  if (conf_parser_ctx.pass == 2)
2546    {
2547      MyFree(class_name);
2548      DupString(class_name, yylval.string);
# Line 2722 | Line 2552 | connect_class: CLASS '=' QSTRING ';'
2552   connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2553   {
2554   #ifdef HAVE_LIBCRYPTO
2555 <  if (ypass == 2)
2555 >  if (conf_parser_ctx.pass == 2)
2556    {
2557      struct EncCapability *ecap;
2558      const char *cipher_name;
# Line 2746 | Line 2576 | connect_cipher_preference: CIPHER_PREFER
2576        yyerror("Invalid cipher");
2577    }
2578   #else
2579 <  if (ypass == 2)
2579 >  if (conf_parser_ctx.pass == 2)
2580      yyerror("Ignoring cipher_preference -- no OpenSSL support");
2581   #endif
2582   };
# Line 2756 | Line 2586 | connect_cipher_preference: CIPHER_PREFER
2586   ***************************************************************************/
2587   kill_entry: KILL
2588   {
2589 <  if (ypass == 2)
2589 >  if (conf_parser_ctx.pass == 2)
2590    {
2591      userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2592      regex_ban = 0;
2593    }
2594   } '{' kill_items '}' ';'
2595   {
2596 <  if (ypass == 2)
2596 >  if (conf_parser_ctx.pass == 2)
2597    {
2598      if (userbuf[0] && hostbuf[0])
2599      {
2600        if (regex_ban)
2601        {
2602 <        pcre *exp_user = NULL;
2603 <        pcre *exp_host = NULL;
2602 > #ifdef HAVE_LIBPCRE
2603 >        void *exp_user = NULL;
2604 >        void *exp_host = NULL;
2605          const char *errptr = NULL;
2606  
2607          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2608              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2609          {
2610 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s", errptr);
2610 >          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2611 >               errptr);
2612            break;
2613          }
2614  
2615 <        yy_conf = make_conf_item(RKLINE_TYPE);
2615 >        yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE));
2616          yy_aconf->regexuser = exp_user;
2617          yy_aconf->regexhost = exp_host;
2618  
# Line 2791 | Line 2623 | kill_entry: KILL
2623            DupString(yy_aconf->reason, reasonbuf);
2624          else
2625            DupString(yy_aconf->reason, "No reason");
2626 + #else
2627 +        ilog(L_ERROR, "Failed to add regular expression based K-Line: no PCRE support");
2628 +        break;
2629 + #endif
2630        }
2631        else
2632        {
2633 <        yy_conf = make_conf_item(KLINE_TYPE);
2798 <        yy_aconf = map_to_conf(yy_conf);
2633 >        yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2634  
2635          DupString(yy_aconf->user, userbuf);
2636          DupString(yy_aconf->host, hostbuf);
# Line 2807 | Line 2642 | kill_entry: KILL
2642          add_conf_by_address(CONF_KILL, yy_aconf);
2643        }
2644      }
2810    else
2811      delete_conf_item(yy_conf);
2645  
2813    yy_conf = NULL;
2646      yy_aconf = NULL;
2647    }
2648   };
# Line 2822 | Line 2654 | kill_type: TYPE
2654   kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2655   kill_type_item: REGEX_T
2656   {
2657 <  if (ypass == 2)
2657 >  if (conf_parser_ctx.pass == 2)
2658      regex_ban = 1;
2659   };
2660  
# Line 2831 | Line 2663 | kill_item:      kill_user | kill_reason
2663  
2664   kill_user: USER '=' QSTRING ';'
2665   {
2666 <  if (ypass == 2)
2666 >  if (conf_parser_ctx.pass == 2)
2667    {
2668 <    char *user = NULL, *host = NULL;
2668 >    struct split_nuh_item nuh;
2669  
2670 <    split_nuh(yylval.string, NULL, &user, &host);
2670 >    nuh.nuhmask  = yylval.string;
2671 >    nuh.nickptr  = NULL;
2672 >    nuh.userptr  = userbuf;
2673 >    nuh.hostptr  = hostbuf;
2674  
2675 <    strlcpy(userbuf, user, sizeof(userbuf));
2676 <    strlcpy(hostbuf, host, sizeof(hostbuf));
2675 >    nuh.nicksize = 0;
2676 >    nuh.usersize = sizeof(userbuf);
2677 >    nuh.hostsize = sizeof(hostbuf);
2678  
2679 <    MyFree(user);
2844 <    MyFree(host);
2679 >    split_nuh(&nuh);
2680    }
2681   };
2682  
2683   kill_reason: REASON '=' QSTRING ';'
2684   {
2685 <  if (ypass == 2)
2685 >  if (conf_parser_ctx.pass == 2)
2686      strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2687   };
2688  
# Line 2856 | Line 2691 | kill_reason: REASON '=' QSTRING ';'
2691   ***************************************************************************/
2692   deny_entry: DENY
2693   {
2694 <  if (ypass == 2)
2695 <  {
2861 <    yy_conf = make_conf_item(DLINE_TYPE);
2862 <    yy_aconf = map_to_conf(yy_conf);
2863 <    /* default reason */
2864 <    DupString(yy_aconf->reason, "No reason");
2865 <  }
2694 >  if (conf_parser_ctx.pass == 2)
2695 >    hostbuf[0] = reasonbuf[0] = '\0';
2696   } '{' deny_items '}' ';'
2697   {
2698 <  if (ypass == 2)
2698 >  if (conf_parser_ctx.pass == 2)
2699    {
2700 <    if (yy_aconf->host && parse_netmask(yy_aconf->host, NULL, NULL) != HM_HOST)
2700 >    if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
2701 >    {
2702 >      yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2703 >      DupString(yy_aconf->host, hostbuf);
2704 >
2705 >      if (reasonbuf[0])
2706 >        DupString(yy_aconf->reason, reasonbuf);
2707 >      else
2708 >        DupString(yy_aconf->reason, "No reason");
2709        add_conf_by_address(CONF_DLINE, yy_aconf);
2710 <    else
2711 <      delete_conf_item(yy_conf);
2874 <    yy_conf = NULL;
2875 <    yy_aconf = NULL;
2710 >      yy_aconf = NULL;
2711 >    }
2712    }
2713   };
2714  
# Line 2881 | Line 2717 | deny_item:      deny_ip | deny_reason |
2717  
2718   deny_ip: IP '=' QSTRING ';'
2719   {
2720 <  if (ypass == 2)
2721 <  {
2886 <    MyFree(yy_aconf->host);
2887 <    DupString(yy_aconf->host, yylval.string);
2888 <  }
2720 >  if (conf_parser_ctx.pass == 2)
2721 >    strlcpy(hostbuf, yylval.string, sizeof(hostbuf));
2722   };
2723  
2724   deny_reason: REASON '=' QSTRING ';'
2725   {
2726 <  if (ypass == 2)
2727 <  {
2895 <    MyFree(yy_aconf->reason);
2896 <    DupString(yy_aconf->reason, yylval.string);
2897 <  }
2726 >  if (conf_parser_ctx.pass == 2)
2727 >    strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2728   };
2729  
2730   /***************************************************************************
# Line 2907 | Line 2737 | exempt_item:      exempt_ip | error;
2737  
2738   exempt_ip: IP '=' QSTRING ';'
2739   {
2740 <  if (ypass == 2)
2740 >  if (conf_parser_ctx.pass == 2)
2741    {
2742      if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2743      {
2744 <      yy_conf = make_conf_item(EXEMPTDLINE_TYPE);
2915 <      yy_aconf = map_to_conf(yy_conf);
2744 >      yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE));
2745        DupString(yy_aconf->host, yylval.string);
2746  
2747        add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
2919
2920      yy_conf = NULL;
2748        yy_aconf = NULL;
2749      }
2750    }
# Line 2928 | Line 2755 | exempt_ip: IP '=' QSTRING ';'
2755   ***************************************************************************/
2756   gecos_entry: GECOS
2757   {
2758 <  if (ypass == 2)
2758 >  if (conf_parser_ctx.pass == 2)
2759    {
2760      regex_ban = 0;
2761      reasonbuf[0] = gecos_name[0] = '\0';
2762    }
2763   } '{' gecos_items '}' ';'
2764   {
2765 <  if (ypass == 2)
2765 >  if (conf_parser_ctx.pass == 2)
2766    {
2767      if (gecos_name[0])
2768      {
2769        if (regex_ban)
2770        {
2771 <        pcre *exp_p = NULL;
2771 > #ifdef HAVE_LIBPCRE
2772 >        void *exp_p = NULL;
2773          const char *errptr = NULL;
2774  
2775          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2776          {
2777 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s", errptr);
2777 >          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
2778 >               errptr);
2779            break;
2780          }
2781  
2782          yy_conf = make_conf_item(RXLINE_TYPE);
2783          yy_conf->regexpname = exp_p;
2784 + #else
2785 +        ilog(L_ERROR, "Failed to add regular expression based X-Line: no PCRE support");
2786 +        break;
2787 + #endif
2788        }
2789        else
2790          yy_conf = make_conf_item(XLINE_TYPE);
# Line 2974 | Line 2807 | gecos_flags: TYPE
2807   gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2808   gecos_flags_item: REGEX_T
2809   {
2810 <  if (ypass == 2)
2810 >  if (conf_parser_ctx.pass == 2)
2811      regex_ban = 1;
2812   };
2813  
# Line 2983 | Line 2816 | gecos_item:  gecos_name | gecos_reason |
2816  
2817   gecos_name: NAME '=' QSTRING ';'
2818   {
2819 <  if (ypass == 2)
2819 >  if (conf_parser_ctx.pass == 2)
2820      strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
2821   };
2822  
2823   gecos_reason: REASON '=' QSTRING ';'
2824   {
2825 <  if (ypass == 2)
2825 >  if (conf_parser_ctx.pass == 2)
2826      strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2827   };
2828  
# Line 3023 | Line 2856 | general_item:       general_hide_spoof_i
2856                      general_default_cipher_preference |
2857                      general_compression_level | general_client_flood |
2858                      general_throttle_time | general_havent_read_conf |
2859 <                    general_dot_in_ip6_addr | general_ping_cookie |
2859 >                    general_ping_cookie |
2860                      general_disable_auth | general_burst_away |
2861                      general_tkline_expire_notices | general_gline_min_cidr |
2862                      general_gline_min_cidr6 | general_use_whois_actually |
2863 <                    general_reject_hold_time |
2863 >                    general_reject_hold_time | general_stats_e_disabled |
2864 >                    general_max_watch |
2865                      error;
2866  
2867  
2868 + general_max_watch: MAX_WATCH '=' NUMBER ';'
2869 + {
2870 +  ConfigFileEntry.max_watch = $3;
2871 + };
2872  
2873   general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2874   {
# Line 3062 | Line 2900 | general_tkline_expire_notices: TKLINE_EX
2900    ConfigFileEntry.tkline_expire_notices = yylval.number;
2901   };
2902  
2903 < general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' NUMBER ';'
2903 > general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2904   {
2905    ConfigFileEntry.kill_chase_time_limit = $3;
2906   };
# Line 3119 | Line 2957 | general_ts_warn_delta: TS_WARN_DELTA '='
2957  
2958   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2959   {
2960 <  if (ypass == 2)
2960 >  if (conf_parser_ctx.pass == 2)
2961      ConfigFileEntry.ts_max_delta = $3;
2962   };
2963  
2964   general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2965   {
2966 <  if (($3 > 0) && ypass == 1)
2966 >  if (($3 > 0) && conf_parser_ctx.pass == 1)
2967    {
2968      ilog(L_CRIT, "You haven't read your config file properly.");
2969      ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
# Line 3141 | Line 2979 | general_kline_with_reason: KLINE_WITH_RE
2979  
2980   general_kline_reason: KLINE_REASON '=' QSTRING ';'
2981   {
2982 <  if (ypass == 2)
2982 >  if (conf_parser_ctx.pass == 2)
2983    {
2984      MyFree(ConfigFileEntry.kline_reason);
2985      DupString(ConfigFileEntry.kline_reason, yylval.string);
# Line 3158 | Line 2996 | general_warn_no_nline: WARN_NO_NLINE '='
2996    ConfigFileEntry.warn_no_nline = yylval.number;
2997   };
2998  
2999 + general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
3000 + {
3001 +  ConfigFileEntry.stats_e_disabled = yylval.number;
3002 + };
3003 +
3004   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
3005   {
3006    ConfigFileEntry.stats_o_oper_only = yylval.number;
# Line 3226 | Line 3069 | general_oper_pass_resv: OPER_PASS_RESV '
3069  
3070   general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
3071   {
3072 <  if (ypass == 2)
3072 >  if (conf_parser_ctx.pass == 2)
3073    {
3074      if (strlen(yylval.string) > LOCALE_LENGTH-2)
3075        yylval.string[LOCALE_LENGTH-1] = '\0';
# Line 3252 | Line 3095 | general_max_targets: MAX_TARGETS '=' NUM
3095  
3096   general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3097   {
3098 <  if (ypass == 2)
3098 >  if (conf_parser_ctx.pass == 2)
3099    {
3100      MyFree(ConfigFileEntry.servlink_path);
3101      DupString(ConfigFileEntry.servlink_path, yylval.string);
# Line 3262 | Line 3105 | general_servlink_path: SERVLINK_PATH '='
3105   general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3106   {
3107   #ifdef HAVE_LIBCRYPTO
3108 <  if (ypass == 2)
3108 >  if (conf_parser_ctx.pass == 2)
3109    {
3110      struct EncCapability *ecap;
3111      const char *cipher_name;
# Line 3286 | Line 3129 | general_default_cipher_preference: DEFAU
3129        yyerror("Invalid cipher");
3130    }
3131   #else
3132 <  if (ypass == 2)
3132 >  if (conf_parser_ctx.pass == 2)
3133      yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3134   #endif
3135   };
3136  
3137   general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3138   {
3139 <  if (ypass == 2)
3139 >  if (conf_parser_ctx.pass == 2)
3140    {
3141      ConfigFileEntry.compression_level = $3;
3142   #ifndef HAVE_LIBZ
# Line 3316 | Line 3159 | general_use_egd: USE_EGD '=' TBOOL ';'
3159  
3160   general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
3161   {
3162 <  if (ypass == 2)
3162 >  if (conf_parser_ctx.pass == 2)
3163    {
3164      MyFree(ConfigFileEntry.egdpool_path);
3165      DupString(ConfigFileEntry.egdpool_path, yylval.string);
# Line 3350 | Line 3193 | umode_oitem:     T_BOTS
3193   } | T_CCONN
3194   {
3195    ConfigFileEntry.oper_umodes |= UMODE_CCONN;
3196 + } | T_CCONN_FULL
3197 + {
3198 +  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
3199   } | T_DEAF
3200   {
3201    ConfigFileEntry.oper_umodes |= UMODE_DEAF;
# Line 3412 | Line 3258 | umode_item:    T_BOTS
3258   } | T_CCONN
3259   {
3260    ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
3261 + } | T_CCONN_FULL
3262 + {
3263 +  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
3264   } | T_DEAF
3265   {
3266    ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
# Line 3482 | Line 3331 | general_client_flood: T_CLIENT_FLOOD '='
3331    ConfigFileEntry.client_flood = $3;
3332   };
3333  
3485 general_dot_in_ip6_addr: DOT_IN_IP6_ADDR '=' TBOOL ';'
3486 {
3487  ConfigFileEntry.dot_in_ip6_addr = yylval.number;
3488 };
3334  
3335   /***************************************************************************
3336   *  section glines
3337   ***************************************************************************/
3338   gline_entry: GLINES
3339   {
3340 <  if (ypass == 2)
3340 >  if (conf_parser_ctx.pass == 2)
3341    {
3342      yy_conf = make_conf_item(GDENY_TYPE);
3343 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
3499 <    yy_aconf->flags = 0;
3343 >    yy_aconf = map_to_conf(yy_conf);
3344    }
3345   } '{' gline_items '}' ';'
3346   {
3347 <  if (ypass == 2)
3347 >  if (conf_parser_ctx.pass == 2)
3348    {
3349      /*
3350       * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3351       * end we will have one extra, so we should free it.
3352       */
3353 <    if (yy_conf->name == NULL && gdeny_items.length)
3353 >    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3354      {
3355 <      dlinkDelete(gdeny_items.tail, &gdeny_items);
3512 <      MyFree(yy_conf);
3355 >      delete_conf_item(yy_conf);
3356        yy_conf = NULL;
3357        yy_aconf = NULL;
3358      }
# Line 3527 | Line 3370 | gline_item:         gline_enable |
3370  
3371   gline_enable: ENABLE '=' TBOOL ';'
3372   {
3373 <  if (ypass == 2)
3373 >  if (conf_parser_ctx.pass == 2)
3374      ConfigFileEntry.glines = yylval.number;
3375   };
3376  
3377   gline_duration: DURATION '=' timespec ';'
3378   {
3379 <  if (ypass == 2)
3379 >  if (conf_parser_ctx.pass == 2)
3380      ConfigFileEntry.gline_time = $3;
3381   };
3382  
3383   gline_logging: LOGGING
3384   {
3385 <  if (ypass == 2)
3385 >  if (conf_parser_ctx.pass == 2)
3386      ConfigFileEntry.gline_logging = 0;
3387   } '=' gline_logging_types ';';
3388   gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3389   gline_logging_type_item: T_REJECT
3390   {
3391 <  if (ypass == 2)
3391 >  if (conf_parser_ctx.pass == 2)
3392      ConfigFileEntry.gline_logging |= GDENY_REJECT;
3393   } | T_BLOCK
3394   {
3395 <  if (ypass == 2)
3395 >  if (conf_parser_ctx.pass == 2)
3396      ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3397   };
3398  
3399   gline_user: USER '=' QSTRING ';'
3400   {
3401 <  if (ypass == 2)
3401 >  if (conf_parser_ctx.pass == 2)
3402    {
3403 <    struct CollectItem *yy_tmp;
3403 >    struct split_nuh_item nuh;
3404 >
3405 >    nuh.nuhmask  = yylval.string;
3406 >    nuh.nickptr  = NULL;
3407 >    nuh.userptr  = userbuf;
3408 >    nuh.hostptr  = hostbuf;
3409 >
3410 >    nuh.nicksize = 0;
3411 >    nuh.usersize = sizeof(userbuf);
3412 >    nuh.hostsize = sizeof(hostbuf);
3413 >
3414 >    split_nuh(&nuh);
3415  
3416      if (yy_aconf->user == NULL)
3417      {
3418 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
3418 >      DupString(yy_aconf->user, userbuf);
3419 >      DupString(yy_aconf->host, hostbuf);
3420      }
3421      else
3422      {
3423 <      yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
3424 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
3423 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3424 >
3425 >      DupString(yy_tmp->user, userbuf);
3426 >      DupString(yy_tmp->host, hostbuf);
3427 >
3428        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3429      }
3430    }
# Line 3574 | Line 3432 | gline_user: USER '=' QSTRING ';'
3432  
3433   gline_server: NAME '=' QSTRING ';'
3434   {
3435 <  if (ypass == 2)  
3435 >  if (conf_parser_ctx.pass == 2)  
3436    {
3437      MyFree(yy_conf->name);
3438      DupString(yy_conf->name, yylval.string);
# Line 3583 | Line 3441 | gline_server: NAME '=' QSTRING ';'
3441  
3442   gline_action: ACTION
3443   {
3444 <  if (ypass == 2)
3444 >  if (conf_parser_ctx.pass == 2)
3445      yy_aconf->flags = 0;
3446   } '=' gdeny_types ';'
3447   {
3448 <  if (ypass == 2)
3448 >  if (conf_parser_ctx.pass == 2)
3449    {
3450 <    struct CollectItem *yy_tmp;
3450 >    struct CollectItem *yy_tmp = NULL;
3451      dlink_node *ptr, *next_ptr;
3452  
3453      DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
# Line 3599 | Line 3457 | gline_action: ACTION
3457  
3458        yy_tmp = ptr->data;
3459        new_conf = make_conf_item(GDENY_TYPE);
3460 <      new_aconf = (struct AccessItem *)map_to_conf(new_conf);
3460 >      new_aconf = map_to_conf(new_conf);
3461  
3462        new_aconf->flags = yy_aconf->flags;
3463  
# Line 3618 | Line 3476 | gline_action: ACTION
3476  
3477        dlinkDelete(&yy_tmp->node, &col_conf_list);
3478      }
3479 +
3480 +    /*
3481 +     * In case someone has fed us with more than one action= after user/name
3482 +     * which would leak memory  -Michael
3483 +     */
3484 +    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3485 +      delete_conf_item(yy_conf);
3486 +
3487      yy_conf = make_conf_item(GDENY_TYPE);
3488 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
3623 <    yy_aconf->flags = 0;
3488 >    yy_aconf = map_to_conf(yy_conf);
3489    }
3490   };
3491  
3492   gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3493   gdeny_type_item: T_REJECT
3494   {
3495 <  if (ypass == 2)
3495 >  if (conf_parser_ctx.pass == 2)
3496      yy_aconf->flags |= GDENY_REJECT;
3497   } | T_BLOCK
3498   {
3499 <  if (ypass == 2)
3499 >  if (conf_parser_ctx.pass == 2)
3500      yy_aconf->flags |= GDENY_BLOCK;
3501   };
3502  
# Line 3645 | Line 3510 | channel_items:      channel_items channe
3510   channel_item:       channel_disable_local_channels | channel_use_except |
3511                      channel_use_invex | channel_use_knock |
3512                      channel_max_bans | channel_knock_delay |
3513 <                    channel_knock_delay_channel | channel_invite_ops_only |
3514 <                    channel_max_chans_per_user | channel_quiet_on_ban |
3515 <                    channel_default_split_user_count |
3516 <                    channel_default_split_server_count |
3517 <                    channel_no_create_on_split | channel_restrict_channels |
3518 <                    channel_no_join_on_split | channel_burst_topicwho |
3519 <                    channel_jflood_count | channel_jflood_time |
3520 <                    error;
3513 >                    channel_knock_delay_channel | channel_max_chans_per_user |
3514 >                    channel_quiet_on_ban | channel_default_split_user_count |
3515 >                    channel_default_split_server_count |
3516 >                    channel_no_create_on_split | channel_restrict_channels |
3517 >                    channel_no_join_on_split | channel_burst_topicwho |
3518 >                    channel_jflood_count | channel_jflood_time |
3519 >                    channel_disable_fake_channels | error;
3520 >
3521 > channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
3522 > {
3523 >  ConfigChannel.disable_fake_channels = yylval.number;
3524 > };
3525  
3526   channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3527   {
# Line 3689 | Line 3558 | channel_knock_delay_channel: KNOCK_DELAY
3558    ConfigChannel.knock_delay_channel = $3;
3559   };
3560  
3692 channel_invite_ops_only: INVITE_OPS_ONLY '=' TBOOL ';'
3693 {
3694  ConfigChannel.invite_ops_only = yylval.number;
3695 };
3696
3561   channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3562   {
3563    ConfigChannel.max_chans_per_user = $3;
# Line 3760 | Line 3624 | serverhide_item:    serverhide_flatten_l
3624  
3625   serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3626   {
3627 <  if (ypass == 2)
3627 >  if (conf_parser_ctx.pass == 2)
3628      ConfigServerHide.flatten_links = yylval.number;
3629   };
3630  
3631   serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3632   {
3633 <  if (ypass == 2)
3633 >  if (conf_parser_ctx.pass == 2)
3634      ConfigServerHide.hide_servers = yylval.number;
3635   };
3636  
3637   serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3638   {
3639 <  if (ypass == 2)
3639 >  if (conf_parser_ctx.pass == 2)
3640    {
3641      MyFree(ConfigServerHide.hidden_name);
3642      DupString(ConfigServerHide.hidden_name, yylval.string);
# Line 3781 | Line 3645 | serverhide_hidden_name: HIDDEN_NAME '='
3645  
3646   serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3647   {
3648 <  if (ypass == 2)
3648 >  if (conf_parser_ctx.pass == 2)
3649    {
3650      if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3651      {
# Line 3795 | Line 3659 | serverhide_links_delay: LINKS_DELAY '='
3659  
3660   serverhide_hidden: HIDDEN '=' TBOOL ';'
3661   {
3662 <  if (ypass == 2)
3662 >  if (conf_parser_ctx.pass == 2)
3663      ConfigServerHide.hidden = yylval.number;
3664   };
3665  
3666   serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3667   {
3668 <  if (ypass == 2)
3668 >  if (conf_parser_ctx.pass == 2)
3669      ConfigServerHide.disable_hidden = yylval.number;
3670   };
3671  
3672   serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3673   {
3674 <  if (ypass == 2)
3674 >  if (conf_parser_ctx.pass == 2)
3675      ConfigServerHide.hide_server_ips = yylval.number;
3676   };

Diff Legend

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