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 671 by michael, Tue Jun 13 07:15:38 2006 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (file contents), Revision 7624 by michael, Thu Jun 23 12:44:09 2016 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.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2005 by the past and present ircd coders, and others.
4 > *  Copyright (c) 2000-2016 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 16 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
21 *
22 *  $Id$
20   */
21  
22 < %{
22 > /*! \file conf_parser.y
23 > * \brief Parses the ircd configuration file.
24 > * \version $Id$
25 > */
26  
27 #define YY_NO_UNPUT
28 #include <sys/types.h>
27  
28 + %{
29 +
30 + #include "config.h"
31   #include "stdinc.h"
32   #include "ircd.h"
32 #include "tools.h"
33   #include "list.h"
34 < #include "s_conf.h"
34 > #include "conf.h"
35 > #include "conf_class.h"
36 > #include "conf_cluster.h"
37 > #include "conf_gecos.h"
38 > #include "conf_pseudo.h"
39 > #include "conf_resv.h"
40 > #include "conf_service.h"
41 > #include "conf_shared.h"
42   #include "event.h"
43 < #include "s_log.h"
44 < #include "client.h"     /* for UMODE_ALL only */
38 < #include "pcre.h"
43 > #include "id.h"
44 > #include "log.h"
45   #include "irc_string.h"
40 #include "irc_getaddrinfo.h"
41 #include "sprintf_irc.h"
46   #include "memory.h"
47   #include "modules.h"
48 < #include "s_serv.h" /* for CAP_LL / IsCapable */
48 > #include "server.h"
49   #include "hostmask.h"
46 #include "send.h"
50   #include "listener.h"
51 < #include "resv.h"
52 < #include "numeric.h"
50 < #include "s_user.h"
51 <
52 < #ifdef HAVE_LIBCRYPTO
53 < #include <openssl/rsa.h>
54 < #include <openssl/bio.h>
55 < #include <openssl/pem.h>
56 < #endif
51 > #include "user.h"
52 > #include "motd.h"
53  
54 < static char *class_name = NULL;
59 < static struct ConfItem *yy_conf = NULL;
60 < static struct AccessItem *yy_aconf = NULL;
61 < static struct MatchItem *yy_match_item = NULL;
62 < static struct ClassItem *yy_class = NULL;
63 < static char *yy_class_name = NULL;
64 <
65 < static dlink_list col_conf_list  = { NULL, NULL, 0 };
66 < static dlink_list hub_conf_list  = { NULL, NULL, 0 };
67 < 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 <
77 < static char *resv_reason = NULL;
78 < static char *listener_address = NULL;
79 < static int not_atom = 0;
80 <
81 < struct CollectItem
82 < {
83 <  dlink_node node;
84 <  char *name;
85 <  char *user;
86 <  char *host;
87 <  char *passwd;
88 <  int  port;
89 <  int  flags;
90 < #ifdef HAVE_LIBCRYPTO
91 <  char *rsa_public_key_file;
92 <  RSA *rsa_public_key;
93 < #endif
94 < };
54 > int yylex(void);
55  
56 < static void
97 < free_collect_item(struct CollectItem *item)
56 > static struct
57   {
58 <  MyFree(item->name);
59 <  MyFree(item->user);
60 <  MyFree(item->host);
61 <  MyFree(item->passwd);
62 < #ifdef HAVE_LIBCRYPTO
63 <  MyFree(item->rsa_public_key_file);
64 < #endif
65 <  MyFree(item);
66 < }
58 >  struct
59 >  {
60 >    dlink_list list;
61 >  } mask,
62 >    leaf,
63 >    hub;
64 >
65 >  struct
66 >  {
67 >    char buf[IRCD_BUFSIZE];
68 >  } name,
69 >    nick,
70 >    user,
71 >    host,
72 >    addr,
73 >    bind,
74 >    file,
75 >    ciph,
76 >    cert,
77 >    rpass,
78 >    spass,
79 >    whois,
80 >    class,
81 >    target,
82 >    prepend,
83 >    command;
84 >
85 >  struct
86 >  {
87 >    unsigned int value;
88 >  } flags,
89 >    modes,
90 >    size,
91 >    type,
92 >    port,
93 >    aftype,
94 >    ping_freq,
95 >    max_perip,
96 >    con_freq,
97 >    min_idle,
98 >    max_idle,
99 >    max_total,
100 >    max_global,
101 >    max_local,
102 >    max_sendq,
103 >    max_recvq,
104 >    max_channels,
105 >    cidr_bitlen_ipv4,
106 >    cidr_bitlen_ipv6,
107 >    number_per_cidr;
108 > } block_state;
109  
110   static void
111 < unhook_hub_leaf_confs(void)
111 > reset_block_state(void)
112   {
113 <  dlink_node *ptr;
114 <  dlink_node *next_ptr;
115 <  struct CollectItem *yy_hconf;
116 <  struct CollectItem *yy_lconf;
113 >  dlink_node *node = NULL, *node_next = NULL;
114 >
115 >  DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head)
116 >  {
117 >    xfree(node->data);
118 >    dlinkDelete(node, &block_state.mask.list);
119 >    free_dlink_node(node);
120 >  }
121  
122 <  DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
122 >  DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head)
123    {
124 <    yy_hconf = ptr->data;
125 <    dlinkDelete(&yy_hconf->node, &hub_conf_list);
126 <    free_collect_item(yy_hconf);
124 >    xfree(node->data);
125 >    dlinkDelete(node, &block_state.leaf.list);
126 >    free_dlink_node(node);
127    }
128  
129 <  DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
129 >  DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head)
130    {
131 <    yy_lconf = ptr->data;
132 <    dlinkDelete(&yy_lconf->node, &leaf_conf_list);
133 <    free_collect_item(yy_lconf);
131 >    xfree(node->data);
132 >    dlinkDelete(node, &block_state.hub.list);
133 >    free_dlink_node(node);
134    }
135 +
136 +  memset(&block_state, 0, sizeof(block_state));
137   }
138  
139   %}
# Line 137 | Line 144 | unhook_hub_leaf_confs(void)
144   }
145  
146   %token  ACCEPT_PASSWORD
140 %token  ACTION
147   %token  ADMIN
148   %token  AFTYPE
143 %token  T_ALLOW
149   %token  ANTI_NICK_FLOOD
150   %token  ANTI_SPAM_EXIT_MESSAGE_TIME
151   %token  AUTOCONN
152 < %token  T_BLOCK
153 < %token  BURST_AWAY
154 < %token  BURST_TOPICWHO
150 < %token  BYTES KBYTES MBYTES GBYTES TBYTES
152 > %token  AWAY_COUNT
153 > %token  AWAY_TIME
154 > %token  BYTES KBYTES MBYTES
155   %token  CALLER_ID_WAIT
156   %token  CAN_FLOOD
153 %token  CAN_IDLE
157   %token  CHANNEL
158 < %token  CIDR_BITLEN_IPV4
159 < %token  CIDR_BITLEN_IPV6
160 < %token  CIPHER_PREFERENCE
158 > %token  CHECK_CACHE
159 > %token  CIDR_BITLEN_IPV4
160 > %token  CIDR_BITLEN_IPV6
161   %token  CLASS
162 < %token  COMPRESSED
160 < %token  COMPRESSION_LEVEL
162 > %token  CLOSE
163   %token  CONNECT
164   %token  CONNECTFREQ
165 < %token  CRYPTLINK
164 < %token  DEFAULT_CIPHER_PREFERENCE
165 > %token  CYCLE_ON_HOST_CHANGE
166   %token  DEFAULT_FLOODCOUNT
167 < %token  DEFAULT_SPLIT_SERVER_COUNT
168 < %token  DEFAULT_SPLIT_USER_COUNT
167 > %token  DEFAULT_JOIN_FLOOD_COUNT
168 > %token  DEFAULT_JOIN_FLOOD_TIME
169 > %token  DEFAULT_MAX_CLIENTS
170   %token  DENY
171   %token  DESCRIPTION
172   %token  DIE
173   %token  DISABLE_AUTH
174   %token  DISABLE_FAKE_CHANNELS
173 %token  DISABLE_HIDDEN
174 %token  DISABLE_LOCAL_CHANNELS
175   %token  DISABLE_REMOTE_COMMANDS
176 < %token  DOT_IN_IP6_ADDR
176 > %token  DLINE_MIN_CIDR
177 > %token  DLINE_MIN_CIDR6
178   %token  DOTS_IN_IDENT
178 %token  DURATION
179 %token  EGDPOOL_PATH
179   %token  EMAIL
181 %token  ENABLE
180   %token  ENCRYPTED
181   %token  EXCEED_LIMIT
182   %token  EXEMPT
183   %token  FAILED_OPER_NOTICE
186 %token  FAKENAME
187 %token  IRCD_FLAGS
184   %token  FLATTEN_LINKS
185 < %token  FFAILED_OPERLOG
186 < %token  FKILLLOG
191 < %token  FKLINELOG
192 < %token  FGLINELOG
193 < %token  FIOERRLOG
194 < %token  FOPERLOG
195 < %token  FOPERSPYLOG
196 < %token  FUSERLOG
185 > %token  FLATTEN_LINKS_DELAY
186 > %token  FLATTEN_LINKS_FILE
187   %token  GECOS
188   %token  GENERAL
199 %token  GLINE
200 %token  GLINES
201 %token  GLINE_EXEMPT
202 %token  GLINE_LOG
203 %token  GLINE_TIME
204 %token  GLINE_MIN_CIDR
205 %token  GLINE_MIN_CIDR6
206 %token  GLOBAL_KILL
207 %token  IRCD_AUTH
208 %token  NEED_IDENT
209 %token  HAVENT_READ_CONF
189   %token  HIDDEN
190 < %token  HIDDEN_ADMIN
191 < %token  HIDDEN_NAME
192 < %token  HIDDEN_OPER
190 > %token  HIDDEN_NAME
191 > %token  HIDE_CHANS
192 > %token  HIDE_IDLE
193 > %token  HIDE_IDLE_FROM_OPERS
194   %token  HIDE_SERVER_IPS
195   %token  HIDE_SERVERS
196 < %token  HIDE_SPOOF_IPS
196 > %token  HIDE_SERVICES
197   %token  HOST
198   %token  HUB
199   %token  HUB_MASK
220 %token  IDLETIME
200   %token  IGNORE_BOGUS_TS
201   %token  INVISIBLE_ON_CONNECT
202 + %token  INVITE_CLIENT_COUNT
203 + %token  INVITE_CLIENT_TIME
204 + %token  INVITE_DELAY_CHANNEL
205   %token  IP
206 + %token  IRCD_AUTH
207 + %token  IRCD_FLAGS
208 + %token  IRCD_SID
209 + %token  JOIN
210   %token  KILL
211 < %token  KILL_CHASE_TIME_LIMIT
211 > %token  KILL_CHASE_TIME_LIMIT
212   %token  KLINE
213   %token  KLINE_EXEMPT
214 < %token  KLINE_REASON
215 < %token  KLINE_WITH_REASON
216 < %token  KNOCK_DELAY
214 > %token  KLINE_MIN_CIDR
215 > %token  KLINE_MIN_CIDR6
216 > %token  KNOCK_CLIENT_COUNT
217 > %token  KNOCK_CLIENT_TIME
218   %token  KNOCK_DELAY_CHANNEL
232 %token  LAZYLINK
219   %token  LEAF_MASK
220 < %token  LINKS_DELAY
220 > %token  LIBGEOIP_DATABASE_OPTIONS
221 > %token  LIBGEOIP_IPV4_DATABASE_FILE
222 > %token  LIBGEOIP_IPV6_DATABASE_FILE
223   %token  LISTEN
224 < %token  T_LOG
237 < %token  LOGGING
238 < %token  LOG_LEVEL
224 > %token  MASK
225   %token  MAX_ACCEPT
226   %token  MAX_BANS
227 < %token  MAX_CHANS_PER_USER
227 > %token  MAX_CHANNELS
228   %token  MAX_GLOBAL
229 < %token  MAX_IDENT
229 > %token  MAX_IDLE
230   %token  MAX_LOCAL
231   %token  MAX_NICK_CHANGES
232 + %token  MAX_NICK_LENGTH
233   %token  MAX_NICK_TIME
234   %token  MAX_NUMBER
235   %token  MAX_TARGETS
236 < %token  MESSAGE_LOCALE
236 > %token  MAX_TOPIC_LENGTH
237 > %token  MAX_WATCH
238 > %token  MEMORY_CACHE
239 > %token  MIN_IDLE
240   %token  MIN_NONWILDCARD
241   %token  MIN_NONWILDCARD_SIMPLE
242 + %token  MMAP_CACHE
243   %token  MODULE
244   %token  MODULES
245 + %token  MOTD
246   %token  NAME
247 + %token  NEED_IDENT
248   %token  NEED_PASSWORD
249   %token  NETWORK_DESC
250   %token  NETWORK_NAME
251   %token  NICK
259 %token  NICK_CHANGES
260 %token  NO_CREATE_ON_SPLIT
261 %token  NO_JOIN_ON_SPLIT
252   %token  NO_OPER_FLOOD
253   %token  NO_TILDE
264 %token  NOT
254   %token  NUMBER
266 %token  NUMBER_PER_IDENT
255   %token  NUMBER_PER_CIDR
256   %token  NUMBER_PER_IP
269 %token  NUMBER_PER_IP_GLOBAL
270 %token  OPERATOR
271 %token  OPERS_BYPASS_CALLERID
272 %token  OPER_LOG
257   %token  OPER_ONLY_UMODES
274 %token  OPER_PASS_RESV
275 %token  OPER_SPY_T
258   %token  OPER_UMODES
259 < %token  JOIN_FLOOD_COUNT
260 < %token  JOIN_FLOOD_TIME
259 > %token  OPERATOR
260 > %token  OPERS_BYPASS_CALLERID
261   %token  PACE_WAIT
262   %token  PACE_WAIT_SIMPLE
263   %token  PASSWORD
264   %token  PATH
265   %token  PING_COOKIE
266   %token  PING_TIME
285 %token  PING_WARNING
267   %token  PORT
268   %token  QSTRING
269 < %token  QUIET_ON_BAN
269 > %token  RANDOM_IDLE
270   %token  REASON
271   %token  REDIRPORT
272   %token  REDIRSERV
292 %token  REGEX_T
273   %token  REHASH
294 %token  TREJECT_HOLD_TIME
274   %token  REMOTE
275   %token  REMOTEBAN
297 %token  RESTRICT_CHANNELS
298 %token  RESTRICTED
299 %token  RSA_PRIVATE_KEY_FILE
300 %token  RSA_PUBLIC_KEY_FILE
301 %token  SSL_CERTIFICATE_FILE
276   %token  RESV
277   %token  RESV_EXEMPT
278 < %token  SECONDS MINUTES HOURS DAYS WEEKS
279 < %token  SENDQ
278 > %token  RSA_PRIVATE_KEY_FILE
279 > %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
280   %token  SEND_PASSWORD
281 + %token  SENDQ
282   %token  SERVERHIDE
283   %token  SERVERINFO
309 %token  SERVLINK_PATH
310 %token  IRCD_SID
311 %token  TKLINE_EXPIRE_NOTICES
312 %token  T_SHARED
313 %token  T_CLUSTER
314 %token  TYPE
284   %token  SHORT_MOTD
316 %token  SILENT
285   %token  SPOOF
286   %token  SPOOF_NOTICE
287 + %token  SQUIT
288 + %token  SSL_CERTIFICATE_FILE
289 + %token  SSL_CERTIFICATE_FINGERPRINT
290 + %token  SSL_CONNECTION_REQUIRED
291 + %token  SSL_DH_ELLIPTIC_CURVE
292 + %token  SSL_DH_PARAM_FILE
293 + %token  SSL_MESSAGE_DIGEST_ALGORITHM
294 + %token  STANDARD
295   %token  STATS_E_DISABLED
296   %token  STATS_I_OPER_ONLY
297   %token  STATS_K_OPER_ONLY
298 + %token  STATS_M_OPER_ONLY
299   %token  STATS_O_OPER_ONLY
300   %token  STATS_P_OPER_ONLY
301 < %token  TBOOL
325 < %token  TMASKED
326 < %token  T_REJECT
327 < %token  TS_MAX_DELTA
328 < %token  TS_WARN_DELTA
329 < %token  TWODOTS
301 > %token  STATS_U_OPER_ONLY
302   %token  T_ALL
303   %token  T_BOTS
332 %token  T_SOFTCALLERID
304   %token  T_CALLERID
305   %token  T_CCONN
306 < %token  T_CLIENT_FLOOD
306 > %token  T_COMMAND
307 > %token  T_CLUSTER
308   %token  T_DEAF
309   %token  T_DEBUG
310 < %token  T_DRONE
310 > %token  T_DLINE
311   %token  T_EXTERNAL
312 + %token  T_FARCONNECT
313 + %token  T_FILE
314   %token  T_FULL
315 + %token  T_GLOBOPS
316   %token  T_INVISIBLE
317   %token  T_IPV4
318   %token  T_IPV6
319   %token  T_LOCOPS
320 < %token  T_LOGPATH
346 < %token  T_L_CRIT
347 < %token  T_L_DEBUG
348 < %token  T_L_ERROR
349 < %token  T_L_INFO
350 < %token  T_L_NOTICE
351 < %token  T_L_TRACE
352 < %token  T_L_WARN
353 < %token  T_MAX_CLIENTS
320 > %token  T_LOG
321   %token  T_NCHANGE
322 < %token  T_OPERWALL
322 > %token  T_NONONREG
323 > %token  T_OPME
324 > %token  T_PREPEND
325 > %token  T_PSEUDO
326 > %token  T_RECVQ
327   %token  T_REJ
328 + %token  T_RESTART
329 + %token  T_SERVER
330 + %token  T_SERVICE
331   %token  T_SERVNOTICE
332 + %token  T_SET
333 + %token  T_SHARED
334 + %token  T_SIZE
335   %token  T_SKILL
336 + %token  T_SOFTCALLERID
337   %token  T_SPY
338   %token  T_SSL
339 + %token  T_SSL_CIPHER_LIST
340 + %token  T_TARGET
341   %token  T_UMODES
342   %token  T_UNAUTH
343 + %token  T_UNDLINE
344 + %token  T_UNLIMITED
345   %token  T_UNRESV
346   %token  T_UNXLINE
347   %token  T_WALLOP
348 + %token  T_WALLOPS
349 + %token  T_WEBIRC
350 + %token  TBOOL
351 + %token  THROTTLE_COUNT
352   %token  THROTTLE_TIME
353 < %token  TOPICBURST
354 < %token  TRUE_NO_OPER_FLOOD
355 < %token  TKLINE
356 < %token  TXLINE
357 < %token  TRESV
353 > %token  TKLINE_EXPIRE_NOTICES
354 > %token  TMASKED
355 > %token  TS_MAX_DELTA
356 > %token  TS_WARN_DELTA
357 > %token  TWODOTS
358 > %token  TYPE
359   %token  UNKLINE
373 %token  USER
374 %token  USE_EGD
375 %token  USE_EXCEPT
376 %token  USE_INVEX
377 %token  USE_KNOCK
360   %token  USE_LOGGING
361 < %token  USE_WHOIS_ACTUALLY
361 > %token  USER
362   %token  VHOST
363   %token  VHOST6
364 + %token  WARN_NO_CONNECT_BLOCK
365 + %token  WHOIS
366 + %token  WHOWAS_HISTORY_LENGTH
367   %token  XLINE
368 < %token  WARN
384 < %token  WARN_NO_NLINE
368 > %token  XLINE_EXEMPT
369  
370 < %type <string> QSTRING
371 < %type <number> NUMBER
372 < %type <number> timespec
373 < %type <number> timespec_
374 < %type <number> sizespec
375 < %type <number> sizespec_
370 > %type  <string> QSTRING
371 > %type  <number> NUMBER
372 > %type  <number> timespec
373 > %type  <number> timespec_
374 > %type  <number> sizespec
375 > %type  <number> sizespec_
376  
377   %%
378 < conf:  
378 > conf:
379          | conf conf_item
380          ;
381  
382   conf_item:        admin_entry
383                  | logging_entry
384                  | oper_entry
385 <                | channel_entry
386 <                | class_entry
385 >                | channel_entry
386 >                | class_entry
387                  | listen_entry
388                  | auth_entry
389                  | serverinfo_entry
390 <                | serverhide_entry
390 >                | serverhide_entry
391                  | resv_entry
392 +                | service_entry
393                  | shared_entry
394 <                | cluster_entry
394 >                | cluster_entry
395                  | connect_entry
396                  | kill_entry
397                  | deny_entry
398 <                | exempt_entry
399 <                | general_entry
415 <                | gline_entry
398 >                | exempt_entry
399 >                | general_entry
400                  | gecos_entry
401                  | modules_entry
402 +                | motd_entry
403 +                | pseudo_entry
404                  | error ';'
405                  | error '}'
406          ;
407  
408  
409   timespec_: { $$ = 0; } | timespec;
410 < timespec:       NUMBER timespec_
411 <                {
412 <                        $$ = $1 + $2;
413 <                }
414 <                | NUMBER SECONDS timespec_
415 <                {
416 <                        $$ = $1 + $3;
417 <                }
418 <                | NUMBER MINUTES timespec_
419 <                {
420 <                        $$ = $1 * 60 + $3;
421 <                }
422 <                | NUMBER HOURS timespec_
423 <                {
424 <                        $$ = $1 * 60 * 60 + $3;
425 <                }
440 <                | NUMBER DAYS timespec_
441 <                {
442 <                        $$ = $1 * 60 * 60 * 24 + $3;
443 <                }
444 <                | NUMBER WEEKS timespec_
445 <                {
446 <                        $$ = $1 * 60 * 60 * 24 * 7 + $3;
447 <                }
448 <                ;
449 <
450 < sizespec_:      { $$ = 0; } | sizespec;
451 < sizespec:       NUMBER sizespec_ { $$ = $1 + $2; }
452 <                | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
453 <                | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
454 <                | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
455 <                ;
410 > timespec:  NUMBER timespec_         { $$ = $1 + $2; } |
411 >           NUMBER SECONDS timespec_ { $$ = $1 + $3; } |
412 >           NUMBER MINUTES timespec_ { $$ = $1 * 60 + $3; } |
413 >           NUMBER HOURS timespec_   { $$ = $1 * 60 * 60 + $3; } |
414 >           NUMBER DAYS timespec_    { $$ = $1 * 60 * 60 * 24 + $3; } |
415 >           NUMBER WEEKS timespec_   { $$ = $1 * 60 * 60 * 24 * 7 + $3; } |
416 >           NUMBER MONTHS timespec_  { $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3; } |
417 >           NUMBER YEARS timespec_   { $$ = $1 * 60 * 60 * 24 * 365 + $3; }
418 >           ;
419 >
420 > sizespec_:  { $$ = 0; } | sizespec;
421 > sizespec:   NUMBER sizespec_ { $$ = $1 + $2; } |
422 >            NUMBER BYTES sizespec_ { $$ = $1 + $3; } |
423 >            NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } |
424 >            NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
425 >            ;
426  
427  
428   /***************************************************************************
429 < *  section modules
429 > * modules {} section
430   ***************************************************************************/
431 < modules_entry: MODULES
462 <  '{' modules_items '}' ';';
431 > modules_entry: MODULES '{' modules_items '}' ';';
432  
433   modules_items:  modules_items modules_item | modules_item;
434   modules_item:   modules_module | modules_path | error ';' ;
435  
436   modules_module: MODULE '=' QSTRING ';'
437   {
438 < #ifndef STATIC_MODULES /* NOOP in the static case */
439 <  if (ypass == 2)
471 <  {
472 <    char *m_bn;
473 <
474 <    m_bn = basename(yylval.string);
475 <
476 <    /* I suppose we should just ignore it if it is already loaded(since
477 <     * otherwise we would flood the opers on rehash) -A1kmm.
478 <     */
479 <    add_conf_module(yylval.string);
480 <  }
481 < #endif
438 >  if (conf_parser_ctx.pass == 2)
439 >    add_conf_module(libio_basename(yylval.string));
440   };
441  
442   modules_path: PATH '=' QSTRING ';'
443   {
444 < #ifndef STATIC_MODULES
487 <  if (ypass == 2)
444 >  if (conf_parser_ctx.pass == 2)
445      mod_add_path(yylval.string);
489 #endif
446   };
447  
448 +
449   /***************************************************************************
450 < *  section serverinfo
450 > * serverinfo {}  section
451   ***************************************************************************/
452 < serverinfo_entry: SERVERINFO
453 <  '{' serverinfo_items '}' ';';
452 > serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
453 >
454 > serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
455 > serverinfo_item:        serverinfo_name |
456 >                        serverinfo_vhost |
457 >                        serverinfo_hub |
458 >                        serverinfo_description |
459 >                        serverinfo_network_name |
460 >                        serverinfo_network_desc |
461 >                        serverinfo_default_max_clients |
462 >                        serverinfo_max_nick_length |
463 >                        serverinfo_max_topic_length |
464 >                        serverinfo_ssl_dh_param_file |
465 >                        serverinfo_ssl_dh_elliptic_curve |
466 >                        serverinfo_rsa_private_key_file |
467 >                        serverinfo_vhost6 |
468 >                        serverinfo_sid |
469 >                        serverinfo_ssl_certificate_file |
470 >                        serverinfo_ssl_cipher_list |
471 >                        serverinfo_ssl_message_digest_algorithm |
472 >                        serverinfo_libgeoip_database_options |
473 >                        serverinfo_libgeoip_ipv4_database_file |
474 >                        serverinfo_libgeoip_ipv6_database_file |
475 >                        error ';' ;
476  
498 serverinfo_items:       serverinfo_items serverinfo_item |
499                        serverinfo_item ;
500 serverinfo_item:        serverinfo_name | serverinfo_vhost |
501                        serverinfo_hub | serverinfo_description |
502                        serverinfo_network_name | serverinfo_network_desc |
503                        serverinfo_max_clients |
504                        serverinfo_rsa_private_key_file | serverinfo_vhost6 |
505                        serverinfo_sid | serverinfo_ssl_certificate_file |
506                        error ';' ;
477  
478   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
479   {
480 < #ifdef HAVE_LIBCRYPTO
511 <  if (ypass == 2 && ServerInfo.ctx)
480 >  if (conf_parser_ctx.pass == 2)
481    {
482 <    if (!ServerInfo.rsa_private_key_file)
483 <    {
515 <      yyerror("No rsa_private_key_file specified, SSL disabled");
516 <      break;
517 <    }
518 <
519 <    if (SSL_CTX_use_certificate_file(ServerInfo.ctx,
520 <      yylval.string, SSL_FILETYPE_PEM) <= 0)
521 <    {
522 <      yyerror(ERR_lib_error_string(ERR_get_error()));
523 <      break;
524 <    }
525 <
526 <    if (SSL_CTX_use_PrivateKey_file(ServerInfo.ctx,
527 <      ServerInfo.rsa_private_key_file, SSL_FILETYPE_PEM) <= 0)
528 <    {
529 <      yyerror(ERR_lib_error_string(ERR_get_error()));
530 <      break;
531 <    }
532 <
533 <    if (!SSL_CTX_check_private_key(ServerInfo.ctx))
534 <    {
535 <      yyerror("RSA private key does not match the SSL certificate public key!");
536 <      break;
537 <    }
482 >    xfree(ConfigServerInfo.ssl_certificate_file);
483 >    ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string);
484    }
539 #endif
485   };
486  
487   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
488   {
489 < #ifdef HAVE_LIBCRYPTO
545 <  if (ypass == 1)
489 >  if (conf_parser_ctx.pass == 2)
490    {
491 <    BIO *file;
492 <
493 <    if (ServerInfo.rsa_private_key)
494 <    {
551 <      RSA_free(ServerInfo.rsa_private_key);
552 <      ServerInfo.rsa_private_key = NULL;
553 <    }
491 >    xfree(ConfigServerInfo.rsa_private_key_file);
492 >    ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
493 >  }
494 > };
495  
496 <    if (ServerInfo.rsa_private_key_file)
497 <    {
498 <      MyFree(ServerInfo.rsa_private_key_file);
499 <      ServerInfo.rsa_private_key_file = NULL;
500 <    }
496 > serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
497 > {
498 >  if (conf_parser_ctx.pass == 2)
499 >  {
500 >    xfree(ConfigServerInfo.ssl_dh_param_file);
501 >    ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string);
502 >  }
503 > };
504  
505 <    DupString(ServerInfo.rsa_private_key_file, yylval.string);
505 > serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
506 > {
507 >  if (conf_parser_ctx.pass == 2)
508 >  {
509 >    xfree(ConfigServerInfo.ssl_cipher_list);
510 >    ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string);
511 >  }
512 > };
513  
514 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
515 <    {
516 <      yyerror("File open failed, ignoring");
517 <      break;
518 <    }
514 > serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';'
515 > {
516 >  if (conf_parser_ctx.pass == 2)
517 >  {
518 >    xfree(ConfigServerInfo.ssl_message_digest_algorithm);
519 >    ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string);
520 >  }
521 > }
522  
523 <    ServerInfo.rsa_private_key = (RSA *)PEM_read_bio_RSAPrivateKey(file, NULL,
524 <      0, NULL);
523 > serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';'
524 > {
525 >  if (conf_parser_ctx.pass == 2)
526 >  {
527 >    xfree(ConfigServerInfo.ssl_dh_elliptic_curve);
528 >    ConfigServerInfo.ssl_dh_elliptic_curve = xstrdup(yylval.string);
529 >  }
530 > };
531  
532 <    BIO_set_close(file, BIO_CLOSE);
533 <    BIO_free(file);
532 > serverinfo_libgeoip_database_options: LIBGEOIP_DATABASE_OPTIONS
533 > {
534 >  if (conf_parser_ctx.pass == 1)
535 >    ConfigServerInfo.libgeoip_database_options = 0;
536 > } '='  options_items ';';
537  
538 <    if (ServerInfo.rsa_private_key == NULL)
539 <    {
540 <      yyerror("Couldn't extract key, ignoring");
541 <      break;
542 <    }
538 > options_items: options_items ',' options_item | options_item;
539 > options_item: STANDARD
540 > {
541 > #ifdef HAVE_LIBGEOIP
542 >  if (conf_parser_ctx.pass == 1)
543 >    ConfigServerInfo.libgeoip_database_options |= GEOIP_STANDARD;
544 > #endif
545 > } | MEMORY_CACHE
546 > {
547 > #ifdef HAVE_LIBGEOIP
548 >  if (conf_parser_ctx.pass == 1)
549 >    ConfigServerInfo.libgeoip_database_options |= GEOIP_MEMORY_CACHE;
550 > #endif
551 > } | MMAP_CACHE
552 > {
553 > #ifdef HAVE_LIBGEOIP
554 >  if (conf_parser_ctx.pass == 1)
555 >    ConfigServerInfo.libgeoip_database_options |= GEOIP_MMAP_CACHE;
556 > #endif
557 > } | CHECK_CACHE
558 > {
559 > #ifdef HAVE_LIBGEOIP
560 >  if (conf_parser_ctx.pass == 1)
561 >    ConfigServerInfo.libgeoip_database_options |= GEOIP_CHECK_CACHE;
562 > #endif
563 > };
564  
565 <    if (!RSA_check_key(ServerInfo.rsa_private_key))
566 <    {
567 <      RSA_free(ServerInfo.rsa_private_key);
568 <      ServerInfo.rsa_private_key = NULL;
565 > serverinfo_libgeoip_ipv4_database_file:  LIBGEOIP_IPV4_DATABASE_FILE '=' QSTRING ';'
566 > {
567 >  if (conf_parser_ctx.pass == 2)
568 >  {
569 >    xfree(ConfigServerInfo.libgeoip_ipv4_database_file);
570 >    ConfigServerInfo.libgeoip_ipv4_database_file = xstrdup(yylval.string);
571  
572 <      yyerror("Invalid key, ignoring");
573 <      break;
574 <    }
572 > #ifdef HAVE_LIBGEOIP
573 >    if (GeoIPv4_ctx)
574 >      GeoIP_delete(GeoIPv4_ctx);
575 >    GeoIPv4_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options);
576 > #endif
577 >  }
578 > };
579  
580 <    /* require 2048 bit (256 byte) key */
581 <    if (RSA_size(ServerInfo.rsa_private_key) != 256)
582 <    {
583 <      RSA_free(ServerInfo.rsa_private_key);
584 <      ServerInfo.rsa_private_key = NULL;
580 > serverinfo_libgeoip_ipv6_database_file:  LIBGEOIP_IPV6_DATABASE_FILE '=' QSTRING ';'
581 > {
582 >  if (conf_parser_ctx.pass == 2)
583 >  {
584 >    xfree(ConfigServerInfo.libgeoip_ipv6_database_file);
585 >    ConfigServerInfo.libgeoip_ipv6_database_file = xstrdup(yylval.string);
586  
587 <      yyerror("Not a 2048 bit key, ignoring");
588 <    }
589 <  }
587 > #ifdef HAVE_LIBGEOIP
588 >    if (GeoIPv6_ctx)
589 >      GeoIP_delete(GeoIPv6_ctx);
590 >    GeoIPv6_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options);
591   #endif
592 +  }
593   };
594  
595 < serverinfo_name: NAME '=' QSTRING ';'
595 > serverinfo_name: NAME '=' QSTRING ';'
596   {
597 <  /* this isn't rehashable */
598 <  if (ypass == 2)
597 >  /* This isn't rehashable */
598 >  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
599    {
600 <    if (ServerInfo.name == NULL)
600 >    if (valid_servname(yylval.string))
601 >      ConfigServerInfo.name = xstrdup(yylval.string);
602 >    else
603      {
604 <      /* the ircd will exit() in main() if we dont set one */
605 <      if (strlen(yylval.string) <= HOSTLEN)
611 <        DupString(ServerInfo.name, yylval.string);
604 >      conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting.");
605 >      exit(EXIT_FAILURE);
606      }
607    }
608   };
609  
610 < serverinfo_sid: IRCD_SID '=' QSTRING ';'
610 > serverinfo_sid: IRCD_SID '=' QSTRING ';'
611   {
612 <  /* this isn't rehashable */
613 <  if (ypass == 2 && !ServerInfo.sid)
612 >  /* This isn't rehashable */
613 >  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid)
614    {
615      if (valid_sid(yylval.string))
616 <      DupString(ServerInfo.sid, yylval.string);
616 >      ConfigServerInfo.sid = xstrdup(yylval.string);
617      else
618      {
619 <      ilog(L_ERROR, "Ignoring config file entry SID -- invalid SID. Aborting.");
620 <      exit(0);
619 >      conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting.");
620 >      exit(EXIT_FAILURE);
621      }
622    }
623   };
624  
625   serverinfo_description: DESCRIPTION '=' QSTRING ';'
626   {
627 <  if (ypass == 2)
627 >  if (conf_parser_ctx.pass == 2)
628    {
629 <    MyFree(ServerInfo.description);
630 <    DupString(ServerInfo.description,yylval.string);
629 >    xfree(ConfigServerInfo.description);
630 >    ConfigServerInfo.description = xstrdup(yylval.string);
631 >    strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info));
632    }
633   };
634  
635   serverinfo_network_name: NETWORK_NAME '=' QSTRING ';'
636   {
637 <  if (ypass == 2)
637 >  if (conf_parser_ctx.pass == 2)
638    {
639      char *p;
640  
641 <    if ((p = strchr(yylval.string, ' ')) != NULL)
642 <      p = '\0';
641 >    if ((p = strchr(yylval.string, ' ')))
642 >      *p = '\0';
643  
644 <    MyFree(ServerInfo.network_name);
645 <    DupString(ServerInfo.network_name, yylval.string);
644 >    xfree(ConfigServerInfo.network_name);
645 >    ConfigServerInfo.network_name = xstrdup(yylval.string);
646    }
647   };
648  
649   serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
650   {
651 <  if (ypass == 2)
652 <  {
653 <    MyFree(ServerInfo.network_desc);
654 <    DupString(ServerInfo.network_desc, yylval.string);
655 <  }
651 >  if (conf_parser_ctx.pass != 2)
652 >    break;
653 >
654 >  xfree(ConfigServerInfo.network_desc);
655 >  ConfigServerInfo.network_desc = xstrdup(yylval.string);
656   };
657  
658   serverinfo_vhost: VHOST '=' QSTRING ';'
659   {
660 <  if (ypass == 2 && *yylval.string != '*')
660 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
661    {
662      struct addrinfo hints, *res;
663  
# Line 672 | Line 667 | serverinfo_vhost: VHOST '=' QSTRING ';'
667      hints.ai_socktype = SOCK_STREAM;
668      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
669  
670 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
671 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
670 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
671 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
672      else
673      {
674 <      assert(res != NULL);
674 >      assert(res);
675  
676 <      memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen);
677 <      ServerInfo.ip.ss.ss_family = res->ai_family;
678 <      ServerInfo.ip.ss_len = res->ai_addrlen;
679 <      irc_freeaddrinfo(res);
676 >      memcpy(&ConfigServerInfo.ip, res->ai_addr, res->ai_addrlen);
677 >      ConfigServerInfo.ip.ss.ss_family = res->ai_family;
678 >      ConfigServerInfo.ip.ss_len = res->ai_addrlen;
679 >      freeaddrinfo(res);
680  
681 <      ServerInfo.specific_ipv4_vhost = 1;
681 >      ConfigServerInfo.specific_ipv4_vhost = 1;
682      }
683    }
684   };
685  
686   serverinfo_vhost6: VHOST6 '=' QSTRING ';'
687   {
688 < #ifdef IPV6
694 <  if (ypass == 2 && *yylval.string != '*')
688 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
689    {
690      struct addrinfo hints, *res;
691  
# Line 701 | Line 695 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
695      hints.ai_socktype = SOCK_STREAM;
696      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
697  
698 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
699 <      ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string);
698 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
699 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
700      else
701      {
702 <      assert(res != NULL);
702 >      assert(res);
703  
704 <      memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen);
705 <      ServerInfo.ip6.ss.ss_family = res->ai_family;
706 <      ServerInfo.ip6.ss_len = res->ai_addrlen;
707 <      irc_freeaddrinfo(res);
704 >      memcpy(&ConfigServerInfo.ip6, res->ai_addr, res->ai_addrlen);
705 >      ConfigServerInfo.ip6.ss.ss_family = res->ai_family;
706 >      ConfigServerInfo.ip6.ss_len = res->ai_addrlen;
707 >      freeaddrinfo(res);
708  
709 <      ServerInfo.specific_ipv6_vhost = 1;
709 >      ConfigServerInfo.specific_ipv6_vhost = 1;
710      }
711    }
718 #endif
712   };
713  
714 < serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
714 > serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';'
715   {
716 <  if (ypass == 2)
716 >  if (conf_parser_ctx.pass != 2)
717 >    break;
718 >
719 >  if ($3 < MAXCLIENTS_MIN)
720    {
721 <    recalc_fdlimit(NULL);
721 >    char buf[IRCD_BUFSIZE] = "";
722  
723 <    if ($3 < MAXCLIENTS_MIN)
724 <    {
725 <      char buf[IRCD_BUFSIZE];
726 <      ircsprintf(buf, "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
727 <      yyerror(buf);
728 <    }
729 <    else if ($3 > MAXCLIENTS_MAX)
730 <    {
731 <      char buf[IRCD_BUFSIZE];
732 <      ircsprintf(buf, "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
733 <      yyerror(buf);
738 <    }
739 <    else
740 <      ServerInfo.max_clients = $3;
723 >    snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
724 >    conf_error_report(buf);
725 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN;
726 >  }
727 >  else if ($3 > MAXCLIENTS_MAX)
728 >  {
729 >    char buf[IRCD_BUFSIZE] = "";
730 >
731 >    snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
732 >    conf_error_report(buf);
733 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
734    }
735 +  else
736 +    ConfigServerInfo.default_max_clients = $3;
737   };
738  
739 < serverinfo_hub: HUB '=' TBOOL ';'
739 > serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';'
740   {
741 <  if (ypass == 2)
741 >  if (conf_parser_ctx.pass != 2)
742 >    break;
743 >
744 >  if ($3 < 9)
745    {
746 <    if (yylval.number)
747 <    {
748 <      /* Don't become a hub if we have a lazylink active. */
749 <      if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL))
750 <      {
751 <        sendto_realops_flags(UMODE_ALL, L_ALL,
752 <                             "Ignoring config file line hub=yes; "
753 <                             "due to active LazyLink (%s)", uplink->name);
754 <      }
755 <      else
756 <      {
757 <        ServerInfo.hub = 1;
758 <        uplink = NULL;
759 <        delete_capability("HUB");
762 <        add_capability("HUB", CAP_HUB, 1);
763 <      }
764 <    }
765 <    else if (ServerInfo.hub)
766 <    {
767 <      dlink_node *ptr = NULL;
746 >    conf_error_report("max_nick_length too low, setting to 9");
747 >    ConfigServerInfo.max_nick_length = 9;
748 >  }
749 >  else if ($3 > NICKLEN)
750 >  {
751 >    char buf[IRCD_BUFSIZE] = "";
752 >
753 >    snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN);
754 >    conf_error_report(buf);
755 >    ConfigServerInfo.max_nick_length = NICKLEN;
756 >  }
757 >  else
758 >    ConfigServerInfo.max_nick_length = $3;
759 > };
760  
761 <      ServerInfo.hub = 0;
762 <      delete_capability("HUB");
761 > serverinfo_max_topic_length: MAX_TOPIC_LENGTH '=' NUMBER ';'
762 > {
763 >  if (conf_parser_ctx.pass != 2)
764 >    break;
765  
766 <      /* Don't become a leaf if we have a lazylink active. */
767 <      DLINK_FOREACH(ptr, serv_list.head)
768 <      {
769 <        const struct Client *acptr = ptr->data;
776 <        if (MyConnect(acptr) && IsCapable(acptr, CAP_LL))
777 <        {
778 <          sendto_realops_flags(UMODE_ALL, L_ALL,
779 <                               "Ignoring config file line hub=no; "
780 <                               "due to active LazyLink (%s)",
781 <                               acptr->name);
782 <          add_capability("HUB", CAP_HUB, 1);
783 <          ServerInfo.hub = 1;
784 <          break;
785 <        }
786 <      }
787 <    }
766 >  if ($3 < 80)
767 >  {
768 >    conf_error_report("max_topic_length too low, setting to 80");
769 >    ConfigServerInfo.max_topic_length = 80;
770    }
771 +  else if ($3 > TOPICLEN)
772 +  {
773 +    char buf[IRCD_BUFSIZE] = "";
774 +
775 +    snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN);
776 +    conf_error_report(buf);
777 +    ConfigServerInfo.max_topic_length = TOPICLEN;
778 +  }
779 +  else
780 +    ConfigServerInfo.max_topic_length = $3;
781   };
782  
783 + serverinfo_hub: HUB '=' TBOOL ';'
784 + {
785 +  if (conf_parser_ctx.pass == 2)
786 +    ConfigServerInfo.hub = yylval.number;
787 + };
788 +
789 +
790   /***************************************************************************
791 < * admin section
791 > * admin {} section
792   ***************************************************************************/
793   admin_entry: ADMIN  '{' admin_items '}' ';' ;
794  
795   admin_items: admin_items admin_item | admin_item;
796 < admin_item:  admin_name | admin_description |
797 <             admin_email | error ';' ;
796 > admin_item:  admin_name |
797 >             admin_description |
798 >             admin_email |
799 >             error ';' ;
800  
801 < admin_name: NAME '=' QSTRING ';'
801 > admin_name: NAME '=' QSTRING ';'
802   {
803 <  if (ypass == 2)
804 <  {
805 <    MyFree(AdminInfo.name);
806 <    DupString(AdminInfo.name, yylval.string);
807 <  }
803 >  if (conf_parser_ctx.pass != 2)
804 >    break;
805 >
806 >  xfree(ConfigAdminInfo.name);
807 >  ConfigAdminInfo.name = xstrdup(yylval.string);
808   };
809  
810   admin_email: EMAIL '=' QSTRING ';'
811   {
812 <  if (ypass == 2)
813 <  {
814 <    MyFree(AdminInfo.email);
815 <    DupString(AdminInfo.email, yylval.string);
816 <  }
812 >  if (conf_parser_ctx.pass != 2)
813 >    break;
814 >
815 >  xfree(ConfigAdminInfo.email);
816 >  ConfigAdminInfo.email = xstrdup(yylval.string);
817   };
818  
819   admin_description: DESCRIPTION '=' QSTRING ';'
820   {
821 <  if (ypass == 2)
822 <  {
823 <    MyFree(AdminInfo.description);
824 <    DupString(AdminInfo.description, yylval.string);
825 <  }
821 >  if (conf_parser_ctx.pass != 2)
822 >    break;
823 >
824 >  xfree(ConfigAdminInfo.description);
825 >  ConfigAdminInfo.description = xstrdup(yylval.string);
826   };
827  
828 +
829   /***************************************************************************
830 < *  section logging
830 > * motd {} section
831   ***************************************************************************/
832 < /* XXX */
833 < logging_entry:          LOGGING  '{' logging_items '}' ';' ;
832 > motd_entry: MOTD
833 > {
834 >  if (conf_parser_ctx.pass == 2)
835 >    reset_block_state();
836 > } '{' motd_items '}' ';'
837 > {
838 >  dlink_node *node = NULL;
839  
840 < logging_items:          logging_items logging_item |
841 <                        logging_item ;
840 >  if (conf_parser_ctx.pass != 2)
841 >    break;
842  
843 < logging_item:           logging_path | logging_oper_log |
844 <                        logging_log_level |
838 <                        logging_use_logging | logging_fuserlog |
839 <                        logging_foperlog | logging_fglinelog |
840 <                        logging_fklinelog | logging_killlog |
841 <                        logging_foperspylog | logging_ioerrlog |
842 <                        logging_ffailed_operlog |
843 <                        error ';' ;
843 >  if (!block_state.file.buf[0])
844 >    break;
845  
846 < logging_path:           T_LOGPATH '=' QSTRING ';'
847 <                        {
848 <                        };
846 >  DLINK_FOREACH(node, block_state.mask.list.head)
847 >    motd_add(node->data, block_state.file.buf);
848 > };
849  
850 < logging_oper_log:       OPER_LOG '=' QSTRING ';'
851 <                        {
851 <                        };
850 > motd_items: motd_items motd_item | motd_item;
851 > motd_item:  motd_mask | motd_file | error ';' ;
852  
853 < logging_fuserlog: FUSERLOG '=' QSTRING ';'
853 > motd_mask: MASK '=' QSTRING ';'
854   {
855 <  if (ypass == 2)
856 <    strlcpy(ConfigLoggingEntry.userlog, yylval.string,
857 <            sizeof(ConfigLoggingEntry.userlog));
855 >  if (conf_parser_ctx.pass == 2)
856 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
857   };
858  
859 < logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
859 > motd_file: T_FILE '=' QSTRING ';'
860   {
861 <  if (ypass == 2)
862 <    strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
864 <            sizeof(ConfigLoggingEntry.failed_operlog));
861 >  if (conf_parser_ctx.pass == 2)
862 >    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
863   };
864  
865 < logging_foperlog: FOPERLOG '=' QSTRING ';'
865 >
866 > /***************************************************************************
867 > * pseudo {} section
868 > ***************************************************************************/
869 > pseudo_entry: T_PSEUDO
870 > {
871 >  if (conf_parser_ctx.pass == 2)
872 >    reset_block_state();
873 > } '{' pseudo_items '}' ';'
874   {
875 <  if (ypass == 2)
876 <    strlcpy(ConfigLoggingEntry.operlog, yylval.string,
877 <            sizeof(ConfigLoggingEntry.operlog));
875 >  if (conf_parser_ctx.pass != 2)
876 >    break;
877 >
878 >  if (!block_state.command.buf[0] ||
879 >      !block_state.name.buf[0] ||
880 >      !block_state.nick.buf[0] ||
881 >      !block_state.host.buf[0])
882 >    break;
883 >
884 >  pseudo_register(block_state.name.buf, block_state.nick.buf, block_state.host.buf,
885 >                  block_state.prepend.buf, block_state.command.buf);
886   };
887  
888 < logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
888 > pseudo_items: pseudo_items pseudo_item | pseudo_item;
889 > pseudo_item:  pseudo_command | pseudo_prepend | pseudo_name | pseudo_target | error ';' ;
890 >
891 > pseudo_command: T_COMMAND '=' QSTRING ';'
892   {
893 <  if (ypass == 2)
894 <    strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
878 <            sizeof(ConfigLoggingEntry.operspylog));
893 >  if (conf_parser_ctx.pass == 2)
894 >    strlcpy(block_state.command.buf, yylval.string, sizeof(block_state.command.buf));
895   };
896  
897 < logging_fglinelog: FGLINELOG '=' QSTRING ';'
897 > pseudo_name: NAME '=' QSTRING ';'
898   {
899 <  if (ypass == 2)
900 <    strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
885 <            sizeof(ConfigLoggingEntry.glinelog));
899 >  if (conf_parser_ctx.pass == 2)
900 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
901   };
902  
903 < logging_fklinelog: FKLINELOG '=' QSTRING ';'
903 > pseudo_prepend: T_PREPEND '=' QSTRING ';'
904   {
905 <  if (ypass == 2)
906 <    strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
892 <            sizeof(ConfigLoggingEntry.klinelog));
905 >  if (conf_parser_ctx.pass == 2)
906 >    strlcpy(block_state.prepend.buf, yylval.string, sizeof(block_state.prepend.buf));
907   };
908  
909 < logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
909 > pseudo_target: T_TARGET '=' QSTRING ';'
910   {
911 <  if (ypass == 2)
912 <    strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
913 <            sizeof(ConfigLoggingEntry.ioerrlog));
911 >  if (conf_parser_ctx.pass == 2)
912 >  {
913 >    struct split_nuh_item nuh;
914 >
915 >    nuh.nuhmask  = yylval.string;
916 >    nuh.nickptr  = NULL;
917 >    nuh.userptr  = block_state.nick.buf;
918 >    nuh.hostptr  = block_state.host.buf;
919 >    nuh.nicksize = 0;
920 >    nuh.usersize = sizeof(block_state.nick.buf);
921 >    nuh.hostsize = sizeof(block_state.host.buf);
922 >
923 >    split_nuh(&nuh);
924 >  }
925   };
926  
927 < logging_killlog: FKILLLOG '=' QSTRING ';'
927 >
928 > /***************************************************************************
929 > * log {} section
930 > ***************************************************************************/
931 > logging_entry:          T_LOG  '{' logging_items '}' ';' ;
932 > logging_items:          logging_items logging_item | logging_item ;
933 >
934 > logging_item:           logging_use_logging | logging_file_entry |
935 >                        error ';' ;
936 >
937 > logging_use_logging: USE_LOGGING '=' TBOOL ';'
938   {
939 <  if (ypass == 2)
940 <    strlcpy(ConfigLoggingEntry.killlog, yylval.string,
906 <            sizeof(ConfigLoggingEntry.killlog));
939 >  if (conf_parser_ctx.pass == 2)
940 >    ConfigLog.use_logging = yylval.number;
941   };
942  
943 < logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
910 < {
911 <  if (ypass == 2)
912 <    set_log_level(L_CRIT);
913 < } | LOG_LEVEL '=' T_L_ERROR ';'
914 < {
915 <  if (ypass == 2)
916 <    set_log_level(L_ERROR);
917 < } | LOG_LEVEL '=' T_L_WARN ';'
943 > logging_file_entry:
944   {
945 <  if (ypass == 2)
946 <    set_log_level(L_WARN);
947 < } | LOG_LEVEL '=' T_L_NOTICE ';'
945 >  if (conf_parser_ctx.pass == 2)
946 >    reset_block_state();
947 > } T_FILE  '{' logging_file_items '}' ';'
948   {
949 <  if (ypass == 2)
950 <    set_log_level(L_NOTICE);
951 < } | LOG_LEVEL '=' T_L_TRACE ';'
949 >  if (conf_parser_ctx.pass != 2)
950 >    break;
951 >
952 >  if (block_state.type.value && block_state.file.buf[0])
953 >    log_set_file(block_state.type.value, block_state.size.value,
954 >                 block_state.file.buf);
955 > };
956 >
957 > logging_file_items: logging_file_items logging_file_item |
958 >                    logging_file_item ;
959 >
960 > logging_file_item:  logging_file_name | logging_file_type |
961 >                    logging_file_size | error ';' ;
962 >
963 > logging_file_name: NAME '=' QSTRING ';'
964   {
965 <  if (ypass == 2)
966 <    set_log_level(L_TRACE);
967 < } | LOG_LEVEL '=' T_L_INFO ';'
965 >  if (conf_parser_ctx.pass != 2)
966 >    break;
967 >
968 >  strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
969 > }
970 >
971 > logging_file_size: T_SIZE '=' sizespec ';'
972   {
973 <  if (ypass == 2)
974 <    set_log_level(L_INFO);
933 < } | LOG_LEVEL '=' T_L_DEBUG ';'
973 >  block_state.size.value = $3;
974 > } | T_SIZE '=' T_UNLIMITED ';'
975   {
976 <  if (ypass == 2)
936 <    set_log_level(L_DEBUG);
976 >  block_state.size.value = 0;
977   };
978  
979 < logging_use_logging: USE_LOGGING '=' TBOOL ';'
979 > logging_file_type: TYPE
980   {
981 <  if (ypass == 2)
982 <    ConfigLoggingEntry.use_logging = yylval.number;
981 >  if (conf_parser_ctx.pass == 2)
982 >    block_state.type.value = 0;
983 > } '='  logging_file_type_items ';' ;
984 >
985 > logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
986 > logging_file_type_item:  USER
987 > {
988 >  if (conf_parser_ctx.pass == 2)
989 >    block_state.type.value = LOG_TYPE_USER;
990 > } | OPERATOR
991 > {
992 >  if (conf_parser_ctx.pass == 2)
993 >    block_state.type.value = LOG_TYPE_OPER;
994 > } | XLINE
995 > {
996 >  if (conf_parser_ctx.pass == 2)
997 >    block_state.type.value = LOG_TYPE_XLINE;
998 > } | RESV
999 > {
1000 >  if (conf_parser_ctx.pass == 2)
1001 >    block_state.type.value = LOG_TYPE_RESV;
1002 > } | T_DLINE
1003 > {
1004 >  if (conf_parser_ctx.pass == 2)
1005 >    block_state.type.value = LOG_TYPE_DLINE;
1006 > } | KLINE
1007 > {
1008 >  if (conf_parser_ctx.pass == 2)
1009 >    block_state.type.value = LOG_TYPE_KLINE;
1010 > } | KILL
1011 > {
1012 >  if (conf_parser_ctx.pass == 2)
1013 >    block_state.type.value = LOG_TYPE_KILL;
1014 > } | T_DEBUG
1015 > {
1016 >  if (conf_parser_ctx.pass == 2)
1017 >    block_state.type.value = LOG_TYPE_DEBUG;
1018   };
1019  
1020 +
1021   /***************************************************************************
1022 < * section oper
1022 > * operator {} section
1023   ***************************************************************************/
1024 < oper_entry: OPERATOR
1024 > oper_entry: OPERATOR
1025   {
1026 <  if (ypass == 2)
1027 <  {
1028 <    yy_conf = make_conf_item(OPER_TYPE);
1029 <    yy_aconf = map_to_conf(yy_conf);
1030 <    SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */
1031 <  }
956 <  else
957 <  {
958 <    MyFree(class_name);
959 <    class_name = NULL;
960 <  }
961 < } oper_name_b '{' oper_items '}' ';'
1026 >  if (conf_parser_ctx.pass != 2)
1027 >    break;
1028 >
1029 >  reset_block_state();
1030 >  block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1031 > } '{' oper_items '}' ';'
1032   {
1033 <  if (ypass == 2)
964 <  {
965 <    struct CollectItem *yy_tmp;
966 <    dlink_node *ptr;
967 <    dlink_node *next_ptr;
1033 >  dlink_node *node = NULL;
1034  
1035 <    conf_add_class_to_conf(yy_conf, class_name);
1035 >  if (conf_parser_ctx.pass != 2)
1036 >    break;
1037  
1038 <    /* Now, make sure there is a copy of the "base" given oper
1039 <     * block in each of the collected copies
973 <     */
1038 >  if (!block_state.name.buf[0])
1039 >    break;
1040  
1041 <    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
1042 <    {
977 <      struct AccessItem *new_aconf;
978 <      struct ConfItem *new_conf;
979 <      yy_tmp = ptr->data;
980 <
981 <      new_conf = make_conf_item(OPER_TYPE);
982 <      new_aconf = (struct AccessItem *)map_to_conf(new_conf);
983 <
984 <      new_aconf->flags = yy_aconf->flags;
985 <
986 <      if (yy_conf->name != NULL)
987 <        DupString(new_conf->name, yy_conf->name);
988 <      if (yy_tmp->user != NULL)
989 <        DupString(new_aconf->user, yy_tmp->user);
990 <      else
991 <        DupString(new_aconf->user, "*");
992 <      if (yy_tmp->host != NULL)
993 <        DupString(new_aconf->host, yy_tmp->host);
994 <      else
995 <        DupString(new_aconf->host, "*");
996 <      conf_add_class_to_conf(new_conf, class_name);
997 <      if (yy_aconf->passwd != NULL)
998 <        DupString(new_aconf->passwd, yy_aconf->passwd);
999 <
1000 <      new_aconf->port = yy_aconf->port;
1001 < #ifdef HAVE_LIBCRYPTO
1002 <      if (yy_aconf->rsa_public_key_file != NULL)
1003 <      {
1004 <        BIO *file;
1005 <
1006 <        DupString(new_aconf->rsa_public_key_file,
1007 <                  yy_aconf->rsa_public_key_file);
1008 <
1009 <        file = BIO_new_file(yy_aconf->rsa_public_key_file, "r");
1010 <        new_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file,
1011 <                                                           NULL, 0, NULL);
1012 <        BIO_set_close(file, BIO_CLOSE);
1013 <        BIO_free(file);
1014 <      }
1015 < #endif
1041 >  if (!block_state.rpass.buf[0])
1042 >    break;
1043  
1044 < #ifdef HAVE_LIBCRYPTO
1045 <      if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key)
1046 <          && yy_tmp->host)
1047 < #else
1048 <      if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host)
1022 < #endif
1023 <      {
1024 <        conf_add_class_to_conf(new_conf, class_name);
1025 <        if (yy_tmp->name != NULL)
1026 <          DupString(new_conf->name, yy_tmp->name);
1027 <      }
1044 >  DLINK_FOREACH(node, block_state.mask.list.head)
1045 >  {
1046 >    struct MaskItem *conf = NULL;
1047 >    struct split_nuh_item nuh;
1048 >    char *s = node->data;
1049  
1050 <      dlinkDelete(&yy_tmp->node, &col_conf_list);
1051 <      free_collect_item(yy_tmp);
1031 <    }
1050 >    if (EmptyString(s))
1051 >      continue;
1052  
1053 <    yy_conf = NULL;
1054 <    yy_aconf = NULL;
1053 >    nuh.nuhmask  = s;
1054 >    nuh.nickptr  = NULL;
1055 >    nuh.userptr  = block_state.user.buf;
1056 >    nuh.hostptr  = block_state.host.buf;
1057 >    nuh.nicksize = 0;
1058 >    nuh.usersize = sizeof(block_state.user.buf);
1059 >    nuh.hostsize = sizeof(block_state.host.buf);
1060 >    split_nuh(&nuh);
1061  
1062 +    conf         = conf_make(CONF_OPER);
1063 +    conf->name   = xstrdup(block_state.name.buf);
1064 +    conf->user   = xstrdup(block_state.user.buf);
1065 +    conf->host   = xstrdup(block_state.host.buf);
1066 +
1067 +    if (block_state.cert.buf[0])
1068 +      conf->certfp = xstrdup(block_state.cert.buf);
1069 +
1070 +    if (block_state.rpass.buf[0])
1071 +      conf->passwd = xstrdup(block_state.rpass.buf);
1072 +
1073 +    if (block_state.whois.buf[0])
1074 +      conf->whois = xstrdup(block_state.whois.buf);
1075 +
1076 +    conf->flags = block_state.flags.value;
1077 +    conf->modes = block_state.modes.value;
1078 +    conf->port  = block_state.port.value;
1079 +    conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits);
1080  
1081 <    MyFree(class_name);
1038 <    class_name = NULL;
1081 >    conf_add_class_to_conf(conf, block_state.class.buf);
1082    }
1083 < };
1083 > };
1084  
1042 oper_name_b: | oper_name_t;
1085   oper_items:     oper_items oper_item | oper_item;
1086 < oper_item:      oper_name | oper_user | oper_password | oper_hidden_admin |
1087 <                oper_hidden_oper | oper_umodes |
1088 <                oper_class | oper_global_kill | oper_remote |
1089 <                oper_kline | oper_xline | oper_unkline |
1090 <                oper_gline | oper_nick_changes | oper_remoteban |
1091 <                oper_die | oper_rehash | oper_admin | oper_operwall |
1092 <                oper_encrypted | oper_rsa_public_key_file |
1093 <                oper_flags | error ';' ;
1086 > oper_item:      oper_name |
1087 >                oper_user |
1088 >                oper_password |
1089 >                oper_whois |
1090 >                oper_umodes |
1091 >                oper_class |
1092 >                oper_encrypted |
1093 >                oper_ssl_certificate_fingerprint |
1094 >                oper_ssl_connection_required |
1095 >                oper_flags |
1096 >                error ';' ;
1097  
1098   oper_name: NAME '=' QSTRING ';'
1099   {
1100 <  if (ypass == 2)
1101 <  {
1057 <    if (strlen(yylval.string) > OPERNICKLEN)
1058 <      yylval.string[OPERNICKLEN] = '\0';
1059 <
1060 <    MyFree(yy_conf->name);
1061 <    DupString(yy_conf->name, yylval.string);
1062 <  }
1063 < };
1064 <
1065 < oper_name_t: QSTRING
1066 < {
1067 <  if (ypass == 2)
1068 <  {
1069 <    if (strlen(yylval.string) > OPERNICKLEN)
1070 <      yylval.string[OPERNICKLEN] = '\0';
1071 <
1072 <    MyFree(yy_conf->name);
1073 <    DupString(yy_conf->name, yylval.string);
1074 <  }
1100 >  if (conf_parser_ctx.pass == 2)
1101 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1102   };
1103  
1104   oper_user: USER '=' QSTRING ';'
1105   {
1106 <  if (ypass == 2)
1107 <  {
1081 <    struct split_nuh_item nuh;
1082 <
1083 <    nuh.nuhmask  = yylval.string;
1084 <    nuh.nickptr  = NULL;
1085 <    nuh.userptr  = userbuf;
1086 <    nuh.hostptr  = hostbuf;
1087 <
1088 <    nuh.nicksize = 0;
1089 <    nuh.usersize = sizeof(userbuf);
1090 <    nuh.hostsize = sizeof(hostbuf);
1091 <
1092 <    split_nuh(&nuh);
1093 <
1094 <    if (yy_aconf->user == NULL)
1095 <    {
1096 <      DupString(yy_aconf->user, userbuf);
1097 <      DupString(yy_aconf->host, hostbuf);
1098 <    }
1099 <    else
1100 <    {
1101 <      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1102 <
1103 <      DupString(yy_tmp->user, userbuf);
1104 <      DupString(yy_tmp->host, hostbuf);
1105 <
1106 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1107 <    }
1108 <  }
1106 >  if (conf_parser_ctx.pass == 2)
1107 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1108   };
1109  
1110   oper_password: PASSWORD '=' QSTRING ';'
1111   {
1112 <  if (ypass == 2)
1113 <  {
1115 <    if (yy_aconf->passwd != NULL)
1116 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1117 <
1118 <    MyFree(yy_aconf->passwd);
1119 <    DupString(yy_aconf->passwd, yylval.string);
1120 <  }
1112 >  if (conf_parser_ctx.pass == 2)
1113 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1114   };
1115  
1116 < oper_encrypted: ENCRYPTED '=' TBOOL ';'
1116 > oper_whois: WHOIS '=' QSTRING ';'
1117   {
1118 <  if (ypass == 2)
1119 <  {
1127 <    if (yylval.number)
1128 <      SetConfEncrypted(yy_aconf);
1129 <    else
1130 <      ClearConfEncrypted(yy_aconf);
1131 <  }
1118 >  if (conf_parser_ctx.pass == 2)
1119 >    strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf));
1120   };
1121  
1122 < oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1122 > oper_encrypted: ENCRYPTED '=' TBOOL ';'
1123   {
1124 < #ifdef HAVE_LIBCRYPTO
1125 <  if (ypass == 2)
1138 <  {
1139 <    BIO *file;
1140 <
1141 <    if (yy_aconf->rsa_public_key != NULL)
1142 <    {
1143 <      RSA_free(yy_aconf->rsa_public_key);
1144 <      yy_aconf->rsa_public_key = NULL;
1145 <    }
1146 <
1147 <    if (yy_aconf->rsa_public_key_file != NULL)
1148 <    {
1149 <      MyFree(yy_aconf->rsa_public_key_file);
1150 <      yy_aconf->rsa_public_key_file = NULL;
1151 <    }
1152 <
1153 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
1154 <    file = BIO_new_file(yylval.string, "r");
1124 >  if (conf_parser_ctx.pass != 2)
1125 >    break;
1126  
1127 <    if (file == NULL)
1128 <    {
1129 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
1130 <      break;
1131 <    }
1127 >  if (yylval.number)
1128 >    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1129 >  else
1130 >    block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1131 > };
1132  
1133 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
1133 > oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1134 > {
1135 >  if (conf_parser_ctx.pass == 2)
1136 >    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1137 > };
1138  
1139 <    if (yy_aconf->rsa_public_key == NULL)
1140 <    {
1141 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
1142 <      break;
1168 <    }
1139 > oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1140 > {
1141 >  if (conf_parser_ctx.pass != 2)
1142 >    break;
1143  
1144 <    BIO_set_close(file, BIO_CLOSE);
1145 <    BIO_free(file);
1146 <  }
1147 < #endif /* HAVE_LIBCRYPTO */
1144 >  if (yylval.number)
1145 >    block_state.flags.value |= CONF_FLAGS_SSL;
1146 >  else
1147 >    block_state.flags.value &= ~CONF_FLAGS_SSL;
1148   };
1149  
1150   oper_class: CLASS '=' QSTRING ';'
1151   {
1152 <  if (ypass == 2)
1153 <  {
1180 <    MyFree(class_name);
1181 <    DupString(class_name, yylval.string);
1182 <  }
1152 >  if (conf_parser_ctx.pass == 2)
1153 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1154   };
1155  
1156   oper_umodes: T_UMODES
1157   {
1158 <  if (ypass == 2)
1159 <    yy_aconf->modes = 0;
1158 >  if (conf_parser_ctx.pass == 2)
1159 >    block_state.modes.value = 0;
1160   } '='  oper_umodes_items ';' ;
1161  
1162   oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1163   oper_umodes_item:  T_BOTS
1164   {
1165 <  if (ypass == 2)
1166 <    yy_aconf->modes |= UMODE_BOTS;
1165 >  if (conf_parser_ctx.pass == 2)
1166 >    block_state.modes.value |= UMODE_BOTS;
1167   } | T_CCONN
1168   {
1169 <  if (ypass == 2)
1170 <    yy_aconf->modes |= UMODE_CCONN;
1169 >  if (conf_parser_ctx.pass == 2)
1170 >    block_state.modes.value |= UMODE_CCONN;
1171   } | T_DEAF
1172   {
1173 <  if (ypass == 2)
1174 <    yy_aconf->modes |= UMODE_DEAF;
1173 >  if (conf_parser_ctx.pass == 2)
1174 >    block_state.modes.value |= UMODE_DEAF;
1175   } | T_DEBUG
1176   {
1177 <  if (ypass == 2)
1178 <    yy_aconf->modes |= UMODE_DEBUG;
1177 >  if (conf_parser_ctx.pass == 2)
1178 >    block_state.modes.value |= UMODE_DEBUG;
1179   } | T_FULL
1180   {
1181 <  if (ypass == 2)
1182 <    yy_aconf->modes |= UMODE_FULL;
1181 >  if (conf_parser_ctx.pass == 2)
1182 >    block_state.modes.value |= UMODE_FULL;
1183 > } | HIDDEN
1184 > {
1185 >  if (conf_parser_ctx.pass == 2)
1186 >    block_state.modes.value |= UMODE_HIDDEN;
1187 > } | HIDE_CHANS
1188 > {
1189 >  if (conf_parser_ctx.pass == 2)
1190 >    block_state.modes.value |= UMODE_HIDECHANS;
1191 > } | HIDE_IDLE
1192 > {
1193 >  if (conf_parser_ctx.pass == 2)
1194 >    block_state.modes.value |= UMODE_HIDEIDLE;
1195   } | T_SKILL
1196   {
1197 <  if (ypass == 2)
1198 <    yy_aconf->modes |= UMODE_SKILL;
1197 >  if (conf_parser_ctx.pass == 2)
1198 >    block_state.modes.value |= UMODE_SKILL;
1199   } | T_NCHANGE
1200   {
1201 <  if (ypass == 2)
1202 <    yy_aconf->modes |= UMODE_NCHANGE;
1201 >  if (conf_parser_ctx.pass == 2)
1202 >    block_state.modes.value |= UMODE_NCHANGE;
1203   } | T_REJ
1204   {
1205 <  if (ypass == 2)
1206 <    yy_aconf->modes |= UMODE_REJ;
1205 >  if (conf_parser_ctx.pass == 2)
1206 >    block_state.modes.value |= UMODE_REJ;
1207   } | T_UNAUTH
1208   {
1209 <  if (ypass == 2)
1210 <    yy_aconf->modes |= UMODE_UNAUTH;
1209 >  if (conf_parser_ctx.pass == 2)
1210 >    block_state.modes.value |= UMODE_UNAUTH;
1211   } | T_SPY
1212   {
1213 <  if (ypass == 2)
1214 <    yy_aconf->modes |= UMODE_SPY;
1213 >  if (conf_parser_ctx.pass == 2)
1214 >    block_state.modes.value |= UMODE_SPY;
1215   } | T_EXTERNAL
1216   {
1217 <  if (ypass == 2)
1218 <    yy_aconf->modes |= UMODE_EXTERNAL;
1236 < } | T_OPERWALL
1237 < {
1238 <  if (ypass == 2)
1239 <    yy_aconf->modes |= UMODE_OPERWALL;
1217 >  if (conf_parser_ctx.pass == 2)
1218 >    block_state.modes.value |= UMODE_EXTERNAL;
1219   } | T_SERVNOTICE
1220   {
1221 <  if (ypass == 2)
1222 <    yy_aconf->modes |= UMODE_SERVNOTICE;
1221 >  if (conf_parser_ctx.pass == 2)
1222 >    block_state.modes.value |= UMODE_SERVNOTICE;
1223   } | T_INVISIBLE
1224   {
1225 <  if (ypass == 2)
1226 <    yy_aconf->modes |= UMODE_INVISIBLE;
1225 >  if (conf_parser_ctx.pass == 2)
1226 >    block_state.modes.value |= UMODE_INVISIBLE;
1227   } | T_WALLOP
1228   {
1229 <  if (ypass == 2)
1230 <    yy_aconf->modes |= UMODE_WALLOP;
1229 >  if (conf_parser_ctx.pass == 2)
1230 >    block_state.modes.value |= UMODE_WALLOP;
1231   } | T_SOFTCALLERID
1232   {
1233 <  if (ypass == 2)
1234 <    yy_aconf->modes |= UMODE_SOFTCALLERID;
1233 >  if (conf_parser_ctx.pass == 2)
1234 >    block_state.modes.value |= UMODE_SOFTCALLERID;
1235   } | T_CALLERID
1236   {
1237 <  if (ypass == 2)
1238 <    yy_aconf->modes |= UMODE_CALLERID;
1237 >  if (conf_parser_ctx.pass == 2)
1238 >    block_state.modes.value |= UMODE_CALLERID;
1239   } | T_LOCOPS
1240   {
1241 <  if (ypass == 2)
1242 <    yy_aconf->modes |= UMODE_LOCOPS;
1243 < };
1244 <
1245 < oper_global_kill: GLOBAL_KILL '=' TBOOL ';'
1241 >  if (conf_parser_ctx.pass == 2)
1242 >    block_state.modes.value |= UMODE_LOCOPS;
1243 > } | T_NONONREG
1244 > {
1245 >  if (conf_parser_ctx.pass == 2)
1246 >    block_state.modes.value |= UMODE_REGONLY;
1247 > } | T_FARCONNECT
1248   {
1249 <  if (ypass == 2)
1250 <  {
1270 <    if (yylval.number)
1271 <      yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1272 <    else
1273 <      yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1274 <  }
1275 < };
1276 <
1277 < oper_remote: REMOTE '=' TBOOL ';'
1278 < {
1279 <  if (ypass == 2)
1280 <  {
1281 <    if (yylval.number)
1282 <      yy_aconf->port |= OPER_FLAG_REMOTE;
1283 <    else
1284 <      yy_aconf->port &= ~OPER_FLAG_REMOTE;
1285 <  }
1286 < };
1287 <
1288 < oper_remoteban: REMOTEBAN '=' TBOOL ';'
1289 < {
1290 <  if (ypass == 2)
1291 <  {
1292 <    if (yylval.number)
1293 <      yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1294 <    else
1295 <      yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1296 <  }
1297 < };
1298 <
1299 < oper_kline: KLINE '=' TBOOL ';'
1300 < {
1301 <  if (ypass == 2)
1302 <  {
1303 <    if (yylval.number)
1304 <      yy_aconf->port |= OPER_FLAG_K;
1305 <    else
1306 <      yy_aconf->port &= ~OPER_FLAG_K;
1307 <  }
1308 < };
1309 <
1310 < oper_xline: XLINE '=' TBOOL ';'
1311 < {
1312 <  if (ypass == 2)
1313 <  {
1314 <    if (yylval.number)
1315 <      yy_aconf->port |= OPER_FLAG_X;
1316 <    else
1317 <      yy_aconf->port &= ~OPER_FLAG_X;
1318 <  }
1319 < };
1320 <
1321 < oper_unkline: UNKLINE '=' TBOOL ';'
1322 < {
1323 <  if (ypass == 2)
1324 <  {
1325 <    if (yylval.number)
1326 <      yy_aconf->port |= OPER_FLAG_UNKLINE;
1327 <    else
1328 <      yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1329 <  }
1330 < };
1331 <
1332 < oper_gline: GLINE '=' TBOOL ';'
1333 < {
1334 <  if (ypass == 2)
1335 <  {
1336 <    if (yylval.number)
1337 <      yy_aconf->port |= OPER_FLAG_GLINE;
1338 <    else
1339 <      yy_aconf->port &= ~OPER_FLAG_GLINE;
1340 <  }
1341 < };
1342 <
1343 < oper_nick_changes: NICK_CHANGES '=' TBOOL ';'
1344 < {
1345 <  if (ypass == 2)
1346 <  {
1347 <    if (yylval.number)
1348 <      yy_aconf->port |= OPER_FLAG_N;
1349 <    else
1350 <      yy_aconf->port &= ~OPER_FLAG_N;
1351 <  }
1352 < };
1353 <
1354 < oper_die: DIE '=' TBOOL ';'
1355 < {
1356 <  if (ypass == 2)
1357 <  {
1358 <    if (yylval.number)
1359 <      yy_aconf->port |= OPER_FLAG_DIE;
1360 <    else
1361 <      yy_aconf->port &= ~OPER_FLAG_DIE;
1362 <  }
1363 < };
1364 <
1365 < oper_rehash: REHASH '=' TBOOL ';'
1366 < {
1367 <  if (ypass == 2)
1368 <  {
1369 <    if (yylval.number)
1370 <      yy_aconf->port |= OPER_FLAG_REHASH;
1371 <    else
1372 <      yy_aconf->port &= ~OPER_FLAG_REHASH;
1373 <  }
1374 < };
1375 <
1376 < oper_admin: ADMIN '=' TBOOL ';'
1377 < {
1378 <  if (ypass == 2)
1379 <  {
1380 <    if (yylval.number)
1381 <      yy_aconf->port |= OPER_FLAG_ADMIN;
1382 <    else
1383 <      yy_aconf->port &= ~OPER_FLAG_ADMIN;
1384 <  }
1385 < };
1386 <
1387 < oper_hidden_admin: HIDDEN_ADMIN '=' TBOOL ';'
1388 < {
1389 <  if (ypass == 2)
1390 <  {
1391 <    if (yylval.number)
1392 <      yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1393 <    else
1394 <      yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1395 <  }
1396 < };
1397 <
1398 < oper_hidden_oper: HIDDEN_OPER '=' TBOOL ';'
1399 < {
1400 <  if (ypass == 2)
1401 <  {
1402 <    if (yylval.number)
1403 <      yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1404 <    else
1405 <      yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1406 <  }
1407 < };
1408 <
1409 < oper_operwall: T_OPERWALL '=' TBOOL ';'
1410 < {
1411 <  if (ypass == 2)
1412 <  {
1413 <    if (yylval.number)
1414 <      yy_aconf->port |= OPER_FLAG_OPERWALL;
1415 <    else
1416 <      yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1417 <  }
1249 >  if (conf_parser_ctx.pass == 2)
1250 >    block_state.modes.value |= UMODE_FARCONNECT;
1251   };
1252  
1253   oper_flags: IRCD_FLAGS
1254   {
1255 +  if (conf_parser_ctx.pass == 2)
1256 +    block_state.port.value = 0;
1257   } '='  oper_flags_items ';';
1258  
1259   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1260 < oper_flags_item: NOT { not_atom = 1; } oper_flags_item_atom
1426 <                | { not_atom = 0; } oper_flags_item_atom;
1427 <
1428 < oper_flags_item_atom: GLOBAL_KILL
1260 > oper_flags_item: KILL ':' REMOTE
1261   {
1262 <  if (ypass == 2)
1263 <  {
1264 <    if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1265 <    else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1266 <  }
1267 < } | REMOTE
1262 >  if (conf_parser_ctx.pass == 2)
1263 >    block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1264 > } | KILL
1265 > {
1266 >  if (conf_parser_ctx.pass == 2)
1267 >    block_state.port.value |= OPER_FLAG_KILL;
1268 > } | CONNECT ':' REMOTE
1269 > {
1270 >  if (conf_parser_ctx.pass == 2)
1271 >    block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1272 > } | CONNECT
1273 > {
1274 >  if (conf_parser_ctx.pass == 2)
1275 >    block_state.port.value |= OPER_FLAG_CONNECT;
1276 > } | SQUIT ':' REMOTE
1277 > {
1278 >  if (conf_parser_ctx.pass == 2)
1279 >    block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1280 > } | SQUIT
1281   {
1282 <  if (ypass == 2)
1283 <  {
1439 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE;
1440 <    else yy_aconf->port |= OPER_FLAG_REMOTE;
1441 <  }
1282 >  if (conf_parser_ctx.pass == 2)
1283 >    block_state.port.value |= OPER_FLAG_SQUIT;
1284   } | KLINE
1285   {
1286 <  if (ypass == 2)
1287 <  {
1446 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_K;
1447 <    else yy_aconf->port |= OPER_FLAG_K;
1448 <  }
1286 >  if (conf_parser_ctx.pass == 2)
1287 >    block_state.port.value |= OPER_FLAG_KLINE;
1288   } | UNKLINE
1289   {
1290 <  if (ypass == 2)
1291 <  {
1292 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1293 <    else yy_aconf->port |= OPER_FLAG_UNKLINE;
1294 <  }
1290 >  if (conf_parser_ctx.pass == 2)
1291 >    block_state.port.value |= OPER_FLAG_UNKLINE;
1292 > } | T_DLINE
1293 > {
1294 >  if (conf_parser_ctx.pass == 2)
1295 >    block_state.port.value |= OPER_FLAG_DLINE;
1296 > } | T_UNDLINE
1297 > {
1298 >  if (conf_parser_ctx.pass == 2)
1299 >    block_state.port.value |= OPER_FLAG_UNDLINE;
1300   } | XLINE
1301   {
1302 <  if (ypass == 2)
1303 <  {
1304 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_X;
1461 <    else yy_aconf->port |= OPER_FLAG_X;
1462 <  }
1463 < } | GLINE
1302 >  if (conf_parser_ctx.pass == 2)
1303 >    block_state.port.value |= OPER_FLAG_XLINE;
1304 > } | T_UNXLINE
1305   {
1306 <  if (ypass == 2)
1307 <  {
1467 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE;
1468 <    else yy_aconf->port |= OPER_FLAG_GLINE;
1469 <  }
1306 >  if (conf_parser_ctx.pass == 2)
1307 >    block_state.port.value |= OPER_FLAG_UNXLINE;
1308   } | DIE
1309   {
1310 <  if (ypass == 2)
1311 <  {
1312 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE;
1313 <    else yy_aconf->port |= OPER_FLAG_DIE;
1314 <  }
1310 >  if (conf_parser_ctx.pass == 2)
1311 >    block_state.port.value |= OPER_FLAG_DIE;
1312 > } | T_RESTART
1313 > {
1314 >  if (conf_parser_ctx.pass == 2)
1315 >    block_state.port.value |= OPER_FLAG_RESTART;
1316 > } | REHASH ':' REMOTE
1317 > {
1318 >  if (conf_parser_ctx.pass == 2)
1319 >    block_state.port.value |= OPER_FLAG_REHASH_REMOTE;
1320   } | REHASH
1321   {
1322 <  if (ypass == 2)
1323 <  {
1481 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH;
1482 <    else yy_aconf->port |= OPER_FLAG_REHASH;
1483 <  }
1322 >  if (conf_parser_ctx.pass == 2)
1323 >    block_state.port.value |= OPER_FLAG_REHASH;
1324   } | ADMIN
1325   {
1326 <  if (ypass == 2)
1327 <  {
1328 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN;
1329 <    else yy_aconf->port |= OPER_FLAG_ADMIN;
1330 <  }
1331 < } | HIDDEN_ADMIN
1326 >  if (conf_parser_ctx.pass == 2)
1327 >    block_state.port.value |= OPER_FLAG_ADMIN;
1328 > } | T_GLOBOPS
1329 > {
1330 >  if (conf_parser_ctx.pass == 2)
1331 >    block_state.port.value |= OPER_FLAG_GLOBOPS;
1332 > } | T_WALLOPS
1333   {
1334 <  if (ypass == 2)
1335 <  {
1336 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1496 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1497 <  }
1498 < } | NICK_CHANGES
1334 >  if (conf_parser_ctx.pass == 2)
1335 >    block_state.port.value |= OPER_FLAG_WALLOPS;
1336 > } | T_LOCOPS
1337   {
1338 <  if (ypass == 2)
1339 <  {
1340 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_N;
1503 <    else yy_aconf->port |= OPER_FLAG_N;
1504 <  }
1505 < } | T_OPERWALL
1338 >  if (conf_parser_ctx.pass == 2)
1339 >    block_state.port.value |= OPER_FLAG_LOCOPS;
1340 > } | REMOTEBAN
1341   {
1342 <  if (ypass == 2)
1343 <  {
1344 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1345 <    else yy_aconf->port |= OPER_FLAG_OPERWALL;
1346 <  }
1347 < } | OPER_SPY_T
1342 >  if (conf_parser_ctx.pass == 2)
1343 >    block_state.port.value |= OPER_FLAG_REMOTEBAN;
1344 > } | T_SET
1345 > {
1346 >  if (conf_parser_ctx.pass == 2)
1347 >    block_state.port.value |= OPER_FLAG_SET;
1348 > } | MODULE
1349 > {
1350 >  if (conf_parser_ctx.pass == 2)
1351 >    block_state.port.value |= OPER_FLAG_MODULE;
1352 > } | T_OPME
1353 > {
1354 >  if (conf_parser_ctx.pass == 2)
1355 >    block_state.port.value |= OPER_FLAG_OPME;
1356 > } | NICK ':' RESV
1357 > {
1358 >  if (conf_parser_ctx.pass == 2)
1359 >    block_state.port.value |= OPER_FLAG_NICK_RESV;
1360 > } | JOIN ':' RESV
1361   {
1362 <  if (ypass == 2)
1363 <  {
1364 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY;
1517 <    else yy_aconf->port |= OPER_FLAG_OPER_SPY;
1518 <  }
1519 < } | HIDDEN_OPER
1362 >  if (conf_parser_ctx.pass == 2)
1363 >    block_state.port.value |= OPER_FLAG_JOIN_RESV;
1364 > } | RESV
1365   {
1366 <  if (ypass == 2)
1367 <  {
1368 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1524 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1525 <  }
1526 < } | REMOTEBAN
1366 >  if (conf_parser_ctx.pass == 2)
1367 >    block_state.port.value |= OPER_FLAG_RESV;
1368 > } | T_UNRESV
1369   {
1370 <  if (ypass == 2)
1371 <  {
1372 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1531 <    else yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1532 <  }
1533 < } | ENCRYPTED
1370 >  if (conf_parser_ctx.pass == 2)
1371 >    block_state.port.value |= OPER_FLAG_UNRESV;
1372 > } | CLOSE
1373   {
1374 <  if (ypass == 2)
1375 <  {
1537 <    if (not_atom) ClearConfEncrypted(yy_aconf);
1538 <    else SetConfEncrypted(yy_aconf);
1539 <  }
1374 >  if (conf_parser_ctx.pass == 2)
1375 >    block_state.port.value |= OPER_FLAG_CLOSE;
1376   };
1377  
1378  
1379   /***************************************************************************
1380 < *  section class
1380 > * class {} section
1381   ***************************************************************************/
1382   class_entry: CLASS
1383   {
1384 <  if (ypass == 1)
1385 <  {
1550 <    yy_conf = make_conf_item(CLASS_TYPE);
1551 <    yy_class = map_to_conf(yy_conf);
1552 <  }
1553 < } class_name_b '{' class_items '}' ';'
1554 < {
1555 <  if (ypass == 1)
1556 <  {
1557 <    struct ConfItem *cconf = NULL;
1558 <    struct ClassItem *class = NULL;
1559 <
1560 <    if (yy_class_name == NULL)
1561 <      delete_conf_item(yy_conf);
1562 <    else
1563 <    {
1564 <      cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1384 >  if (conf_parser_ctx.pass != 1)
1385 >    break;
1386  
1387 <      if (cconf != NULL)                /* The class existed already */
1567 <      {
1568 <        int user_count = 0;
1569 <
1570 <        rebuild_cidr_class(cconf, yy_class);
1571 <
1572 <        class = map_to_conf(cconf);
1573 <
1574 <        user_count = class->curr_user_count;
1575 <        memcpy(class, yy_class, sizeof(*class));
1576 <        class->curr_user_count = user_count;
1577 <        class->active = 1;
1578 <
1579 <        delete_conf_item(yy_conf);
1580 <
1581 <        MyFree(cconf->name);            /* Allows case change of class name */
1582 <        cconf->name = yy_class_name;
1583 <      }
1584 <      else      /* Brand new class */
1585 <      {
1586 <        MyFree(yy_conf->name);          /* just in case it was allocated */
1587 <        yy_conf->name = yy_class_name;
1588 <        yy_class->active = 1;
1589 <      }
1590 <    }
1387 >  reset_block_state();
1388  
1389 <    yy_class_name = NULL;
1390 <  }
1389 >  block_state.ping_freq.value = DEFAULT_PINGFREQUENCY;
1390 >  block_state.con_freq.value  = DEFAULT_CONNECTFREQUENCY;
1391 >  block_state.max_total.value = MAXIMUM_LINKS_DEFAULT;
1392 >  block_state.max_sendq.value = DEFAULT_SENDQ;
1393 >  block_state.max_recvq.value = DEFAULT_RECVQ;
1394 > } '{' class_items '}' ';'
1395 > {
1396 >  struct ClassItem *class = NULL;
1397 >
1398 >  if (conf_parser_ctx.pass != 1)
1399 >    break;
1400 >
1401 >  if (!block_state.class.buf[0])
1402 >    break;
1403 >
1404 >  if (!(class = class_find(block_state.class.buf, 0)))
1405 >    class = class_make();
1406 >
1407 >  class->active = 1;
1408 >  xfree(class->name);
1409 >  class->name = xstrdup(block_state.class.buf);
1410 >  class->ping_freq = block_state.ping_freq.value;
1411 >  class->max_perip = block_state.max_perip.value;
1412 >  class->con_freq = block_state.con_freq.value;
1413 >  class->max_total = block_state.max_total.value;
1414 >  class->max_global = block_state.max_global.value;
1415 >  class->max_local = block_state.max_local.value;
1416 >  class->max_sendq = block_state.max_sendq.value;
1417 >  class->max_recvq = block_state.max_recvq.value;
1418 >  class->max_channels = block_state.max_channels.value;
1419 >
1420 >  if (block_state.min_idle.value > block_state.max_idle.value)
1421 >  {
1422 >    block_state.min_idle.value = 0;
1423 >    block_state.max_idle.value = 0;
1424 >    block_state.flags.value &= ~CLASS_FLAGS_FAKE_IDLE;
1425 >  }
1426 >
1427 >  class->flags = block_state.flags.value;
1428 >  class->min_idle = block_state.min_idle.value;
1429 >  class->max_idle = block_state.max_idle.value;
1430 >
1431 >  rebuild_cidr_list(class);
1432 >
1433 >  class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1434 >  class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1435 >  class->number_per_cidr = block_state.number_per_cidr.value;
1436   };
1437  
1596 class_name_b: | class_name_t;
1597
1438   class_items:    class_items class_item | class_item;
1439   class_item:     class_name |
1440 <                class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
1440 >                class_cidr_bitlen_ipv4 |
1441 >                class_cidr_bitlen_ipv6 |
1442                  class_ping_time |
1443 <                class_ping_warning |
1603 <                class_number_per_cidr |
1443 >                class_number_per_cidr |
1444                  class_number_per_ip |
1445                  class_connectfreq |
1446 +                class_max_channels |
1447                  class_max_number |
1448 <                class_max_global |
1449 <                class_max_local |
1609 <                class_max_ident |
1448 >                class_max_global |
1449 >                class_max_local |
1450                  class_sendq |
1451 <                error ';' ;
1452 <
1453 < class_name: NAME '=' QSTRING ';'
1454 < {
1455 <  if (ypass == 1)
1616 <  {
1617 <    MyFree(yy_class_name);
1618 <    DupString(yy_class_name, yylval.string);
1619 <  }
1620 < };
1451 >                class_recvq |
1452 >                class_min_idle |
1453 >                class_max_idle |
1454 >                class_flags |
1455 >                error ';' ;
1456  
1457 < class_name_t: QSTRING
1457 > class_name: NAME '=' QSTRING ';'
1458   {
1459 <  if (ypass == 1)
1460 <  {
1626 <    MyFree(yy_class_name);
1627 <    DupString(yy_class_name, yylval.string);
1628 <  }
1459 >  if (conf_parser_ctx.pass == 1)
1460 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1461   };
1462  
1463   class_ping_time: PING_TIME '=' timespec ';'
1464   {
1465 <  if (ypass == 1)
1466 <    PingFreq(yy_class) = $3;
1465 >  if (conf_parser_ctx.pass == 1)
1466 >    block_state.ping_freq.value = $3;
1467   };
1468  
1469 < class_ping_warning: PING_WARNING '=' timespec ';'
1469 > class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1470   {
1471 <  if (ypass == 1)
1472 <    PingWarning(yy_class) = $3;
1471 >  if (conf_parser_ctx.pass == 1)
1472 >    block_state.max_perip.value = $3;
1473   };
1474  
1475 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1475 > class_connectfreq: CONNECTFREQ '=' timespec ';'
1476   {
1477 <  if (ypass == 1)
1478 <    MaxPerIp(yy_class) = $3;
1477 >  if (conf_parser_ctx.pass == 1)
1478 >    block_state.con_freq.value = $3;
1479   };
1480  
1481 < class_connectfreq: CONNECTFREQ '=' timespec ';'
1481 > class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1482   {
1483 <  if (ypass == 1)
1484 <    ConFreq(yy_class) = $3;
1483 >  if (conf_parser_ctx.pass == 1)
1484 >    block_state.max_channels.value = $3;
1485   };
1486  
1487   class_max_number: MAX_NUMBER '=' NUMBER ';'
1488   {
1489 <  if (ypass == 1)
1490 <    MaxTotal(yy_class) = $3;
1489 >  if (conf_parser_ctx.pass == 1)
1490 >    block_state.max_total.value = $3;
1491   };
1492  
1493   class_max_global: MAX_GLOBAL '=' NUMBER ';'
1494   {
1495 <  if (ypass == 1)
1496 <    MaxGlobal(yy_class) = $3;
1495 >  if (conf_parser_ctx.pass == 1)
1496 >    block_state.max_global.value = $3;
1497   };
1498  
1499   class_max_local: MAX_LOCAL '=' NUMBER ';'
1500   {
1501 <  if (ypass == 1)
1502 <    MaxLocal(yy_class) = $3;
1501 >  if (conf_parser_ctx.pass == 1)
1502 >    block_state.max_local.value = $3;
1503   };
1504  
1505 < class_max_ident: MAX_IDENT '=' NUMBER ';'
1505 > class_sendq: SENDQ '=' sizespec ';'
1506   {
1507 <  if (ypass == 1)
1508 <    MaxIdent(yy_class) = $3;
1507 >  if (conf_parser_ctx.pass == 1)
1508 >    block_state.max_sendq.value = $3;
1509   };
1510  
1511 < class_sendq: SENDQ '=' sizespec ';'
1511 > class_recvq: T_RECVQ '=' sizespec ';'
1512   {
1513 <  if (ypass == 1)
1514 <    MaxSendq(yy_class) = $3;
1513 >  if (conf_parser_ctx.pass == 1)
1514 >    if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1515 >      block_state.max_recvq.value = $3;
1516   };
1517  
1518   class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1519   {
1520 <  if (ypass == 1)
1521 <    CidrBitlenIPV4(yy_class) = $3;
1520 >  if (conf_parser_ctx.pass == 1)
1521 >    block_state.cidr_bitlen_ipv4.value = $3 > 32 ? 32 : $3;
1522   };
1523  
1524   class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1525   {
1526 <  if (ypass == 1)
1527 <    CidrBitlenIPV6(yy_class) = $3;
1526 >  if (conf_parser_ctx.pass == 1)
1527 >    block_state.cidr_bitlen_ipv6.value = $3 > 128 ? 128 : $3;
1528   };
1529  
1530   class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1531   {
1532 <  if (ypass == 1)
1533 <    NumberPerCidr(yy_class) = $3;
1532 >  if (conf_parser_ctx.pass == 1)
1533 >    block_state.number_per_cidr.value = $3;
1534   };
1535  
1536 + class_min_idle: MIN_IDLE '=' timespec ';'
1537 + {
1538 +  if (conf_parser_ctx.pass != 1)
1539 +    break;
1540 +
1541 +  block_state.min_idle.value = $3;
1542 +  block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1543 + };
1544 +
1545 + class_max_idle: MAX_IDLE '=' timespec ';'
1546 + {
1547 +  if (conf_parser_ctx.pass != 1)
1548 +    break;
1549 +
1550 +  block_state.max_idle.value = $3;
1551 +  block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1552 + };
1553 +
1554 + class_flags: IRCD_FLAGS
1555 + {
1556 +  if (conf_parser_ctx.pass == 1)
1557 +    block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE;
1558 + } '='  class_flags_items ';';
1559 +
1560 + class_flags_items: class_flags_items ',' class_flags_item | class_flags_item;
1561 + class_flags_item: RANDOM_IDLE
1562 + {
1563 +  if (conf_parser_ctx.pass == 1)
1564 +    block_state.flags.value |= CLASS_FLAGS_RANDOM_IDLE;
1565 + } | HIDE_IDLE_FROM_OPERS
1566 + {
1567 +  if (conf_parser_ctx.pass == 1)
1568 +    block_state.flags.value |= CLASS_FLAGS_HIDE_IDLE_FROM_OPERS;
1569 + };
1570 +
1571 +
1572   /***************************************************************************
1573 < *  section listen
1573 > * listen {} section
1574   ***************************************************************************/
1575   listen_entry: LISTEN
1576   {
1577 <  if (ypass == 2)
1578 <  {
1579 <    listener_address = NULL;
1711 <    listener_flags = 0;
1712 <  }
1713 < } '{' listen_items '}' ';'
1714 < {
1715 <  if (ypass == 2)
1716 <  {
1717 <    MyFree(listener_address);
1718 <    listener_address = NULL;
1719 <  }
1720 < };
1577 >  if (conf_parser_ctx.pass == 2)
1578 >    reset_block_state();
1579 > } '{' listen_items '}' ';';
1580  
1581   listen_flags: IRCD_FLAGS
1582   {
1583 <  listener_flags = 0;
1583 >  block_state.flags.value = 0;
1584   } '='  listen_flags_items ';';
1585  
1586   listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1587   listen_flags_item: T_SSL
1588   {
1589 <  if (ypass == 2)
1590 <    listener_flags |= LISTENER_SSL;
1589 >  if (conf_parser_ctx.pass == 2)
1590 >    block_state.flags.value |= LISTENER_SSL;
1591   } | HIDDEN
1592   {
1593 <  if (ypass == 2)
1594 <    listener_flags |= LISTENER_HIDDEN;
1593 >  if (conf_parser_ctx.pass == 2)
1594 >    block_state.flags.value |= LISTENER_HIDDEN;
1595 > } | T_SERVER
1596 > {
1597 >  if (conf_parser_ctx.pass == 2)
1598 >   block_state.flags.value |= LISTENER_SERVER;
1599   };
1600  
1601   listen_items:   listen_items listen_item | listen_item;
1602   listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';';
1603  
1604 < listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1604 > listen_port: PORT '=' port_items { block_state.flags.value = 0; } ';';
1605  
1606   port_items: port_items ',' port_item | port_item;
1607  
1608   port_item: NUMBER
1609   {
1610 <  if (ypass == 2)
1610 >  if (conf_parser_ctx.pass == 2)
1611    {
1612 <    if ((listener_flags & LISTENER_SSL))
1613 < #ifdef HAVE_LIBCRYPTO
1614 <      if (!ServerInfo.ctx)
1612 > #ifndef HAVE_TLS
1613 >    if (block_state.flags.value & LISTENER_SSL)
1614 >    {
1615 >      conf_error_report("TLS not available - port closed");
1616 >      break;
1617 >    }
1618   #endif
1619 <      {
1754 <        yyerror("SSL not available - port closed");
1755 <        break;
1756 <      }
1757 <    add_listener($1, listener_address, listener_flags);
1619 >    listener_add($1, block_state.addr.buf, block_state.flags.value);
1620    }
1621   } | NUMBER TWODOTS NUMBER
1622   {
1623 <  if (ypass == 2)
1623 >  if (conf_parser_ctx.pass == 2)
1624    {
1625 <    int i;
1626 <
1627 <    if ((listener_flags & LISTENER_SSL))
1628 < #ifdef HAVE_LIBCRYPTO
1629 <      if (!ServerInfo.ctx)
1625 > #ifndef HAVE_TLS
1626 >    if (block_state.flags.value & LISTENER_SSL)
1627 >    {
1628 >      conf_error_report("TLS not available - port closed");
1629 >      break;
1630 >    }
1631   #endif
1769      {
1770        yyerror("SSL not available - port closed");
1771        break;
1772      }
1632  
1633 <    for (i = $1; i <= $3; ++i)
1634 <      add_listener(i, listener_address, listener_flags);
1633 >    for (int i = $1; i <= $3; ++i)
1634 >      listener_add(i, block_state.addr.buf, block_state.flags.value);
1635    }
1636   };
1637  
1638   listen_address: IP '=' QSTRING ';'
1639   {
1640 <  if (ypass == 2)
1641 <  {
1783 <    MyFree(listener_address);
1784 <    DupString(listener_address, yylval.string);
1785 <  }
1640 >  if (conf_parser_ctx.pass == 2)
1641 >    strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1642   };
1643  
1644   listen_host: HOST '=' QSTRING ';'
1645   {
1646 <  if (ypass == 2)
1647 <  {
1792 <    MyFree(listener_address);
1793 <    DupString(listener_address, yylval.string);
1794 <  }
1646 >  if (conf_parser_ctx.pass == 2)
1647 >    strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1648   };
1649  
1650 +
1651   /***************************************************************************
1652 < *  section auth
1652 > * auth {} section
1653   ***************************************************************************/
1654   auth_entry: IRCD_AUTH
1655   {
1656 <  if (ypass == 2)
1657 <  {
1804 <    yy_conf = make_conf_item(CLIENT_TYPE);
1805 <    yy_aconf = map_to_conf(yy_conf);
1806 <  }
1807 <  else
1808 <  {
1809 <    MyFree(class_name);
1810 <    class_name = NULL;
1811 <  }
1656 >  if (conf_parser_ctx.pass == 2)
1657 >    reset_block_state();
1658   } '{' auth_items '}' ';'
1659   {
1660 <  if (ypass == 2)
1815 <  {
1816 <    struct CollectItem *yy_tmp = NULL;
1817 <    dlink_node *ptr = NULL, *next_ptr = NULL;
1660 >  dlink_node *node = NULL;
1661  
1662 <    if (yy_aconf->user && yy_aconf->host)
1663 <    {
1821 <      conf_add_class_to_conf(yy_conf, class_name);
1822 <      add_conf_by_address(CONF_CLIENT, yy_aconf);
1823 <    }
1824 <    else
1825 <      delete_conf_item(yy_conf);
1662 >  if (conf_parser_ctx.pass != 2)
1663 >    break;
1664  
1665 <    /* copy over settings from first struct */
1828 <    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
1829 <    {
1830 <      struct AccessItem *new_aconf;
1831 <      struct ConfItem *new_conf;
1832 <
1833 <      new_conf = make_conf_item(CLIENT_TYPE);
1834 <      new_aconf = map_to_conf(new_conf);
1835 <
1836 <      yy_tmp = ptr->data;
1837 <
1838 <      assert(yy_tmp->user && yy_tmp->host);
1839 <
1840 <      if (yy_aconf->passwd != NULL)
1841 <        DupString(new_aconf->passwd, yy_aconf->passwd);
1842 <      if (yy_conf->name != NULL)
1843 <        DupString(new_conf->name, yy_conf->name);
1844 <      if (yy_aconf->passwd != NULL)
1845 <        DupString(new_aconf->passwd, yy_aconf->passwd);
1846 <
1847 <      new_aconf->flags = yy_aconf->flags;
1848 <      new_aconf->port  = yy_aconf->port;
1849 <
1850 <      DupString(new_aconf->user, yy_tmp->user);
1851 <      collapse(new_aconf->user);
1852 <
1853 <      DupString(new_aconf->host, yy_tmp->host);
1854 <      collapse(new_aconf->host);
1855 <
1856 <      conf_add_class_to_conf(new_conf, class_name);
1857 <      add_conf_by_address(CONF_CLIENT, new_aconf);
1858 <      dlinkDelete(&yy_tmp->node, &col_conf_list);
1859 <      free_collect_item(yy_tmp);
1860 <    }
1861 <
1862 <    MyFree(class_name);
1863 <    class_name = NULL;
1864 <    yy_conf = NULL;
1865 <    yy_aconf = NULL;
1866 <  }
1867 < };
1868 <
1869 < auth_items:     auth_items auth_item | auth_item;
1870 < auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
1871 <                auth_kline_exempt | auth_need_ident |
1872 <                auth_exceed_limit | auth_no_tilde | auth_gline_exempt |
1873 <                auth_spoof | auth_spoof_notice |
1874 <                auth_redir_serv | auth_redir_port | auth_can_flood |
1875 <                auth_need_password | auth_encrypted | error ';' ;
1876 <
1877 < auth_user: USER '=' QSTRING ';'
1878 < {
1879 <  if (ypass == 2)
1665 >  DLINK_FOREACH(node, block_state.mask.list.head)
1666    {
1667 <    struct CollectItem *yy_tmp = NULL;
1667 >    struct MaskItem *conf = NULL;
1668      struct split_nuh_item nuh;
1669 +    char *s = node->data;
1670  
1671 <    nuh.nuhmask  = yylval.string;
1672 <    nuh.nickptr  = NULL;
1886 <    nuh.userptr  = userbuf;
1887 <    nuh.hostptr  = hostbuf;
1671 >    if (EmptyString(s))
1672 >      continue;
1673  
1674 +    nuh.nuhmask  = s;
1675 +    nuh.nickptr  = NULL;
1676 +    nuh.userptr  = block_state.user.buf;
1677 +    nuh.hostptr  = block_state.host.buf;
1678      nuh.nicksize = 0;
1679 <    nuh.usersize = sizeof(userbuf);
1680 <    nuh.hostsize = sizeof(hostbuf);
1892 <
1679 >    nuh.usersize = sizeof(block_state.user.buf);
1680 >    nuh.hostsize = sizeof(block_state.host.buf);
1681      split_nuh(&nuh);
1682  
1683 <    if (yy_aconf->user == NULL)
1684 <    {
1685 <      DupString(yy_aconf->user, userbuf);
1686 <      DupString(yy_aconf->host, hostbuf);
1687 <    }
1688 <    else
1689 <    {
1690 <      yy_tmp = MyMalloc(sizeof(struct CollectItem));
1683 >    conf        = conf_make(CONF_CLIENT);
1684 >    conf->user  = xstrdup(block_state.user.buf);
1685 >    conf->host  = xstrdup(block_state.host.buf);
1686 >
1687 >    if (block_state.rpass.buf[0])
1688 >      conf->passwd = xstrdup(block_state.rpass.buf);
1689 >    if (block_state.name.buf[0])
1690 >      conf->name = xstrdup(block_state.name.buf);
1691  
1692 <      DupString(yy_tmp->user, userbuf);
1693 <      DupString(yy_tmp->host, hostbuf);
1692 >    conf->flags = block_state.flags.value;
1693 >    conf->port  = block_state.port.value;
1694  
1695 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1696 <    }
1695 >    conf_add_class_to_conf(conf, block_state.class.buf);
1696 >    add_conf_by_address(CONF_CLIENT, conf);
1697    }
1698   };
1699  
1700 < /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1700 > auth_items:     auth_items auth_item | auth_item;
1701 > auth_item:      auth_user |
1702 >                auth_passwd |
1703 >                auth_class |
1704 >                auth_flags |
1705 >                auth_spoof |
1706 >                auth_redir_serv |
1707 >                auth_redir_port |
1708 >                auth_encrypted |
1709 >                error ';' ;
1710  
1711 < auth_passwd: PASSWORD '=' QSTRING ';'
1711 > auth_user: USER '=' QSTRING ';'
1712   {
1713 <  if (ypass == 2)
1714 <  {
1918 <    /* be paranoid */
1919 <    if (yy_aconf->passwd != NULL)
1920 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1921 <
1922 <    MyFree(yy_aconf->passwd);
1923 <    DupString(yy_aconf->passwd, yylval.string);
1924 <  }
1713 >  if (conf_parser_ctx.pass == 2)
1714 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1715   };
1716  
1717 < auth_spoof_notice: SPOOF_NOTICE '=' TBOOL ';'
1717 > auth_passwd: PASSWORD '=' QSTRING ';'
1718   {
1719 <  if (ypass == 2)
1720 <  {
1931 <    if (yylval.number)
1932 <      yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1933 <    else
1934 <      yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1935 <  }
1719 >  if (conf_parser_ctx.pass == 2)
1720 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1721   };
1722  
1723   auth_class: CLASS '=' QSTRING ';'
1724   {
1725 <  if (ypass == 2)
1726 <  {
1942 <    MyFree(class_name);
1943 <    DupString(class_name, yylval.string);
1944 <  }
1725 >  if (conf_parser_ctx.pass == 2)
1726 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1727   };
1728  
1729   auth_encrypted: ENCRYPTED '=' TBOOL ';'
1730   {
1731 <  if (ypass == 2)
1731 >  if (conf_parser_ctx.pass == 2)
1732    {
1733      if (yylval.number)
1734 <      SetConfEncrypted(yy_aconf);
1734 >      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1735      else
1736 <      ClearConfEncrypted(yy_aconf);
1736 >      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1737    }
1738   };
1739  
1740   auth_flags: IRCD_FLAGS
1741   {
1742 +  if (conf_parser_ctx.pass == 2)
1743 +    block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1744   } '='  auth_flags_items ';';
1745  
1746   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1747 < auth_flags_item: NOT { not_atom = 1; } auth_flags_item_atom
1964 <                | { not_atom = 0; } auth_flags_item_atom;
1965 <
1966 < auth_flags_item_atom: SPOOF_NOTICE
1747 > auth_flags_item: SPOOF_NOTICE
1748   {
1749 <  if (ypass == 2)
1750 <  {
1970 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1971 <    else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1972 <  }
1973 <
1749 >  if (conf_parser_ctx.pass == 2)
1750 >    block_state.flags.value |= CONF_FLAGS_SPOOF_NOTICE;
1751   } | EXCEED_LIMIT
1752   {
1753 <  if (ypass == 2)
1754 <  {
1978 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1979 <    else yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1980 <  }
1753 >  if (conf_parser_ctx.pass == 2)
1754 >    block_state.flags.value |= CONF_FLAGS_NOLIMIT;
1755   } | KLINE_EXEMPT
1756   {
1757 <  if (ypass == 2)
1758 <  {
1759 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1760 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1761 <  }
1757 >  if (conf_parser_ctx.pass == 2)
1758 >    block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1759 > } | XLINE_EXEMPT
1760 > {
1761 >  if (conf_parser_ctx.pass == 2)
1762 >    block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1763   } | NEED_IDENT
1764   {
1765 <  if (ypass == 2)
1766 <  {
1992 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1993 <    else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1994 <  }
1765 >  if (conf_parser_ctx.pass == 2)
1766 >    block_state.flags.value |= CONF_FLAGS_NEED_IDENTD;
1767   } | CAN_FLOOD
1768   {
1769 <  if (ypass == 2)
1770 <  {
1999 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
2000 <    else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
2001 <  }
2002 < } | CAN_IDLE
2003 < {
2004 <  if (ypass == 2)
2005 <  {
2006 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED;
2007 <    else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED;
2008 <  }
1769 >  if (conf_parser_ctx.pass == 2)
1770 >    block_state.flags.value |= CONF_FLAGS_CAN_FLOOD;
1771   } | NO_TILDE
1772   {
1773 <  if (ypass == 2)
1774 <  {
2013 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
2014 <    else yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
2015 <  }
2016 < } | GLINE_EXEMPT
2017 < {
2018 <  if (ypass == 2)
2019 <  {
2020 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
2021 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
2022 <  }
1773 >  if (conf_parser_ctx.pass == 2)
1774 >    block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1775   } | RESV_EXEMPT
1776   {
1777 <  if (ypass == 2)
1778 <  {
1779 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV;
1780 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1781 <  }
1777 >  if (conf_parser_ctx.pass == 2)
1778 >    block_state.flags.value |= CONF_FLAGS_EXEMPTRESV;
1779 > } | T_WEBIRC
1780 > {
1781 >  if (conf_parser_ctx.pass == 2)
1782 >    block_state.flags.value |= CONF_FLAGS_WEBIRC;
1783   } | NEED_PASSWORD
1784   {
1785 <  if (ypass == 2)
1786 <  {
2034 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2035 <    else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
2036 <  }
1785 >  if (conf_parser_ctx.pass == 2)
1786 >    block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1787   };
1788  
1789 < auth_kline_exempt: KLINE_EXEMPT '=' TBOOL ';'
1789 > auth_spoof: SPOOF '=' QSTRING ';'
1790   {
1791 <  if (ypass == 2)
1792 <  {
2043 <    if (yylval.number)
2044 <      yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
2045 <    else
2046 <      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
2047 <  }
2048 < };
1791 >  if (conf_parser_ctx.pass != 2)
1792 >    break;
1793  
1794 < auth_need_ident: NEED_IDENT '=' TBOOL ';'
2051 < {
2052 <  if (ypass == 2)
1794 >  if (valid_hostname(yylval.string))
1795    {
1796 <    if (yylval.number)
1797 <      yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
2056 <    else
2057 <      yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1796 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1797 >    block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
1798    }
1799 +  else
1800 +    ilog(LOG_TYPE_IRCD, "Spoof either is too long or contains invalid characters. Ignoring it.");
1801   };
1802  
1803 < auth_exceed_limit: EXCEED_LIMIT '=' TBOOL ';'
1803 > auth_redir_serv: REDIRSERV '=' QSTRING ';'
1804   {
1805 <  if (ypass == 2)
1806 <  {
2065 <    if (yylval.number)
2066 <      yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
2067 <    else
2068 <      yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
2069 <  }
2070 < };
1805 >  if (conf_parser_ctx.pass != 2)
1806 >    break;
1807  
1808 < auth_can_flood: CAN_FLOOD '=' TBOOL ';'
1809 < {
2074 <  if (ypass == 2)
2075 <  {
2076 <    if (yylval.number)
2077 <      yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
2078 <    else
2079 <      yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
2080 <  }
1808 >  strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1809 >  block_state.flags.value |= CONF_FLAGS_REDIR;
1810   };
1811  
1812 < auth_no_tilde: NO_TILDE '=' TBOOL ';'
1812 > auth_redir_port: REDIRPORT '=' NUMBER ';'
1813   {
1814 <  if (ypass == 2)
1815 <  {
1816 <    if (yylval.number)
1817 <      yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1818 <    else
2090 <      yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
2091 <  }
1814 >  if (conf_parser_ctx.pass != 2)
1815 >    break;
1816 >
1817 >  block_state.flags.value |= CONF_FLAGS_REDIR;
1818 >  block_state.port.value = $3;
1819   };
1820  
1821 < auth_gline_exempt: GLINE_EXEMPT '=' TBOOL ';'
1821 >
1822 > /***************************************************************************
1823 > * resv {} section
1824 > ***************************************************************************/
1825 > resv_entry: RESV
1826   {
1827 <  if (ypass == 2)
1828 <  {
2098 <    if (yylval.number)
2099 <      yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
2100 <    else
2101 <      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
2102 <  }
2103 < };
1827 >  if (conf_parser_ctx.pass != 2)
1828 >    break;
1829  
1830 < /* XXX - need check for illegal hostnames here */
1831 < auth_spoof: SPOOF '=' QSTRING ';'
1830 >  reset_block_state();
1831 >  strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1832 > } '{' resv_items '}' ';'
1833   {
1834 <  if (ypass == 2)
1835 <  {
2110 <    MyFree(yy_conf->name);
1834 >  if (conf_parser_ctx.pass != 2)
1835 >    break;
1836  
1837 <    if (strlen(yylval.string) < HOSTLEN)
2113 <    {    
2114 <      DupString(yy_conf->name, yylval.string);
2115 <      yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
2116 <    }
2117 <    else
2118 <    {
2119 <      ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
2120 <      yy_conf->name = NULL;
2121 <    }
2122 <  }
1837 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1838   };
1839  
1840 < auth_redir_serv: REDIRSERV '=' QSTRING ';'
1840 > resv_items:     resv_items resv_item | resv_item;
1841 > resv_item:      resv_mask | resv_reason | resv_exempt | error ';' ;
1842 >
1843 > resv_mask: MASK '=' QSTRING ';'
1844   {
1845 <  if (ypass == 2)
1846 <  {
2129 <    yy_aconf->flags |= CONF_FLAGS_REDIR;
2130 <    MyFree(yy_conf->name);
2131 <    DupString(yy_conf->name, yylval.string);
2132 <  }
1845 >  if (conf_parser_ctx.pass == 2)
1846 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1847   };
1848  
1849 < auth_redir_port: REDIRPORT '=' NUMBER ';'
1849 > resv_reason: REASON '=' QSTRING ';'
1850   {
1851 <  if (ypass == 2)
1852 <  {
2139 <    yy_aconf->flags |= CONF_FLAGS_REDIR;
2140 <    yy_aconf->port = $3;
2141 <  }
1851 >  if (conf_parser_ctx.pass == 2)
1852 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1853   };
1854  
1855 < auth_need_password: NEED_PASSWORD '=' TBOOL ';'
1855 > resv_exempt: EXEMPT '=' QSTRING ';'
1856   {
1857 <  if (ypass == 2)
1858 <  {
2148 <    if (yylval.number)
2149 <      yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
2150 <    else
2151 <      yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2152 <  }
1857 >  if (conf_parser_ctx.pass == 2)
1858 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1859   };
1860  
1861  
1862   /***************************************************************************
1863 < *  section resv
1863 > * service {} section
1864   ***************************************************************************/
1865 < resv_entry: RESV
2160 < {
2161 <  if (ypass == 2)
2162 <  {
2163 <    MyFree(resv_reason);
2164 <    resv_reason = NULL;
2165 <  }
2166 < } '{' resv_items '}' ';'
2167 < {
2168 <  if (ypass == 2)
2169 <  {
2170 <    MyFree(resv_reason);
2171 <    resv_reason = NULL;
2172 <  }
2173 < };
1865 > service_entry: T_SERVICE '{' service_items '}' ';';
1866  
1867 < resv_items:     resv_items resv_item | resv_item;
1868 < resv_item:      resv_creason | resv_channel | resv_nick | error ';' ;
1867 > service_items:     service_items service_item | service_item;
1868 > service_item:      service_name | error;
1869  
1870 < resv_creason: REASON '=' QSTRING ';'
1870 > service_name: NAME '=' QSTRING ';'
1871   {
1872 <  if (ypass == 2)
1873 <  {
2182 <    MyFree(resv_reason);
2183 <    DupString(resv_reason, yylval.string);
2184 <  }
2185 < };
1872 >  if (conf_parser_ctx.pass != 2)
1873 >    break;
1874  
1875 < resv_channel: CHANNEL '=' QSTRING ';'
2188 < {
2189 <  if (ypass == 2)
1875 >  if (valid_servname(yylval.string))
1876    {
1877 <    if (IsChanPrefix(*yylval.string))
1878 <    {
2193 <      char def_reason[] = "No reason";
2194 <
2195 <      create_channel_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
2196 <    }
1877 >    struct ServiceItem *service = service_make();
1878 >    service->name = xstrdup(yylval.string);
1879    }
2198  /* ignore it for now.. but we really should make a warning if
2199   * its an erroneous name --fl_ */
1880   };
1881  
2202 resv_nick: NICK '=' QSTRING ';'
2203 {
2204  if (ypass == 2)
2205  {
2206    char def_reason[] = "No reason";
2207
2208    create_nick_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
2209  }
2210 };
1882  
1883   /***************************************************************************
1884 < *  section shared, for sharing remote klines etc.
1884 > * shared {} section, for sharing remote klines etc.
1885   ***************************************************************************/
1886   shared_entry: T_SHARED
1887   {
1888 <  if (ypass == 2)
1889 <  {
1890 <    yy_conf = make_conf_item(ULINE_TYPE);
1891 <    yy_match_item = map_to_conf(yy_conf);
1892 <    yy_match_item->action = SHARED_ALL;
1893 <  }
1888 >  if (conf_parser_ctx.pass != 2)
1889 >    break;
1890 >
1891 >  reset_block_state();
1892 >
1893 >  strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1894 >  strlcpy(block_state.user.buf, "*", sizeof(block_state.user.buf));
1895 >  strlcpy(block_state.host.buf, "*", sizeof(block_state.host.buf));
1896 >  block_state.flags.value = SHARED_ALL;
1897   } '{' shared_items '}' ';'
1898   {
1899 <  if (ypass == 2)
1900 <  {
1901 <    yy_conf = NULL;
1902 <  }
1899 >  if (conf_parser_ctx.pass != 2)
1900 >    break;
1901 >
1902 >  struct SharedItem *shared = shared_make();
1903 >  shared->type = block_state.flags.value;
1904 >  shared->server = xstrdup(block_state.name.buf);
1905 >  shared->user = xstrdup(block_state.user.buf);
1906 >  shared->host = xstrdup(block_state.host.buf);
1907   };
1908  
1909   shared_items: shared_items shared_item | shared_item;
# Line 2233 | Line 1911 | shared_item:  shared_name | shared_user
1911  
1912   shared_name: NAME '=' QSTRING ';'
1913   {
1914 <  if (ypass == 2)
1915 <  {
2238 <    MyFree(yy_conf->name);
2239 <    DupString(yy_conf->name, yylval.string);
2240 <  }
1914 >  if (conf_parser_ctx.pass == 2)
1915 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1916   };
1917  
1918   shared_user: USER '=' QSTRING ';'
1919   {
1920 <  if (ypass == 2)
1920 >  if (conf_parser_ctx.pass == 2)
1921    {
1922      struct split_nuh_item nuh;
1923  
1924      nuh.nuhmask  = yylval.string;
1925      nuh.nickptr  = NULL;
1926 <    nuh.userptr  = userbuf;
1927 <    nuh.hostptr  = hostbuf;
1926 >    nuh.userptr  = block_state.user.buf;
1927 >    nuh.hostptr  = block_state.host.buf;
1928  
1929      nuh.nicksize = 0;
1930 <    nuh.usersize = sizeof(userbuf);
1931 <    nuh.hostsize = sizeof(hostbuf);
1930 >    nuh.usersize = sizeof(block_state.user.buf);
1931 >    nuh.hostsize = sizeof(block_state.host.buf);
1932  
1933      split_nuh(&nuh);
2259
2260    DupString(yy_match_item->user, userbuf);
2261    DupString(yy_match_item->host, hostbuf);
1934    }
1935   };
1936  
1937   shared_type: TYPE
1938   {
1939 <  if (ypass == 2)
1940 <    yy_match_item->action = 0;
1939 >  if (conf_parser_ctx.pass == 2)
1940 >    block_state.flags.value = 0;
1941   } '=' shared_types ';' ;
1942  
1943   shared_types: shared_types ',' shared_type_item | shared_type_item;
1944   shared_type_item: KLINE
1945   {
1946 <  if (ypass == 2)
1947 <    yy_match_item->action |= SHARED_KLINE;
2276 < } | TKLINE
2277 < {
2278 <  if (ypass == 2)
2279 <    yy_match_item->action |= SHARED_TKLINE;
1946 >  if (conf_parser_ctx.pass == 2)
1947 >    block_state.flags.value |= SHARED_KLINE;
1948   } | UNKLINE
1949   {
1950 <  if (ypass == 2)
1951 <    yy_match_item->action |= SHARED_UNKLINE;
1952 < } | XLINE
1950 >  if (conf_parser_ctx.pass == 2)
1951 >    block_state.flags.value |= SHARED_UNKLINE;
1952 > } | T_DLINE
1953 > {
1954 >  if (conf_parser_ctx.pass == 2)
1955 >    block_state.flags.value |= SHARED_DLINE;
1956 > } | T_UNDLINE
1957   {
1958 <  if (ypass == 2)
1959 <    yy_match_item->action |= SHARED_XLINE;
1960 < } | TXLINE
1958 >  if (conf_parser_ctx.pass == 2)
1959 >    block_state.flags.value |= SHARED_UNDLINE;
1960 > } | XLINE
1961   {
1962 <  if (ypass == 2)
1963 <    yy_match_item->action |= SHARED_TXLINE;
1962 >  if (conf_parser_ctx.pass == 2)
1963 >    block_state.flags.value |= SHARED_XLINE;
1964   } | T_UNXLINE
1965   {
1966 <  if (ypass == 2)
1967 <    yy_match_item->action |= SHARED_UNXLINE;
1966 >  if (conf_parser_ctx.pass == 2)
1967 >    block_state.flags.value |= SHARED_UNXLINE;
1968   } | RESV
1969   {
1970 <  if (ypass == 2)
1971 <    yy_match_item->action |= SHARED_RESV;
2300 < } | TRESV
2301 < {
2302 <  if (ypass == 2)
2303 <    yy_match_item->action |= SHARED_TRESV;
1970 >  if (conf_parser_ctx.pass == 2)
1971 >    block_state.flags.value |= SHARED_RESV;
1972   } | T_UNRESV
1973   {
1974 <  if (ypass == 2)
1975 <    yy_match_item->action |= SHARED_UNRESV;
1974 >  if (conf_parser_ctx.pass == 2)
1975 >    block_state.flags.value |= SHARED_UNRESV;
1976   } | T_LOCOPS
1977   {
1978 <  if (ypass == 2)
1979 <    yy_match_item->action |= SHARED_LOCOPS;
1978 >  if (conf_parser_ctx.pass == 2)
1979 >    block_state.flags.value |= SHARED_LOCOPS;
1980   } | T_ALL
1981   {
1982 <  if (ypass == 2)
1983 <    yy_match_item->action = SHARED_ALL;
1982 >  if (conf_parser_ctx.pass == 2)
1983 >    block_state.flags.value = SHARED_ALL;
1984   };
1985  
1986 +
1987   /***************************************************************************
1988 < *  section cluster
1988 > * cluster {} section
1989   ***************************************************************************/
1990   cluster_entry: T_CLUSTER
1991   {
1992 <  if (ypass == 2)
1993 <  {
1994 <    yy_conf = make_conf_item(CLUSTER_TYPE);
1995 <    yy_conf->flags = SHARED_ALL;
1996 <  }
1992 >  if (conf_parser_ctx.pass != 2)
1993 >    break;
1994 >
1995 >  reset_block_state();
1996 >
1997 >  strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1998 >  block_state.flags.value = CLUSTER_ALL;
1999   } '{' cluster_items '}' ';'
2000   {
2001 <  if (ypass == 2)
2002 <  {
2003 <    if (yy_conf->name == NULL)
2004 <      DupString(yy_conf->name, "*");
2005 <    yy_conf = NULL;
2006 <  }
2001 >  if (conf_parser_ctx.pass != 2)
2002 >    break;
2003 >
2004 >  struct ClusterItem *cluster = cluster_make();
2005 >  cluster->type = block_state.flags.value;
2006 >  cluster->server = xstrdup(block_state.name.buf);
2007   };
2008  
2009 < cluster_items:  cluster_items cluster_item | cluster_item;
2010 < cluster_item:   cluster_name | cluster_type | error ';' ;
2009 > cluster_items:  cluster_items cluster_item | cluster_item;
2010 > cluster_item:   cluster_name | cluster_type | error ';' ;
2011  
2012   cluster_name: NAME '=' QSTRING ';'
2013   {
2014 <  if (ypass == 2)
2015 <    DupString(yy_conf->name, yylval.string);
2014 >  if (conf_parser_ctx.pass == 2)
2015 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2016   };
2017  
2018   cluster_type: TYPE
2019   {
2020 <  if (ypass == 2)
2021 <    yy_conf->flags = 0;
2020 >  if (conf_parser_ctx.pass == 2)
2021 >    block_state.flags.value = 0;
2022   } '=' cluster_types ';' ;
2023  
2024 < cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2024 > cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2025   cluster_type_item: KLINE
2026   {
2027 <  if (ypass == 2)
2028 <    yy_conf->flags |= SHARED_KLINE;
2358 < } | TKLINE
2359 < {
2360 <  if (ypass == 2)
2361 <    yy_conf->flags |= SHARED_TKLINE;
2027 >  if (conf_parser_ctx.pass == 2)
2028 >    block_state.flags.value |= CLUSTER_KLINE;
2029   } | UNKLINE
2030   {
2031 <  if (ypass == 2)
2032 <    yy_conf->flags |= SHARED_UNKLINE;
2033 < } | XLINE
2031 >  if (conf_parser_ctx.pass == 2)
2032 >    block_state.flags.value |= CLUSTER_UNKLINE;
2033 > } | T_DLINE
2034 > {
2035 >  if (conf_parser_ctx.pass == 2)
2036 >    block_state.flags.value |= CLUSTER_DLINE;
2037 > } | T_UNDLINE
2038   {
2039 <  if (ypass == 2)
2040 <    yy_conf->flags |= SHARED_XLINE;
2041 < } | TXLINE
2039 >  if (conf_parser_ctx.pass == 2)
2040 >    block_state.flags.value |= CLUSTER_UNDLINE;
2041 > } | XLINE
2042   {
2043 <  if (ypass == 2)
2044 <    yy_conf->flags |= SHARED_TXLINE;
2043 >  if (conf_parser_ctx.pass == 2)
2044 >    block_state.flags.value |= CLUSTER_XLINE;
2045   } | T_UNXLINE
2046   {
2047 <  if (ypass == 2)
2048 <    yy_conf->flags |= SHARED_UNXLINE;
2047 >  if (conf_parser_ctx.pass == 2)
2048 >    block_state.flags.value |= CLUSTER_UNXLINE;
2049   } | RESV
2050   {
2051 <  if (ypass == 2)
2052 <    yy_conf->flags |= SHARED_RESV;
2382 < } | TRESV
2383 < {
2384 <  if (ypass == 2)
2385 <    yy_conf->flags |= SHARED_TRESV;
2051 >  if (conf_parser_ctx.pass == 2)
2052 >    block_state.flags.value |= CLUSTER_RESV;
2053   } | T_UNRESV
2054   {
2055 <  if (ypass == 2)
2056 <    yy_conf->flags |= SHARED_UNRESV;
2055 >  if (conf_parser_ctx.pass == 2)
2056 >    block_state.flags.value |= CLUSTER_UNRESV;
2057   } | T_LOCOPS
2058   {
2059 <  if (ypass == 2)
2060 <    yy_conf->flags |= SHARED_LOCOPS;
2059 >  if (conf_parser_ctx.pass == 2)
2060 >    block_state.flags.value |= CLUSTER_LOCOPS;
2061   } | T_ALL
2062   {
2063 <  if (ypass == 2)
2064 <    yy_conf->flags = SHARED_ALL;
2063 >  if (conf_parser_ctx.pass == 2)
2064 >    block_state.flags.value = CLUSTER_ALL;
2065   };
2066  
2067 +
2068   /***************************************************************************
2069 < *  section connect
2069 > * connect {}  section
2070   ***************************************************************************/
2071 < connect_entry: CONNECT  
2071 > connect_entry: CONNECT
2072   {
2405  if (ypass == 2)
2406  {
2407    yy_conf = make_conf_item(SERVER_TYPE);
2408    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
2409    yy_aconf->passwd = NULL;
2410    /* defaults */
2411    yy_aconf->port = PORTNUM;
2073  
2074 <    if (ConfigFileEntry.burst_away)
2075 <      yy_aconf->flags = CONF_FLAGS_BURST_AWAY;
2076 <  }
2077 <  else
2078 <  {
2079 <    MyFree(class_name);
2080 <    class_name = NULL;
2420 <  }
2421 < } connect_name_b '{' connect_items '}' ';'
2074 >  if (conf_parser_ctx.pass != 2)
2075 >    break;
2076 >
2077 >  reset_block_state();
2078 >  block_state.aftype.value = AF_INET;
2079 >  block_state.port.value = PORTNUM;
2080 > } '{' connect_items '}' ';'
2081   {
2082 <  if (ypass == 2)
2083 <  {
2425 <    struct CollectItem *yy_hconf=NULL;
2426 <    struct CollectItem *yy_lconf=NULL;
2427 <    dlink_node *ptr;
2428 <    dlink_node *next_ptr;
2429 < #ifdef HAVE_LIBCRYPTO
2430 <    if (yy_aconf->host &&
2431 <        ((yy_aconf->passwd && yy_aconf->spasswd) ||
2432 <         (yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf))))
2433 < #else /* !HAVE_LIBCRYPTO */
2434 <      if (yy_aconf->host && !IsConfCryptLink(yy_aconf) &&
2435 <          yy_aconf->passwd && yy_aconf->spasswd)
2436 < #endif /* !HAVE_LIBCRYPTO */
2437 <        {
2438 <          if (conf_add_server(yy_conf, class_name) == -1)
2439 <          {
2440 <            delete_conf_item(yy_conf);
2441 <            yy_conf = NULL;
2442 <            yy_aconf = NULL;
2443 <          }
2444 <        }
2445 <        else
2446 <        {
2447 <          /* Even if yy_conf ->name is NULL
2448 <           * should still unhook any hub/leaf confs still pending
2449 <           */
2450 <          unhook_hub_leaf_confs();
2451 <
2452 <          if (yy_conf->name != NULL)
2453 <          {
2454 < #ifndef HAVE_LIBCRYPTO
2455 <            if (IsConfCryptLink(yy_aconf))
2456 <              yyerror("Ignoring connect block -- no OpenSSL support");
2457 < #else
2458 <            if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2459 <              yyerror("Ignoring connect block -- missing key");
2460 < #endif
2461 <            if (yy_aconf->host == NULL)
2462 <              yyerror("Ignoring connect block -- missing host");
2463 <            else if (!IsConfCryptLink(yy_aconf) &&
2464 <                    (!yy_aconf->passwd || !yy_aconf->spasswd))
2465 <              yyerror("Ignoring connect block -- missing password");
2466 <          }
2467 <
2468 <
2469 <          /* XXX
2470 <           * This fixes a try_connections() core (caused by invalid class_ptr
2471 <           * pointers) reported by metalrock. That's an ugly fix, but there
2472 <           * is currently no better way. The entire config subsystem needs an
2473 <           * rewrite ASAP. make_conf_item() shouldn't really add things onto
2474 <           * a doubly linked list immediately without any sanity checks!  -Michael
2475 <           */
2476 <          delete_conf_item(yy_conf);
2477 <
2478 <          yy_aconf = NULL;
2479 <          yy_conf = NULL;
2480 <        }
2481 <
2482 <      /*
2483 <       * yy_conf is still pointing at the server that is having
2484 <       * a connect block built for it. This means, y_aconf->name
2485 <       * points to the actual irc name this server will be known as.
2486 <       * Now this new server has a set or even just one hub_mask (or leaf_mask)
2487 <       * given in the link list at yy_hconf. Fill in the HUB confs
2488 <       * from this link list now.
2489 <       */        
2490 <      DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
2491 <      {
2492 <        struct ConfItem *new_hub_conf;
2493 <        struct MatchItem *match_item;
2494 <
2495 <        yy_hconf = ptr->data;
2496 <
2497 <        /* yy_conf == NULL is a fatal error for this connect block! */
2498 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2499 <        {
2500 <          new_hub_conf = make_conf_item(HUB_TYPE);
2501 <          match_item = (struct MatchItem *)map_to_conf(new_hub_conf);
2502 <          DupString(new_hub_conf->name, yy_conf->name);
2503 <          if (yy_hconf->user != NULL)
2504 <            DupString(match_item->user, yy_hconf->user);
2505 <          else
2506 <            DupString(match_item->user, "*");
2507 <          if (yy_hconf->host != NULL)
2508 <            DupString(match_item->host, yy_hconf->host);
2509 <          else
2510 <            DupString(match_item->host, "*");
2511 <        }
2512 <        dlinkDelete(&yy_hconf->node, &hub_conf_list);
2513 <        free_collect_item(yy_hconf);
2514 <      }
2515 <
2516 <      /* Ditto for the LEAF confs */
2517 <
2518 <      DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
2519 <      {
2520 <        struct ConfItem *new_leaf_conf;
2521 <        struct MatchItem *match_item;
2522 <
2523 <        yy_lconf = ptr->data;
2524 <
2525 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2526 <        {
2527 <          new_leaf_conf = make_conf_item(LEAF_TYPE);
2528 <          match_item = (struct MatchItem *)map_to_conf(new_leaf_conf);
2529 <          DupString(new_leaf_conf->name, yy_conf->name);
2530 <          if (yy_lconf->user != NULL)
2531 <            DupString(match_item->user, yy_lconf->user);
2532 <          else
2533 <            DupString(match_item->user, "*");
2534 <          if (yy_lconf->host != NULL)
2535 <            DupString(match_item->host, yy_lconf->host);
2536 <          else
2537 <            DupString(match_item->host, "*");
2538 <        }
2539 <        dlinkDelete(&yy_lconf->node, &leaf_conf_list);
2540 <        free_collect_item(yy_lconf);
2541 <      }
2542 <      MyFree(class_name);
2543 <      class_name = NULL;
2544 <      yy_conf = NULL;
2545 <      yy_aconf = NULL;
2546 <  }
2547 < };
2082 >  struct MaskItem *conf = NULL;
2083 >  struct addrinfo hints, *res;
2084  
2085 < connect_name_b: | connect_name_t;
2086 < connect_items:  connect_items connect_item | connect_item;
2551 < connect_item:   connect_name | connect_host | connect_vhost |
2552 <                connect_send_password | connect_accept_password |
2553 <                connect_aftype | connect_port |
2554 <                connect_fakename | connect_flags | connect_hub_mask |
2555 <                connect_leaf_mask | connect_class | connect_auto |
2556 <                connect_encrypted | connect_compressed | connect_cryptlink |
2557 <                connect_rsa_public_key_file | connect_cipher_preference |
2558 <                connect_topicburst | error ';' ;
2085 >  if (conf_parser_ctx.pass != 2)
2086 >    break;
2087  
2088 < connect_name: NAME '=' QSTRING ';'
2089 < {
2090 <  if (ypass == 2)
2563 <  {
2564 <    if (yy_conf->name != NULL)
2565 <      yyerror("Multiple connect name entry");
2088 >  if (!block_state.name.buf[0] ||
2089 >      !block_state.host.buf[0])
2090 >    break;
2091  
2092 <    MyFree(yy_conf->name);
2093 <    DupString(yy_conf->name, yylval.string);
2094 <  }
2570 < };
2092 >  if (!block_state.rpass.buf[0] ||
2093 >      !block_state.spass.buf[0])
2094 >    break;
2095  
2096 < connect_name_t: QSTRING
2097 < {
2098 <  if (ypass == 2)
2575 <  {
2576 <    if (yy_conf->name != NULL)
2577 <      yyerror("Multiple connect name entry");
2096 >  if (has_wildcards(block_state.name.buf) ||
2097 >      has_wildcards(block_state.host.buf))
2098 >    break;
2099  
2100 <    MyFree(yy_conf->name);
2101 <    DupString(yy_conf->name, yylval.string);
2102 <  }
2103 < };
2100 >  conf = conf_make(CONF_SERVER);
2101 >  conf->port = block_state.port.value;
2102 >  conf->flags = block_state.flags.value;
2103 >  conf->aftype = block_state.aftype.value;
2104 >  conf->host = xstrdup(block_state.host.buf);
2105 >  conf->name = xstrdup(block_state.name.buf);
2106 >  conf->passwd = xstrdup(block_state.rpass.buf);
2107 >  conf->spasswd = xstrdup(block_state.spass.buf);
2108  
2109 < connect_host: HOST '=' QSTRING ';'
2110 < {
2586 <  if (ypass == 2)
2587 <  {
2588 <    MyFree(yy_aconf->host);
2589 <    DupString(yy_aconf->host, yylval.string);
2590 <  }
2591 < };
2109 >  if (block_state.cert.buf[0])
2110 >    conf->certfp = xstrdup(block_state.cert.buf);
2111  
2112 < connect_vhost: VHOST '=' QSTRING ';'
2113 < {
2114 <  if (ypass == 2)
2115 <  {
2116 <    struct addrinfo hints, *res;
2112 >  if (block_state.ciph.buf[0])
2113 >    conf->cipher_list = xstrdup(block_state.ciph.buf);
2114 >
2115 >  dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2116 >  dlinkMoveList(&block_state.hub.list, &conf->hub_list);
2117  
2118 +  if (block_state.bind.buf[0])
2119 +  {
2120      memset(&hints, 0, sizeof(hints));
2121  
2122      hints.ai_family   = AF_UNSPEC;
2123      hints.ai_socktype = SOCK_STREAM;
2124      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2125  
2126 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
2127 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2126 >    if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2127 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2128      else
2129      {
2130 <      assert(res != NULL);
2130 >      assert(res);
2131  
2132 <      memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen);
2133 <      yy_aconf->my_ipnum.ss.ss_family = res->ai_family;
2134 <      yy_aconf->my_ipnum.ss_len = res->ai_addrlen;
2135 <      irc_freeaddrinfo(res);
2132 >      memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2133 >      conf->bind.ss.ss_family = res->ai_family;
2134 >      conf->bind.ss_len = res->ai_addrlen;
2135 >      freeaddrinfo(res);
2136      }
2137    }
2617 };
2618
2619 connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2620 {
2621  if (ypass == 2)
2622  {
2623    if ($3[0] == ':')
2624      yyerror("Server passwords cannot begin with a colon");
2625    else if (strchr($3, ' ') != NULL)
2626      yyerror("Server passwords cannot contain spaces");
2627    else {
2628      if (yy_aconf->spasswd != NULL)
2629        memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2138  
2139 <      MyFree(yy_aconf->spasswd);
2140 <      DupString(yy_aconf->spasswd, yylval.string);
2633 <    }
2634 <  }
2139 >  conf_add_class_to_conf(conf, block_state.class.buf);
2140 >  lookup_confhost(conf);
2141   };
2142  
2143 < connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2144 < {
2145 <  if (ypass == 2)
2146 <  {
2147 <    if ($3[0] == ':')
2148 <      yyerror("Server passwords cannot begin with a colon");
2149 <    else if (strchr($3, ' ') != NULL)
2150 <      yyerror("Server passwords cannot contain spaces");
2151 <    else {
2152 <      if (yy_aconf->passwd != NULL)
2153 <        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2154 <
2155 <      MyFree(yy_aconf->passwd);
2156 <      DupString(yy_aconf->passwd, yylval.string);
2157 <    }
2158 <  }
2653 < };
2143 > connect_items:  connect_items connect_item | connect_item;
2144 > connect_item:   connect_name |
2145 >                connect_host |
2146 >                connect_vhost |
2147 >                connect_send_password |
2148 >                connect_accept_password |
2149 >                connect_ssl_certificate_fingerprint |
2150 >                connect_aftype |
2151 >                connect_port |
2152 >                connect_ssl_cipher_list |
2153 >                connect_flags |
2154 >                connect_hub_mask |
2155 >                connect_leaf_mask |
2156 >                connect_class |
2157 >                connect_encrypted |
2158 >                error ';' ;
2159  
2160 < connect_port: PORT '=' NUMBER ';'
2160 > connect_name: NAME '=' QSTRING ';'
2161   {
2162 <  if (ypass == 2)
2163 <    yy_aconf->port = $3;
2162 >  if (conf_parser_ctx.pass == 2)
2163 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2164   };
2165  
2166 < connect_aftype: AFTYPE '=' T_IPV4 ';'
2166 > connect_host: HOST '=' QSTRING ';'
2167   {
2168 <  if (ypass == 2)
2169 <    yy_aconf->aftype = AF_INET;
2665 < } | AFTYPE '=' T_IPV6 ';'
2666 < {
2667 < #ifdef IPV6
2668 <  if (ypass == 2)
2669 <    yy_aconf->aftype = AF_INET6;
2670 < #endif
2168 >  if (conf_parser_ctx.pass == 2)
2169 >    strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2170   };
2171  
2172 < connect_fakename: FAKENAME '=' QSTRING ';'
2172 > connect_vhost: VHOST '=' QSTRING ';'
2173   {
2174 <  if (ypass == 2)
2175 <  {
2677 <    MyFree(yy_aconf->fakename);
2678 <    DupString(yy_aconf->fakename, yylval.string);
2679 <  }
2174 >  if (conf_parser_ctx.pass == 2)
2175 >    strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2176   };
2177  
2178 < connect_flags: IRCD_FLAGS
2178 > connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2179   {
2180 < } '='  connect_flags_items ';';
2180 >  if (conf_parser_ctx.pass != 2)
2181 >    break;
2182  
2183 < connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2184 < connect_flags_item: NOT  { not_atom = 1; } connect_flags_item_atom
2185 <                        |  { not_atom = 0; } connect_flags_item_atom;
2186 <
2187 < connect_flags_item_atom: LAZYLINK
2188 < {
2189 <  if (ypass == 2)
2693 <  {
2694 <    if (not_atom)ClearConfLazyLink(yy_aconf);
2695 <    else SetConfLazyLink(yy_aconf);
2696 <  }
2697 < } | COMPRESSED
2698 < {
2699 <  if (ypass == 2)
2700 < #ifndef HAVE_LIBZ
2701 <    yyerror("Ignoring flags = compressed; -- no zlib support");
2702 < #else
2703 < {
2704 <   if (not_atom)ClearConfCompressed(yy_aconf);
2705 <   else SetConfCompressed(yy_aconf);
2706 < }
2707 < #endif
2708 < } | CRYPTLINK
2709 < {
2710 <  if (ypass == 2)
2711 <  {
2712 <    if (not_atom)ClearConfCryptLink(yy_aconf);
2713 <    else SetConfCryptLink(yy_aconf);
2714 <  }
2715 < } | AUTOCONN
2716 < {
2717 <  if (ypass == 2)
2718 <  {
2719 <    if (not_atom)ClearConfAllowAutoConn(yy_aconf);
2720 <    else SetConfAllowAutoConn(yy_aconf);
2721 <  }
2722 < } | BURST_AWAY
2723 < {
2724 <  if (ypass == 2)
2725 <  {
2726 <    if (not_atom)ClearConfAwayBurst(yy_aconf);
2727 <    else SetConfAwayBurst(yy_aconf);
2728 <  }
2729 < } | TOPICBURST
2730 < {
2731 <  if (ypass == 2)
2732 <  {
2733 <    if (not_atom)ClearConfTopicBurst(yy_aconf);
2734 <    else SetConfTopicBurst(yy_aconf);
2735 <  }
2736 < }
2737 < ;
2183 >  if ($3[0] == ':')
2184 >    conf_error_report("Server passwords cannot begin with a colon");
2185 >  else if (strchr($3, ' '))
2186 >    conf_error_report("Server passwords cannot contain spaces");
2187 >  else
2188 >    strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
2189 > };
2190  
2191 < connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2191 > connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2192   {
2193 < #ifdef HAVE_LIBCRYPTO
2194 <  if (ypass == 2)
2743 <  {
2744 <    BIO *file;
2745 <
2746 <    if (yy_aconf->rsa_public_key != NULL)
2747 <    {
2748 <      RSA_free(yy_aconf->rsa_public_key);
2749 <      yy_aconf->rsa_public_key = NULL;
2750 <    }
2751 <
2752 <    if (yy_aconf->rsa_public_key_file != NULL)
2753 <    {
2754 <      MyFree(yy_aconf->rsa_public_key_file);
2755 <      yy_aconf->rsa_public_key_file = NULL;
2756 <    }
2757 <
2758 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
2759 <
2760 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2761 <    {
2762 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2763 <      break;
2764 <    }
2193 >  if (conf_parser_ctx.pass != 2)
2194 >    break;
2195  
2196 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2197 <
2198 <    if (yy_aconf->rsa_public_key == NULL)
2199 <    {
2200 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2201 <      break;
2772 <    }
2773 <      
2774 <    BIO_set_close(file, BIO_CLOSE);
2775 <    BIO_free(file);
2776 <  }
2777 < #endif /* HAVE_LIBCRYPTO */
2196 >  if ($3[0] == ':')
2197 >    conf_error_report("Server passwords cannot begin with a colon");
2198 >  else if (strchr($3, ' '))
2199 >    conf_error_report("Server passwords cannot contain spaces");
2200 >  else
2201 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2202   };
2203  
2204 < connect_encrypted: ENCRYPTED '=' TBOOL ';'
2204 > connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2205   {
2206 <  if (ypass == 2)
2207 <  {
2784 <    if (yylval.number)
2785 <      yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
2786 <    else
2787 <      yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED;
2788 <  }
2206 >  if (conf_parser_ctx.pass == 2)
2207 >    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2208   };
2209  
2210 < connect_cryptlink: CRYPTLINK '=' TBOOL ';'
2210 > connect_port: PORT '=' NUMBER ';'
2211   {
2212 <  if (ypass == 2)
2213 <  {
2795 <    if (yylval.number)
2796 <      yy_aconf->flags |= CONF_FLAGS_CRYPTLINK;
2797 <    else
2798 <      yy_aconf->flags &= ~CONF_FLAGS_CRYPTLINK;
2799 <  }
2212 >  if (conf_parser_ctx.pass == 2)
2213 >    block_state.port.value = $3;
2214   };
2215  
2216 < connect_compressed: COMPRESSED '=' TBOOL ';'
2216 > connect_aftype: AFTYPE '=' T_IPV4 ';'
2217   {
2218 <  if (ypass == 2)
2219 <  {
2220 <    if (yylval.number)
2221 < #ifndef HAVE_LIBZ
2222 <      yyerror("Ignoring compressed=yes; -- no zlib support");
2223 < #else
2810 <      yy_aconf->flags |= CONF_FLAGS_COMPRESSED;
2811 < #endif
2812 <    else
2813 <      yy_aconf->flags &= ~CONF_FLAGS_COMPRESSED;
2814 <  }
2218 >  if (conf_parser_ctx.pass == 2)
2219 >    block_state.aftype.value = AF_INET;
2220 > } | AFTYPE '=' T_IPV6 ';'
2221 > {
2222 >  if (conf_parser_ctx.pass == 2)
2223 >    block_state.aftype.value = AF_INET6;
2224   };
2225  
2226 < connect_auto: AUTOCONN '=' TBOOL ';'
2226 > connect_flags: IRCD_FLAGS
2227   {
2228 <  if (ypass == 2)
2229 <  {
2230 <    if (yylval.number)
2231 <      yy_aconf->flags |= CONF_FLAGS_ALLOW_AUTO_CONN;
2232 <    else
2233 <      yy_aconf->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN;
2234 <  }
2228 >  block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2229 > } '='  connect_flags_items ';';
2230 >
2231 > connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2232 > connect_flags_item: AUTOCONN
2233 > {
2234 >  if (conf_parser_ctx.pass == 2)
2235 >    block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN;
2236 > } | T_SSL
2237 > {
2238 >  if (conf_parser_ctx.pass == 2)
2239 >    block_state.flags.value |= CONF_FLAGS_SSL;
2240   };
2241  
2242 < connect_topicburst: TOPICBURST '=' TBOOL ';'
2242 > connect_encrypted: ENCRYPTED '=' TBOOL ';'
2243   {
2244 <  if (ypass == 2)
2244 >  if (conf_parser_ctx.pass == 2)
2245    {
2246      if (yylval.number)
2247 <      SetConfTopicBurst(yy_aconf);
2247 >      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
2248      else
2249 <      ClearConfTopicBurst(yy_aconf);
2249 >      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
2250    }
2251   };
2252  
2253 < connect_hub_mask: HUB_MASK '=' QSTRING ';'
2253 > connect_hub_mask: HUB_MASK '=' QSTRING ';'
2254   {
2255 <  if (ypass == 2)
2256 <  {
2843 <    struct CollectItem *yy_tmp;
2844 <
2845 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2846 <    DupString(yy_tmp->host, yylval.string);
2847 <    DupString(yy_tmp->user, "*");
2848 <    dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list);
2849 <  }
2255 >  if (conf_parser_ctx.pass == 2)
2256 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2257   };
2258  
2259 < connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2259 > connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2260   {
2261 <  if (ypass == 2)
2262 <  {
2856 <    struct CollectItem *yy_tmp;
2857 <
2858 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2859 <    DupString(yy_tmp->host, yylval.string);
2860 <    DupString(yy_tmp->user, "*");
2861 <    dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list);
2862 <  }
2261 >  if (conf_parser_ctx.pass == 2)
2262 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
2263   };
2264  
2265   connect_class: CLASS '=' QSTRING ';'
2266   {
2267 <  if (ypass == 2)
2268 <  {
2869 <    MyFree(class_name);
2870 <    DupString(class_name, yylval.string);
2871 <  }
2267 >  if (conf_parser_ctx.pass == 2)
2268 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
2269   };
2270  
2271 < connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2271 > connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2272   {
2273 < #ifdef HAVE_LIBCRYPTO
2274 <  if (ypass == 2)
2275 <  {
2879 <    struct EncCapability *ecap;
2880 <    const char *cipher_name;
2881 <    int found = 0;
2882 <
2883 <    yy_aconf->cipher_preference = NULL;
2884 <    cipher_name = yylval.string;
2885 <
2886 <    for (ecap = CipherTable; ecap->name; ecap++)
2887 <    {
2888 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
2889 <          (ecap->cap & CAP_ENC_MASK))
2890 <      {
2891 <        yy_aconf->cipher_preference = ecap;
2892 <        found = 1;
2893 <        break;
2894 <      }
2895 <    }
2896 <
2897 <    if (!found)
2898 <      yyerror("Invalid cipher");
2899 <  }
2273 > #ifdef HAVE_TLS
2274 >  if (conf_parser_ctx.pass == 2)
2275 >    strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2276   #else
2277 <  if (ypass == 2)
2278 <    yyerror("Ignoring cipher_preference -- no OpenSSL support");
2277 >  if (conf_parser_ctx.pass == 2)
2278 >    conf_error_report("Ignoring connect::ciphers -- no TLS support");
2279   #endif
2280   };
2281  
2282 +
2283   /***************************************************************************
2284 < *  section kill
2284 > * kill {} section
2285   ***************************************************************************/
2286   kill_entry: KILL
2287   {
2288 <  if (ypass == 2)
2289 <  {
2913 <    userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2914 <    regex_ban = 0;
2915 <  }
2288 >  if (conf_parser_ctx.pass == 2)
2289 >    reset_block_state();
2290   } '{' kill_items '}' ';'
2291   {
2292 <  if (ypass == 2)
2919 <  {
2920 <    if (userbuf[0] && hostbuf[0])
2921 <    {
2922 <      if (regex_ban)
2923 <      {
2924 <        pcre *exp_user = NULL;
2925 <        pcre *exp_host = NULL;
2926 <        const char *errptr = NULL;
2927 <
2928 <        if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2929 <            !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2930 <        {
2931 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2932 <               errptr);
2933 <          break;
2934 <        }
2935 <
2936 <        yy_conf = make_conf_item(RKLINE_TYPE);
2937 <        yy_aconf = map_to_conf(yy_conf);
2938 <
2939 <        yy_aconf->regexuser = exp_user;
2940 <        yy_aconf->regexhost = exp_host;
2941 <
2942 <        DupString(yy_aconf->user, userbuf);
2943 <        DupString(yy_aconf->host, hostbuf);
2944 <
2945 <        if (reasonbuf[0])
2946 <          DupString(yy_aconf->reason, reasonbuf);
2947 <        else
2948 <          DupString(yy_aconf->reason, "No reason");
2949 <      }
2950 <      else
2951 <      {
2952 <        yy_conf = make_conf_item(KLINE_TYPE);
2953 <        yy_aconf = map_to_conf(yy_conf);
2954 <
2955 <        DupString(yy_aconf->user, userbuf);
2956 <        DupString(yy_aconf->host, hostbuf);
2957 <
2958 <        if (reasonbuf[0])
2959 <          DupString(yy_aconf->reason, reasonbuf);
2960 <        else
2961 <          DupString(yy_aconf->reason, "No reason");
2962 <        add_conf_by_address(CONF_KILL, yy_aconf);
2963 <      }
2964 <    }
2965 <    else
2966 <      delete_conf_item(yy_conf);
2292 >  struct MaskItem *conf = NULL;
2293  
2294 <    yy_conf = NULL;
2295 <    yy_aconf = NULL;
2970 <  }
2971 < };
2294 >  if (conf_parser_ctx.pass != 2)
2295 >    break;
2296  
2297 < kill_type: TYPE
2298 < {
2299 < } '='  kill_type_items ';';
2297 >  if (!block_state.user.buf[0] ||
2298 >      !block_state.host.buf[0])
2299 >    break;
2300  
2301 < kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2302 < kill_type_item: REGEX_T
2303 < {
2304 <  if (ypass == 2)
2305 <    regex_ban = 1;
2301 >  conf = conf_make(CONF_KLINE);
2302 >  conf->user = xstrdup(block_state.user.buf);
2303 >  conf->host = xstrdup(block_state.host.buf);
2304 >
2305 >  if (block_state.rpass.buf[0])
2306 >    conf->reason = xstrdup(block_state.rpass.buf);
2307 >  else
2308 >    conf->reason = xstrdup(CONF_NOREASON);
2309 >  add_conf_by_address(CONF_KLINE, conf);
2310   };
2311  
2312   kill_items:     kill_items kill_item | kill_item;
2313 < kill_item:      kill_user | kill_reason | kill_type | error;
2313 > kill_item:      kill_user | kill_reason | error;
2314  
2315   kill_user: USER '=' QSTRING ';'
2316   {
2317 <  if (ypass == 2)
2317 >
2318 >  if (conf_parser_ctx.pass == 2)
2319    {
2320      struct split_nuh_item nuh;
2321  
2322      nuh.nuhmask  = yylval.string;
2323      nuh.nickptr  = NULL;
2324 <    nuh.userptr  = userbuf;
2325 <    nuh.hostptr  = hostbuf;
2324 >    nuh.userptr  = block_state.user.buf;
2325 >    nuh.hostptr  = block_state.host.buf;
2326  
2327      nuh.nicksize = 0;
2328 <    nuh.usersize = sizeof(userbuf);
2329 <    nuh.hostsize = sizeof(hostbuf);
2328 >    nuh.usersize = sizeof(block_state.user.buf);
2329 >    nuh.hostsize = sizeof(block_state.host.buf);
2330  
2331      split_nuh(&nuh);
2332    }
2333   };
2334  
2335 < kill_reason: REASON '=' QSTRING ';'
2335 > kill_reason: REASON '=' QSTRING ';'
2336   {
2337 <  if (ypass == 2)
2338 <    strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2337 >  if (conf_parser_ctx.pass == 2)
2338 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2339   };
2340  
2341 +
2342   /***************************************************************************
2343 < *  section deny
2343 > * deny {} section
2344   ***************************************************************************/
2345 < deny_entry: DENY
2345 > deny_entry: DENY
2346   {
2347 <  if (ypass == 2)
2348 <  {
3019 <    yy_conf = make_conf_item(DLINE_TYPE);
3020 <    yy_aconf = map_to_conf(yy_conf);
3021 <    /* default reason */
3022 <    DupString(yy_aconf->reason, "No reason");
3023 <  }
2347 >  if (conf_parser_ctx.pass == 2)
2348 >    reset_block_state();
2349   } '{' deny_items '}' ';'
2350   {
2351 <  if (ypass == 2)
2351 >  struct MaskItem *conf = NULL;
2352 >
2353 >  if (conf_parser_ctx.pass != 2)
2354 >    break;
2355 >
2356 >  if (!block_state.addr.buf[0])
2357 >    break;
2358 >
2359 >  if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2360    {
2361 <    if (yy_aconf->host && parse_netmask(yy_aconf->host, NULL, NULL) != HM_HOST)
2362 <      add_conf_by_address(CONF_DLINE, yy_aconf);
2361 >    conf = conf_make(CONF_DLINE);
2362 >    conf->host = xstrdup(block_state.addr.buf);
2363 >
2364 >    if (block_state.rpass.buf[0])
2365 >      conf->reason = xstrdup(block_state.rpass.buf);
2366      else
2367 <      delete_conf_item(yy_conf);
2368 <    yy_conf = NULL;
3033 <    yy_aconf = NULL;
2367 >      conf->reason = xstrdup(CONF_NOREASON);
2368 >    add_conf_by_address(CONF_DLINE, conf);
2369    }
2370 < };
2370 > };
2371  
2372   deny_items:     deny_items deny_item | deny_item;
2373   deny_item:      deny_ip | deny_reason | error;
2374  
2375   deny_ip: IP '=' QSTRING ';'
2376   {
2377 <  if (ypass == 2)
2378 <  {
3044 <    MyFree(yy_aconf->host);
3045 <    DupString(yy_aconf->host, yylval.string);
3046 <  }
2377 >  if (conf_parser_ctx.pass == 2)
2378 >    strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2379   };
2380  
2381 < deny_reason: REASON '=' QSTRING ';'
2381 > deny_reason: REASON '=' QSTRING ';'
2382   {
2383 <  if (ypass == 2)
2384 <  {
3053 <    MyFree(yy_aconf->reason);
3054 <    DupString(yy_aconf->reason, yylval.string);
3055 <  }
2383 >  if (conf_parser_ctx.pass == 2)
2384 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2385   };
2386  
2387 +
2388   /***************************************************************************
2389 < *  section exempt
2389 > * exempt {} section
2390   ***************************************************************************/
2391   exempt_entry: EXEMPT '{' exempt_items '}' ';';
2392  
2393 < exempt_items:     exempt_items exempt_item | exempt_item;
2394 < exempt_item:      exempt_ip | error;
2393 > exempt_items: exempt_items exempt_item | exempt_item;
2394 > exempt_item:  exempt_ip | error;
2395  
2396   exempt_ip: IP '=' QSTRING ';'
2397   {
2398 <  if (ypass == 2)
2398 >  if (conf_parser_ctx.pass == 2)
2399    {
2400 <    if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2400 >    if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2401      {
2402 <      yy_conf = make_conf_item(EXEMPTDLINE_TYPE);
2403 <      yy_aconf = map_to_conf(yy_conf);
3074 <      DupString(yy_aconf->host, yylval.string);
2402 >      struct MaskItem *conf = conf_make(CONF_EXEMPT);
2403 >      conf->host = xstrdup(yylval.string);
2404  
2405 <      add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
3077 <
3078 <      yy_conf = NULL;
3079 <      yy_aconf = NULL;
2405 >      add_conf_by_address(CONF_EXEMPT, conf);
2406      }
2407    }
2408   };
2409  
2410   /***************************************************************************
2411 < *  section gecos
2411 > * gecos {} section
2412   ***************************************************************************/
2413   gecos_entry: GECOS
2414   {
2415 <  if (ypass == 2)
2416 <  {
3091 <    regex_ban = 0;
3092 <    reasonbuf[0] = gecos_name[0] = '\0';
3093 <  }
2415 >  if (conf_parser_ctx.pass == 2)
2416 >    reset_block_state();
2417   } '{' gecos_items '}' ';'
2418   {
2419 <  if (ypass == 2)
2420 <  {
3098 <    if (gecos_name[0])
3099 <    {
3100 <      if (regex_ban)
3101 <      {
3102 <        pcre *exp_p = NULL;
3103 <        const char *errptr = NULL;
3104 <
3105 <        if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
3106 <        {
3107 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
3108 <               errptr);
3109 <          break;
3110 <        }
3111 <
3112 <        yy_conf = make_conf_item(RXLINE_TYPE);
3113 <        yy_conf->regexpname = exp_p;
3114 <      }
3115 <      else
3116 <        yy_conf = make_conf_item(XLINE_TYPE);
3117 <
3118 <      yy_match_item = map_to_conf(yy_conf);
3119 <      DupString(yy_conf->name, gecos_name);
3120 <
3121 <      if (reasonbuf[0])
3122 <        DupString(yy_match_item->reason, reasonbuf);
3123 <      else
3124 <        DupString(yy_match_item->reason, "No reason");
3125 <    }
3126 <  }
3127 < };
2419 >  if (conf_parser_ctx.pass != 2)
2420 >    break;
2421  
2422 < gecos_flags: TYPE
2423 < {
3131 < } '='  gecos_flags_items ';';
2422 >  if (!block_state.name.buf[0])
2423 >    break;
2424  
2425 < gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2426 < gecos_flags_item: REGEX_T
2427 < {
2428 <  if (ypass == 2)
2429 <    regex_ban = 1;
2425 >  struct GecosItem *gecos = gecos_make();
2426 >  gecos->mask = xstrdup(block_state.name.buf);
2427 >
2428 >  if (block_state.rpass.buf[0])
2429 >    gecos->reason = xstrdup(block_state.rpass.buf);
2430 >  else
2431 >    gecos->reason = xstrdup(CONF_NOREASON);
2432   };
2433  
2434   gecos_items: gecos_items gecos_item | gecos_item;
2435 < gecos_item:  gecos_name | gecos_reason | gecos_flags | error;
2435 > gecos_item:  gecos_name | gecos_reason | error;
2436  
2437 < gecos_name: NAME '=' QSTRING ';'
2437 > gecos_name: NAME '=' QSTRING ';'
2438   {
2439 <  if (ypass == 2)
2440 <    strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
2439 >  if (conf_parser_ctx.pass == 2)
2440 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2441   };
2442  
2443 < gecos_reason: REASON '=' QSTRING ';'
2443 > gecos_reason: REASON '=' QSTRING ';'
2444   {
2445 <  if (ypass == 2)
2446 <    strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2445 >  if (conf_parser_ctx.pass == 2)
2446 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2447   };
2448  
2449 +
2450   /***************************************************************************
2451 < *  section general
2451 > * general {} section
2452   ***************************************************************************/
2453 < general_entry: GENERAL
3159 <  '{' general_items '}' ';';
2453 > general_entry: GENERAL '{' general_items '}' ';';
2454  
2455   general_items:      general_items general_item | general_item;
2456 < general_item:       general_hide_spoof_ips | general_ignore_bogus_ts |
2457 <                    general_failed_oper_notice | general_anti_nick_flood |
2458 <                    general_max_nick_time | general_max_nick_changes |
2459 <                    general_max_accept | general_anti_spam_exit_message_time |
2460 <                    general_ts_warn_delta | general_ts_max_delta |
2461 <                    general_kill_chase_time_limit | general_kline_with_reason |
2462 <                    general_kline_reason | general_invisible_on_connect |
2463 <                    general_warn_no_nline | general_dots_in_ident |
2464 <                    general_stats_o_oper_only | general_stats_k_oper_only |
2465 <                    general_pace_wait | general_stats_i_oper_only |
2466 <                    general_pace_wait_simple | general_stats_P_oper_only |
2467 <                    general_short_motd | general_no_oper_flood |
2468 <                    general_true_no_oper_flood | general_oper_pass_resv |
2469 <                    general_idletime | general_message_locale |
2470 <                    general_oper_only_umodes | general_max_targets |
2471 <                    general_use_egd | general_egdpool_path |
2472 <                    general_oper_umodes | general_caller_id_wait |
2473 <                    general_opers_bypass_callerid | general_default_floodcount |
2474 <                    general_min_nonwildcard | general_min_nonwildcard_simple |
2475 <                    general_servlink_path | general_disable_remote_commands |
2476 <                    general_default_cipher_preference |
2477 <                    general_compression_level | general_client_flood |
2478 <                    general_throttle_time | general_havent_read_conf |
2479 <                    general_dot_in_ip6_addr | general_ping_cookie |
2480 <                    general_disable_auth | general_burst_away |
2481 <                    general_tkline_expire_notices | general_gline_min_cidr |
2482 <                    general_gline_min_cidr6 | general_use_whois_actually |
2483 <                    general_reject_hold_time | general_stats_e_disabled |
2484 <                    error;
2456 > general_item:       general_away_count |
2457 >                    general_away_time |
2458 >                    general_ignore_bogus_ts |
2459 >                    general_failed_oper_notice |
2460 >                    general_anti_nick_flood |
2461 >                    general_max_nick_time |
2462 >                    general_max_nick_changes |
2463 >                    general_max_accept |
2464 >                    general_whowas_history_length |
2465 >                    general_anti_spam_exit_message_time |
2466 >                    general_ts_warn_delta |
2467 >                    general_ts_max_delta |
2468 >                    general_kill_chase_time_limit |
2469 >                    general_invisible_on_connect |
2470 >                    general_warn_no_connect_block |
2471 >                    general_dots_in_ident |
2472 >                    general_stats_i_oper_only |
2473 >                    general_stats_k_oper_only |
2474 >                    general_stats_m_oper_only |
2475 >                    general_stats_o_oper_only |
2476 >                    general_stats_P_oper_only |
2477 >                    general_stats_u_oper_only |
2478 >                    general_pace_wait |
2479 >                    general_pace_wait_simple |
2480 >                    general_short_motd |
2481 >                    general_no_oper_flood |
2482 >                    general_oper_only_umodes |
2483 >                    general_max_targets |
2484 >                    general_oper_umodes |
2485 >                    general_caller_id_wait |
2486 >                    general_opers_bypass_callerid |
2487 >                    general_default_floodcount |
2488 >                    general_min_nonwildcard |
2489 >                    general_min_nonwildcard_simple |
2490 >                    general_throttle_count |
2491 >                    general_throttle_time |
2492 >                    general_ping_cookie |
2493 >                    general_disable_auth |
2494 >                    general_tkline_expire_notices |
2495 >                    general_dline_min_cidr |
2496 >                    general_dline_min_cidr6 |
2497 >                    general_kline_min_cidr |
2498 >                    general_kline_min_cidr6 |
2499 >                    general_stats_e_disabled |
2500 >                    general_max_watch |
2501 >                    general_cycle_on_host_change |
2502 >                    error;
2503  
2504  
2505 + general_away_count: AWAY_COUNT '=' NUMBER ';'
2506 + {
2507 +  ConfigGeneral.away_count = $3;
2508 + };
2509  
2510 < general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2510 > general_away_time: AWAY_TIME '=' timespec ';'
2511   {
2512 <  ConfigFileEntry.gline_min_cidr = $3;
2512 >  ConfigGeneral.away_time = $3;
2513   };
2514  
2515 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2515 > general_max_watch: MAX_WATCH '=' NUMBER ';'
2516   {
2517 <  ConfigFileEntry.gline_min_cidr6 = $3;
2517 >  ConfigGeneral.max_watch = $3;
2518   };
2519  
2520 < general_burst_away: BURST_AWAY '=' TBOOL ';'
2520 > general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2521   {
2522 <  ConfigFileEntry.burst_away = yylval.number;
2522 >  ConfigGeneral.whowas_history_length = $3;
2523   };
2524  
2525 < general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2525 > general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2526   {
2527 <  ConfigFileEntry.use_whois_actually = yylval.number;
2527 >  if (conf_parser_ctx.pass == 2)
2528 >    ConfigGeneral.cycle_on_host_change = yylval.number;
2529   };
2530  
2531 < general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';'
2531 > general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2532   {
2533 <  GlobalSetOptions.rejecttime = yylval.number;
2533 >  ConfigGeneral.dline_min_cidr = $3;
2534   };
2535  
2536 < general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2536 > general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2537   {
2538 <  ConfigFileEntry.tkline_expire_notices = yylval.number;
2538 >  ConfigGeneral.dline_min_cidr6 = $3;
2539   };
2540  
2541 < general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' NUMBER ';'
2541 > general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2542   {
2543 <  ConfigFileEntry.kill_chase_time_limit = $3;
2543 >  ConfigGeneral.kline_min_cidr = $3;
2544   };
2545  
2546 < general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2546 > general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2547   {
2548 <  ConfigFileEntry.hide_spoof_ips = yylval.number;
2548 >  ConfigGeneral.kline_min_cidr6 = $3;
2549   };
2550  
2551 < general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2551 > general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2552   {
2553 <  ConfigFileEntry.ignore_bogus_ts = yylval.number;
2553 >  ConfigGeneral.tkline_expire_notices = yylval.number;
2554   };
2555  
2556 < general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2556 > general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2557   {
2558 <  ConfigFileEntry.disable_remote = yylval.number;
2558 >  ConfigGeneral.kill_chase_time_limit = $3;
2559 > };
2560 >
2561 > general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2562 > {
2563 >  ConfigGeneral.ignore_bogus_ts = yylval.number;
2564   };
2565  
2566   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2567   {
2568 <  ConfigFileEntry.failed_oper_notice = yylval.number;
2568 >  ConfigGeneral.failed_oper_notice = yylval.number;
2569   };
2570  
2571   general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2572   {
2573 <  ConfigFileEntry.anti_nick_flood = yylval.number;
2573 >  ConfigGeneral.anti_nick_flood = yylval.number;
2574   };
2575  
2576   general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2577   {
2578 <  ConfigFileEntry.max_nick_time = $3;
2578 >  ConfigGeneral.max_nick_time = $3;
2579   };
2580  
2581   general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2582   {
2583 <  ConfigFileEntry.max_nick_changes = $3;
2583 >  ConfigGeneral.max_nick_changes = $3;
2584   };
2585  
2586   general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2587   {
2588 <  ConfigFileEntry.max_accept = $3;
2588 >  ConfigGeneral.max_accept = $3;
2589   };
2590  
2591   general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2592   {
2593 <  ConfigFileEntry.anti_spam_exit_message_time = $3;
2593 >  ConfigGeneral.anti_spam_exit_message_time = $3;
2594   };
2595  
2596   general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2597   {
2598 <  ConfigFileEntry.ts_warn_delta = $3;
2598 >  ConfigGeneral.ts_warn_delta = $3;
2599   };
2600  
2601   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2602   {
2603 <  if (ypass == 2)
2604 <    ConfigFileEntry.ts_max_delta = $3;
2603 >  if (conf_parser_ctx.pass == 2)
2604 >    ConfigGeneral.ts_max_delta = $3;
2605   };
2606  
2607 < general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2607 > general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2608   {
2609 <  if (($3 > 0) && ypass == 1)
3288 <  {
3289 <    ilog(L_CRIT, "You haven't read your config file properly.");
3290 <    ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
3291 <    ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
3292 <    exit(0);
3293 <  }
2609 >  ConfigGeneral.invisible_on_connect = yylval.number;
2610   };
2611  
2612 < general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
2612 > general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2613   {
2614 <  ConfigFileEntry.kline_with_reason = yylval.number;
2614 >  ConfigGeneral.warn_no_connect_block = yylval.number;
2615   };
2616  
2617 < general_kline_reason: KLINE_REASON '=' QSTRING ';'
2617 > general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2618   {
2619 <  if (ypass == 2)
3304 <  {
3305 <    MyFree(ConfigFileEntry.kline_reason);
3306 <    DupString(ConfigFileEntry.kline_reason, yylval.string);
3307 <  }
2619 >  ConfigGeneral.stats_e_disabled = yylval.number;
2620   };
2621  
2622 < general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2622 > general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2623   {
2624 <  ConfigFileEntry.invisible_on_connect = yylval.number;
2624 >  ConfigGeneral.stats_m_oper_only = yylval.number;
2625   };
2626  
2627 < general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';'
2627 > general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2628   {
2629 <  ConfigFileEntry.warn_no_nline = yylval.number;
2629 >  ConfigGeneral.stats_o_oper_only = yylval.number;
2630   };
2631  
2632 < general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2632 > general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2633   {
2634 <  ConfigFileEntry.stats_e_disabled = yylval.number;
2634 >  ConfigGeneral.stats_P_oper_only = yylval.number;
2635   };
2636  
2637 < general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2637 > general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2638   {
2639 <  ConfigFileEntry.stats_o_oper_only = yylval.number;
3328 < };
3329 <
3330 < general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
3331 < {
3332 <  ConfigFileEntry.stats_P_oper_only = yylval.number;
2639 >  ConfigGeneral.stats_u_oper_only = yylval.number;
2640   };
2641  
2642   general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2643   {
2644 <  ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2644 >  ConfigGeneral.stats_k_oper_only = 2 * yylval.number;
2645   } | STATS_K_OPER_ONLY '=' TMASKED ';'
2646   {
2647 <  ConfigFileEntry.stats_k_oper_only = 1;
2647 >  ConfigGeneral.stats_k_oper_only = 1;
2648   };
2649  
2650   general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2651   {
2652 <  ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2652 >  ConfigGeneral.stats_i_oper_only = 2 * yylval.number;
2653   } | STATS_I_OPER_ONLY '=' TMASKED ';'
2654   {
2655 <  ConfigFileEntry.stats_i_oper_only = 1;
2655 >  ConfigGeneral.stats_i_oper_only = 1;
2656   };
2657  
2658   general_pace_wait: PACE_WAIT '=' timespec ';'
2659   {
2660 <  ConfigFileEntry.pace_wait = $3;
2660 >  ConfigGeneral.pace_wait = $3;
2661   };
2662  
2663   general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2664   {
2665 <  ConfigFileEntry.caller_id_wait = $3;
2665 >  ConfigGeneral.caller_id_wait = $3;
2666   };
2667  
2668   general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2669   {
2670 <  ConfigFileEntry.opers_bypass_callerid = yylval.number;
2670 >  ConfigGeneral.opers_bypass_callerid = yylval.number;
2671   };
2672  
2673   general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2674   {
2675 <  ConfigFileEntry.pace_wait_simple = $3;
2675 >  ConfigGeneral.pace_wait_simple = $3;
2676   };
2677  
2678   general_short_motd: SHORT_MOTD '=' TBOOL ';'
2679   {
2680 <  ConfigFileEntry.short_motd = yylval.number;
3374 < };
3375 <  
3376 < general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
3377 < {
3378 <  ConfigFileEntry.no_oper_flood = yylval.number;
3379 < };
3380 <
3381 < general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
3382 < {
3383 <  ConfigFileEntry.true_no_oper_flood = yylval.number;
3384 < };
3385 <
3386 < general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
3387 < {
3388 <  ConfigFileEntry.oper_pass_resv = yylval.number;
3389 < };
3390 <
3391 < general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
3392 < {
3393 <  if (ypass == 2)
3394 <  {
3395 <    if (strlen(yylval.string) > LOCALE_LENGTH-2)
3396 <      yylval.string[LOCALE_LENGTH-1] = '\0';
3397 <
3398 <    set_locale(yylval.string);
3399 <  }
2680 >  ConfigGeneral.short_motd = yylval.number;
2681   };
2682  
2683 < general_idletime: IDLETIME '=' timespec ';'
2683 > general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2684   {
2685 <  ConfigFileEntry.idletime = $3;
2685 >  ConfigGeneral.no_oper_flood = yylval.number;
2686   };
2687  
2688   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2689   {
2690 <  ConfigFileEntry.dots_in_ident = $3;
2690 >  ConfigGeneral.dots_in_ident = $3;
2691   };
2692  
2693   general_max_targets: MAX_TARGETS '=' NUMBER ';'
2694   {
2695 <  ConfigFileEntry.max_targets = $3;
2695 >  ConfigGeneral.max_targets = $3;
2696   };
2697  
2698 < general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3418 < {
3419 <  if (ypass == 2)
3420 <  {
3421 <    MyFree(ConfigFileEntry.servlink_path);
3422 <    DupString(ConfigFileEntry.servlink_path, yylval.string);
3423 <  }
3424 < };
3425 <
3426 < general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3427 < {
3428 < #ifdef HAVE_LIBCRYPTO
3429 <  if (ypass == 2)
3430 <  {
3431 <    struct EncCapability *ecap;
3432 <    const char *cipher_name;
3433 <    int found = 0;
3434 <
3435 <    ConfigFileEntry.default_cipher_preference = NULL;
3436 <    cipher_name = yylval.string;
3437 <
3438 <    for (ecap = CipherTable; ecap->name; ecap++)
3439 <    {
3440 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
3441 <          (ecap->cap & CAP_ENC_MASK))
3442 <      {
3443 <        ConfigFileEntry.default_cipher_preference = ecap;
3444 <        found = 1;
3445 <        break;
3446 <      }
3447 <    }
3448 <
3449 <    if (!found)
3450 <      yyerror("Invalid cipher");
3451 <  }
3452 < #else
3453 <  if (ypass == 2)
3454 <    yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3455 < #endif
3456 < };
3457 <
3458 < general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3459 < {
3460 <  if (ypass == 2)
3461 <  {
3462 <    ConfigFileEntry.compression_level = $3;
3463 < #ifndef HAVE_LIBZ
3464 <    yyerror("Ignoring compression_level -- no zlib support");
3465 < #else
3466 <    if ((ConfigFileEntry.compression_level < 1) ||
3467 <        (ConfigFileEntry.compression_level > 9))
3468 <    {
3469 <      yyerror("Ignoring invalid compression_level, using default");
3470 <      ConfigFileEntry.compression_level = 0;
3471 <    }
3472 < #endif
3473 <  }
3474 < };
3475 <
3476 < general_use_egd: USE_EGD '=' TBOOL ';'
3477 < {
3478 <  ConfigFileEntry.use_egd = yylval.number;
3479 < };
3480 <
3481 < general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2698 > general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2699   {
2700 <  if (ypass == 2)
3484 <  {
3485 <    MyFree(ConfigFileEntry.egdpool_path);
3486 <    DupString(ConfigFileEntry.egdpool_path, yylval.string);
3487 <  }
2700 >  ConfigGeneral.ping_cookie = yylval.number;
2701   };
2702  
2703 < general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2703 > general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2704   {
2705 <  ConfigFileEntry.ping_cookie = yylval.number;
2705 >  ConfigGeneral.disable_auth = yylval.number;
2706   };
2707  
2708 < general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2708 > general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2709   {
2710 <  ConfigFileEntry.disable_auth = yylval.number;
2710 >  ConfigGeneral.throttle_count = $3;
2711   };
2712  
2713   general_throttle_time: THROTTLE_TIME '=' timespec ';'
2714   {
2715 <  ConfigFileEntry.throttle_time = yylval.number;
2715 >  ConfigGeneral.throttle_time = $3;
2716   };
2717  
2718   general_oper_umodes: OPER_UMODES
2719   {
2720 <  ConfigFileEntry.oper_umodes = 0;
2720 >  ConfigGeneral.oper_umodes = 0;
2721   } '='  umode_oitems ';' ;
2722  
2723   umode_oitems:    umode_oitems ',' umode_oitem | umode_oitem;
2724   umode_oitem:     T_BOTS
2725   {
2726 <  ConfigFileEntry.oper_umodes |= UMODE_BOTS;
2726 >  ConfigGeneral.oper_umodes |= UMODE_BOTS;
2727   } | T_CCONN
2728   {
2729 <  ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2729 >  ConfigGeneral.oper_umodes |= UMODE_CCONN;
2730   } | T_DEAF
2731   {
2732 <  ConfigFileEntry.oper_umodes |= UMODE_DEAF;
2732 >  ConfigGeneral.oper_umodes |= UMODE_DEAF;
2733   } | T_DEBUG
2734   {
2735 <  ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
2735 >  ConfigGeneral.oper_umodes |= UMODE_DEBUG;
2736   } | T_FULL
2737   {
2738 <  ConfigFileEntry.oper_umodes |= UMODE_FULL;
2738 >  ConfigGeneral.oper_umodes |= UMODE_FULL;
2739 > } | HIDDEN
2740 > {
2741 >  ConfigGeneral.oper_umodes |= UMODE_HIDDEN;
2742 > } | HIDE_CHANS
2743 > {
2744 >  ConfigGeneral.oper_umodes |= UMODE_HIDECHANS;
2745 > } | HIDE_IDLE
2746 > {
2747 >  ConfigGeneral.oper_umodes |= UMODE_HIDEIDLE;
2748   } | T_SKILL
2749   {
2750 <  ConfigFileEntry.oper_umodes |= UMODE_SKILL;
2750 >  ConfigGeneral.oper_umodes |= UMODE_SKILL;
2751   } | T_NCHANGE
2752   {
2753 <  ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
2753 >  ConfigGeneral.oper_umodes |= UMODE_NCHANGE;
2754   } | T_REJ
2755   {
2756 <  ConfigFileEntry.oper_umodes |= UMODE_REJ;
2756 >  ConfigGeneral.oper_umodes |= UMODE_REJ;
2757   } | T_UNAUTH
2758   {
2759 <  ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
2759 >  ConfigGeneral.oper_umodes |= UMODE_UNAUTH;
2760   } | T_SPY
2761   {
2762 <  ConfigFileEntry.oper_umodes |= UMODE_SPY;
2762 >  ConfigGeneral.oper_umodes |= UMODE_SPY;
2763   } | T_EXTERNAL
2764   {
2765 <  ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
3544 < } | T_OPERWALL
3545 < {
3546 <  ConfigFileEntry.oper_umodes |= UMODE_OPERWALL;
2765 >  ConfigGeneral.oper_umodes |= UMODE_EXTERNAL;
2766   } | T_SERVNOTICE
2767   {
2768 <  ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
2768 >  ConfigGeneral.oper_umodes |= UMODE_SERVNOTICE;
2769   } | T_INVISIBLE
2770   {
2771 <  ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
2771 >  ConfigGeneral.oper_umodes |= UMODE_INVISIBLE;
2772   } | T_WALLOP
2773   {
2774 <  ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
2774 >  ConfigGeneral.oper_umodes |= UMODE_WALLOP;
2775   } | T_SOFTCALLERID
2776   {
2777 <  ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
2777 >  ConfigGeneral.oper_umodes |= UMODE_SOFTCALLERID;
2778   } | T_CALLERID
2779   {
2780 <  ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
2780 >  ConfigGeneral.oper_umodes |= UMODE_CALLERID;
2781   } | T_LOCOPS
2782   {
2783 <  ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2783 >  ConfigGeneral.oper_umodes |= UMODE_LOCOPS;
2784 > } | T_NONONREG
2785 > {
2786 >  ConfigGeneral.oper_umodes |= UMODE_REGONLY;
2787 > } | T_FARCONNECT
2788 > {
2789 >  ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2790   };
2791  
2792 < general_oper_only_umodes: OPER_ONLY_UMODES
2792 > general_oper_only_umodes: OPER_ONLY_UMODES
2793   {
2794 <  ConfigFileEntry.oper_only_umodes = 0;
2794 >  ConfigGeneral.oper_only_umodes = 0;
2795   } '='  umode_items ';' ;
2796  
2797 < umode_items:    umode_items ',' umode_item | umode_item;
2798 < umode_item:     T_BOTS
2797 > umode_items:  umode_items ',' umode_item | umode_item;
2798 > umode_item:   T_BOTS
2799   {
2800 <  ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2800 >  ConfigGeneral.oper_only_umodes |= UMODE_BOTS;
2801   } | T_CCONN
2802   {
2803 <  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2803 >  ConfigGeneral.oper_only_umodes |= UMODE_CCONN;
2804   } | T_DEAF
2805   {
2806 <  ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
2806 >  ConfigGeneral.oper_only_umodes |= UMODE_DEAF;
2807   } | T_DEBUG
2808   {
2809 <  ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2809 >  ConfigGeneral.oper_only_umodes |= UMODE_DEBUG;
2810   } | T_FULL
2811 < {
2812 <  ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2811 > {
2812 >  ConfigGeneral.oper_only_umodes |= UMODE_FULL;
2813   } | T_SKILL
2814   {
2815 <  ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2815 >  ConfigGeneral.oper_only_umodes |= UMODE_SKILL;
2816 > } | HIDDEN
2817 > {
2818 >  ConfigGeneral.oper_only_umodes |= UMODE_HIDDEN;
2819   } | T_NCHANGE
2820   {
2821 <  ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
2821 >  ConfigGeneral.oper_only_umodes |= UMODE_NCHANGE;
2822   } | T_REJ
2823   {
2824 <  ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
2824 >  ConfigGeneral.oper_only_umodes |= UMODE_REJ;
2825   } | T_UNAUTH
2826   {
2827 <  ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
2827 >  ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH;
2828   } | T_SPY
2829   {
2830 <  ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
2830 >  ConfigGeneral.oper_only_umodes |= UMODE_SPY;
2831   } | T_EXTERNAL
2832   {
2833 <  ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
3606 < } | T_OPERWALL
3607 < {
3608 <  ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL;
2833 >  ConfigGeneral.oper_only_umodes |= UMODE_EXTERNAL;
2834   } | T_SERVNOTICE
2835   {
2836 <  ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
2836 >  ConfigGeneral.oper_only_umodes |= UMODE_SERVNOTICE;
2837   } | T_INVISIBLE
2838   {
2839 <  ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
2839 >  ConfigGeneral.oper_only_umodes |= UMODE_INVISIBLE;
2840   } | T_WALLOP
2841   {
2842 <  ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
2842 >  ConfigGeneral.oper_only_umodes |= UMODE_WALLOP;
2843   } | T_SOFTCALLERID
2844   {
2845 <  ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
2845 >  ConfigGeneral.oper_only_umodes |= UMODE_SOFTCALLERID;
2846   } | T_CALLERID
2847   {
2848 <  ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
2848 >  ConfigGeneral.oper_only_umodes |= UMODE_CALLERID;
2849   } | T_LOCOPS
2850   {
2851 <  ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
2851 >  ConfigGeneral.oper_only_umodes |= UMODE_LOCOPS;
2852 > } | T_NONONREG
2853 > {
2854 >  ConfigGeneral.oper_only_umodes |= UMODE_REGONLY;
2855 > } | T_FARCONNECT
2856 > {
2857 >  ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2858   };
2859  
2860   general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2861   {
2862 <  ConfigFileEntry.min_nonwildcard = $3;
2862 >  ConfigGeneral.min_nonwildcard = $3;
2863   };
2864  
2865   general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2866   {
2867 <  ConfigFileEntry.min_nonwildcard_simple = $3;
2867 >  ConfigGeneral.min_nonwildcard_simple = $3;
2868   };
2869  
2870   general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2871   {
2872 <  ConfigFileEntry.default_floodcount = $3;
3642 < };
3643 <
3644 < general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
3645 < {
3646 <  ConfigFileEntry.client_flood = $3;
3647 < };
3648 <
3649 < general_dot_in_ip6_addr: DOT_IN_IP6_ADDR '=' TBOOL ';'
3650 < {
3651 <  ConfigFileEntry.dot_in_ip6_addr = yylval.number;
3652 < };
3653 <
3654 < /***************************************************************************
3655 < *  section glines
3656 < ***************************************************************************/
3657 < gline_entry: GLINES
3658 < {
3659 <  if (ypass == 2)
3660 <  {
3661 <    yy_conf = make_conf_item(GDENY_TYPE);
3662 <    yy_aconf = map_to_conf(yy_conf);
3663 <  }
3664 < } '{' gline_items '}' ';'
3665 < {
3666 <  if (ypass == 2)
3667 <  {
3668 <    /*
3669 <     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3670 <     * end we will have one extra, so we should free it.
3671 <     */
3672 <    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3673 <    {
3674 <      delete_conf_item(yy_conf);
3675 <      yy_conf = NULL;
3676 <      yy_aconf = NULL;
3677 <    }
3678 <  }
3679 < };
3680 <
3681 < gline_items:        gline_items gline_item | gline_item;
3682 < gline_item:         gline_enable |
3683 <                    gline_duration |
3684 <                    gline_logging |
3685 <                    gline_user |
3686 <                    gline_server |
3687 <                    gline_action |
3688 <                    error;
3689 <
3690 < gline_enable: ENABLE '=' TBOOL ';'
3691 < {
3692 <  if (ypass == 2)
3693 <    ConfigFileEntry.glines = yylval.number;
3694 < };
3695 <
3696 < gline_duration: DURATION '=' timespec ';'
3697 < {
3698 <  if (ypass == 2)
3699 <    ConfigFileEntry.gline_time = $3;
3700 < };
3701 <
3702 < gline_logging: LOGGING
3703 < {
3704 <  if (ypass == 2)
3705 <    ConfigFileEntry.gline_logging = 0;
3706 < } '=' gline_logging_types ';';
3707 < gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3708 < gline_logging_type_item: T_REJECT
3709 < {
3710 <  if (ypass == 2)
3711 <    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3712 < } | T_BLOCK
3713 < {
3714 <  if (ypass == 2)
3715 <    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3716 < };
3717 <
3718 < gline_user: USER '=' QSTRING ';'
3719 < {
3720 <  if (ypass == 2)
3721 <  {
3722 <    struct split_nuh_item nuh;
3723 <
3724 <    nuh.nuhmask  = yylval.string;
3725 <    nuh.nickptr  = NULL;
3726 <    nuh.userptr  = userbuf;
3727 <    nuh.hostptr  = hostbuf;
3728 <
3729 <    nuh.nicksize = 0;
3730 <    nuh.usersize = sizeof(userbuf);
3731 <    nuh.hostsize = sizeof(hostbuf);
3732 <
3733 <    split_nuh(&nuh);
3734 <
3735 <    if (yy_aconf->user == NULL)
3736 <    {
3737 <      DupString(yy_aconf->user, userbuf);
3738 <      DupString(yy_aconf->host, hostbuf);
3739 <    }
3740 <    else
3741 <    {
3742 <      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3743 <
3744 <      DupString(yy_tmp->user, userbuf);
3745 <      DupString(yy_tmp->host, hostbuf);
3746 <
3747 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3748 <    }
3749 <  }
3750 < };
3751 <
3752 < gline_server: NAME '=' QSTRING ';'
3753 < {
3754 <  if (ypass == 2)  
3755 <  {
3756 <    MyFree(yy_conf->name);
3757 <    DupString(yy_conf->name, yylval.string);
3758 <  }
2872 >  ConfigGeneral.default_floodcount = $3;
2873   };
2874  
3761 gline_action: ACTION
3762 {
3763  if (ypass == 2)
3764    yy_aconf->flags = 0;
3765 } '=' gdeny_types ';'
3766 {
3767  if (ypass == 2)
3768  {
3769    struct CollectItem *yy_tmp = NULL;
3770    dlink_node *ptr, *next_ptr;
3771
3772    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3773    {
3774      struct AccessItem *new_aconf;
3775      struct ConfItem *new_conf;
3776
3777      yy_tmp = ptr->data;
3778      new_conf = make_conf_item(GDENY_TYPE);
3779      new_aconf = map_to_conf(new_conf);
3780
3781      new_aconf->flags = yy_aconf->flags;
3782
3783      if (yy_conf->name != NULL)
3784        DupString(new_conf->name, yy_conf->name);
3785      else
3786        DupString(new_conf->name, "*");
3787      if (yy_aconf->user != NULL)
3788         DupString(new_aconf->user, yy_tmp->user);
3789      else  
3790        DupString(new_aconf->user, "*");
3791      if (yy_aconf->host != NULL)
3792        DupString(new_aconf->host, yy_tmp->host);
3793      else
3794        DupString(new_aconf->host, "*");
3795
3796      dlinkDelete(&yy_tmp->node, &col_conf_list);
3797    }
3798
3799    /*
3800     * In case someone has fed us with more than one action= after user/name
3801     * which would leak memory  -Michael
3802     */
3803    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3804      delete_conf_item(yy_conf);
3805
3806    yy_conf = make_conf_item(GDENY_TYPE);
3807    yy_aconf = map_to_conf(yy_conf);
3808  }
3809 };
3810
3811 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3812 gdeny_type_item: T_REJECT
3813 {
3814  if (ypass == 2)
3815    yy_aconf->flags |= GDENY_REJECT;
3816 } | T_BLOCK
3817 {
3818  if (ypass == 2)
3819    yy_aconf->flags |= GDENY_BLOCK;
3820 };
2875  
2876   /***************************************************************************
2877 < *  section channel
2877 > * channel {} section
2878   ***************************************************************************/
2879 < channel_entry: CHANNEL
3826 <  '{' channel_items '}' ';';
2879 > channel_entry: CHANNEL '{' channel_items '}' ';';
2880  
2881   channel_items:      channel_items channel_item | channel_item;
2882 < channel_item:       channel_disable_local_channels | channel_use_except |
2883 <                    channel_use_invex | channel_use_knock |
2884 <                    channel_max_bans | channel_knock_delay |
2885 <                    channel_knock_delay_channel | channel_max_chans_per_user |
2886 <                    channel_quiet_on_ban | channel_default_split_user_count |
2887 <                    channel_default_split_server_count |
2888 <                    channel_no_create_on_split | channel_restrict_channels |
2889 <                    channel_no_join_on_split | channel_burst_topicwho |
2890 <                    channel_jflood_count | channel_jflood_time |
2891 <                    channel_disable_fake_channels | error;
2882 > channel_item:       channel_max_bans |
2883 >                    channel_invite_client_count |
2884 >                    channel_invite_client_time |
2885 >                    channel_invite_delay_channel |
2886 >                    channel_knock_client_count |
2887 >                    channel_knock_client_time |
2888 >                    channel_knock_delay_channel |
2889 >                    channel_max_channels |
2890 >                    channel_default_join_flood_count |
2891 >                    channel_default_join_flood_time |
2892 >                    channel_disable_fake_channels |
2893 >                    error;
2894  
2895   channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2896   {
2897    ConfigChannel.disable_fake_channels = yylval.number;
2898   };
2899  
2900 < channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3846 < {
3847 <  ConfigChannel.restrict_channels = yylval.number;
3848 < };
3849 <
3850 < channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
2900 > channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2901   {
2902 <  ConfigChannel.disable_local_channels = yylval.number;
2902 >  ConfigChannel.invite_client_count = $3;
2903   };
2904  
2905 < channel_use_except: USE_EXCEPT '=' TBOOL ';'
2905 > channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2906   {
2907 <  ConfigChannel.use_except = yylval.number;
2907 >  ConfigChannel.invite_client_time = $3;
2908   };
2909  
2910 < channel_use_invex: USE_INVEX '=' TBOOL ';'
2910 > channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2911   {
2912 <  ConfigChannel.use_invex = yylval.number;
2912 >  ConfigChannel.invite_delay_channel = $3;
2913   };
2914  
2915 < channel_use_knock: USE_KNOCK '=' TBOOL ';'
2915 > channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2916   {
2917 <  ConfigChannel.use_knock = yylval.number;
2917 >  ConfigChannel.knock_client_count = $3;
2918   };
2919  
2920 < channel_knock_delay: KNOCK_DELAY '=' timespec ';'
2920 > channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2921   {
2922 <  ConfigChannel.knock_delay = $3;
2922 >  ConfigChannel.knock_client_time = $3;
2923   };
2924  
2925   channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
# Line 3877 | Line 2927 | channel_knock_delay_channel: KNOCK_DELAY
2927    ConfigChannel.knock_delay_channel = $3;
2928   };
2929  
2930 < channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3881 < {
3882 <  ConfigChannel.max_chans_per_user = $3;
3883 < };
3884 <
3885 < channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
2930 > channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
2931   {
2932 <  ConfigChannel.quiet_on_ban = yylval.number;
2932 >  ConfigChannel.max_channels = $3;
2933   };
2934  
2935   channel_max_bans: MAX_BANS '=' NUMBER ';'
# Line 3892 | Line 2937 | channel_max_bans: MAX_BANS '=' NUMBER ';
2937    ConfigChannel.max_bans = $3;
2938   };
2939  
2940 < channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2940 > channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2941   {
2942 <  ConfigChannel.default_split_user_count = $3;
2942 >  ConfigChannel.default_join_flood_count = yylval.number;
2943   };
2944  
2945 < channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2945 > channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2946   {
2947 <  ConfigChannel.default_split_server_count = $3;
2947 >  ConfigChannel.default_join_flood_time = $3;
2948   };
2949  
3905 channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
3906 {
3907  ConfigChannel.no_create_on_split = yylval.number;
3908 };
2950  
2951 < channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2952 < {
2953 <  ConfigChannel.no_join_on_split = yylval.number;
2954 < };
2951 > /***************************************************************************
2952 > * serverhide {} section
2953 > ***************************************************************************/
2954 > serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2955 >
2956 > serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2957 > serverhide_item:    serverhide_flatten_links |
2958 >                    serverhide_flatten_links_delay |
2959 >                    serverhide_flatten_links_file |
2960 >                    serverhide_disable_remote_commands |
2961 >                    serverhide_hide_servers |
2962 >                    serverhide_hide_services |
2963 >                    serverhide_hidden |
2964 >                    serverhide_hidden_name |
2965 >                    serverhide_hide_server_ips |
2966 >                    error;
2967  
2968 < channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
2968 > serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
2969   {
2970 <  ConfigChannel.burst_topicwho = yylval.number;
2970 >  if (conf_parser_ctx.pass == 2)
2971 >    ConfigServerHide.flatten_links = yylval.number;
2972   };
2973  
2974 < channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2974 > serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2975   {
2976 <  GlobalSetOptions.joinfloodcount = yylval.number;
2976 >  if (conf_parser_ctx.pass == 2)
2977 >  {
2978 >    if ($3 > 0)
2979 >    {
2980 >      event_write_links_file.when = $3;
2981 >      event_add(&event_write_links_file, NULL);
2982 >    }
2983 >    else
2984 >     event_delete(&event_write_links_file);
2985 >
2986 >    ConfigServerHide.flatten_links_delay = $3;
2987 >  }
2988   };
2989  
2990 < channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
2990 > serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
2991   {
2992 <  GlobalSetOptions.joinfloodtime = yylval.number;
2992 >  if (conf_parser_ctx.pass == 2)
2993 >  {
2994 >    xfree(ConfigServerHide.flatten_links_file);
2995 >    ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
2996 >  }
2997   };
2998  
2999 < /***************************************************************************
3931 < *  section serverhide
3932 < ***************************************************************************/
3933 < serverhide_entry: SERVERHIDE
3934 <  '{' serverhide_items '}' ';';
3935 <
3936 < serverhide_items:   serverhide_items serverhide_item | serverhide_item;
3937 < serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
3938 <                    serverhide_links_delay |
3939 <                    serverhide_disable_hidden |
3940 <                    serverhide_hidden | serverhide_hidden_name |
3941 <                    serverhide_hide_server_ips |
3942 <                    error;
3943 <
3944 < serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
2999 > serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
3000   {
3001 <  if (ypass == 2)
3002 <    ConfigServerHide.flatten_links = yylval.number;
3001 >  if (conf_parser_ctx.pass == 2)
3002 >    ConfigServerHide.disable_remote_commands = yylval.number;
3003   };
3004  
3005   serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3006   {
3007 <  if (ypass == 2)
3007 >  if (conf_parser_ctx.pass == 2)
3008      ConfigServerHide.hide_servers = yylval.number;
3009   };
3010  
3011 < serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3011 > serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
3012   {
3013 <  if (ypass == 2)
3014 <  {
3960 <    MyFree(ConfigServerHide.hidden_name);
3961 <    DupString(ConfigServerHide.hidden_name, yylval.string);
3962 <  }
3013 >  if (conf_parser_ctx.pass == 2)
3014 >    ConfigServerHide.hide_services = yylval.number;
3015   };
3016  
3017 < serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3017 > serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3018   {
3019 <  if (ypass == 2)
3019 >  if (conf_parser_ctx.pass == 2)
3020    {
3021 <    if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3022 <    {
3971 <      eventAddIsh("write_links_file", write_links_file, NULL, $3);
3972 <      ConfigServerHide.links_disabled = 0;
3973 <    }
3974 <
3975 <    ConfigServerHide.links_delay = $3;
3021 >    xfree(ConfigServerHide.hidden_name);
3022 >    ConfigServerHide.hidden_name = xstrdup(yylval.string);
3023    }
3024   };
3025  
3026   serverhide_hidden: HIDDEN '=' TBOOL ';'
3027   {
3028 <  if (ypass == 2)
3028 >  if (conf_parser_ctx.pass == 2)
3029      ConfigServerHide.hidden = yylval.number;
3030   };
3031  
3985 serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3986 {
3987  if (ypass == 2)
3988    ConfigServerHide.disable_hidden = yylval.number;
3989 };
3990
3032   serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3033   {
3034 <  if (ypass == 2)
3034 >  if (conf_parser_ctx.pass == 2)
3035      ConfigServerHide.hide_server_ips = yylval.number;
3036   };

Diff Legend

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