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/src/ircd_parser.y (file contents), Revision 33 by knight, Sun Oct 2 20:50:00 2005 UTC vs.
ircd-hybrid-7.2/src/ircd_parser.y (file contents), Revision 1005 by michael, Mon Aug 31 23:07:43 2009 UTC

# Line 26 | Line 26
26  
27   #define YY_NO_UNPUT
28   #include <sys/types.h>
29 + #include <string.h>
30  
31   #include "stdinc.h"
31 #include "dalloca.h"
32   #include "ircd.h"
33   #include "tools.h"
34   #include "list.h"
# Line 42 | Line 42
42   #include "sprintf_irc.h"
43   #include "memory.h"
44   #include "modules.h"
45 < #include "s_serv.h" /* for CAP_LL / IsCapable */
45 > #include "s_serv.h"
46   #include "hostmask.h"
47   #include "send.h"
48   #include "listener.h"
# Line 79 | Line 79 | static char *resv_reason = NULL;
79   static char *listener_address = NULL;
80   static int not_atom = 0;
81  
82 < struct CollectItem {
82 > struct CollectItem
83 > {
84    dlink_node node;
85    char *name;
86    char *user;
# Line 169 | Line 170 | unhook_hub_leaf_confs(void)
170   %token  DESCRIPTION
171   %token  DIE
172   %token  DISABLE_AUTH
173 + %token  DISABLE_FAKE_CHANNELS
174   %token  DISABLE_HIDDEN
175   %token  DISABLE_LOCAL_CHANNELS
176   %token  DISABLE_REMOTE_COMMANDS
# Line 228 | Line 230 | unhook_hub_leaf_confs(void)
230   %token  KLINE_WITH_REASON
231   %token  KNOCK_DELAY
232   %token  KNOCK_DELAY_CHANNEL
231 %token  LAZYLINK
233   %token  LEAF_MASK
234   %token  LINKS_DELAY
235   %token  LISTEN
# Line 245 | Line 246 | unhook_hub_leaf_confs(void)
246   %token  MAX_NICK_TIME
247   %token  MAX_NUMBER
248   %token  MAX_TARGETS
249 + %token  MAX_WATCH
250   %token  MESSAGE_LOCALE
251   %token  MIN_NONWILDCARD
252   %token  MIN_NONWILDCARD_SIMPLE
# Line 273 | Line 275 | unhook_hub_leaf_confs(void)
275   %token  OPER_PASS_RESV
276   %token  OPER_SPY_T
277   %token  OPER_UMODES
276 %token  INVITE_OPS_ONLY
278   %token  JOIN_FLOOD_COUNT
279   %token  JOIN_FLOOD_TIME
280   %token  PACE_WAIT
# Line 299 | Line 300 | unhook_hub_leaf_confs(void)
300   %token  RSA_PRIVATE_KEY_FILE
301   %token  RSA_PUBLIC_KEY_FILE
302   %token  SSL_CERTIFICATE_FILE
303 + %token  T_SSL_CONNECTION_METHOD
304 + %token  T_SSLV3
305 + %token  T_TLSV1
306   %token  RESV
307   %token  RESV_EXEMPT
308   %token  SECONDS MINUTES HOURS DAYS WEEKS
# Line 316 | Line 320 | unhook_hub_leaf_confs(void)
320   %token  SILENT
321   %token  SPOOF
322   %token  SPOOF_NOTICE
323 + %token  STATS_E_DISABLED
324   %token  STATS_I_OPER_ONLY
325   %token  STATS_K_OPER_ONLY
326   %token  STATS_O_OPER_ONLY
# Line 331 | Line 336 | unhook_hub_leaf_confs(void)
336   %token  T_SOFTCALLERID
337   %token  T_CALLERID
338   %token  T_CCONN
339 + %token  T_CCONN_FULL
340   %token  T_CLIENT_FLOOD
341   %token  T_DEAF
342   %token  T_DEBUG
# Line 353 | Line 359 | unhook_hub_leaf_confs(void)
359   %token  T_NCHANGE
360   %token  T_OPERWALL
361   %token  T_REJ
362 + %token  T_SERVER
363   %token  T_SERVNOTICE
364   %token  T_SKILL
365   %token  T_SPY
366   %token  T_SSL
367 + %token  T_UMODES
368   %token  T_UNAUTH
369   %token  T_UNRESV
370   %token  T_UNXLINE
# Line 465 | Line 473 | modules_item:   modules_module | modules
473   modules_module: MODULE '=' QSTRING ';'
474   {
475   #ifndef STATIC_MODULES /* NOOP in the static case */
476 <  if (ypass == 2)
477 <  {
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 <  }
476 >  if (conf_parser_ctx.pass == 2)
477 >    add_conf_module(libio_basename(yylval.string));
478   #endif
479   };
480  
481   modules_path: PATH '=' QSTRING ';'
482   {
483   #ifndef STATIC_MODULES
484 <  if (ypass == 2)
484 >  if (conf_parser_ctx.pass == 2)
485      mod_add_path(yylval.string);
486   #endif
487   };
488  
490 /***************************************************************************
491 *  section serverinfo
492 ***************************************************************************/
493 serverinfo_entry: SERVERINFO
494  '{' serverinfo_items '}' ';';
489  
490 < serverinfo_items:       serverinfo_items serverinfo_item |
491 <                        serverinfo_item ;
490 > serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
491 >
492 > serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
493   serverinfo_item:        serverinfo_name | serverinfo_vhost |
494                          serverinfo_hub | serverinfo_description |
495                          serverinfo_network_name | serverinfo_network_desc |
496                          serverinfo_max_clients |
497                          serverinfo_rsa_private_key_file | serverinfo_vhost6 |
498                          serverinfo_sid | serverinfo_ssl_certificate_file |
499 +                        serverinfo_ssl_connection_method |
500                          error ';' ;
501  
502 +
503 + serverinfo_ssl_connection_method: T_SSL_CONNECTION_METHOD
504 + {
505 +  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
506 +    ServerInfo.tls_version = 0;
507 + } '=' method_types ';'
508 + {
509 +  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
510 +  {
511 +    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3))
512 +      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
513 +    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1))
514 +      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
515 +  }
516 + };
517 +
518 + method_types: method_types ',' method_type_item | method_type_item;
519 + method_type_item: T_SSLV3
520 + {
521 +  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
522 +    ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_SSLV3;
523 + } | T_TLSV1
524 + {
525 +  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
526 +    ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_TLSV1;
527 + };
528 +
529   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
530   {
531   #ifdef HAVE_LIBCRYPTO
532 <  if (ypass == 2 && ServerInfo.ctx)
532 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
533    {
534      if (!ServerInfo.rsa_private_key_file)
535      {
# Line 514 | Line 537 | serverinfo_ssl_certificate_file: SSL_CER
537        break;
538      }
539  
540 <    if (SSL_CTX_use_certificate_file(ServerInfo.ctx,
541 <      yylval.string, SSL_FILETYPE_PEM) <= 0)
540 >    if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
541 >                                     SSL_FILETYPE_PEM) <= 0)
542      {
543        yyerror(ERR_lib_error_string(ERR_get_error()));
544        break;
545      }
546  
547 <    if (SSL_CTX_use_PrivateKey_file(ServerInfo.ctx,
548 <      ServerInfo.rsa_private_key_file, SSL_FILETYPE_PEM) <= 0)
547 >    if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
548 >                                    SSL_FILETYPE_PEM) <= 0)
549      {
550        yyerror(ERR_lib_error_string(ERR_get_error()));
551        break;
552      }
553  
554 <    if (!SSL_CTX_check_private_key(ServerInfo.ctx))
554 >    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx))
555      {
556 <      yyerror("RSA private key does not match the SSL certificate public key!");
556 >      yyerror(ERR_lib_error_string(ERR_get_error()));
557        break;
558      }
559    }
# Line 540 | Line 563 | serverinfo_ssl_certificate_file: SSL_CER
563   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
564   {
565   #ifdef HAVE_LIBCRYPTO
566 <  if (ypass == 1)
566 >  if (conf_parser_ctx.pass == 1)
567    {
568      BIO *file;
569  
# Line 600 | Line 623 | serverinfo_rsa_private_key_file: RSA_PRI
623   serverinfo_name: NAME '=' QSTRING ';'
624   {
625    /* this isn't rehashable */
626 <  if (ypass == 2)
626 >  if (conf_parser_ctx.pass == 2)
627    {
628      if (ServerInfo.name == NULL)
629      {
# Line 614 | Line 637 | serverinfo_name: NAME '=' QSTRING ';'
637   serverinfo_sid: IRCD_SID '=' QSTRING ';'
638   {
639    /* this isn't rehashable */
640 <  if (ypass == 2 && !ServerInfo.sid)
640 >  if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
641    {
642 <    if ((strlen(yylval.string) == IRC_MAXSID) && IsDigit(yylval.string[0])
620 <        && IsAlNum(yylval.string[1]) && IsAlNum(yylval.string[2]))
621 <    {
642 >    if (valid_sid(yylval.string))
643        DupString(ServerInfo.sid, yylval.string);
623    }
644      else
645      {
646        ilog(L_ERROR, "Ignoring config file entry SID -- invalid SID. Aborting.");
# Line 631 | Line 651 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
651  
652   serverinfo_description: DESCRIPTION '=' QSTRING ';'
653   {
654 <  if (ypass == 2)
654 >  if (conf_parser_ctx.pass == 2)
655    {
656      MyFree(ServerInfo.description);
657      DupString(ServerInfo.description,yylval.string);
# Line 640 | Line 660 | serverinfo_description: DESCRIPTION '='
660  
661   serverinfo_network_name: NETWORK_NAME '=' QSTRING ';'
662   {
663 <  if (ypass == 2)
663 >  if (conf_parser_ctx.pass == 2)
664    {
665      char *p;
666  
# Line 654 | Line 674 | serverinfo_network_name: NETWORK_NAME '=
674  
675   serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
676   {
677 <  if (ypass == 2)
677 >  if (conf_parser_ctx.pass == 2)
678    {
679      MyFree(ServerInfo.network_desc);
680      DupString(ServerInfo.network_desc, yylval.string);
# Line 663 | Line 683 | serverinfo_network_desc: NETWORK_DESC '=
683  
684   serverinfo_vhost: VHOST '=' QSTRING ';'
685   {
686 <  if (ypass == 2 && *yylval.string != '*')
686 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
687    {
688      struct addrinfo hints, *res;
689  
# Line 692 | Line 712 | serverinfo_vhost: VHOST '=' QSTRING ';'
712   serverinfo_vhost6: VHOST6 '=' QSTRING ';'
713   {
714   #ifdef IPV6
715 <  if (ypass == 2 && *yylval.string != '*')
715 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
716    {
717      struct addrinfo hints, *res;
718  
# Line 721 | Line 741 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
741  
742   serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
743   {
744 <  if (ypass == 2)
744 >  if (conf_parser_ctx.pass == 2)
745    {
746      recalc_fdlimit(NULL);
747  
# Line 744 | Line 764 | serverinfo_max_clients: T_MAX_CLIENTS '=
764  
765   serverinfo_hub: HUB '=' TBOOL ';'
766   {
767 <  if (ypass == 2)
767 >  if (conf_parser_ctx.pass == 2)
768    {
769      if (yylval.number)
770      {
771 <      /* Don't become a hub if we have a lazylink active. */
772 <      if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL))
773 <      {
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 <      }
771 >      ServerInfo.hub = 1;
772 >      delete_capability("HUB");
773 >      add_capability("HUB", CAP_HUB, 1);
774      }
775      else if (ServerInfo.hub)
776      {
768      dlink_node *ptr = NULL;
777  
778        ServerInfo.hub = 0;
779        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      }
780      }
781    }
782   };
# Line 800 | Line 792 | admin_item:  admin_name | admin_descript
792  
793   admin_name: NAME '=' QSTRING ';'
794   {
795 <  if (ypass == 2)
795 >  if (conf_parser_ctx.pass == 2)
796    {
797      MyFree(AdminInfo.name);
798      DupString(AdminInfo.name, yylval.string);
# Line 809 | Line 801 | admin_name: NAME '=' QSTRING ';'
801  
802   admin_email: EMAIL '=' QSTRING ';'
803   {
804 <  if (ypass == 2)
804 >  if (conf_parser_ctx.pass == 2)
805    {
806      MyFree(AdminInfo.email);
807      DupString(AdminInfo.email, yylval.string);
# Line 818 | Line 810 | admin_email: EMAIL '=' QSTRING ';'
810  
811   admin_description: DESCRIPTION '=' QSTRING ';'
812   {
813 <  if (ypass == 2)
813 >  if (conf_parser_ctx.pass == 2)
814    {
815      MyFree(AdminInfo.description);
816      DupString(AdminInfo.description, yylval.string);
# Line 853 | Line 845 | logging_oper_log:      OPER_LOG '=' QSTRING '
845  
846   logging_fuserlog: FUSERLOG '=' QSTRING ';'
847   {
848 <  if (ypass == 2)
848 >  if (conf_parser_ctx.pass == 2)
849      strlcpy(ConfigLoggingEntry.userlog, yylval.string,
850              sizeof(ConfigLoggingEntry.userlog));
851   };
852  
853   logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
854   {
855 <  if (ypass == 2)
855 >  if (conf_parser_ctx.pass == 2)
856      strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
857              sizeof(ConfigLoggingEntry.failed_operlog));
858   };
859  
860   logging_foperlog: FOPERLOG '=' QSTRING ';'
861   {
862 <  if (ypass == 2)
862 >  if (conf_parser_ctx.pass == 2)
863      strlcpy(ConfigLoggingEntry.operlog, yylval.string,
864              sizeof(ConfigLoggingEntry.operlog));
865   };
866  
867   logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
868   {
869 <  if (ypass == 2)
869 >  if (conf_parser_ctx.pass == 2)
870      strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
871              sizeof(ConfigLoggingEntry.operspylog));
872   };
873  
874   logging_fglinelog: FGLINELOG '=' QSTRING ';'
875   {
876 <  if (ypass == 2)
876 >  if (conf_parser_ctx.pass == 2)
877      strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
878              sizeof(ConfigLoggingEntry.glinelog));
879   };
880  
881   logging_fklinelog: FKLINELOG '=' QSTRING ';'
882   {
883 <  if (ypass == 2)
883 >  if (conf_parser_ctx.pass == 2)
884      strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
885              sizeof(ConfigLoggingEntry.klinelog));
886   };
887  
888   logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
889   {
890 <  if (ypass == 2)
890 >  if (conf_parser_ctx.pass == 2)
891      strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
892              sizeof(ConfigLoggingEntry.ioerrlog));
893   };
894  
895   logging_killlog: FKILLLOG '=' QSTRING ';'
896   {
897 <  if (ypass == 2)
897 >  if (conf_parser_ctx.pass == 2)
898      strlcpy(ConfigLoggingEntry.killlog, yylval.string,
899              sizeof(ConfigLoggingEntry.killlog));
900   };
901  
902   logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
903   {
904 <  if (ypass == 2)
904 >  if (conf_parser_ctx.pass == 2)
905      set_log_level(L_CRIT);
906   } | LOG_LEVEL '=' T_L_ERROR ';'
907   {
908 <  if (ypass == 2)
908 >  if (conf_parser_ctx.pass == 2)
909      set_log_level(L_ERROR);
910   } | LOG_LEVEL '=' T_L_WARN ';'
911   {
912 <  if (ypass == 2)
912 >  if (conf_parser_ctx.pass == 2)
913      set_log_level(L_WARN);
914   } | LOG_LEVEL '=' T_L_NOTICE ';'
915   {
916 <  if (ypass == 2)
916 >  if (conf_parser_ctx.pass == 2)
917      set_log_level(L_NOTICE);
918   } | LOG_LEVEL '=' T_L_TRACE ';'
919   {
920 <  if (ypass == 2)
920 >  if (conf_parser_ctx.pass == 2)
921      set_log_level(L_TRACE);
922   } | LOG_LEVEL '=' T_L_INFO ';'
923   {
924 <  if (ypass == 2)
924 >  if (conf_parser_ctx.pass == 2)
925      set_log_level(L_INFO);
926   } | LOG_LEVEL '=' T_L_DEBUG ';'
927   {
928 <  if (ypass == 2)
928 >  if (conf_parser_ctx.pass == 2)
929      set_log_level(L_DEBUG);
930   };
931  
932   logging_use_logging: USE_LOGGING '=' TBOOL ';'
933   {
934 <  if (ypass == 2)
934 >  if (conf_parser_ctx.pass == 2)
935      ConfigLoggingEntry.use_logging = yylval.number;
936   };
937  
# Line 948 | Line 940 | logging_use_logging: USE_LOGGING '=' TBO
940   ***************************************************************************/
941   oper_entry: OPERATOR
942   {
943 <  if (ypass == 2)
943 >  if (conf_parser_ctx.pass == 2)
944    {
945      yy_conf = make_conf_item(OPER_TYPE);
946      yy_aconf = map_to_conf(yy_conf);
# Line 961 | Line 953 | oper_entry: OPERATOR
953    }
954   } oper_name_b '{' oper_items '}' ';'
955   {
956 <  if (ypass == 2)
956 >  if (conf_parser_ctx.pass == 2)
957    {
958      struct CollectItem *yy_tmp;
959      dlink_node *ptr;
# Line 1043 | Line 1035 | oper_entry: OPERATOR
1035   oper_name_b: | oper_name_t;
1036   oper_items:     oper_items oper_item | oper_item;
1037   oper_item:      oper_name | oper_user | oper_password | oper_hidden_admin |
1038 <                oper_hidden_oper |
1038 >                oper_hidden_oper | oper_umodes |
1039                  oper_class | oper_global_kill | oper_remote |
1040                  oper_kline | oper_xline | oper_unkline |
1041                  oper_gline | oper_nick_changes | oper_remoteban |
# Line 1053 | Line 1045 | oper_item:      oper_name | oper_user |
1045  
1046   oper_name: NAME '=' QSTRING ';'
1047   {
1048 <  if (ypass == 2)
1048 >  if (conf_parser_ctx.pass == 2)
1049    {
1050      if (strlen(yylval.string) > OPERNICKLEN)
1051        yylval.string[OPERNICKLEN] = '\0';
# Line 1065 | Line 1057 | oper_name: NAME '=' QSTRING ';'
1057  
1058   oper_name_t: QSTRING
1059   {
1060 <  if (ypass == 2)
1060 >  if (conf_parser_ctx.pass == 2)
1061    {
1062      if (strlen(yylval.string) > OPERNICKLEN)
1063        yylval.string[OPERNICKLEN] = '\0';
# Line 1077 | Line 1069 | oper_name_t: QSTRING
1069  
1070   oper_user: USER '=' QSTRING ';'
1071   {
1072 <  if (ypass == 2)
1072 >  if (conf_parser_ctx.pass == 2)
1073    {
1074 <    struct CollectItem *yy_tmp;
1074 >    struct split_nuh_item nuh;
1075 >
1076 >    nuh.nuhmask  = yylval.string;
1077 >    nuh.nickptr  = NULL;
1078 >    nuh.userptr  = userbuf;
1079 >    nuh.hostptr  = hostbuf;
1080 >
1081 >    nuh.nicksize = 0;
1082 >    nuh.usersize = sizeof(userbuf);
1083 >    nuh.hostsize = sizeof(hostbuf);
1084 >
1085 >    split_nuh(&nuh);
1086  
1087      if (yy_aconf->user == NULL)
1088      {
1089 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1089 >      DupString(yy_aconf->user, userbuf);
1090 >      DupString(yy_aconf->host, hostbuf);
1091      }
1092      else
1093      {
1094 <      yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
1095 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1094 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1095 >
1096 >      DupString(yy_tmp->user, userbuf);
1097 >      DupString(yy_tmp->host, hostbuf);
1098 >
1099        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1100      }
1101    }
# Line 1096 | Line 1103 | oper_user: USER '=' QSTRING ';'
1103  
1104   oper_password: PASSWORD '=' QSTRING ';'
1105   {
1106 <  if (ypass == 2)
1106 >  if (conf_parser_ctx.pass == 2)
1107    {
1108      if (yy_aconf->passwd != NULL)
1109        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
# Line 1108 | Line 1115 | oper_password: PASSWORD '=' QSTRING ';'
1115  
1116   oper_encrypted: ENCRYPTED '=' TBOOL ';'
1117   {
1118 <  if (ypass == 2)
1118 >  if (conf_parser_ctx.pass == 2)
1119    {
1120      if (yylval.number)
1121        SetConfEncrypted(yy_aconf);
# Line 1120 | Line 1127 | oper_encrypted: ENCRYPTED '=' TBOOL ';'
1127   oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1128   {
1129   #ifdef HAVE_LIBCRYPTO
1130 <  if (ypass == 2)
1130 >  if (conf_parser_ctx.pass == 2)
1131    {
1132      BIO *file;
1133  
# Line 1161 | Line 1168 | oper_rsa_public_key_file: RSA_PUBLIC_KEY
1168  
1169   oper_class: CLASS '=' QSTRING ';'
1170   {
1171 <  if (ypass == 2)
1171 >  if (conf_parser_ctx.pass == 2)
1172    {
1173      MyFree(class_name);
1174      DupString(class_name, yylval.string);
1175    }
1176   };
1177  
1178 + oper_umodes: T_UMODES
1179 + {
1180 +  if (conf_parser_ctx.pass == 2)
1181 +    yy_aconf->modes = 0;
1182 + } '='  oper_umodes_items ';' ;
1183 +
1184 + oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1185 + oper_umodes_item:  T_BOTS
1186 + {
1187 +  if (conf_parser_ctx.pass == 2)
1188 +    yy_aconf->modes |= UMODE_BOTS;
1189 + } | T_CCONN
1190 + {
1191 +  if (conf_parser_ctx.pass == 2)
1192 +    yy_aconf->modes |= UMODE_CCONN;
1193 + } | T_CCONN_FULL
1194 + {
1195 +  if (conf_parser_ctx.pass == 2)
1196 +    yy_aconf->modes |= UMODE_CCONN_FULL;
1197 + } | T_DEAF
1198 + {
1199 +  if (conf_parser_ctx.pass == 2)
1200 +    yy_aconf->modes |= UMODE_DEAF;
1201 + } | T_DEBUG
1202 + {
1203 +  if (conf_parser_ctx.pass == 2)
1204 +    yy_aconf->modes |= UMODE_DEBUG;
1205 + } | T_FULL
1206 + {
1207 +  if (conf_parser_ctx.pass == 2)
1208 +    yy_aconf->modes |= UMODE_FULL;
1209 + } | T_SKILL
1210 + {
1211 +  if (conf_parser_ctx.pass == 2)
1212 +    yy_aconf->modes |= UMODE_SKILL;
1213 + } | T_NCHANGE
1214 + {
1215 +  if (conf_parser_ctx.pass == 2)
1216 +    yy_aconf->modes |= UMODE_NCHANGE;
1217 + } | T_REJ
1218 + {
1219 +  if (conf_parser_ctx.pass == 2)
1220 +    yy_aconf->modes |= UMODE_REJ;
1221 + } | T_UNAUTH
1222 + {
1223 +  if (conf_parser_ctx.pass == 2)
1224 +    yy_aconf->modes |= UMODE_UNAUTH;
1225 + } | T_SPY
1226 + {
1227 +  if (conf_parser_ctx.pass == 2)
1228 +    yy_aconf->modes |= UMODE_SPY;
1229 + } | T_EXTERNAL
1230 + {
1231 +  if (conf_parser_ctx.pass == 2)
1232 +    yy_aconf->modes |= UMODE_EXTERNAL;
1233 + } | T_OPERWALL
1234 + {
1235 +  if (conf_parser_ctx.pass == 2)
1236 +    yy_aconf->modes |= UMODE_OPERWALL;
1237 + } | T_SERVNOTICE
1238 + {
1239 +  if (conf_parser_ctx.pass == 2)
1240 +    yy_aconf->modes |= UMODE_SERVNOTICE;
1241 + } | T_INVISIBLE
1242 + {
1243 +  if (conf_parser_ctx.pass == 2)
1244 +    yy_aconf->modes |= UMODE_INVISIBLE;
1245 + } | T_WALLOP
1246 + {
1247 +  if (conf_parser_ctx.pass == 2)
1248 +    yy_aconf->modes |= UMODE_WALLOP;
1249 + } | T_SOFTCALLERID
1250 + {
1251 +  if (conf_parser_ctx.pass == 2)
1252 +    yy_aconf->modes |= UMODE_SOFTCALLERID;
1253 + } | T_CALLERID
1254 + {
1255 +  if (conf_parser_ctx.pass == 2)
1256 +    yy_aconf->modes |= UMODE_CALLERID;
1257 + } | T_LOCOPS
1258 + {
1259 +  if (conf_parser_ctx.pass == 2)
1260 +    yy_aconf->modes |= UMODE_LOCOPS;
1261 + };
1262 +
1263   oper_global_kill: GLOBAL_KILL '=' TBOOL ';'
1264   {
1265 <  if (ypass == 2)
1265 >  if (conf_parser_ctx.pass == 2)
1266    {
1267      if (yylval.number)
1268        yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
# Line 1181 | Line 1273 | oper_global_kill: GLOBAL_KILL '=' TBOOL
1273  
1274   oper_remote: REMOTE '=' TBOOL ';'
1275   {
1276 <  if (ypass == 2)
1276 >  if (conf_parser_ctx.pass == 2)
1277    {
1278      if (yylval.number)
1279        yy_aconf->port |= OPER_FLAG_REMOTE;
# Line 1192 | Line 1284 | oper_remote: REMOTE '=' TBOOL ';'
1284  
1285   oper_remoteban: REMOTEBAN '=' TBOOL ';'
1286   {
1287 <  if (ypass == 2)
1287 >  if (conf_parser_ctx.pass == 2)
1288    {
1289      if (yylval.number)
1290        yy_aconf->port |= OPER_FLAG_REMOTEBAN;
# Line 1203 | Line 1295 | oper_remoteban: REMOTEBAN '=' TBOOL ';'
1295  
1296   oper_kline: KLINE '=' TBOOL ';'
1297   {
1298 <  if (ypass == 2)
1298 >  if (conf_parser_ctx.pass == 2)
1299    {
1300      if (yylval.number)
1301        yy_aconf->port |= OPER_FLAG_K;
# Line 1214 | Line 1306 | oper_kline: KLINE '=' TBOOL ';'
1306  
1307   oper_xline: XLINE '=' TBOOL ';'
1308   {
1309 <  if (ypass == 2)
1309 >  if (conf_parser_ctx.pass == 2)
1310    {
1311      if (yylval.number)
1312        yy_aconf->port |= OPER_FLAG_X;
# Line 1225 | Line 1317 | oper_xline: XLINE '=' TBOOL ';'
1317  
1318   oper_unkline: UNKLINE '=' TBOOL ';'
1319   {
1320 <  if (ypass == 2)
1320 >  if (conf_parser_ctx.pass == 2)
1321    {
1322      if (yylval.number)
1323        yy_aconf->port |= OPER_FLAG_UNKLINE;
# Line 1236 | Line 1328 | oper_unkline: UNKLINE '=' TBOOL ';'
1328  
1329   oper_gline: GLINE '=' TBOOL ';'
1330   {
1331 <  if (ypass == 2)
1331 >  if (conf_parser_ctx.pass == 2)
1332    {
1333      if (yylval.number)
1334        yy_aconf->port |= OPER_FLAG_GLINE;
# Line 1247 | Line 1339 | oper_gline: GLINE '=' TBOOL ';'
1339  
1340   oper_nick_changes: NICK_CHANGES '=' TBOOL ';'
1341   {
1342 <  if (ypass == 2)
1342 >  if (conf_parser_ctx.pass == 2)
1343    {
1344      if (yylval.number)
1345        yy_aconf->port |= OPER_FLAG_N;
# Line 1258 | Line 1350 | oper_nick_changes: NICK_CHANGES '=' TBOO
1350  
1351   oper_die: DIE '=' TBOOL ';'
1352   {
1353 <  if (ypass == 2)
1353 >  if (conf_parser_ctx.pass == 2)
1354    {
1355      if (yylval.number)
1356        yy_aconf->port |= OPER_FLAG_DIE;
# Line 1269 | Line 1361 | oper_die: DIE '=' TBOOL ';'
1361  
1362   oper_rehash: REHASH '=' TBOOL ';'
1363   {
1364 <  if (ypass == 2)
1364 >  if (conf_parser_ctx.pass == 2)
1365    {
1366      if (yylval.number)
1367        yy_aconf->port |= OPER_FLAG_REHASH;
# Line 1280 | Line 1372 | oper_rehash: REHASH '=' TBOOL ';'
1372  
1373   oper_admin: ADMIN '=' TBOOL ';'
1374   {
1375 <  if (ypass == 2)
1375 >  if (conf_parser_ctx.pass == 2)
1376    {
1377      if (yylval.number)
1378        yy_aconf->port |= OPER_FLAG_ADMIN;
# Line 1291 | Line 1383 | oper_admin: ADMIN '=' TBOOL ';'
1383  
1384   oper_hidden_admin: HIDDEN_ADMIN '=' TBOOL ';'
1385   {
1386 <  if (ypass == 2)
1386 >  if (conf_parser_ctx.pass == 2)
1387    {
1388      if (yylval.number)
1389        yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
# Line 1302 | Line 1394 | oper_hidden_admin: HIDDEN_ADMIN '=' TBOO
1394  
1395   oper_hidden_oper: HIDDEN_OPER '=' TBOOL ';'
1396   {
1397 <  if (ypass == 2)
1397 >  if (conf_parser_ctx.pass == 2)
1398    {
1399      if (yylval.number)
1400        yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
# Line 1313 | Line 1405 | oper_hidden_oper: HIDDEN_OPER '=' TBOOL
1405  
1406   oper_operwall: T_OPERWALL '=' TBOOL ';'
1407   {
1408 <  if (ypass == 2)
1408 >  if (conf_parser_ctx.pass == 2)
1409    {
1410      if (yylval.number)
1411        yy_aconf->port |= OPER_FLAG_OPERWALL;
# Line 1327 | Line 1419 | oper_flags: IRCD_FLAGS
1419   } '='  oper_flags_items ';';
1420  
1421   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1422 < oper_flags_item: NOT oper_flags_item_atom { not_atom = 1; }
1423 <                | oper_flags_item_atom { not_atom = 0; };
1422 > oper_flags_item: NOT { not_atom = 1; } oper_flags_item_atom
1423 >                | { not_atom = 0; } oper_flags_item_atom;
1424  
1425   oper_flags_item_atom: GLOBAL_KILL
1426   {
1427 <  if (ypass == 2)
1427 >  if (conf_parser_ctx.pass == 2)
1428    {
1429      if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1430      else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1431    }
1432   } | REMOTE
1433   {
1434 <  if (ypass == 2)
1434 >  if (conf_parser_ctx.pass == 2)
1435    {
1436      if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE;
1437      else yy_aconf->port |= OPER_FLAG_REMOTE;
1438    }
1439   } | KLINE
1440   {
1441 <  if (ypass == 2)
1441 >  if (conf_parser_ctx.pass == 2)
1442    {
1443      if (not_atom) yy_aconf->port &= ~OPER_FLAG_K;
1444      else yy_aconf->port |= OPER_FLAG_K;
1445    }
1446   } | UNKLINE
1447   {
1448 <  if (ypass == 2)
1448 >  if (conf_parser_ctx.pass == 2)
1449    {
1450      if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1451      else yy_aconf->port |= OPER_FLAG_UNKLINE;
1452    }
1453   } | XLINE
1454   {
1455 <  if (ypass == 2)
1455 >  if (conf_parser_ctx.pass == 2)
1456    {
1457      if (not_atom) yy_aconf->port &= ~OPER_FLAG_X;
1458      else yy_aconf->port |= OPER_FLAG_X;
1459    }
1460   } | GLINE
1461   {
1462 <  if (ypass == 2)
1462 >  if (conf_parser_ctx.pass == 2)
1463    {
1464      if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE;
1465      else yy_aconf->port |= OPER_FLAG_GLINE;
1466    }
1467   } | DIE
1468   {
1469 <  if (ypass == 2)
1469 >  if (conf_parser_ctx.pass == 2)
1470    {
1471      if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE;
1472      else yy_aconf->port |= OPER_FLAG_DIE;
1473    }
1474   } | REHASH
1475   {
1476 <  if (ypass == 2)
1476 >  if (conf_parser_ctx.pass == 2)
1477    {
1478      if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH;
1479      else yy_aconf->port |= OPER_FLAG_REHASH;
1480    }
1481   } | ADMIN
1482   {
1483 <  if (ypass == 2)
1483 >  if (conf_parser_ctx.pass == 2)
1484    {
1485      if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN;
1486      else yy_aconf->port |= OPER_FLAG_ADMIN;
1487    }
1488   } | HIDDEN_ADMIN
1489   {
1490 <  if (ypass == 2)
1490 >  if (conf_parser_ctx.pass == 2)
1491    {
1492      if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1493      else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1494    }
1495   } | NICK_CHANGES
1496   {
1497 <  if (ypass == 2)
1497 >  if (conf_parser_ctx.pass == 2)
1498    {
1499      if (not_atom) yy_aconf->port &= ~OPER_FLAG_N;
1500      else yy_aconf->port |= OPER_FLAG_N;
1501    }
1502   } | T_OPERWALL
1503   {
1504 <  if (ypass == 2)
1504 >  if (conf_parser_ctx.pass == 2)
1505    {
1506      if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1507      else yy_aconf->port |= OPER_FLAG_OPERWALL;
1508    }
1509   } | OPER_SPY_T
1510   {
1511 <  if (ypass == 2)
1511 >  if (conf_parser_ctx.pass == 2)
1512    {
1513      if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY;
1514      else yy_aconf->port |= OPER_FLAG_OPER_SPY;
1515    }
1516   } | HIDDEN_OPER
1517   {
1518 <  if (ypass == 2)
1518 >  if (conf_parser_ctx.pass == 2)
1519    {
1520      if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1521      else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1522    }
1523   } | REMOTEBAN
1524   {
1525 <  if (ypass == 2)
1525 >  if (conf_parser_ctx.pass == 2)
1526    {
1527      if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1528      else yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1529    }
1530   } | ENCRYPTED
1531   {
1532 <  if (ypass == 2)
1532 >  if (conf_parser_ctx.pass == 2)
1533    {
1534      if (not_atom) ClearConfEncrypted(yy_aconf);
1535      else SetConfEncrypted(yy_aconf);
# Line 1450 | Line 1542 | oper_flags_item_atom: GLOBAL_KILL
1542   ***************************************************************************/
1543   class_entry: CLASS
1544   {
1545 <  if (ypass == 1)
1545 >  if (conf_parser_ctx.pass == 1)
1546    {
1547      yy_conf = make_conf_item(CLASS_TYPE);
1548 <    yy_class = (struct ClassItem *)map_to_conf(yy_conf);
1548 >    yy_class = map_to_conf(yy_conf);
1549    }
1550   } class_name_b '{' class_items '}' ';'
1551   {
1552 <  if (ypass == 1)
1552 >  if (conf_parser_ctx.pass == 1)
1553    {
1554 <    struct ConfItem *cconf;
1554 >    struct ConfItem *cconf = NULL;
1555      struct ClassItem *class = NULL;
1556  
1557      if (yy_class_name == NULL)
1466    {
1558        delete_conf_item(yy_conf);
1468    }
1559      else
1560      {
1561        cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1562  
1563        if (cconf != NULL)                /* The class existed already */
1564        {
1565 +        int user_count = 0;
1566 +
1567          rebuild_cidr_class(cconf, yy_class);
1568 <        class = (struct ClassItem *) map_to_conf(cconf);
1569 <        *class = *yy_class;
1568 >
1569 >        class = map_to_conf(cconf);
1570 >
1571 >        user_count = class->curr_user_count;
1572 >        memcpy(class, yy_class, sizeof(*class));
1573 >        class->curr_user_count = user_count;
1574 >        class->active = 1;
1575 >
1576          delete_conf_item(yy_conf);
1577  
1578          MyFree(cconf->name);            /* Allows case change of class name */
# Line 1484 | Line 1582 | class_entry: CLASS
1582        {
1583          MyFree(yy_conf->name);          /* just in case it was allocated */
1584          yy_conf->name = yy_class_name;
1585 +        yy_class->active = 1;
1586        }
1587      }
1588 +
1589      yy_class_name = NULL;
1590    }
1591   };
# Line 1509 | Line 1609 | class_item:     class_name |
1609  
1610   class_name: NAME '=' QSTRING ';'
1611   {
1612 <  if (ypass == 1)
1612 >  if (conf_parser_ctx.pass == 1)
1613    {
1614      MyFree(yy_class_name);
1615      DupString(yy_class_name, yylval.string);
# Line 1518 | Line 1618 | class_name: NAME '=' QSTRING ';'
1618  
1619   class_name_t: QSTRING
1620   {
1621 <  if (ypass == 1)
1621 >  if (conf_parser_ctx.pass == 1)
1622    {
1623      MyFree(yy_class_name);
1624      DupString(yy_class_name, yylval.string);
# Line 1527 | Line 1627 | class_name_t: QSTRING
1627  
1628   class_ping_time: PING_TIME '=' timespec ';'
1629   {
1630 <  if (ypass == 1)
1630 >  if (conf_parser_ctx.pass == 1)
1631      PingFreq(yy_class) = $3;
1632   };
1633  
1634   class_ping_warning: PING_WARNING '=' timespec ';'
1635   {
1636 <  if (ypass == 1)
1636 >  if (conf_parser_ctx.pass == 1)
1637      PingWarning(yy_class) = $3;
1638   };
1639  
1640   class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1641   {
1642 <  if (ypass == 1)
1642 >  if (conf_parser_ctx.pass == 1)
1643      MaxPerIp(yy_class) = $3;
1644   };
1645  
1646   class_connectfreq: CONNECTFREQ '=' timespec ';'
1647   {
1648 <  if (ypass == 1)
1648 >  if (conf_parser_ctx.pass == 1)
1649      ConFreq(yy_class) = $3;
1650   };
1651  
1652   class_max_number: MAX_NUMBER '=' NUMBER ';'
1653   {
1654 <  if (ypass == 1)
1654 >  if (conf_parser_ctx.pass == 1)
1655      MaxTotal(yy_class) = $3;
1656   };
1657  
1658   class_max_global: MAX_GLOBAL '=' NUMBER ';'
1659   {
1660 <  if (ypass == 1)
1660 >  if (conf_parser_ctx.pass == 1)
1661      MaxGlobal(yy_class) = $3;
1662   };
1663  
1664   class_max_local: MAX_LOCAL '=' NUMBER ';'
1665   {
1666 <  if (ypass == 1)
1666 >  if (conf_parser_ctx.pass == 1)
1667      MaxLocal(yy_class) = $3;
1668   };
1669  
1670   class_max_ident: MAX_IDENT '=' NUMBER ';'
1671   {
1672 <  if (ypass == 1)
1672 >  if (conf_parser_ctx.pass == 1)
1673      MaxIdent(yy_class) = $3;
1674   };
1675  
1676   class_sendq: SENDQ '=' sizespec ';'
1677   {
1678 <  if (ypass == 1)
1678 >  if (conf_parser_ctx.pass == 1)
1679      MaxSendq(yy_class) = $3;
1680   };
1681  
1682   class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1683   {
1684 <  if (ypass == 1)
1684 >  if (conf_parser_ctx.pass == 1)
1685      CidrBitlenIPV4(yy_class) = $3;
1686   };
1687  
1688   class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1689   {
1690 <  if (ypass == 1)
1690 >  if (conf_parser_ctx.pass == 1)
1691      CidrBitlenIPV6(yy_class) = $3;
1692   };
1693  
1694   class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1695   {
1696 <  if (ypass == 1)
1696 >  if (conf_parser_ctx.pass == 1)
1697      NumberPerCidr(yy_class) = $3;
1698   };
1699  
# Line 1602 | Line 1702 | class_number_per_cidr: NUMBER_PER_CIDR '
1702   ***************************************************************************/
1703   listen_entry: LISTEN
1704   {
1705 <  if (ypass == 2)
1705 >  if (conf_parser_ctx.pass == 2)
1706    {
1707      listener_address = NULL;
1708      listener_flags = 0;
1709    }
1710   } '{' listen_items '}' ';'
1711   {
1712 <  if (ypass == 2)
1712 >  if (conf_parser_ctx.pass == 2)
1713    {
1714      MyFree(listener_address);
1715      listener_address = NULL;
# Line 1618 | Line 1718 | listen_entry: LISTEN
1718  
1719   listen_flags: IRCD_FLAGS
1720   {
1721 +  listener_flags = 0;
1722   } '='  listen_flags_items ';';
1723  
1724   listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1725   listen_flags_item: T_SSL
1726   {
1727 <  if (ypass == 2)
1727 >  if (conf_parser_ctx.pass == 2)
1728      listener_flags |= LISTENER_SSL;
1729   } | HIDDEN
1730   {
1731 <  if (ypass == 2)
1731 >  if (conf_parser_ctx.pass == 2)
1732      listener_flags |= LISTENER_HIDDEN;
1733 + } | T_SERVER
1734 + {
1735 +  if (conf_parser_ctx.pass == 2)
1736 +    listener_flags |= LISTENER_SERVER;
1737   };
1738  
1739 +
1740 +
1741   listen_items:   listen_items listen_item | listen_item;
1742 < listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';' ;
1742 > listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';';
1743  
1744 < listen_port: PORT '=' port_items ';' ;
1744 > listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1745  
1746   port_items: port_items ',' port_item | port_item;
1747  
1748   port_item: NUMBER
1749   {
1750 <  if (ypass == 2)
1750 >  if (conf_parser_ctx.pass == 2)
1751    {
1752      if ((listener_flags & LISTENER_SSL))
1753   #ifdef HAVE_LIBCRYPTO
1754 <      if (!ServerInfo.ctx)
1754 >      if (!ServerInfo.server_ctx)
1755   #endif
1756        {
1757          yyerror("SSL not available - port closed");
1758          break;
1759        }
1760      add_listener($1, listener_address, listener_flags);
1654    listener_flags = 0;
1761    }
1762   } | NUMBER TWODOTS NUMBER
1763   {
1764 <  if (ypass == 2)
1764 >  if (conf_parser_ctx.pass == 2)
1765    {
1766      int i;
1767  
1768      if ((listener_flags & LISTENER_SSL))
1769   #ifdef HAVE_LIBCRYPTO
1770 <      if (!ServerInfo.ctx)
1770 >      if (!ServerInfo.server_ctx)
1771   #endif
1772        {
1773          yyerror("SSL not available - port closed");
# Line 1670 | Line 1776 | port_item: NUMBER
1776  
1777      for (i = $1; i <= $3; ++i)
1778        add_listener(i, listener_address, listener_flags);
1673
1674    listener_flags = 0;
1779    }
1780   };
1781  
1782   listen_address: IP '=' QSTRING ';'
1783   {
1784 <  if (ypass == 2)
1784 >  if (conf_parser_ctx.pass == 2)
1785    {
1786      MyFree(listener_address);
1787      DupString(listener_address, yylval.string);
# Line 1686 | Line 1790 | listen_address: IP '=' QSTRING ';'
1790  
1791   listen_host: HOST '=' QSTRING ';'
1792   {
1793 <  if (ypass == 2)
1793 >  if (conf_parser_ctx.pass == 2)
1794    {
1795      MyFree(listener_address);
1796      DupString(listener_address, yylval.string);
# Line 1698 | Line 1802 | listen_host: HOST '=' QSTRING ';'
1802   ***************************************************************************/
1803   auth_entry: IRCD_AUTH
1804   {
1805 <  if (ypass == 2)
1805 >  if (conf_parser_ctx.pass == 2)
1806    {
1807      yy_conf = make_conf_item(CLIENT_TYPE);
1808      yy_aconf = map_to_conf(yy_conf);
# Line 1710 | Line 1814 | auth_entry: IRCD_AUTH
1814    }
1815   } '{' auth_items '}' ';'
1816   {
1817 <  if (ypass == 2)
1817 >  if (conf_parser_ctx.pass == 2)
1818    {
1819      struct CollectItem *yy_tmp = NULL;
1820      dlink_node *ptr = NULL, *next_ptr = NULL;
# Line 1775 | Line 1879 | auth_item:      auth_user | auth_passwd
1879  
1880   auth_user: USER '=' QSTRING ';'
1881   {
1882 <  if (ypass == 2)
1882 >  if (conf_parser_ctx.pass == 2)
1883    {
1884 <    struct CollectItem *yy_tmp;
1884 >    struct CollectItem *yy_tmp = NULL;
1885 >    struct split_nuh_item nuh;
1886 >
1887 >    nuh.nuhmask  = yylval.string;
1888 >    nuh.nickptr  = NULL;
1889 >    nuh.userptr  = userbuf;
1890 >    nuh.hostptr  = hostbuf;
1891 >
1892 >    nuh.nicksize = 0;
1893 >    nuh.usersize = sizeof(userbuf);
1894 >    nuh.hostsize = sizeof(hostbuf);
1895 >
1896 >    split_nuh(&nuh);
1897  
1898      if (yy_aconf->user == NULL)
1899 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1899 >    {
1900 >      DupString(yy_aconf->user, userbuf);
1901 >      DupString(yy_aconf->host, hostbuf);
1902 >    }
1903      else
1904      {
1905        yy_tmp = MyMalloc(sizeof(struct CollectItem));
1906 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1906 >
1907 >      DupString(yy_tmp->user, userbuf);
1908 >      DupString(yy_tmp->host, hostbuf);
1909 >
1910        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1911      }
1912    }
# Line 1794 | Line 1916 | auth_user: USER '=' QSTRING ';'
1916  
1917   auth_passwd: PASSWORD '=' QSTRING ';'
1918   {
1919 <  if (ypass == 2)
1919 >  if (conf_parser_ctx.pass == 2)
1920    {
1921      /* be paranoid */
1922      if (yy_aconf->passwd != NULL)
# Line 1807 | Line 1929 | auth_passwd: PASSWORD '=' QSTRING ';'
1929  
1930   auth_spoof_notice: SPOOF_NOTICE '=' TBOOL ';'
1931   {
1932 <  if (ypass == 2)
1932 >  if (conf_parser_ctx.pass == 2)
1933    {
1934      if (yylval.number)
1935        yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
# Line 1818 | Line 1940 | auth_spoof_notice: SPOOF_NOTICE '=' TBOO
1940  
1941   auth_class: CLASS '=' QSTRING ';'
1942   {
1943 <  if (ypass == 2)
1943 >  if (conf_parser_ctx.pass == 2)
1944    {
1945      MyFree(class_name);
1946      DupString(class_name, yylval.string);
# Line 1827 | Line 1949 | auth_class: CLASS '=' QSTRING ';'
1949  
1950   auth_encrypted: ENCRYPTED '=' TBOOL ';'
1951   {
1952 <  if (ypass == 2)
1952 >  if (conf_parser_ctx.pass == 2)
1953    {
1954      if (yylval.number)
1955        SetConfEncrypted(yy_aconf);
# Line 1841 | Line 1963 | auth_flags: IRCD_FLAGS
1963   } '='  auth_flags_items ';';
1964  
1965   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1966 < auth_flags_item: NOT auth_flags_item_atom { not_atom = 1; }
1967 <                | auth_flags_item_atom { not_atom = 0; };
1966 > auth_flags_item: NOT { not_atom = 1; } auth_flags_item_atom
1967 >                | { not_atom = 0; } auth_flags_item_atom;
1968  
1969   auth_flags_item_atom: SPOOF_NOTICE
1970   {
1971 <  if (ypass == 2)
1971 >  if (conf_parser_ctx.pass == 2)
1972    {
1973      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1974      else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
# Line 1854 | Line 1976 | auth_flags_item_atom: SPOOF_NOTICE
1976  
1977   } | EXCEED_LIMIT
1978   {
1979 <  if (ypass == 2)
1979 >  if (conf_parser_ctx.pass == 2)
1980    {
1981      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1982      else yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1983    }
1984   } | KLINE_EXEMPT
1985   {
1986 <  if (ypass == 2)
1986 >  if (conf_parser_ctx.pass == 2)
1987    {
1988      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1989      else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1990    }
1991   } | NEED_IDENT
1992   {
1993 <  if (ypass == 2)
1993 >  if (conf_parser_ctx.pass == 2)
1994    {
1995      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1996      else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1997    }
1998   } | CAN_FLOOD
1999   {
2000 <  if (ypass == 2)
2000 >  if (conf_parser_ctx.pass == 2)
2001    {
2002      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
2003      else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
2004    }
2005   } | CAN_IDLE
2006   {
2007 <  if (ypass == 2)
2007 >  if (conf_parser_ctx.pass == 2)
2008    {
2009      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED;
2010      else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED;
2011    }
2012   } | NO_TILDE
2013   {
2014 <  if (ypass == 2)
2014 >  if (conf_parser_ctx.pass == 2)
2015    {
2016      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
2017      else yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
2018    }
2019   } | GLINE_EXEMPT
2020   {
2021 <  if (ypass == 2)
2021 >  if (conf_parser_ctx.pass == 2)
2022    {
2023      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
2024      else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
2025    }
2026   } | RESV_EXEMPT
2027   {
2028 <  if (ypass == 2)
2028 >  if (conf_parser_ctx.pass == 2)
2029    {
2030      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV;
2031      else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
2032    }
2033   } | NEED_PASSWORD
2034   {
2035 <  if (ypass == 2)
2035 >  if (conf_parser_ctx.pass == 2)
2036    {
2037      if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2038      else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
# Line 1919 | Line 2041 | auth_flags_item_atom: SPOOF_NOTICE
2041  
2042   auth_kline_exempt: KLINE_EXEMPT '=' TBOOL ';'
2043   {
2044 <  if (ypass == 2)
2044 >  if (conf_parser_ctx.pass == 2)
2045    {
2046      if (yylval.number)
2047        yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
# Line 1930 | Line 2052 | auth_kline_exempt: KLINE_EXEMPT '=' TBOO
2052  
2053   auth_need_ident: NEED_IDENT '=' TBOOL ';'
2054   {
2055 <  if (ypass == 2)
2055 >  if (conf_parser_ctx.pass == 2)
2056    {
2057      if (yylval.number)
2058        yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
# Line 1941 | Line 2063 | auth_need_ident: NEED_IDENT '=' TBOOL ';
2063  
2064   auth_exceed_limit: EXCEED_LIMIT '=' TBOOL ';'
2065   {
2066 <  if (ypass == 2)
2066 >  if (conf_parser_ctx.pass == 2)
2067    {
2068      if (yylval.number)
2069        yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
# Line 1952 | Line 2074 | auth_exceed_limit: EXCEED_LIMIT '=' TBOO
2074  
2075   auth_can_flood: CAN_FLOOD '=' TBOOL ';'
2076   {
2077 <  if (ypass == 2)
2077 >  if (conf_parser_ctx.pass == 2)
2078    {
2079      if (yylval.number)
2080        yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
# Line 1963 | Line 2085 | auth_can_flood: CAN_FLOOD '=' TBOOL ';'
2085  
2086   auth_no_tilde: NO_TILDE '=' TBOOL ';'
2087   {
2088 <  if (ypass == 2)
2088 >  if (conf_parser_ctx.pass == 2)
2089    {
2090      if (yylval.number)
2091        yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
# Line 1974 | Line 2096 | auth_no_tilde: NO_TILDE '=' TBOOL ';'
2096  
2097   auth_gline_exempt: GLINE_EXEMPT '=' TBOOL ';'
2098   {
2099 <  if (ypass == 2)
2099 >  if (conf_parser_ctx.pass == 2)
2100    {
2101      if (yylval.number)
2102        yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
# Line 1986 | Line 2108 | auth_gline_exempt: GLINE_EXEMPT '=' TBOO
2108   /* XXX - need check for illegal hostnames here */
2109   auth_spoof: SPOOF '=' QSTRING ';'
2110   {
2111 <  if (ypass == 2)
2111 >  if (conf_parser_ctx.pass == 2)
2112    {
2113      MyFree(yy_conf->name);
2114  
# Line 2005 | Line 2127 | auth_spoof: SPOOF '=' QSTRING ';'
2127  
2128   auth_redir_serv: REDIRSERV '=' QSTRING ';'
2129   {
2130 <  if (ypass == 2)
2130 >  if (conf_parser_ctx.pass == 2)
2131    {
2132      yy_aconf->flags |= CONF_FLAGS_REDIR;
2133      MyFree(yy_conf->name);
# Line 2015 | Line 2137 | auth_redir_serv: REDIRSERV '=' QSTRING '
2137  
2138   auth_redir_port: REDIRPORT '=' NUMBER ';'
2139   {
2140 <  if (ypass == 2)
2140 >  if (conf_parser_ctx.pass == 2)
2141    {
2142      yy_aconf->flags |= CONF_FLAGS_REDIR;
2143      yy_aconf->port = $3;
# Line 2024 | Line 2146 | auth_redir_port: REDIRPORT '=' NUMBER ';
2146  
2147   auth_need_password: NEED_PASSWORD '=' TBOOL ';'
2148   {
2149 <  if (ypass == 2)
2149 >  if (conf_parser_ctx.pass == 2)
2150    {
2151      if (yylval.number)
2152        yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
# Line 2039 | Line 2161 | auth_need_password: NEED_PASSWORD '=' TB
2161   ***************************************************************************/
2162   resv_entry: RESV
2163   {
2164 <  if (ypass == 2)
2164 >  if (conf_parser_ctx.pass == 2)
2165    {
2166      MyFree(resv_reason);
2167      resv_reason = NULL;
2168    }
2169   } '{' resv_items '}' ';'
2170   {
2171 <  if (ypass == 2)
2171 >  if (conf_parser_ctx.pass == 2)
2172    {
2173      MyFree(resv_reason);
2174      resv_reason = NULL;
# Line 2058 | Line 2180 | resv_item:     resv_creason | resv_channel |
2180  
2181   resv_creason: REASON '=' QSTRING ';'
2182   {
2183 <  if (ypass == 2)
2183 >  if (conf_parser_ctx.pass == 2)
2184    {
2185      MyFree(resv_reason);
2186      DupString(resv_reason, yylval.string);
# Line 2067 | Line 2189 | resv_creason: REASON '=' QSTRING ';'
2189  
2190   resv_channel: CHANNEL '=' QSTRING ';'
2191   {
2192 <  if (ypass == 2)
2192 >  if (conf_parser_ctx.pass == 2)
2193    {
2194      if (IsChanPrefix(*yylval.string))
2195      {
# Line 2082 | Line 2204 | resv_channel: CHANNEL '=' QSTRING ';'
2204  
2205   resv_nick: NICK '=' QSTRING ';'
2206   {
2207 <  if (ypass == 2)
2207 >  if (conf_parser_ctx.pass == 2)
2208    {
2209      char def_reason[] = "No reason";
2210  
# Line 2095 | Line 2217 | resv_nick: NICK '=' QSTRING ';'
2217   ***************************************************************************/
2218   shared_entry: T_SHARED
2219   {
2220 <  if (ypass == 2)
2220 >  if (conf_parser_ctx.pass == 2)
2221    {
2222      yy_conf = make_conf_item(ULINE_TYPE);
2223      yy_match_item = map_to_conf(yy_conf);
# Line 2103 | Line 2225 | shared_entry: T_SHARED
2225    }
2226   } '{' shared_items '}' ';'
2227   {
2228 <  if (ypass == 2)
2228 >  if (conf_parser_ctx.pass == 2)
2229    {
2230      yy_conf = NULL;
2231    }
# Line 2114 | Line 2236 | shared_item:  shared_name | shared_user
2236  
2237   shared_name: NAME '=' QSTRING ';'
2238   {
2239 <  if (ypass == 2)
2239 >  if (conf_parser_ctx.pass == 2)
2240    {
2241      MyFree(yy_conf->name);
2242      DupString(yy_conf->name, yylval.string);
# Line 2123 | Line 2245 | shared_name: NAME '=' QSTRING ';'
2245  
2246   shared_user: USER '=' QSTRING ';'
2247   {
2248 <  if (ypass == 2)
2248 >  if (conf_parser_ctx.pass == 2)
2249    {
2250 <    split_nuh(yylval.string, NULL, &yy_match_item->user, &yy_match_item->host);
2250 >    struct split_nuh_item nuh;
2251 >
2252 >    nuh.nuhmask  = yylval.string;
2253 >    nuh.nickptr  = NULL;
2254 >    nuh.userptr  = userbuf;
2255 >    nuh.hostptr  = hostbuf;
2256 >
2257 >    nuh.nicksize = 0;
2258 >    nuh.usersize = sizeof(userbuf);
2259 >    nuh.hostsize = sizeof(hostbuf);
2260 >
2261 >    split_nuh(&nuh);
2262 >
2263 >    DupString(yy_match_item->user, userbuf);
2264 >    DupString(yy_match_item->host, hostbuf);
2265    }
2266   };
2267  
2268   shared_type: TYPE
2269   {
2270 <  if (ypass == 2)
2270 >  if (conf_parser_ctx.pass == 2)
2271      yy_match_item->action = 0;
2272   } '=' shared_types ';' ;
2273  
2274   shared_types: shared_types ',' shared_type_item | shared_type_item;
2275   shared_type_item: KLINE
2276   {
2277 <  if (ypass == 2)
2277 >  if (conf_parser_ctx.pass == 2)
2278      yy_match_item->action |= SHARED_KLINE;
2279   } | TKLINE
2280   {
2281 <  if (ypass == 2)
2281 >  if (conf_parser_ctx.pass == 2)
2282      yy_match_item->action |= SHARED_TKLINE;
2283   } | UNKLINE
2284   {
2285 <  if (ypass == 2)
2285 >  if (conf_parser_ctx.pass == 2)
2286      yy_match_item->action |= SHARED_UNKLINE;
2287   } | XLINE
2288   {
2289 <  if (ypass == 2)
2289 >  if (conf_parser_ctx.pass == 2)
2290      yy_match_item->action |= SHARED_XLINE;
2291   } | TXLINE
2292   {
2293 <  if (ypass == 2)
2293 >  if (conf_parser_ctx.pass == 2)
2294      yy_match_item->action |= SHARED_TXLINE;
2295   } | T_UNXLINE
2296   {
2297 <  if (ypass == 2)
2297 >  if (conf_parser_ctx.pass == 2)
2298      yy_match_item->action |= SHARED_UNXLINE;
2299   } | RESV
2300   {
2301 <  if (ypass == 2)
2301 >  if (conf_parser_ctx.pass == 2)
2302      yy_match_item->action |= SHARED_RESV;
2303   } | TRESV
2304   {
2305 <  if (ypass == 2)
2305 >  if (conf_parser_ctx.pass == 2)
2306      yy_match_item->action |= SHARED_TRESV;
2307   } | T_UNRESV
2308   {
2309 <  if (ypass == 2)
2309 >  if (conf_parser_ctx.pass == 2)
2310      yy_match_item->action |= SHARED_UNRESV;
2311   } | T_LOCOPS
2312   {
2313 <  if (ypass == 2)
2313 >  if (conf_parser_ctx.pass == 2)
2314      yy_match_item->action |= SHARED_LOCOPS;
2315   } | T_ALL
2316   {
2317 <  if (ypass == 2)
2317 >  if (conf_parser_ctx.pass == 2)
2318      yy_match_item->action = SHARED_ALL;
2319   };
2320  
# Line 2187 | Line 2323 | shared_type_item: KLINE
2323   ***************************************************************************/
2324   cluster_entry: T_CLUSTER
2325   {
2326 <  if (ypass == 2)
2326 >  if (conf_parser_ctx.pass == 2)
2327    {
2328      yy_conf = make_conf_item(CLUSTER_TYPE);
2329      yy_conf->flags = SHARED_ALL;
2330    }
2331   } '{' cluster_items '}' ';'
2332   {
2333 <  if (ypass == 2)
2333 >  if (conf_parser_ctx.pass == 2)
2334    {
2335      if (yy_conf->name == NULL)
2336        DupString(yy_conf->name, "*");
# Line 2207 | Line 2343 | cluster_item:  cluster_name | cluster_typ
2343  
2344   cluster_name: NAME '=' QSTRING ';'
2345   {
2346 <  if (ypass == 2)
2346 >  if (conf_parser_ctx.pass == 2)
2347      DupString(yy_conf->name, yylval.string);
2348   };
2349  
2350   cluster_type: TYPE
2351   {
2352 <  if (ypass == 2)
2352 >  if (conf_parser_ctx.pass == 2)
2353      yy_conf->flags = 0;
2354   } '=' cluster_types ';' ;
2355  
2356   cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2357   cluster_type_item: KLINE
2358   {
2359 <  if (ypass == 2)
2359 >  if (conf_parser_ctx.pass == 2)
2360      yy_conf->flags |= SHARED_KLINE;
2361   } | TKLINE
2362   {
2363 <  if (ypass == 2)
2363 >  if (conf_parser_ctx.pass == 2)
2364      yy_conf->flags |= SHARED_TKLINE;
2365   } | UNKLINE
2366   {
2367 <  if (ypass == 2)
2367 >  if (conf_parser_ctx.pass == 2)
2368      yy_conf->flags |= SHARED_UNKLINE;
2369   } | XLINE
2370   {
2371 <  if (ypass == 2)
2371 >  if (conf_parser_ctx.pass == 2)
2372      yy_conf->flags |= SHARED_XLINE;
2373   } | TXLINE
2374   {
2375 <  if (ypass == 2)
2375 >  if (conf_parser_ctx.pass == 2)
2376      yy_conf->flags |= SHARED_TXLINE;
2377   } | T_UNXLINE
2378   {
2379 <  if (ypass == 2)
2379 >  if (conf_parser_ctx.pass == 2)
2380      yy_conf->flags |= SHARED_UNXLINE;
2381   } | RESV
2382   {
2383 <  if (ypass == 2)
2383 >  if (conf_parser_ctx.pass == 2)
2384      yy_conf->flags |= SHARED_RESV;
2385   } | TRESV
2386   {
2387 <  if (ypass == 2)
2387 >  if (conf_parser_ctx.pass == 2)
2388      yy_conf->flags |= SHARED_TRESV;
2389   } | T_UNRESV
2390   {
2391 <  if (ypass == 2)
2391 >  if (conf_parser_ctx.pass == 2)
2392      yy_conf->flags |= SHARED_UNRESV;
2393   } | T_LOCOPS
2394   {
2395 <  if (ypass == 2)
2395 >  if (conf_parser_ctx.pass == 2)
2396      yy_conf->flags |= SHARED_LOCOPS;
2397   } | T_ALL
2398   {
2399 <  if (ypass == 2)
2399 >  if (conf_parser_ctx.pass == 2)
2400      yy_conf->flags = SHARED_ALL;
2401   };
2402  
# Line 2269 | Line 2405 | cluster_type_item: KLINE
2405   ***************************************************************************/
2406   connect_entry: CONNECT  
2407   {
2408 <  if (ypass == 2)
2408 >  if (conf_parser_ctx.pass == 2)
2409    {
2410      yy_conf = make_conf_item(SERVER_TYPE);
2411      yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
# Line 2287 | Line 2423 | connect_entry: CONNECT
2423    }
2424   } connect_name_b '{' connect_items '}' ';'
2425   {
2426 <  if (ypass == 2)
2426 >  if (conf_parser_ctx.pass == 2)
2427    {
2428      struct CollectItem *yy_hconf=NULL;
2429      struct CollectItem *yy_lconf=NULL;
# Line 2302 | Line 2438 | connect_entry: CONNECT
2438            yy_aconf->passwd && yy_aconf->spasswd)
2439   #endif /* !HAVE_LIBCRYPTO */
2440          {
2441 <          if (conf_add_server(yy_conf, scount, class_name) >= 0)
2306 <          {
2307 <            ++scount;
2308 <          }
2309 <          else
2441 >          if (conf_add_server(yy_conf, class_name) == -1)
2442            {
2443              delete_conf_item(yy_conf);
2444              yy_conf = NULL;
# Line 2426 | Line 2558 | connect_item:   connect_name | connect_h
2558                  connect_leaf_mask | connect_class | connect_auto |
2559                  connect_encrypted | connect_compressed | connect_cryptlink |
2560                  connect_rsa_public_key_file | connect_cipher_preference |
2561 <                error ';' ;
2561 >                connect_topicburst | error ';' ;
2562  
2563   connect_name: NAME '=' QSTRING ';'
2564   {
2565 <  if (ypass == 2)
2565 >  if (conf_parser_ctx.pass == 2)
2566    {
2567      if (yy_conf->name != NULL)
2568        yyerror("Multiple connect name entry");
# Line 2442 | Line 2574 | connect_name: NAME '=' QSTRING ';'
2574  
2575   connect_name_t: QSTRING
2576   {
2577 <  if (ypass == 2)
2577 >  if (conf_parser_ctx.pass == 2)
2578    {
2579      if (yy_conf->name != NULL)
2580        yyerror("Multiple connect name entry");
# Line 2454 | Line 2586 | connect_name_t: QSTRING
2586  
2587   connect_host: HOST '=' QSTRING ';'
2588   {
2589 <  if (ypass == 2)
2589 >  if (conf_parser_ctx.pass == 2)
2590    {
2591      MyFree(yy_aconf->host);
2592      DupString(yy_aconf->host, yylval.string);
# Line 2463 | Line 2595 | connect_host: HOST '=' QSTRING ';'
2595  
2596   connect_vhost: VHOST '=' QSTRING ';'
2597   {
2598 <  if (ypass == 2)
2598 >  if (conf_parser_ctx.pass == 2)
2599    {
2600      struct addrinfo hints, *res;
2601  
# Line 2489 | Line 2621 | connect_vhost: VHOST '=' QSTRING ';'
2621  
2622   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2623   {
2624 <  if (ypass == 2)
2624 >  if (conf_parser_ctx.pass == 2)
2625    {
2626 <    if (yy_aconf->spasswd != NULL)
2627 <      memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2626 >    if ($3[0] == ':')
2627 >      yyerror("Server passwords cannot begin with a colon");
2628 >    else if (strchr($3, ' ') != NULL)
2629 >      yyerror("Server passwords cannot contain spaces");
2630 >    else {
2631 >      if (yy_aconf->spasswd != NULL)
2632 >        memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2633  
2634 <    MyFree(yy_aconf->spasswd);
2635 <    DupString(yy_aconf->spasswd, yylval.string);
2634 >      MyFree(yy_aconf->spasswd);
2635 >      DupString(yy_aconf->spasswd, yylval.string);
2636 >    }
2637    }
2638   };
2639  
2640   connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2641   {
2642 <  if (ypass == 2)
2642 >  if (conf_parser_ctx.pass == 2)
2643    {
2644 <    if (yy_aconf->passwd != NULL)
2645 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2644 >    if ($3[0] == ':')
2645 >      yyerror("Server passwords cannot begin with a colon");
2646 >    else if (strchr($3, ' ') != NULL)
2647 >      yyerror("Server passwords cannot contain spaces");
2648 >    else {
2649 >      if (yy_aconf->passwd != NULL)
2650 >        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2651  
2652 <    MyFree(yy_aconf->passwd);
2653 <    DupString(yy_aconf->passwd, yylval.string);
2652 >      MyFree(yy_aconf->passwd);
2653 >      DupString(yy_aconf->passwd, yylval.string);
2654 >    }
2655    }
2656   };
2657  
2658   connect_port: PORT '=' NUMBER ';'
2659   {
2660 <  if (ypass == 2)
2660 >  if (conf_parser_ctx.pass == 2)
2661      yy_aconf->port = $3;
2662   };
2663  
2664   connect_aftype: AFTYPE '=' T_IPV4 ';'
2665   {
2666 <  if (ypass == 2)
2666 >  if (conf_parser_ctx.pass == 2)
2667      yy_aconf->aftype = AF_INET;
2668   } | AFTYPE '=' T_IPV6 ';'
2669   {
2670   #ifdef IPV6
2671 <  if (ypass == 2)
2671 >  if (conf_parser_ctx.pass == 2)
2672      yy_aconf->aftype = AF_INET6;
2673   #endif
2674   };
2675  
2676   connect_fakename: FAKENAME '=' QSTRING ';'
2677   {
2678 <  if (ypass == 2)
2678 >  if (conf_parser_ctx.pass == 2)
2679    {
2680      MyFree(yy_aconf->fakename);
2681      DupString(yy_aconf->fakename, yylval.string);
# Line 2543 | Line 2687 | connect_flags: IRCD_FLAGS
2687   } '='  connect_flags_items ';';
2688  
2689   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2690 < connect_flags_item: NOT connect_flags_item_atom { not_atom = 1; }
2691 <                        | connect_flags_item_atom { not_atom = 0; };
2690 > connect_flags_item: NOT  { not_atom = 1; } connect_flags_item_atom
2691 >                        |  { not_atom = 0; } connect_flags_item_atom;
2692  
2693 < connect_flags_item_atom: LAZYLINK
2693 > connect_flags_item_atom: COMPRESSED
2694   {
2695 <  if (ypass == 2)
2552 <  {
2553 <    if (not_atom)ClearConfLazyLink(yy_aconf);
2554 <    else SetConfLazyLink(yy_aconf);
2555 <  }
2556 < } | COMPRESSED
2557 < {
2558 <  if (ypass == 2)
2695 >  if (conf_parser_ctx.pass == 2)
2696   #ifndef HAVE_LIBZ
2697      yyerror("Ignoring flags = compressed; -- no zlib support");
2698   #else
# Line 2566 | Line 2703 | connect_flags_item_atom: LAZYLINK
2703   #endif
2704   } | CRYPTLINK
2705   {
2706 <  if (ypass == 2)
2706 >  if (conf_parser_ctx.pass == 2)
2707    {
2708      if (not_atom)ClearConfCryptLink(yy_aconf);
2709      else SetConfCryptLink(yy_aconf);
2710    }
2711   } | AUTOCONN
2712   {
2713 <  if (ypass == 2)
2713 >  if (conf_parser_ctx.pass == 2)
2714    {
2715      if (not_atom)ClearConfAllowAutoConn(yy_aconf);
2716      else SetConfAllowAutoConn(yy_aconf);
2717    }
2718   } | BURST_AWAY
2719   {
2720 <  if (ypass == 2)
2720 >  if (conf_parser_ctx.pass == 2)
2721    {
2722      if (not_atom)ClearConfAwayBurst(yy_aconf);
2723      else SetConfAwayBurst(yy_aconf);
2724    }
2725   } | TOPICBURST
2726   {
2727 <  if (ypass == 2)
2727 >  if (conf_parser_ctx.pass == 2)
2728    {
2729      if (not_atom)ClearConfTopicBurst(yy_aconf);
2730      else SetConfTopicBurst(yy_aconf);
# Line 2598 | Line 2735 | connect_flags_item_atom: LAZYLINK
2735   connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2736   {
2737   #ifdef HAVE_LIBCRYPTO
2738 <  if (ypass == 2)
2738 >  if (conf_parser_ctx.pass == 2)
2739    {
2740      BIO *file;
2741  
# Line 2638 | Line 2775 | connect_rsa_public_key_file: RSA_PUBLIC_
2775  
2776   connect_encrypted: ENCRYPTED '=' TBOOL ';'
2777   {
2778 <  if (ypass == 2)
2778 >  if (conf_parser_ctx.pass == 2)
2779    {
2780      if (yylval.number)
2781        yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
# Line 2649 | Line 2786 | connect_encrypted: ENCRYPTED '=' TBOOL '
2786  
2787   connect_cryptlink: CRYPTLINK '=' TBOOL ';'
2788   {
2789 <  if (ypass == 2)
2789 >  if (conf_parser_ctx.pass == 2)
2790    {
2791      if (yylval.number)
2792        yy_aconf->flags |= CONF_FLAGS_CRYPTLINK;
# Line 2660 | Line 2797 | connect_cryptlink: CRYPTLINK '=' TBOOL '
2797  
2798   connect_compressed: COMPRESSED '=' TBOOL ';'
2799   {
2800 <  if (ypass == 2)
2800 >  if (conf_parser_ctx.pass == 2)
2801    {
2802      if (yylval.number)
2803   #ifndef HAVE_LIBZ
# Line 2675 | Line 2812 | connect_compressed: COMPRESSED '=' TBOOL
2812  
2813   connect_auto: AUTOCONN '=' TBOOL ';'
2814   {
2815 <  if (ypass == 2)
2815 >  if (conf_parser_ctx.pass == 2)
2816    {
2817      if (yylval.number)
2818        yy_aconf->flags |= CONF_FLAGS_ALLOW_AUTO_CONN;
# Line 2684 | Line 2821 | connect_auto: AUTOCONN '=' TBOOL ';'
2821    }
2822   };
2823  
2824 + connect_topicburst: TOPICBURST '=' TBOOL ';'
2825 + {
2826 +  if (conf_parser_ctx.pass == 2)
2827 +  {
2828 +    if (yylval.number)
2829 +      SetConfTopicBurst(yy_aconf);
2830 +    else
2831 +      ClearConfTopicBurst(yy_aconf);
2832 +  }
2833 + };
2834 +
2835   connect_hub_mask: HUB_MASK '=' QSTRING ';'
2836   {
2837 <  if (ypass == 2)
2837 >  if (conf_parser_ctx.pass == 2)
2838    {
2839      struct CollectItem *yy_tmp;
2840  
# Line 2699 | Line 2847 | connect_hub_mask: HUB_MASK '=' QSTRING '
2847  
2848   connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2849   {
2850 <  if (ypass == 2)
2850 >  if (conf_parser_ctx.pass == 2)
2851    {
2852      struct CollectItem *yy_tmp;
2853  
# Line 2712 | Line 2860 | connect_leaf_mask: LEAF_MASK '=' QSTRING
2860  
2861   connect_class: CLASS '=' QSTRING ';'
2862   {
2863 <  if (ypass == 2)
2863 >  if (conf_parser_ctx.pass == 2)
2864    {
2865      MyFree(class_name);
2866      DupString(class_name, yylval.string);
# Line 2722 | Line 2870 | connect_class: CLASS '=' QSTRING ';'
2870   connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2871   {
2872   #ifdef HAVE_LIBCRYPTO
2873 <  if (ypass == 2)
2873 >  if (conf_parser_ctx.pass == 2)
2874    {
2875      struct EncCapability *ecap;
2876      const char *cipher_name;
# Line 2746 | Line 2894 | connect_cipher_preference: CIPHER_PREFER
2894        yyerror("Invalid cipher");
2895    }
2896   #else
2897 <  if (ypass == 2)
2897 >  if (conf_parser_ctx.pass == 2)
2898      yyerror("Ignoring cipher_preference -- no OpenSSL support");
2899   #endif
2900   };
# Line 2756 | Line 2904 | connect_cipher_preference: CIPHER_PREFER
2904   ***************************************************************************/
2905   kill_entry: KILL
2906   {
2907 <  if (ypass == 2)
2907 >  if (conf_parser_ctx.pass == 2)
2908    {
2909      userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2910      regex_ban = 0;
2911    }
2912   } '{' kill_items '}' ';'
2913   {
2914 <  if (ypass == 2)
2914 >  if (conf_parser_ctx.pass == 2)
2915    {
2916      if (userbuf[0] && hostbuf[0])
2917      {
# Line 2776 | Line 2924 | kill_entry: KILL
2924          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2925              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2926          {
2927 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s", errptr);
2927 >          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2928 >               errptr);
2929            break;
2930          }
2931  
2932 <        yy_conf = make_conf_item(RKLINE_TYPE);
2932 >        yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE));
2933          yy_aconf->regexuser = exp_user;
2934          yy_aconf->regexhost = exp_host;
2935  
# Line 2794 | Line 2943 | kill_entry: KILL
2943        }
2944        else
2945        {
2946 <        yy_conf = make_conf_item(KLINE_TYPE);
2798 <        yy_aconf = map_to_conf(yy_conf);
2946 >        yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2947  
2948          DupString(yy_aconf->user, userbuf);
2949          DupString(yy_aconf->host, hostbuf);
# Line 2807 | Line 2955 | kill_entry: KILL
2955          add_conf_by_address(CONF_KILL, yy_aconf);
2956        }
2957      }
2810    else
2811      delete_conf_item(yy_conf);
2958  
2813    yy_conf = NULL;
2959      yy_aconf = NULL;
2960    }
2961   };
# Line 2822 | Line 2967 | kill_type: TYPE
2967   kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2968   kill_type_item: REGEX_T
2969   {
2970 <  if (ypass == 2)
2970 >  if (conf_parser_ctx.pass == 2)
2971      regex_ban = 1;
2972   };
2973  
# Line 2831 | Line 2976 | kill_item:      kill_user | kill_reason
2976  
2977   kill_user: USER '=' QSTRING ';'
2978   {
2979 <  if (ypass == 2)
2979 >  if (conf_parser_ctx.pass == 2)
2980    {
2981 <    char *user = NULL, *host = NULL;
2981 >    struct split_nuh_item nuh;
2982  
2983 <    split_nuh(yylval.string, NULL, &user, &host);
2983 >    nuh.nuhmask  = yylval.string;
2984 >    nuh.nickptr  = NULL;
2985 >    nuh.userptr  = userbuf;
2986 >    nuh.hostptr  = hostbuf;
2987  
2988 <    strlcpy(userbuf, user, sizeof(userbuf));
2989 <    strlcpy(hostbuf, host, sizeof(hostbuf));
2988 >    nuh.nicksize = 0;
2989 >    nuh.usersize = sizeof(userbuf);
2990 >    nuh.hostsize = sizeof(hostbuf);
2991  
2992 <    MyFree(user);
2844 <    MyFree(host);
2992 >    split_nuh(&nuh);
2993    }
2994   };
2995  
2996   kill_reason: REASON '=' QSTRING ';'
2997   {
2998 <  if (ypass == 2)
2998 >  if (conf_parser_ctx.pass == 2)
2999      strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
3000   };
3001  
# Line 2856 | Line 3004 | kill_reason: REASON '=' QSTRING ';'
3004   ***************************************************************************/
3005   deny_entry: DENY
3006   {
3007 <  if (ypass == 2)
3008 <  {
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 <  }
3007 >  if (conf_parser_ctx.pass == 2)
3008 >    hostbuf[0] = reasonbuf[0] = '\0';
3009   } '{' deny_items '}' ';'
3010   {
3011 <  if (ypass == 2)
3011 >  if (conf_parser_ctx.pass == 2)
3012    {
3013 <    if (yy_aconf->host && parse_netmask(yy_aconf->host, NULL, NULL) != HM_HOST)
3013 >    if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
3014 >    {
3015 >      yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
3016 >      DupString(yy_aconf->host, hostbuf);
3017 >
3018 >      if (reasonbuf[0])
3019 >        DupString(yy_aconf->reason, reasonbuf);
3020 >      else
3021 >        DupString(yy_aconf->reason, "No reason");
3022        add_conf_by_address(CONF_DLINE, yy_aconf);
3023 <    else
3024 <      delete_conf_item(yy_conf);
2874 <    yy_conf = NULL;
2875 <    yy_aconf = NULL;
3023 >      yy_aconf = NULL;
3024 >    }
3025    }
3026   };
3027  
# Line 2881 | Line 3030 | deny_item:      deny_ip | deny_reason |
3030  
3031   deny_ip: IP '=' QSTRING ';'
3032   {
3033 <  if (ypass == 2)
3034 <  {
2886 <    MyFree(yy_aconf->host);
2887 <    DupString(yy_aconf->host, yylval.string);
2888 <  }
3033 >  if (conf_parser_ctx.pass == 2)
3034 >    strlcpy(hostbuf, yylval.string, sizeof(hostbuf));
3035   };
3036  
3037   deny_reason: REASON '=' QSTRING ';'
3038   {
3039 <  if (ypass == 2)
3040 <  {
2895 <    MyFree(yy_aconf->reason);
2896 <    DupString(yy_aconf->reason, yylval.string);
2897 <  }
3039 >  if (conf_parser_ctx.pass == 2)
3040 >    strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
3041   };
3042  
3043   /***************************************************************************
# Line 2907 | Line 3050 | exempt_item:      exempt_ip | error;
3050  
3051   exempt_ip: IP '=' QSTRING ';'
3052   {
3053 <  if (ypass == 2)
3053 >  if (conf_parser_ctx.pass == 2)
3054    {
3055      if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
3056      {
3057 <      yy_conf = make_conf_item(EXEMPTDLINE_TYPE);
2915 <      yy_aconf = map_to_conf(yy_conf);
3057 >      yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE));
3058        DupString(yy_aconf->host, yylval.string);
3059  
3060        add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
2919
2920      yy_conf = NULL;
3061        yy_aconf = NULL;
3062      }
3063    }
# Line 2928 | Line 3068 | exempt_ip: IP '=' QSTRING ';'
3068   ***************************************************************************/
3069   gecos_entry: GECOS
3070   {
3071 <  if (ypass == 2)
3071 >  if (conf_parser_ctx.pass == 2)
3072    {
3073      regex_ban = 0;
3074      reasonbuf[0] = gecos_name[0] = '\0';
3075    }
3076   } '{' gecos_items '}' ';'
3077   {
3078 <  if (ypass == 2)
3078 >  if (conf_parser_ctx.pass == 2)
3079    {
3080      if (gecos_name[0])
3081      {
# Line 2946 | Line 3086 | gecos_entry: GECOS
3086  
3087          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
3088          {
3089 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s", errptr);
3089 >          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
3090 >               errptr);
3091            break;
3092          }
3093  
# Line 2974 | Line 3115 | gecos_flags: TYPE
3115   gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
3116   gecos_flags_item: REGEX_T
3117   {
3118 <  if (ypass == 2)
3118 >  if (conf_parser_ctx.pass == 2)
3119      regex_ban = 1;
3120   };
3121  
# Line 2983 | Line 3124 | gecos_item:  gecos_name | gecos_reason |
3124  
3125   gecos_name: NAME '=' QSTRING ';'
3126   {
3127 <  if (ypass == 2)
3127 >  if (conf_parser_ctx.pass == 2)
3128      strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
3129   };
3130  
3131   gecos_reason: REASON '=' QSTRING ';'
3132   {
3133 <  if (ypass == 2)
3133 >  if (conf_parser_ctx.pass == 2)
3134      strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
3135   };
3136  
# Line 3027 | Line 3168 | general_item:       general_hide_spoof_i
3168                      general_disable_auth | general_burst_away |
3169                      general_tkline_expire_notices | general_gline_min_cidr |
3170                      general_gline_min_cidr6 | general_use_whois_actually |
3171 <                    general_reject_hold_time |
3171 >                    general_reject_hold_time | general_stats_e_disabled |
3172 >                    general_max_watch |
3173                      error;
3174  
3175  
3176 + general_max_watch: MAX_WATCH '=' NUMBER ';'
3177 + {
3178 +  ConfigFileEntry.max_watch = $3;
3179 + };
3180  
3181   general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
3182   {
# Line 3119 | Line 3265 | general_ts_warn_delta: TS_WARN_DELTA '='
3265  
3266   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
3267   {
3268 <  if (ypass == 2)
3268 >  if (conf_parser_ctx.pass == 2)
3269      ConfigFileEntry.ts_max_delta = $3;
3270   };
3271  
3272   general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
3273   {
3274 <  if (($3 > 0) && ypass == 1)
3274 >  if (($3 > 0) && conf_parser_ctx.pass == 1)
3275    {
3276      ilog(L_CRIT, "You haven't read your config file properly.");
3277      ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
# Line 3141 | Line 3287 | general_kline_with_reason: KLINE_WITH_RE
3287  
3288   general_kline_reason: KLINE_REASON '=' QSTRING ';'
3289   {
3290 <  if (ypass == 2)
3290 >  if (conf_parser_ctx.pass == 2)
3291    {
3292      MyFree(ConfigFileEntry.kline_reason);
3293      DupString(ConfigFileEntry.kline_reason, yylval.string);
# Line 3158 | Line 3304 | general_warn_no_nline: WARN_NO_NLINE '='
3304    ConfigFileEntry.warn_no_nline = yylval.number;
3305   };
3306  
3307 + general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
3308 + {
3309 +  ConfigFileEntry.stats_e_disabled = yylval.number;
3310 + };
3311 +
3312   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
3313   {
3314    ConfigFileEntry.stats_o_oper_only = yylval.number;
# Line 3226 | Line 3377 | general_oper_pass_resv: OPER_PASS_RESV '
3377  
3378   general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
3379   {
3380 <  if (ypass == 2)
3380 >  if (conf_parser_ctx.pass == 2)
3381    {
3382      if (strlen(yylval.string) > LOCALE_LENGTH-2)
3383        yylval.string[LOCALE_LENGTH-1] = '\0';
# Line 3252 | Line 3403 | general_max_targets: MAX_TARGETS '=' NUM
3403  
3404   general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3405   {
3406 <  if (ypass == 2)
3406 >  if (conf_parser_ctx.pass == 2)
3407    {
3408      MyFree(ConfigFileEntry.servlink_path);
3409      DupString(ConfigFileEntry.servlink_path, yylval.string);
# Line 3262 | Line 3413 | general_servlink_path: SERVLINK_PATH '='
3413   general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3414   {
3415   #ifdef HAVE_LIBCRYPTO
3416 <  if (ypass == 2)
3416 >  if (conf_parser_ctx.pass == 2)
3417    {
3418      struct EncCapability *ecap;
3419      const char *cipher_name;
# Line 3286 | Line 3437 | general_default_cipher_preference: DEFAU
3437        yyerror("Invalid cipher");
3438    }
3439   #else
3440 <  if (ypass == 2)
3440 >  if (conf_parser_ctx.pass == 2)
3441      yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3442   #endif
3443   };
3444  
3445   general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3446   {
3447 <  if (ypass == 2)
3447 >  if (conf_parser_ctx.pass == 2)
3448    {
3449      ConfigFileEntry.compression_level = $3;
3450   #ifndef HAVE_LIBZ
# Line 3316 | Line 3467 | general_use_egd: USE_EGD '=' TBOOL ';'
3467  
3468   general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
3469   {
3470 <  if (ypass == 2)
3470 >  if (conf_parser_ctx.pass == 2)
3471    {
3472      MyFree(ConfigFileEntry.egdpool_path);
3473      DupString(ConfigFileEntry.egdpool_path, yylval.string);
# Line 3350 | Line 3501 | umode_oitem:     T_BOTS
3501   } | T_CCONN
3502   {
3503    ConfigFileEntry.oper_umodes |= UMODE_CCONN;
3504 + } | T_CCONN_FULL
3505 + {
3506 +  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
3507   } | T_DEAF
3508   {
3509    ConfigFileEntry.oper_umodes |= UMODE_DEAF;
# Line 3412 | Line 3566 | umode_item:    T_BOTS
3566   } | T_CCONN
3567   {
3568    ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
3569 + } | T_CCONN_FULL
3570 + {
3571 +  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
3572   } | T_DEAF
3573   {
3574    ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
# Line 3492 | Line 3649 | general_dot_in_ip6_addr: DOT_IN_IP6_ADDR
3649   ***************************************************************************/
3650   gline_entry: GLINES
3651   {
3652 <  if (ypass == 2)
3652 >  if (conf_parser_ctx.pass == 2)
3653    {
3654      yy_conf = make_conf_item(GDENY_TYPE);
3655 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
3499 <    yy_aconf->flags = 0;
3655 >    yy_aconf = map_to_conf(yy_conf);
3656    }
3657   } '{' gline_items '}' ';'
3658   {
3659 <  if (ypass == 2)
3659 >  if (conf_parser_ctx.pass == 2)
3660    {
3661      /*
3662       * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3663       * end we will have one extra, so we should free it.
3664       */
3665 <    if (yy_conf->name == NULL && gdeny_items.length)
3665 >    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3666      {
3667 <      dlinkDelete(gdeny_items.tail, &gdeny_items);
3512 <      MyFree(yy_conf);
3667 >      delete_conf_item(yy_conf);
3668        yy_conf = NULL;
3669        yy_aconf = NULL;
3670      }
# Line 3527 | Line 3682 | gline_item:         gline_enable |
3682  
3683   gline_enable: ENABLE '=' TBOOL ';'
3684   {
3685 <  if (ypass == 2)
3685 >  if (conf_parser_ctx.pass == 2)
3686      ConfigFileEntry.glines = yylval.number;
3687   };
3688  
3689   gline_duration: DURATION '=' timespec ';'
3690   {
3691 <  if (ypass == 2)
3691 >  if (conf_parser_ctx.pass == 2)
3692      ConfigFileEntry.gline_time = $3;
3693   };
3694  
3695   gline_logging: LOGGING
3696   {
3697 <  if (ypass == 2)
3697 >  if (conf_parser_ctx.pass == 2)
3698      ConfigFileEntry.gline_logging = 0;
3699   } '=' gline_logging_types ';';
3700   gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3701   gline_logging_type_item: T_REJECT
3702   {
3703 <  if (ypass == 2)
3703 >  if (conf_parser_ctx.pass == 2)
3704      ConfigFileEntry.gline_logging |= GDENY_REJECT;
3705   } | T_BLOCK
3706   {
3707 <  if (ypass == 2)
3707 >  if (conf_parser_ctx.pass == 2)
3708      ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3709   };
3710  
3711   gline_user: USER '=' QSTRING ';'
3712   {
3713 <  if (ypass == 2)
3713 >  if (conf_parser_ctx.pass == 2)
3714    {
3715 <    struct CollectItem *yy_tmp;
3715 >    struct split_nuh_item nuh;
3716 >
3717 >    nuh.nuhmask  = yylval.string;
3718 >    nuh.nickptr  = NULL;
3719 >    nuh.userptr  = userbuf;
3720 >    nuh.hostptr  = hostbuf;
3721 >
3722 >    nuh.nicksize = 0;
3723 >    nuh.usersize = sizeof(userbuf);
3724 >    nuh.hostsize = sizeof(hostbuf);
3725 >
3726 >    split_nuh(&nuh);
3727  
3728      if (yy_aconf->user == NULL)
3729      {
3730 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
3730 >      DupString(yy_aconf->user, userbuf);
3731 >      DupString(yy_aconf->host, hostbuf);
3732      }
3733      else
3734      {
3735 <      yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
3736 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
3735 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3736 >
3737 >      DupString(yy_tmp->user, userbuf);
3738 >      DupString(yy_tmp->host, hostbuf);
3739 >
3740        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3741      }
3742    }
# Line 3574 | Line 3744 | gline_user: USER '=' QSTRING ';'
3744  
3745   gline_server: NAME '=' QSTRING ';'
3746   {
3747 <  if (ypass == 2)  
3747 >  if (conf_parser_ctx.pass == 2)  
3748    {
3749      MyFree(yy_conf->name);
3750      DupString(yy_conf->name, yylval.string);
# Line 3583 | Line 3753 | gline_server: NAME '=' QSTRING ';'
3753  
3754   gline_action: ACTION
3755   {
3756 <  if (ypass == 2)
3756 >  if (conf_parser_ctx.pass == 2)
3757      yy_aconf->flags = 0;
3758   } '=' gdeny_types ';'
3759   {
3760 <  if (ypass == 2)
3760 >  if (conf_parser_ctx.pass == 2)
3761    {
3762 <    struct CollectItem *yy_tmp;
3762 >    struct CollectItem *yy_tmp = NULL;
3763      dlink_node *ptr, *next_ptr;
3764  
3765      DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
# Line 3599 | Line 3769 | gline_action: ACTION
3769  
3770        yy_tmp = ptr->data;
3771        new_conf = make_conf_item(GDENY_TYPE);
3772 <      new_aconf = (struct AccessItem *)map_to_conf(new_conf);
3772 >      new_aconf = map_to_conf(new_conf);
3773  
3774        new_aconf->flags = yy_aconf->flags;
3775  
# Line 3618 | Line 3788 | gline_action: ACTION
3788  
3789        dlinkDelete(&yy_tmp->node, &col_conf_list);
3790      }
3791 +
3792 +    /*
3793 +     * In case someone has fed us with more than one action= after user/name
3794 +     * which would leak memory  -Michael
3795 +     */
3796 +    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3797 +      delete_conf_item(yy_conf);
3798 +
3799      yy_conf = make_conf_item(GDENY_TYPE);
3800 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
3623 <    yy_aconf->flags = 0;
3800 >    yy_aconf = map_to_conf(yy_conf);
3801    }
3802   };
3803  
3804   gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3805   gdeny_type_item: T_REJECT
3806   {
3807 <  if (ypass == 2)
3807 >  if (conf_parser_ctx.pass == 2)
3808      yy_aconf->flags |= GDENY_REJECT;
3809   } | T_BLOCK
3810   {
3811 <  if (ypass == 2)
3811 >  if (conf_parser_ctx.pass == 2)
3812      yy_aconf->flags |= GDENY_BLOCK;
3813   };
3814  
# Line 3645 | Line 3822 | channel_items:      channel_items channe
3822   channel_item:       channel_disable_local_channels | channel_use_except |
3823                      channel_use_invex | channel_use_knock |
3824                      channel_max_bans | channel_knock_delay |
3825 <                    channel_knock_delay_channel | channel_invite_ops_only |
3826 <                    channel_max_chans_per_user | channel_quiet_on_ban |
3827 <                    channel_default_split_user_count |
3828 <                    channel_default_split_server_count |
3829 <                    channel_no_create_on_split | channel_restrict_channels |
3830 <                    channel_no_join_on_split | channel_burst_topicwho |
3831 <                    channel_jflood_count | channel_jflood_time |
3832 <                    error;
3825 >                    channel_knock_delay_channel | channel_max_chans_per_user |
3826 >                    channel_quiet_on_ban | channel_default_split_user_count |
3827 >                    channel_default_split_server_count |
3828 >                    channel_no_create_on_split | channel_restrict_channels |
3829 >                    channel_no_join_on_split | channel_burst_topicwho |
3830 >                    channel_jflood_count | channel_jflood_time |
3831 >                    channel_disable_fake_channels | error;
3832 >
3833 > channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
3834 > {
3835 >  ConfigChannel.disable_fake_channels = yylval.number;
3836 > };
3837  
3838   channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3839   {
# Line 3689 | Line 3870 | channel_knock_delay_channel: KNOCK_DELAY
3870    ConfigChannel.knock_delay_channel = $3;
3871   };
3872  
3692 channel_invite_ops_only: INVITE_OPS_ONLY '=' TBOOL ';'
3693 {
3694  ConfigChannel.invite_ops_only = yylval.number;
3695 };
3696
3873   channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3874   {
3875    ConfigChannel.max_chans_per_user = $3;
# Line 3760 | Line 3936 | serverhide_item:    serverhide_flatten_l
3936  
3937   serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3938   {
3939 <  if (ypass == 2)
3939 >  if (conf_parser_ctx.pass == 2)
3940      ConfigServerHide.flatten_links = yylval.number;
3941   };
3942  
3943   serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3944   {
3945 <  if (ypass == 2)
3945 >  if (conf_parser_ctx.pass == 2)
3946      ConfigServerHide.hide_servers = yylval.number;
3947   };
3948  
3949   serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3950   {
3951 <  if (ypass == 2)
3951 >  if (conf_parser_ctx.pass == 2)
3952    {
3953      MyFree(ConfigServerHide.hidden_name);
3954      DupString(ConfigServerHide.hidden_name, yylval.string);
# Line 3781 | Line 3957 | serverhide_hidden_name: HIDDEN_NAME '='
3957  
3958   serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3959   {
3960 <  if (ypass == 2)
3960 >  if (conf_parser_ctx.pass == 2)
3961    {
3962      if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3963      {
# Line 3795 | Line 3971 | serverhide_links_delay: LINKS_DELAY '='
3971  
3972   serverhide_hidden: HIDDEN '=' TBOOL ';'
3973   {
3974 <  if (ypass == 2)
3974 >  if (conf_parser_ctx.pass == 2)
3975      ConfigServerHide.hidden = yylval.number;
3976   };
3977  
3978   serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3979   {
3980 <  if (ypass == 2)
3980 >  if (conf_parser_ctx.pass == 2)
3981      ConfigServerHide.disable_hidden = yylval.number;
3982   };
3983  
3984   serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3985   {
3986 <  if (ypass == 2)
3986 >  if (conf_parser_ctx.pass == 2)
3987      ConfigServerHide.hide_server_ips = yylval.number;
3988   };

Diff Legend

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