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 102 by michael, Mon Oct 10 12:17:19 2005 UTC vs.
ircd-hybrid-8/src/conf_parser.y (file contents), Revision 1495 by michael, Sun Aug 5 09:35:42 2012 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  ircd_parser.y: Parses the ircd configuration file.
3 > *  conf_parser.y: Parses the ircd configuration file.
4   *
5   *  Copyright (C) 2005 by the past and present ircd coders, and others.
6   *
# 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"
35 > #include "conf.h"
36   #include "event.h"
37 < #include "s_log.h"
37 > #include "log.h"
38   #include "client.h"     /* for UMODE_ALL only */
39 #include "pcre.h"
39   #include "irc_string.h"
41 #include "irc_getaddrinfo.h"
40   #include "sprintf_irc.h"
41   #include "memory.h"
42   #include "modules.h"
43 < #include "s_serv.h" /* for CAP_LL / IsCapable */
43 > #include "s_serv.h"
44   #include "hostmask.h"
45   #include "send.h"
46   #include "listener.h"
# Line 54 | Line 52
52   #include <openssl/rsa.h>
53   #include <openssl/bio.h>
54   #include <openssl/pem.h>
55 + #include <openssl/dh.h>
56   #endif
57  
58 + int yylex(void);
59 +
60   static char *class_name = NULL;
61   static struct ConfItem *yy_conf = NULL;
62   static struct AccessItem *yy_aconf = NULL;
# Line 64 | Line 65 | static struct ClassItem *yy_class = NULL
65   static char *yy_class_name = NULL;
66  
67   static dlink_list col_conf_list  = { NULL, NULL, 0 };
67 static dlink_list hub_conf_list  = { NULL, NULL, 0 };
68 static dlink_list leaf_conf_list = { NULL, NULL, 0 };
68   static unsigned int listener_flags = 0;
69   static unsigned int regex_ban = 0;
70   static char userbuf[IRCD_BUFSIZE];
71   static char hostbuf[IRCD_BUFSIZE];
72   static char reasonbuf[REASONLEN + 1];
73   static char gecos_name[REALLEN * 4];
74 <
75 < extern dlink_list gdeny_items; /* XXX */
76 <
74 > static char lfile[IRCD_BUFSIZE];
75 > static unsigned int ltype = 0;
76 > static unsigned int lsize = 0;
77   static char *resv_reason = NULL;
78   static char *listener_address = NULL;
80 static int not_atom = 0;
79  
80 < struct CollectItem {
80 > struct CollectItem
81 > {
82    dlink_node node;
83    char *name;
84    char *user;
# Line 106 | Line 105 | free_collect_item(struct CollectItem *it
105    MyFree(item);
106   }
107  
109 static void
110 unhook_hub_leaf_confs(void)
111 {
112  dlink_node *ptr;
113  dlink_node *next_ptr;
114  struct CollectItem *yy_hconf;
115  struct CollectItem *yy_lconf;
116
117  DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
118  {
119    yy_hconf = ptr->data;
120    dlinkDelete(&yy_hconf->node, &hub_conf_list);
121    free_collect_item(yy_hconf);
122  }
123
124  DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
125  {
126    yy_lconf = ptr->data;
127    dlinkDelete(&yy_lconf->node, &leaf_conf_list);
128    free_collect_item(yy_lconf);
129  }
130 }
131
108   %}
109  
110   %union {
# Line 146 | Line 122 | unhook_hub_leaf_confs(void)
122   %token  AUTOCONN
123   %token  T_BLOCK
124   %token  BURST_AWAY
149 %token  BURST_TOPICWHO
125   %token  BYTES KBYTES MBYTES GBYTES TBYTES
126   %token  CALLER_ID_WAIT
127   %token  CAN_FLOOD
153 %token  CAN_IDLE
128   %token  CHANNEL
129   %token  CIDR_BITLEN_IPV4
130   %token  CIDR_BITLEN_IPV6
157 %token  CIPHER_PREFERENCE
131   %token  CLASS
159 %token  COMPRESSED
160 %token  COMPRESSION_LEVEL
132   %token  CONNECT
133   %token  CONNECTFREQ
163 %token  CRYPTLINK
164 %token  DEFAULT_CIPHER_PREFERENCE
134   %token  DEFAULT_FLOODCOUNT
135   %token  DEFAULT_SPLIT_SERVER_COUNT
136   %token  DEFAULT_SPLIT_USER_COUNT
# Line 169 | Line 138 | unhook_hub_leaf_confs(void)
138   %token  DESCRIPTION
139   %token  DIE
140   %token  DISABLE_AUTH
141 < %token  DISABLE_HIDDEN
173 < %token  DISABLE_LOCAL_CHANNELS
141 > %token  DISABLE_FAKE_CHANNELS
142   %token  DISABLE_REMOTE_COMMANDS
175 %token  DOT_IN_IP6_ADDR
143   %token  DOTS_IN_IDENT
144   %token  DURATION
145   %token  EGDPOOL_PATH
# Line 182 | Line 149 | unhook_hub_leaf_confs(void)
149   %token  EXCEED_LIMIT
150   %token  EXEMPT
151   %token  FAILED_OPER_NOTICE
185 %token  FAKENAME
152   %token  IRCD_FLAGS
153   %token  FLATTEN_LINKS
188 %token  FFAILED_OPERLOG
189 %token  FKILLLOG
190 %token  FKLINELOG
191 %token  FGLINELOG
192 %token  FIOERRLOG
193 %token  FOPERLOG
194 %token  FOPERSPYLOG
195 %token  FUSERLOG
154   %token  GECOS
155   %token  GENERAL
156   %token  GLINE
157 < %token  GLINES
157 > %token  GLINE_DURATION
158 > %token  GLINE_ENABLE
159   %token  GLINE_EXEMPT
201 %token  GLINE_LOG
160   %token  GLINE_TIME
161 + %token  GLINE_REQUEST_DURATION
162   %token  GLINE_MIN_CIDR
163   %token  GLINE_MIN_CIDR6
164   %token  GLOBAL_KILL
# Line 207 | Line 166 | unhook_hub_leaf_confs(void)
166   %token  NEED_IDENT
167   %token  HAVENT_READ_CONF
168   %token  HIDDEN
210 %token  HIDDEN_ADMIN
169   %token  HIDDEN_NAME
212 %token  HIDDEN_OPER
170   %token  HIDE_SERVER_IPS
171   %token  HIDE_SERVERS
172   %token  HIDE_SPOOF_IPS
173   %token  HOST
174   %token  HUB
175   %token  HUB_MASK
219 %token  IDLETIME
176   %token  IGNORE_BOGUS_TS
177   %token  INVISIBLE_ON_CONNECT
178   %token  IP
# Line 228 | Line 184 | unhook_hub_leaf_confs(void)
184   %token  KLINE_WITH_REASON
185   %token  KNOCK_DELAY
186   %token  KNOCK_DELAY_CHANNEL
231 %token  LAZYLINK
187   %token  LEAF_MASK
188   %token  LINKS_DELAY
189   %token  LISTEN
190   %token  T_LOG
236 %token  LOGGING
237 %token  LOG_LEVEL
191   %token  MAX_ACCEPT
192   %token  MAX_BANS
193 + %token  MAX_CHANS_PER_OPER
194   %token  MAX_CHANS_PER_USER
195   %token  MAX_GLOBAL
196   %token  MAX_IDENT
# Line 245 | Line 199 | unhook_hub_leaf_confs(void)
199   %token  MAX_NICK_TIME
200   %token  MAX_NUMBER
201   %token  MAX_TARGETS
202 + %token  MAX_WATCH
203   %token  MESSAGE_LOCALE
204   %token  MIN_NONWILDCARD
205   %token  MIN_NONWILDCARD_SIMPLE
# Line 260 | Line 215 | unhook_hub_leaf_confs(void)
215   %token  NO_JOIN_ON_SPLIT
216   %token  NO_OPER_FLOOD
217   %token  NO_TILDE
263 %token  NOT
218   %token  NUMBER
219   %token  NUMBER_PER_IDENT
220   %token  NUMBER_PER_CIDR
# Line 268 | Line 222 | unhook_hub_leaf_confs(void)
222   %token  NUMBER_PER_IP_GLOBAL
223   %token  OPERATOR
224   %token  OPERS_BYPASS_CALLERID
271 %token  OPER_LOG
225   %token  OPER_ONLY_UMODES
226   %token  OPER_PASS_RESV
227   %token  OPER_SPY_T
228   %token  OPER_UMODES
276 %token  INVITE_OPS_ONLY
229   %token  JOIN_FLOOD_COUNT
230   %token  JOIN_FLOOD_TIME
231   %token  PACE_WAIT
# Line 299 | Line 251 | unhook_hub_leaf_confs(void)
251   %token  RSA_PRIVATE_KEY_FILE
252   %token  RSA_PUBLIC_KEY_FILE
253   %token  SSL_CERTIFICATE_FILE
254 + %token  SSL_DH_PARAM_FILE
255 + %token  T_SSL_CLIENT_METHOD
256 + %token  T_SSL_SERVER_METHOD
257 + %token  T_SSLV3
258 + %token  T_TLSV1
259   %token  RESV
260   %token  RESV_EXEMPT
261   %token  SECONDS MINUTES HOURS DAYS WEEKS
# Line 306 | Line 263 | unhook_hub_leaf_confs(void)
263   %token  SEND_PASSWORD
264   %token  SERVERHIDE
265   %token  SERVERINFO
309 %token  SERVLINK_PATH
266   %token  IRCD_SID
267   %token  TKLINE_EXPIRE_NOTICES
268   %token  T_SHARED
# Line 316 | Line 272 | unhook_hub_leaf_confs(void)
272   %token  SILENT
273   %token  SPOOF
274   %token  SPOOF_NOTICE
275 + %token  STATS_E_DISABLED
276   %token  STATS_I_OPER_ONLY
277   %token  STATS_K_OPER_ONLY
278   %token  STATS_O_OPER_ONLY
# Line 331 | Line 288 | unhook_hub_leaf_confs(void)
288   %token  T_SOFTCALLERID
289   %token  T_CALLERID
290   %token  T_CCONN
291 + %token  T_CCONN_FULL
292 + %token  T_SSL_CIPHER_LIST
293   %token  T_CLIENT_FLOOD
294   %token  T_DEAF
295   %token  T_DEBUG
296 + %token  T_DLINE
297   %token  T_DRONE
298   %token  T_EXTERNAL
299   %token  T_FULL
# Line 341 | Line 301 | unhook_hub_leaf_confs(void)
301   %token  T_IPV4
302   %token  T_IPV6
303   %token  T_LOCOPS
344 %token  T_LOGPATH
345 %token  T_L_CRIT
346 %token  T_L_DEBUG
347 %token  T_L_ERROR
348 %token  T_L_INFO
349 %token  T_L_NOTICE
350 %token  T_L_TRACE
351 %token  T_L_WARN
304   %token  T_MAX_CLIENTS
305   %token  T_NCHANGE
306   %token  T_OPERWALL
307   %token  T_REJ
308 + %token  T_SERVER
309   %token  T_SERVNOTICE
310 + %token  T_SET
311   %token  T_SKILL
312   %token  T_SPY
313   %token  T_SSL
314   %token  T_UMODES
315   %token  T_UNAUTH
316 + %token  T_UNDLINE
317 + %token  T_UNLIMITED
318   %token  T_UNRESV
319   %token  T_UNXLINE
320 + %token  T_GLOBOPS
321   %token  T_WALLOP
322 + %token  T_RESTART
323 + %token  T_SERVICE
324 + %token  T_SERVICES_NAME
325   %token  THROTTLE_TIME
326   %token  TOPICBURST
327   %token  TRUE_NO_OPER_FLOOD
# Line 371 | Line 331 | unhook_hub_leaf_confs(void)
331   %token  UNKLINE
332   %token  USER
333   %token  USE_EGD
374 %token  USE_EXCEPT
375 %token  USE_INVEX
376 %token  USE_KNOCK
334   %token  USE_LOGGING
335   %token  USE_WHOIS_ACTUALLY
336   %token  VHOST
# Line 381 | Line 338 | unhook_hub_leaf_confs(void)
338   %token  XLINE
339   %token  WARN
340   %token  WARN_NO_NLINE
341 + %token  T_SIZE
342 + %token  T_FILE
343  
344   %type <string> QSTRING
345   %type <number> NUMBER
# Line 404 | Line 363 | conf_item:        admin_entry
363                  | serverinfo_entry
364                  | serverhide_entry
365                  | resv_entry
366 +                | service_entry
367                  | shared_entry
368                  | cluster_entry
369                  | connect_entry
# Line 411 | Line 371 | conf_item:        admin_entry
371                  | deny_entry
372                  | exempt_entry
373                  | general_entry
414                | gline_entry
374                  | gecos_entry
375                  | modules_entry
376                  | error ';'
# Line 465 | Line 424 | modules_item:   modules_module | modules
424  
425   modules_module: MODULE '=' QSTRING ';'
426   {
427 < #ifndef STATIC_MODULES /* NOOP in the static case */
428 <  if (ypass == 2)
470 <  {
471 <    char *m_bn;
472 <
473 <    m_bn = basename(yylval.string);
474 <
475 <    /* I suppose we should just ignore it if it is already loaded(since
476 <     * otherwise we would flood the opers on rehash) -A1kmm.
477 <     */
478 <    add_conf_module(yylval.string);
479 <  }
480 < #endif
427 >  if (conf_parser_ctx.pass == 2)
428 >    add_conf_module(libio_basename(yylval.string));
429   };
430  
431   modules_path: PATH '=' QSTRING ';'
432   {
433 < #ifndef STATIC_MODULES
486 <  if (ypass == 2)
433 >  if (conf_parser_ctx.pass == 2)
434      mod_add_path(yylval.string);
488 #endif
435   };
436  
491 /***************************************************************************
492 *  section serverinfo
493 ***************************************************************************/
494 serverinfo_entry: SERVERINFO
495  '{' serverinfo_items '}' ';';
437  
438 < serverinfo_items:       serverinfo_items serverinfo_item |
439 <                        serverinfo_item ;
438 > serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
439 >
440 > serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
441   serverinfo_item:        serverinfo_name | serverinfo_vhost |
442                          serverinfo_hub | serverinfo_description |
443                          serverinfo_network_name | serverinfo_network_desc |
444 <                        serverinfo_max_clients |
444 >                        serverinfo_max_clients | serverinfo_ssl_dh_param_file |
445                          serverinfo_rsa_private_key_file | serverinfo_vhost6 |
446                          serverinfo_sid | serverinfo_ssl_certificate_file |
447 +                        serverinfo_ssl_client_method | serverinfo_ssl_server_method |
448 +                        serverinfo_ssl_cipher_list |
449                          error ';' ;
450  
451 +
452 + serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
453 + serverinfo_ssl_server_method: T_SSL_SERVER_METHOD '=' server_method_types ';' ;
454 +
455 + client_method_types: client_method_types ',' client_method_type_item | client_method_type_item;
456 + client_method_type_item: T_SSLV3
457 + {
458 + #ifdef HAVE_LIBCRYPTO
459 +  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
460 +    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
461 + #endif
462 + } | T_TLSV1
463 + {
464 + #ifdef HAVE_LIBCRYPTO
465 +  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
466 +    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
467 + #endif
468 + };
469 +
470 + server_method_types: server_method_types ',' server_method_type_item | server_method_type_item;
471 + server_method_type_item: T_SSLV3
472 + {
473 + #ifdef HAVE_LIBCRYPTO
474 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
475 +    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
476 + #endif
477 + } | T_TLSV1
478 + {
479 + #ifdef HAVE_LIBCRYPTO
480 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
481 +    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
482 + #endif
483 + };
484 +
485   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
486   {
487   #ifdef HAVE_LIBCRYPTO
488 <  if (ypass == 2 && ServerInfo.ctx)
488 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
489    {
490      if (!ServerInfo.rsa_private_key_file)
491      {
# Line 515 | Line 493 | serverinfo_ssl_certificate_file: SSL_CER
493        break;
494      }
495  
496 <    if (SSL_CTX_use_certificate_file(ServerInfo.ctx,
497 <      yylval.string, SSL_FILETYPE_PEM) <= 0)
496 >    if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
497 >                                     SSL_FILETYPE_PEM) <= 0 ||
498 >        SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
499 >                                     SSL_FILETYPE_PEM) <= 0)
500      {
501        yyerror(ERR_lib_error_string(ERR_get_error()));
502        break;
503      }
504  
505 <    if (SSL_CTX_use_PrivateKey_file(ServerInfo.ctx,
506 <      ServerInfo.rsa_private_key_file, SSL_FILETYPE_PEM) <= 0)
505 >    if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
506 >                                    SSL_FILETYPE_PEM) <= 0 ||
507 >        SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
508 >                                    SSL_FILETYPE_PEM) <= 0)
509      {
510        yyerror(ERR_lib_error_string(ERR_get_error()));
511        break;
512      }
513  
514 <    if (!SSL_CTX_check_private_key(ServerInfo.ctx))
514 >    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) ||
515 >        !SSL_CTX_check_private_key(ServerInfo.client_ctx))
516      {
517 <      yyerror("RSA private key does not match the SSL certificate public key!");
517 >      yyerror(ERR_lib_error_string(ERR_get_error()));
518        break;
519      }
520    }
# Line 541 | Line 524 | serverinfo_ssl_certificate_file: SSL_CER
524   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
525   {
526   #ifdef HAVE_LIBCRYPTO
527 <  if (ypass == 1)
527 >  if (conf_parser_ctx.pass == 1)
528    {
529      BIO *file;
530  
# Line 565 | Line 548 | serverinfo_rsa_private_key_file: RSA_PRI
548        break;
549      }
550  
551 <    ServerInfo.rsa_private_key = (RSA *)PEM_read_bio_RSAPrivateKey(file, NULL,
569 <      0, NULL);
551 >    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
552  
553      BIO_set_close(file, BIO_CLOSE);
554      BIO_free(file);
# Line 598 | Line 580 | serverinfo_rsa_private_key_file: RSA_PRI
580   #endif
581   };
582  
583 + serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
584 + {
585 + /* TBD - XXX: error reporting */
586 + #ifdef HAVE_LIBCRYPTO
587 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
588 +  {
589 +    BIO *file = BIO_new_file(yylval.string, "r");
590 +
591 +    if (file)
592 +    {
593 +      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
594 +
595 +      BIO_free(file);
596 +
597 +      if (dh)
598 +      {
599 +        if (DH_size(dh) < 128)
600 +          ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
601 +        else
602 +          SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
603 +
604 +        DH_free(dh);
605 +      }
606 +    }
607 +  }
608 + #endif
609 + };
610 +
611 + serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
612 + {
613 + #ifdef HAVE_LIBCRYPTO
614 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
615 +    SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
616 + #endif
617 + };
618 +
619   serverinfo_name: NAME '=' QSTRING ';'
620   {
621    /* this isn't rehashable */
622 <  if (ypass == 2)
622 >  if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
623    {
624 <    if (ServerInfo.name == NULL)
624 >    if (valid_servname(yylval.string))
625 >      DupString(ServerInfo.name, yylval.string);
626 >    else
627      {
628 <      /* the ircd will exit() in main() if we dont set one */
629 <      if (strlen(yylval.string) <= HOSTLEN)
610 <        DupString(ServerInfo.name, yylval.string);
628 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::name -- invalid name. Aborting.");
629 >      exit(0);
630      }
631    }
632   };
# Line 615 | Line 634 | serverinfo_name: NAME '=' QSTRING ';'
634   serverinfo_sid: IRCD_SID '=' QSTRING ';'
635   {
636    /* this isn't rehashable */
637 <  if (ypass == 2 && !ServerInfo.sid)
637 >  if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
638    {
639 <    if ((strlen(yylval.string) == IRC_MAXSID) && IsDigit(yylval.string[0])
621 <        && IsAlNum(yylval.string[1]) && IsAlNum(yylval.string[2]))
622 <    {
639 >    if (valid_sid(yylval.string))
640        DupString(ServerInfo.sid, yylval.string);
624    }
641      else
642      {
643 <      ilog(L_ERROR, "Ignoring config file entry SID -- invalid SID. Aborting.");
643 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
644        exit(0);
645      }
646    }
# Line 632 | Line 648 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
648  
649   serverinfo_description: DESCRIPTION '=' QSTRING ';'
650   {
651 <  if (ypass == 2)
651 >  if (conf_parser_ctx.pass == 2)
652    {
653      MyFree(ServerInfo.description);
654      DupString(ServerInfo.description,yylval.string);
# Line 641 | Line 657 | serverinfo_description: DESCRIPTION '='
657  
658   serverinfo_network_name: NETWORK_NAME '=' QSTRING ';'
659   {
660 <  if (ypass == 2)
660 >  if (conf_parser_ctx.pass == 2)
661    {
662      char *p;
663  
# Line 655 | Line 671 | serverinfo_network_name: NETWORK_NAME '=
671  
672   serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
673   {
674 <  if (ypass == 2)
674 >  if (conf_parser_ctx.pass == 2)
675    {
676      MyFree(ServerInfo.network_desc);
677      DupString(ServerInfo.network_desc, yylval.string);
# Line 664 | Line 680 | serverinfo_network_desc: NETWORK_DESC '=
680  
681   serverinfo_vhost: VHOST '=' QSTRING ';'
682   {
683 <  if (ypass == 2 && *yylval.string != '*')
683 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
684    {
685      struct addrinfo hints, *res;
686  
# Line 674 | Line 690 | serverinfo_vhost: VHOST '=' QSTRING ';'
690      hints.ai_socktype = SOCK_STREAM;
691      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
692  
693 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
694 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
693 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
694 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
695      else
696      {
697        assert(res != NULL);
# Line 683 | Line 699 | serverinfo_vhost: VHOST '=' QSTRING ';'
699        memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen);
700        ServerInfo.ip.ss.ss_family = res->ai_family;
701        ServerInfo.ip.ss_len = res->ai_addrlen;
702 <      irc_freeaddrinfo(res);
702 >      freeaddrinfo(res);
703  
704        ServerInfo.specific_ipv4_vhost = 1;
705      }
# Line 693 | Line 709 | serverinfo_vhost: VHOST '=' QSTRING ';'
709   serverinfo_vhost6: VHOST6 '=' QSTRING ';'
710   {
711   #ifdef IPV6
712 <  if (ypass == 2 && *yylval.string != '*')
712 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
713    {
714      struct addrinfo hints, *res;
715  
# Line 703 | Line 719 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
719      hints.ai_socktype = SOCK_STREAM;
720      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
721  
722 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
723 <      ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string);
722 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
723 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
724      else
725      {
726        assert(res != NULL);
# Line 712 | Line 728 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
728        memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen);
729        ServerInfo.ip6.ss.ss_family = res->ai_family;
730        ServerInfo.ip6.ss_len = res->ai_addrlen;
731 <      irc_freeaddrinfo(res);
731 >      freeaddrinfo(res);
732  
733        ServerInfo.specific_ipv6_vhost = 1;
734      }
# Line 722 | Line 738 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
738  
739   serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
740   {
741 <  if (ypass == 2)
741 >  if (conf_parser_ctx.pass == 2)
742    {
743      recalc_fdlimit(NULL);
744  
# Line 745 | Line 761 | serverinfo_max_clients: T_MAX_CLIENTS '=
761  
762   serverinfo_hub: HUB '=' TBOOL ';'
763   {
764 <  if (ypass == 2)
765 <  {
750 <    if (yylval.number)
751 <    {
752 <      /* Don't become a hub if we have a lazylink active. */
753 <      if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL))
754 <      {
755 <        sendto_realops_flags(UMODE_ALL, L_ALL,
756 <                             "Ignoring config file line hub=yes; "
757 <                             "due to active LazyLink (%s)", uplink->name);
758 <      }
759 <      else
760 <      {
761 <        ServerInfo.hub = 1;
762 <        uplink = NULL;
763 <        delete_capability("HUB");
764 <        add_capability("HUB", CAP_HUB, 1);
765 <      }
766 <    }
767 <    else if (ServerInfo.hub)
768 <    {
769 <      dlink_node *ptr = NULL;
770 <
771 <      ServerInfo.hub = 0;
772 <      delete_capability("HUB");
773 <
774 <      /* Don't become a leaf if we have a lazylink active. */
775 <      DLINK_FOREACH(ptr, serv_list.head)
776 <      {
777 <        const struct Client *acptr = ptr->data;
778 <        if (MyConnect(acptr) && IsCapable(acptr, CAP_LL))
779 <        {
780 <          sendto_realops_flags(UMODE_ALL, L_ALL,
781 <                               "Ignoring config file line hub=no; "
782 <                               "due to active LazyLink (%s)",
783 <                               acptr->name);
784 <          add_capability("HUB", CAP_HUB, 1);
785 <          ServerInfo.hub = 1;
786 <          break;
787 <        }
788 <      }
789 <    }
790 <  }
764 >  if (conf_parser_ctx.pass == 2)
765 >    ServerInfo.hub = yylval.number;
766   };
767  
768   /***************************************************************************
# Line 801 | Line 776 | admin_item:  admin_name | admin_descript
776  
777   admin_name: NAME '=' QSTRING ';'
778   {
779 <  if (ypass == 2)
779 >  if (conf_parser_ctx.pass == 2)
780    {
781      MyFree(AdminInfo.name);
782      DupString(AdminInfo.name, yylval.string);
# Line 810 | Line 785 | admin_name: NAME '=' QSTRING ';'
785  
786   admin_email: EMAIL '=' QSTRING ';'
787   {
788 <  if (ypass == 2)
788 >  if (conf_parser_ctx.pass == 2)
789    {
790      MyFree(AdminInfo.email);
791      DupString(AdminInfo.email, yylval.string);
# Line 819 | Line 794 | admin_email: EMAIL '=' QSTRING ';'
794  
795   admin_description: DESCRIPTION '=' QSTRING ';'
796   {
797 <  if (ypass == 2)
797 >  if (conf_parser_ctx.pass == 2)
798    {
799      MyFree(AdminInfo.description);
800      DupString(AdminInfo.description, yylval.string);
# Line 829 | Line 804 | admin_description: DESCRIPTION '=' QSTRI
804   /***************************************************************************
805   *  section logging
806   ***************************************************************************/
807 < /* XXX */
808 < logging_entry:          LOGGING  '{' logging_items '}' ';' ;
834 <
835 < logging_items:          logging_items logging_item |
836 <                        logging_item ;
807 > logging_entry:          T_LOG  '{' logging_items '}' ';' ;
808 > logging_items:          logging_items logging_item | logging_item ;
809  
810 < logging_item:           logging_path | logging_oper_log |
839 <                        logging_log_level |
840 <                        logging_use_logging | logging_fuserlog |
841 <                        logging_foperlog | logging_fglinelog |
842 <                        logging_fklinelog | logging_killlog |
843 <                        logging_foperspylog | logging_ioerrlog |
844 <                        logging_ffailed_operlog |
810 > logging_item:           logging_use_logging | logging_file_entry |
811                          error ';' ;
812  
813 < logging_path:           T_LOGPATH '=' QSTRING ';'
848 <                        {
849 <                        };
850 <
851 < logging_oper_log:       OPER_LOG '=' QSTRING ';'
852 <                        {
853 <                        };
854 <
855 < logging_fuserlog: FUSERLOG '=' QSTRING ';'
813 > logging_use_logging: USE_LOGGING '=' TBOOL ';'
814   {
815 <  if (ypass == 2)
816 <    strlcpy(ConfigLoggingEntry.userlog, yylval.string,
859 <            sizeof(ConfigLoggingEntry.userlog));
815 >  if (conf_parser_ctx.pass == 2)
816 >    ConfigLoggingEntry.use_logging = yylval.number;
817   };
818  
819 < logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
819 > logging_file_entry:
820   {
821 <  if (ypass == 2)
822 <    strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
823 <            sizeof(ConfigLoggingEntry.failed_operlog));
824 < };
868 <
869 < logging_foperlog: FOPERLOG '=' QSTRING ';'
821 >  lfile[0] = '\0';
822 >  ltype = 0;
823 >  lsize = 0;
824 > } T_FILE  '{' logging_file_items '}' ';'
825   {
826 <  if (ypass == 2)
827 <    strlcpy(ConfigLoggingEntry.operlog, yylval.string,
873 <            sizeof(ConfigLoggingEntry.operlog));
826 >  if (conf_parser_ctx.pass == 2 && ltype > 0)
827 >    log_add_file(ltype, lsize, lfile);
828   };
829  
830 < logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
831 < {
878 <  if (ypass == 2)
879 <    strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
880 <            sizeof(ConfigLoggingEntry.operspylog));
881 < };
830 > logging_file_items: logging_file_items logging_file_item |
831 >                    logging_file_item ;
832  
833 < logging_fglinelog: FGLINELOG '=' QSTRING ';'
834 < {
885 <  if (ypass == 2)
886 <    strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
887 <            sizeof(ConfigLoggingEntry.glinelog));
888 < };
833 > logging_file_item:  logging_file_name | logging_file_type |
834 >                    logging_file_size | error ';' ;
835  
836 < logging_fklinelog: FKLINELOG '=' QSTRING ';'
836 > logging_file_name: NAME '=' QSTRING ';'
837   {
838 <  if (ypass == 2)
839 <    strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
894 <            sizeof(ConfigLoggingEntry.klinelog));
895 < };
838 >  strlcpy(lfile, yylval.string, sizeof(lfile));
839 > }
840  
841 < logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
841 > logging_file_size: T_SIZE '=' sizespec ';'
842   {
843 <  if (ypass == 2)
844 <    strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
901 <            sizeof(ConfigLoggingEntry.ioerrlog));
902 < };
903 <
904 < logging_killlog: FKILLLOG '=' QSTRING ';'
843 >  lsize = $3;
844 > } | T_SIZE '=' T_UNLIMITED ';'
845   {
846 <  if (ypass == 2)
907 <    strlcpy(ConfigLoggingEntry.killlog, yylval.string,
908 <            sizeof(ConfigLoggingEntry.killlog));
846 >  lsize = 0;
847   };
848  
849 < logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
912 < {
913 <  if (ypass == 2)
914 <    set_log_level(L_CRIT);
915 < } | LOG_LEVEL '=' T_L_ERROR ';'
916 < {
917 <  if (ypass == 2)
918 <    set_log_level(L_ERROR);
919 < } | LOG_LEVEL '=' T_L_WARN ';'
920 < {
921 <  if (ypass == 2)
922 <    set_log_level(L_WARN);
923 < } | LOG_LEVEL '=' T_L_NOTICE ';'
924 < {
925 <  if (ypass == 2)
926 <    set_log_level(L_NOTICE);
927 < } | LOG_LEVEL '=' T_L_TRACE ';'
928 < {
929 <  if (ypass == 2)
930 <    set_log_level(L_TRACE);
931 < } | LOG_LEVEL '=' T_L_INFO ';'
932 < {
933 <  if (ypass == 2)
934 <    set_log_level(L_INFO);
935 < } | LOG_LEVEL '=' T_L_DEBUG ';'
849 > logging_file_type: TYPE
850   {
851 <  if (ypass == 2)
852 <    set_log_level(L_DEBUG);
853 < };
851 >  if (conf_parser_ctx.pass == 2)
852 >    ltype = 0;
853 > } '='  logging_file_type_items ';' ;
854  
855 < logging_use_logging: USE_LOGGING '=' TBOOL ';'
855 > logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
856 > logging_file_type_item:  USER
857   {
858 <  if (ypass == 2)
859 <    ConfigLoggingEntry.use_logging = yylval.number;
858 >  if (conf_parser_ctx.pass == 2)
859 >    ltype = LOG_TYPE_USER;
860 > } | OPERATOR
861 > {
862 >  if (conf_parser_ctx.pass == 2)
863 >    ltype = LOG_TYPE_OPER;
864 > } | GLINE
865 > {
866 >  if (conf_parser_ctx.pass == 2)
867 >    ltype = LOG_TYPE_GLINE;
868 > } | T_DLINE
869 > {
870 >  if (conf_parser_ctx.pass == 2)
871 >    ltype = LOG_TYPE_DLINE;
872 > } | KLINE
873 > {
874 >  if (conf_parser_ctx.pass == 2)
875 >    ltype = LOG_TYPE_KLINE;
876 > } | KILL
877 > {
878 >  if (conf_parser_ctx.pass == 2)
879 >    ltype = LOG_TYPE_KILL;
880 > } | T_DEBUG
881 > {
882 >  if (conf_parser_ctx.pass == 2)
883 >    ltype = LOG_TYPE_DEBUG;
884   };
885  
886 +
887   /***************************************************************************
888   * section oper
889   ***************************************************************************/
890   oper_entry: OPERATOR
891   {
892 <  if (ypass == 2)
892 >  if (conf_parser_ctx.pass == 2)
893    {
894      yy_conf = make_conf_item(OPER_TYPE);
895      yy_aconf = map_to_conf(yy_conf);
# Line 960 | Line 900 | oper_entry: OPERATOR
900      MyFree(class_name);
901      class_name = NULL;
902    }
903 < } oper_name_b '{' oper_items '}' ';'
903 > } '{' oper_items '}' ';'
904   {
905 <  if (ypass == 2)
905 >  if (conf_parser_ctx.pass == 2)
906    {
907      struct CollectItem *yy_tmp;
908      dlink_node *ptr;
# Line 995 | Line 935 | oper_entry: OPERATOR
935          DupString(new_aconf->host, yy_tmp->host);
936        else
937          DupString(new_aconf->host, "*");
938 +
939 +      new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->addr,
940 +                                     &new_aconf->bits);
941 +
942        conf_add_class_to_conf(new_conf, class_name);
943        if (yy_aconf->passwd != NULL)
944          DupString(new_aconf->passwd, yy_aconf->passwd);
# Line 1041 | Line 985 | oper_entry: OPERATOR
985    }
986   };
987  
1044 oper_name_b: | oper_name_t;
988   oper_items:     oper_items oper_item | oper_item;
989 < oper_item:      oper_name | oper_user | oper_password | oper_hidden_admin |
990 <                oper_hidden_oper | oper_umodes |
991 <                oper_class | oper_global_kill | oper_remote |
1049 <                oper_kline | oper_xline | oper_unkline |
1050 <                oper_gline | oper_nick_changes | oper_remoteban |
1051 <                oper_die | oper_rehash | oper_admin | oper_operwall |
1052 <                oper_encrypted | oper_rsa_public_key_file |
1053 <                oper_flags | error ';' ;
989 > oper_item:      oper_name | oper_user | oper_password |
990 >                oper_umodes | oper_class | oper_encrypted |
991 >                oper_rsa_public_key_file | oper_flags | error ';' ;
992  
993   oper_name: NAME '=' QSTRING ';'
994   {
995 <  if (ypass == 2)
995 >  if (conf_parser_ctx.pass == 2)
996    {
1059    if (strlen(yylval.string) > OPERNICKLEN)
1060      yylval.string[OPERNICKLEN] = '\0';
1061
997      MyFree(yy_conf->name);
998      DupString(yy_conf->name, yylval.string);
999    }
1000   };
1001  
1002 < oper_name_t: QSTRING
1002 > oper_user: USER '=' QSTRING ';'
1003   {
1004 <  if (ypass == 2)
1004 >  if (conf_parser_ctx.pass == 2)
1005    {
1006 <    if (strlen(yylval.string) > OPERNICKLEN)
1072 <      yylval.string[OPERNICKLEN] = '\0';
1006 >    struct split_nuh_item nuh;
1007  
1008 <    MyFree(yy_conf->name);
1009 <    DupString(yy_conf->name, yylval.string);
1010 <  }
1011 < };
1008 >    nuh.nuhmask  = yylval.string;
1009 >    nuh.nickptr  = NULL;
1010 >    nuh.userptr  = userbuf;
1011 >    nuh.hostptr  = hostbuf;
1012  
1013 < oper_user: USER '=' QSTRING ';'
1014 < {
1015 <  if (ypass == 2)
1016 <  {
1017 <    struct CollectItem *yy_tmp;
1013 >    nuh.nicksize = 0;
1014 >    nuh.usersize = sizeof(userbuf);
1015 >    nuh.hostsize = sizeof(hostbuf);
1016 >
1017 >    split_nuh(&nuh);
1018  
1019      if (yy_aconf->user == NULL)
1020      {
1021 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1021 >      DupString(yy_aconf->user, userbuf);
1022 >      DupString(yy_aconf->host, hostbuf);
1023 >
1024 >      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->addr,
1025 >                                    &yy_aconf->bits);
1026      }
1027      else
1028      {
1029 <      yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
1030 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1029 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1030 >
1031 >      DupString(yy_tmp->user, userbuf);
1032 >      DupString(yy_tmp->host, hostbuf);
1033 >
1034        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1035      }
1036    }
# Line 1097 | Line 1038 | oper_user: USER '=' QSTRING ';'
1038  
1039   oper_password: PASSWORD '=' QSTRING ';'
1040   {
1041 <  if (ypass == 2)
1041 >  if (conf_parser_ctx.pass == 2)
1042    {
1043      if (yy_aconf->passwd != NULL)
1044        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
# Line 1109 | Line 1050 | oper_password: PASSWORD '=' QSTRING ';'
1050  
1051   oper_encrypted: ENCRYPTED '=' TBOOL ';'
1052   {
1053 <  if (ypass == 2)
1053 >  if (conf_parser_ctx.pass == 2)
1054    {
1055      if (yylval.number)
1056        SetConfEncrypted(yy_aconf);
# Line 1121 | Line 1062 | oper_encrypted: ENCRYPTED '=' TBOOL ';'
1062   oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1063   {
1064   #ifdef HAVE_LIBCRYPTO
1065 <  if (ypass == 2)
1065 >  if (conf_parser_ctx.pass == 2)
1066    {
1067      BIO *file;
1068  
# Line 1162 | Line 1103 | oper_rsa_public_key_file: RSA_PUBLIC_KEY
1103  
1104   oper_class: CLASS '=' QSTRING ';'
1105   {
1106 <  if (ypass == 2)
1106 >  if (conf_parser_ctx.pass == 2)
1107    {
1108      MyFree(class_name);
1109      DupString(class_name, yylval.string);
# Line 1171 | Line 1112 | oper_class: CLASS '=' QSTRING ';'
1112  
1113   oper_umodes: T_UMODES
1114   {
1115 <  yy_aconf->modes = 0;
1115 >  if (conf_parser_ctx.pass == 2)
1116 >    yy_aconf->modes = 0;
1117   } '='  oper_umodes_items ';' ;
1118  
1119   oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1120   oper_umodes_item:  T_BOTS
1121   {
1122 <  yy_aconf->modes |= UMODE_BOTS;
1122 >  if (conf_parser_ctx.pass == 2)
1123 >    yy_aconf->modes |= UMODE_BOTS;
1124   } | T_CCONN
1125   {
1126 <  yy_aconf->modes |= UMODE_CCONN;
1126 >  if (conf_parser_ctx.pass == 2)
1127 >    yy_aconf->modes |= UMODE_CCONN;
1128 > } | T_CCONN_FULL
1129 > {
1130 >  if (conf_parser_ctx.pass == 2)
1131 >    yy_aconf->modes |= UMODE_CCONN_FULL;
1132   } | T_DEAF
1133   {
1134 <  yy_aconf->modes |= UMODE_DEAF;
1134 >  if (conf_parser_ctx.pass == 2)
1135 >    yy_aconf->modes |= UMODE_DEAF;
1136   } | T_DEBUG
1137   {
1138 <  yy_aconf->modes |= UMODE_DEBUG;
1138 >  if (conf_parser_ctx.pass == 2)
1139 >    yy_aconf->modes |= UMODE_DEBUG;
1140   } | T_FULL
1141   {
1142 <  yy_aconf->modes |= UMODE_FULL;
1142 >  if (conf_parser_ctx.pass == 2)
1143 >    yy_aconf->modes |= UMODE_FULL;
1144 > } | HIDDEN
1145 > {
1146 >  if (conf_parser_ctx.pass == 2)
1147 >    yy_aconf->modes |= UMODE_HIDDEN;
1148   } | T_SKILL
1149   {
1150 <  yy_aconf->modes |= UMODE_SKILL;
1150 >  if (conf_parser_ctx.pass == 2)
1151 >    yy_aconf->modes |= UMODE_SKILL;
1152   } | T_NCHANGE
1153   {
1154 <  yy_aconf->modes |= UMODE_NCHANGE;
1154 >  if (conf_parser_ctx.pass == 2)
1155 >    yy_aconf->modes |= UMODE_NCHANGE;
1156   } | T_REJ
1157   {
1158 <  yy_aconf->modes |= UMODE_REJ;
1158 >  if (conf_parser_ctx.pass == 2)
1159 >    yy_aconf->modes |= UMODE_REJ;
1160   } | T_UNAUTH
1161   {
1162 <  yy_aconf->modes |= UMODE_UNAUTH;
1162 >  if (conf_parser_ctx.pass == 2)
1163 >    yy_aconf->modes |= UMODE_UNAUTH;
1164   } | T_SPY
1165   {
1166 <  yy_aconf->modes |= UMODE_SPY;
1166 >  if (conf_parser_ctx.pass == 2)
1167 >    yy_aconf->modes |= UMODE_SPY;
1168   } | T_EXTERNAL
1169   {
1170 <  yy_aconf->modes |= UMODE_EXTERNAL;
1170 >  if (conf_parser_ctx.pass == 2)
1171 >    yy_aconf->modes |= UMODE_EXTERNAL;
1172   } | T_OPERWALL
1173   {
1174 <  yy_aconf->modes |= UMODE_OPERWALL;
1174 >  if (conf_parser_ctx.pass == 2)
1175 >    yy_aconf->modes |= UMODE_OPERWALL;
1176   } | T_SERVNOTICE
1177   {
1178 <  yy_aconf->modes |= UMODE_SERVNOTICE;
1178 >  if (conf_parser_ctx.pass == 2)
1179 >    yy_aconf->modes |= UMODE_SERVNOTICE;
1180   } | T_INVISIBLE
1181   {
1182 <  yy_aconf->modes |= UMODE_INVISIBLE;
1182 >  if (conf_parser_ctx.pass == 2)
1183 >    yy_aconf->modes |= UMODE_INVISIBLE;
1184   } | T_WALLOP
1185   {
1186 <  yy_aconf->modes |= UMODE_WALLOP;
1186 >  if (conf_parser_ctx.pass == 2)
1187 >    yy_aconf->modes |= UMODE_WALLOP;
1188   } | T_SOFTCALLERID
1189   {
1190 <  yy_aconf->modes |= UMODE_SOFTCALLERID;
1190 >  if (conf_parser_ctx.pass == 2)
1191 >    yy_aconf->modes |= UMODE_SOFTCALLERID;
1192   } | T_CALLERID
1193   {
1194 <  yy_aconf->modes |= UMODE_CALLERID;
1194 >  if (conf_parser_ctx.pass == 2)
1195 >    yy_aconf->modes |= UMODE_CALLERID;
1196   } | T_LOCOPS
1197   {
1198 <  yy_aconf->modes |= UMODE_LOCOPS;
1199 < };
1233 <
1234 < oper_global_kill: GLOBAL_KILL '=' TBOOL ';'
1235 < {
1236 <  if (ypass == 2)
1237 <  {
1238 <    if (yylval.number)
1239 <      yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1240 <    else
1241 <      yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1242 <  }
1243 < };
1244 <
1245 < oper_remote: REMOTE '=' TBOOL ';'
1246 < {
1247 <  if (ypass == 2)
1248 <  {
1249 <    if (yylval.number)
1250 <      yy_aconf->port |= OPER_FLAG_REMOTE;
1251 <    else
1252 <      yy_aconf->port &= ~OPER_FLAG_REMOTE;
1253 <  }
1254 < };
1255 <
1256 < oper_remoteban: REMOTEBAN '=' TBOOL ';'
1257 < {
1258 <  if (ypass == 2)
1259 <  {
1260 <    if (yylval.number)
1261 <      yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1262 <    else
1263 <      yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1264 <  }
1265 < };
1266 <
1267 < oper_kline: KLINE '=' TBOOL ';'
1268 < {
1269 <  if (ypass == 2)
1270 <  {
1271 <    if (yylval.number)
1272 <      yy_aconf->port |= OPER_FLAG_K;
1273 <    else
1274 <      yy_aconf->port &= ~OPER_FLAG_K;
1275 <  }
1276 < };
1277 <
1278 < oper_xline: XLINE '=' TBOOL ';'
1279 < {
1280 <  if (ypass == 2)
1281 <  {
1282 <    if (yylval.number)
1283 <      yy_aconf->port |= OPER_FLAG_X;
1284 <    else
1285 <      yy_aconf->port &= ~OPER_FLAG_X;
1286 <  }
1287 < };
1288 <
1289 < oper_unkline: UNKLINE '=' TBOOL ';'
1290 < {
1291 <  if (ypass == 2)
1292 <  {
1293 <    if (yylval.number)
1294 <      yy_aconf->port |= OPER_FLAG_UNKLINE;
1295 <    else
1296 <      yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1297 <  }
1298 < };
1299 <
1300 < oper_gline: GLINE '=' TBOOL ';'
1301 < {
1302 <  if (ypass == 2)
1303 <  {
1304 <    if (yylval.number)
1305 <      yy_aconf->port |= OPER_FLAG_GLINE;
1306 <    else
1307 <      yy_aconf->port &= ~OPER_FLAG_GLINE;
1308 <  }
1309 < };
1310 <
1311 < oper_nick_changes: NICK_CHANGES '=' TBOOL ';'
1312 < {
1313 <  if (ypass == 2)
1314 <  {
1315 <    if (yylval.number)
1316 <      yy_aconf->port |= OPER_FLAG_N;
1317 <    else
1318 <      yy_aconf->port &= ~OPER_FLAG_N;
1319 <  }
1320 < };
1321 <
1322 < oper_die: DIE '=' TBOOL ';'
1323 < {
1324 <  if (ypass == 2)
1325 <  {
1326 <    if (yylval.number)
1327 <      yy_aconf->port |= OPER_FLAG_DIE;
1328 <    else
1329 <      yy_aconf->port &= ~OPER_FLAG_DIE;
1330 <  }
1331 < };
1332 <
1333 < oper_rehash: REHASH '=' TBOOL ';'
1334 < {
1335 <  if (ypass == 2)
1336 <  {
1337 <    if (yylval.number)
1338 <      yy_aconf->port |= OPER_FLAG_REHASH;
1339 <    else
1340 <      yy_aconf->port &= ~OPER_FLAG_REHASH;
1341 <  }
1342 < };
1343 <
1344 < oper_admin: ADMIN '=' TBOOL ';'
1345 < {
1346 <  if (ypass == 2)
1347 <  {
1348 <    if (yylval.number)
1349 <      yy_aconf->port |= OPER_FLAG_ADMIN;
1350 <    else
1351 <      yy_aconf->port &= ~OPER_FLAG_ADMIN;
1352 <  }
1353 < };
1354 <
1355 < oper_hidden_admin: HIDDEN_ADMIN '=' TBOOL ';'
1356 < {
1357 <  if (ypass == 2)
1358 <  {
1359 <    if (yylval.number)
1360 <      yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1361 <    else
1362 <      yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1363 <  }
1364 < };
1365 <
1366 < oper_hidden_oper: HIDDEN_OPER '=' TBOOL ';'
1367 < {
1368 <  if (ypass == 2)
1369 <  {
1370 <    if (yylval.number)
1371 <      yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1372 <    else
1373 <      yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1374 <  }
1375 < };
1376 <
1377 < oper_operwall: T_OPERWALL '=' TBOOL ';'
1378 < {
1379 <  if (ypass == 2)
1380 <  {
1381 <    if (yylval.number)
1382 <      yy_aconf->port |= OPER_FLAG_OPERWALL;
1383 <    else
1384 <      yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1385 <  }
1198 >  if (conf_parser_ctx.pass == 2)
1199 >    yy_aconf->modes |= UMODE_LOCOPS;
1200   };
1201  
1202   oper_flags: IRCD_FLAGS
1203   {
1204 +  if (conf_parser_ctx.pass == 2)
1205 +    yy_aconf->port = 0;
1206   } '='  oper_flags_items ';';
1207  
1208   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1209 < oper_flags_item: NOT oper_flags_item_atom { not_atom = 1; }
1394 <                | oper_flags_item_atom { not_atom = 0; };
1395 <
1396 < oper_flags_item_atom: GLOBAL_KILL
1209 > oper_flags_item: GLOBAL_KILL
1210   {
1211 <  if (ypass == 2)
1212 <  {
1400 <    if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1401 <    else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1402 <  }
1211 >  if (conf_parser_ctx.pass == 2)
1212 >    yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1213   } | REMOTE
1214   {
1215 <  if (ypass == 2)
1216 <  {
1407 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE;
1408 <    else yy_aconf->port |= OPER_FLAG_REMOTE;
1409 <  }
1215 >  if (conf_parser_ctx.pass == 2)
1216 >    yy_aconf->port |= OPER_FLAG_REMOTE;
1217   } | KLINE
1218   {
1219 <  if (ypass == 2)
1220 <  {
1414 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_K;
1415 <    else yy_aconf->port |= OPER_FLAG_K;
1416 <  }
1219 >  if (conf_parser_ctx.pass == 2)
1220 >    yy_aconf->port |= OPER_FLAG_K;
1221   } | UNKLINE
1222   {
1223 <  if (ypass == 2)
1224 <  {
1225 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1226 <    else yy_aconf->port |= OPER_FLAG_UNKLINE;
1227 <  }
1223 >  if (conf_parser_ctx.pass == 2)
1224 >    yy_aconf->port |= OPER_FLAG_UNKLINE;
1225 > } | T_DLINE
1226 > {
1227 >  if (conf_parser_ctx.pass == 2)
1228 >    yy_aconf->port |= OPER_FLAG_DLINE;
1229 > } | T_UNDLINE
1230 > {
1231 >  if (conf_parser_ctx.pass == 2)
1232 >    yy_aconf->port |= OPER_FLAG_UNDLINE;
1233   } | XLINE
1234   {
1235 <  if (ypass == 2)
1236 <  {
1428 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_X;
1429 <    else yy_aconf->port |= OPER_FLAG_X;
1430 <  }
1235 >  if (conf_parser_ctx.pass == 2)
1236 >    yy_aconf->port |= OPER_FLAG_X;
1237   } | GLINE
1238   {
1239 <  if (ypass == 2)
1240 <  {
1435 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE;
1436 <    else yy_aconf->port |= OPER_FLAG_GLINE;
1437 <  }
1239 >  if (conf_parser_ctx.pass == 2)
1240 >    yy_aconf->port |= OPER_FLAG_GLINE;
1241   } | DIE
1242   {
1243 <  if (ypass == 2)
1244 <  {
1245 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE;
1246 <    else yy_aconf->port |= OPER_FLAG_DIE;
1247 <  }
1243 >  if (conf_parser_ctx.pass == 2)
1244 >    yy_aconf->port |= OPER_FLAG_DIE;
1245 > } | T_RESTART
1246 > {
1247 >  if (conf_parser_ctx.pass == 2)
1248 >    yy_aconf->port |= OPER_FLAG_RESTART;
1249   } | REHASH
1250   {
1251 <  if (ypass == 2)
1252 <  {
1449 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH;
1450 <    else yy_aconf->port |= OPER_FLAG_REHASH;
1451 <  }
1251 >  if (conf_parser_ctx.pass == 2)
1252 >    yy_aconf->port |= OPER_FLAG_REHASH;
1253   } | ADMIN
1254   {
1255 <  if (ypass == 2)
1256 <  {
1456 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN;
1457 <    else yy_aconf->port |= OPER_FLAG_ADMIN;
1458 <  }
1459 < } | HIDDEN_ADMIN
1460 < {
1461 <  if (ypass == 2)
1462 <  {
1463 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1464 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1465 <  }
1255 >  if (conf_parser_ctx.pass == 2)
1256 >    yy_aconf->port |= OPER_FLAG_ADMIN;
1257   } | NICK_CHANGES
1258   {
1259 <  if (ypass == 2)
1260 <  {
1470 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_N;
1471 <    else yy_aconf->port |= OPER_FLAG_N;
1472 <  }
1259 >  if (conf_parser_ctx.pass == 2)
1260 >    yy_aconf->port |= OPER_FLAG_N;
1261   } | T_OPERWALL
1262   {
1263 <  if (ypass == 2)
1264 <  {
1265 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1478 <    else yy_aconf->port |= OPER_FLAG_OPERWALL;
1479 <  }
1480 < } | OPER_SPY_T
1263 >  if (conf_parser_ctx.pass == 2)
1264 >    yy_aconf->port |= OPER_FLAG_OPERWALL;
1265 > } | T_GLOBOPS
1266   {
1267 <  if (ypass == 2)
1268 <  {
1269 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY;
1485 <    else yy_aconf->port |= OPER_FLAG_OPER_SPY;
1486 <  }
1487 < } | HIDDEN_OPER
1267 >  if (conf_parser_ctx.pass == 2)
1268 >    yy_aconf->port |= OPER_FLAG_GLOBOPS;
1269 > } | OPER_SPY_T
1270   {
1271 <  if (ypass == 2)
1272 <  {
1491 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1492 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1493 <  }
1271 >  if (conf_parser_ctx.pass == 2)
1272 >    yy_aconf->port |= OPER_FLAG_OPER_SPY;
1273   } | REMOTEBAN
1274   {
1275 <  if (ypass == 2)
1276 <  {
1277 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1278 <    else yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1279 <  }
1280 < } | ENCRYPTED
1275 >  if (conf_parser_ctx.pass == 2)
1276 >    yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1277 > } | T_SET
1278 > {
1279 >  if (conf_parser_ctx.pass == 2)
1280 >    yy_aconf->port |= OPER_FLAG_SET;
1281 > } | MODULE
1282   {
1283 <  if (ypass == 2)
1284 <  {
1505 <    if (not_atom) ClearConfEncrypted(yy_aconf);
1506 <    else SetConfEncrypted(yy_aconf);
1507 <  }
1283 >  if (conf_parser_ctx.pass == 2)
1284 >    yy_aconf->port |= OPER_FLAG_MODULE;
1285   };
1286  
1287  
# Line 1513 | Line 1290 | oper_flags_item_atom: GLOBAL_KILL
1290   ***************************************************************************/
1291   class_entry: CLASS
1292   {
1293 <  if (ypass == 1)
1293 >  if (conf_parser_ctx.pass == 1)
1294    {
1295      yy_conf = make_conf_item(CLASS_TYPE);
1296 <    yy_class = (struct ClassItem *)map_to_conf(yy_conf);
1296 >    yy_class = map_to_conf(yy_conf);
1297    }
1298 < } class_name_b '{' class_items '}' ';'
1298 > } '{' class_items '}' ';'
1299   {
1300 <  if (ypass == 1)
1300 >  if (conf_parser_ctx.pass == 1)
1301    {
1302 <    struct ConfItem *cconf;
1302 >    struct ConfItem *cconf = NULL;
1303      struct ClassItem *class = NULL;
1304  
1305      if (yy_class_name == NULL)
1529    {
1306        delete_conf_item(yy_conf);
1531    }
1307      else
1308      {
1309 <      cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1309 >      cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1310  
1311        if (cconf != NULL)                /* The class existed already */
1312        {
1313 +        int user_count = 0;
1314 +
1315          rebuild_cidr_class(cconf, yy_class);
1316 <        class = (struct ClassItem *) map_to_conf(cconf);
1317 <        *class = *yy_class;
1316 >
1317 >        class = map_to_conf(cconf);
1318 >
1319 >        user_count = class->curr_user_count;
1320 >        memcpy(class, yy_class, sizeof(*class));
1321 >        class->curr_user_count = user_count;
1322 >        class->active = 1;
1323 >
1324          delete_conf_item(yy_conf);
1325  
1326          MyFree(cconf->name);            /* Allows case change of class name */
# Line 1547 | Line 1330 | class_entry: CLASS
1330        {
1331          MyFree(yy_conf->name);          /* just in case it was allocated */
1332          yy_conf->name = yy_class_name;
1333 +        yy_class->active = 1;
1334        }
1335      }
1336 +
1337      yy_class_name = NULL;
1338    }
1339   };
1340  
1556 class_name_b: | class_name_t;
1557
1341   class_items:    class_items class_item | class_item;
1342   class_item:     class_name |
1343                  class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
# Line 1572 | Line 1355 | class_item:     class_name |
1355  
1356   class_name: NAME '=' QSTRING ';'
1357   {
1358 <  if (ypass == 1)
1576 <  {
1577 <    MyFree(yy_class_name);
1578 <    DupString(yy_class_name, yylval.string);
1579 <  }
1580 < };
1581 <
1582 < class_name_t: QSTRING
1583 < {
1584 <  if (ypass == 1)
1358 >  if (conf_parser_ctx.pass == 1)
1359    {
1360      MyFree(yy_class_name);
1361      DupString(yy_class_name, yylval.string);
# Line 1590 | Line 1364 | class_name_t: QSTRING
1364  
1365   class_ping_time: PING_TIME '=' timespec ';'
1366   {
1367 <  if (ypass == 1)
1368 <    PingFreq(yy_class) = $3;
1367 >  if (conf_parser_ctx.pass == 1)
1368 >    yy_class->ping_freq = $3;
1369   };
1370  
1371   class_ping_warning: PING_WARNING '=' timespec ';'
1372   {
1373 <  if (ypass == 1)
1374 <    PingWarning(yy_class) = $3;
1373 >  if (conf_parser_ctx.pass == 1)
1374 >    yy_class->ping_warning = $3;
1375   };
1376  
1377   class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1378   {
1379 <  if (ypass == 1)
1380 <    MaxPerIp(yy_class) = $3;
1379 >  if (conf_parser_ctx.pass == 1)
1380 >    yy_class->max_perip = $3;
1381   };
1382  
1383   class_connectfreq: CONNECTFREQ '=' timespec ';'
1384   {
1385 <  if (ypass == 1)
1386 <    ConFreq(yy_class) = $3;
1385 >  if (conf_parser_ctx.pass == 1)
1386 >    yy_class->con_freq = $3;
1387   };
1388  
1389   class_max_number: MAX_NUMBER '=' NUMBER ';'
1390   {
1391 <  if (ypass == 1)
1392 <    MaxTotal(yy_class) = $3;
1391 >  if (conf_parser_ctx.pass == 1)
1392 >    yy_class->max_total = $3;
1393   };
1394  
1395   class_max_global: MAX_GLOBAL '=' NUMBER ';'
1396   {
1397 <  if (ypass == 1)
1398 <    MaxGlobal(yy_class) = $3;
1397 >  if (conf_parser_ctx.pass == 1)
1398 >    yy_class->max_global = $3;
1399   };
1400  
1401   class_max_local: MAX_LOCAL '=' NUMBER ';'
1402   {
1403 <  if (ypass == 1)
1404 <    MaxLocal(yy_class) = $3;
1403 >  if (conf_parser_ctx.pass == 1)
1404 >    yy_class->max_local = $3;
1405   };
1406  
1407   class_max_ident: MAX_IDENT '=' NUMBER ';'
1408   {
1409 <  if (ypass == 1)
1410 <    MaxIdent(yy_class) = $3;
1409 >  if (conf_parser_ctx.pass == 1)
1410 >    yy_class->max_ident = $3;
1411   };
1412  
1413   class_sendq: SENDQ '=' sizespec ';'
1414   {
1415 <  if (ypass == 1)
1416 <    MaxSendq(yy_class) = $3;
1415 >  if (conf_parser_ctx.pass == 1)
1416 >    yy_class->max_sendq = $3;
1417   };
1418  
1419   class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1420   {
1421 <  if (ypass == 1)
1422 <    CidrBitlenIPV4(yy_class) = $3;
1421 >  if (conf_parser_ctx.pass == 1)
1422 >    yy_class->cidr_bitlen_ipv4 = $3 > 32 ? 32 : $3;
1423   };
1424  
1425   class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1426   {
1427 <  if (ypass == 1)
1428 <    CidrBitlenIPV6(yy_class) = $3;
1427 >  if (conf_parser_ctx.pass == 1)
1428 >    yy_class->cidr_bitlen_ipv6 = $3 > 128 ? 128 : $3;
1429   };
1430  
1431   class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1432   {
1433 <  if (ypass == 1)
1434 <    NumberPerCidr(yy_class) = $3;
1433 >  if (conf_parser_ctx.pass == 1)
1434 >    yy_class->number_per_cidr = $3;
1435   };
1436  
1437   /***************************************************************************
# Line 1665 | Line 1439 | class_number_per_cidr: NUMBER_PER_CIDR '
1439   ***************************************************************************/
1440   listen_entry: LISTEN
1441   {
1442 <  if (ypass == 2)
1442 >  if (conf_parser_ctx.pass == 2)
1443    {
1444      listener_address = NULL;
1445      listener_flags = 0;
1446    }
1447   } '{' listen_items '}' ';'
1448   {
1449 <  if (ypass == 2)
1449 >  if (conf_parser_ctx.pass == 2)
1450    {
1451      MyFree(listener_address);
1452      listener_address = NULL;
# Line 1681 | Line 1455 | listen_entry: LISTEN
1455  
1456   listen_flags: IRCD_FLAGS
1457   {
1458 +  listener_flags = 0;
1459   } '='  listen_flags_items ';';
1460  
1461   listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1462   listen_flags_item: T_SSL
1463   {
1464 <  if (ypass == 2)
1464 >  if (conf_parser_ctx.pass == 2)
1465      listener_flags |= LISTENER_SSL;
1466   } | HIDDEN
1467   {
1468 <  if (ypass == 2)
1468 >  if (conf_parser_ctx.pass == 2)
1469      listener_flags |= LISTENER_HIDDEN;
1470 + } | T_SERVER
1471 + {
1472 +  if (conf_parser_ctx.pass == 2)
1473 +    listener_flags |= LISTENER_SERVER;
1474   };
1475  
1476 +
1477 +
1478   listen_items:   listen_items listen_item | listen_item;
1479 < listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';' ;
1479 > listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';';
1480  
1481 < listen_port: PORT '=' port_items ';' ;
1481 > listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1482  
1483   port_items: port_items ',' port_item | port_item;
1484  
1485   port_item: NUMBER
1486   {
1487 <  if (ypass == 2)
1487 >  if (conf_parser_ctx.pass == 2)
1488    {
1489      if ((listener_flags & LISTENER_SSL))
1490   #ifdef HAVE_LIBCRYPTO
1491 <      if (!ServerInfo.ctx)
1491 >      if (!ServerInfo.server_ctx)
1492   #endif
1493        {
1494          yyerror("SSL not available - port closed");
1495          break;
1496        }
1497      add_listener($1, listener_address, listener_flags);
1717    listener_flags = 0;
1498    }
1499   } | NUMBER TWODOTS NUMBER
1500   {
1501 <  if (ypass == 2)
1501 >  if (conf_parser_ctx.pass == 2)
1502    {
1503      int i;
1504  
1505      if ((listener_flags & LISTENER_SSL))
1506   #ifdef HAVE_LIBCRYPTO
1507 <      if (!ServerInfo.ctx)
1507 >      if (!ServerInfo.server_ctx)
1508   #endif
1509        {
1510          yyerror("SSL not available - port closed");
# Line 1733 | Line 1513 | port_item: NUMBER
1513  
1514      for (i = $1; i <= $3; ++i)
1515        add_listener(i, listener_address, listener_flags);
1736
1737    listener_flags = 0;
1516    }
1517   };
1518  
1519   listen_address: IP '=' QSTRING ';'
1520   {
1521 <  if (ypass == 2)
1521 >  if (conf_parser_ctx.pass == 2)
1522    {
1523      MyFree(listener_address);
1524      DupString(listener_address, yylval.string);
# Line 1749 | Line 1527 | listen_address: IP '=' QSTRING ';'
1527  
1528   listen_host: HOST '=' QSTRING ';'
1529   {
1530 <  if (ypass == 2)
1530 >  if (conf_parser_ctx.pass == 2)
1531    {
1532      MyFree(listener_address);
1533      DupString(listener_address, yylval.string);
# Line 1761 | Line 1539 | listen_host: HOST '=' QSTRING ';'
1539   ***************************************************************************/
1540   auth_entry: IRCD_AUTH
1541   {
1542 <  if (ypass == 2)
1542 >  if (conf_parser_ctx.pass == 2)
1543    {
1544      yy_conf = make_conf_item(CLIENT_TYPE);
1545      yy_aconf = map_to_conf(yy_conf);
# Line 1773 | Line 1551 | auth_entry: IRCD_AUTH
1551    }
1552   } '{' auth_items '}' ';'
1553   {
1554 <  if (ypass == 2)
1554 >  if (conf_parser_ctx.pass == 2)
1555    {
1556      struct CollectItem *yy_tmp = NULL;
1557      dlink_node *ptr = NULL, *next_ptr = NULL;
# Line 1830 | Line 1608 | auth_entry: IRCD_AUTH
1608  
1609   auth_items:     auth_items auth_item | auth_item;
1610   auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
1611 <                auth_kline_exempt | auth_need_ident |
1612 <                auth_exceed_limit | auth_no_tilde | auth_gline_exempt |
1835 <                auth_spoof | auth_spoof_notice |
1836 <                auth_redir_serv | auth_redir_port | auth_can_flood |
1837 <                auth_need_password | auth_encrypted | error ';' ;
1611 >                auth_spoof | auth_redir_serv | auth_redir_port |
1612 >                auth_encrypted | error ';' ;
1613  
1614   auth_user: USER '=' QSTRING ';'
1615   {
1616 <  if (ypass == 2)
1616 >  if (conf_parser_ctx.pass == 2)
1617    {
1618 <    struct CollectItem *yy_tmp;
1618 >    struct CollectItem *yy_tmp = NULL;
1619 >    struct split_nuh_item nuh;
1620 >
1621 >    nuh.nuhmask  = yylval.string;
1622 >    nuh.nickptr  = NULL;
1623 >    nuh.userptr  = userbuf;
1624 >    nuh.hostptr  = hostbuf;
1625 >
1626 >    nuh.nicksize = 0;
1627 >    nuh.usersize = sizeof(userbuf);
1628 >    nuh.hostsize = sizeof(hostbuf);
1629 >
1630 >    split_nuh(&nuh);
1631  
1632      if (yy_aconf->user == NULL)
1633 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1633 >    {
1634 >      DupString(yy_aconf->user, userbuf);
1635 >      DupString(yy_aconf->host, hostbuf);
1636 >    }
1637      else
1638      {
1639        yy_tmp = MyMalloc(sizeof(struct CollectItem));
1640 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1640 >
1641 >      DupString(yy_tmp->user, userbuf);
1642 >      DupString(yy_tmp->host, hostbuf);
1643 >
1644        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1645      }
1646    }
1647   };
1648  
1856 /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1857
1649   auth_passwd: PASSWORD '=' QSTRING ';'
1650   {
1651 <  if (ypass == 2)
1651 >  if (conf_parser_ctx.pass == 2)
1652    {
1653      /* be paranoid */
1654      if (yy_aconf->passwd != NULL)
# Line 1868 | Line 1659 | auth_passwd: PASSWORD '=' QSTRING ';'
1659    }
1660   };
1661  
1871 auth_spoof_notice: SPOOF_NOTICE '=' TBOOL ';'
1872 {
1873  if (ypass == 2)
1874  {
1875    if (yylval.number)
1876      yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1877    else
1878      yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1879  }
1880 };
1881
1662   auth_class: CLASS '=' QSTRING ';'
1663   {
1664 <  if (ypass == 2)
1664 >  if (conf_parser_ctx.pass == 2)
1665    {
1666      MyFree(class_name);
1667      DupString(class_name, yylval.string);
# Line 1890 | Line 1670 | auth_class: CLASS '=' QSTRING ';'
1670  
1671   auth_encrypted: ENCRYPTED '=' TBOOL ';'
1672   {
1673 <  if (ypass == 2)
1673 >  if (conf_parser_ctx.pass == 2)
1674    {
1675      if (yylval.number)
1676        SetConfEncrypted(yy_aconf);
# Line 1904 | Line 1684 | auth_flags: IRCD_FLAGS
1684   } '='  auth_flags_items ';';
1685  
1686   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1687 < auth_flags_item: NOT auth_flags_item_atom { not_atom = 1; }
1908 <                | auth_flags_item_atom { not_atom = 0; };
1909 <
1910 < auth_flags_item_atom: SPOOF_NOTICE
1687 > auth_flags_item: SPOOF_NOTICE
1688   {
1689 <  if (ypass == 2)
1690 <  {
1914 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1915 <    else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1916 <  }
1917 <
1689 >  if (conf_parser_ctx.pass == 2)
1690 >    yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1691   } | EXCEED_LIMIT
1692   {
1693 <  if (ypass == 2)
1694 <  {
1922 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1923 <    else yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1924 <  }
1693 >  if (conf_parser_ctx.pass == 2)
1694 >    yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1695   } | KLINE_EXEMPT
1696   {
1697 <  if (ypass == 2)
1698 <  {
1929 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1930 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1931 <  }
1697 >  if (conf_parser_ctx.pass == 2)
1698 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1699   } | NEED_IDENT
1700   {
1701 <  if (ypass == 2)
1702 <  {
1936 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1937 <    else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1938 <  }
1701 >  if (conf_parser_ctx.pass == 2)
1702 >    yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1703   } | CAN_FLOOD
1704   {
1705 <  if (ypass == 2)
1706 <  {
1943 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
1944 <    else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1945 <  }
1946 < } | CAN_IDLE
1947 < {
1948 <  if (ypass == 2)
1949 <  {
1950 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED;
1951 <    else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED;
1952 <  }
1705 >  if (conf_parser_ctx.pass == 2)
1706 >    yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1707   } | NO_TILDE
1708   {
1709 <  if (ypass == 2)
1710 <  {
1957 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
1958 <    else yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1959 <  }
1709 >  if (conf_parser_ctx.pass == 2)
1710 >    yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1711   } | GLINE_EXEMPT
1712   {
1713 <  if (ypass == 2)
1714 <  {
1964 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
1965 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1966 <  }
1713 >  if (conf_parser_ctx.pass == 2)
1714 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1715   } | RESV_EXEMPT
1716   {
1717 <  if (ypass == 2)
1718 <  {
1971 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV;
1972 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1973 <  }
1717 >  if (conf_parser_ctx.pass == 2)
1718 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1719   } | NEED_PASSWORD
1720   {
1721 <  if (ypass == 2)
1722 <  {
1978 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
1979 <    else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1980 <  }
1981 < };
1982 <
1983 < auth_kline_exempt: KLINE_EXEMPT '=' TBOOL ';'
1984 < {
1985 <  if (ypass == 2)
1986 <  {
1987 <    if (yylval.number)
1988 <      yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1989 <    else
1990 <      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1991 <  }
1992 < };
1993 <
1994 < auth_need_ident: NEED_IDENT '=' TBOOL ';'
1995 < {
1996 <  if (ypass == 2)
1997 <  {
1998 <    if (yylval.number)
1999 <      yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
2000 <    else
2001 <      yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
2002 <  }
2003 < };
2004 <
2005 < auth_exceed_limit: EXCEED_LIMIT '=' TBOOL ';'
2006 < {
2007 <  if (ypass == 2)
2008 <  {
2009 <    if (yylval.number)
2010 <      yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
2011 <    else
2012 <      yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
2013 <  }
2014 < };
2015 <
2016 < auth_can_flood: CAN_FLOOD '=' TBOOL ';'
2017 < {
2018 <  if (ypass == 2)
2019 <  {
2020 <    if (yylval.number)
2021 <      yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
2022 <    else
2023 <      yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
2024 <  }
2025 < };
2026 <
2027 < auth_no_tilde: NO_TILDE '=' TBOOL ';'
2028 < {
2029 <  if (ypass == 2)
2030 <  {
2031 <    if (yylval.number)
2032 <      yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
2033 <    else
2034 <      yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
2035 <  }
2036 < };
2037 <
2038 < auth_gline_exempt: GLINE_EXEMPT '=' TBOOL ';'
2039 < {
2040 <  if (ypass == 2)
2041 <  {
2042 <    if (yylval.number)
2043 <      yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
2044 <    else
2045 <      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
2046 <  }
1721 >  if (conf_parser_ctx.pass == 2)
1722 >    yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1723   };
1724  
1725   /* XXX - need check for illegal hostnames here */
1726   auth_spoof: SPOOF '=' QSTRING ';'
1727   {
1728 <  if (ypass == 2)
1728 >  if (conf_parser_ctx.pass == 2)
1729    {
1730      MyFree(yy_conf->name);
1731  
# Line 2060 | Line 1736 | auth_spoof: SPOOF '=' QSTRING ';'
1736      }
1737      else
1738      {
1739 <      ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1739 >      ilog(LOG_TYPE_IRCD, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1740        yy_conf->name = NULL;
1741      }
1742    }
# Line 2068 | Line 1744 | auth_spoof: SPOOF '=' QSTRING ';'
1744  
1745   auth_redir_serv: REDIRSERV '=' QSTRING ';'
1746   {
1747 <  if (ypass == 2)
1747 >  if (conf_parser_ctx.pass == 2)
1748    {
1749      yy_aconf->flags |= CONF_FLAGS_REDIR;
1750      MyFree(yy_conf->name);
# Line 2078 | Line 1754 | auth_redir_serv: REDIRSERV '=' QSTRING '
1754  
1755   auth_redir_port: REDIRPORT '=' NUMBER ';'
1756   {
1757 <  if (ypass == 2)
1757 >  if (conf_parser_ctx.pass == 2)
1758    {
1759      yy_aconf->flags |= CONF_FLAGS_REDIR;
1760      yy_aconf->port = $3;
1761    }
1762   };
1763  
2088 auth_need_password: NEED_PASSWORD '=' TBOOL ';'
2089 {
2090  if (ypass == 2)
2091  {
2092    if (yylval.number)
2093      yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
2094    else
2095      yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2096  }
2097 };
2098
1764  
1765   /***************************************************************************
1766   *  section resv
1767   ***************************************************************************/
1768   resv_entry: RESV
1769   {
1770 <  if (ypass == 2)
1770 >  if (conf_parser_ctx.pass == 2)
1771    {
1772      MyFree(resv_reason);
1773      resv_reason = NULL;
1774    }
1775   } '{' resv_items '}' ';'
1776   {
1777 <  if (ypass == 2)
1777 >  if (conf_parser_ctx.pass == 2)
1778    {
1779      MyFree(resv_reason);
1780      resv_reason = NULL;
# Line 2121 | Line 1786 | resv_item:     resv_creason | resv_channel |
1786  
1787   resv_creason: REASON '=' QSTRING ';'
1788   {
1789 <  if (ypass == 2)
1789 >  if (conf_parser_ctx.pass == 2)
1790    {
1791      MyFree(resv_reason);
1792      DupString(resv_reason, yylval.string);
# Line 2130 | Line 1795 | resv_creason: REASON '=' QSTRING ';'
1795  
1796   resv_channel: CHANNEL '=' QSTRING ';'
1797   {
1798 <  if (ypass == 2)
1798 >  if (conf_parser_ctx.pass == 2)
1799    {
1800      if (IsChanPrefix(*yylval.string))
1801      {
# Line 2145 | Line 1810 | resv_channel: CHANNEL '=' QSTRING ';'
1810  
1811   resv_nick: NICK '=' QSTRING ';'
1812   {
1813 <  if (ypass == 2)
1813 >  if (conf_parser_ctx.pass == 2)
1814    {
1815      char def_reason[] = "No reason";
1816  
# Line 2154 | Line 1819 | resv_nick: NICK '=' QSTRING ';'
1819   };
1820  
1821   /***************************************************************************
1822 + *  section service
1823 + ***************************************************************************/
1824 + service_entry: T_SERVICE '{' service_items '}' ';';
1825 +
1826 + service_items:     service_items service_item | service_item;
1827 + service_item:      service_name | error;
1828 +
1829 + service_name: NAME '=' QSTRING ';'
1830 + {
1831 +  if (conf_parser_ctx.pass == 2)
1832 +  {
1833 +    if (valid_servname(yylval.string))
1834 +    {
1835 +      yy_conf = make_conf_item(SERVICE_TYPE);
1836 +      DupString(yy_conf->name, yylval.string);
1837 +    }
1838 +  }
1839 + };
1840 +
1841 + /***************************************************************************
1842   *  section shared, for sharing remote klines etc.
1843   ***************************************************************************/
1844   shared_entry: T_SHARED
1845   {
1846 <  if (ypass == 2)
1846 >  if (conf_parser_ctx.pass == 2)
1847    {
1848      yy_conf = make_conf_item(ULINE_TYPE);
1849      yy_match_item = map_to_conf(yy_conf);
# Line 2166 | Line 1851 | shared_entry: T_SHARED
1851    }
1852   } '{' shared_items '}' ';'
1853   {
1854 <  if (ypass == 2)
1854 >  if (conf_parser_ctx.pass == 2)
1855    {
1856      yy_conf = NULL;
1857    }
# Line 2177 | Line 1862 | shared_item:  shared_name | shared_user
1862  
1863   shared_name: NAME '=' QSTRING ';'
1864   {
1865 <  if (ypass == 2)
1865 >  if (conf_parser_ctx.pass == 2)
1866    {
1867      MyFree(yy_conf->name);
1868      DupString(yy_conf->name, yylval.string);
# Line 2186 | Line 1871 | shared_name: NAME '=' QSTRING ';'
1871  
1872   shared_user: USER '=' QSTRING ';'
1873   {
1874 <  if (ypass == 2)
1874 >  if (conf_parser_ctx.pass == 2)
1875    {
1876 <    split_nuh(yylval.string, NULL, &yy_match_item->user, &yy_match_item->host);
1876 >    struct split_nuh_item nuh;
1877 >
1878 >    nuh.nuhmask  = yylval.string;
1879 >    nuh.nickptr  = NULL;
1880 >    nuh.userptr  = userbuf;
1881 >    nuh.hostptr  = hostbuf;
1882 >
1883 >    nuh.nicksize = 0;
1884 >    nuh.usersize = sizeof(userbuf);
1885 >    nuh.hostsize = sizeof(hostbuf);
1886 >
1887 >    split_nuh(&nuh);
1888 >
1889 >    DupString(yy_match_item->user, userbuf);
1890 >    DupString(yy_match_item->host, hostbuf);
1891    }
1892   };
1893  
1894   shared_type: TYPE
1895   {
1896 <  if (ypass == 2)
1896 >  if (conf_parser_ctx.pass == 2)
1897      yy_match_item->action = 0;
1898   } '=' shared_types ';' ;
1899  
1900   shared_types: shared_types ',' shared_type_item | shared_type_item;
1901   shared_type_item: KLINE
1902   {
1903 <  if (ypass == 2)
1903 >  if (conf_parser_ctx.pass == 2)
1904      yy_match_item->action |= SHARED_KLINE;
2206 } | TKLINE
2207 {
2208  if (ypass == 2)
2209    yy_match_item->action |= SHARED_TKLINE;
1905   } | UNKLINE
1906   {
1907 <  if (ypass == 2)
1907 >  if (conf_parser_ctx.pass == 2)
1908      yy_match_item->action |= SHARED_UNKLINE;
1909 + } | T_DLINE
1910 + {
1911 +  if (conf_parser_ctx.pass == 2)
1912 +    yy_match_item->action |= SHARED_DLINE;
1913 + } | T_UNDLINE
1914 + {
1915 +  if (conf_parser_ctx.pass == 2)
1916 +    yy_match_item->action |= SHARED_UNDLINE;
1917   } | XLINE
1918   {
1919 <  if (ypass == 2)
1919 >  if (conf_parser_ctx.pass == 2)
1920      yy_match_item->action |= SHARED_XLINE;
2218 } | TXLINE
2219 {
2220  if (ypass == 2)
2221    yy_match_item->action |= SHARED_TXLINE;
1921   } | T_UNXLINE
1922   {
1923 <  if (ypass == 2)
1923 >  if (conf_parser_ctx.pass == 2)
1924      yy_match_item->action |= SHARED_UNXLINE;
1925   } | RESV
1926   {
1927 <  if (ypass == 2)
1927 >  if (conf_parser_ctx.pass == 2)
1928      yy_match_item->action |= SHARED_RESV;
2230 } | TRESV
2231 {
2232  if (ypass == 2)
2233    yy_match_item->action |= SHARED_TRESV;
1929   } | T_UNRESV
1930   {
1931 <  if (ypass == 2)
1931 >  if (conf_parser_ctx.pass == 2)
1932      yy_match_item->action |= SHARED_UNRESV;
1933   } | T_LOCOPS
1934   {
1935 <  if (ypass == 2)
1935 >  if (conf_parser_ctx.pass == 2)
1936      yy_match_item->action |= SHARED_LOCOPS;
1937   } | T_ALL
1938   {
1939 <  if (ypass == 2)
1939 >  if (conf_parser_ctx.pass == 2)
1940      yy_match_item->action = SHARED_ALL;
1941   };
1942  
# Line 2250 | Line 1945 | shared_type_item: KLINE
1945   ***************************************************************************/
1946   cluster_entry: T_CLUSTER
1947   {
1948 <  if (ypass == 2)
1948 >  if (conf_parser_ctx.pass == 2)
1949    {
1950      yy_conf = make_conf_item(CLUSTER_TYPE);
1951      yy_conf->flags = SHARED_ALL;
1952    }
1953   } '{' cluster_items '}' ';'
1954   {
1955 <  if (ypass == 2)
1955 >  if (conf_parser_ctx.pass == 2)
1956    {
1957      if (yy_conf->name == NULL)
1958        DupString(yy_conf->name, "*");
# Line 2270 | Line 1965 | cluster_item:  cluster_name | cluster_typ
1965  
1966   cluster_name: NAME '=' QSTRING ';'
1967   {
1968 <  if (ypass == 2)
1968 >  if (conf_parser_ctx.pass == 2)
1969      DupString(yy_conf->name, yylval.string);
1970   };
1971  
1972   cluster_type: TYPE
1973   {
1974 <  if (ypass == 2)
1974 >  if (conf_parser_ctx.pass == 2)
1975      yy_conf->flags = 0;
1976   } '=' cluster_types ';' ;
1977  
1978   cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
1979   cluster_type_item: KLINE
1980   {
1981 <  if (ypass == 2)
1981 >  if (conf_parser_ctx.pass == 2)
1982      yy_conf->flags |= SHARED_KLINE;
2288 } | TKLINE
2289 {
2290  if (ypass == 2)
2291    yy_conf->flags |= SHARED_TKLINE;
1983   } | UNKLINE
1984   {
1985 <  if (ypass == 2)
1985 >  if (conf_parser_ctx.pass == 2)
1986      yy_conf->flags |= SHARED_UNKLINE;
1987 + } | T_DLINE
1988 + {
1989 +  if (conf_parser_ctx.pass == 2)
1990 +    yy_conf->flags |= SHARED_DLINE;
1991 + } | T_UNDLINE
1992 + {
1993 +  if (conf_parser_ctx.pass == 2)
1994 +    yy_conf->flags |= SHARED_UNDLINE;
1995   } | XLINE
1996   {
1997 <  if (ypass == 2)
1997 >  if (conf_parser_ctx.pass == 2)
1998      yy_conf->flags |= SHARED_XLINE;
2300 } | TXLINE
2301 {
2302  if (ypass == 2)
2303    yy_conf->flags |= SHARED_TXLINE;
1999   } | T_UNXLINE
2000   {
2001 <  if (ypass == 2)
2001 >  if (conf_parser_ctx.pass == 2)
2002      yy_conf->flags |= SHARED_UNXLINE;
2003   } | RESV
2004   {
2005 <  if (ypass == 2)
2005 >  if (conf_parser_ctx.pass == 2)
2006      yy_conf->flags |= SHARED_RESV;
2312 } | TRESV
2313 {
2314  if (ypass == 2)
2315    yy_conf->flags |= SHARED_TRESV;
2007   } | T_UNRESV
2008   {
2009 <  if (ypass == 2)
2009 >  if (conf_parser_ctx.pass == 2)
2010      yy_conf->flags |= SHARED_UNRESV;
2011   } | T_LOCOPS
2012   {
2013 <  if (ypass == 2)
2013 >  if (conf_parser_ctx.pass == 2)
2014      yy_conf->flags |= SHARED_LOCOPS;
2015   } | T_ALL
2016   {
2017 <  if (ypass == 2)
2017 >  if (conf_parser_ctx.pass == 2)
2018      yy_conf->flags = SHARED_ALL;
2019   };
2020  
# Line 2332 | Line 2023 | cluster_type_item: KLINE
2023   ***************************************************************************/
2024   connect_entry: CONNECT  
2025   {
2026 <  if (ypass == 2)
2026 >  if (conf_parser_ctx.pass == 2)
2027    {
2028      yy_conf = make_conf_item(SERVER_TYPE);
2029 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
2030 <    yy_aconf->passwd = NULL;
2029 >    yy_aconf = map_to_conf(yy_conf);
2030 >
2031      /* defaults */
2032      yy_aconf->port = PORTNUM;
2342
2343    if (ConfigFileEntry.burst_away)
2344      yy_aconf->flags = CONF_FLAGS_BURST_AWAY;
2033    }
2034    else
2035    {
2036      MyFree(class_name);
2037      class_name = NULL;
2038    }
2039 < } connect_name_b '{' connect_items '}' ';'
2039 > } '{' connect_items '}' ';'
2040   {
2041 <  if (ypass == 2)
2041 >  if (conf_parser_ctx.pass == 2)
2042    {
2043 <    struct CollectItem *yy_hconf=NULL;
2044 <    struct CollectItem *yy_lconf=NULL;
2045 <    dlink_node *ptr;
2046 <    dlink_node *next_ptr;
2047 < #ifdef HAVE_LIBCRYPTO
2048 <    if (yy_aconf->host &&
2049 <        ((yy_aconf->passwd && yy_aconf->spasswd) ||
2050 <         (yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf))))
2363 < #else /* !HAVE_LIBCRYPTO */
2364 <      if (yy_aconf->host && !IsConfCryptLink(yy_aconf) &&
2365 <          yy_aconf->passwd && yy_aconf->spasswd)
2366 < #endif /* !HAVE_LIBCRYPTO */
2367 <        {
2368 <          if (conf_add_server(yy_conf, scount, class_name) >= 0)
2369 <          {
2370 <            ++scount;
2371 <          }
2372 <          else
2373 <          {
2374 <            delete_conf_item(yy_conf);
2375 <            yy_conf = NULL;
2376 <            yy_aconf = NULL;
2377 <          }
2378 <        }
2379 <        else
2380 <        {
2381 <          /* Even if yy_conf ->name is NULL
2382 <           * should still unhook any hub/leaf confs still pending
2383 <           */
2384 <          unhook_hub_leaf_confs();
2385 <
2386 <          if (yy_conf->name != NULL)
2387 <          {
2388 < #ifndef HAVE_LIBCRYPTO
2389 <            if (IsConfCryptLink(yy_aconf))
2390 <              yyerror("Ignoring connect block -- no OpenSSL support");
2391 < #else
2392 <            if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2393 <              yyerror("Ignoring connect block -- missing key");
2394 < #endif
2395 <            if (yy_aconf->host == NULL)
2396 <              yyerror("Ignoring connect block -- missing host");
2397 <            else if (!IsConfCryptLink(yy_aconf) &&
2398 <                    (!yy_aconf->passwd || !yy_aconf->spasswd))
2399 <              yyerror("Ignoring connect block -- missing password");
2400 <          }
2401 <
2402 <
2403 <          /* XXX
2404 <           * This fixes a try_connections() core (caused by invalid class_ptr
2405 <           * pointers) reported by metalrock. That's an ugly fix, but there
2406 <           * is currently no better way. The entire config subsystem needs an
2407 <           * rewrite ASAP. make_conf_item() shouldn't really add things onto
2408 <           * a doubly linked list immediately without any sanity checks!  -Michael
2409 <           */
2410 <          delete_conf_item(yy_conf);
2411 <
2412 <          yy_aconf = NULL;
2413 <          yy_conf = NULL;
2414 <        }
2415 <
2416 <      /*
2417 <       * yy_conf is still pointing at the server that is having
2418 <       * a connect block built for it. This means, y_aconf->name
2419 <       * points to the actual irc name this server will be known as.
2420 <       * Now this new server has a set or even just one hub_mask (or leaf_mask)
2421 <       * given in the link list at yy_hconf. Fill in the HUB confs
2422 <       * from this link list now.
2423 <       */        
2424 <      DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
2043 >    if (yy_aconf->host && yy_aconf->passwd && yy_aconf->spasswd)
2044 >    {
2045 >      if (conf_add_server(yy_conf, class_name) == -1)
2046 >        delete_conf_item(yy_conf);
2047 >    }
2048 >    else
2049 >    {
2050 >      if (yy_conf->name != NULL)
2051        {
2052 <        struct ConfItem *new_hub_conf;
2053 <        struct MatchItem *match_item;
2054 <
2055 <        yy_hconf = ptr->data;
2430 <
2431 <        /* yy_conf == NULL is a fatal error for this connect block! */
2432 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2433 <        {
2434 <          new_hub_conf = make_conf_item(HUB_TYPE);
2435 <          match_item = (struct MatchItem *)map_to_conf(new_hub_conf);
2436 <          DupString(new_hub_conf->name, yy_conf->name);
2437 <          if (yy_hconf->user != NULL)
2438 <            DupString(match_item->user, yy_hconf->user);
2439 <          else
2440 <            DupString(match_item->user, "*");
2441 <          if (yy_hconf->host != NULL)
2442 <            DupString(match_item->host, yy_hconf->host);
2443 <          else
2444 <            DupString(match_item->host, "*");
2445 <        }
2446 <        dlinkDelete(&yy_hconf->node, &hub_conf_list);
2447 <        free_collect_item(yy_hconf);
2052 >        if (yy_aconf->host == NULL)
2053 >          yyerror("Ignoring connect block -- missing host");
2054 >        else if (!yy_aconf->passwd || !yy_aconf->spasswd)
2055 >          yyerror("Ignoring connect block -- missing password");
2056        }
2057  
2058 <      /* Ditto for the LEAF confs */
2059 <
2060 <      DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
2061 <      {
2062 <        struct ConfItem *new_leaf_conf;
2063 <        struct MatchItem *match_item;
2064 <
2065 <        yy_lconf = ptr->data;
2058 >      /* XXX
2059 >       * This fixes a try_connections() core (caused by invalid class_ptr
2060 >       * pointers) reported by metalrock. That's an ugly fix, but there
2061 >       * is currently no better way. The entire config subsystem needs an
2062 >       * rewrite ASAP. make_conf_item() shouldn't really add things onto
2063 >       * a doubly linked list immediately without any sanity checks!  -Michael
2064 >       */
2065 >      delete_conf_item(yy_conf);
2066 >    }
2067  
2068 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2069 <        {
2070 <          new_leaf_conf = make_conf_item(LEAF_TYPE);
2071 <          match_item = (struct MatchItem *)map_to_conf(new_leaf_conf);
2463 <          DupString(new_leaf_conf->name, yy_conf->name);
2464 <          if (yy_lconf->user != NULL)
2465 <            DupString(match_item->user, yy_lconf->user);
2466 <          else
2467 <            DupString(match_item->user, "*");
2468 <          if (yy_lconf->host != NULL)
2469 <            DupString(match_item->host, yy_lconf->host);
2470 <          else
2471 <            DupString(match_item->host, "*");
2472 <        }
2473 <        dlinkDelete(&yy_lconf->node, &leaf_conf_list);
2474 <        free_collect_item(yy_lconf);
2475 <      }
2476 <      MyFree(class_name);
2477 <      class_name = NULL;
2478 <      yy_conf = NULL;
2479 <      yy_aconf = NULL;
2068 >    MyFree(class_name);
2069 >    class_name = NULL;
2070 >    yy_conf = NULL;
2071 >    yy_aconf = NULL;
2072    }
2073   };
2074  
2483 connect_name_b: | connect_name_t;
2075   connect_items:  connect_items connect_item | connect_item;
2076   connect_item:   connect_name | connect_host | connect_vhost |
2077                  connect_send_password | connect_accept_password |
2078 <                connect_aftype | connect_port |
2079 <                connect_fakename | connect_flags | connect_hub_mask |
2080 <                connect_leaf_mask | connect_class | connect_auto |
2490 <                connect_encrypted | connect_compressed | connect_cryptlink |
2491 <                connect_rsa_public_key_file | connect_cipher_preference |
2078 >                connect_aftype | connect_port | connect_ssl_cipher_list |
2079 >                connect_flags | connect_hub_mask | connect_leaf_mask |
2080 >                connect_class | connect_encrypted |
2081                  error ';' ;
2082  
2083   connect_name: NAME '=' QSTRING ';'
2084   {
2085 <  if (ypass == 2)
2085 >  if (conf_parser_ctx.pass == 2)
2086    {
2498    if (yy_conf->name != NULL)
2499      yyerror("Multiple connect name entry");
2500
2501    MyFree(yy_conf->name);
2502    DupString(yy_conf->name, yylval.string);
2503  }
2504 };
2505
2506 connect_name_t: QSTRING
2507 {
2508  if (ypass == 2)
2509  {
2510    if (yy_conf->name != NULL)
2511      yyerror("Multiple connect name entry");
2512
2087      MyFree(yy_conf->name);
2088      DupString(yy_conf->name, yylval.string);
2089    }
# Line 2517 | Line 2091 | connect_name_t: QSTRING
2091  
2092   connect_host: HOST '=' QSTRING ';'
2093   {
2094 <  if (ypass == 2)
2094 >  if (conf_parser_ctx.pass == 2)
2095    {
2096      MyFree(yy_aconf->host);
2097      DupString(yy_aconf->host, yylval.string);
# Line 2526 | Line 2100 | connect_host: HOST '=' QSTRING ';'
2100  
2101   connect_vhost: VHOST '=' QSTRING ';'
2102   {
2103 <  if (ypass == 2)
2103 >  if (conf_parser_ctx.pass == 2)
2104    {
2105      struct addrinfo hints, *res;
2106  
# Line 2536 | Line 2110 | connect_vhost: VHOST '=' QSTRING ';'
2110      hints.ai_socktype = SOCK_STREAM;
2111      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2112  
2113 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
2114 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2113 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
2114 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2115      else
2116      {
2117        assert(res != NULL);
2118  
2119 <      memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen);
2120 <      yy_aconf->my_ipnum.ss.ss_family = res->ai_family;
2121 <      yy_aconf->my_ipnum.ss_len = res->ai_addrlen;
2122 <      irc_freeaddrinfo(res);
2119 >      memcpy(&yy_aconf->bind, res->ai_addr, res->ai_addrlen);
2120 >      yy_aconf->bind.ss.ss_family = res->ai_family;
2121 >      yy_aconf->bind.ss_len = res->ai_addrlen;
2122 >      freeaddrinfo(res);
2123      }
2124    }
2125   };
2126  
2127   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2128   {
2129 <  if (ypass == 2)
2129 >  if (conf_parser_ctx.pass == 2)
2130    {
2131      if ($3[0] == ':')
2132        yyerror("Server passwords cannot begin with a colon");
# Line 2570 | Line 2144 | connect_send_password: SEND_PASSWORD '='
2144  
2145   connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2146   {
2147 <  if (ypass == 2)
2147 >  if (conf_parser_ctx.pass == 2)
2148    {
2149      if ($3[0] == ':')
2150        yyerror("Server passwords cannot begin with a colon");
# Line 2588 | Line 2162 | connect_accept_password: ACCEPT_PASSWORD
2162  
2163   connect_port: PORT '=' NUMBER ';'
2164   {
2165 <  if (ypass == 2)
2165 >  if (conf_parser_ctx.pass == 2)
2166      yy_aconf->port = $3;
2167   };
2168  
2169   connect_aftype: AFTYPE '=' T_IPV4 ';'
2170   {
2171 <  if (ypass == 2)
2171 >  if (conf_parser_ctx.pass == 2)
2172      yy_aconf->aftype = AF_INET;
2173   } | AFTYPE '=' T_IPV6 ';'
2174   {
2175   #ifdef IPV6
2176 <  if (ypass == 2)
2176 >  if (conf_parser_ctx.pass == 2)
2177      yy_aconf->aftype = AF_INET6;
2178   #endif
2179   };
2180  
2607 connect_fakename: FAKENAME '=' QSTRING ';'
2608 {
2609  if (ypass == 2)
2610  {
2611    MyFree(yy_aconf->fakename);
2612    DupString(yy_aconf->fakename, yylval.string);
2613  }
2614 };
2615
2181   connect_flags: IRCD_FLAGS
2182   {
2183   } '='  connect_flags_items ';';
2184  
2185   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2186 < connect_flags_item: NOT connect_flags_item_atom { not_atom = 1; }
2622 <                        | connect_flags_item_atom { not_atom = 0; };
2623 <
2624 < connect_flags_item_atom: LAZYLINK
2625 < {
2626 <  if (ypass == 2)
2627 <  {
2628 <    if (not_atom)ClearConfLazyLink(yy_aconf);
2629 <    else SetConfLazyLink(yy_aconf);
2630 <  }
2631 < } | COMPRESSED
2632 < {
2633 <  if (ypass == 2)
2634 < #ifndef HAVE_LIBZ
2635 <    yyerror("Ignoring flags = compressed; -- no zlib support");
2636 < #else
2637 < {
2638 <   if (not_atom)ClearConfCompressed(yy_aconf);
2639 <   else SetConfCompressed(yy_aconf);
2640 < }
2641 < #endif
2642 < } | CRYPTLINK
2186 > connect_flags_item: AUTOCONN
2187   {
2188 <  if (ypass == 2)
2189 <  {
2646 <    if (not_atom)ClearConfCryptLink(yy_aconf);
2647 <    else SetConfCryptLink(yy_aconf);
2648 <  }
2649 < } | AUTOCONN
2650 < {
2651 <  if (ypass == 2)
2652 <  {
2653 <    if (not_atom)ClearConfAllowAutoConn(yy_aconf);
2654 <    else SetConfAllowAutoConn(yy_aconf);
2655 <  }
2188 >  if (conf_parser_ctx.pass == 2)
2189 >    SetConfAllowAutoConn(yy_aconf);
2190   } | BURST_AWAY
2191   {
2192 <  if (ypass == 2)
2193 <  {
2660 <    if (not_atom)ClearConfAwayBurst(yy_aconf);
2661 <    else SetConfAwayBurst(yy_aconf);
2662 <  }
2192 >  if (conf_parser_ctx.pass == 2)
2193 >    SetConfAwayBurst(yy_aconf);
2194   } | TOPICBURST
2195   {
2196 <  if (ypass == 2)
2197 <  {
2198 <    if (not_atom)ClearConfTopicBurst(yy_aconf);
2668 <    else SetConfTopicBurst(yy_aconf);
2669 <  }
2670 < }
2671 < ;
2672 <
2673 < connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2196 >  if (conf_parser_ctx.pass == 2)
2197 >    SetConfTopicBurst(yy_aconf);
2198 > } | T_SSL
2199   {
2200 < #ifdef HAVE_LIBCRYPTO
2201 <  if (ypass == 2)
2677 <  {
2678 <    BIO *file;
2679 <
2680 <    if (yy_aconf->rsa_public_key != NULL)
2681 <    {
2682 <      RSA_free(yy_aconf->rsa_public_key);
2683 <      yy_aconf->rsa_public_key = NULL;
2684 <    }
2685 <
2686 <    if (yy_aconf->rsa_public_key_file != NULL)
2687 <    {
2688 <      MyFree(yy_aconf->rsa_public_key_file);
2689 <      yy_aconf->rsa_public_key_file = NULL;
2690 <    }
2691 <
2692 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
2693 <
2694 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2695 <    {
2696 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2697 <      break;
2698 <    }
2699 <
2700 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2701 <
2702 <    if (yy_aconf->rsa_public_key == NULL)
2703 <    {
2704 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2705 <      break;
2706 <    }
2707 <      
2708 <    BIO_set_close(file, BIO_CLOSE);
2709 <    BIO_free(file);
2710 <  }
2711 < #endif /* HAVE_LIBCRYPTO */
2200 >  if (conf_parser_ctx.pass == 2)
2201 >    SetConfSSL(yy_aconf);
2202   };
2203  
2204   connect_encrypted: ENCRYPTED '=' TBOOL ';'
2205   {
2206 <  if (ypass == 2)
2206 >  if (conf_parser_ctx.pass == 2)
2207    {
2208      if (yylval.number)
2209        yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
# Line 2722 | Line 2212 | connect_encrypted: ENCRYPTED '=' TBOOL '
2212    }
2213   };
2214  
2725 connect_cryptlink: CRYPTLINK '=' TBOOL ';'
2726 {
2727  if (ypass == 2)
2728  {
2729    if (yylval.number)
2730      yy_aconf->flags |= CONF_FLAGS_CRYPTLINK;
2731    else
2732      yy_aconf->flags &= ~CONF_FLAGS_CRYPTLINK;
2733  }
2734 };
2735
2736 connect_compressed: COMPRESSED '=' TBOOL ';'
2737 {
2738  if (ypass == 2)
2739  {
2740    if (yylval.number)
2741 #ifndef HAVE_LIBZ
2742      yyerror("Ignoring compressed=yes; -- no zlib support");
2743 #else
2744      yy_aconf->flags |= CONF_FLAGS_COMPRESSED;
2745 #endif
2746    else
2747      yy_aconf->flags &= ~CONF_FLAGS_COMPRESSED;
2748  }
2749 };
2750
2751 connect_auto: AUTOCONN '=' TBOOL ';'
2752 {
2753  if (ypass == 2)
2754  {
2755    if (yylval.number)
2756      yy_aconf->flags |= CONF_FLAGS_ALLOW_AUTO_CONN;
2757    else
2758      yy_aconf->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN;
2759  }
2760 };
2761
2215   connect_hub_mask: HUB_MASK '=' QSTRING ';'
2216   {
2217 <  if (ypass == 2)
2217 >  if (conf_parser_ctx.pass == 2)
2218    {
2219 <    struct CollectItem *yy_tmp;
2219 >    char *mask;
2220  
2221 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2222 <    DupString(yy_tmp->host, yylval.string);
2770 <    DupString(yy_tmp->user, "*");
2771 <    dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list);
2221 >    DupString(mask, yylval.string);
2222 >    dlinkAdd(mask, make_dlink_node(), &yy_aconf->hub_list);
2223    }
2224   };
2225  
2226   connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2227   {
2228 <  if (ypass == 2)
2228 >  if (conf_parser_ctx.pass == 2)
2229    {
2230 <    struct CollectItem *yy_tmp;
2230 >    char *mask;
2231  
2232 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2233 <    DupString(yy_tmp->host, yylval.string);
2783 <    DupString(yy_tmp->user, "*");
2784 <    dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list);
2232 >    DupString(mask, yylval.string);
2233 >    dlinkAdd(mask, make_dlink_node(), &yy_aconf->leaf_list);
2234    }
2235   };
2236  
2237   connect_class: CLASS '=' QSTRING ';'
2238   {
2239 <  if (ypass == 2)
2239 >  if (conf_parser_ctx.pass == 2)
2240    {
2241      MyFree(class_name);
2242      DupString(class_name, yylval.string);
2243    }
2244   };
2245  
2246 < connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2246 > connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2247   {
2248   #ifdef HAVE_LIBCRYPTO
2249 <  if (ypass == 2)
2249 >  if (conf_parser_ctx.pass == 2)
2250    {
2251 <    struct EncCapability *ecap;
2252 <    const char *cipher_name;
2804 <    int found = 0;
2805 <
2806 <    yy_aconf->cipher_preference = NULL;
2807 <    cipher_name = yylval.string;
2808 <
2809 <    for (ecap = CipherTable; ecap->name; ecap++)
2810 <    {
2811 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
2812 <          (ecap->cap & CAP_ENC_MASK))
2813 <      {
2814 <        yy_aconf->cipher_preference = ecap;
2815 <        found = 1;
2816 <        break;
2817 <      }
2818 <    }
2819 <
2820 <    if (!found)
2821 <      yyerror("Invalid cipher");
2251 >    MyFree(yy_aconf->cipher_list);
2252 >    DupString(yy_aconf->cipher_list, yylval.string);
2253    }
2254   #else
2255 <  if (ypass == 2)
2256 <    yyerror("Ignoring cipher_preference -- no OpenSSL support");
2255 >  if (conf_parser_ctx.pass == 2)
2256 >    yyerror("Ignoring connect::ciphers -- no OpenSSL support");
2257   #endif
2258   };
2259  
2260 +
2261   /***************************************************************************
2262   *  section kill
2263   ***************************************************************************/
2264   kill_entry: KILL
2265   {
2266 <  if (ypass == 2)
2266 >  if (conf_parser_ctx.pass == 2)
2267    {
2268      userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2269      regex_ban = 0;
2270    }
2271   } '{' kill_items '}' ';'
2272   {
2273 <  if (ypass == 2)
2273 >  if (conf_parser_ctx.pass == 2)
2274    {
2275      if (userbuf[0] && hostbuf[0])
2276      {
2277        if (regex_ban)
2278        {
2279 <        pcre *exp_user = NULL;
2280 <        pcre *exp_host = NULL;
2279 > #ifdef HAVE_LIBPCRE
2280 >        void *exp_user = NULL;
2281 >        void *exp_host = NULL;
2282          const char *errptr = NULL;
2283  
2284          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2285              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2286          {
2287 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s", errptr);
2287 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2288 >               errptr);
2289            break;
2290          }
2291  
2292 <        yy_conf = make_conf_item(RKLINE_TYPE);
2292 >        yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE));
2293          yy_aconf->regexuser = exp_user;
2294          yy_aconf->regexhost = exp_host;
2295  
# Line 2866 | Line 2300 | kill_entry: KILL
2300            DupString(yy_aconf->reason, reasonbuf);
2301          else
2302            DupString(yy_aconf->reason, "No reason");
2303 + #else
2304 +        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2305 +        break;
2306 + #endif
2307        }
2308        else
2309        {
2310 <        yy_conf = make_conf_item(KLINE_TYPE);
2311 <        yy_aconf = map_to_conf(yy_conf);
2310 >        find_and_delete_temporary(userbuf, hostbuf, CONF_KLINE);
2311 >
2312 >        yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2313  
2314          DupString(yy_aconf->user, userbuf);
2315          DupString(yy_aconf->host, hostbuf);
# Line 2879 | Line 2318 | kill_entry: KILL
2318            DupString(yy_aconf->reason, reasonbuf);
2319          else
2320            DupString(yy_aconf->reason, "No reason");
2321 <        add_conf_by_address(CONF_KILL, yy_aconf);
2321 >        add_conf_by_address(CONF_KLINE, yy_aconf);
2322        }
2323      }
2885    else
2886      delete_conf_item(yy_conf);
2324  
2888    yy_conf = NULL;
2325      yy_aconf = NULL;
2326    }
2327   };
# Line 2897 | Line 2333 | kill_type: TYPE
2333   kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2334   kill_type_item: REGEX_T
2335   {
2336 <  if (ypass == 2)
2336 >  if (conf_parser_ctx.pass == 2)
2337      regex_ban = 1;
2338   };
2339  
# Line 2906 | Line 2342 | kill_item:      kill_user | kill_reason
2342  
2343   kill_user: USER '=' QSTRING ';'
2344   {
2345 <  if (ypass == 2)
2345 >  if (conf_parser_ctx.pass == 2)
2346    {
2347 <    char *user = NULL, *host = NULL;
2347 >    struct split_nuh_item nuh;
2348  
2349 <    split_nuh(yylval.string, NULL, &user, &host);
2349 >    nuh.nuhmask  = yylval.string;
2350 >    nuh.nickptr  = NULL;
2351 >    nuh.userptr  = userbuf;
2352 >    nuh.hostptr  = hostbuf;
2353  
2354 <    strlcpy(userbuf, user, sizeof(userbuf));
2355 <    strlcpy(hostbuf, host, sizeof(hostbuf));
2354 >    nuh.nicksize = 0;
2355 >    nuh.usersize = sizeof(userbuf);
2356 >    nuh.hostsize = sizeof(hostbuf);
2357  
2358 <    MyFree(user);
2919 <    MyFree(host);
2358 >    split_nuh(&nuh);
2359    }
2360   };
2361  
2362   kill_reason: REASON '=' QSTRING ';'
2363   {
2364 <  if (ypass == 2)
2364 >  if (conf_parser_ctx.pass == 2)
2365      strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2366   };
2367  
# Line 2931 | Line 2370 | kill_reason: REASON '=' QSTRING ';'
2370   ***************************************************************************/
2371   deny_entry: DENY
2372   {
2373 <  if (ypass == 2)
2374 <  {
2936 <    yy_conf = make_conf_item(DLINE_TYPE);
2937 <    yy_aconf = map_to_conf(yy_conf);
2938 <    /* default reason */
2939 <    DupString(yy_aconf->reason, "No reason");
2940 <  }
2373 >  if (conf_parser_ctx.pass == 2)
2374 >    hostbuf[0] = reasonbuf[0] = '\0';
2375   } '{' deny_items '}' ';'
2376   {
2377 <  if (ypass == 2)
2377 >  if (conf_parser_ctx.pass == 2)
2378    {
2379 <    if (yy_aconf->host && parse_netmask(yy_aconf->host, NULL, NULL) != HM_HOST)
2379 >    if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
2380 >    {
2381 >      find_and_delete_temporary(NULL, hostbuf, CONF_DLINE);
2382 >
2383 >      yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2384 >      DupString(yy_aconf->host, hostbuf);
2385 >
2386 >      if (reasonbuf[0])
2387 >        DupString(yy_aconf->reason, reasonbuf);
2388 >      else
2389 >        DupString(yy_aconf->reason, "No reason");
2390        add_conf_by_address(CONF_DLINE, yy_aconf);
2391 <    else
2392 <      delete_conf_item(yy_conf);
2949 <    yy_conf = NULL;
2950 <    yy_aconf = NULL;
2391 >      yy_aconf = NULL;
2392 >    }
2393    }
2394   };
2395  
# Line 2956 | Line 2398 | deny_item:      deny_ip | deny_reason |
2398  
2399   deny_ip: IP '=' QSTRING ';'
2400   {
2401 <  if (ypass == 2)
2402 <  {
2961 <    MyFree(yy_aconf->host);
2962 <    DupString(yy_aconf->host, yylval.string);
2963 <  }
2401 >  if (conf_parser_ctx.pass == 2)
2402 >    strlcpy(hostbuf, yylval.string, sizeof(hostbuf));
2403   };
2404  
2405   deny_reason: REASON '=' QSTRING ';'
2406   {
2407 <  if (ypass == 2)
2408 <  {
2970 <    MyFree(yy_aconf->reason);
2971 <    DupString(yy_aconf->reason, yylval.string);
2972 <  }
2407 >  if (conf_parser_ctx.pass == 2)
2408 >    strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2409   };
2410  
2411   /***************************************************************************
# Line 2982 | Line 2418 | exempt_item:      exempt_ip | error;
2418  
2419   exempt_ip: IP '=' QSTRING ';'
2420   {
2421 <  if (ypass == 2)
2421 >  if (conf_parser_ctx.pass == 2)
2422    {
2423      if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2424      {
2425 <      yy_conf = make_conf_item(EXEMPTDLINE_TYPE);
2990 <      yy_aconf = map_to_conf(yy_conf);
2425 >      yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE));
2426        DupString(yy_aconf->host, yylval.string);
2427  
2428        add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
2994
2995      yy_conf = NULL;
2429        yy_aconf = NULL;
2430      }
2431    }
# Line 3003 | Line 2436 | exempt_ip: IP '=' QSTRING ';'
2436   ***************************************************************************/
2437   gecos_entry: GECOS
2438   {
2439 <  if (ypass == 2)
2439 >  if (conf_parser_ctx.pass == 2)
2440    {
2441      regex_ban = 0;
2442      reasonbuf[0] = gecos_name[0] = '\0';
2443    }
2444   } '{' gecos_items '}' ';'
2445   {
2446 <  if (ypass == 2)
2446 >  if (conf_parser_ctx.pass == 2)
2447    {
2448      if (gecos_name[0])
2449      {
2450        if (regex_ban)
2451        {
2452 <        pcre *exp_p = NULL;
2452 > #ifdef HAVE_LIBPCRE
2453 >        void *exp_p = NULL;
2454          const char *errptr = NULL;
2455  
2456          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2457          {
2458 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s", errptr);
2458 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2459 >               errptr);
2460            break;
2461          }
2462  
2463          yy_conf = make_conf_item(RXLINE_TYPE);
2464          yy_conf->regexpname = exp_p;
2465 + #else
2466 +        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2467 +        break;
2468 + #endif
2469        }
2470        else
2471          yy_conf = make_conf_item(XLINE_TYPE);
# Line 3049 | Line 2488 | gecos_flags: TYPE
2488   gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2489   gecos_flags_item: REGEX_T
2490   {
2491 <  if (ypass == 2)
2491 >  if (conf_parser_ctx.pass == 2)
2492      regex_ban = 1;
2493   };
2494  
# Line 3058 | Line 2497 | gecos_item:  gecos_name | gecos_reason |
2497  
2498   gecos_name: NAME '=' QSTRING ';'
2499   {
2500 <  if (ypass == 2)
2500 >  if (conf_parser_ctx.pass == 2)
2501      strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
2502   };
2503  
2504   gecos_reason: REASON '=' QSTRING ';'
2505   {
2506 <  if (ypass == 2)
2506 >  if (conf_parser_ctx.pass == 2)
2507      strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2508   };
2509  
# Line 3088 | Line 2527 | general_item:       general_hide_spoof_i
2527                      general_pace_wait_simple | general_stats_P_oper_only |
2528                      general_short_motd | general_no_oper_flood |
2529                      general_true_no_oper_flood | general_oper_pass_resv |
2530 <                    general_idletime | general_message_locale |
2530 >                    general_message_locale |
2531                      general_oper_only_umodes | general_max_targets |
2532                      general_use_egd | general_egdpool_path |
2533                      general_oper_umodes | general_caller_id_wait |
2534                      general_opers_bypass_callerid | general_default_floodcount |
2535                      general_min_nonwildcard | general_min_nonwildcard_simple |
2536 <                    general_servlink_path | general_disable_remote_commands |
2537 <                    general_default_cipher_preference |
3099 <                    general_compression_level | general_client_flood |
2536 >                    general_disable_remote_commands |
2537 >                    general_client_flood |
2538                      general_throttle_time | general_havent_read_conf |
2539 <                    general_dot_in_ip6_addr | general_ping_cookie |
2540 <                    general_disable_auth | general_burst_away |
2541 <                    general_tkline_expire_notices | general_gline_min_cidr |
2539 >                    general_ping_cookie |
2540 >                    general_disable_auth |
2541 >                    general_tkline_expire_notices | general_gline_enable |
2542 >                    general_gline_duration | general_gline_request_duration |
2543 >                    general_gline_min_cidr |
2544                      general_gline_min_cidr6 | general_use_whois_actually |
2545 <                    general_reject_hold_time |
2545 >                    general_reject_hold_time | general_stats_e_disabled |
2546 >                    general_max_watch | general_services_name |
2547                      error;
2548  
2549  
2550 + general_max_watch: MAX_WATCH '=' NUMBER ';'
2551 + {
2552 +  ConfigFileEntry.max_watch = $3;
2553 + };
2554 +
2555 + general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2556 + {
2557 +  if (conf_parser_ctx.pass == 2)
2558 +    ConfigFileEntry.glines = yylval.number;
2559 + };
2560 +
2561 + general_gline_duration: GLINE_DURATION '=' timespec ';'
2562 + {
2563 +  if (conf_parser_ctx.pass == 2)
2564 +    ConfigFileEntry.gline_time = $3;
2565 + };
2566 +
2567 + general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2568 + {
2569 +  if (conf_parser_ctx.pass == 2)
2570 +    ConfigFileEntry.gline_request_time = $3;
2571 + };
2572  
2573   general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2574   {
# Line 3117 | Line 2580 | general_gline_min_cidr6: GLINE_MIN_CIDR6
2580    ConfigFileEntry.gline_min_cidr6 = $3;
2581   };
2582  
3120 general_burst_away: BURST_AWAY '=' TBOOL ';'
3121 {
3122  ConfigFileEntry.burst_away = yylval.number;
3123 };
3124
2583   general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2584   {
2585    ConfigFileEntry.use_whois_actually = yylval.number;
# Line 3137 | Line 2595 | general_tkline_expire_notices: TKLINE_EX
2595    ConfigFileEntry.tkline_expire_notices = yylval.number;
2596   };
2597  
2598 < general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' NUMBER ';'
2598 > general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2599   {
2600    ConfigFileEntry.kill_chase_time_limit = $3;
2601   };
# Line 3194 | Line 2652 | general_ts_warn_delta: TS_WARN_DELTA '='
2652  
2653   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2654   {
2655 <  if (ypass == 2)
2655 >  if (conf_parser_ctx.pass == 2)
2656      ConfigFileEntry.ts_max_delta = $3;
2657   };
2658  
2659   general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2660   {
2661 <  if (($3 > 0) && ypass == 1)
2661 >  if (($3 > 0) && conf_parser_ctx.pass == 1)
2662    {
2663 <    ilog(L_CRIT, "You haven't read your config file properly.");
2664 <    ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
2665 <    ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
2663 >    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2664 >    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2665 >    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2666      exit(0);
2667    }
2668   };
# Line 3216 | Line 2674 | general_kline_with_reason: KLINE_WITH_RE
2674  
2675   general_kline_reason: KLINE_REASON '=' QSTRING ';'
2676   {
2677 <  if (ypass == 2)
2677 >  if (conf_parser_ctx.pass == 2)
2678    {
2679      MyFree(ConfigFileEntry.kline_reason);
2680      DupString(ConfigFileEntry.kline_reason, yylval.string);
# Line 3233 | Line 2691 | general_warn_no_nline: WARN_NO_NLINE '='
2691    ConfigFileEntry.warn_no_nline = yylval.number;
2692   };
2693  
2694 + general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2695 + {
2696 +  ConfigFileEntry.stats_e_disabled = yylval.number;
2697 + };
2698 +
2699   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2700   {
2701    ConfigFileEntry.stats_o_oper_only = yylval.number;
# Line 3301 | Line 2764 | general_oper_pass_resv: OPER_PASS_RESV '
2764  
2765   general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
2766   {
2767 <  if (ypass == 2)
2767 >  if (conf_parser_ctx.pass == 2)
2768    {
2769      if (strlen(yylval.string) > LOCALE_LENGTH-2)
2770        yylval.string[LOCALE_LENGTH-1] = '\0';
# Line 3310 | Line 2773 | general_message_locale: MESSAGE_LOCALE '
2773    }
2774   };
2775  
3313 general_idletime: IDLETIME '=' timespec ';'
3314 {
3315  ConfigFileEntry.idletime = $3;
3316 };
3317
2776   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2777   {
2778    ConfigFileEntry.dots_in_ident = $3;
# Line 3325 | Line 2783 | general_max_targets: MAX_TARGETS '=' NUM
2783    ConfigFileEntry.max_targets = $3;
2784   };
2785  
3328 general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3329 {
3330  if (ypass == 2)
3331  {
3332    MyFree(ConfigFileEntry.servlink_path);
3333    DupString(ConfigFileEntry.servlink_path, yylval.string);
3334  }
3335 };
3336
3337 general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3338 {
3339 #ifdef HAVE_LIBCRYPTO
3340  if (ypass == 2)
3341  {
3342    struct EncCapability *ecap;
3343    const char *cipher_name;
3344    int found = 0;
3345
3346    ConfigFileEntry.default_cipher_preference = NULL;
3347    cipher_name = yylval.string;
3348
3349    for (ecap = CipherTable; ecap->name; ecap++)
3350    {
3351      if ((irccmp(ecap->name, cipher_name) == 0) &&
3352          (ecap->cap & CAP_ENC_MASK))
3353      {
3354        ConfigFileEntry.default_cipher_preference = ecap;
3355        found = 1;
3356        break;
3357      }
3358    }
3359
3360    if (!found)
3361      yyerror("Invalid cipher");
3362  }
3363 #else
3364  if (ypass == 2)
3365    yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3366 #endif
3367 };
3368
3369 general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3370 {
3371  if (ypass == 2)
3372  {
3373    ConfigFileEntry.compression_level = $3;
3374 #ifndef HAVE_LIBZ
3375    yyerror("Ignoring compression_level -- no zlib support");
3376 #else
3377    if ((ConfigFileEntry.compression_level < 1) ||
3378        (ConfigFileEntry.compression_level > 9))
3379    {
3380      yyerror("Ignoring invalid compression_level, using default");
3381      ConfigFileEntry.compression_level = 0;
3382    }
3383 #endif
3384  }
3385 };
3386
2786   general_use_egd: USE_EGD '=' TBOOL ';'
2787   {
2788    ConfigFileEntry.use_egd = yylval.number;
# Line 3391 | Line 2790 | general_use_egd: USE_EGD '=' TBOOL ';'
2790  
2791   general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2792   {
2793 <  if (ypass == 2)
2793 >  if (conf_parser_ctx.pass == 2)
2794    {
2795      MyFree(ConfigFileEntry.egdpool_path);
2796      DupString(ConfigFileEntry.egdpool_path, yylval.string);
2797    }
2798   };
2799  
2800 + general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2801 + {
2802 +  if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2803 +  {
2804 +    MyFree(ConfigFileEntry.service_name);
2805 +    DupString(ConfigFileEntry.service_name, yylval.string);
2806 +  }
2807 + };
2808 +
2809   general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2810   {
2811    ConfigFileEntry.ping_cookie = yylval.number;
# Line 3425 | Line 2833 | umode_oitem:     T_BOTS
2833   } | T_CCONN
2834   {
2835    ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2836 + } | T_CCONN_FULL
2837 + {
2838 +  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
2839   } | T_DEAF
2840   {
2841    ConfigFileEntry.oper_umodes |= UMODE_DEAF;
# Line 3434 | Line 2845 | umode_oitem:     T_BOTS
2845   } | T_FULL
2846   {
2847    ConfigFileEntry.oper_umodes |= UMODE_FULL;
2848 + } | HIDDEN
2849 + {
2850 +  ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2851   } | T_SKILL
2852   {
2853    ConfigFileEntry.oper_umodes |= UMODE_SKILL;
# Line 3487 | Line 2901 | umode_item:    T_BOTS
2901   } | T_CCONN
2902   {
2903    ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2904 + } | T_CCONN_FULL
2905 + {
2906 +  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
2907   } | T_DEAF
2908   {
2909    ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
# Line 3499 | Line 2916 | umode_item:    T_BOTS
2916   } | T_SKILL
2917   {
2918    ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2919 + } | HIDDEN
2920 + {
2921 +  ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
2922   } | T_NCHANGE
2923   {
2924    ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
# Line 3557 | Line 2977 | general_client_flood: T_CLIENT_FLOOD '='
2977    ConfigFileEntry.client_flood = $3;
2978   };
2979  
3560 general_dot_in_ip6_addr: DOT_IN_IP6_ADDR '=' TBOOL ';'
3561 {
3562  ConfigFileEntry.dot_in_ip6_addr = yylval.number;
3563 };
3564
3565 /***************************************************************************
3566 *  section glines
3567 ***************************************************************************/
3568 gline_entry: GLINES
3569 {
3570  if (ypass == 2)
3571  {
3572    yy_conf = make_conf_item(GDENY_TYPE);
3573    yy_aconf = map_to_conf(yy_conf);
3574  }
3575 } '{' gline_items '}' ';'
3576 {
3577  if (ypass == 2)
3578  {
3579    /*
3580     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3581     * end we will have one extra, so we should free it.
3582     */
3583    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3584    {
3585      delete_conf_item(yy_conf);
3586      yy_conf = NULL;
3587      yy_aconf = NULL;
3588    }
3589  }
3590 };
3591
3592 gline_items:        gline_items gline_item | gline_item;
3593 gline_item:         gline_enable |
3594                    gline_duration |
3595                    gline_logging |
3596                    gline_user |
3597                    gline_server |
3598                    gline_action |
3599                    error;
3600
3601 gline_enable: ENABLE '=' TBOOL ';'
3602 {
3603  if (ypass == 2)
3604    ConfigFileEntry.glines = yylval.number;
3605 };
3606
3607 gline_duration: DURATION '=' timespec ';'
3608 {
3609  if (ypass == 2)
3610    ConfigFileEntry.gline_time = $3;
3611 };
3612
3613 gline_logging: LOGGING
3614 {
3615  if (ypass == 2)
3616    ConfigFileEntry.gline_logging = 0;
3617 } '=' gline_logging_types ';';
3618 gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3619 gline_logging_type_item: T_REJECT
3620 {
3621  if (ypass == 2)
3622    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3623 } | T_BLOCK
3624 {
3625  if (ypass == 2)
3626    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3627 };
3628
3629 gline_user: USER '=' QSTRING ';'
3630 {
3631  if (ypass == 2)
3632  {
3633    struct CollectItem *yy_tmp = NULL;
3634
3635    if (yy_aconf->user == NULL)
3636    {
3637      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
3638    }
3639    else
3640    {
3641      yy_tmp = MyMalloc(sizeof(struct CollectItem));
3642      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
3643      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3644    }
3645  }
3646 };
3647
3648 gline_server: NAME '=' QSTRING ';'
3649 {
3650  if (ypass == 2)  
3651  {
3652    MyFree(yy_conf->name);
3653    DupString(yy_conf->name, yylval.string);
3654  }
3655 };
3656
3657 gline_action: ACTION
3658 {
3659  if (ypass == 2)
3660    yy_aconf->flags = 0;
3661 } '=' gdeny_types ';'
3662 {
3663  if (ypass == 2)
3664  {
3665    struct CollectItem *yy_tmp = NULL;
3666    dlink_node *ptr, *next_ptr;
3667
3668    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3669    {
3670      struct AccessItem *new_aconf;
3671      struct ConfItem *new_conf;
3672
3673      yy_tmp = ptr->data;
3674      new_conf = make_conf_item(GDENY_TYPE);
3675      new_aconf = map_to_conf(new_conf);
3676
3677      new_aconf->flags = yy_aconf->flags;
3678
3679      if (yy_conf->name != NULL)
3680        DupString(new_conf->name, yy_conf->name);
3681      else
3682        DupString(new_conf->name, "*");
3683      if (yy_aconf->user != NULL)
3684         DupString(new_aconf->user, yy_tmp->user);
3685      else  
3686        DupString(new_aconf->user, "*");
3687      if (yy_aconf->host != NULL)
3688        DupString(new_aconf->host, yy_tmp->host);
3689      else
3690        DupString(new_aconf->host, "*");
3691
3692      dlinkDelete(&yy_tmp->node, &col_conf_list);
3693    }
3694
3695    /*
3696     * In case someone has fed us with more than one action= after user/name
3697     * which would leak memory  -Michael
3698     */
3699    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3700      delete_conf_item(yy_conf);
3701
3702    yy_conf = make_conf_item(GDENY_TYPE);
3703    yy_aconf = map_to_conf(yy_conf);
3704  }
3705 };
3706
3707 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3708 gdeny_type_item: T_REJECT
3709 {
3710  if (ypass == 2)
3711    yy_aconf->flags |= GDENY_REJECT;
3712 } | T_BLOCK
3713 {
3714  if (ypass == 2)
3715    yy_aconf->flags |= GDENY_BLOCK;
3716 };
2980  
2981   /***************************************************************************
2982   *  section channel
# Line 3722 | Line 2985 | channel_entry: CHANNEL
2985    '{' channel_items '}' ';';
2986  
2987   channel_items:      channel_items channel_item | channel_item;
2988 < channel_item:       channel_disable_local_channels | channel_use_except |
2989 <                    channel_use_invex | channel_use_knock |
2990 <                    channel_max_bans | channel_knock_delay |
2991 <                    channel_knock_delay_channel | channel_invite_ops_only |
2992 <                    channel_max_chans_per_user | channel_quiet_on_ban |
2993 <                    channel_default_split_user_count |
2994 <                    channel_default_split_server_count |
2995 <                    channel_no_create_on_split | channel_restrict_channels |
2996 <                    channel_no_join_on_split | channel_burst_topicwho |
3734 <                    channel_jflood_count | channel_jflood_time |
3735 <                    error;
2988 > channel_item:       channel_max_bans |
2989 >                    channel_knock_delay | channel_knock_delay_channel |
2990 >                    channel_max_chans_per_user | channel_max_chans_per_oper |
2991 >                    channel_quiet_on_ban | channel_default_split_user_count |
2992 >                    channel_default_split_server_count |
2993 >                    channel_no_create_on_split | channel_restrict_channels |
2994 >                    channel_no_join_on_split |
2995 >                    channel_jflood_count | channel_jflood_time |
2996 >                    channel_disable_fake_channels | error;
2997  
2998 < channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3738 < {
3739 <  ConfigChannel.restrict_channels = yylval.number;
3740 < };
3741 <
3742 < channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
3743 < {
3744 <  ConfigChannel.disable_local_channels = yylval.number;
3745 < };
3746 <
3747 < channel_use_except: USE_EXCEPT '=' TBOOL ';'
3748 < {
3749 <  ConfigChannel.use_except = yylval.number;
3750 < };
3751 <
3752 < channel_use_invex: USE_INVEX '=' TBOOL ';'
2998 > channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2999   {
3000 <  ConfigChannel.use_invex = yylval.number;
3000 >  ConfigChannel.disable_fake_channels = yylval.number;
3001   };
3002  
3003 < channel_use_knock: USE_KNOCK '=' TBOOL ';'
3003 > channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3004   {
3005 <  ConfigChannel.use_knock = yylval.number;
3005 >  ConfigChannel.restrict_channels = yylval.number;
3006   };
3007  
3008   channel_knock_delay: KNOCK_DELAY '=' timespec ';'
# Line 3769 | Line 3015 | channel_knock_delay_channel: KNOCK_DELAY
3015    ConfigChannel.knock_delay_channel = $3;
3016   };
3017  
3018 < channel_invite_ops_only: INVITE_OPS_ONLY '=' TBOOL ';'
3018 > channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3019   {
3020 <  ConfigChannel.invite_ops_only = yylval.number;
3020 >  ConfigChannel.max_chans_per_user = $3;
3021   };
3022  
3023 < channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3023 > channel_max_chans_per_oper: MAX_CHANS_PER_OPER '=' NUMBER ';'
3024   {
3025 <  ConfigChannel.max_chans_per_user = $3;
3025 >  ConfigChannel.max_chans_per_oper = $3;
3026   };
3027  
3028   channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
# Line 3809 | Line 3055 | channel_no_join_on_split: NO_JOIN_ON_SPL
3055    ConfigChannel.no_join_on_split = yylval.number;
3056   };
3057  
3812 channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
3813 {
3814  ConfigChannel.burst_topicwho = yylval.number;
3815 };
3816
3058   channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3059   {
3060    GlobalSetOptions.joinfloodcount = yylval.number;
# Line 3833 | Line 3074 | serverhide_entry: SERVERHIDE
3074   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
3075   serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
3076                      serverhide_links_delay |
3836                    serverhide_disable_hidden |
3077                      serverhide_hidden | serverhide_hidden_name |
3078                      serverhide_hide_server_ips |
3079                      error;
3080  
3081   serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3082   {
3083 <  if (ypass == 2)
3083 >  if (conf_parser_ctx.pass == 2)
3084      ConfigServerHide.flatten_links = yylval.number;
3085   };
3086  
3087   serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3088   {
3089 <  if (ypass == 2)
3089 >  if (conf_parser_ctx.pass == 2)
3090      ConfigServerHide.hide_servers = yylval.number;
3091   };
3092  
3093   serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3094   {
3095 <  if (ypass == 2)
3095 >  if (conf_parser_ctx.pass == 2)
3096    {
3097      MyFree(ConfigServerHide.hidden_name);
3098      DupString(ConfigServerHide.hidden_name, yylval.string);
# Line 3861 | Line 3101 | serverhide_hidden_name: HIDDEN_NAME '='
3101  
3102   serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3103   {
3104 <  if (ypass == 2)
3104 >  if (conf_parser_ctx.pass == 2)
3105    {
3106      if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3107      {
# Line 3875 | Line 3115 | serverhide_links_delay: LINKS_DELAY '='
3115  
3116   serverhide_hidden: HIDDEN '=' TBOOL ';'
3117   {
3118 <  if (ypass == 2)
3118 >  if (conf_parser_ctx.pass == 2)
3119      ConfigServerHide.hidden = yylval.number;
3120   };
3121  
3882 serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3883 {
3884  if (ypass == 2)
3885    ConfigServerHide.disable_hidden = yylval.number;
3886 };
3887
3122   serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3123   {
3124 <  if (ypass == 2)
3124 >  if (conf_parser_ctx.pass == 2)
3125      ConfigServerHide.hide_server_ips = yylval.number;
3126   };

Diff Legend

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