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

Diff Legend

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