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 853 by db, Thu Feb 22 06:01:30 2007 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (file contents), Revision 7282 by michael, Sun Feb 7 18:04:26 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_pseudo.h"
38 > #include "conf_resv.h"
39 > #include "conf_service.h"
40 > #include "conf_shared.h"
41   #include "event.h"
42 < #include "s_log.h"
43 < #include "client.h"     /* for UMODE_ALL only */
38 < #include "pcre.h"
42 > #include "id.h"
43 > #include "log.h"
44   #include "irc_string.h"
40 #include "irc_getaddrinfo.h"
41 #include "sprintf_irc.h"
45   #include "memory.h"
46   #include "modules.h"
47 < #include "s_serv.h" /* for CAP_LL / IsCapable */
47 > #include "server.h"
48   #include "hostmask.h"
46 #include "send.h"
49   #include "listener.h"
50 < #include "resv.h"
51 < #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
50 > #include "user.h"
51 > #include "motd.h"
52  
53 < 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 < };
53 > int yylex(void);
54  
55 < static void
97 < free_collect_item(struct CollectItem *item)
55 > static struct
56   {
57 <  MyFree(item->name);
58 <  MyFree(item->user);
59 <  MyFree(item->host);
60 <  MyFree(item->passwd);
61 < #ifdef HAVE_LIBCRYPTO
62 <  MyFree(item->rsa_public_key_file);
63 < #endif
64 <  MyFree(item);
65 < }
57 >  struct
58 >  {
59 >    dlink_list list;
60 >  } mask,
61 >    leaf,
62 >    hub;
63 >
64 >  struct
65 >  {
66 >    char buf[IRCD_BUFSIZE];
67 >  } name,
68 >    nick,
69 >    user,
70 >    host,
71 >    addr,
72 >    bind,
73 >    file,
74 >    ciph,
75 >    cert,
76 >    rpass,
77 >    spass,
78 >    whois,
79 >    class,
80 >    target,
81 >    prepend,
82 >    command;
83 >
84 >  struct
85 >  {
86 >    unsigned int value;
87 >  } flags,
88 >    modes,
89 >    size,
90 >    type,
91 >    port,
92 >    aftype,
93 >    ping_freq,
94 >    max_perip,
95 >    con_freq,
96 >    min_idle,
97 >    max_idle,
98 >    max_total,
99 >    max_global,
100 >    max_local,
101 >    max_ident,
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
230 + %token  MAX_IDLE
231   %token  MAX_LOCAL
232   %token  MAX_NICK_CHANGES
233 + %token  MAX_NICK_LENGTH
234   %token  MAX_NICK_TIME
235   %token  MAX_NUMBER
236   %token  MAX_TARGETS
237 < %token  MESSAGE_LOCALE
237 > %token  MAX_TOPIC_LENGTH
238 > %token  MAX_WATCH
239 > %token  MEMORY_CACHE
240 > %token  MIN_IDLE
241   %token  MIN_NONWILDCARD
242   %token  MIN_NONWILDCARD_SIMPLE
243 + %token  MMAP_CACHE
244   %token  MODULE
245   %token  MODULES
246 + %token  MOTD
247   %token  NAME
248 + %token  NEED_IDENT
249   %token  NEED_PASSWORD
250   %token  NETWORK_DESC
251   %token  NETWORK_NAME
252   %token  NICK
259 %token  NICK_CHANGES
260 %token  NO_CREATE_ON_SPLIT
261 %token  NO_JOIN_ON_SPLIT
253   %token  NO_OPER_FLOOD
254   %token  NO_TILDE
264 %token  NOT
255   %token  NUMBER
266 %token  NUMBER_PER_IDENT
256   %token  NUMBER_PER_CIDR
257   %token  NUMBER_PER_IP
269 %token  NUMBER_PER_IP_GLOBAL
270 %token  OPERATOR
271 %token  OPERS_BYPASS_CALLERID
272 %token  OPER_LOG
258   %token  OPER_ONLY_UMODES
274 %token  OPER_PASS_RESV
275 %token  OPER_SPY_T
259   %token  OPER_UMODES
260 < %token  JOIN_FLOOD_COUNT
261 < %token  JOIN_FLOOD_TIME
260 > %token  OPERATOR
261 > %token  OPERS_BYPASS_CALLERID
262   %token  PACE_WAIT
263   %token  PACE_WAIT_SIMPLE
264   %token  PASSWORD
265   %token  PATH
266   %token  PING_COOKIE
267   %token  PING_TIME
285 %token  PING_WARNING
268   %token  PORT
269   %token  QSTRING
270 < %token  QUIET_ON_BAN
270 > %token  RANDOM_IDLE
271   %token  REASON
272   %token  REDIRPORT
273   %token  REDIRSERV
292 %token  REGEX_T
274   %token  REHASH
294 %token  TREJECT_HOLD_TIME
275   %token  REMOTE
276   %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
277   %token  RESV
278   %token  RESV_EXEMPT
279 < %token  SECONDS MINUTES HOURS DAYS WEEKS
280 < %token  SENDQ
279 > %token  RSA_PRIVATE_KEY_FILE
280 > %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
281   %token  SEND_PASSWORD
282 + %token  SENDQ
283   %token  SERVERHIDE
284   %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
285   %token  SHORT_MOTD
316 %token  SILENT
286   %token  SPOOF
287   %token  SPOOF_NOTICE
288 + %token  SQUIT
289 + %token  SSL_CERTIFICATE_FILE
290 + %token  SSL_CERTIFICATE_FINGERPRINT
291 + %token  SSL_CONNECTION_REQUIRED
292 + %token  SSL_DH_ELLIPTIC_CURVE
293 + %token  SSL_DH_PARAM_FILE
294 + %token  SSL_MESSAGE_DIGEST_ALGORITHM
295 + %token  STANDARD
296   %token  STATS_E_DISABLED
297   %token  STATS_I_OPER_ONLY
298   %token  STATS_K_OPER_ONLY
299 + %token  STATS_M_OPER_ONLY
300   %token  STATS_O_OPER_ONLY
301   %token  STATS_P_OPER_ONLY
302 < %token  TBOOL
325 < %token  TMASKED
326 < %token  T_REJECT
327 < %token  TS_MAX_DELTA
328 < %token  TS_WARN_DELTA
329 < %token  TWODOTS
302 > %token  STATS_U_OPER_ONLY
303   %token  T_ALL
304   %token  T_BOTS
332 %token  T_SOFTCALLERID
305   %token  T_CALLERID
306   %token  T_CCONN
307 < %token  T_CCONN_FULL
308 < %token  T_CLIENT_FLOOD
307 > %token  T_COMMAND
308 > %token  T_CLUSTER
309   %token  T_DEAF
310   %token  T_DEBUG
311 < %token  T_DRONE
311 > %token  T_DLINE
312   %token  T_EXTERNAL
313 + %token  T_FARCONNECT
314 + %token  T_FILE
315   %token  T_FULL
316 + %token  T_GLOBOPS
317   %token  T_INVISIBLE
318   %token  T_IPV4
319   %token  T_IPV6
320   %token  T_LOCOPS
321 < %token  T_LOGPATH
347 < %token  T_L_CRIT
348 < %token  T_L_DEBUG
349 < %token  T_L_ERROR
350 < %token  T_L_INFO
351 < %token  T_L_NOTICE
352 < %token  T_L_TRACE
353 < %token  T_L_WARN
354 < %token  T_MAX_CLIENTS
321 > %token  T_LOG
322   %token  T_NCHANGE
323 < %token  T_OPERWALL
323 > %token  T_NONONREG
324 > %token  T_OPME
325 > %token  T_PREPEND
326 > %token  T_PSEUDO
327 > %token  T_RECVQ
328   %token  T_REJ
329 + %token  T_RESTART
330 + %token  T_SERVER
331 + %token  T_SERVICE
332   %token  T_SERVNOTICE
333 + %token  T_SET
334 + %token  T_SHARED
335 + %token  T_SIZE
336   %token  T_SKILL
337 + %token  T_SOFTCALLERID
338   %token  T_SPY
339   %token  T_SSL
340 + %token  T_SSL_CIPHER_LIST
341 + %token  T_TARGET
342   %token  T_UMODES
343   %token  T_UNAUTH
344 + %token  T_UNDLINE
345 + %token  T_UNLIMITED
346   %token  T_UNRESV
347   %token  T_UNXLINE
348   %token  T_WALLOP
349 + %token  T_WALLOPS
350 + %token  T_WEBIRC
351 + %token  TBOOL
352 + %token  THROTTLE_COUNT
353   %token  THROTTLE_TIME
354 < %token  TOPICBURST
355 < %token  TRUE_NO_OPER_FLOOD
356 < %token  TKLINE
357 < %token  TXLINE
358 < %token  TRESV
354 > %token  TKLINE_EXPIRE_NOTICES
355 > %token  TMASKED
356 > %token  TS_MAX_DELTA
357 > %token  TS_WARN_DELTA
358 > %token  TWODOTS
359 > %token  TYPE
360   %token  UNKLINE
374 %token  USER
375 %token  USE_EGD
376 %token  USE_EXCEPT
377 %token  USE_INVEX
378 %token  USE_KNOCK
361   %token  USE_LOGGING
362 < %token  USE_WHOIS_ACTUALLY
362 > %token  USER
363   %token  VHOST
364   %token  VHOST6
365 + %token  WARN_NO_CONNECT_BLOCK
366 + %token  WHOIS
367   %token  XLINE
368 < %token  WARN
385 < %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
416 <                | 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 <                }
441 <                | NUMBER DAYS timespec_
442 <                {
443 <                        $$ = $1 * 60 * 60 * 24 + $3;
444 <                }
445 <                | NUMBER WEEKS timespec_
446 <                {
447 <                        $$ = $1 * 60 * 60 * 24 * 7 + $3;
448 <                }
449 <                ;
450 <
451 < sizespec_:      { $$ = 0; } | sizespec;
452 < sizespec:       NUMBER sizespec_ { $$ = $1 + $2; }
453 <                | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
454 <                | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
455 <                | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
456 <                ;
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
463 <  '{' 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)
472 <  {
473 <    char *m_bn;
474 <
475 <    m_bn = basename(yylval.string);
476 <
477 <    /* I suppose we should just ignore it if it is already loaded(since
478 <     * otherwise we would flood the opers on rehash) -A1kmm.
479 <     */
480 <    add_conf_module(yylval.string);
481 <  }
482 < #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
488 <  if (ypass == 2)
444 >  if (conf_parser_ctx.pass == 2)
445      mod_add_path(yylval.string);
490 #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  
499 serverinfo_items:       serverinfo_items serverinfo_item |
500                        serverinfo_item ;
501 serverinfo_item:        serverinfo_name | serverinfo_vhost |
502                        serverinfo_hub | serverinfo_description |
503                        serverinfo_network_name | serverinfo_network_desc |
504                        serverinfo_max_clients |
505                        serverinfo_rsa_private_key_file | serverinfo_vhost6 |
506                        serverinfo_sid | serverinfo_ssl_certificate_file |
507                        error ';' ;
477  
478   serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
479   {
480 < #ifdef HAVE_LIBCRYPTO
512 <  if (ypass == 2 && ServerInfo.ctx)
480 >  if (conf_parser_ctx.pass == 2)
481    {
482 <    if (!ServerInfo.rsa_private_key_file)
483 <    {
516 <      yyerror("No rsa_private_key_file specified, SSL disabled");
517 <      break;
518 <    }
519 <
520 <    if (SSL_CTX_use_certificate_file(ServerInfo.ctx,
521 <      yylval.string, SSL_FILETYPE_PEM) <= 0)
522 <    {
523 <      yyerror(ERR_lib_error_string(ERR_get_error()));
524 <      break;
525 <    }
526 <
527 <    if (SSL_CTX_use_PrivateKey_file(ServerInfo.ctx,
528 <      ServerInfo.rsa_private_key_file, SSL_FILETYPE_PEM) <= 0)
529 <    {
530 <      yyerror(ERR_lib_error_string(ERR_get_error()));
531 <      break;
532 <    }
533 <
534 <    if (!SSL_CTX_check_private_key(ServerInfo.ctx))
535 <    {
536 <      yyerror("RSA private key does not match the SSL certificate public key!");
537 <      break;
538 <    }
482 >    xfree(ConfigServerInfo.ssl_certificate_file);
483 >    ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string);
484    }
540 #endif
485   };
486  
487   serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
488   {
489 < #ifdef HAVE_LIBCRYPTO
546 <  if (ypass == 1)
489 >  if (conf_parser_ctx.pass == 2)
490    {
491 <    BIO *file;
492 <
493 <    if (ServerInfo.rsa_private_key)
494 <    {
552 <      RSA_free(ServerInfo.rsa_private_key);
553 <      ServerInfo.rsa_private_key = NULL;
554 <    }
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)
612 <        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 673 | 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
695 <  if (ypass == 2 && *yylval.string != '*')
688 >  if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
689    {
690      struct addrinfo hints, *res;
691  
# Line 702 | 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    }
719 #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);
739 <    }
740 <    else
741 <      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,
755 <                             "Ignoring config file line hub=yes; "
756 <                             "due to active LazyLink (%s)", uplink->name);
757 <      }
758 <      else
759 <      {
760 <        ServerInfo.hub = 1;
761 <        uplink = NULL;
762 <        delete_capability("HUB");
763 <        add_capability("HUB", CAP_HUB, 1);
764 <      }
765 <    }
766 <    else if (ServerInfo.hub)
767 <    {
768 <      dlink_node *ptr = NULL;
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 <      ServerInfo.hub = 0;
754 <      delete_capability("HUB");
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 <      /* Don't become a leaf if we have a lazylink active. */
762 <      DLINK_FOREACH(ptr, serv_list.head)
763 <      {
764 <        const struct Client *acptr = ptr->data;
765 <        if (MyConnect(acptr) && IsCapable(acptr, CAP_LL))
766 <        {
767 <          sendto_realops_flags(UMODE_ALL, L_ALL,
768 <                               "Ignoring config file line hub=no; "
769 <                               "due to active LazyLink (%s)",
770 <                               acptr->name);
771 <          add_capability("HUB", CAP_HUB, 1);
772 <          ServerInfo.hub = 1;
773 <          break;
774 <        }
775 <      }
776 <    }
761 > serverinfo_max_topic_length: MAX_TOPIC_LENGTH '=' NUMBER ';'
762 > {
763 >  if (conf_parser_ctx.pass != 2)
764 >    break;
765 >
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 |
839 <                        logging_use_logging | logging_fuserlog |
840 <                        logging_foperlog | logging_fglinelog |
841 <                        logging_fklinelog | logging_killlog |
842 <                        logging_foperspylog | logging_ioerrlog |
843 <                        logging_ffailed_operlog |
844 <                        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 <                        {
852 <                        };
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,
858 <            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,
865 <            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 (ypass == 2)
872 <    strlcpy(ConfigLoggingEntry.operlog, yylval.string,
873 <            sizeof(ConfigLoggingEntry.operlog));
871 >  if (conf_parser_ctx.pass == 2)
872 >    reset_block_state();
873 > } '{' pseudo_items '}' ';'
874 > {
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,
879 <            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,
886 <            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,
893 <            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,
907 <            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 ';'
911 < {
912 <  if (ypass == 2)
913 <    set_log_level(L_CRIT);
914 < } | LOG_LEVEL '=' T_L_ERROR ';'
943 > logging_file_entry:
944   {
945 <  if (ypass == 2)
946 <    set_log_level(L_ERROR);
947 < } | LOG_LEVEL '=' T_L_WARN ';'
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_WARN);
951 < } | LOG_LEVEL '=' T_L_NOTICE ';'
952 < {
953 <  if (ypass == 2)
954 <    set_log_level(L_NOTICE);
955 < } | 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);
934 < } | LOG_LEVEL '=' T_L_DEBUG ';'
973 >  block_state.size.value = $3;
974 > } | T_SIZE '=' T_UNLIMITED ';'
975   {
976 <  if (ypass == 2)
937 <    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 (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 (ypass == 2)
989 <    ConfigLoggingEntry.use_logging = yylval.number;
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
950 < {
951 <  if (ypass == 2)
952 <  {
953 <    yy_conf = make_conf_item(OPER_TYPE);
954 <    yy_aconf = map_to_conf(yy_conf);
955 <    SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */
956 <  }
957 <  else
958 <  {
959 <    MyFree(class_name);
960 <    class_name = NULL;
961 <  }
962 < } oper_name_b '{' oper_items '}' ';'
1024 > oper_entry: OPERATOR
1025   {
1026 <  if (ypass == 2)
1027 <  {
966 <    struct CollectItem *yy_tmp;
967 <    dlink_node *ptr;
968 <    dlink_node *next_ptr;
1026 >  if (conf_parser_ctx.pass != 2)
1027 >    break;
1028  
1029 <    conf_add_class_to_conf(yy_conf, class_name);
1029 >  reset_block_state();
1030 >  block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1031 > } '{' oper_items '}' ';'
1032 > {
1033 >  dlink_node *node = NULL;
1034  
1035 <    /* Now, make sure there is a copy of the "base" given oper
1036 <     * block in each of the collected copies
974 <     */
1035 >  if (conf_parser_ctx.pass != 2)
1036 >    break;
1037  
1038 <    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
1039 <    {
978 <      struct AccessItem *new_aconf;
979 <      struct ConfItem *new_conf;
980 <      yy_tmp = ptr->data;
981 <
982 <      new_conf = make_conf_item(OPER_TYPE);
983 <      new_aconf = (struct AccessItem *)map_to_conf(new_conf);
984 <
985 <      new_aconf->flags = yy_aconf->flags;
986 <
987 <      if (yy_conf->name != NULL)
988 <        DupString(new_conf->name, yy_conf->name);
989 <      if (yy_tmp->user != NULL)
990 <        DupString(new_aconf->user, yy_tmp->user);
991 <      else
992 <        DupString(new_aconf->user, "*");
993 <      if (yy_tmp->host != NULL)
994 <        DupString(new_aconf->host, yy_tmp->host);
995 <      else
996 <        DupString(new_aconf->host, "*");
997 <      conf_add_class_to_conf(new_conf, class_name);
998 <      if (yy_aconf->passwd != NULL)
999 <        DupString(new_aconf->passwd, yy_aconf->passwd);
1000 <
1001 <      new_aconf->port = yy_aconf->port;
1002 < #ifdef HAVE_LIBCRYPTO
1003 <      if (yy_aconf->rsa_public_key_file != NULL)
1004 <      {
1005 <        BIO *file;
1006 <
1007 <        DupString(new_aconf->rsa_public_key_file,
1008 <                  yy_aconf->rsa_public_key_file);
1009 <
1010 <        file = BIO_new_file(yy_aconf->rsa_public_key_file, "r");
1011 <        new_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file,
1012 <                                                           NULL, 0, NULL);
1013 <        BIO_set_close(file, BIO_CLOSE);
1014 <        BIO_free(file);
1015 <      }
1016 < #endif
1038 >  if (!block_state.name.buf[0])
1039 >    break;
1040  
1041 < #ifdef HAVE_LIBCRYPTO
1042 <      if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key)
1020 <          && yy_tmp->host)
1021 < #else
1022 <      if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host)
1023 < #endif
1024 <      {
1025 <        conf_add_class_to_conf(new_conf, class_name);
1026 <        if (yy_tmp->name != NULL)
1027 <          DupString(new_conf->name, yy_tmp->name);
1028 <      }
1041 >  if (!block_state.rpass.buf[0])
1042 >    break;
1043  
1044 <      dlinkDelete(&yy_tmp->node, &col_conf_list);
1045 <      free_collect_item(yy_tmp);
1046 <    }
1044 >  DLINK_FOREACH(node, block_state.mask.list.head)
1045 >  {
1046 >    struct MaskItem *conf = NULL;
1047 >    struct split_nuh_item nuh;
1048  
1049 <    yy_conf = NULL;
1050 <    yy_aconf = NULL;
1049 >    nuh.nuhmask  = node->data;
1050 >    nuh.nickptr  = NULL;
1051 >    nuh.userptr  = block_state.user.buf;
1052 >    nuh.hostptr  = block_state.host.buf;
1053 >    nuh.nicksize = 0;
1054 >    nuh.usersize = sizeof(block_state.user.buf);
1055 >    nuh.hostsize = sizeof(block_state.host.buf);
1056 >    split_nuh(&nuh);
1057  
1058 +    conf         = conf_make(CONF_OPER);
1059 +    conf->name   = xstrdup(block_state.name.buf);
1060 +    conf->user   = xstrdup(block_state.user.buf);
1061 +    conf->host   = xstrdup(block_state.host.buf);
1062 +
1063 +    if (block_state.cert.buf[0])
1064 +      conf->certfp = xstrdup(block_state.cert.buf);
1065 +
1066 +    if (block_state.rpass.buf[0])
1067 +      conf->passwd = xstrdup(block_state.rpass.buf);
1068 +
1069 +    if (block_state.whois.buf[0])
1070 +      conf->whois = xstrdup(block_state.whois.buf);
1071 +
1072 +    conf->flags = block_state.flags.value;
1073 +    conf->modes = block_state.modes.value;
1074 +    conf->port  = block_state.port.value;
1075 +    conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits);
1076  
1077 <    MyFree(class_name);
1039 <    class_name = NULL;
1077 >    conf_add_class_to_conf(conf, block_state.class.buf);
1078    }
1079 < };
1079 > };
1080  
1043 oper_name_b: | oper_name_t;
1081   oper_items:     oper_items oper_item | oper_item;
1082 < oper_item:      oper_name | oper_user | oper_password | oper_hidden_admin |
1083 <                oper_hidden_oper | oper_umodes |
1084 <                oper_class | oper_global_kill | oper_remote |
1085 <                oper_kline | oper_xline | oper_unkline |
1086 <                oper_gline | oper_nick_changes | oper_remoteban |
1087 <                oper_die | oper_rehash | oper_admin | oper_operwall |
1088 <                oper_encrypted | oper_rsa_public_key_file |
1089 <                oper_flags | error ';' ;
1082 > oper_item:      oper_name |
1083 >                oper_user |
1084 >                oper_password |
1085 >                oper_whois |
1086 >                oper_umodes |
1087 >                oper_class |
1088 >                oper_encrypted |
1089 >                oper_ssl_certificate_fingerprint |
1090 >                oper_ssl_connection_required |
1091 >                oper_flags |
1092 >                error ';' ;
1093  
1094   oper_name: NAME '=' QSTRING ';'
1095   {
1096 <  if (ypass == 2)
1097 <  {
1058 <    if (strlen(yylval.string) > OPERNICKLEN)
1059 <      yylval.string[OPERNICKLEN] = '\0';
1060 <
1061 <    MyFree(yy_conf->name);
1062 <    DupString(yy_conf->name, yylval.string);
1063 <  }
1064 < };
1065 <
1066 < oper_name_t: QSTRING
1067 < {
1068 <  if (ypass == 2)
1069 <  {
1070 <    if (strlen(yylval.string) > OPERNICKLEN)
1071 <      yylval.string[OPERNICKLEN] = '\0';
1072 <
1073 <    MyFree(yy_conf->name);
1074 <    DupString(yy_conf->name, yylval.string);
1075 <  }
1096 >  if (conf_parser_ctx.pass == 2)
1097 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1098   };
1099  
1100   oper_user: USER '=' QSTRING ';'
1101   {
1102 <  if (ypass == 2)
1103 <  {
1082 <    struct split_nuh_item nuh;
1083 <
1084 <    nuh.nuhmask  = yylval.string;
1085 <    nuh.nickptr  = NULL;
1086 <    nuh.userptr  = userbuf;
1087 <    nuh.hostptr  = hostbuf;
1088 <
1089 <    nuh.nicksize = 0;
1090 <    nuh.usersize = sizeof(userbuf);
1091 <    nuh.hostsize = sizeof(hostbuf);
1092 <
1093 <    split_nuh(&nuh);
1094 <
1095 <    if (yy_aconf->user == NULL)
1096 <    {
1097 <      DupString(yy_aconf->user, userbuf);
1098 <      DupString(yy_aconf->host, hostbuf);
1099 <    }
1100 <    else
1101 <    {
1102 <      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1103 <
1104 <      DupString(yy_tmp->user, userbuf);
1105 <      DupString(yy_tmp->host, hostbuf);
1106 <
1107 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1108 <    }
1109 <  }
1102 >  if (conf_parser_ctx.pass == 2)
1103 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1104   };
1105  
1106   oper_password: PASSWORD '=' QSTRING ';'
1107   {
1108 <  if (ypass == 2)
1109 <  {
1116 <    if (yy_aconf->passwd != NULL)
1117 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1118 <
1119 <    MyFree(yy_aconf->passwd);
1120 <    DupString(yy_aconf->passwd, yylval.string);
1121 <  }
1108 >  if (conf_parser_ctx.pass == 2)
1109 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1110   };
1111  
1112 < oper_encrypted: ENCRYPTED '=' TBOOL ';'
1112 > oper_whois: WHOIS '=' QSTRING ';'
1113   {
1114 <  if (ypass == 2)
1115 <  {
1128 <    if (yylval.number)
1129 <      SetConfEncrypted(yy_aconf);
1130 <    else
1131 <      ClearConfEncrypted(yy_aconf);
1132 <  }
1114 >  if (conf_parser_ctx.pass == 2)
1115 >    strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf));
1116   };
1117  
1118 < oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1118 > oper_encrypted: ENCRYPTED '=' TBOOL ';'
1119   {
1120 < #ifdef HAVE_LIBCRYPTO
1121 <  if (ypass == 2)
1139 <  {
1140 <    BIO *file;
1141 <
1142 <    if (yy_aconf->rsa_public_key != NULL)
1143 <    {
1144 <      RSA_free(yy_aconf->rsa_public_key);
1145 <      yy_aconf->rsa_public_key = NULL;
1146 <    }
1147 <
1148 <    if (yy_aconf->rsa_public_key_file != NULL)
1149 <    {
1150 <      MyFree(yy_aconf->rsa_public_key_file);
1151 <      yy_aconf->rsa_public_key_file = NULL;
1152 <    }
1153 <
1154 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
1155 <    file = BIO_new_file(yylval.string, "r");
1120 >  if (conf_parser_ctx.pass != 2)
1121 >    break;
1122  
1123 <    if (file == NULL)
1124 <    {
1125 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
1126 <      break;
1127 <    }
1123 >  if (yylval.number)
1124 >    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1125 >  else
1126 >    block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1127 > };
1128  
1129 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
1129 > oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1130 > {
1131 >  if (conf_parser_ctx.pass == 2)
1132 >    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1133 > };
1134  
1135 <    if (yy_aconf->rsa_public_key == NULL)
1136 <    {
1137 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
1138 <      break;
1169 <    }
1135 > oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1136 > {
1137 >  if (conf_parser_ctx.pass != 2)
1138 >    break;
1139  
1140 <    BIO_set_close(file, BIO_CLOSE);
1141 <    BIO_free(file);
1142 <  }
1143 < #endif /* HAVE_LIBCRYPTO */
1140 >  if (yylval.number)
1141 >    block_state.flags.value |= CONF_FLAGS_SSL;
1142 >  else
1143 >    block_state.flags.value &= ~CONF_FLAGS_SSL;
1144   };
1145  
1146   oper_class: CLASS '=' QSTRING ';'
1147   {
1148 <  if (ypass == 2)
1149 <  {
1181 <    MyFree(class_name);
1182 <    DupString(class_name, yylval.string);
1183 <  }
1148 >  if (conf_parser_ctx.pass == 2)
1149 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1150   };
1151  
1152   oper_umodes: T_UMODES
1153   {
1154 <  if (ypass == 2)
1155 <    yy_aconf->modes = 0;
1154 >  if (conf_parser_ctx.pass == 2)
1155 >    block_state.modes.value = 0;
1156   } '='  oper_umodes_items ';' ;
1157  
1158   oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1159   oper_umodes_item:  T_BOTS
1160   {
1161 <  if (ypass == 2)
1162 <    yy_aconf->modes |= UMODE_BOTS;
1161 >  if (conf_parser_ctx.pass == 2)
1162 >    block_state.modes.value |= UMODE_BOTS;
1163   } | T_CCONN
1164   {
1165 <  if (ypass == 2)
1166 <    yy_aconf->modes |= UMODE_CCONN;
1201 < } | T_CCONN_FULL
1202 < {
1203 <  if (ypass == 2)
1204 <    yy_aconf->modes |= UMODE_CCONN_FULL;
1165 >  if (conf_parser_ctx.pass == 2)
1166 >    block_state.modes.value |= UMODE_CCONN;
1167   } | T_DEAF
1168   {
1169 <  if (ypass == 2)
1170 <    yy_aconf->modes |= UMODE_DEAF;
1169 >  if (conf_parser_ctx.pass == 2)
1170 >    block_state.modes.value |= UMODE_DEAF;
1171   } | T_DEBUG
1172   {
1173 <  if (ypass == 2)
1174 <    yy_aconf->modes |= UMODE_DEBUG;
1173 >  if (conf_parser_ctx.pass == 2)
1174 >    block_state.modes.value |= UMODE_DEBUG;
1175   } | T_FULL
1176   {
1177 <  if (ypass == 2)
1178 <    yy_aconf->modes |= UMODE_FULL;
1177 >  if (conf_parser_ctx.pass == 2)
1178 >    block_state.modes.value |= UMODE_FULL;
1179 > } | HIDDEN
1180 > {
1181 >  if (conf_parser_ctx.pass == 2)
1182 >    block_state.modes.value |= UMODE_HIDDEN;
1183 > } | HIDE_CHANS
1184 > {
1185 >  if (conf_parser_ctx.pass == 2)
1186 >    block_state.modes.value |= UMODE_HIDECHANS;
1187 > } | HIDE_IDLE
1188 > {
1189 >  if (conf_parser_ctx.pass == 2)
1190 >    block_state.modes.value |= UMODE_HIDEIDLE;
1191   } | T_SKILL
1192   {
1193 <  if (ypass == 2)
1194 <    yy_aconf->modes |= UMODE_SKILL;
1193 >  if (conf_parser_ctx.pass == 2)
1194 >    block_state.modes.value |= UMODE_SKILL;
1195   } | T_NCHANGE
1196   {
1197 <  if (ypass == 2)
1198 <    yy_aconf->modes |= UMODE_NCHANGE;
1197 >  if (conf_parser_ctx.pass == 2)
1198 >    block_state.modes.value |= UMODE_NCHANGE;
1199   } | T_REJ
1200   {
1201 <  if (ypass == 2)
1202 <    yy_aconf->modes |= UMODE_REJ;
1201 >  if (conf_parser_ctx.pass == 2)
1202 >    block_state.modes.value |= UMODE_REJ;
1203   } | T_UNAUTH
1204   {
1205 <  if (ypass == 2)
1206 <    yy_aconf->modes |= UMODE_UNAUTH;
1205 >  if (conf_parser_ctx.pass == 2)
1206 >    block_state.modes.value |= UMODE_UNAUTH;
1207   } | T_SPY
1208   {
1209 <  if (ypass == 2)
1210 <    yy_aconf->modes |= UMODE_SPY;
1209 >  if (conf_parser_ctx.pass == 2)
1210 >    block_state.modes.value |= UMODE_SPY;
1211   } | T_EXTERNAL
1212   {
1213 <  if (ypass == 2)
1214 <    yy_aconf->modes |= UMODE_EXTERNAL;
1241 < } | T_OPERWALL
1242 < {
1243 <  if (ypass == 2)
1244 <    yy_aconf->modes |= UMODE_OPERWALL;
1213 >  if (conf_parser_ctx.pass == 2)
1214 >    block_state.modes.value |= UMODE_EXTERNAL;
1215   } | T_SERVNOTICE
1216   {
1217 <  if (ypass == 2)
1218 <    yy_aconf->modes |= UMODE_SERVNOTICE;
1217 >  if (conf_parser_ctx.pass == 2)
1218 >    block_state.modes.value |= UMODE_SERVNOTICE;
1219   } | T_INVISIBLE
1220   {
1221 <  if (ypass == 2)
1222 <    yy_aconf->modes |= UMODE_INVISIBLE;
1221 >  if (conf_parser_ctx.pass == 2)
1222 >    block_state.modes.value |= UMODE_INVISIBLE;
1223   } | T_WALLOP
1224   {
1225 <  if (ypass == 2)
1226 <    yy_aconf->modes |= UMODE_WALLOP;
1225 >  if (conf_parser_ctx.pass == 2)
1226 >    block_state.modes.value |= UMODE_WALLOP;
1227   } | T_SOFTCALLERID
1228   {
1229 <  if (ypass == 2)
1230 <    yy_aconf->modes |= UMODE_SOFTCALLERID;
1229 >  if (conf_parser_ctx.pass == 2)
1230 >    block_state.modes.value |= UMODE_SOFTCALLERID;
1231   } | T_CALLERID
1232   {
1233 <  if (ypass == 2)
1234 <    yy_aconf->modes |= UMODE_CALLERID;
1233 >  if (conf_parser_ctx.pass == 2)
1234 >    block_state.modes.value |= UMODE_CALLERID;
1235   } | T_LOCOPS
1236   {
1237 <  if (ypass == 2)
1238 <    yy_aconf->modes |= UMODE_LOCOPS;
1239 < };
1240 <
1241 < oper_global_kill: GLOBAL_KILL '=' TBOOL ';'
1237 >  if (conf_parser_ctx.pass == 2)
1238 >    block_state.modes.value |= UMODE_LOCOPS;
1239 > } | T_NONONREG
1240 > {
1241 >  if (conf_parser_ctx.pass == 2)
1242 >    block_state.modes.value |= UMODE_REGONLY;
1243 > } | T_FARCONNECT
1244   {
1245 <  if (ypass == 2)
1246 <  {
1275 <    if (yylval.number)
1276 <      yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1277 <    else
1278 <      yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1279 <  }
1280 < };
1281 <
1282 < oper_remote: REMOTE '=' TBOOL ';'
1283 < {
1284 <  if (ypass == 2)
1285 <  {
1286 <    if (yylval.number)
1287 <      yy_aconf->port |= OPER_FLAG_REMOTE;
1288 <    else
1289 <      yy_aconf->port &= ~OPER_FLAG_REMOTE;
1290 <  }
1291 < };
1292 <
1293 < oper_remoteban: REMOTEBAN '=' TBOOL ';'
1294 < {
1295 <  if (ypass == 2)
1296 <  {
1297 <    if (yylval.number)
1298 <      yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1299 <    else
1300 <      yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1301 <  }
1302 < };
1303 <
1304 < oper_kline: KLINE '=' TBOOL ';'
1305 < {
1306 <  if (ypass == 2)
1307 <  {
1308 <    if (yylval.number)
1309 <      yy_aconf->port |= OPER_FLAG_K;
1310 <    else
1311 <      yy_aconf->port &= ~OPER_FLAG_K;
1312 <  }
1313 < };
1314 <
1315 < oper_xline: XLINE '=' TBOOL ';'
1316 < {
1317 <  if (ypass == 2)
1318 <  {
1319 <    if (yylval.number)
1320 <      yy_aconf->port |= OPER_FLAG_X;
1321 <    else
1322 <      yy_aconf->port &= ~OPER_FLAG_X;
1323 <  }
1324 < };
1325 <
1326 < oper_unkline: UNKLINE '=' TBOOL ';'
1327 < {
1328 <  if (ypass == 2)
1329 <  {
1330 <    if (yylval.number)
1331 <      yy_aconf->port |= OPER_FLAG_UNKLINE;
1332 <    else
1333 <      yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1334 <  }
1335 < };
1336 <
1337 < oper_gline: GLINE '=' TBOOL ';'
1338 < {
1339 <  if (ypass == 2)
1340 <  {
1341 <    if (yylval.number)
1342 <      yy_aconf->port |= OPER_FLAG_GLINE;
1343 <    else
1344 <      yy_aconf->port &= ~OPER_FLAG_GLINE;
1345 <  }
1346 < };
1347 <
1348 < oper_nick_changes: NICK_CHANGES '=' TBOOL ';'
1349 < {
1350 <  if (ypass == 2)
1351 <  {
1352 <    if (yylval.number)
1353 <      yy_aconf->port |= OPER_FLAG_N;
1354 <    else
1355 <      yy_aconf->port &= ~OPER_FLAG_N;
1356 <  }
1357 < };
1358 <
1359 < oper_die: DIE '=' TBOOL ';'
1360 < {
1361 <  if (ypass == 2)
1362 <  {
1363 <    if (yylval.number)
1364 <      yy_aconf->port |= OPER_FLAG_DIE;
1365 <    else
1366 <      yy_aconf->port &= ~OPER_FLAG_DIE;
1367 <  }
1368 < };
1369 <
1370 < oper_rehash: REHASH '=' TBOOL ';'
1371 < {
1372 <  if (ypass == 2)
1373 <  {
1374 <    if (yylval.number)
1375 <      yy_aconf->port |= OPER_FLAG_REHASH;
1376 <    else
1377 <      yy_aconf->port &= ~OPER_FLAG_REHASH;
1378 <  }
1379 < };
1380 <
1381 < oper_admin: ADMIN '=' TBOOL ';'
1382 < {
1383 <  if (ypass == 2)
1384 <  {
1385 <    if (yylval.number)
1386 <      yy_aconf->port |= OPER_FLAG_ADMIN;
1387 <    else
1388 <      yy_aconf->port &= ~OPER_FLAG_ADMIN;
1389 <  }
1390 < };
1391 <
1392 < oper_hidden_admin: HIDDEN_ADMIN '=' TBOOL ';'
1393 < {
1394 <  if (ypass == 2)
1395 <  {
1396 <    if (yylval.number)
1397 <      yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1398 <    else
1399 <      yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1400 <  }
1401 < };
1402 <
1403 < oper_hidden_oper: HIDDEN_OPER '=' TBOOL ';'
1404 < {
1405 <  if (ypass == 2)
1406 <  {
1407 <    if (yylval.number)
1408 <      yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1409 <    else
1410 <      yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1411 <  }
1412 < };
1413 <
1414 < oper_operwall: T_OPERWALL '=' TBOOL ';'
1415 < {
1416 <  if (ypass == 2)
1417 <  {
1418 <    if (yylval.number)
1419 <      yy_aconf->port |= OPER_FLAG_OPERWALL;
1420 <    else
1421 <      yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1422 <  }
1245 >  if (conf_parser_ctx.pass == 2)
1246 >    block_state.modes.value |= UMODE_FARCONNECT;
1247   };
1248  
1249   oper_flags: IRCD_FLAGS
1250   {
1251 +  if (conf_parser_ctx.pass == 2)
1252 +    block_state.port.value = 0;
1253   } '='  oper_flags_items ';';
1254  
1255   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1256 < oper_flags_item: NOT { not_atom = 1; } oper_flags_item_atom
1431 <                | { not_atom = 0; } oper_flags_item_atom;
1432 <
1433 < oper_flags_item_atom: GLOBAL_KILL
1256 > oper_flags_item: KILL ':' REMOTE
1257   {
1258 <  if (ypass == 2)
1259 <  {
1260 <    if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1261 <    else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1262 <  }
1263 < } | REMOTE
1258 >  if (conf_parser_ctx.pass == 2)
1259 >    block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1260 > } | KILL
1261 > {
1262 >  if (conf_parser_ctx.pass == 2)
1263 >    block_state.port.value |= OPER_FLAG_KILL;
1264 > } | CONNECT ':' REMOTE
1265 > {
1266 >  if (conf_parser_ctx.pass == 2)
1267 >    block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1268 > } | CONNECT
1269 > {
1270 >  if (conf_parser_ctx.pass == 2)
1271 >    block_state.port.value |= OPER_FLAG_CONNECT;
1272 > } | SQUIT ':' REMOTE
1273 > {
1274 >  if (conf_parser_ctx.pass == 2)
1275 >    block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1276 > } | SQUIT
1277   {
1278 <  if (ypass == 2)
1279 <  {
1444 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE;
1445 <    else yy_aconf->port |= OPER_FLAG_REMOTE;
1446 <  }
1278 >  if (conf_parser_ctx.pass == 2)
1279 >    block_state.port.value |= OPER_FLAG_SQUIT;
1280   } | KLINE
1281   {
1282 <  if (ypass == 2)
1283 <  {
1451 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_K;
1452 <    else yy_aconf->port |= OPER_FLAG_K;
1453 <  }
1282 >  if (conf_parser_ctx.pass == 2)
1283 >    block_state.port.value |= OPER_FLAG_KLINE;
1284   } | UNKLINE
1285   {
1286 <  if (ypass == 2)
1287 <  {
1288 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1289 <    else yy_aconf->port |= OPER_FLAG_UNKLINE;
1290 <  }
1286 >  if (conf_parser_ctx.pass == 2)
1287 >    block_state.port.value |= OPER_FLAG_UNKLINE;
1288 > } | T_DLINE
1289 > {
1290 >  if (conf_parser_ctx.pass == 2)
1291 >    block_state.port.value |= OPER_FLAG_DLINE;
1292 > } | T_UNDLINE
1293 > {
1294 >  if (conf_parser_ctx.pass == 2)
1295 >    block_state.port.value |= OPER_FLAG_UNDLINE;
1296   } | XLINE
1297   {
1298 <  if (ypass == 2)
1299 <  {
1300 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_X;
1466 <    else yy_aconf->port |= OPER_FLAG_X;
1467 <  }
1468 < } | GLINE
1298 >  if (conf_parser_ctx.pass == 2)
1299 >    block_state.port.value |= OPER_FLAG_XLINE;
1300 > } | T_UNXLINE
1301   {
1302 <  if (ypass == 2)
1303 <  {
1472 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE;
1473 <    else yy_aconf->port |= OPER_FLAG_GLINE;
1474 <  }
1302 >  if (conf_parser_ctx.pass == 2)
1303 >    block_state.port.value |= OPER_FLAG_UNXLINE;
1304   } | DIE
1305   {
1306 <  if (ypass == 2)
1307 <  {
1308 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE;
1309 <    else yy_aconf->port |= OPER_FLAG_DIE;
1310 <  }
1306 >  if (conf_parser_ctx.pass == 2)
1307 >    block_state.port.value |= OPER_FLAG_DIE;
1308 > } | T_RESTART
1309 > {
1310 >  if (conf_parser_ctx.pass == 2)
1311 >    block_state.port.value |= OPER_FLAG_RESTART;
1312 > } | REHASH ':' REMOTE
1313 > {
1314 >  if (conf_parser_ctx.pass == 2)
1315 >    block_state.port.value |= OPER_FLAG_REHASH_REMOTE;
1316   } | REHASH
1317   {
1318 <  if (ypass == 2)
1319 <  {
1486 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH;
1487 <    else yy_aconf->port |= OPER_FLAG_REHASH;
1488 <  }
1318 >  if (conf_parser_ctx.pass == 2)
1319 >    block_state.port.value |= OPER_FLAG_REHASH;
1320   } | ADMIN
1321   {
1322 <  if (ypass == 2)
1323 <  {
1324 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN;
1325 <    else yy_aconf->port |= OPER_FLAG_ADMIN;
1326 <  }
1327 < } | HIDDEN_ADMIN
1322 >  if (conf_parser_ctx.pass == 2)
1323 >    block_state.port.value |= OPER_FLAG_ADMIN;
1324 > } | T_GLOBOPS
1325 > {
1326 >  if (conf_parser_ctx.pass == 2)
1327 >    block_state.port.value |= OPER_FLAG_GLOBOPS;
1328 > } | T_WALLOPS
1329   {
1330 <  if (ypass == 2)
1331 <  {
1332 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1501 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1502 <  }
1503 < } | NICK_CHANGES
1330 >  if (conf_parser_ctx.pass == 2)
1331 >    block_state.port.value |= OPER_FLAG_WALLOPS;
1332 > } | T_LOCOPS
1333   {
1334 <  if (ypass == 2)
1335 <  {
1336 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_N;
1508 <    else yy_aconf->port |= OPER_FLAG_N;
1509 <  }
1510 < } | T_OPERWALL
1334 >  if (conf_parser_ctx.pass == 2)
1335 >    block_state.port.value |= OPER_FLAG_LOCOPS;
1336 > } | REMOTEBAN
1337   {
1338 <  if (ypass == 2)
1339 <  {
1340 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1341 <    else yy_aconf->port |= OPER_FLAG_OPERWALL;
1342 <  }
1343 < } | OPER_SPY_T
1338 >  if (conf_parser_ctx.pass == 2)
1339 >    block_state.port.value |= OPER_FLAG_REMOTEBAN;
1340 > } | T_SET
1341 > {
1342 >  if (conf_parser_ctx.pass == 2)
1343 >    block_state.port.value |= OPER_FLAG_SET;
1344 > } | MODULE
1345 > {
1346 >  if (conf_parser_ctx.pass == 2)
1347 >    block_state.port.value |= OPER_FLAG_MODULE;
1348 > } | T_OPME
1349 > {
1350 >  if (conf_parser_ctx.pass == 2)
1351 >    block_state.port.value |= OPER_FLAG_OPME;
1352 > } | NICK ':' RESV
1353 > {
1354 >  if (conf_parser_ctx.pass == 2)
1355 >    block_state.port.value |= OPER_FLAG_NICK_RESV;
1356 > } | JOIN ':' RESV
1357   {
1358 <  if (ypass == 2)
1359 <  {
1360 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY;
1522 <    else yy_aconf->port |= OPER_FLAG_OPER_SPY;
1523 <  }
1524 < } | HIDDEN_OPER
1358 >  if (conf_parser_ctx.pass == 2)
1359 >    block_state.port.value |= OPER_FLAG_JOIN_RESV;
1360 > } | RESV
1361   {
1362 <  if (ypass == 2)
1363 <  {
1364 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1529 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1530 <  }
1531 < } | REMOTEBAN
1362 >  if (conf_parser_ctx.pass == 2)
1363 >    block_state.port.value |= OPER_FLAG_RESV;
1364 > } | T_UNRESV
1365   {
1366 <  if (ypass == 2)
1367 <  {
1368 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1536 <    else yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1537 <  }
1538 < } | ENCRYPTED
1366 >  if (conf_parser_ctx.pass == 2)
1367 >    block_state.port.value |= OPER_FLAG_UNRESV;
1368 > } | CLOSE
1369   {
1370 <  if (ypass == 2)
1371 <  {
1542 <    if (not_atom) ClearConfEncrypted(yy_aconf);
1543 <    else SetConfEncrypted(yy_aconf);
1544 <  }
1370 >  if (conf_parser_ctx.pass == 2)
1371 >    block_state.port.value |= OPER_FLAG_CLOSE;
1372   };
1373  
1374  
1375   /***************************************************************************
1376 < *  section class
1376 > * class {} section
1377   ***************************************************************************/
1378   class_entry: CLASS
1379   {
1380 <  if (ypass == 1)
1381 <  {
1555 <    yy_conf = make_conf_item(CLASS_TYPE);
1556 <    yy_class = map_to_conf(yy_conf);
1557 <  }
1558 < } class_name_b '{' class_items '}' ';'
1559 < {
1560 <  if (ypass == 1)
1561 <  {
1562 <    struct ConfItem *cconf = NULL;
1563 <    struct ClassItem *class = NULL;
1380 >  if (conf_parser_ctx.pass != 1)
1381 >    break;
1382  
1383 <    if (yy_class_name == NULL)
1566 <      delete_conf_item(yy_conf);
1567 <    else
1568 <    {
1569 <      cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1570 <
1571 <      if (cconf != NULL)                /* The class existed already */
1572 <      {
1573 <        int user_count = 0;
1574 <
1575 <        rebuild_cidr_class(cconf, yy_class);
1576 <
1577 <        class = map_to_conf(cconf);
1578 <
1579 <        user_count = class->curr_user_count;
1580 <        memcpy(class, yy_class, sizeof(*class));
1581 <        class->curr_user_count = user_count;
1582 <        class->active = 1;
1583 <
1584 <        delete_conf_item(yy_conf);
1585 <
1586 <        MyFree(cconf->name);            /* Allows case change of class name */
1587 <        cconf->name = yy_class_name;
1588 <      }
1589 <      else      /* Brand new class */
1590 <      {
1591 <        MyFree(yy_conf->name);          /* just in case it was allocated */
1592 <        yy_conf->name = yy_class_name;
1593 <        yy_class->active = 1;
1594 <      }
1595 <    }
1383 >  reset_block_state();
1384  
1385 <    yy_class_name = NULL;
1386 <  }
1385 >  block_state.ping_freq.value = DEFAULT_PINGFREQUENCY;
1386 >  block_state.con_freq.value  = DEFAULT_CONNECTFREQUENCY;
1387 >  block_state.max_total.value = MAXIMUM_LINKS_DEFAULT;
1388 >  block_state.max_sendq.value = DEFAULT_SENDQ;
1389 >  block_state.max_recvq.value = DEFAULT_RECVQ;
1390 > } '{' class_items '}' ';'
1391 > {
1392 >  struct ClassItem *class = NULL;
1393 >
1394 >  if (conf_parser_ctx.pass != 1)
1395 >    break;
1396 >
1397 >  if (!block_state.class.buf[0])
1398 >    break;
1399 >
1400 >  if (!(class = class_find(block_state.class.buf, 0)))
1401 >    class = class_make();
1402 >
1403 >  class->active = 1;
1404 >  xfree(class->name);
1405 >  class->name = xstrdup(block_state.class.buf);
1406 >  class->ping_freq = block_state.ping_freq.value;
1407 >  class->max_perip = block_state.max_perip.value;
1408 >  class->con_freq = block_state.con_freq.value;
1409 >  class->max_total = block_state.max_total.value;
1410 >  class->max_global = block_state.max_global.value;
1411 >  class->max_local = block_state.max_local.value;
1412 >  class->max_ident = block_state.max_ident.value;
1413 >  class->max_sendq = block_state.max_sendq.value;
1414 >  class->max_recvq = block_state.max_recvq.value;
1415 >  class->max_channels = block_state.max_channels.value;
1416 >
1417 >  if (block_state.min_idle.value > block_state.max_idle.value)
1418 >  {
1419 >    block_state.min_idle.value = 0;
1420 >    block_state.max_idle.value = 0;
1421 >    block_state.flags.value &= ~CLASS_FLAGS_FAKE_IDLE;
1422 >  }
1423 >
1424 >  class->flags = block_state.flags.value;
1425 >  class->min_idle = block_state.min_idle.value;
1426 >  class->max_idle = block_state.max_idle.value;
1427 >
1428 >  rebuild_cidr_list(class);
1429 >
1430 >  class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1431 >  class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1432 >  class->number_per_cidr = block_state.number_per_cidr.value;
1433   };
1434  
1601 class_name_b: | class_name_t;
1602
1435   class_items:    class_items class_item | class_item;
1436   class_item:     class_name |
1437 <                class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
1437 >                class_cidr_bitlen_ipv4 |
1438 >                class_cidr_bitlen_ipv6 |
1439                  class_ping_time |
1440 <                class_ping_warning |
1608 <                class_number_per_cidr |
1440 >                class_number_per_cidr |
1441                  class_number_per_ip |
1442                  class_connectfreq |
1443 +                class_max_channels |
1444                  class_max_number |
1445 <                class_max_global |
1446 <                class_max_local |
1447 <                class_max_ident |
1448 <                class_sendq |
1449 <                error ';' ;
1450 <
1451 < class_name: NAME '=' QSTRING ';'
1452 < {
1620 <  if (ypass == 1)
1621 <  {
1622 <    MyFree(yy_class_name);
1623 <    DupString(yy_class_name, yylval.string);
1624 <  }
1625 < };
1445 >                class_max_global |
1446 >                class_max_local |
1447 >                class_max_ident |
1448 >                class_sendq | class_recvq |
1449 >                class_min_idle |
1450 >                class_max_idle |
1451 >                class_flags |
1452 >                error ';' ;
1453  
1454 < class_name_t: QSTRING
1454 > class_name: NAME '=' QSTRING ';'
1455   {
1456 <  if (ypass == 1)
1457 <  {
1631 <    MyFree(yy_class_name);
1632 <    DupString(yy_class_name, yylval.string);
1633 <  }
1456 >  if (conf_parser_ctx.pass == 1)
1457 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1458   };
1459  
1460   class_ping_time: PING_TIME '=' timespec ';'
1461   {
1462 <  if (ypass == 1)
1463 <    PingFreq(yy_class) = $3;
1462 >  if (conf_parser_ctx.pass == 1)
1463 >    block_state.ping_freq.value = $3;
1464   };
1465  
1466 < class_ping_warning: PING_WARNING '=' timespec ';'
1466 > class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1467   {
1468 <  if (ypass == 1)
1469 <    PingWarning(yy_class) = $3;
1468 >  if (conf_parser_ctx.pass == 1)
1469 >    block_state.max_perip.value = $3;
1470   };
1471  
1472 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1472 > class_connectfreq: CONNECTFREQ '=' timespec ';'
1473   {
1474 <  if (ypass == 1)
1475 <    MaxPerIp(yy_class) = $3;
1474 >  if (conf_parser_ctx.pass == 1)
1475 >    block_state.con_freq.value = $3;
1476   };
1477  
1478 < class_connectfreq: CONNECTFREQ '=' timespec ';'
1478 > class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1479   {
1480 <  if (ypass == 1)
1481 <    ConFreq(yy_class) = $3;
1480 >  if (conf_parser_ctx.pass == 1)
1481 >    block_state.max_channels.value = $3;
1482   };
1483  
1484   class_max_number: MAX_NUMBER '=' NUMBER ';'
1485   {
1486 <  if (ypass == 1)
1487 <    MaxTotal(yy_class) = $3;
1486 >  if (conf_parser_ctx.pass == 1)
1487 >    block_state.max_total.value = $3;
1488   };
1489  
1490   class_max_global: MAX_GLOBAL '=' NUMBER ';'
1491   {
1492 <  if (ypass == 1)
1493 <    MaxGlobal(yy_class) = $3;
1492 >  if (conf_parser_ctx.pass == 1)
1493 >    block_state.max_global.value = $3;
1494   };
1495  
1496   class_max_local: MAX_LOCAL '=' NUMBER ';'
1497   {
1498 <  if (ypass == 1)
1499 <    MaxLocal(yy_class) = $3;
1498 >  if (conf_parser_ctx.pass == 1)
1499 >    block_state.max_local.value = $3;
1500   };
1501  
1502   class_max_ident: MAX_IDENT '=' NUMBER ';'
1503   {
1504 <  if (ypass == 1)
1505 <    MaxIdent(yy_class) = $3;
1504 >  if (conf_parser_ctx.pass == 1)
1505 >    block_state.max_ident.value = $3;
1506   };
1507  
1508   class_sendq: SENDQ '=' sizespec ';'
1509   {
1510 <  if (ypass == 1)
1511 <    MaxSendq(yy_class) = $3;
1510 >  if (conf_parser_ctx.pass == 1)
1511 >    block_state.max_sendq.value = $3;
1512 > };
1513 >
1514 > class_recvq: T_RECVQ '=' sizespec ';'
1515 > {
1516 >  if (conf_parser_ctx.pass == 1)
1517 >    if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1518 >      block_state.max_recvq.value = $3;
1519   };
1520  
1521   class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1522   {
1523 <  if (ypass == 1)
1524 <    CidrBitlenIPV4(yy_class) = $3;
1523 >  if (conf_parser_ctx.pass == 1)
1524 >    block_state.cidr_bitlen_ipv4.value = $3 > 32 ? 32 : $3;
1525   };
1526  
1527   class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1528   {
1529 <  if (ypass == 1)
1530 <    CidrBitlenIPV6(yy_class) = $3;
1529 >  if (conf_parser_ctx.pass == 1)
1530 >    block_state.cidr_bitlen_ipv6.value = $3 > 128 ? 128 : $3;
1531   };
1532  
1533   class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1534   {
1535 <  if (ypass == 1)
1536 <    NumberPerCidr(yy_class) = $3;
1535 >  if (conf_parser_ctx.pass == 1)
1536 >    block_state.number_per_cidr.value = $3;
1537   };
1538  
1539 + class_min_idle: MIN_IDLE '=' timespec ';'
1540 + {
1541 +  if (conf_parser_ctx.pass != 1)
1542 +    break;
1543 +
1544 +  block_state.min_idle.value = $3;
1545 +  block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1546 + };
1547 +
1548 + class_max_idle: MAX_IDLE '=' timespec ';'
1549 + {
1550 +  if (conf_parser_ctx.pass != 1)
1551 +    break;
1552 +
1553 +  block_state.max_idle.value = $3;
1554 +  block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1555 + };
1556 +
1557 + class_flags: IRCD_FLAGS
1558 + {
1559 +  if (conf_parser_ctx.pass == 1)
1560 +    block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE;
1561 + } '='  class_flags_items ';';
1562 +
1563 + class_flags_items: class_flags_items ',' class_flags_item | class_flags_item;
1564 + class_flags_item: RANDOM_IDLE
1565 + {
1566 +  if (conf_parser_ctx.pass == 1)
1567 +    block_state.flags.value |= CLASS_FLAGS_RANDOM_IDLE;
1568 + } | HIDE_IDLE_FROM_OPERS
1569 + {
1570 +  if (conf_parser_ctx.pass == 1)
1571 +    block_state.flags.value |= CLASS_FLAGS_HIDE_IDLE_FROM_OPERS;
1572 + };
1573 +
1574 +
1575   /***************************************************************************
1576 < *  section listen
1576 > * listen {} section
1577   ***************************************************************************/
1578   listen_entry: LISTEN
1579   {
1580 <  if (ypass == 2)
1581 <  {
1582 <    listener_address = NULL;
1716 <    listener_flags = 0;
1717 <  }
1718 < } '{' listen_items '}' ';'
1719 < {
1720 <  if (ypass == 2)
1721 <  {
1722 <    MyFree(listener_address);
1723 <    listener_address = NULL;
1724 <  }
1725 < };
1580 >  if (conf_parser_ctx.pass == 2)
1581 >    reset_block_state();
1582 > } '{' listen_items '}' ';';
1583  
1584   listen_flags: IRCD_FLAGS
1585   {
1586 <  listener_flags = 0;
1586 >  block_state.flags.value = 0;
1587   } '='  listen_flags_items ';';
1588  
1589   listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1590   listen_flags_item: T_SSL
1591   {
1592 <  if (ypass == 2)
1593 <    listener_flags |= LISTENER_SSL;
1592 >  if (conf_parser_ctx.pass == 2)
1593 >    block_state.flags.value |= LISTENER_SSL;
1594   } | HIDDEN
1595   {
1596 <  if (ypass == 2)
1597 <    listener_flags |= LISTENER_HIDDEN;
1596 >  if (conf_parser_ctx.pass == 2)
1597 >    block_state.flags.value |= LISTENER_HIDDEN;
1598 > } | T_SERVER
1599 > {
1600 >  if (conf_parser_ctx.pass == 2)
1601 >   block_state.flags.value |= LISTENER_SERVER;
1602   };
1603  
1604   listen_items:   listen_items listen_item | listen_item;
1605   listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';';
1606  
1607 < listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1607 > listen_port: PORT '=' port_items { block_state.flags.value = 0; } ';';
1608  
1609   port_items: port_items ',' port_item | port_item;
1610  
1611   port_item: NUMBER
1612   {
1613 <  if (ypass == 2)
1613 >  if (conf_parser_ctx.pass == 2)
1614    {
1615 <    if ((listener_flags & LISTENER_SSL))
1616 < #ifdef HAVE_LIBCRYPTO
1617 <      if (!ServerInfo.ctx)
1615 > #ifndef HAVE_TLS
1616 >    if (block_state.flags.value & LISTENER_SSL)
1617 >    {
1618 >      conf_error_report("TLS not available - port closed");
1619 >      break;
1620 >    }
1621   #endif
1622 <      {
1759 <        yyerror("SSL not available - port closed");
1760 <        break;
1761 <      }
1762 <    add_listener($1, listener_address, listener_flags);
1622 >    listener_add($1, block_state.addr.buf, block_state.flags.value);
1623    }
1624   } | NUMBER TWODOTS NUMBER
1625   {
1626 <  if (ypass == 2)
1626 >  if (conf_parser_ctx.pass == 2)
1627    {
1628 <    int i;
1629 <
1630 <    if ((listener_flags & LISTENER_SSL))
1631 < #ifdef HAVE_LIBCRYPTO
1632 <      if (!ServerInfo.ctx)
1628 > #ifndef HAVE_TLS
1629 >    if (block_state.flags.value & LISTENER_SSL)
1630 >    {
1631 >      conf_error_report("TLS not available - port closed");
1632 >      break;
1633 >    }
1634   #endif
1774      {
1775        yyerror("SSL not available - port closed");
1776        break;
1777      }
1635  
1636 <    for (i = $1; i <= $3; ++i)
1637 <      add_listener(i, listener_address, listener_flags);
1636 >    for (int i = $1; i <= $3; ++i)
1637 >      listener_add(i, block_state.addr.buf, block_state.flags.value);
1638    }
1639   };
1640  
1641   listen_address: IP '=' QSTRING ';'
1642   {
1643 <  if (ypass == 2)
1644 <  {
1788 <    MyFree(listener_address);
1789 <    DupString(listener_address, yylval.string);
1790 <  }
1643 >  if (conf_parser_ctx.pass == 2)
1644 >    strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1645   };
1646  
1647   listen_host: HOST '=' QSTRING ';'
1648   {
1649 <  if (ypass == 2)
1650 <  {
1797 <    MyFree(listener_address);
1798 <    DupString(listener_address, yylval.string);
1799 <  }
1649 >  if (conf_parser_ctx.pass == 2)
1650 >    strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1651   };
1652  
1653 +
1654   /***************************************************************************
1655 < *  section auth
1655 > * auth {} section
1656   ***************************************************************************/
1657   auth_entry: IRCD_AUTH
1658   {
1659 <  if (ypass == 2)
1660 <  {
1809 <    yy_conf = make_conf_item(CLIENT_TYPE);
1810 <    yy_aconf = map_to_conf(yy_conf);
1811 <  }
1812 <  else
1813 <  {
1814 <    MyFree(class_name);
1815 <    class_name = NULL;
1816 <  }
1659 >  if (conf_parser_ctx.pass == 2)
1660 >    reset_block_state();
1661   } '{' auth_items '}' ';'
1662   {
1663 <  if (ypass == 2)
1820 <  {
1821 <    struct CollectItem *yy_tmp = NULL;
1822 <    dlink_node *ptr = NULL, *next_ptr = NULL;
1663 >  dlink_node *node = NULL;
1664  
1665 <    if (yy_aconf->user && yy_aconf->host)
1666 <    {
1826 <      conf_add_class_to_conf(yy_conf, class_name);
1827 <      add_conf_by_address(CONF_CLIENT, yy_aconf);
1828 <    }
1829 <    else
1830 <      delete_conf_item(yy_conf);
1831 <
1832 <    /* copy over settings from first struct */
1833 <    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
1834 <    {
1835 <      struct AccessItem *new_aconf;
1836 <      struct ConfItem *new_conf;
1837 <
1838 <      new_conf = make_conf_item(CLIENT_TYPE);
1839 <      new_aconf = map_to_conf(new_conf);
1840 <
1841 <      yy_tmp = ptr->data;
1842 <
1843 <      assert(yy_tmp->user && yy_tmp->host);
1844 <
1845 <      if (yy_aconf->passwd != NULL)
1846 <        DupString(new_aconf->passwd, yy_aconf->passwd);
1847 <      if (yy_conf->name != NULL)
1848 <        DupString(new_conf->name, yy_conf->name);
1849 <      if (yy_aconf->passwd != NULL)
1850 <        DupString(new_aconf->passwd, yy_aconf->passwd);
1851 <
1852 <      new_aconf->flags = yy_aconf->flags;
1853 <      new_aconf->port  = yy_aconf->port;
1854 <
1855 <      DupString(new_aconf->user, yy_tmp->user);
1856 <      collapse(new_aconf->user);
1857 <
1858 <      DupString(new_aconf->host, yy_tmp->host);
1859 <      collapse(new_aconf->host);
1860 <
1861 <      conf_add_class_to_conf(new_conf, class_name);
1862 <      add_conf_by_address(CONF_CLIENT, new_aconf);
1863 <      dlinkDelete(&yy_tmp->node, &col_conf_list);
1864 <      free_collect_item(yy_tmp);
1865 <    }
1866 <
1867 <    MyFree(class_name);
1868 <    class_name = NULL;
1869 <    yy_conf = NULL;
1870 <    yy_aconf = NULL;
1871 <  }
1872 < };
1873 <
1874 < auth_items:     auth_items auth_item | auth_item;
1875 < auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
1876 <                auth_kline_exempt | auth_need_ident |
1877 <                auth_exceed_limit | auth_no_tilde | auth_gline_exempt |
1878 <                auth_spoof | auth_spoof_notice |
1879 <                auth_redir_serv | auth_redir_port | auth_can_flood |
1880 <                auth_need_password | auth_encrypted | error ';' ;
1665 >  if (conf_parser_ctx.pass != 2)
1666 >    break;
1667  
1668 < auth_user: USER '=' QSTRING ';'
1883 < {
1884 <  if (ypass == 2)
1668 >  DLINK_FOREACH(node, block_state.mask.list.head)
1669    {
1670 <    struct CollectItem *yy_tmp = NULL;
1670 >    struct MaskItem *conf = NULL;
1671      struct split_nuh_item nuh;
1672  
1673 <    nuh.nuhmask  = yylval.string;
1673 >    nuh.nuhmask  = node->data;
1674      nuh.nickptr  = NULL;
1675 <    nuh.userptr  = userbuf;
1676 <    nuh.hostptr  = hostbuf;
1893 <
1675 >    nuh.userptr  = block_state.user.buf;
1676 >    nuh.hostptr  = block_state.host.buf;
1677      nuh.nicksize = 0;
1678 <    nuh.usersize = sizeof(userbuf);
1679 <    nuh.hostsize = sizeof(hostbuf);
1897 <
1678 >    nuh.usersize = sizeof(block_state.user.buf);
1679 >    nuh.hostsize = sizeof(block_state.host.buf);
1680      split_nuh(&nuh);
1681  
1682 <    if (yy_aconf->user == NULL)
1683 <    {
1684 <      DupString(yy_aconf->user, userbuf);
1685 <      DupString(yy_aconf->host, hostbuf);
1686 <    }
1687 <    else
1688 <    {
1689 <      yy_tmp = MyMalloc(sizeof(struct CollectItem));
1682 >    conf        = conf_make(CONF_CLIENT);
1683 >    conf->user  = xstrdup(block_state.user.buf);
1684 >    conf->host  = xstrdup(block_state.host.buf);
1685 >
1686 >    if (block_state.rpass.buf[0])
1687 >      conf->passwd = xstrdup(block_state.rpass.buf);
1688 >    if (block_state.name.buf[0])
1689 >      conf->name = xstrdup(block_state.name.buf);
1690  
1691 <      DupString(yy_tmp->user, userbuf);
1692 <      DupString(yy_tmp->host, hostbuf);
1691 >    conf->flags = block_state.flags.value;
1692 >    conf->port  = block_state.port.value;
1693  
1694 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1695 <    }
1694 >    conf_add_class_to_conf(conf, block_state.class.buf);
1695 >    add_conf_by_address(CONF_CLIENT, conf);
1696    }
1697   };
1698  
1699 < /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1699 > auth_items:     auth_items auth_item | auth_item;
1700 > auth_item:      auth_user |
1701 >                auth_passwd |
1702 >                auth_class |
1703 >                auth_flags |
1704 >                auth_spoof |
1705 >                auth_redir_serv |
1706 >                auth_redir_port |
1707 >                auth_encrypted |
1708 >                error ';' ;
1709  
1710 < auth_passwd: PASSWORD '=' QSTRING ';'
1710 > auth_user: USER '=' QSTRING ';'
1711   {
1712 <  if (ypass == 2)
1713 <  {
1923 <    /* be paranoid */
1924 <    if (yy_aconf->passwd != NULL)
1925 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1926 <
1927 <    MyFree(yy_aconf->passwd);
1928 <    DupString(yy_aconf->passwd, yylval.string);
1929 <  }
1712 >  if (conf_parser_ctx.pass == 2)
1713 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1714   };
1715  
1716 < auth_spoof_notice: SPOOF_NOTICE '=' TBOOL ';'
1716 > auth_passwd: PASSWORD '=' QSTRING ';'
1717   {
1718 <  if (ypass == 2)
1719 <  {
1936 <    if (yylval.number)
1937 <      yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1938 <    else
1939 <      yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1940 <  }
1718 >  if (conf_parser_ctx.pass == 2)
1719 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1720   };
1721  
1722   auth_class: CLASS '=' QSTRING ';'
1723   {
1724 <  if (ypass == 2)
1725 <  {
1947 <    MyFree(class_name);
1948 <    DupString(class_name, yylval.string);
1949 <  }
1724 >  if (conf_parser_ctx.pass == 2)
1725 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1726   };
1727  
1728   auth_encrypted: ENCRYPTED '=' TBOOL ';'
1729   {
1730 <  if (ypass == 2)
1730 >  if (conf_parser_ctx.pass == 2)
1731    {
1732      if (yylval.number)
1733 <      SetConfEncrypted(yy_aconf);
1733 >      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1734      else
1735 <      ClearConfEncrypted(yy_aconf);
1735 >      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1736    }
1737   };
1738  
1739   auth_flags: IRCD_FLAGS
1740   {
1741 +  if (conf_parser_ctx.pass == 2)
1742 +    block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1743   } '='  auth_flags_items ';';
1744  
1745   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1746 < auth_flags_item: NOT { not_atom = 1; } auth_flags_item_atom
1969 <                | { not_atom = 0; } auth_flags_item_atom;
1970 <
1971 < auth_flags_item_atom: SPOOF_NOTICE
1746 > auth_flags_item: SPOOF_NOTICE
1747   {
1748 <  if (ypass == 2)
1749 <  {
1975 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1976 <    else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1977 <  }
1978 <
1748 >  if (conf_parser_ctx.pass == 2)
1749 >    block_state.flags.value |= CONF_FLAGS_SPOOF_NOTICE;
1750   } | EXCEED_LIMIT
1751   {
1752 <  if (ypass == 2)
1753 <  {
1983 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1984 <    else yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1985 <  }
1752 >  if (conf_parser_ctx.pass == 2)
1753 >    block_state.flags.value |= CONF_FLAGS_NOLIMIT;
1754   } | KLINE_EXEMPT
1755   {
1756 <  if (ypass == 2)
1757 <  {
1758 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1759 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1760 <  }
1756 >  if (conf_parser_ctx.pass == 2)
1757 >    block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1758 > } | XLINE_EXEMPT
1759 > {
1760 >  if (conf_parser_ctx.pass == 2)
1761 >    block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1762   } | NEED_IDENT
1763   {
1764 <  if (ypass == 2)
1765 <  {
1997 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1998 <    else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1999 <  }
1764 >  if (conf_parser_ctx.pass == 2)
1765 >    block_state.flags.value |= CONF_FLAGS_NEED_IDENTD;
1766   } | CAN_FLOOD
1767   {
1768 <  if (ypass == 2)
1769 <  {
2004 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
2005 <    else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
2006 <  }
2007 < } | CAN_IDLE
2008 < {
2009 <  if (ypass == 2)
2010 <  {
2011 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED;
2012 <    else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED;
2013 <  }
1768 >  if (conf_parser_ctx.pass == 2)
1769 >    block_state.flags.value |= CONF_FLAGS_CAN_FLOOD;
1770   } | NO_TILDE
1771   {
1772 <  if (ypass == 2)
1773 <  {
2018 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
2019 <    else yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
2020 <  }
2021 < } | GLINE_EXEMPT
2022 < {
2023 <  if (ypass == 2)
2024 <  {
2025 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
2026 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
2027 <  }
1772 >  if (conf_parser_ctx.pass == 2)
1773 >    block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1774   } | RESV_EXEMPT
1775   {
1776 <  if (ypass == 2)
1777 <  {
1778 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV;
1779 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1780 <  }
1776 >  if (conf_parser_ctx.pass == 2)
1777 >    block_state.flags.value |= CONF_FLAGS_EXEMPTRESV;
1778 > } | T_WEBIRC
1779 > {
1780 >  if (conf_parser_ctx.pass == 2)
1781 >    block_state.flags.value |= CONF_FLAGS_WEBIRC;
1782   } | NEED_PASSWORD
1783   {
1784 <  if (ypass == 2)
1785 <  {
2039 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2040 <    else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
2041 <  }
1784 >  if (conf_parser_ctx.pass == 2)
1785 >    block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1786   };
1787  
1788 < auth_kline_exempt: KLINE_EXEMPT '=' TBOOL ';'
1788 > auth_spoof: SPOOF '=' QSTRING ';'
1789   {
1790 <  if (ypass == 2)
1791 <  {
2048 <    if (yylval.number)
2049 <      yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
2050 <    else
2051 <      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
2052 <  }
2053 < };
1790 >  if (conf_parser_ctx.pass != 2)
1791 >    break;
1792  
1793 < auth_need_ident: NEED_IDENT '=' TBOOL ';'
2056 < {
2057 <  if (ypass == 2)
1793 >  if (valid_hostname(yylval.string))
1794    {
1795 <    if (yylval.number)
1796 <      yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
2061 <    else
2062 <      yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
1795 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1796 >    block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
1797    }
1798 +  else
1799 +    ilog(LOG_TYPE_IRCD, "Spoof either is too long or contains invalid characters. Ignoring it.");
1800   };
1801  
1802 < auth_exceed_limit: EXCEED_LIMIT '=' TBOOL ';'
1802 > auth_redir_serv: REDIRSERV '=' QSTRING ';'
1803   {
1804 <  if (ypass == 2)
1805 <  {
2070 <    if (yylval.number)
2071 <      yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
2072 <    else
2073 <      yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
2074 <  }
2075 < };
1804 >  if (conf_parser_ctx.pass != 2)
1805 >    break;
1806  
1807 < auth_can_flood: CAN_FLOOD '=' TBOOL ';'
1808 < {
2079 <  if (ypass == 2)
2080 <  {
2081 <    if (yylval.number)
2082 <      yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
2083 <    else
2084 <      yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
2085 <  }
1807 >  strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1808 >  block_state.flags.value |= CONF_FLAGS_REDIR;
1809   };
1810  
1811 < auth_no_tilde: NO_TILDE '=' TBOOL ';'
1811 > auth_redir_port: REDIRPORT '=' NUMBER ';'
1812   {
1813 <  if (ypass == 2)
1814 <  {
1815 <    if (yylval.number)
1816 <      yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1817 <    else
2095 <      yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
2096 <  }
1813 >  if (conf_parser_ctx.pass != 2)
1814 >    break;
1815 >
1816 >  block_state.flags.value |= CONF_FLAGS_REDIR;
1817 >  block_state.port.value = $3;
1818   };
1819  
1820 < auth_gline_exempt: GLINE_EXEMPT '=' TBOOL ';'
1820 >
1821 > /***************************************************************************
1822 > * resv {} section
1823 > ***************************************************************************/
1824 > resv_entry: RESV
1825   {
1826 <  if (ypass == 2)
1827 <  {
2103 <    if (yylval.number)
2104 <      yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
2105 <    else
2106 <      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
2107 <  }
2108 < };
1826 >  if (conf_parser_ctx.pass != 2)
1827 >    break;
1828  
1829 < /* XXX - need check for illegal hostnames here */
1830 < auth_spoof: SPOOF '=' QSTRING ';'
1829 >  reset_block_state();
1830 >  strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1831 > } '{' resv_items '}' ';'
1832   {
1833 <  if (ypass == 2)
1834 <  {
2115 <    MyFree(yy_conf->name);
1833 >  if (conf_parser_ctx.pass != 2)
1834 >    break;
1835  
1836 <    if (strlen(yylval.string) < HOSTLEN)
2118 <    {    
2119 <      DupString(yy_conf->name, yylval.string);
2120 <      yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
2121 <    }
2122 <    else
2123 <    {
2124 <      ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
2125 <      yy_conf->name = NULL;
2126 <    }
2127 <  }
1836 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1837   };
1838  
1839 < auth_redir_serv: REDIRSERV '=' QSTRING ';'
1839 > resv_items:     resv_items resv_item | resv_item;
1840 > resv_item:      resv_mask | resv_reason | resv_exempt | error ';' ;
1841 >
1842 > resv_mask: MASK '=' QSTRING ';'
1843   {
1844 <  if (ypass == 2)
1845 <  {
2134 <    yy_aconf->flags |= CONF_FLAGS_REDIR;
2135 <    MyFree(yy_conf->name);
2136 <    DupString(yy_conf->name, yylval.string);
2137 <  }
1844 >  if (conf_parser_ctx.pass == 2)
1845 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1846   };
1847  
1848 < auth_redir_port: REDIRPORT '=' NUMBER ';'
1848 > resv_reason: REASON '=' QSTRING ';'
1849   {
1850 <  if (ypass == 2)
1851 <  {
2144 <    yy_aconf->flags |= CONF_FLAGS_REDIR;
2145 <    yy_aconf->port = $3;
2146 <  }
1850 >  if (conf_parser_ctx.pass == 2)
1851 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1852   };
1853  
1854 < auth_need_password: NEED_PASSWORD '=' TBOOL ';'
1854 > resv_exempt: EXEMPT '=' QSTRING ';'
1855   {
1856 <  if (ypass == 2)
1857 <  {
2153 <    if (yylval.number)
2154 <      yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
2155 <    else
2156 <      yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2157 <  }
1856 >  if (conf_parser_ctx.pass == 2)
1857 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1858   };
1859  
1860  
1861   /***************************************************************************
1862 < *  section resv
1862 > * service {} section
1863   ***************************************************************************/
1864 < resv_entry: RESV
2165 < {
2166 <  if (ypass == 2)
2167 <  {
2168 <    MyFree(resv_reason);
2169 <    resv_reason = NULL;
2170 <  }
2171 < } '{' resv_items '}' ';'
2172 < {
2173 <  if (ypass == 2)
2174 <  {
2175 <    MyFree(resv_reason);
2176 <    resv_reason = NULL;
2177 <  }
2178 < };
1864 > service_entry: T_SERVICE '{' service_items '}' ';';
1865  
1866 < resv_items:     resv_items resv_item | resv_item;
1867 < resv_item:      resv_creason | resv_channel | resv_nick | error ';' ;
1866 > service_items:     service_items service_item | service_item;
1867 > service_item:      service_name | error;
1868  
1869 < resv_creason: REASON '=' QSTRING ';'
1869 > service_name: NAME '=' QSTRING ';'
1870   {
1871 <  if (ypass == 2)
1872 <  {
2187 <    MyFree(resv_reason);
2188 <    DupString(resv_reason, yylval.string);
2189 <  }
2190 < };
1871 >  if (conf_parser_ctx.pass != 2)
1872 >    break;
1873  
1874 < resv_channel: CHANNEL '=' QSTRING ';'
2193 < {
2194 <  if (ypass == 2)
1874 >  if (valid_servname(yylval.string))
1875    {
1876 <    if (IsChanPrefix(*yylval.string))
1877 <    {
2198 <      char def_reason[] = "No reason";
2199 <
2200 <      create_channel_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
2201 <    }
1876 >    struct ServiceItem *service = service_make();
1877 >    service->name = xstrdup(yylval.string);
1878    }
2203  /* ignore it for now.. but we really should make a warning if
2204   * its an erroneous name --fl_ */
1879   };
1880  
2207 resv_nick: NICK '=' QSTRING ';'
2208 {
2209  if (ypass == 2)
2210  {
2211    char def_reason[] = "No reason";
2212
2213    create_nick_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
2214  }
2215 };
1881  
1882   /***************************************************************************
1883 < *  section shared, for sharing remote klines etc.
1883 > * shared {} section, for sharing remote klines etc.
1884   ***************************************************************************/
1885   shared_entry: T_SHARED
1886   {
1887 <  if (ypass == 2)
1888 <  {
1889 <    yy_conf = make_conf_item(ULINE_TYPE);
1890 <    yy_match_item = map_to_conf(yy_conf);
1891 <    yy_match_item->action = SHARED_ALL;
1892 <  }
1887 >  if (conf_parser_ctx.pass != 2)
1888 >    break;
1889 >
1890 >  reset_block_state();
1891 >
1892 >  strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1893 >  strlcpy(block_state.user.buf, "*", sizeof(block_state.user.buf));
1894 >  strlcpy(block_state.host.buf, "*", sizeof(block_state.host.buf));
1895 >  block_state.flags.value = SHARED_ALL;
1896   } '{' shared_items '}' ';'
1897   {
1898 <  if (ypass == 2)
1899 <  {
1900 <    yy_conf = NULL;
1901 <  }
1898 >  if (conf_parser_ctx.pass != 2)
1899 >    break;
1900 >
1901 >  struct SharedItem *shared = shared_make();
1902 >  shared->type = block_state.flags.value;
1903 >  shared->server = xstrdup(block_state.name.buf);
1904 >  shared->user = xstrdup(block_state.user.buf);
1905 >  shared->host = xstrdup(block_state.host.buf);
1906   };
1907  
1908   shared_items: shared_items shared_item | shared_item;
# Line 2238 | Line 1910 | shared_item:  shared_name | shared_user
1910  
1911   shared_name: NAME '=' QSTRING ';'
1912   {
1913 <  if (ypass == 2)
1914 <  {
2243 <    MyFree(yy_conf->name);
2244 <    DupString(yy_conf->name, yylval.string);
2245 <  }
1913 >  if (conf_parser_ctx.pass == 2)
1914 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1915   };
1916  
1917   shared_user: USER '=' QSTRING ';'
1918   {
1919 <  if (ypass == 2)
1919 >  if (conf_parser_ctx.pass == 2)
1920    {
1921      struct split_nuh_item nuh;
1922  
1923      nuh.nuhmask  = yylval.string;
1924      nuh.nickptr  = NULL;
1925 <    nuh.userptr  = userbuf;
1926 <    nuh.hostptr  = hostbuf;
1925 >    nuh.userptr  = block_state.user.buf;
1926 >    nuh.hostptr  = block_state.host.buf;
1927  
1928      nuh.nicksize = 0;
1929 <    nuh.usersize = sizeof(userbuf);
1930 <    nuh.hostsize = sizeof(hostbuf);
1929 >    nuh.usersize = sizeof(block_state.user.buf);
1930 >    nuh.hostsize = sizeof(block_state.host.buf);
1931  
1932      split_nuh(&nuh);
2264
2265    DupString(yy_match_item->user, userbuf);
2266    DupString(yy_match_item->host, hostbuf);
1933    }
1934   };
1935  
1936   shared_type: TYPE
1937   {
1938 <  if (ypass == 2)
1939 <    yy_match_item->action = 0;
1938 >  if (conf_parser_ctx.pass == 2)
1939 >    block_state.flags.value = 0;
1940   } '=' shared_types ';' ;
1941  
1942   shared_types: shared_types ',' shared_type_item | shared_type_item;
1943   shared_type_item: KLINE
1944   {
1945 <  if (ypass == 2)
1946 <    yy_match_item->action |= SHARED_KLINE;
2281 < } | TKLINE
2282 < {
2283 <  if (ypass == 2)
2284 <    yy_match_item->action |= SHARED_TKLINE;
1945 >  if (conf_parser_ctx.pass == 2)
1946 >    block_state.flags.value |= SHARED_KLINE;
1947   } | UNKLINE
1948   {
1949 <  if (ypass == 2)
1950 <    yy_match_item->action |= SHARED_UNKLINE;
1951 < } | XLINE
1949 >  if (conf_parser_ctx.pass == 2)
1950 >    block_state.flags.value |= SHARED_UNKLINE;
1951 > } | T_DLINE
1952 > {
1953 >  if (conf_parser_ctx.pass == 2)
1954 >    block_state.flags.value |= SHARED_DLINE;
1955 > } | T_UNDLINE
1956   {
1957 <  if (ypass == 2)
1958 <    yy_match_item->action |= SHARED_XLINE;
1959 < } | TXLINE
1957 >  if (conf_parser_ctx.pass == 2)
1958 >    block_state.flags.value |= SHARED_UNDLINE;
1959 > } | XLINE
1960   {
1961 <  if (ypass == 2)
1962 <    yy_match_item->action |= SHARED_TXLINE;
1961 >  if (conf_parser_ctx.pass == 2)
1962 >    block_state.flags.value |= SHARED_XLINE;
1963   } | T_UNXLINE
1964   {
1965 <  if (ypass == 2)
1966 <    yy_match_item->action |= SHARED_UNXLINE;
1965 >  if (conf_parser_ctx.pass == 2)
1966 >    block_state.flags.value |= SHARED_UNXLINE;
1967   } | RESV
1968   {
1969 <  if (ypass == 2)
1970 <    yy_match_item->action |= SHARED_RESV;
2305 < } | TRESV
2306 < {
2307 <  if (ypass == 2)
2308 <    yy_match_item->action |= SHARED_TRESV;
1969 >  if (conf_parser_ctx.pass == 2)
1970 >    block_state.flags.value |= SHARED_RESV;
1971   } | T_UNRESV
1972   {
1973 <  if (ypass == 2)
1974 <    yy_match_item->action |= SHARED_UNRESV;
1973 >  if (conf_parser_ctx.pass == 2)
1974 >    block_state.flags.value |= SHARED_UNRESV;
1975   } | T_LOCOPS
1976   {
1977 <  if (ypass == 2)
1978 <    yy_match_item->action |= SHARED_LOCOPS;
1977 >  if (conf_parser_ctx.pass == 2)
1978 >    block_state.flags.value |= SHARED_LOCOPS;
1979   } | T_ALL
1980   {
1981 <  if (ypass == 2)
1982 <    yy_match_item->action = SHARED_ALL;
1981 >  if (conf_parser_ctx.pass == 2)
1982 >    block_state.flags.value = SHARED_ALL;
1983   };
1984  
1985 +
1986   /***************************************************************************
1987 < *  section cluster
1987 > * cluster {} section
1988   ***************************************************************************/
1989   cluster_entry: T_CLUSTER
1990   {
1991 <  if (ypass == 2)
1992 <  {
1993 <    yy_conf = make_conf_item(CLUSTER_TYPE);
1994 <    yy_conf->flags = SHARED_ALL;
1995 <  }
1991 >  if (conf_parser_ctx.pass != 2)
1992 >    break;
1993 >
1994 >  reset_block_state();
1995 >
1996 >  strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1997 >  block_state.flags.value = CLUSTER_ALL;
1998   } '{' cluster_items '}' ';'
1999   {
2000 <  if (ypass == 2)
2001 <  {
2002 <    if (yy_conf->name == NULL)
2003 <      DupString(yy_conf->name, "*");
2004 <    yy_conf = NULL;
2005 <  }
2000 >  if (conf_parser_ctx.pass != 2)
2001 >    break;
2002 >
2003 >  struct ClusterItem *cluster = cluster_make();
2004 >  cluster->type = block_state.flags.value;
2005 >  cluster->server = xstrdup(block_state.name.buf);
2006   };
2007  
2008 < cluster_items:  cluster_items cluster_item | cluster_item;
2009 < cluster_item:   cluster_name | cluster_type | error ';' ;
2008 > cluster_items:  cluster_items cluster_item | cluster_item;
2009 > cluster_item:   cluster_name | cluster_type | error ';' ;
2010  
2011   cluster_name: NAME '=' QSTRING ';'
2012   {
2013 <  if (ypass == 2)
2014 <    DupString(yy_conf->name, yylval.string);
2013 >  if (conf_parser_ctx.pass == 2)
2014 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2015   };
2016  
2017   cluster_type: TYPE
2018   {
2019 <  if (ypass == 2)
2020 <    yy_conf->flags = 0;
2019 >  if (conf_parser_ctx.pass == 2)
2020 >    block_state.flags.value = 0;
2021   } '=' cluster_types ';' ;
2022  
2023 < cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2023 > cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2024   cluster_type_item: KLINE
2025   {
2026 <  if (ypass == 2)
2027 <    yy_conf->flags |= SHARED_KLINE;
2363 < } | TKLINE
2364 < {
2365 <  if (ypass == 2)
2366 <    yy_conf->flags |= SHARED_TKLINE;
2026 >  if (conf_parser_ctx.pass == 2)
2027 >    block_state.flags.value |= CLUSTER_KLINE;
2028   } | UNKLINE
2029   {
2030 <  if (ypass == 2)
2031 <    yy_conf->flags |= SHARED_UNKLINE;
2032 < } | XLINE
2030 >  if (conf_parser_ctx.pass == 2)
2031 >    block_state.flags.value |= CLUSTER_UNKLINE;
2032 > } | T_DLINE
2033 > {
2034 >  if (conf_parser_ctx.pass == 2)
2035 >    block_state.flags.value |= CLUSTER_DLINE;
2036 > } | T_UNDLINE
2037   {
2038 <  if (ypass == 2)
2039 <    yy_conf->flags |= SHARED_XLINE;
2040 < } | TXLINE
2038 >  if (conf_parser_ctx.pass == 2)
2039 >    block_state.flags.value |= CLUSTER_UNDLINE;
2040 > } | XLINE
2041   {
2042 <  if (ypass == 2)
2043 <    yy_conf->flags |= SHARED_TXLINE;
2042 >  if (conf_parser_ctx.pass == 2)
2043 >    block_state.flags.value |= CLUSTER_XLINE;
2044   } | T_UNXLINE
2045   {
2046 <  if (ypass == 2)
2047 <    yy_conf->flags |= SHARED_UNXLINE;
2046 >  if (conf_parser_ctx.pass == 2)
2047 >    block_state.flags.value |= CLUSTER_UNXLINE;
2048   } | RESV
2049   {
2050 <  if (ypass == 2)
2051 <    yy_conf->flags |= SHARED_RESV;
2387 < } | TRESV
2388 < {
2389 <  if (ypass == 2)
2390 <    yy_conf->flags |= SHARED_TRESV;
2050 >  if (conf_parser_ctx.pass == 2)
2051 >    block_state.flags.value |= CLUSTER_RESV;
2052   } | T_UNRESV
2053   {
2054 <  if (ypass == 2)
2055 <    yy_conf->flags |= SHARED_UNRESV;
2054 >  if (conf_parser_ctx.pass == 2)
2055 >    block_state.flags.value |= CLUSTER_UNRESV;
2056   } | T_LOCOPS
2057   {
2058 <  if (ypass == 2)
2059 <    yy_conf->flags |= SHARED_LOCOPS;
2058 >  if (conf_parser_ctx.pass == 2)
2059 >    block_state.flags.value |= CLUSTER_LOCOPS;
2060   } | T_ALL
2061   {
2062 <  if (ypass == 2)
2063 <    yy_conf->flags = SHARED_ALL;
2062 >  if (conf_parser_ctx.pass == 2)
2063 >    block_state.flags.value = CLUSTER_ALL;
2064   };
2065  
2066 +
2067   /***************************************************************************
2068 < *  section connect
2068 > * connect {}  section
2069   ***************************************************************************/
2070 < connect_entry: CONNECT  
2070 > connect_entry: CONNECT
2071   {
2410  if (ypass == 2)
2411  {
2412    yy_conf = make_conf_item(SERVER_TYPE);
2413    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
2414    yy_aconf->passwd = NULL;
2415    /* defaults */
2416    yy_aconf->port = PORTNUM;
2072  
2073 <    if (ConfigFileEntry.burst_away)
2074 <      yy_aconf->flags = CONF_FLAGS_BURST_AWAY;
2075 <  }
2076 <  else
2077 <  {
2078 <    MyFree(class_name);
2079 <    class_name = NULL;
2425 <  }
2426 < } connect_name_b '{' connect_items '}' ';'
2073 >  if (conf_parser_ctx.pass != 2)
2074 >    break;
2075 >
2076 >  reset_block_state();
2077 >  block_state.aftype.value = AF_INET;
2078 >  block_state.port.value = PORTNUM;
2079 > } '{' connect_items '}' ';'
2080   {
2081 <  if (ypass == 2)
2082 <  {
2430 <    struct CollectItem *yy_hconf=NULL;
2431 <    struct CollectItem *yy_lconf=NULL;
2432 <    dlink_node *ptr;
2433 <    dlink_node *next_ptr;
2434 < #ifdef HAVE_LIBCRYPTO
2435 <    if (yy_aconf->host &&
2436 <        ((yy_aconf->passwd && yy_aconf->spasswd) ||
2437 <         (yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf))))
2438 < #else /* !HAVE_LIBCRYPTO */
2439 <      if (yy_aconf->host && !IsConfCryptLink(yy_aconf) &&
2440 <          yy_aconf->passwd && yy_aconf->spasswd)
2441 < #endif /* !HAVE_LIBCRYPTO */
2442 <        {
2443 <          if (conf_add_server(yy_conf, class_name) == -1)
2444 <          {
2445 <            delete_conf_item(yy_conf);
2446 <            yy_conf = NULL;
2447 <            yy_aconf = NULL;
2448 <          }
2449 <        }
2450 <        else
2451 <        {
2452 <          /* Even if yy_conf ->name is NULL
2453 <           * should still unhook any hub/leaf confs still pending
2454 <           */
2455 <          unhook_hub_leaf_confs();
2456 <
2457 <          if (yy_conf->name != NULL)
2458 <          {
2459 < #ifndef HAVE_LIBCRYPTO
2460 <            if (IsConfCryptLink(yy_aconf))
2461 <              yyerror("Ignoring connect block -- no OpenSSL support");
2462 < #else
2463 <            if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2464 <              yyerror("Ignoring connect block -- missing key");
2465 < #endif
2466 <            if (yy_aconf->host == NULL)
2467 <              yyerror("Ignoring connect block -- missing host");
2468 <            else if (!IsConfCryptLink(yy_aconf) &&
2469 <                    (!yy_aconf->passwd || !yy_aconf->spasswd))
2470 <              yyerror("Ignoring connect block -- missing password");
2471 <          }
2472 <
2473 <
2474 <          /* XXX
2475 <           * This fixes a try_connections() core (caused by invalid class_ptr
2476 <           * pointers) reported by metalrock. That's an ugly fix, but there
2477 <           * is currently no better way. The entire config subsystem needs an
2478 <           * rewrite ASAP. make_conf_item() shouldn't really add things onto
2479 <           * a doubly linked list immediately without any sanity checks!  -Michael
2480 <           */
2481 <          delete_conf_item(yy_conf);
2482 <
2483 <          yy_aconf = NULL;
2484 <          yy_conf = NULL;
2485 <        }
2486 <
2487 <      /*
2488 <       * yy_conf is still pointing at the server that is having
2489 <       * a connect block built for it. This means, y_aconf->name
2490 <       * points to the actual irc name this server will be known as.
2491 <       * Now this new server has a set or even just one hub_mask (or leaf_mask)
2492 <       * given in the link list at yy_hconf. Fill in the HUB confs
2493 <       * from this link list now.
2494 <       */        
2495 <      DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
2496 <      {
2497 <        struct ConfItem *new_hub_conf;
2498 <        struct MatchItem *match_item;
2499 <
2500 <        yy_hconf = ptr->data;
2501 <
2502 <        /* yy_conf == NULL is a fatal error for this connect block! */
2503 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2504 <        {
2505 <          new_hub_conf = make_conf_item(HUB_TYPE);
2506 <          match_item = (struct MatchItem *)map_to_conf(new_hub_conf);
2507 <          DupString(new_hub_conf->name, yy_conf->name);
2508 <          if (yy_hconf->user != NULL)
2509 <            DupString(match_item->user, yy_hconf->user);
2510 <          else
2511 <            DupString(match_item->user, "*");
2512 <          if (yy_hconf->host != NULL)
2513 <            DupString(match_item->host, yy_hconf->host);
2514 <          else
2515 <            DupString(match_item->host, "*");
2516 <        }
2517 <        dlinkDelete(&yy_hconf->node, &hub_conf_list);
2518 <        free_collect_item(yy_hconf);
2519 <      }
2520 <
2521 <      /* Ditto for the LEAF confs */
2522 <
2523 <      DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
2524 <      {
2525 <        struct ConfItem *new_leaf_conf;
2526 <        struct MatchItem *match_item;
2527 <
2528 <        yy_lconf = ptr->data;
2529 <
2530 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2531 <        {
2532 <          new_leaf_conf = make_conf_item(LEAF_TYPE);
2533 <          match_item = (struct MatchItem *)map_to_conf(new_leaf_conf);
2534 <          DupString(new_leaf_conf->name, yy_conf->name);
2535 <          if (yy_lconf->user != NULL)
2536 <            DupString(match_item->user, yy_lconf->user);
2537 <          else
2538 <            DupString(match_item->user, "*");
2539 <          if (yy_lconf->host != NULL)
2540 <            DupString(match_item->host, yy_lconf->host);
2541 <          else
2542 <            DupString(match_item->host, "*");
2543 <        }
2544 <        dlinkDelete(&yy_lconf->node, &leaf_conf_list);
2545 <        free_collect_item(yy_lconf);
2546 <      }
2547 <      MyFree(class_name);
2548 <      class_name = NULL;
2549 <      yy_conf = NULL;
2550 <      yy_aconf = NULL;
2551 <  }
2552 < };
2081 >  struct MaskItem *conf = NULL;
2082 >  struct addrinfo hints, *res;
2083  
2084 < connect_name_b: | connect_name_t;
2085 < connect_items:  connect_items connect_item | connect_item;
2556 < connect_item:   connect_name | connect_host | connect_vhost |
2557 <                connect_send_password | connect_accept_password |
2558 <                connect_aftype | connect_port |
2559 <                connect_fakename | connect_flags | connect_hub_mask |
2560 <                connect_leaf_mask | connect_class | connect_auto |
2561 <                connect_encrypted | connect_compressed | connect_cryptlink |
2562 <                connect_rsa_public_key_file | connect_cipher_preference |
2563 <                connect_topicburst | error ';' ;
2084 >  if (conf_parser_ctx.pass != 2)
2085 >    break;
2086  
2087 < connect_name: NAME '=' QSTRING ';'
2088 < {
2089 <  if (ypass == 2)
2568 <  {
2569 <    if (yy_conf->name != NULL)
2570 <      yyerror("Multiple connect name entry");
2087 >  if (!block_state.name.buf[0] ||
2088 >      !block_state.host.buf[0])
2089 >    break;
2090  
2091 <    MyFree(yy_conf->name);
2092 <    DupString(yy_conf->name, yylval.string);
2093 <  }
2575 < };
2091 >  if (!block_state.rpass.buf[0] ||
2092 >      !block_state.spass.buf[0])
2093 >    break;
2094  
2095 < connect_name_t: QSTRING
2096 < {
2097 <  if (ypass == 2)
2580 <  {
2581 <    if (yy_conf->name != NULL)
2582 <      yyerror("Multiple connect name entry");
2095 >  if (has_wildcards(block_state.name.buf) ||
2096 >      has_wildcards(block_state.host.buf))
2097 >    break;
2098  
2099 <    MyFree(yy_conf->name);
2100 <    DupString(yy_conf->name, yylval.string);
2101 <  }
2102 < };
2099 >  conf = conf_make(CONF_SERVER);
2100 >  conf->port = block_state.port.value;
2101 >  conf->flags = block_state.flags.value;
2102 >  conf->aftype = block_state.aftype.value;
2103 >  conf->host = xstrdup(block_state.host.buf);
2104 >  conf->name = xstrdup(block_state.name.buf);
2105 >  conf->passwd = xstrdup(block_state.rpass.buf);
2106 >  conf->spasswd = xstrdup(block_state.spass.buf);
2107  
2108 < connect_host: HOST '=' QSTRING ';'
2109 < {
2591 <  if (ypass == 2)
2592 <  {
2593 <    MyFree(yy_aconf->host);
2594 <    DupString(yy_aconf->host, yylval.string);
2595 <  }
2596 < };
2108 >  if (block_state.cert.buf[0])
2109 >    conf->certfp = xstrdup(block_state.cert.buf);
2110  
2111 < connect_vhost: VHOST '=' QSTRING ';'
2112 < {
2113 <  if (ypass == 2)
2114 <  {
2115 <    struct addrinfo hints, *res;
2111 >  if (block_state.ciph.buf[0])
2112 >    conf->cipher_list = xstrdup(block_state.ciph.buf);
2113 >
2114 >  dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2115 >  dlinkMoveList(&block_state.hub.list, &conf->hub_list);
2116  
2117 +  if (block_state.bind.buf[0])
2118 +  {
2119      memset(&hints, 0, sizeof(hints));
2120  
2121      hints.ai_family   = AF_UNSPEC;
2122      hints.ai_socktype = SOCK_STREAM;
2123      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2124  
2125 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
2126 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2125 >    if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2126 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2127      else
2128      {
2129 <      assert(res != NULL);
2129 >      assert(res);
2130  
2131 <      memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen);
2132 <      yy_aconf->my_ipnum.ss.ss_family = res->ai_family;
2133 <      yy_aconf->my_ipnum.ss_len = res->ai_addrlen;
2134 <      irc_freeaddrinfo(res);
2131 >      memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2132 >      conf->bind.ss.ss_family = res->ai_family;
2133 >      conf->bind.ss_len = res->ai_addrlen;
2134 >      freeaddrinfo(res);
2135      }
2136    }
2622 };
2623
2624 connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2625 {
2626  if (ypass == 2)
2627  {
2628    if ($3[0] == ':')
2629      yyerror("Server passwords cannot begin with a colon");
2630    else if (strchr($3, ' ') != NULL)
2631      yyerror("Server passwords cannot contain spaces");
2632    else {
2633      if (yy_aconf->spasswd != NULL)
2634        memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2137  
2138 <      MyFree(yy_aconf->spasswd);
2139 <      DupString(yy_aconf->spasswd, yylval.string);
2638 <    }
2639 <  }
2138 >  conf_add_class_to_conf(conf, block_state.class.buf);
2139 >  lookup_confhost(conf);
2140   };
2141  
2142 < connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2143 < {
2144 <  if (ypass == 2)
2145 <  {
2146 <    if ($3[0] == ':')
2147 <      yyerror("Server passwords cannot begin with a colon");
2148 <    else if (strchr($3, ' ') != NULL)
2149 <      yyerror("Server passwords cannot contain spaces");
2150 <    else {
2151 <      if (yy_aconf->passwd != NULL)
2152 <        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2153 <
2154 <      MyFree(yy_aconf->passwd);
2155 <      DupString(yy_aconf->passwd, yylval.string);
2156 <    }
2157 <  }
2658 < };
2142 > connect_items:  connect_items connect_item | connect_item;
2143 > connect_item:   connect_name |
2144 >                connect_host |
2145 >                connect_vhost |
2146 >                connect_send_password |
2147 >                connect_accept_password |
2148 >                connect_ssl_certificate_fingerprint |
2149 >                connect_aftype |
2150 >                connect_port |
2151 >                connect_ssl_cipher_list |
2152 >                connect_flags |
2153 >                connect_hub_mask |
2154 >                connect_leaf_mask |
2155 >                connect_class |
2156 >                connect_encrypted |
2157 >                error ';' ;
2158  
2159 < connect_port: PORT '=' NUMBER ';'
2159 > connect_name: NAME '=' QSTRING ';'
2160   {
2161 <  if (ypass == 2)
2162 <    yy_aconf->port = $3;
2161 >  if (conf_parser_ctx.pass == 2)
2162 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2163   };
2164  
2165 < connect_aftype: AFTYPE '=' T_IPV4 ';'
2165 > connect_host: HOST '=' QSTRING ';'
2166   {
2167 <  if (ypass == 2)
2168 <    yy_aconf->aftype = AF_INET;
2670 < } | AFTYPE '=' T_IPV6 ';'
2671 < {
2672 < #ifdef IPV6
2673 <  if (ypass == 2)
2674 <    yy_aconf->aftype = AF_INET6;
2675 < #endif
2167 >  if (conf_parser_ctx.pass == 2)
2168 >    strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2169   };
2170  
2171 < connect_fakename: FAKENAME '=' QSTRING ';'
2171 > connect_vhost: VHOST '=' QSTRING ';'
2172   {
2173 <  if (ypass == 2)
2174 <  {
2682 <    MyFree(yy_aconf->fakename);
2683 <    DupString(yy_aconf->fakename, yylval.string);
2684 <  }
2173 >  if (conf_parser_ctx.pass == 2)
2174 >    strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2175   };
2176  
2177 < connect_flags: IRCD_FLAGS
2177 > connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2178   {
2179 < } '='  connect_flags_items ';';
2179 >  if (conf_parser_ctx.pass != 2)
2180 >    break;
2181  
2182 < connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2183 < connect_flags_item: NOT  { not_atom = 1; } connect_flags_item_atom
2184 <                        |  { not_atom = 0; } connect_flags_item_atom;
2185 <
2186 < connect_flags_item_atom: LAZYLINK
2187 < {
2188 <  if (ypass == 2)
2698 <  {
2699 <    if (not_atom)ClearConfLazyLink(yy_aconf);
2700 <    else SetConfLazyLink(yy_aconf);
2701 <  }
2702 < } | COMPRESSED
2703 < {
2704 <  if (ypass == 2)
2705 < #ifndef HAVE_LIBZ
2706 <    yyerror("Ignoring flags = compressed; -- no zlib support");
2707 < #else
2708 < {
2709 <   if (not_atom)ClearConfCompressed(yy_aconf);
2710 <   else SetConfCompressed(yy_aconf);
2711 < }
2712 < #endif
2713 < } | CRYPTLINK
2714 < {
2715 <  if (ypass == 2)
2716 <  {
2717 <    if (not_atom)ClearConfCryptLink(yy_aconf);
2718 <    else SetConfCryptLink(yy_aconf);
2719 <  }
2720 < } | AUTOCONN
2721 < {
2722 <  if (ypass == 2)
2723 <  {
2724 <    if (not_atom)ClearConfAllowAutoConn(yy_aconf);
2725 <    else SetConfAllowAutoConn(yy_aconf);
2726 <  }
2727 < } | BURST_AWAY
2728 < {
2729 <  if (ypass == 2)
2730 <  {
2731 <    if (not_atom)ClearConfAwayBurst(yy_aconf);
2732 <    else SetConfAwayBurst(yy_aconf);
2733 <  }
2734 < } | TOPICBURST
2735 < {
2736 <  if (ypass == 2)
2737 <  {
2738 <    if (not_atom)ClearConfTopicBurst(yy_aconf);
2739 <    else SetConfTopicBurst(yy_aconf);
2740 <  }
2741 < }
2742 < ;
2182 >  if ($3[0] == ':')
2183 >    conf_error_report("Server passwords cannot begin with a colon");
2184 >  else if (strchr($3, ' '))
2185 >    conf_error_report("Server passwords cannot contain spaces");
2186 >  else
2187 >    strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
2188 > };
2189  
2190 < connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2190 > connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2191   {
2192 < #ifdef HAVE_LIBCRYPTO
2193 <  if (ypass == 2)
2748 <  {
2749 <    BIO *file;
2750 <
2751 <    if (yy_aconf->rsa_public_key != NULL)
2752 <    {
2753 <      RSA_free(yy_aconf->rsa_public_key);
2754 <      yy_aconf->rsa_public_key = NULL;
2755 <    }
2756 <
2757 <    if (yy_aconf->rsa_public_key_file != NULL)
2758 <    {
2759 <      MyFree(yy_aconf->rsa_public_key_file);
2760 <      yy_aconf->rsa_public_key_file = NULL;
2761 <    }
2762 <
2763 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
2764 <
2765 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2766 <    {
2767 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2768 <      break;
2769 <    }
2192 >  if (conf_parser_ctx.pass != 2)
2193 >    break;
2194  
2195 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2196 <
2197 <    if (yy_aconf->rsa_public_key == NULL)
2198 <    {
2199 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2200 <      break;
2777 <    }
2778 <      
2779 <    BIO_set_close(file, BIO_CLOSE);
2780 <    BIO_free(file);
2781 <  }
2782 < #endif /* HAVE_LIBCRYPTO */
2195 >  if ($3[0] == ':')
2196 >    conf_error_report("Server passwords cannot begin with a colon");
2197 >  else if (strchr($3, ' '))
2198 >    conf_error_report("Server passwords cannot contain spaces");
2199 >  else
2200 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2201   };
2202  
2203 < connect_encrypted: ENCRYPTED '=' TBOOL ';'
2203 > connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2204   {
2205 <  if (ypass == 2)
2206 <  {
2789 <    if (yylval.number)
2790 <      yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
2791 <    else
2792 <      yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED;
2793 <  }
2205 >  if (conf_parser_ctx.pass == 2)
2206 >    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2207   };
2208  
2209 < connect_cryptlink: CRYPTLINK '=' TBOOL ';'
2209 > connect_port: PORT '=' NUMBER ';'
2210   {
2211 <  if (ypass == 2)
2212 <  {
2800 <    if (yylval.number)
2801 <      yy_aconf->flags |= CONF_FLAGS_CRYPTLINK;
2802 <    else
2803 <      yy_aconf->flags &= ~CONF_FLAGS_CRYPTLINK;
2804 <  }
2211 >  if (conf_parser_ctx.pass == 2)
2212 >    block_state.port.value = $3;
2213   };
2214  
2215 < connect_compressed: COMPRESSED '=' TBOOL ';'
2215 > connect_aftype: AFTYPE '=' T_IPV4 ';'
2216   {
2217 <  if (ypass == 2)
2218 <  {
2219 <    if (yylval.number)
2220 < #ifndef HAVE_LIBZ
2221 <      yyerror("Ignoring compressed=yes; -- no zlib support");
2222 < #else
2815 <      yy_aconf->flags |= CONF_FLAGS_COMPRESSED;
2816 < #endif
2817 <    else
2818 <      yy_aconf->flags &= ~CONF_FLAGS_COMPRESSED;
2819 <  }
2217 >  if (conf_parser_ctx.pass == 2)
2218 >    block_state.aftype.value = AF_INET;
2219 > } | AFTYPE '=' T_IPV6 ';'
2220 > {
2221 >  if (conf_parser_ctx.pass == 2)
2222 >    block_state.aftype.value = AF_INET6;
2223   };
2224  
2225 < connect_auto: AUTOCONN '=' TBOOL ';'
2225 > connect_flags: IRCD_FLAGS
2226   {
2227 <  if (ypass == 2)
2228 <  {
2229 <    if (yylval.number)
2230 <      yy_aconf->flags |= CONF_FLAGS_ALLOW_AUTO_CONN;
2231 <    else
2232 <      yy_aconf->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN;
2233 <  }
2227 >  block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2228 > } '='  connect_flags_items ';';
2229 >
2230 > connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2231 > connect_flags_item: AUTOCONN
2232 > {
2233 >  if (conf_parser_ctx.pass == 2)
2234 >    block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN;
2235 > } | T_SSL
2236 > {
2237 >  if (conf_parser_ctx.pass == 2)
2238 >    block_state.flags.value |= CONF_FLAGS_SSL;
2239   };
2240  
2241 < connect_topicburst: TOPICBURST '=' TBOOL ';'
2241 > connect_encrypted: ENCRYPTED '=' TBOOL ';'
2242   {
2243 <  if (ypass == 2)
2243 >  if (conf_parser_ctx.pass == 2)
2244    {
2245      if (yylval.number)
2246 <      SetConfTopicBurst(yy_aconf);
2246 >      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
2247      else
2248 <      ClearConfTopicBurst(yy_aconf);
2248 >      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
2249    }
2250   };
2251  
2252 < connect_hub_mask: HUB_MASK '=' QSTRING ';'
2252 > connect_hub_mask: HUB_MASK '=' QSTRING ';'
2253   {
2254 <  if (ypass == 2)
2255 <  {
2848 <    struct CollectItem *yy_tmp;
2849 <
2850 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2851 <    DupString(yy_tmp->host, yylval.string);
2852 <    DupString(yy_tmp->user, "*");
2853 <    dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list);
2854 <  }
2254 >  if (conf_parser_ctx.pass == 2)
2255 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2256   };
2257  
2258 < connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2258 > connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2259   {
2260 <  if (ypass == 2)
2261 <  {
2861 <    struct CollectItem *yy_tmp;
2862 <
2863 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2864 <    DupString(yy_tmp->host, yylval.string);
2865 <    DupString(yy_tmp->user, "*");
2866 <    dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list);
2867 <  }
2260 >  if (conf_parser_ctx.pass == 2)
2261 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
2262   };
2263  
2264   connect_class: CLASS '=' QSTRING ';'
2265   {
2266 <  if (ypass == 2)
2267 <  {
2874 <    MyFree(class_name);
2875 <    DupString(class_name, yylval.string);
2876 <  }
2266 >  if (conf_parser_ctx.pass == 2)
2267 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
2268   };
2269  
2270 < connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2270 > connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2271   {
2272 < #ifdef HAVE_LIBCRYPTO
2273 <  if (ypass == 2)
2274 <  {
2884 <    struct EncCapability *ecap;
2885 <    const char *cipher_name;
2886 <    int found = 0;
2887 <
2888 <    yy_aconf->cipher_preference = NULL;
2889 <    cipher_name = yylval.string;
2890 <
2891 <    for (ecap = CipherTable; ecap->name; ecap++)
2892 <    {
2893 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
2894 <          (ecap->cap & CAP_ENC_MASK))
2895 <      {
2896 <        yy_aconf->cipher_preference = ecap;
2897 <        found = 1;
2898 <        break;
2899 <      }
2900 <    }
2901 <
2902 <    if (!found)
2903 <      yyerror("Invalid cipher");
2904 <  }
2272 > #ifdef HAVE_TLS
2273 >  if (conf_parser_ctx.pass == 2)
2274 >    strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2275   #else
2276 <  if (ypass == 2)
2277 <    yyerror("Ignoring cipher_preference -- no OpenSSL support");
2276 >  if (conf_parser_ctx.pass == 2)
2277 >    conf_error_report("Ignoring connect::ciphers -- no TLS support");
2278   #endif
2279   };
2280  
2281 +
2282   /***************************************************************************
2283 < *  section kill
2283 > * kill {} section
2284   ***************************************************************************/
2285   kill_entry: KILL
2286   {
2287 <  if (ypass == 2)
2288 <  {
2918 <    userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2919 <    regex_ban = 0;
2920 <  }
2287 >  if (conf_parser_ctx.pass == 2)
2288 >    reset_block_state();
2289   } '{' kill_items '}' ';'
2290   {
2291 <  if (ypass == 2)
2924 <  {
2925 <    if (userbuf[0] && hostbuf[0])
2926 <    {
2927 <      if (regex_ban)
2928 <      {
2929 <        pcre *exp_user = NULL;
2930 <        pcre *exp_host = NULL;
2931 <        const char *errptr = NULL;
2932 <
2933 <        if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2934 <            !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2935 <        {
2936 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2937 <               errptr);
2938 <          break;
2939 <        }
2940 <
2941 <        yy_conf = make_conf_item(RKLINE_TYPE);
2942 <        yy_aconf = map_to_conf(yy_conf);
2943 <
2944 <        yy_aconf->regexuser = exp_user;
2945 <        yy_aconf->regexhost = exp_host;
2946 <
2947 <        DupString(yy_aconf->user, userbuf);
2948 <        DupString(yy_aconf->host, hostbuf);
2949 <
2950 <        if (reasonbuf[0])
2951 <          DupString(yy_aconf->reason, reasonbuf);
2952 <        else
2953 <          DupString(yy_aconf->reason, "No reason");
2954 <      }
2955 <      else
2956 <      {
2957 <        yy_conf = make_conf_item(KLINE_TYPE);
2958 <        yy_aconf = map_to_conf(yy_conf);
2959 <
2960 <        DupString(yy_aconf->user, userbuf);
2961 <        DupString(yy_aconf->host, hostbuf);
2962 <
2963 <        if (reasonbuf[0])
2964 <          DupString(yy_aconf->reason, reasonbuf);
2965 <        else
2966 <          DupString(yy_aconf->reason, "No reason");
2967 <        add_conf_by_address(CONF_KILL, yy_aconf);
2968 <      }
2969 <    }
2970 <    else
2971 <      delete_conf_item(yy_conf);
2291 >  struct MaskItem *conf = NULL;
2292  
2293 <    yy_conf = NULL;
2294 <    yy_aconf = NULL;
2975 <  }
2976 < };
2293 >  if (conf_parser_ctx.pass != 2)
2294 >    break;
2295  
2296 < kill_type: TYPE
2297 < {
2298 < } '='  kill_type_items ';';
2296 >  if (!block_state.user.buf[0] ||
2297 >      !block_state.host.buf[0])
2298 >    break;
2299  
2300 < kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2301 < kill_type_item: REGEX_T
2302 < {
2303 <  if (ypass == 2)
2304 <    regex_ban = 1;
2300 >  conf = conf_make(CONF_KLINE);
2301 >  conf->user = xstrdup(block_state.user.buf);
2302 >  conf->host = xstrdup(block_state.host.buf);
2303 >
2304 >  if (block_state.rpass.buf[0])
2305 >    conf->reason = xstrdup(block_state.rpass.buf);
2306 >  else
2307 >    conf->reason = xstrdup(CONF_NOREASON);
2308 >  add_conf_by_address(CONF_KLINE, conf);
2309   };
2310  
2311   kill_items:     kill_items kill_item | kill_item;
2312 < kill_item:      kill_user | kill_reason | kill_type | error;
2312 > kill_item:      kill_user | kill_reason | error;
2313  
2314   kill_user: USER '=' QSTRING ';'
2315   {
2316 <  if (ypass == 2)
2316 >
2317 >  if (conf_parser_ctx.pass == 2)
2318    {
2319      struct split_nuh_item nuh;
2320  
2321      nuh.nuhmask  = yylval.string;
2322      nuh.nickptr  = NULL;
2323 <    nuh.userptr  = userbuf;
2324 <    nuh.hostptr  = hostbuf;
2323 >    nuh.userptr  = block_state.user.buf;
2324 >    nuh.hostptr  = block_state.host.buf;
2325  
2326      nuh.nicksize = 0;
2327 <    nuh.usersize = sizeof(userbuf);
2328 <    nuh.hostsize = sizeof(hostbuf);
2327 >    nuh.usersize = sizeof(block_state.user.buf);
2328 >    nuh.hostsize = sizeof(block_state.host.buf);
2329  
2330      split_nuh(&nuh);
2331    }
2332   };
2333  
2334 < kill_reason: REASON '=' QSTRING ';'
2334 > kill_reason: REASON '=' QSTRING ';'
2335   {
2336 <  if (ypass == 2)
2337 <    strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2336 >  if (conf_parser_ctx.pass == 2)
2337 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2338   };
2339  
2340 +
2341   /***************************************************************************
2342 < *  section deny
2342 > * deny {} section
2343   ***************************************************************************/
2344 < deny_entry: DENY
2344 > deny_entry: DENY
2345   {
2346 <  if (ypass == 2)
2347 <  {
3024 <    yy_conf = make_conf_item(DLINE_TYPE);
3025 <    yy_aconf = map_to_conf(yy_conf);
3026 <    /* default reason */
3027 <    DupString(yy_aconf->reason, "No reason");
3028 <  }
2346 >  if (conf_parser_ctx.pass == 2)
2347 >    reset_block_state();
2348   } '{' deny_items '}' ';'
2349   {
2350 <  if (ypass == 2)
2350 >  struct MaskItem *conf = NULL;
2351 >
2352 >  if (conf_parser_ctx.pass != 2)
2353 >    break;
2354 >
2355 >  if (!block_state.addr.buf[0])
2356 >    break;
2357 >
2358 >  if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2359    {
2360 <    if (yy_aconf->host && parse_netmask(yy_aconf->host, NULL, NULL) != HM_HOST)
2361 <      add_conf_by_address(CONF_DLINE, yy_aconf);
2360 >    conf = conf_make(CONF_DLINE);
2361 >    conf->host = xstrdup(block_state.addr.buf);
2362 >
2363 >    if (block_state.rpass.buf[0])
2364 >      conf->reason = xstrdup(block_state.rpass.buf);
2365      else
2366 <      delete_conf_item(yy_conf);
2367 <    yy_conf = NULL;
3038 <    yy_aconf = NULL;
2366 >      conf->reason = xstrdup(CONF_NOREASON);
2367 >    add_conf_by_address(CONF_DLINE, conf);
2368    }
2369 < };
2369 > };
2370  
2371   deny_items:     deny_items deny_item | deny_item;
2372   deny_item:      deny_ip | deny_reason | error;
2373  
2374   deny_ip: IP '=' QSTRING ';'
2375   {
2376 <  if (ypass == 2)
2377 <  {
3049 <    MyFree(yy_aconf->host);
3050 <    DupString(yy_aconf->host, yylval.string);
3051 <  }
2376 >  if (conf_parser_ctx.pass == 2)
2377 >    strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2378   };
2379  
2380 < deny_reason: REASON '=' QSTRING ';'
2380 > deny_reason: REASON '=' QSTRING ';'
2381   {
2382 <  if (ypass == 2)
2383 <  {
3058 <    MyFree(yy_aconf->reason);
3059 <    DupString(yy_aconf->reason, yylval.string);
3060 <  }
2382 >  if (conf_parser_ctx.pass == 2)
2383 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2384   };
2385  
2386 +
2387   /***************************************************************************
2388 < *  section exempt
2388 > * exempt {} section
2389   ***************************************************************************/
2390   exempt_entry: EXEMPT '{' exempt_items '}' ';';
2391  
2392 < exempt_items:     exempt_items exempt_item | exempt_item;
2393 < exempt_item:      exempt_ip | error;
2392 > exempt_items: exempt_items exempt_item | exempt_item;
2393 > exempt_item:  exempt_ip | error;
2394  
2395   exempt_ip: IP '=' QSTRING ';'
2396   {
2397 <  if (ypass == 2)
2397 >  if (conf_parser_ctx.pass == 2)
2398    {
2399 <    if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2399 >    if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2400      {
2401 <      yy_conf = make_conf_item(EXEMPTDLINE_TYPE);
2402 <      yy_aconf = map_to_conf(yy_conf);
3079 <      DupString(yy_aconf->host, yylval.string);
2401 >      struct MaskItem *conf = conf_make(CONF_EXEMPT);
2402 >      conf->host = xstrdup(yylval.string);
2403  
2404 <      add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
3082 <
3083 <      yy_conf = NULL;
3084 <      yy_aconf = NULL;
2404 >      add_conf_by_address(CONF_EXEMPT, conf);
2405      }
2406    }
2407   };
2408  
2409   /***************************************************************************
2410 < *  section gecos
2410 > * gecos {} section
2411   ***************************************************************************/
2412   gecos_entry: GECOS
2413   {
2414 <  if (ypass == 2)
2415 <  {
3096 <    regex_ban = 0;
3097 <    reasonbuf[0] = gecos_name[0] = '\0';
3098 <  }
2414 >  if (conf_parser_ctx.pass == 2)
2415 >    reset_block_state();
2416   } '{' gecos_items '}' ';'
2417   {
2418 <  if (ypass == 2)
3102 <  {
3103 <    if (gecos_name[0])
3104 <    {
3105 <      if (regex_ban)
3106 <      {
3107 <        pcre *exp_p = NULL;
3108 <        const char *errptr = NULL;
3109 <
3110 <        if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
3111 <        {
3112 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
3113 <               errptr);
3114 <          break;
3115 <        }
3116 <
3117 <        yy_conf = make_conf_item(RXLINE_TYPE);
3118 <        yy_conf->regexpname = exp_p;
3119 <      }
3120 <      else
3121 <        yy_conf = make_conf_item(XLINE_TYPE);
3122 <
3123 <      yy_match_item = map_to_conf(yy_conf);
3124 <      DupString(yy_conf->name, gecos_name);
3125 <
3126 <      if (reasonbuf[0])
3127 <        DupString(yy_match_item->reason, reasonbuf);
3128 <      else
3129 <        DupString(yy_match_item->reason, "No reason");
3130 <    }
3131 <  }
3132 < };
2418 >  struct MaskItem *conf = NULL;
2419  
2420 < gecos_flags: TYPE
2421 < {
3136 < } '='  gecos_flags_items ';';
2420 >  if (conf_parser_ctx.pass != 2)
2421 >    break;
2422  
2423 < gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2424 < gecos_flags_item: REGEX_T
2425 < {
2426 <  if (ypass == 2)
2427 <    regex_ban = 1;
2423 >  if (!block_state.name.buf[0])
2424 >    break;
2425 >
2426 >  conf = conf_make(CONF_XLINE);
2427 >  conf->name = xstrdup(block_state.name.buf);
2428 >
2429 >  if (block_state.rpass.buf[0])
2430 >    conf->reason = xstrdup(block_state.rpass.buf);
2431 >  else
2432 >    conf->reason = xstrdup(CONF_NOREASON);
2433   };
2434  
2435   gecos_items: gecos_items gecos_item | gecos_item;
2436 < gecos_item:  gecos_name | gecos_reason | gecos_flags | error;
2436 > gecos_item:  gecos_name | gecos_reason | error;
2437  
2438 < gecos_name: NAME '=' QSTRING ';'
2438 > gecos_name: NAME '=' QSTRING ';'
2439   {
2440 <  if (ypass == 2)
2441 <    strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
2440 >  if (conf_parser_ctx.pass == 2)
2441 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2442   };
2443  
2444 < gecos_reason: REASON '=' QSTRING ';'
2444 > gecos_reason: REASON '=' QSTRING ';'
2445   {
2446 <  if (ypass == 2)
2447 <    strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2446 >  if (conf_parser_ctx.pass == 2)
2447 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2448   };
2449  
2450 +
2451   /***************************************************************************
2452 < *  section general
2452 > * general {} section
2453   ***************************************************************************/
2454 < general_entry: GENERAL
3164 <  '{' general_items '}' ';';
2454 > general_entry: GENERAL '{' general_items '}' ';';
2455  
2456   general_items:      general_items general_item | general_item;
2457 < general_item:       general_hide_spoof_ips | general_ignore_bogus_ts |
2458 <                    general_failed_oper_notice | general_anti_nick_flood |
2459 <                    general_max_nick_time | general_max_nick_changes |
2460 <                    general_max_accept | general_anti_spam_exit_message_time |
2461 <                    general_ts_warn_delta | general_ts_max_delta |
2462 <                    general_kill_chase_time_limit | general_kline_with_reason |
2463 <                    general_kline_reason | general_invisible_on_connect |
2464 <                    general_warn_no_nline | general_dots_in_ident |
2465 <                    general_stats_o_oper_only | general_stats_k_oper_only |
2466 <                    general_pace_wait | general_stats_i_oper_only |
2467 <                    general_pace_wait_simple | general_stats_P_oper_only |
2468 <                    general_short_motd | general_no_oper_flood |
2469 <                    general_true_no_oper_flood | general_oper_pass_resv |
2470 <                    general_idletime | general_message_locale |
2471 <                    general_oper_only_umodes | general_max_targets |
2472 <                    general_use_egd | general_egdpool_path |
2473 <                    general_oper_umodes | general_caller_id_wait |
2474 <                    general_opers_bypass_callerid | general_default_floodcount |
2475 <                    general_min_nonwildcard | general_min_nonwildcard_simple |
2476 <                    general_servlink_path | general_disable_remote_commands |
2477 <                    general_default_cipher_preference |
2478 <                    general_compression_level | general_client_flood |
2479 <                    general_throttle_time | general_havent_read_conf |
2480 <                    general_dot_in_ip6_addr | general_ping_cookie |
2481 <                    general_disable_auth | general_burst_away |
2482 <                    general_tkline_expire_notices | general_gline_min_cidr |
2483 <                    general_gline_min_cidr6 | general_use_whois_actually |
2484 <                    general_reject_hold_time | general_stats_e_disabled |
2485 <                    error;
2457 > general_item:       general_away_count |
2458 >                    general_away_time |
2459 >                    general_ignore_bogus_ts |
2460 >                    general_failed_oper_notice |
2461 >                    general_anti_nick_flood |
2462 >                    general_max_nick_time |
2463 >                    general_max_nick_changes |
2464 >                    general_max_accept |
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_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2521   {
2522 <  ConfigFileEntry.burst_away = yylval.number;
2522 >  if (conf_parser_ctx.pass == 2)
2523 >    ConfigGeneral.cycle_on_host_change = yylval.number;
2524   };
2525  
2526 < general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2526 > general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2527   {
2528 <  ConfigFileEntry.use_whois_actually = yylval.number;
2528 >  ConfigGeneral.dline_min_cidr = $3;
2529   };
2530  
2531 < general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';'
2531 > general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2532   {
2533 <  GlobalSetOptions.rejecttime = yylval.number;
2533 >  ConfigGeneral.dline_min_cidr6 = $3;
2534   };
2535  
2536 < general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2536 > general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2537   {
2538 <  ConfigFileEntry.tkline_expire_notices = yylval.number;
2538 >  ConfigGeneral.kline_min_cidr = $3;
2539   };
2540  
2541 < general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' NUMBER ';'
2541 > general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2542   {
2543 <  ConfigFileEntry.kill_chase_time_limit = $3;
2543 >  ConfigGeneral.kline_min_cidr6 = $3;
2544   };
2545  
2546 < general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2546 > general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2547   {
2548 <  ConfigFileEntry.hide_spoof_ips = yylval.number;
2548 >  ConfigGeneral.tkline_expire_notices = yylval.number;
2549   };
2550  
2551 < general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2551 > general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2552   {
2553 <  ConfigFileEntry.ignore_bogus_ts = yylval.number;
2553 >  ConfigGeneral.kill_chase_time_limit = $3;
2554   };
2555  
2556 < general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2556 > general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2557   {
2558 <  ConfigFileEntry.disable_remote = yylval.number;
2558 >  ConfigGeneral.ignore_bogus_ts = yylval.number;
2559   };
2560  
2561   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2562   {
2563 <  ConfigFileEntry.failed_oper_notice = yylval.number;
2563 >  ConfigGeneral.failed_oper_notice = yylval.number;
2564   };
2565  
2566   general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2567   {
2568 <  ConfigFileEntry.anti_nick_flood = yylval.number;
2568 >  ConfigGeneral.anti_nick_flood = yylval.number;
2569   };
2570  
2571   general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2572   {
2573 <  ConfigFileEntry.max_nick_time = $3;
2573 >  ConfigGeneral.max_nick_time = $3;
2574   };
2575  
2576   general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2577   {
2578 <  ConfigFileEntry.max_nick_changes = $3;
2578 >  ConfigGeneral.max_nick_changes = $3;
2579   };
2580  
2581   general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2582   {
2583 <  ConfigFileEntry.max_accept = $3;
2583 >  ConfigGeneral.max_accept = $3;
2584   };
2585  
2586   general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2587   {
2588 <  ConfigFileEntry.anti_spam_exit_message_time = $3;
2588 >  ConfigGeneral.anti_spam_exit_message_time = $3;
2589   };
2590  
2591   general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2592   {
2593 <  ConfigFileEntry.ts_warn_delta = $3;
2593 >  ConfigGeneral.ts_warn_delta = $3;
2594   };
2595  
2596   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2597   {
2598 <  if (ypass == 2)
2599 <    ConfigFileEntry.ts_max_delta = $3;
2598 >  if (conf_parser_ctx.pass == 2)
2599 >    ConfigGeneral.ts_max_delta = $3;
2600   };
2601  
2602 < general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
3291 < {
3292 <  if (($3 > 0) && ypass == 1)
3293 <  {
3294 <    ilog(L_CRIT, "You haven't read your config file properly.");
3295 <    ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
3296 <    ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
3297 <    exit(0);
3298 <  }
3299 < };
3300 <
3301 < general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
2602 > general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2603   {
2604 <  ConfigFileEntry.kline_with_reason = yylval.number;
2604 >  ConfigGeneral.invisible_on_connect = yylval.number;
2605   };
2606  
2607 < general_kline_reason: KLINE_REASON '=' QSTRING ';'
2607 > general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2608   {
2609 <  if (ypass == 2)
3309 <  {
3310 <    MyFree(ConfigFileEntry.kline_reason);
3311 <    DupString(ConfigFileEntry.kline_reason, yylval.string);
3312 <  }
2609 >  ConfigGeneral.warn_no_connect_block = yylval.number;
2610   };
2611  
2612 < general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2612 > general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2613   {
2614 <  ConfigFileEntry.invisible_on_connect = yylval.number;
2614 >  ConfigGeneral.stats_e_disabled = yylval.number;
2615   };
2616  
2617 < general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';'
2617 > general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2618   {
2619 <  ConfigFileEntry.warn_no_nline = yylval.number;
2619 >  ConfigGeneral.stats_m_oper_only = yylval.number;
2620   };
2621  
2622 < general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2622 > general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2623   {
2624 <  ConfigFileEntry.stats_e_disabled = yylval.number;
2624 >  ConfigGeneral.stats_o_oper_only = yylval.number;
2625   };
2626  
2627 < general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2627 > general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2628   {
2629 <  ConfigFileEntry.stats_o_oper_only = yylval.number;
2629 >  ConfigGeneral.stats_P_oper_only = yylval.number;
2630   };
2631  
2632 < general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2632 > general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2633   {
2634 <  ConfigFileEntry.stats_P_oper_only = yylval.number;
2634 >  ConfigGeneral.stats_u_oper_only = yylval.number;
2635   };
2636  
2637   general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2638   {
2639 <  ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2639 >  ConfigGeneral.stats_k_oper_only = 2 * yylval.number;
2640   } | STATS_K_OPER_ONLY '=' TMASKED ';'
2641   {
2642 <  ConfigFileEntry.stats_k_oper_only = 1;
2642 >  ConfigGeneral.stats_k_oper_only = 1;
2643   };
2644  
2645   general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2646   {
2647 <  ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2647 >  ConfigGeneral.stats_i_oper_only = 2 * yylval.number;
2648   } | STATS_I_OPER_ONLY '=' TMASKED ';'
2649   {
2650 <  ConfigFileEntry.stats_i_oper_only = 1;
2650 >  ConfigGeneral.stats_i_oper_only = 1;
2651   };
2652  
2653   general_pace_wait: PACE_WAIT '=' timespec ';'
2654   {
2655 <  ConfigFileEntry.pace_wait = $3;
2655 >  ConfigGeneral.pace_wait = $3;
2656   };
2657  
2658   general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2659   {
2660 <  ConfigFileEntry.caller_id_wait = $3;
2660 >  ConfigGeneral.caller_id_wait = $3;
2661   };
2662  
2663   general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2664   {
2665 <  ConfigFileEntry.opers_bypass_callerid = yylval.number;
2665 >  ConfigGeneral.opers_bypass_callerid = yylval.number;
2666   };
2667  
2668   general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2669   {
2670 <  ConfigFileEntry.pace_wait_simple = $3;
2670 >  ConfigGeneral.pace_wait_simple = $3;
2671   };
2672  
2673   general_short_motd: SHORT_MOTD '=' TBOOL ';'
2674   {
2675 <  ConfigFileEntry.short_motd = yylval.number;
3379 < };
3380 <  
3381 < general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
3382 < {
3383 <  ConfigFileEntry.no_oper_flood = yylval.number;
3384 < };
3385 <
3386 < general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
3387 < {
3388 <  ConfigFileEntry.true_no_oper_flood = yylval.number;
3389 < };
3390 <
3391 < general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
3392 < {
3393 <  ConfigFileEntry.oper_pass_resv = yylval.number;
2675 >  ConfigGeneral.short_motd = yylval.number;
2676   };
2677  
2678 < general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
3397 < {
3398 <  if (ypass == 2)
3399 <  {
3400 <    if (strlen(yylval.string) > LOCALE_LENGTH-2)
3401 <      yylval.string[LOCALE_LENGTH-1] = '\0';
3402 <
3403 <    set_locale(yylval.string);
3404 <  }
3405 < };
3406 <
3407 < general_idletime: IDLETIME '=' timespec ';'
2678 > general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2679   {
2680 <  ConfigFileEntry.idletime = $3;
2680 >  ConfigGeneral.no_oper_flood = yylval.number;
2681   };
2682  
2683   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2684   {
2685 <  ConfigFileEntry.dots_in_ident = $3;
2685 >  ConfigGeneral.dots_in_ident = $3;
2686   };
2687  
2688   general_max_targets: MAX_TARGETS '=' NUMBER ';'
2689   {
2690 <  ConfigFileEntry.max_targets = $3;
3420 < };
3421 <
3422 < general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3423 < {
3424 <  if (ypass == 2)
3425 <  {
3426 <    MyFree(ConfigFileEntry.servlink_path);
3427 <    DupString(ConfigFileEntry.servlink_path, yylval.string);
3428 <  }
2690 >  ConfigGeneral.max_targets = $3;
2691   };
2692  
2693 < general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3432 < {
3433 < #ifdef HAVE_LIBCRYPTO
3434 <  if (ypass == 2)
3435 <  {
3436 <    struct EncCapability *ecap;
3437 <    const char *cipher_name;
3438 <    int found = 0;
3439 <
3440 <    ConfigFileEntry.default_cipher_preference = NULL;
3441 <    cipher_name = yylval.string;
3442 <
3443 <    for (ecap = CipherTable; ecap->name; ecap++)
3444 <    {
3445 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
3446 <          (ecap->cap & CAP_ENC_MASK))
3447 <      {
3448 <        ConfigFileEntry.default_cipher_preference = ecap;
3449 <        found = 1;
3450 <        break;
3451 <      }
3452 <    }
3453 <
3454 <    if (!found)
3455 <      yyerror("Invalid cipher");
3456 <  }
3457 < #else
3458 <  if (ypass == 2)
3459 <    yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3460 < #endif
3461 < };
3462 <
3463 < general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3464 < {
3465 <  if (ypass == 2)
3466 <  {
3467 <    ConfigFileEntry.compression_level = $3;
3468 < #ifndef HAVE_LIBZ
3469 <    yyerror("Ignoring compression_level -- no zlib support");
3470 < #else
3471 <    if ((ConfigFileEntry.compression_level < 1) ||
3472 <        (ConfigFileEntry.compression_level > 9))
3473 <    {
3474 <      yyerror("Ignoring invalid compression_level, using default");
3475 <      ConfigFileEntry.compression_level = 0;
3476 <    }
3477 < #endif
3478 <  }
3479 < };
3480 <
3481 < general_use_egd: USE_EGD '=' TBOOL ';'
2693 > general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2694   {
2695 <  ConfigFileEntry.use_egd = yylval.number;
2695 >  ConfigGeneral.ping_cookie = yylval.number;
2696   };
2697  
2698 < general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2698 > general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2699   {
2700 <  if (ypass == 2)
3489 <  {
3490 <    MyFree(ConfigFileEntry.egdpool_path);
3491 <    DupString(ConfigFileEntry.egdpool_path, yylval.string);
3492 <  }
2700 >  ConfigGeneral.disable_auth = yylval.number;
2701   };
2702  
2703 < general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2703 > general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2704   {
2705 <  ConfigFileEntry.ping_cookie = yylval.number;
3498 < };
3499 <
3500 < general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
3501 < {
3502 <  ConfigFileEntry.disable_auth = yylval.number;
2705 >  ConfigGeneral.throttle_count = $3;
2706   };
2707  
2708   general_throttle_time: THROTTLE_TIME '=' timespec ';'
2709   {
2710 <  ConfigFileEntry.throttle_time = yylval.number;
2710 >  ConfigGeneral.throttle_time = $3;
2711   };
2712  
2713   general_oper_umodes: OPER_UMODES
2714   {
2715 <  ConfigFileEntry.oper_umodes = 0;
2715 >  ConfigGeneral.oper_umodes = 0;
2716   } '='  umode_oitems ';' ;
2717  
2718   umode_oitems:    umode_oitems ',' umode_oitem | umode_oitem;
2719   umode_oitem:     T_BOTS
2720   {
2721 <  ConfigFileEntry.oper_umodes |= UMODE_BOTS;
2721 >  ConfigGeneral.oper_umodes |= UMODE_BOTS;
2722   } | T_CCONN
2723   {
2724 <  ConfigFileEntry.oper_umodes |= UMODE_CCONN;
3522 < } | T_CCONN_FULL
3523 < {
3524 <  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
2724 >  ConfigGeneral.oper_umodes |= UMODE_CCONN;
2725   } | T_DEAF
2726   {
2727 <  ConfigFileEntry.oper_umodes |= UMODE_DEAF;
2727 >  ConfigGeneral.oper_umodes |= UMODE_DEAF;
2728   } | T_DEBUG
2729   {
2730 <  ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
2730 >  ConfigGeneral.oper_umodes |= UMODE_DEBUG;
2731   } | T_FULL
2732   {
2733 <  ConfigFileEntry.oper_umodes |= UMODE_FULL;
2733 >  ConfigGeneral.oper_umodes |= UMODE_FULL;
2734 > } | HIDDEN
2735 > {
2736 >  ConfigGeneral.oper_umodes |= UMODE_HIDDEN;
2737 > } | HIDE_CHANS
2738 > {
2739 >  ConfigGeneral.oper_umodes |= UMODE_HIDECHANS;
2740 > } | HIDE_IDLE
2741 > {
2742 >  ConfigGeneral.oper_umodes |= UMODE_HIDEIDLE;
2743   } | T_SKILL
2744   {
2745 <  ConfigFileEntry.oper_umodes |= UMODE_SKILL;
2745 >  ConfigGeneral.oper_umodes |= UMODE_SKILL;
2746   } | T_NCHANGE
2747   {
2748 <  ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
2748 >  ConfigGeneral.oper_umodes |= UMODE_NCHANGE;
2749   } | T_REJ
2750   {
2751 <  ConfigFileEntry.oper_umodes |= UMODE_REJ;
2751 >  ConfigGeneral.oper_umodes |= UMODE_REJ;
2752   } | T_UNAUTH
2753   {
2754 <  ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
2754 >  ConfigGeneral.oper_umodes |= UMODE_UNAUTH;
2755   } | T_SPY
2756   {
2757 <  ConfigFileEntry.oper_umodes |= UMODE_SPY;
2757 >  ConfigGeneral.oper_umodes |= UMODE_SPY;
2758   } | T_EXTERNAL
2759   {
2760 <  ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
3552 < } | T_OPERWALL
3553 < {
3554 <  ConfigFileEntry.oper_umodes |= UMODE_OPERWALL;
2760 >  ConfigGeneral.oper_umodes |= UMODE_EXTERNAL;
2761   } | T_SERVNOTICE
2762   {
2763 <  ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
2763 >  ConfigGeneral.oper_umodes |= UMODE_SERVNOTICE;
2764   } | T_INVISIBLE
2765   {
2766 <  ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
2766 >  ConfigGeneral.oper_umodes |= UMODE_INVISIBLE;
2767   } | T_WALLOP
2768   {
2769 <  ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
2769 >  ConfigGeneral.oper_umodes |= UMODE_WALLOP;
2770   } | T_SOFTCALLERID
2771   {
2772 <  ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
2772 >  ConfigGeneral.oper_umodes |= UMODE_SOFTCALLERID;
2773   } | T_CALLERID
2774   {
2775 <  ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
2775 >  ConfigGeneral.oper_umodes |= UMODE_CALLERID;
2776   } | T_LOCOPS
2777   {
2778 <  ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2778 >  ConfigGeneral.oper_umodes |= UMODE_LOCOPS;
2779 > } | T_NONONREG
2780 > {
2781 >  ConfigGeneral.oper_umodes |= UMODE_REGONLY;
2782 > } | T_FARCONNECT
2783 > {
2784 >  ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2785   };
2786  
2787 < general_oper_only_umodes: OPER_ONLY_UMODES
2787 > general_oper_only_umodes: OPER_ONLY_UMODES
2788   {
2789 <  ConfigFileEntry.oper_only_umodes = 0;
2789 >  ConfigGeneral.oper_only_umodes = 0;
2790   } '='  umode_items ';' ;
2791  
2792 < umode_items:    umode_items ',' umode_item | umode_item;
2793 < umode_item:     T_BOTS
2792 > umode_items:  umode_items ',' umode_item | umode_item;
2793 > umode_item:   T_BOTS
2794   {
2795 <  ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2795 >  ConfigGeneral.oper_only_umodes |= UMODE_BOTS;
2796   } | T_CCONN
2797   {
2798 <  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
3587 < } | T_CCONN_FULL
3588 < {
3589 <  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
2798 >  ConfigGeneral.oper_only_umodes |= UMODE_CCONN;
2799   } | T_DEAF
2800   {
2801 <  ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
2801 >  ConfigGeneral.oper_only_umodes |= UMODE_DEAF;
2802   } | T_DEBUG
2803   {
2804 <  ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2804 >  ConfigGeneral.oper_only_umodes |= UMODE_DEBUG;
2805   } | T_FULL
2806 < {
2807 <  ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2806 > {
2807 >  ConfigGeneral.oper_only_umodes |= UMODE_FULL;
2808   } | T_SKILL
2809   {
2810 <  ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2810 >  ConfigGeneral.oper_only_umodes |= UMODE_SKILL;
2811 > } | HIDDEN
2812 > {
2813 >  ConfigGeneral.oper_only_umodes |= UMODE_HIDDEN;
2814   } | T_NCHANGE
2815   {
2816 <  ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
2816 >  ConfigGeneral.oper_only_umodes |= UMODE_NCHANGE;
2817   } | T_REJ
2818   {
2819 <  ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
2819 >  ConfigGeneral.oper_only_umodes |= UMODE_REJ;
2820   } | T_UNAUTH
2821   {
2822 <  ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
2822 >  ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH;
2823   } | T_SPY
2824   {
2825 <  ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
2825 >  ConfigGeneral.oper_only_umodes |= UMODE_SPY;
2826   } | T_EXTERNAL
2827   {
2828 <  ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
3617 < } | T_OPERWALL
3618 < {
3619 <  ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL;
2828 >  ConfigGeneral.oper_only_umodes |= UMODE_EXTERNAL;
2829   } | T_SERVNOTICE
2830   {
2831 <  ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
2831 >  ConfigGeneral.oper_only_umodes |= UMODE_SERVNOTICE;
2832   } | T_INVISIBLE
2833   {
2834 <  ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
2834 >  ConfigGeneral.oper_only_umodes |= UMODE_INVISIBLE;
2835   } | T_WALLOP
2836   {
2837 <  ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
2837 >  ConfigGeneral.oper_only_umodes |= UMODE_WALLOP;
2838   } | T_SOFTCALLERID
2839   {
2840 <  ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
2840 >  ConfigGeneral.oper_only_umodes |= UMODE_SOFTCALLERID;
2841   } | T_CALLERID
2842   {
2843 <  ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
2843 >  ConfigGeneral.oper_only_umodes |= UMODE_CALLERID;
2844   } | T_LOCOPS
2845   {
2846 <  ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
2846 >  ConfigGeneral.oper_only_umodes |= UMODE_LOCOPS;
2847 > } | T_NONONREG
2848 > {
2849 >  ConfigGeneral.oper_only_umodes |= UMODE_REGONLY;
2850 > } | T_FARCONNECT
2851 > {
2852 >  ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2853   };
2854  
2855   general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2856   {
2857 <  ConfigFileEntry.min_nonwildcard = $3;
2857 >  ConfigGeneral.min_nonwildcard = $3;
2858   };
2859  
2860   general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2861   {
2862 <  ConfigFileEntry.min_nonwildcard_simple = $3;
2862 >  ConfigGeneral.min_nonwildcard_simple = $3;
2863   };
2864  
2865   general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2866   {
2867 <  ConfigFileEntry.default_floodcount = $3;
3653 < };
3654 <
3655 < general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
3656 < {
3657 <  ConfigFileEntry.client_flood = $3;
3658 < };
3659 <
3660 < general_dot_in_ip6_addr: DOT_IN_IP6_ADDR '=' TBOOL ';'
3661 < {
3662 <  ConfigFileEntry.dot_in_ip6_addr = yylval.number;
3663 < };
3664 <
3665 < /***************************************************************************
3666 < *  section glines
3667 < ***************************************************************************/
3668 < gline_entry: GLINES
3669 < {
3670 <  if (ypass == 2)
3671 <  {
3672 <    yy_conf = make_conf_item(GDENY_TYPE);
3673 <    yy_aconf = map_to_conf(yy_conf);
3674 <  }
3675 < } '{' gline_items '}' ';'
3676 < {
3677 <  if (ypass == 2)
3678 <  {
3679 <    /*
3680 <     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3681 <     * end we will have one extra, so we should free it.
3682 <     */
3683 <    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3684 <    {
3685 <      delete_conf_item(yy_conf);
3686 <      yy_conf = NULL;
3687 <      yy_aconf = NULL;
3688 <    }
3689 <  }
3690 < };
3691 <
3692 < gline_items:        gline_items gline_item | gline_item;
3693 < gline_item:         gline_enable |
3694 <                    gline_duration |
3695 <                    gline_logging |
3696 <                    gline_user |
3697 <                    gline_server |
3698 <                    gline_action |
3699 <                    error;
3700 <
3701 < gline_enable: ENABLE '=' TBOOL ';'
3702 < {
3703 <  if (ypass == 2)
3704 <    ConfigFileEntry.glines = yylval.number;
3705 < };
3706 <
3707 < gline_duration: DURATION '=' timespec ';'
3708 < {
3709 <  if (ypass == 2)
3710 <    ConfigFileEntry.gline_time = $3;
3711 < };
3712 <
3713 < gline_logging: LOGGING
3714 < {
3715 <  if (ypass == 2)
3716 <    ConfigFileEntry.gline_logging = 0;
3717 < } '=' gline_logging_types ';';
3718 < gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3719 < gline_logging_type_item: T_REJECT
3720 < {
3721 <  if (ypass == 2)
3722 <    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3723 < } | T_BLOCK
3724 < {
3725 <  if (ypass == 2)
3726 <    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3727 < };
3728 <
3729 < gline_user: USER '=' QSTRING ';'
3730 < {
3731 <  if (ypass == 2)
3732 <  {
3733 <    struct split_nuh_item nuh;
3734 <
3735 <    nuh.nuhmask  = yylval.string;
3736 <    nuh.nickptr  = NULL;
3737 <    nuh.userptr  = userbuf;
3738 <    nuh.hostptr  = hostbuf;
3739 <
3740 <    nuh.nicksize = 0;
3741 <    nuh.usersize = sizeof(userbuf);
3742 <    nuh.hostsize = sizeof(hostbuf);
3743 <
3744 <    split_nuh(&nuh);
3745 <
3746 <    if (yy_aconf->user == NULL)
3747 <    {
3748 <      DupString(yy_aconf->user, userbuf);
3749 <      DupString(yy_aconf->host, hostbuf);
3750 <    }
3751 <    else
3752 <    {
3753 <      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3754 <
3755 <      DupString(yy_tmp->user, userbuf);
3756 <      DupString(yy_tmp->host, hostbuf);
3757 <
3758 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3759 <    }
3760 <  }
3761 < };
3762 <
3763 < gline_server: NAME '=' QSTRING ';'
3764 < {
3765 <  if (ypass == 2)  
3766 <  {
3767 <    MyFree(yy_conf->name);
3768 <    DupString(yy_conf->name, yylval.string);
3769 <  }
2867 >  ConfigGeneral.default_floodcount = $3;
2868   };
2869  
3772 gline_action: ACTION
3773 {
3774  if (ypass == 2)
3775    yy_aconf->flags = 0;
3776 } '=' gdeny_types ';'
3777 {
3778  if (ypass == 2)
3779  {
3780    struct CollectItem *yy_tmp = NULL;
3781    dlink_node *ptr, *next_ptr;
3782
3783    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3784    {
3785      struct AccessItem *new_aconf;
3786      struct ConfItem *new_conf;
3787
3788      yy_tmp = ptr->data;
3789      new_conf = make_conf_item(GDENY_TYPE);
3790      new_aconf = map_to_conf(new_conf);
3791
3792      new_aconf->flags = yy_aconf->flags;
3793
3794      if (yy_conf->name != NULL)
3795        DupString(new_conf->name, yy_conf->name);
3796      else
3797        DupString(new_conf->name, "*");
3798      if (yy_aconf->user != NULL)
3799         DupString(new_aconf->user, yy_tmp->user);
3800      else  
3801        DupString(new_aconf->user, "*");
3802      if (yy_aconf->host != NULL)
3803        DupString(new_aconf->host, yy_tmp->host);
3804      else
3805        DupString(new_aconf->host, "*");
3806
3807      dlinkDelete(&yy_tmp->node, &col_conf_list);
3808    }
3809
3810    /*
3811     * In case someone has fed us with more than one action= after user/name
3812     * which would leak memory  -Michael
3813     */
3814    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3815      delete_conf_item(yy_conf);
3816
3817    yy_conf = make_conf_item(GDENY_TYPE);
3818    yy_aconf = map_to_conf(yy_conf);
3819  }
3820 };
3821
3822 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3823 gdeny_type_item: T_REJECT
3824 {
3825  if (ypass == 2)
3826    yy_aconf->flags |= GDENY_REJECT;
3827 } | T_BLOCK
3828 {
3829  if (ypass == 2)
3830    yy_aconf->flags |= GDENY_BLOCK;
3831 };
2870  
2871   /***************************************************************************
2872 < *  section channel
2872 > * channel {} section
2873   ***************************************************************************/
2874 < channel_entry: CHANNEL
3837 <  '{' channel_items '}' ';';
2874 > channel_entry: CHANNEL '{' channel_items '}' ';';
2875  
2876   channel_items:      channel_items channel_item | channel_item;
2877 < channel_item:       channel_disable_local_channels | channel_use_except |
2878 <                    channel_use_invex | channel_use_knock |
2879 <                    channel_max_bans | channel_knock_delay |
2880 <                    channel_knock_delay_channel | channel_max_chans_per_user |
2881 <                    channel_quiet_on_ban | channel_default_split_user_count |
2882 <                    channel_default_split_server_count |
2883 <                    channel_no_create_on_split | channel_restrict_channels |
2884 <                    channel_no_join_on_split | channel_burst_topicwho |
2885 <                    channel_jflood_count | channel_jflood_time |
2886 <                    channel_disable_fake_channels | error;
2877 > channel_item:       channel_max_bans |
2878 >                    channel_invite_client_count |
2879 >                    channel_invite_client_time |
2880 >                    channel_invite_delay_channel |
2881 >                    channel_knock_client_count |
2882 >                    channel_knock_client_time |
2883 >                    channel_knock_delay_channel |
2884 >                    channel_max_channels |
2885 >                    channel_default_join_flood_count |
2886 >                    channel_default_join_flood_time |
2887 >                    channel_disable_fake_channels |
2888 >                    error;
2889  
2890   channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2891   {
2892    ConfigChannel.disable_fake_channels = yylval.number;
2893   };
2894  
2895 < channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3857 < {
3858 <  ConfigChannel.restrict_channels = yylval.number;
3859 < };
3860 <
3861 < channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
2895 > channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2896   {
2897 <  ConfigChannel.disable_local_channels = yylval.number;
2897 >  ConfigChannel.invite_client_count = $3;
2898   };
2899  
2900 < channel_use_except: USE_EXCEPT '=' TBOOL ';'
2900 > channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2901   {
2902 <  ConfigChannel.use_except = yylval.number;
2902 >  ConfigChannel.invite_client_time = $3;
2903   };
2904  
2905 < channel_use_invex: USE_INVEX '=' TBOOL ';'
2905 > channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2906   {
2907 <  ConfigChannel.use_invex = yylval.number;
2907 >  ConfigChannel.invite_delay_channel = $3;
2908   };
2909  
2910 < channel_use_knock: USE_KNOCK '=' TBOOL ';'
2910 > channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2911   {
2912 <  ConfigChannel.use_knock = yylval.number;
2912 >  ConfigChannel.knock_client_count = $3;
2913   };
2914  
2915 < channel_knock_delay: KNOCK_DELAY '=' timespec ';'
2915 > channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2916   {
2917 <  ConfigChannel.knock_delay = $3;
2917 >  ConfigChannel.knock_client_time = $3;
2918   };
2919  
2920   channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
# Line 3888 | Line 2922 | channel_knock_delay_channel: KNOCK_DELAY
2922    ConfigChannel.knock_delay_channel = $3;
2923   };
2924  
2925 < channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3892 < {
3893 <  ConfigChannel.max_chans_per_user = $3;
3894 < };
3895 <
3896 < channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
2925 > channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
2926   {
2927 <  ConfigChannel.quiet_on_ban = yylval.number;
2927 >  ConfigChannel.max_channels = $3;
2928   };
2929  
2930   channel_max_bans: MAX_BANS '=' NUMBER ';'
# Line 3903 | Line 2932 | channel_max_bans: MAX_BANS '=' NUMBER ';
2932    ConfigChannel.max_bans = $3;
2933   };
2934  
2935 < channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2935 > channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2936   {
2937 <  ConfigChannel.default_split_user_count = $3;
2937 >  ConfigChannel.default_join_flood_count = yylval.number;
2938   };
2939  
2940 < channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2940 > channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2941   {
2942 <  ConfigChannel.default_split_server_count = $3;
2942 >  ConfigChannel.default_join_flood_time = $3;
2943   };
2944  
3916 channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
3917 {
3918  ConfigChannel.no_create_on_split = yylval.number;
3919 };
2945  
2946 < channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2947 < {
2948 <  ConfigChannel.no_join_on_split = yylval.number;
2949 < };
2946 > /***************************************************************************
2947 > * serverhide {} section
2948 > ***************************************************************************/
2949 > serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2950 >
2951 > serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2952 > serverhide_item:    serverhide_flatten_links |
2953 >                    serverhide_flatten_links_delay |
2954 >                    serverhide_flatten_links_file |
2955 >                    serverhide_disable_remote_commands |
2956 >                    serverhide_hide_servers |
2957 >                    serverhide_hide_services |
2958 >                    serverhide_hidden |
2959 >                    serverhide_hidden_name |
2960 >                    serverhide_hide_server_ips |
2961 >                    error;
2962  
2963 < channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
2963 > serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
2964   {
2965 <  ConfigChannel.burst_topicwho = yylval.number;
2965 >  if (conf_parser_ctx.pass == 2)
2966 >    ConfigServerHide.flatten_links = yylval.number;
2967   };
2968  
2969 < channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2969 > serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2970   {
2971 <  GlobalSetOptions.joinfloodcount = yylval.number;
2971 >  if (conf_parser_ctx.pass == 2)
2972 >  {
2973 >    if ($3 > 0)
2974 >    {
2975 >      event_write_links_file.when = $3;
2976 >      event_add(&event_write_links_file, NULL);
2977 >    }
2978 >    else
2979 >     event_delete(&event_write_links_file);
2980 >
2981 >    ConfigServerHide.flatten_links_delay = $3;
2982 >  }
2983   };
2984  
2985 < channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
2985 > serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
2986   {
2987 <  GlobalSetOptions.joinfloodtime = yylval.number;
2987 >  if (conf_parser_ctx.pass == 2)
2988 >  {
2989 >    xfree(ConfigServerHide.flatten_links_file);
2990 >    ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
2991 >  }
2992   };
2993  
2994 < /***************************************************************************
3942 < *  section serverhide
3943 < ***************************************************************************/
3944 < serverhide_entry: SERVERHIDE
3945 <  '{' serverhide_items '}' ';';
3946 <
3947 < serverhide_items:   serverhide_items serverhide_item | serverhide_item;
3948 < serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
3949 <                    serverhide_links_delay |
3950 <                    serverhide_disable_hidden |
3951 <                    serverhide_hidden | serverhide_hidden_name |
3952 <                    serverhide_hide_server_ips |
3953 <                    error;
3954 <
3955 < serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
2994 > serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2995   {
2996 <  if (ypass == 2)
2997 <    ConfigServerHide.flatten_links = yylval.number;
2996 >  if (conf_parser_ctx.pass == 2)
2997 >    ConfigServerHide.disable_remote_commands = yylval.number;
2998   };
2999  
3000   serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3001   {
3002 <  if (ypass == 2)
3002 >  if (conf_parser_ctx.pass == 2)
3003      ConfigServerHide.hide_servers = yylval.number;
3004   };
3005  
3006 < serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3006 > serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
3007   {
3008 <  if (ypass == 2)
3009 <  {
3971 <    MyFree(ConfigServerHide.hidden_name);
3972 <    DupString(ConfigServerHide.hidden_name, yylval.string);
3973 <  }
3008 >  if (conf_parser_ctx.pass == 2)
3009 >    ConfigServerHide.hide_services = yylval.number;
3010   };
3011  
3012 < serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3012 > serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3013   {
3014 <  if (ypass == 2)
3014 >  if (conf_parser_ctx.pass == 2)
3015    {
3016 <    if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3017 <    {
3982 <      eventAddIsh("write_links_file", write_links_file, NULL, $3);
3983 <      ConfigServerHide.links_disabled = 0;
3984 <    }
3985 <
3986 <    ConfigServerHide.links_delay = $3;
3016 >    xfree(ConfigServerHide.hidden_name);
3017 >    ConfigServerHide.hidden_name = xstrdup(yylval.string);
3018    }
3019   };
3020  
3021   serverhide_hidden: HIDDEN '=' TBOOL ';'
3022   {
3023 <  if (ypass == 2)
3023 >  if (conf_parser_ctx.pass == 2)
3024      ConfigServerHide.hidden = yylval.number;
3025   };
3026  
3996 serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3997 {
3998  if (ypass == 2)
3999    ConfigServerHide.disable_hidden = yylval.number;
4000 };
4001
3027   serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3028   {
3029 <  if (ypass == 2)
3029 >  if (conf_parser_ctx.pass == 2)
3030      ConfigServerHide.hide_server_ips = yylval.number;
3031   };

Diff Legend

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