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/trunk/src/conf_parser.y (file contents):
Revision 1834 by michael, Fri Apr 19 19:50:27 2013 UTC vs.
Revision 7282 by michael, Sun Feb 7 18:04:26 2016 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  conf_parser.y: Parses the ircd configuration file.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2005 by the past and present ircd coders, and others.
4 > *  Copyright (c) 2000-2016 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 16 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
21 *
22 *  $Id$
20   */
21  
22 < %{
22 > /*! \file conf_parser.y
23 > * \brief Parses the ircd configuration file.
24 > * \version $Id$
25 > */
26  
27 < #define YY_NO_UNPUT
28 < #include <sys/types.h>
29 < #include <string.h>
27 >
28 > %{
29  
30   #include "config.h"
31   #include "stdinc.h"
# Line 34 | Line 33
33   #include "list.h"
34   #include "conf.h"
35   #include "conf_class.h"
36 + #include "conf_cluster.h"
37 + #include "conf_pseudo.h"
38 + #include "conf_resv.h"
39 + #include "conf_service.h"
40 + #include "conf_shared.h"
41   #include "event.h"
42 + #include "id.h"
43   #include "log.h"
39 #include "client.h"     /* for UMODE_ALL only */
44   #include "irc_string.h"
45   #include "memory.h"
46   #include "modules.h"
47 < #include "s_serv.h"
47 > #include "server.h"
48   #include "hostmask.h"
45 #include "send.h"
49   #include "listener.h"
50 < #include "resv.h"
51 < #include "numeric.h"
49 < #include "s_user.h"
50 <
51 < #ifdef HAVE_LIBCRYPTO
52 < #include <openssl/rsa.h>
53 < #include <openssl/bio.h>
54 < #include <openssl/pem.h>
55 < #include <openssl/dh.h>
56 < #endif
57 <
58 < #include "rsa.h"
50 > #include "user.h"
51 > #include "motd.h"
52  
53   int yylex(void);
54  
55   static struct
56   {
57 <  struct {
57 >  struct
58 >  {
59      dlink_list list;
60    } mask,
61      leaf,
62      hub;
63  
64 <  struct {
64 >  struct
65 >  {
66      char buf[IRCD_BUFSIZE];
67    } name,
68 +    nick,
69      user,
70      host,
71      addr,
72      bind,
73      file,
74      ciph,
75 +    cert,
76      rpass,
77      spass,
78 <    class;
78 >    whois,
79 >    class,
80 >    target,
81 >    prepend,
82 >    command;
83  
84 <  struct {
84 >  struct
85 >  {
86      unsigned int value;
87    } flags,
88      modes,
# Line 99 | Line 101 | static struct
101      max_ident,
102      max_sendq,
103      max_recvq,
104 +    max_channels,
105      cidr_bitlen_ipv4,
106      cidr_bitlen_ipv6,
107      number_per_cidr;
# Line 107 | Line 110 | static struct
110   static void
111   reset_block_state(void)
112   {
113 <  dlink_node *ptr = NULL, *ptr_next = NULL;
113 >  dlink_node *node = NULL, *node_next = NULL;
114  
115 <  DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.mask.list.head)
115 >  DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head)
116    {
117 <    MyFree(ptr->data);
118 <    dlinkDelete(ptr, &block_state.mask.list);
119 <    free_dlink_node(ptr);
117 >    xfree(node->data);
118 >    dlinkDelete(node, &block_state.mask.list);
119 >    free_dlink_node(node);
120    }
121  
122 <  DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.leaf.list.head)
122 >  DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head)
123    {
124 <    MyFree(ptr->data);
125 <    dlinkDelete(ptr, &block_state.leaf.list);
126 <    free_dlink_node(ptr);
124 >    xfree(node->data);
125 >    dlinkDelete(node, &block_state.leaf.list);
126 >    free_dlink_node(node);
127    }
128  
129 <  DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.hub.list.head)
129 >  DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head)
130    {
131 <    MyFree(ptr->data);
132 <    dlinkDelete(ptr, &block_state.hub.list);
133 <    free_dlink_node(ptr);
131 >    xfree(node->data);
132 >    dlinkDelete(node, &block_state.hub.list);
133 >    free_dlink_node(node);
134    }
135  
136    memset(&block_state, 0, sizeof(block_state));
# Line 146 | Line 149 | reset_block_state(void)
149   %token  ANTI_NICK_FLOOD
150   %token  ANTI_SPAM_EXIT_MESSAGE_TIME
151   %token  AUTOCONN
152 + %token  AWAY_COUNT
153 + %token  AWAY_TIME
154   %token  BYTES KBYTES MBYTES
155   %token  CALLER_ID_WAIT
156   %token  CAN_FLOOD
157   %token  CHANNEL
158 < %token  CIDR_BITLEN_IPV4
159 < %token  CIDR_BITLEN_IPV6
158 > %token  CHECK_CACHE
159 > %token  CIDR_BITLEN_IPV4
160 > %token  CIDR_BITLEN_IPV6
161   %token  CLASS
162 + %token  CLOSE
163   %token  CONNECT
164   %token  CONNECTFREQ
165 + %token  CYCLE_ON_HOST_CHANGE
166   %token  DEFAULT_FLOODCOUNT
167 < %token  DEFAULT_SPLIT_SERVER_COUNT
168 < %token  DEFAULT_SPLIT_USER_COUNT
167 > %token  DEFAULT_JOIN_FLOOD_COUNT
168 > %token  DEFAULT_JOIN_FLOOD_TIME
169 > %token  DEFAULT_MAX_CLIENTS
170   %token  DENY
171   %token  DESCRIPTION
172   %token  DIE
173   %token  DISABLE_AUTH
174   %token  DISABLE_FAKE_CHANNELS
175   %token  DISABLE_REMOTE_COMMANDS
176 + %token  DLINE_MIN_CIDR
177 + %token  DLINE_MIN_CIDR6
178   %token  DOTS_IN_IDENT
168 %token  EGDPOOL_PATH
179   %token  EMAIL
180   %token  ENCRYPTED
181   %token  EXCEED_LIMIT
182   %token  EXEMPT
183   %token  FAILED_OPER_NOTICE
174 %token  IRCD_FLAGS
184   %token  FLATTEN_LINKS
185 + %token  FLATTEN_LINKS_DELAY
186 + %token  FLATTEN_LINKS_FILE
187   %token  GECOS
188   %token  GENERAL
178 %token  GLINE
179 %token  GLINE_DURATION
180 %token  GLINE_ENABLE
181 %token  GLINE_EXEMPT
182 %token  GLINE_REQUEST_DURATION
183 %token  GLINE_MIN_CIDR
184 %token  GLINE_MIN_CIDR6
185 %token  GLOBAL_KILL
186 %token  IRCD_AUTH
187 %token  NEED_IDENT
188 %token  HAVENT_READ_CONF
189   %token  HIDDEN
190 < %token  HIDDEN_NAME
190 > %token  HIDDEN_NAME
191 > %token  HIDE_CHANS
192 > %token  HIDE_IDLE
193 > %token  HIDE_IDLE_FROM_OPERS
194   %token  HIDE_SERVER_IPS
195   %token  HIDE_SERVERS
196 < %token  HIDE_SPOOF_IPS
196 > %token  HIDE_SERVICES
197   %token  HOST
198   %token  HUB
199   %token  HUB_MASK
200   %token  IGNORE_BOGUS_TS
201   %token  INVISIBLE_ON_CONNECT
202 + %token  INVITE_CLIENT_COUNT
203 + %token  INVITE_CLIENT_TIME
204 + %token  INVITE_DELAY_CHANNEL
205   %token  IP
206 + %token  IRCD_AUTH
207 + %token  IRCD_FLAGS
208 + %token  IRCD_SID
209 + %token  JOIN
210   %token  KILL
211 < %token  KILL_CHASE_TIME_LIMIT
211 > %token  KILL_CHASE_TIME_LIMIT
212   %token  KLINE
213   %token  KLINE_EXEMPT
214 < %token  KNOCK_DELAY
214 > %token  KLINE_MIN_CIDR
215 > %token  KLINE_MIN_CIDR6
216 > %token  KNOCK_CLIENT_COUNT
217 > %token  KNOCK_CLIENT_TIME
218   %token  KNOCK_DELAY_CHANNEL
219   %token  LEAF_MASK
220 < %token  LINKS_DELAY
220 > %token  LIBGEOIP_DATABASE_OPTIONS
221 > %token  LIBGEOIP_IPV4_DATABASE_FILE
222 > %token  LIBGEOIP_IPV6_DATABASE_FILE
223   %token  LISTEN
224 < %token  T_LOG
224 > %token  MASK
225   %token  MAX_ACCEPT
226   %token  MAX_BANS
227 < %token  MAX_CHANS_PER_OPER
213 < %token  MAX_CHANS_PER_USER
227 > %token  MAX_CHANNELS
228   %token  MAX_GLOBAL
229   %token  MAX_IDENT
230 + %token  MAX_IDLE
231   %token  MAX_LOCAL
232   %token  MAX_NICK_CHANGES
233   %token  MAX_NICK_LENGTH
# Line 221 | Line 236 | reset_block_state(void)
236   %token  MAX_TARGETS
237   %token  MAX_TOPIC_LENGTH
238   %token  MAX_WATCH
239 < %token  MESSAGE_LOCALE
239 > %token  MEMORY_CACHE
240 > %token  MIN_IDLE
241   %token  MIN_NONWILDCARD
242   %token  MIN_NONWILDCARD_SIMPLE
243 < %token  MIN_IDLE
228 < %token  MAX_IDLE
229 < %token  RANDOM_IDLE
230 < %token  HIDE_IDLE_FROM_OPERS
243 > %token  MMAP_CACHE
244   %token  MODULE
245   %token  MODULES
246 + %token  MOTD
247   %token  NAME
248 + %token  NEED_IDENT
249   %token  NEED_PASSWORD
250   %token  NETWORK_DESC
251   %token  NETWORK_NAME
252   %token  NICK
238 %token  NICK_CHANGES
239 %token  NO_CREATE_ON_SPLIT
240 %token  NO_JOIN_ON_SPLIT
253   %token  NO_OPER_FLOOD
254   %token  NO_TILDE
255   %token  NUMBER
256   %token  NUMBER_PER_CIDR
257   %token  NUMBER_PER_IP
246 %token  OPERATOR
247 %token  OPERS_BYPASS_CALLERID
258   %token  OPER_ONLY_UMODES
249 %token  OPER_PASS_RESV
250 %token  OPER_SPY_T
259   %token  OPER_UMODES
260 < %token  JOIN_FLOOD_COUNT
261 < %token  JOIN_FLOOD_TIME
260 > %token  OPERATOR
261 > %token  OPERS_BYPASS_CALLERID
262   %token  PACE_WAIT
263   %token  PACE_WAIT_SIMPLE
264   %token  PASSWORD
# Line 259 | Line 267 | reset_block_state(void)
267   %token  PING_TIME
268   %token  PORT
269   %token  QSTRING
270 < %token  QUIET_ON_BAN
270 > %token  RANDOM_IDLE
271   %token  REASON
272   %token  REDIRPORT
273   %token  REDIRSERV
266 %token  REGEX_T
274   %token  REHASH
275   %token  REMOTE
276   %token  REMOTEBAN
270 %token  RESTRICT_CHANNELS
271 %token  RSA_PRIVATE_KEY_FILE
272 %token  RSA_PUBLIC_KEY_FILE
273 %token  SSL_CERTIFICATE_FILE
274 %token  SSL_DH_PARAM_FILE
275 %token  T_SSL_CLIENT_METHOD
276 %token  T_SSL_SERVER_METHOD
277 %token  T_SSLV3
278 %token  T_TLSV1
277   %token  RESV
278   %token  RESV_EXEMPT
279 + %token  RSA_PRIVATE_KEY_FILE
280   %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
282 %token  SENDQ
281   %token  SEND_PASSWORD
282 + %token  SENDQ
283   %token  SERVERHIDE
284   %token  SERVERINFO
286 %token  IRCD_SID
287 %token  TKLINE_EXPIRE_NOTICES
288 %token  T_SHARED
289 %token  T_CLUSTER
290 %token  TYPE
285   %token  SHORT_MOTD
286   %token  SPOOF
287   %token  SPOOF_NOTICE
288 + %token  SQUIT
289 + %token  SSL_CERTIFICATE_FILE
290 + %token  SSL_CERTIFICATE_FINGERPRINT
291 + %token  SSL_CONNECTION_REQUIRED
292 + %token  SSL_DH_ELLIPTIC_CURVE
293 + %token  SSL_DH_PARAM_FILE
294 + %token  SSL_MESSAGE_DIGEST_ALGORITHM
295 + %token  STANDARD
296   %token  STATS_E_DISABLED
297   %token  STATS_I_OPER_ONLY
298   %token  STATS_K_OPER_ONLY
299 + %token  STATS_M_OPER_ONLY
300   %token  STATS_O_OPER_ONLY
301   %token  STATS_P_OPER_ONLY
302 < %token  TBOOL
300 < %token  TMASKED
301 < %token  TS_MAX_DELTA
302 < %token  TS_WARN_DELTA
303 < %token  TWODOTS
302 > %token  STATS_U_OPER_ONLY
303   %token  T_ALL
304   %token  T_BOTS
306 %token  T_SOFTCALLERID
305   %token  T_CALLERID
306   %token  T_CCONN
307 < %token  T_CCONN_FULL
308 < %token  T_SSL_CIPHER_LIST
307 > %token  T_COMMAND
308 > %token  T_CLUSTER
309   %token  T_DEAF
310   %token  T_DEBUG
311   %token  T_DLINE
312   %token  T_EXTERNAL
313 + %token  T_FARCONNECT
314 + %token  T_FILE
315   %token  T_FULL
316 + %token  T_GLOBOPS
317   %token  T_INVISIBLE
318   %token  T_IPV4
319   %token  T_IPV6
320   %token  T_LOCOPS
321 < %token  T_MAX_CLIENTS
321 > %token  T_LOG
322   %token  T_NCHANGE
323 < %token  T_OPERWALL
323 > %token  T_NONONREG
324 > %token  T_OPME
325 > %token  T_PREPEND
326 > %token  T_PSEUDO
327   %token  T_RECVQ
328   %token  T_REJ
329 + %token  T_RESTART
330   %token  T_SERVER
331 + %token  T_SERVICE
332   %token  T_SERVNOTICE
333   %token  T_SET
334 + %token  T_SHARED
335 + %token  T_SIZE
336   %token  T_SKILL
337 + %token  T_SOFTCALLERID
338   %token  T_SPY
339   %token  T_SSL
340 + %token  T_SSL_CIPHER_LIST
341 + %token  T_TARGET
342   %token  T_UMODES
343   %token  T_UNAUTH
344   %token  T_UNDLINE
345   %token  T_UNLIMITED
346   %token  T_UNRESV
347   %token  T_UNXLINE
337 %token  T_GLOBOPS
348   %token  T_WALLOP
349 + %token  T_WALLOPS
350   %token  T_WEBIRC
351 < %token  T_RESTART
352 < %token  T_SERVICE
342 < %token  T_SERVICES_NAME
351 > %token  TBOOL
352 > %token  THROTTLE_COUNT
353   %token  THROTTLE_TIME
354 < %token  TRUE_NO_OPER_FLOOD
354 > %token  TKLINE_EXPIRE_NOTICES
355 > %token  TMASKED
356 > %token  TS_MAX_DELTA
357 > %token  TS_WARN_DELTA
358 > %token  TWODOTS
359 > %token  TYPE
360   %token  UNKLINE
346 %token  USER
347 %token  USE_EGD
361   %token  USE_LOGGING
362 + %token  USER
363   %token  VHOST
364   %token  VHOST6
365 + %token  WARN_NO_CONNECT_BLOCK
366 + %token  WHOIS
367   %token  XLINE
368 < %token  WARN_NO_NLINE
353 < %token  T_SIZE
354 < %token  T_FILE
368 > %token  XLINE_EXEMPT
369  
370 < %type <string> QSTRING
371 < %type <number> NUMBER
372 < %type <number> timespec
373 < %type <number> timespec_
374 < %type <number> sizespec
375 < %type <number> sizespec_
370 > %type  <string> QSTRING
371 > %type  <number> NUMBER
372 > %type  <number> timespec
373 > %type  <number> timespec_
374 > %type  <number> sizespec
375 > %type  <number> sizespec_
376  
377   %%
378 < conf:  
378 > conf:
379          | conf conf_item
380          ;
381  
382   conf_item:        admin_entry
383                  | logging_entry
384                  | oper_entry
385 <                | channel_entry
386 <                | class_entry
385 >                | channel_entry
386 >                | class_entry
387                  | listen_entry
388                  | auth_entry
389                  | serverinfo_entry
390 <                | serverhide_entry
390 >                | serverhide_entry
391                  | resv_entry
392                  | service_entry
393                  | shared_entry
394 <                | cluster_entry
394 >                | cluster_entry
395                  | connect_entry
396                  | kill_entry
397                  | deny_entry
398 <                | exempt_entry
399 <                | general_entry
398 >                | exempt_entry
399 >                | general_entry
400                  | gecos_entry
401                  | modules_entry
402 +                | motd_entry
403 +                | pseudo_entry
404                  | error ';'
405                  | error '}'
406          ;
407  
408  
409   timespec_: { $$ = 0; } | timespec;
410 < timespec:       NUMBER timespec_
411 <                {
412 <                        $$ = $1 + $2;
413 <                }
414 <                | NUMBER SECONDS timespec_
415 <                {
416 <                        $$ = $1 + $3;
417 <                }
418 <                | NUMBER MINUTES timespec_
419 <                {
420 <                        $$ = $1 * 60 + $3;
421 <                }
422 <                | NUMBER HOURS timespec_
423 <                {
424 <                        $$ = $1 * 60 * 60 + $3;
425 <                }
410 <                | NUMBER DAYS timespec_
411 <                {
412 <                        $$ = $1 * 60 * 60 * 24 + $3;
413 <                }
414 <                | NUMBER WEEKS timespec_
415 <                {
416 <                        $$ = $1 * 60 * 60 * 24 * 7 + $3;
417 <                }
418 <                | NUMBER MONTHS timespec_
419 <                {
420 <                        $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3;
421 <                }
422 <                | NUMBER YEARS timespec_
423 <                {
424 <                        $$ = $1 * 60 * 60 * 24 * 365 + $3;
425 <                }
426 <                ;
427 <
428 < sizespec_:      { $$ = 0; } | sizespec;
429 < sizespec:       NUMBER sizespec_ { $$ = $1 + $2; }
430 <                | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
431 <                | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
432 <                | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
433 <                ;
410 > timespec:  NUMBER timespec_         { $$ = $1 + $2; } |
411 >           NUMBER SECONDS timespec_ { $$ = $1 + $3; } |
412 >           NUMBER MINUTES timespec_ { $$ = $1 * 60 + $3; } |
413 >           NUMBER HOURS timespec_   { $$ = $1 * 60 * 60 + $3; } |
414 >           NUMBER DAYS timespec_    { $$ = $1 * 60 * 60 * 24 + $3; } |
415 >           NUMBER WEEKS timespec_   { $$ = $1 * 60 * 60 * 24 * 7 + $3; } |
416 >           NUMBER MONTHS timespec_  { $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3; } |
417 >           NUMBER YEARS timespec_   { $$ = $1 * 60 * 60 * 24 * 365 + $3; }
418 >           ;
419 >
420 > sizespec_:  { $$ = 0; } | sizespec;
421 > sizespec:   NUMBER sizespec_ { $$ = $1 + $2; } |
422 >            NUMBER BYTES sizespec_ { $$ = $1 + $3; } |
423 >            NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } |
424 >            NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
425 >            ;
426  
427  
428   /***************************************************************************
429 < *  section modules
429 > * modules {} section
430   ***************************************************************************/
431 < modules_entry: MODULES
440 <  '{' modules_items '}' ';';
431 > modules_entry: MODULES '{' modules_items '}' ';';
432  
433   modules_items:  modules_items modules_item | modules_item;
434   modules_item:   modules_module | modules_path | error ';' ;
# Line 455 | Line 446 | modules_path: PATH '=' QSTRING ';'
446   };
447  
448  
449 + /***************************************************************************
450 + * serverinfo {}  section
451 + ***************************************************************************/
452   serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
453  
454   serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
455 < serverinfo_item:        serverinfo_name | serverinfo_vhost |
456 <                        serverinfo_hub | serverinfo_description |
457 <                        serverinfo_network_name | serverinfo_network_desc |
458 <                        serverinfo_max_clients | serverinfo_max_nick_length |
459 <                        serverinfo_max_topic_length | serverinfo_ssl_dh_param_file |
460 <                        serverinfo_rsa_private_key_file | serverinfo_vhost6 |
461 <                        serverinfo_sid | serverinfo_ssl_certificate_file |
462 <                        serverinfo_ssl_client_method | serverinfo_ssl_server_method |
455 > serverinfo_item:        serverinfo_name |
456 >                        serverinfo_vhost |
457 >                        serverinfo_hub |
458 >                        serverinfo_description |
459 >                        serverinfo_network_name |
460 >                        serverinfo_network_desc |
461 >                        serverinfo_default_max_clients |
462 >                        serverinfo_max_nick_length |
463 >                        serverinfo_max_topic_length |
464 >                        serverinfo_ssl_dh_param_file |
465 >                        serverinfo_ssl_dh_elliptic_curve |
466 >                        serverinfo_rsa_private_key_file |
467 >                        serverinfo_vhost6 |
468 >                        serverinfo_sid |
469 >                        serverinfo_ssl_certificate_file |
470                          serverinfo_ssl_cipher_list |
471 <                        error ';' ;
471 >                        serverinfo_ssl_message_digest_algorithm |
472 >                        serverinfo_libgeoip_database_options |
473 >                        serverinfo_libgeoip_ipv4_database_file |
474 >                        serverinfo_libgeoip_ipv6_database_file |
475 >                        error ';' ;
476  
477  
478 < serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
474 < serverinfo_ssl_server_method: T_SSL_SERVER_METHOD '=' server_method_types ';' ;
475 <
476 < client_method_types: client_method_types ',' client_method_type_item | client_method_type_item;
477 < client_method_type_item: T_SSLV3
478 < {
479 < #ifdef HAVE_LIBCRYPTO
480 <  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
481 <    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
482 < #endif
483 < } | T_TLSV1
478 > serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
479   {
480 < #ifdef HAVE_LIBCRYPTO
481 <  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
482 <    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
483 < #endif
480 >  if (conf_parser_ctx.pass == 2)
481 >  {
482 >    xfree(ConfigServerInfo.ssl_certificate_file);
483 >    ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string);
484 >  }
485   };
486  
487 < server_method_types: server_method_types ',' server_method_type_item | server_method_type_item;
492 < server_method_type_item: T_SSLV3
493 < {
494 < #ifdef HAVE_LIBCRYPTO
495 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
496 <    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
497 < #endif
498 < } | T_TLSV1
487 > serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
488   {
489 < #ifdef HAVE_LIBCRYPTO
490 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
491 <    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
492 < #endif
489 >  if (conf_parser_ctx.pass == 2)
490 >  {
491 >    xfree(ConfigServerInfo.rsa_private_key_file);
492 >    ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
493 >  }
494   };
495  
496 < serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
496 > serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
497   {
498 < #ifdef HAVE_LIBCRYPTO
509 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
498 >  if (conf_parser_ctx.pass == 2)
499    {
500 <    if (!ServerInfo.rsa_private_key_file)
501 <    {
513 <      conf_error_report("No rsa_private_key_file specified, SSL disabled");
514 <      break;
515 <    }
516 <
517 <    if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
518 <                                     SSL_FILETYPE_PEM) <= 0 ||
519 <        SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
520 <                                     SSL_FILETYPE_PEM) <= 0)
521 <    {
522 <      report_crypto_errors();
523 <      conf_error_report("Could not open/read certificate file");
524 <      break;
525 <    }
526 <
527 <    if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
528 <                                    SSL_FILETYPE_PEM) <= 0 ||
529 <        SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
530 <                                    SSL_FILETYPE_PEM) <= 0)
531 <    {
532 <      report_crypto_errors();
533 <      conf_error_report("Could not read RSA private key");
534 <      break;
535 <    }
536 <
537 <    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) ||
538 <        !SSL_CTX_check_private_key(ServerInfo.client_ctx))
539 <    {
540 <      report_crypto_errors();
541 <      conf_error_report("Could not read RSA private key");
542 <      break;
543 <    }
500 >    xfree(ConfigServerInfo.ssl_dh_param_file);
501 >    ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string);
502    }
545 #endif
503   };
504  
505 < serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
505 > serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
506   {
507 < #ifdef HAVE_LIBCRYPTO
551 <  if (conf_parser_ctx.pass == 1)
507 >  if (conf_parser_ctx.pass == 2)
508    {
509 <    BIO *file;
510 <
511 <    if (ServerInfo.rsa_private_key)
512 <    {
557 <      RSA_free(ServerInfo.rsa_private_key);
558 <      ServerInfo.rsa_private_key = NULL;
559 <    }
560 <
561 <    if (ServerInfo.rsa_private_key_file)
562 <    {
563 <      MyFree(ServerInfo.rsa_private_key_file);
564 <      ServerInfo.rsa_private_key_file = NULL;
565 <    }
566 <
567 <    ServerInfo.rsa_private_key_file = xstrdup(yylval.string);
568 <
569 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
570 <    {
571 <      conf_error_report("File open failed, ignoring");
572 <      break;
573 <    }
574 <
575 <    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
576 <
577 <    BIO_set_close(file, BIO_CLOSE);
578 <    BIO_free(file);
579 <
580 <    if (ServerInfo.rsa_private_key == NULL)
581 <    {
582 <      conf_error_report("Couldn't extract key, ignoring");
583 <      break;
584 <    }
509 >    xfree(ConfigServerInfo.ssl_cipher_list);
510 >    ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string);
511 >  }
512 > };
513  
514 <    if (!RSA_check_key(ServerInfo.rsa_private_key))
515 <    {
516 <      RSA_free(ServerInfo.rsa_private_key);
517 <      ServerInfo.rsa_private_key = NULL;
514 > serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';'
515 > {
516 >  if (conf_parser_ctx.pass == 2)
517 >  {
518 >    xfree(ConfigServerInfo.ssl_message_digest_algorithm);
519 >    ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string);
520 >  }
521 > }
522  
523 <      conf_error_report("Invalid key, ignoring");
524 <      break;
525 <    }
523 > serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';'
524 > {
525 >  if (conf_parser_ctx.pass == 2)
526 >  {
527 >    xfree(ConfigServerInfo.ssl_dh_elliptic_curve);
528 >    ConfigServerInfo.ssl_dh_elliptic_curve = xstrdup(yylval.string);
529 >  }
530 > };
531  
532 <    /* require 2048 bit (256 byte) key */
533 <    if (RSA_size(ServerInfo.rsa_private_key) != 256)
534 <    {
535 <      RSA_free(ServerInfo.rsa_private_key);
536 <      ServerInfo.rsa_private_key = NULL;
532 > serverinfo_libgeoip_database_options: LIBGEOIP_DATABASE_OPTIONS
533 > {
534 >  if (conf_parser_ctx.pass == 1)
535 >    ConfigServerInfo.libgeoip_database_options = 0;
536 > } '='  options_items ';';
537  
538 <      conf_error_report("Not a 2048 bit key, ignoring");
539 <    }
540 <  }
538 > options_items: options_items ',' options_item | options_item;
539 > options_item: STANDARD
540 > {
541 > #ifdef HAVE_LIBGEOIP
542 >  if (conf_parser_ctx.pass == 1)
543 >    ConfigServerInfo.libgeoip_database_options |= GEOIP_STANDARD;
544 > #endif
545 > } | MEMORY_CACHE
546 > {
547 > #ifdef HAVE_LIBGEOIP
548 >  if (conf_parser_ctx.pass == 1)
549 >    ConfigServerInfo.libgeoip_database_options |= GEOIP_MEMORY_CACHE;
550 > #endif
551 > } | MMAP_CACHE
552 > {
553 > #ifdef HAVE_LIBGEOIP
554 >  if (conf_parser_ctx.pass == 1)
555 >    ConfigServerInfo.libgeoip_database_options |= GEOIP_MMAP_CACHE;
556 > #endif
557 > } | CHECK_CACHE
558 > {
559 > #ifdef HAVE_LIBGEOIP
560 >  if (conf_parser_ctx.pass == 1)
561 >    ConfigServerInfo.libgeoip_database_options |= GEOIP_CHECK_CACHE;
562   #endif
563   };
564  
565 < serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
565 > serverinfo_libgeoip_ipv4_database_file:  LIBGEOIP_IPV4_DATABASE_FILE '=' QSTRING ';'
566   {
567 < /* TBD - XXX: error reporting */
610 < #ifdef HAVE_LIBCRYPTO
611 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
567 >  if (conf_parser_ctx.pass == 2)
568    {
569 <    BIO *file = BIO_new_file(yylval.string, "r");
569 >    xfree(ConfigServerInfo.libgeoip_ipv4_database_file);
570 >    ConfigServerInfo.libgeoip_ipv4_database_file = xstrdup(yylval.string);
571  
572 <    if (file)
573 <    {
574 <      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
575 <
619 <      BIO_free(file);
620 <
621 <      if (dh)
622 <      {
623 <        if (DH_size(dh) < 128)
624 <          conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
625 <        else
626 <          SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
627 <
628 <        DH_free(dh);
629 <      }
630 <    }
631 <  }
572 > #ifdef HAVE_LIBGEOIP
573 >    if (GeoIPv4_ctx)
574 >      GeoIP_delete(GeoIPv4_ctx);
575 >    GeoIPv4_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options);
576   #endif
577 +  }
578   };
579  
580 < serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
580 > serverinfo_libgeoip_ipv6_database_file:  LIBGEOIP_IPV6_DATABASE_FILE '=' QSTRING ';'
581   {
582 < #ifdef HAVE_LIBCRYPTO
583 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
584 <    SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
582 >  if (conf_parser_ctx.pass == 2)
583 >  {
584 >    xfree(ConfigServerInfo.libgeoip_ipv6_database_file);
585 >    ConfigServerInfo.libgeoip_ipv6_database_file = xstrdup(yylval.string);
586 >
587 > #ifdef HAVE_LIBGEOIP
588 >    if (GeoIPv6_ctx)
589 >      GeoIP_delete(GeoIPv6_ctx);
590 >    GeoIPv6_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options);
591   #endif
592 +  }
593   };
594  
595 < serverinfo_name: NAME '=' QSTRING ';'
595 > serverinfo_name: NAME '=' QSTRING ';'
596   {
597 <  /* this isn't rehashable */
598 <  if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
597 >  /* This isn't rehashable */
598 >  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
599    {
600      if (valid_servname(yylval.string))
601 <      ServerInfo.name = xstrdup(yylval.string);
601 >      ConfigServerInfo.name = xstrdup(yylval.string);
602      else
603      {
604        conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting.");
605 <      exit(0);
605 >      exit(EXIT_FAILURE);
606      }
607    }
608   };
609  
610 < serverinfo_sid: IRCD_SID '=' QSTRING ';'
610 > serverinfo_sid: IRCD_SID '=' QSTRING ';'
611   {
612 <  /* this isn't rehashable */
613 <  if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
612 >  /* This isn't rehashable */
613 >  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid)
614    {
615      if (valid_sid(yylval.string))
616 <      ServerInfo.sid = xstrdup(yylval.string);
616 >      ConfigServerInfo.sid = xstrdup(yylval.string);
617      else
618      {
619        conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting.");
620 <      exit(0);
620 >      exit(EXIT_FAILURE);
621      }
622    }
623   };
# Line 674 | Line 626 | serverinfo_description: DESCRIPTION '='
626   {
627    if (conf_parser_ctx.pass == 2)
628    {
629 <    MyFree(ServerInfo.description);
630 <    ServerInfo.description = xstrdup(yylval.string);
629 >    xfree(ConfigServerInfo.description);
630 >    ConfigServerInfo.description = xstrdup(yylval.string);
631 >    strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info));
632    }
633   };
634  
# Line 685 | Line 638 | serverinfo_network_name: NETWORK_NAME '=
638    {
639      char *p;
640  
641 <    if ((p = strchr(yylval.string, ' ')) != NULL)
642 <      p = '\0';
641 >    if ((p = strchr(yylval.string, ' ')))
642 >      *p = '\0';
643  
644 <    MyFree(ServerInfo.network_name);
645 <    ServerInfo.network_name = xstrdup(yylval.string);
644 >    xfree(ConfigServerInfo.network_name);
645 >    ConfigServerInfo.network_name = xstrdup(yylval.string);
646    }
647   };
648  
649   serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
650   {
651 <  if (conf_parser_ctx.pass == 2)
652 <  {
653 <    MyFree(ServerInfo.network_desc);
654 <    ServerInfo.network_desc = xstrdup(yylval.string);
655 <  }
651 >  if (conf_parser_ctx.pass != 2)
652 >    break;
653 >
654 >  xfree(ConfigServerInfo.network_desc);
655 >  ConfigServerInfo.network_desc = xstrdup(yylval.string);
656   };
657  
658   serverinfo_vhost: VHOST '=' QSTRING ';'
# Line 718 | Line 671 | serverinfo_vhost: VHOST '=' QSTRING ';'
671        ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
672      else
673      {
674 <      assert(res != NULL);
674 >      assert(res);
675  
676 <      memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen);
677 <      ServerInfo.ip.ss.ss_family = res->ai_family;
678 <      ServerInfo.ip.ss_len = res->ai_addrlen;
676 >      memcpy(&ConfigServerInfo.ip, res->ai_addr, res->ai_addrlen);
677 >      ConfigServerInfo.ip.ss.ss_family = res->ai_family;
678 >      ConfigServerInfo.ip.ss_len = res->ai_addrlen;
679        freeaddrinfo(res);
680  
681 <      ServerInfo.specific_ipv4_vhost = 1;
681 >      ConfigServerInfo.specific_ipv4_vhost = 1;
682      }
683    }
684   };
685  
686   serverinfo_vhost6: VHOST6 '=' QSTRING ';'
687   {
735 #ifdef IPV6
688    if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
689    {
690      struct addrinfo hints, *res;
# Line 747 | Line 699 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
699        ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
700      else
701      {
702 <      assert(res != NULL);
702 >      assert(res);
703  
704 <      memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen);
705 <      ServerInfo.ip6.ss.ss_family = res->ai_family;
706 <      ServerInfo.ip6.ss_len = res->ai_addrlen;
704 >      memcpy(&ConfigServerInfo.ip6, res->ai_addr, res->ai_addrlen);
705 >      ConfigServerInfo.ip6.ss.ss_family = res->ai_family;
706 >      ConfigServerInfo.ip6.ss_len = res->ai_addrlen;
707        freeaddrinfo(res);
708  
709 <      ServerInfo.specific_ipv6_vhost = 1;
709 >      ConfigServerInfo.specific_ipv6_vhost = 1;
710      }
711    }
760 #endif
712   };
713  
714 < serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
714 > serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';'
715   {
716    if (conf_parser_ctx.pass != 2)
717      break;
718  
719    if ($3 < MAXCLIENTS_MIN)
720    {
721 <    char buf[IRCD_BUFSIZE];
721 >    char buf[IRCD_BUFSIZE] = "";
722  
723      snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
724      conf_error_report(buf);
725 <    ServerInfo.max_clients = MAXCLIENTS_MIN;
725 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN;
726    }
727    else if ($3 > MAXCLIENTS_MAX)
728    {
729 <    char buf[IRCD_BUFSIZE];
729 >    char buf[IRCD_BUFSIZE] = "";
730  
731      snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
732      conf_error_report(buf);
733 <    ServerInfo.max_clients = MAXCLIENTS_MAX;
733 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
734    }
735    else
736 <    ServerInfo.max_clients = $3;
736 >    ConfigServerInfo.default_max_clients = $3;
737   };
738  
739   serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';'
# Line 793 | Line 744 | serverinfo_max_nick_length: MAX_NICK_LEN
744    if ($3 < 9)
745    {
746      conf_error_report("max_nick_length too low, setting to 9");
747 <    ServerInfo.max_nick_length = 9;
747 >    ConfigServerInfo.max_nick_length = 9;
748    }
749    else if ($3 > NICKLEN)
750    {
751 <    char buf[IRCD_BUFSIZE];
751 >    char buf[IRCD_BUFSIZE] = "";
752  
753      snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN);
754      conf_error_report(buf);
755 <    ServerInfo.max_nick_length = NICKLEN;
755 >    ConfigServerInfo.max_nick_length = NICKLEN;
756    }
757    else
758 <    ServerInfo.max_nick_length = $3;
758 >    ConfigServerInfo.max_nick_length = $3;
759   };
760  
761   serverinfo_max_topic_length: MAX_TOPIC_LENGTH '=' NUMBER ';'
# Line 815 | Line 766 | serverinfo_max_topic_length: MAX_TOPIC_L
766    if ($3 < 80)
767    {
768      conf_error_report("max_topic_length too low, setting to 80");
769 <    ServerInfo.max_topic_length = 80;
769 >    ConfigServerInfo.max_topic_length = 80;
770    }
771    else if ($3 > TOPICLEN)
772    {
773 <    char buf[IRCD_BUFSIZE];
773 >    char buf[IRCD_BUFSIZE] = "";
774  
775      snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN);
776      conf_error_report(buf);
777 <    ServerInfo.max_topic_length = TOPICLEN;
777 >    ConfigServerInfo.max_topic_length = TOPICLEN;
778    }
779    else
780 <    ServerInfo.max_topic_length = $3;
780 >    ConfigServerInfo.max_topic_length = $3;
781   };
782  
783 < serverinfo_hub: HUB '=' TBOOL ';'
783 > serverinfo_hub: HUB '=' TBOOL ';'
784   {
785    if (conf_parser_ctx.pass == 2)
786 <    ServerInfo.hub = yylval.number;
786 >    ConfigServerInfo.hub = yylval.number;
787   };
788  
789 +
790   /***************************************************************************
791 < * admin section
791 > * admin {} section
792   ***************************************************************************/
793   admin_entry: ADMIN  '{' admin_items '}' ';' ;
794  
795   admin_items: admin_items admin_item | admin_item;
796 < admin_item:  admin_name | admin_description |
797 <             admin_email | error ';' ;
796 > admin_item:  admin_name |
797 >             admin_description |
798 >             admin_email |
799 >             error ';' ;
800  
801 < admin_name: NAME '=' QSTRING ';'
801 > admin_name: NAME '=' QSTRING ';'
802   {
803 <  if (conf_parser_ctx.pass == 2)
804 <  {
805 <    MyFree(AdminInfo.name);
806 <    AdminInfo.name = xstrdup(yylval.string);
807 <  }
803 >  if (conf_parser_ctx.pass != 2)
804 >    break;
805 >
806 >  xfree(ConfigAdminInfo.name);
807 >  ConfigAdminInfo.name = xstrdup(yylval.string);
808   };
809  
810   admin_email: EMAIL '=' QSTRING ';'
811   {
812 <  if (conf_parser_ctx.pass == 2)
813 <  {
814 <    MyFree(AdminInfo.email);
815 <    AdminInfo.email = xstrdup(yylval.string);
816 <  }
812 >  if (conf_parser_ctx.pass != 2)
813 >    break;
814 >
815 >  xfree(ConfigAdminInfo.email);
816 >  ConfigAdminInfo.email = xstrdup(yylval.string);
817   };
818  
819   admin_description: DESCRIPTION '=' QSTRING ';'
820   {
821 +  if (conf_parser_ctx.pass != 2)
822 +    break;
823 +
824 +  xfree(ConfigAdminInfo.description);
825 +  ConfigAdminInfo.description = xstrdup(yylval.string);
826 + };
827 +
828 +
829 + /***************************************************************************
830 + * motd {} section
831 + ***************************************************************************/
832 + motd_entry: MOTD
833 + {
834 +  if (conf_parser_ctx.pass == 2)
835 +    reset_block_state();
836 + } '{' motd_items '}' ';'
837 + {
838 +  dlink_node *node = NULL;
839 +
840 +  if (conf_parser_ctx.pass != 2)
841 +    break;
842 +
843 +  if (!block_state.file.buf[0])
844 +    break;
845 +
846 +  DLINK_FOREACH(node, block_state.mask.list.head)
847 +    motd_add(node->data, block_state.file.buf);
848 + };
849 +
850 + motd_items: motd_items motd_item | motd_item;
851 + motd_item:  motd_mask | motd_file | error ';' ;
852 +
853 + motd_mask: MASK '=' QSTRING ';'
854 + {
855 +  if (conf_parser_ctx.pass == 2)
856 +    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
857 + };
858 +
859 + motd_file: T_FILE '=' QSTRING ';'
860 + {
861 +  if (conf_parser_ctx.pass == 2)
862 +    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
863 + };
864 +
865 +
866 + /***************************************************************************
867 + * pseudo {} section
868 + ***************************************************************************/
869 + pseudo_entry: T_PSEUDO
870 + {
871 +  if (conf_parser_ctx.pass == 2)
872 +    reset_block_state();
873 + } '{' pseudo_items '}' ';'
874 + {
875 +  if (conf_parser_ctx.pass != 2)
876 +    break;
877 +
878 +  if (!block_state.command.buf[0] ||
879 +      !block_state.name.buf[0] ||
880 +      !block_state.nick.buf[0] ||
881 +      !block_state.host.buf[0])
882 +    break;
883 +
884 +  pseudo_register(block_state.name.buf, block_state.nick.buf, block_state.host.buf,
885 +                  block_state.prepend.buf, block_state.command.buf);
886 + };
887 +
888 + pseudo_items: pseudo_items pseudo_item | pseudo_item;
889 + pseudo_item:  pseudo_command | pseudo_prepend | pseudo_name | pseudo_target | error ';' ;
890 +
891 + pseudo_command: T_COMMAND '=' QSTRING ';'
892 + {
893 +  if (conf_parser_ctx.pass == 2)
894 +    strlcpy(block_state.command.buf, yylval.string, sizeof(block_state.command.buf));
895 + };
896 +
897 + pseudo_name: NAME '=' QSTRING ';'
898 + {
899 +  if (conf_parser_ctx.pass == 2)
900 +    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
901 + };
902 +
903 + pseudo_prepend: T_PREPEND '=' QSTRING ';'
904 + {
905 +  if (conf_parser_ctx.pass == 2)
906 +    strlcpy(block_state.prepend.buf, yylval.string, sizeof(block_state.prepend.buf));
907 + };
908 +
909 + pseudo_target: T_TARGET '=' QSTRING ';'
910 + {
911    if (conf_parser_ctx.pass == 2)
912    {
913 <    MyFree(AdminInfo.description);
914 <    AdminInfo.description = xstrdup(yylval.string);
913 >    struct split_nuh_item nuh;
914 >
915 >    nuh.nuhmask  = yylval.string;
916 >    nuh.nickptr  = NULL;
917 >    nuh.userptr  = block_state.nick.buf;
918 >    nuh.hostptr  = block_state.host.buf;
919 >    nuh.nicksize = 0;
920 >    nuh.usersize = sizeof(block_state.nick.buf);
921 >    nuh.hostsize = sizeof(block_state.host.buf);
922 >
923 >    split_nuh(&nuh);
924    }
925   };
926  
927 +
928   /***************************************************************************
929 < *  section logging
929 > * log {} section
930   ***************************************************************************/
931   logging_entry:          T_LOG  '{' logging_items '}' ';' ;
932   logging_items:          logging_items logging_item | logging_item ;
933  
934 < logging_item:           logging_use_logging | logging_file_entry |
935 <                        error ';' ;
934 > logging_item:           logging_use_logging | logging_file_entry |
935 >                        error ';' ;
936  
937   logging_use_logging: USE_LOGGING '=' TBOOL ';'
938   {
939    if (conf_parser_ctx.pass == 2)
940 <    ConfigLoggingEntry.use_logging = yylval.number;
940 >    ConfigLog.use_logging = yylval.number;
941   };
942  
943   logging_file_entry:
# Line 937 | Line 991 | logging_file_type_item:  USER
991   {
992    if (conf_parser_ctx.pass == 2)
993      block_state.type.value = LOG_TYPE_OPER;
994 < } | GLINE
994 > } | XLINE
995   {
996    if (conf_parser_ctx.pass == 2)
997 <    block_state.type.value = LOG_TYPE_GLINE;
997 >    block_state.type.value = LOG_TYPE_XLINE;
998 > } | RESV
999 > {
1000 >  if (conf_parser_ctx.pass == 2)
1001 >    block_state.type.value = LOG_TYPE_RESV;
1002   } | T_DLINE
1003   {
1004    if (conf_parser_ctx.pass == 2)
# Line 961 | Line 1019 | logging_file_type_item:  USER
1019  
1020  
1021   /***************************************************************************
1022 < * section oper
1022 > * operator {} section
1023   ***************************************************************************/
1024 < oper_entry: OPERATOR
1024 > oper_entry: OPERATOR
1025   {
1026    if (conf_parser_ctx.pass != 2)
1027      break;
# Line 972 | Line 1030 | oper_entry: OPERATOR
1030    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1031   } '{' oper_items '}' ';'
1032   {
1033 <  dlink_node *ptr = NULL;
1033 >  dlink_node *node = NULL;
1034  
1035    if (conf_parser_ctx.pass != 2)
1036      break;
1037  
1038    if (!block_state.name.buf[0])
1039      break;
1040 < #ifdef HAVE_LIBCRYPTO
983 <  if (!(block_state.file.buf[0] ||
984 <        block_state.rpass.buf[0]))
985 <    break;
986 < #else
1040 >
1041    if (!block_state.rpass.buf[0])
1042      break;
989 #endif
1043  
1044 <  DLINK_FOREACH(ptr, block_state.mask.list.head)
1044 >  DLINK_FOREACH(node, block_state.mask.list.head)
1045    {
1046      struct MaskItem *conf = NULL;
1047      struct split_nuh_item nuh;
1048  
1049 <    nuh.nuhmask  = ptr->data;
1049 >    nuh.nuhmask  = node->data;
1050      nuh.nickptr  = NULL;
1051      nuh.userptr  = block_state.user.buf;
1052      nuh.hostptr  = block_state.host.buf;
# Line 1002 | Line 1055 | oper_entry: OPERATOR
1055      nuh.hostsize = sizeof(block_state.host.buf);
1056      split_nuh(&nuh);
1057  
1058 <    conf        = conf_make(CONF_OPER);
1059 <    conf->name  = xstrdup(block_state.name.buf);
1060 <    conf->user  = xstrdup(block_state.user.buf);
1061 <    conf->host  = xstrdup(block_state.host.buf);
1058 >    conf         = conf_make(CONF_OPER);
1059 >    conf->name   = xstrdup(block_state.name.buf);
1060 >    conf->user   = xstrdup(block_state.user.buf);
1061 >    conf->host   = xstrdup(block_state.host.buf);
1062 >
1063 >    if (block_state.cert.buf[0])
1064 >      conf->certfp = xstrdup(block_state.cert.buf);
1065  
1066      if (block_state.rpass.buf[0])
1067        conf->passwd = xstrdup(block_state.rpass.buf);
1068  
1069 +    if (block_state.whois.buf[0])
1070 +      conf->whois = xstrdup(block_state.whois.buf);
1071 +
1072      conf->flags = block_state.flags.value;
1073      conf->modes = block_state.modes.value;
1074      conf->port  = block_state.port.value;
1075      conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits);
1076  
1077      conf_add_class_to_conf(conf, block_state.class.buf);
1019
1020 #ifdef HAVE_LIBCRYPTO
1021    if (block_state.file.buf[0])
1022    {
1023      BIO *file = NULL;
1024      RSA *pkey = NULL;
1025
1026      if ((file = BIO_new_file(block_state.file.buf, "r")) == NULL)
1027      {
1028        conf_error_report("Ignoring rsa_public_key_file -- file doesn't exist");
1029        break;
1030      }
1031
1032      if ((pkey = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL)) == NULL)
1033        conf_error_report("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
1034
1035      conf->rsa_public_key = pkey;
1036      BIO_set_close(file, BIO_CLOSE);
1037      BIO_free(file);
1038    }
1039 #endif /* HAVE_LIBCRYPTO */
1078    }
1079   };
1080  
1081   oper_items:     oper_items oper_item | oper_item;
1082 < oper_item:      oper_name | oper_user | oper_password |
1083 <                oper_umodes | oper_class | oper_encrypted |
1084 <                oper_rsa_public_key_file | oper_flags | error ';' ;
1082 > oper_item:      oper_name |
1083 >                oper_user |
1084 >                oper_password |
1085 >                oper_whois |
1086 >                oper_umodes |
1087 >                oper_class |
1088 >                oper_encrypted |
1089 >                oper_ssl_certificate_fingerprint |
1090 >                oper_ssl_connection_required |
1091 >                oper_flags |
1092 >                error ';' ;
1093  
1094   oper_name: NAME '=' QSTRING ';'
1095   {
# Line 1063 | Line 1109 | oper_password: PASSWORD '=' QSTRING ';'
1109      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1110   };
1111  
1112 < oper_encrypted: ENCRYPTED '=' TBOOL ';'
1112 > oper_whois: WHOIS '=' QSTRING ';'
1113   {
1114    if (conf_parser_ctx.pass == 2)
1115 <  {
1070 <    if (yylval.number)
1071 <      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1072 <    else
1073 <      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1074 <  }
1115 >    strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf));
1116   };
1117  
1118 < oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1118 > oper_encrypted: ENCRYPTED '=' TBOOL ';'
1119 > {
1120 >  if (conf_parser_ctx.pass != 2)
1121 >    break;
1122 >
1123 >  if (yylval.number)
1124 >    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1125 >  else
1126 >    block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1127 > };
1128 >
1129 > oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1130   {
1131    if (conf_parser_ctx.pass == 2)
1132 <    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1132 >    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1133 > };
1134 >
1135 > oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1136 > {
1137 >  if (conf_parser_ctx.pass != 2)
1138 >    break;
1139 >
1140 >  if (yylval.number)
1141 >    block_state.flags.value |= CONF_FLAGS_SSL;
1142 >  else
1143 >    block_state.flags.value &= ~CONF_FLAGS_SSL;
1144   };
1145  
1146   oper_class: CLASS '=' QSTRING ';'
# Line 1101 | Line 1164 | oper_umodes_item:  T_BOTS
1164   {
1165    if (conf_parser_ctx.pass == 2)
1166      block_state.modes.value |= UMODE_CCONN;
1104 } | T_CCONN_FULL
1105 {
1106  if (conf_parser_ctx.pass == 2)
1107    block_state.modes.value |= UMODE_CCONN_FULL;
1167   } | T_DEAF
1168   {
1169    if (conf_parser_ctx.pass == 2)
# Line 1121 | Line 1180 | oper_umodes_item:  T_BOTS
1180   {
1181    if (conf_parser_ctx.pass == 2)
1182      block_state.modes.value |= UMODE_HIDDEN;
1183 + } | HIDE_CHANS
1184 + {
1185 +  if (conf_parser_ctx.pass == 2)
1186 +    block_state.modes.value |= UMODE_HIDECHANS;
1187 + } | HIDE_IDLE
1188 + {
1189 +  if (conf_parser_ctx.pass == 2)
1190 +    block_state.modes.value |= UMODE_HIDEIDLE;
1191   } | T_SKILL
1192   {
1193    if (conf_parser_ctx.pass == 2)
# Line 1145 | Line 1212 | oper_umodes_item:  T_BOTS
1212   {
1213    if (conf_parser_ctx.pass == 2)
1214      block_state.modes.value |= UMODE_EXTERNAL;
1148 } | T_OPERWALL
1149 {
1150  if (conf_parser_ctx.pass == 2)
1151    block_state.modes.value |= UMODE_OPERWALL;
1215   } | T_SERVNOTICE
1216   {
1217    if (conf_parser_ctx.pass == 2)
# Line 1173 | Line 1236 | oper_umodes_item:  T_BOTS
1236   {
1237    if (conf_parser_ctx.pass == 2)
1238      block_state.modes.value |= UMODE_LOCOPS;
1239 + } | T_NONONREG
1240 + {
1241 +  if (conf_parser_ctx.pass == 2)
1242 +    block_state.modes.value |= UMODE_REGONLY;
1243 + } | T_FARCONNECT
1244 + {
1245 +  if (conf_parser_ctx.pass == 2)
1246 +    block_state.modes.value |= UMODE_FARCONNECT;
1247   };
1248  
1249   oper_flags: IRCD_FLAGS
# Line 1182 | Line 1253 | oper_flags: IRCD_FLAGS
1253   } '='  oper_flags_items ';';
1254  
1255   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1256 < oper_flags_item: GLOBAL_KILL
1256 > oper_flags_item: KILL ':' REMOTE
1257 > {
1258 >  if (conf_parser_ctx.pass == 2)
1259 >    block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1260 > } | KILL
1261 > {
1262 >  if (conf_parser_ctx.pass == 2)
1263 >    block_state.port.value |= OPER_FLAG_KILL;
1264 > } | CONNECT ':' REMOTE
1265 > {
1266 >  if (conf_parser_ctx.pass == 2)
1267 >    block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1268 > } | CONNECT
1269   {
1270    if (conf_parser_ctx.pass == 2)
1271 <    block_state.port.value |= OPER_FLAG_GLOBAL_KILL;
1272 < } | REMOTE
1271 >    block_state.port.value |= OPER_FLAG_CONNECT;
1272 > } | SQUIT ':' REMOTE
1273   {
1274    if (conf_parser_ctx.pass == 2)
1275 <    block_state.port.value |= OPER_FLAG_REMOTE;
1275 >    block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1276 > } | SQUIT
1277 > {
1278 >  if (conf_parser_ctx.pass == 2)
1279 >    block_state.port.value |= OPER_FLAG_SQUIT;
1280   } | KLINE
1281   {
1282    if (conf_parser_ctx.pass == 2)
1283 <    block_state.port.value |= OPER_FLAG_K;
1283 >    block_state.port.value |= OPER_FLAG_KLINE;
1284   } | UNKLINE
1285   {
1286    if (conf_parser_ctx.pass == 2)
# Line 1209 | Line 1296 | oper_flags_item: GLOBAL_KILL
1296   } | XLINE
1297   {
1298    if (conf_parser_ctx.pass == 2)
1299 <    block_state.port.value |= OPER_FLAG_X;
1300 < } | GLINE
1299 >    block_state.port.value |= OPER_FLAG_XLINE;
1300 > } | T_UNXLINE
1301   {
1302    if (conf_parser_ctx.pass == 2)
1303 <    block_state.port.value |= OPER_FLAG_GLINE;
1303 >    block_state.port.value |= OPER_FLAG_UNXLINE;
1304   } | DIE
1305   {
1306    if (conf_parser_ctx.pass == 2)
# Line 1222 | Line 1309 | oper_flags_item: GLOBAL_KILL
1309   {
1310    if (conf_parser_ctx.pass == 2)
1311      block_state.port.value |= OPER_FLAG_RESTART;
1312 + } | REHASH ':' REMOTE
1313 + {
1314 +  if (conf_parser_ctx.pass == 2)
1315 +    block_state.port.value |= OPER_FLAG_REHASH_REMOTE;
1316   } | REHASH
1317   {
1318    if (conf_parser_ctx.pass == 2)
# Line 1230 | Line 1321 | oper_flags_item: GLOBAL_KILL
1321   {
1322    if (conf_parser_ctx.pass == 2)
1323      block_state.port.value |= OPER_FLAG_ADMIN;
1233 } | NICK_CHANGES
1234 {
1235  if (conf_parser_ctx.pass == 2)
1236    block_state.port.value |= OPER_FLAG_N;
1237 } | T_OPERWALL
1238 {
1239  if (conf_parser_ctx.pass == 2)
1240    block_state.port.value |= OPER_FLAG_OPERWALL;
1324   } | T_GLOBOPS
1325   {
1326    if (conf_parser_ctx.pass == 2)
1327      block_state.port.value |= OPER_FLAG_GLOBOPS;
1328 < } | OPER_SPY_T
1328 > } | T_WALLOPS
1329   {
1330    if (conf_parser_ctx.pass == 2)
1331 <    block_state.port.value |= OPER_FLAG_OPER_SPY;
1331 >    block_state.port.value |= OPER_FLAG_WALLOPS;
1332 > } | T_LOCOPS
1333 > {
1334 >  if (conf_parser_ctx.pass == 2)
1335 >    block_state.port.value |= OPER_FLAG_LOCOPS;
1336   } | REMOTEBAN
1337   {
1338    if (conf_parser_ctx.pass == 2)
# Line 1258 | Line 1345 | oper_flags_item: GLOBAL_KILL
1345   {
1346    if (conf_parser_ctx.pass == 2)
1347      block_state.port.value |= OPER_FLAG_MODULE;
1348 + } | T_OPME
1349 + {
1350 +  if (conf_parser_ctx.pass == 2)
1351 +    block_state.port.value |= OPER_FLAG_OPME;
1352 + } | NICK ':' RESV
1353 + {
1354 +  if (conf_parser_ctx.pass == 2)
1355 +    block_state.port.value |= OPER_FLAG_NICK_RESV;
1356 + } | JOIN ':' RESV
1357 + {
1358 +  if (conf_parser_ctx.pass == 2)
1359 +    block_state.port.value |= OPER_FLAG_JOIN_RESV;
1360 + } | RESV
1361 + {
1362 +  if (conf_parser_ctx.pass == 2)
1363 +    block_state.port.value |= OPER_FLAG_RESV;
1364 + } | T_UNRESV
1365 + {
1366 +  if (conf_parser_ctx.pass == 2)
1367 +    block_state.port.value |= OPER_FLAG_UNRESV;
1368 + } | CLOSE
1369 + {
1370 +  if (conf_parser_ctx.pass == 2)
1371 +    block_state.port.value |= OPER_FLAG_CLOSE;
1372   };
1373  
1374  
1375   /***************************************************************************
1376 < *  section class
1376 > * class {} section
1377   ***************************************************************************/
1378   class_entry: CLASS
1379   {
# Line 1290 | Line 1401 | class_entry: CLASS
1401      class = class_make();
1402  
1403    class->active = 1;
1404 <  MyFree(class->name);
1404 >  xfree(class->name);
1405    class->name = xstrdup(block_state.class.buf);
1406    class->ping_freq = block_state.ping_freq.value;
1407    class->max_perip = block_state.max_perip.value;
# Line 1301 | Line 1412 | class_entry: CLASS
1412    class->max_ident = block_state.max_ident.value;
1413    class->max_sendq = block_state.max_sendq.value;
1414    class->max_recvq = block_state.max_recvq.value;
1415 +  class->max_channels = block_state.max_channels.value;
1416  
1417    if (block_state.min_idle.value > block_state.max_idle.value)
1418    {
# Line 1313 | Line 1425 | class_entry: CLASS
1425    class->min_idle = block_state.min_idle.value;
1426    class->max_idle = block_state.max_idle.value;
1427  
1428 <  if (class->number_per_cidr && block_state.number_per_cidr.value)
1317 <    if ((class->cidr_bitlen_ipv4 && block_state.cidr_bitlen_ipv4.value) ||
1318 <        (class->cidr_bitlen_ipv6 && block_state.cidr_bitlen_ipv6.value))
1319 <      if ((class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value) ||
1320 <          (class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value))
1321 <        rebuild_cidr_list(class);
1428 >  rebuild_cidr_list(class);
1429  
1430    class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1431    class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
# Line 1327 | Line 1434 | class_entry: CLASS
1434  
1435   class_items:    class_items class_item | class_item;
1436   class_item:     class_name |
1437 <                class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
1437 >                class_cidr_bitlen_ipv4 |
1438 >                class_cidr_bitlen_ipv6 |
1439                  class_ping_time |
1440 <                class_number_per_cidr |
1440 >                class_number_per_cidr |
1441                  class_number_per_ip |
1442                  class_connectfreq |
1443 +                class_max_channels |
1444                  class_max_number |
1445 <                class_max_global |
1446 <                class_max_local |
1447 <                class_max_ident |
1445 >                class_max_global |
1446 >                class_max_local |
1447 >                class_max_ident |
1448                  class_sendq | class_recvq |
1449                  class_min_idle |
1450                  class_max_idle |
1451                  class_flags |
1452 <                error ';' ;
1452 >                error ';' ;
1453  
1454 < class_name: NAME '=' QSTRING ';'
1454 > class_name: NAME '=' QSTRING ';'
1455   {
1456    if (conf_parser_ctx.pass == 1)
1457      strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
# Line 1366 | Line 1475 | class_connectfreq: CONNECTFREQ '=' times
1475      block_state.con_freq.value = $3;
1476   };
1477  
1478 + class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1479 + {
1480 +  if (conf_parser_ctx.pass == 1)
1481 +    block_state.max_channels.value = $3;
1482 + };
1483 +
1484   class_max_number: MAX_NUMBER '=' NUMBER ';'
1485   {
1486    if (conf_parser_ctx.pass == 1)
# Line 1458 | Line 1573 | class_flags_item: RANDOM_IDLE
1573  
1574  
1575   /***************************************************************************
1576 < *  section listen
1576 > * listen {} section
1577   ***************************************************************************/
1578   listen_entry: LISTEN
1579   {
# Line 1497 | Line 1612 | port_item: NUMBER
1612   {
1613    if (conf_parser_ctx.pass == 2)
1614    {
1615 + #ifndef HAVE_TLS
1616      if (block_state.flags.value & LISTENER_SSL)
1617 < #ifdef HAVE_LIBCRYPTO
1618 <      if (!ServerInfo.server_ctx)
1617 >    {
1618 >      conf_error_report("TLS not available - port closed");
1619 >      break;
1620 >    }
1621   #endif
1622 <      {
1505 <        conf_error_report("SSL not available - port closed");
1506 <        break;
1507 <      }
1508 <    add_listener($1, block_state.addr.buf, block_state.flags.value);
1622 >    listener_add($1, block_state.addr.buf, block_state.flags.value);
1623    }
1624   } | NUMBER TWODOTS NUMBER
1625   {
1626    if (conf_parser_ctx.pass == 2)
1627    {
1628 <    int i;
1515 <
1628 > #ifndef HAVE_TLS
1629      if (block_state.flags.value & LISTENER_SSL)
1630 < #ifdef HAVE_LIBCRYPTO
1631 <      if (!ServerInfo.server_ctx)
1630 >    {
1631 >      conf_error_report("TLS not available - port closed");
1632 >      break;
1633 >    }
1634   #endif
1520      {
1521        conf_error_report("SSL not available - port closed");
1522        break;
1523      }
1635  
1636 <    for (i = $1; i <= $3; ++i)
1637 <      add_listener(i, block_state.addr.buf, block_state.flags.value);
1636 >    for (int i = $1; i <= $3; ++i)
1637 >      listener_add(i, block_state.addr.buf, block_state.flags.value);
1638    }
1639   };
1640  
# Line 1539 | Line 1650 | listen_host: HOST '=' QSTRING ';'
1650      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1651   };
1652  
1653 +
1654   /***************************************************************************
1655 < *  section auth
1655 > * auth {} section
1656   ***************************************************************************/
1657   auth_entry: IRCD_AUTH
1658   {
# Line 1548 | Line 1660 | auth_entry: IRCD_AUTH
1660      reset_block_state();
1661   } '{' auth_items '}' ';'
1662   {
1663 <  dlink_node *ptr = NULL;
1663 >  dlink_node *node = NULL;
1664  
1665    if (conf_parser_ctx.pass != 2)
1666      break;
1667  
1668 <  DLINK_FOREACH(ptr, block_state.mask.list.head)
1668 >  DLINK_FOREACH(node, block_state.mask.list.head)
1669    {
1670      struct MaskItem *conf = NULL;
1671      struct split_nuh_item nuh;
1672  
1673 <    nuh.nuhmask  = ptr->data;
1673 >    nuh.nuhmask  = node->data;
1674      nuh.nickptr  = NULL;
1675      nuh.userptr  = block_state.user.buf;
1676      nuh.hostptr  = block_state.host.buf;
# Line 1568 | Line 1680 | auth_entry: IRCD_AUTH
1680      split_nuh(&nuh);
1681  
1682      conf        = conf_make(CONF_CLIENT);
1683 <    conf->user  = xstrdup(collapse(block_state.user.buf));
1684 <    conf->host  = xstrdup(collapse(block_state.host.buf));
1683 >    conf->user  = xstrdup(block_state.user.buf);
1684 >    conf->host  = xstrdup(block_state.host.buf);
1685  
1686      if (block_state.rpass.buf[0])
1687        conf->passwd = xstrdup(block_state.rpass.buf);
1688      if (block_state.name.buf[0])
1689 <      conf->passwd = xstrdup(block_state.name.buf);
1689 >      conf->name = xstrdup(block_state.name.buf);
1690  
1691      conf->flags = block_state.flags.value;
1692      conf->port  = block_state.port.value;
# Line 1582 | Line 1694 | auth_entry: IRCD_AUTH
1694      conf_add_class_to_conf(conf, block_state.class.buf);
1695      add_conf_by_address(CONF_CLIENT, conf);
1696    }
1697 < };
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 ';' ;
1700 > auth_item:      auth_user |
1701 >                auth_passwd |
1702 >                auth_class |
1703 >                auth_flags |
1704 >                auth_spoof |
1705 >                auth_redir_serv |
1706 >                auth_redir_port |
1707 >                auth_encrypted |
1708 >                error ';' ;
1709  
1710   auth_user: USER '=' QSTRING ';'
1711   {
# Line 1621 | Line 1739 | auth_encrypted: ENCRYPTED '=' TBOOL ';'
1739   auth_flags: IRCD_FLAGS
1740   {
1741    if (conf_parser_ctx.pass == 2)
1742 <    block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
1742 >    block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1743   } '='  auth_flags_items ';';
1744  
1745   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
# Line 1637 | Line 1755 | auth_flags_item: SPOOF_NOTICE
1755   {
1756    if (conf_parser_ctx.pass == 2)
1757      block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1758 + } | XLINE_EXEMPT
1759 + {
1760 +  if (conf_parser_ctx.pass == 2)
1761 +    block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1762   } | NEED_IDENT
1763   {
1764    if (conf_parser_ctx.pass == 2)
# Line 1649 | Line 1771 | auth_flags_item: SPOOF_NOTICE
1771   {
1772    if (conf_parser_ctx.pass == 2)
1773      block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1652 } | GLINE_EXEMPT
1653 {
1654  if (conf_parser_ctx.pass == 2)
1655    block_state.flags.value |= CONF_FLAGS_EXEMPTGLINE;
1774   } | RESV_EXEMPT
1775   {
1776    if (conf_parser_ctx.pass == 2)
# Line 1667 | Line 1785 | auth_flags_item: SPOOF_NOTICE
1785      block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1786   };
1787  
1788 < auth_spoof: SPOOF '=' QSTRING ';'
1788 > auth_spoof: SPOOF '=' QSTRING ';'
1789   {
1790    if (conf_parser_ctx.pass != 2)
1791      break;
1792  
1793 <  if (strlen(yylval.string) <= HOSTLEN && valid_hostname(yylval.string))
1793 >  if (valid_hostname(yylval.string))
1794    {
1795      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1796      block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
# Line 1701 | Line 1819 | auth_redir_port: REDIRPORT '=' NUMBER ';
1819  
1820  
1821   /***************************************************************************
1822 < *  section resv
1822 > * resv {} section
1823   ***************************************************************************/
1824   resv_entry: RESV
1825   {
# Line 1712 | Line 1830 | resv_entry: RESV
1830    strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1831   } '{' resv_items '}' ';'
1832   {
1833 <  if (IsChanPrefix(block_state.name.buf[0]))
1834 <    create_channel_resv(block_state.name.buf, block_state.rpass.buf);
1835 <  else if (block_state.name.buf[0])
1836 <    create_nick_resv(block_state.name.buf, block_state.rpass.buf);
1833 >  if (conf_parser_ctx.pass != 2)
1834 >    break;
1835 >
1836 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1837   };
1838  
1839 < resv_items:     resv_items resv_item | resv_item;
1840 < resv_item:      resv_reason | resv_channel | resv_nick | error ';' ;
1839 > resv_items:     resv_items resv_item | resv_item;
1840 > resv_item:      resv_mask | resv_reason | resv_exempt | error ';' ;
1841  
1842 < resv_reason: REASON '=' QSTRING ';'
1842 > resv_mask: MASK '=' QSTRING ';'
1843   {
1844    if (conf_parser_ctx.pass == 2)
1845 <    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1845 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1846   };
1847  
1848 < resv_channel: CHANNEL '=' QSTRING ';'
1848 > resv_reason: REASON '=' QSTRING ';'
1849   {
1850    if (conf_parser_ctx.pass == 2)
1851 <    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1851 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1852   };
1853  
1854 < resv_nick: NICK '=' QSTRING ';'
1854 > resv_exempt: EXEMPT '=' QSTRING ';'
1855   {
1856    if (conf_parser_ctx.pass == 2)
1857 <    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1857 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1858   };
1859  
1860 +
1861   /***************************************************************************
1862 < *  section service
1862 > * service {} section
1863   ***************************************************************************/
1864   service_entry: T_SERVICE '{' service_items '}' ';';
1865  
# Line 1749 | Line 1868 | service_item:      service_name | error;
1868  
1869   service_name: NAME '=' QSTRING ';'
1870   {
1871 <  if (conf_parser_ctx.pass == 2)
1871 >  if (conf_parser_ctx.pass != 2)
1872 >    break;
1873 >
1874 >  if (valid_servname(yylval.string))
1875    {
1876 <    if (valid_servname(yylval.string))
1877 <    {
1756 <      struct MaskItem *conf = conf_make(CONF_SERVICE);
1757 <      conf->name = xstrdup(yylval.string);
1758 <    }
1876 >    struct ServiceItem *service = service_make();
1877 >    service->name = xstrdup(yylval.string);
1878    }
1879   };
1880  
1881 +
1882   /***************************************************************************
1883 < *  section shared, for sharing remote klines etc.
1883 > * shared {} section, for sharing remote klines etc.
1884   ***************************************************************************/
1885   shared_entry: T_SHARED
1886   {
# Line 1775 | Line 1895 | shared_entry: T_SHARED
1895    block_state.flags.value = SHARED_ALL;
1896   } '{' shared_items '}' ';'
1897   {
1778  struct MaskItem *conf = NULL;
1779
1898    if (conf_parser_ctx.pass != 2)
1899      break;
1900  
1901 <  conf = conf_make(CONF_ULINE);
1902 <  conf->flags = block_state.flags.value;
1903 <  conf->name = xstrdup(block_state.name.buf);
1904 <  conf->user = xstrdup(block_state.user.buf);
1905 <  conf->user = xstrdup(block_state.host.buf);
1901 >  struct SharedItem *shared = shared_make();
1902 >  shared->type = block_state.flags.value;
1903 >  shared->server = xstrdup(block_state.name.buf);
1904 >  shared->user = xstrdup(block_state.user.buf);
1905 >  shared->host = xstrdup(block_state.host.buf);
1906   };
1907  
1908   shared_items: shared_items shared_item | shared_item;
# Line 1864 | Line 1982 | shared_type_item: KLINE
1982      block_state.flags.value = SHARED_ALL;
1983   };
1984  
1985 +
1986   /***************************************************************************
1987 < *  section cluster
1987 > * cluster {} section
1988   ***************************************************************************/
1989   cluster_entry: T_CLUSTER
1990   {
# Line 1875 | Line 1994 | cluster_entry: T_CLUSTER
1994    reset_block_state();
1995  
1996    strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1997 <  block_state.flags.value = SHARED_ALL;
1997 >  block_state.flags.value = CLUSTER_ALL;
1998   } '{' cluster_items '}' ';'
1999   {
1881  struct MaskItem *conf = NULL;
1882
2000    if (conf_parser_ctx.pass != 2)
2001      break;
2002  
2003 <  conf = conf_make(CONF_CLUSTER);
2004 <  conf->flags = block_state.flags.value;
2005 <  conf->name = xstrdup(block_state.name.buf);
2003 >  struct ClusterItem *cluster = cluster_make();
2004 >  cluster->type = block_state.flags.value;
2005 >  cluster->server = xstrdup(block_state.name.buf);
2006   };
2007  
2008 < cluster_items:  cluster_items cluster_item | cluster_item;
2009 < cluster_item:   cluster_name | cluster_type | error ';' ;
2008 > cluster_items:  cluster_items cluster_item | cluster_item;
2009 > cluster_item:   cluster_name | cluster_type | error ';' ;
2010  
2011   cluster_name: NAME '=' QSTRING ';'
2012   {
# Line 1903 | Line 2020 | cluster_type: TYPE
2020      block_state.flags.value = 0;
2021   } '=' cluster_types ';' ;
2022  
2023 < cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2023 > cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
2024   cluster_type_item: KLINE
2025   {
2026    if (conf_parser_ctx.pass == 2)
2027 <    block_state.flags.value |= SHARED_KLINE;
2027 >    block_state.flags.value |= CLUSTER_KLINE;
2028   } | UNKLINE
2029   {
2030    if (conf_parser_ctx.pass == 2)
2031 <    block_state.flags.value |= SHARED_UNKLINE;
2031 >    block_state.flags.value |= CLUSTER_UNKLINE;
2032   } | T_DLINE
2033   {
2034    if (conf_parser_ctx.pass == 2)
2035 <    block_state.flags.value |= SHARED_DLINE;
2035 >    block_state.flags.value |= CLUSTER_DLINE;
2036   } | T_UNDLINE
2037   {
2038    if (conf_parser_ctx.pass == 2)
2039 <    block_state.flags.value |= SHARED_UNDLINE;
2039 >    block_state.flags.value |= CLUSTER_UNDLINE;
2040   } | XLINE
2041   {
2042    if (conf_parser_ctx.pass == 2)
2043 <    block_state.flags.value |= SHARED_XLINE;
2043 >    block_state.flags.value |= CLUSTER_XLINE;
2044   } | T_UNXLINE
2045   {
2046    if (conf_parser_ctx.pass == 2)
2047 <    block_state.flags.value |= SHARED_UNXLINE;
2047 >    block_state.flags.value |= CLUSTER_UNXLINE;
2048   } | RESV
2049   {
2050    if (conf_parser_ctx.pass == 2)
2051 <    block_state.flags.value |= SHARED_RESV;
2051 >    block_state.flags.value |= CLUSTER_RESV;
2052   } | T_UNRESV
2053   {
2054    if (conf_parser_ctx.pass == 2)
2055 <    block_state.flags.value |= SHARED_UNRESV;
2055 >    block_state.flags.value |= CLUSTER_UNRESV;
2056   } | T_LOCOPS
2057   {
2058    if (conf_parser_ctx.pass == 2)
2059 <    block_state.flags.value |= SHARED_LOCOPS;
2059 >    block_state.flags.value |= CLUSTER_LOCOPS;
2060   } | T_ALL
2061   {
2062    if (conf_parser_ctx.pass == 2)
2063 <    block_state.flags.value = SHARED_ALL;
2063 >    block_state.flags.value = CLUSTER_ALL;
2064   };
2065  
2066 +
2067   /***************************************************************************
2068 < *  section connect
2068 > * connect {}  section
2069   ***************************************************************************/
2070 < connect_entry: CONNECT  
2070 > connect_entry: CONNECT
2071   {
2072  
2073    if (conf_parser_ctx.pass != 2)
2074      break;
2075  
2076    reset_block_state();
2077 +  block_state.aftype.value = AF_INET;
2078    block_state.port.value = PORTNUM;
2079   } '{' connect_items '}' ';'
2080   {
# Line 1969 | Line 2088 | connect_entry: CONNECT
2088        !block_state.host.buf[0])
2089      break;
2090  
2091 <  if (!(block_state.rpass.buf[0] ||
2092 <        block_state.spass.buf[0]))
2091 >  if (!block_state.rpass.buf[0] ||
2092 >      !block_state.spass.buf[0])
2093      break;
2094  
2095    if (has_wildcards(block_state.name.buf) ||
# Line 1985 | Line 2104 | connect_entry: CONNECT
2104    conf->name = xstrdup(block_state.name.buf);
2105    conf->passwd = xstrdup(block_state.rpass.buf);
2106    conf->spasswd = xstrdup(block_state.spass.buf);
2107 <  conf->cipher_list = xstrdup(block_state.ciph.buf);
2107 >
2108 >  if (block_state.cert.buf[0])
2109 >    conf->certfp = xstrdup(block_state.cert.buf);
2110 >
2111 >  if (block_state.ciph.buf[0])
2112 >    conf->cipher_list = xstrdup(block_state.ciph.buf);
2113  
2114    dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2115    dlinkMoveList(&block_state.hub.list, &conf->hub_list);
# Line 2002 | Line 2126 | connect_entry: CONNECT
2126        ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2127      else
2128      {
2129 <      assert(res != NULL);
2129 >      assert(res);
2130  
2131        memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2132        conf->bind.ss.ss_family = res->ai_family;
# Line 2016 | Line 2140 | connect_entry: CONNECT
2140   };
2141  
2142   connect_items:  connect_items connect_item | connect_item;
2143 < connect_item:   connect_name | connect_host | connect_vhost |
2144 <                connect_send_password | connect_accept_password |
2145 <                connect_aftype | connect_port | connect_ssl_cipher_list |
2146 <                connect_flags | connect_hub_mask | connect_leaf_mask |
2147 <                connect_class | connect_encrypted |
2143 > connect_item:   connect_name |
2144 >                connect_host |
2145 >                connect_vhost |
2146 >                connect_send_password |
2147 >                connect_accept_password |
2148 >                connect_ssl_certificate_fingerprint |
2149 >                connect_aftype |
2150 >                connect_port |
2151 >                connect_ssl_cipher_list |
2152 >                connect_flags |
2153 >                connect_hub_mask |
2154 >                connect_leaf_mask |
2155 >                connect_class |
2156 >                connect_encrypted |
2157                  error ';' ;
2158  
2159   connect_name: NAME '=' QSTRING ';'
# Line 2029 | Line 2162 | connect_name: NAME '=' QSTRING ';'
2162      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2163   };
2164  
2165 < connect_host: HOST '=' QSTRING ';'
2165 > connect_host: HOST '=' QSTRING ';'
2166   {
2167    if (conf_parser_ctx.pass == 2)
2168      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2169   };
2170  
2171 < connect_vhost: VHOST '=' QSTRING ';'
2171 > connect_vhost: VHOST '=' QSTRING ';'
2172   {
2173    if (conf_parser_ctx.pass == 2)
2174      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2175   };
2176 <
2176 >
2177   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2178   {
2179    if (conf_parser_ctx.pass != 2)
# Line 2048 | Line 2181 | connect_send_password: SEND_PASSWORD '='
2181  
2182    if ($3[0] == ':')
2183      conf_error_report("Server passwords cannot begin with a colon");
2184 <  else if (strchr($3, ' ') != NULL)
2184 >  else if (strchr($3, ' '))
2185      conf_error_report("Server passwords cannot contain spaces");
2186    else
2187      strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
# Line 2061 | Line 2194 | connect_accept_password: ACCEPT_PASSWORD
2194  
2195    if ($3[0] == ':')
2196      conf_error_report("Server passwords cannot begin with a colon");
2197 <  else if (strchr($3, ' ') != NULL)
2197 >  else if (strchr($3, ' '))
2198      conf_error_report("Server passwords cannot contain spaces");
2199    else
2200      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2201   };
2202  
2203 + connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2204 + {
2205 +  if (conf_parser_ctx.pass == 2)
2206 +    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2207 + };
2208 +
2209   connect_port: PORT '=' NUMBER ';'
2210   {
2211    if (conf_parser_ctx.pass == 2)
# Line 2079 | Line 2218 | connect_aftype: AFTYPE '=' T_IPV4 ';'
2218      block_state.aftype.value = AF_INET;
2219   } | AFTYPE '=' T_IPV6 ';'
2220   {
2082 #ifdef IPV6
2221    if (conf_parser_ctx.pass == 2)
2222      block_state.aftype.value = AF_INET6;
2085 #endif
2223   };
2224  
2225   connect_flags: IRCD_FLAGS
# Line 2112 | Line 2249 | connect_encrypted: ENCRYPTED '=' TBOOL '
2249    }
2250   };
2251  
2252 < connect_hub_mask: HUB_MASK '=' QSTRING ';'
2252 > connect_hub_mask: HUB_MASK '=' QSTRING ';'
2253   {
2254    if (conf_parser_ctx.pass == 2)
2255      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2256   };
2257  
2258 < connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2258 > connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2259   {
2260    if (conf_parser_ctx.pass == 2)
2261      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
# Line 2132 | Line 2269 | connect_class: CLASS '=' QSTRING ';'
2269  
2270   connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2271   {
2272 < #ifdef HAVE_LIBCRYPTO
2272 > #ifdef HAVE_TLS
2273    if (conf_parser_ctx.pass == 2)
2274      strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2275   #else
2276    if (conf_parser_ctx.pass == 2)
2277 <    conf_error_report("Ignoring connect::ciphers -- no OpenSSL support");
2277 >    conf_error_report("Ignoring connect::ciphers -- no TLS support");
2278   #endif
2279   };
2280  
2281  
2282   /***************************************************************************
2283 < *  section kill
2283 > * kill {} section
2284   ***************************************************************************/
2285   kill_entry: KILL
2286   {
# Line 2160 | Line 2297 | kill_entry: KILL
2297        !block_state.host.buf[0])
2298      break;
2299  
2300 +  conf = conf_make(CONF_KLINE);
2301 +  conf->user = xstrdup(block_state.user.buf);
2302 +  conf->host = xstrdup(block_state.host.buf);
2303  
2304 <  if (block_state.port.value == 1)
2305 <  {
2166 < #ifdef HAVE_LIBPCRE
2167 <    void *exp_user = NULL;
2168 <    void *exp_host = NULL;
2169 <    const char *errptr = NULL;
2170 <
2171 <    if (!(exp_user = ircd_pcre_compile(block_state.user.buf, &errptr)) ||
2172 <        !(exp_host = ircd_pcre_compile(block_state.host.buf, &errptr)))
2173 <    {
2174 <      ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2175 <           errptr);
2176 <      break;
2177 <    }
2178 <
2179 <    conf = conf_make(CONF_RKLINE);
2180 <    conf->regexuser = exp_user;
2181 <    conf->regexhost = exp_host;
2182 <
2183 <    conf->user = xstrdup(block_state.user.buf);
2184 <    conf->host = xstrdup(block_state.host.buf);
2185 <
2186 <    if (block_state.rpass.buf[0])
2187 <      conf->reason = xstrdup(block_state.rpass.buf);
2188 <    else
2189 <      conf->reason = xstrdup(CONF_NOREASON);
2190 < #else
2191 <    ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2192 <    break;
2193 < #endif
2194 <  }
2304 >  if (block_state.rpass.buf[0])
2305 >    conf->reason = xstrdup(block_state.rpass.buf);
2306    else
2307 <  {
2308 <    conf = conf_make(CONF_KLINE);
2198 <
2199 <    conf->user = xstrdup(block_state.user.buf);
2200 <    conf->host = xstrdup(block_state.host.buf);
2201 <
2202 <    if (block_state.rpass.buf[0])
2203 <      conf->reason = xstrdup(block_state.rpass.buf);
2204 <    else
2205 <      conf->reason = xstrdup(CONF_NOREASON);
2206 <    add_conf_by_address(CONF_KLINE, conf);
2207 <  }
2208 < };
2209 <
2210 < kill_type: TYPE
2211 < {
2212 <  if (conf_parser_ctx.pass == 2)
2213 <    block_state.port.value = 0;
2214 < } '='  kill_type_items ';';
2215 <
2216 < kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2217 < kill_type_item: REGEX_T
2218 < {
2219 <  if (conf_parser_ctx.pass == 2)
2220 <    block_state.port.value = 1;
2307 >    conf->reason = xstrdup(CONF_NOREASON);
2308 >  add_conf_by_address(CONF_KLINE, conf);
2309   };
2310  
2311   kill_items:     kill_items kill_item | kill_item;
2312 < kill_item:      kill_user | kill_reason | kill_type | error;
2312 > kill_item:      kill_user | kill_reason | error;
2313  
2314   kill_user: USER '=' QSTRING ';'
2315   {
# Line 2243 | Line 2331 | kill_user: USER '=' QSTRING ';'
2331    }
2332   };
2333  
2334 < kill_reason: REASON '=' QSTRING ';'
2334 > kill_reason: REASON '=' QSTRING ';'
2335   {
2336    if (conf_parser_ctx.pass == 2)
2337      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2338   };
2339  
2340 +
2341   /***************************************************************************
2342 < *  section deny
2342 > * deny {} section
2343   ***************************************************************************/
2344 < deny_entry: DENY
2344 > deny_entry: DENY
2345   {
2346    if (conf_parser_ctx.pass == 2)
2347      reset_block_state();
# Line 2277 | Line 2366 | deny_entry: DENY
2366        conf->reason = xstrdup(CONF_NOREASON);
2367      add_conf_by_address(CONF_DLINE, conf);
2368    }
2369 < };
2369 > };
2370  
2371   deny_items:     deny_items deny_item | deny_item;
2372   deny_item:      deny_ip | deny_reason | error;
# Line 2288 | Line 2377 | deny_ip: IP '=' QSTRING ';'
2377      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2378   };
2379  
2380 < deny_reason: REASON '=' QSTRING ';'
2380 > deny_reason: REASON '=' QSTRING ';'
2381   {
2382    if (conf_parser_ctx.pass == 2)
2383      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2384   };
2385  
2386 +
2387   /***************************************************************************
2388 < *  section exempt
2388 > * exempt {} section
2389   ***************************************************************************/
2390   exempt_entry: EXEMPT '{' exempt_items '}' ';';
2391  
2392 < exempt_items:     exempt_items exempt_item | exempt_item;
2393 < exempt_item:      exempt_ip | error;
2392 > exempt_items: exempt_items exempt_item | exempt_item;
2393 > exempt_item:  exempt_ip | error;
2394  
2395   exempt_ip: IP '=' QSTRING ';'
2396   {
2397    if (conf_parser_ctx.pass == 2)
2398    {
2399 <    if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2399 >    if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2400      {
2401        struct MaskItem *conf = conf_make(CONF_EXEMPT);
2402        conf->host = xstrdup(yylval.string);
# Line 2317 | Line 2407 | exempt_ip: IP '=' QSTRING ';'
2407   };
2408  
2409   /***************************************************************************
2410 < *  section gecos
2410 > * gecos {} section
2411   ***************************************************************************/
2412   gecos_entry: GECOS
2413   {
# Line 2333 | Line 2423 | gecos_entry: GECOS
2423    if (!block_state.name.buf[0])
2424      break;
2425  
2426 <  if (block_state.port.value == 1)
2337 <  {
2338 < #ifdef HAVE_LIBPCRE
2339 <    void *exp_p = NULL;
2340 <    const char *errptr = NULL;
2341 <
2342 <    if (!(exp_p = ircd_pcre_compile(block_state.name.buf, &errptr)))
2343 <    {
2344 <      ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2345 <           errptr);
2346 <      break;
2347 <    }
2348 <
2349 <    conf = conf_make(CONF_RXLINE);
2350 <    conf->regexuser = exp_p;
2351 < #else
2352 <    conf_error_report("Failed to add regular expression based X-Line: no PCRE support");
2353 <    break;
2354 < #endif
2355 <  }
2356 <  else
2357 <    conf = conf_make(CONF_XLINE);
2358 <
2426 >  conf = conf_make(CONF_XLINE);
2427    conf->name = xstrdup(block_state.name.buf);
2428  
2429    if (block_state.rpass.buf[0])
# Line 2364 | Line 2432 | gecos_entry: GECOS
2432      conf->reason = xstrdup(CONF_NOREASON);
2433   };
2434  
2367 gecos_flags: TYPE
2368 {
2369  if (conf_parser_ctx.pass == 2)
2370    block_state.port.value = 0;
2371 } '='  gecos_flags_items ';';
2372
2373 gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2374 gecos_flags_item: REGEX_T
2375 {
2376  if (conf_parser_ctx.pass == 2)
2377    block_state.port.value = 1;
2378 };
2379
2435   gecos_items: gecos_items gecos_item | gecos_item;
2436 < gecos_item:  gecos_name | gecos_reason | gecos_flags | error;
2436 > gecos_item:  gecos_name | gecos_reason | error;
2437  
2438 < gecos_name: NAME '=' QSTRING ';'
2438 > gecos_name: NAME '=' QSTRING ';'
2439   {
2440    if (conf_parser_ctx.pass == 2)
2441      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2442   };
2443  
2444 < gecos_reason: REASON '=' QSTRING ';'
2444 > gecos_reason: REASON '=' QSTRING ';'
2445   {
2446    if (conf_parser_ctx.pass == 2)
2447      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2448   };
2449  
2450 +
2451   /***************************************************************************
2452 < *  section general
2452 > * general {} section
2453   ***************************************************************************/
2454 < general_entry: GENERAL
2399 <  '{' general_items '}' ';';
2454 > general_entry: GENERAL '{' general_items '}' ';';
2455  
2456   general_items:      general_items general_item | general_item;
2457 < general_item:       general_hide_spoof_ips | general_ignore_bogus_ts |
2458 <                    general_failed_oper_notice | general_anti_nick_flood |
2459 <                    general_max_nick_time | general_max_nick_changes |
2460 <                    general_max_accept | general_anti_spam_exit_message_time |
2461 <                    general_ts_warn_delta | general_ts_max_delta |
2457 > general_item:       general_away_count |
2458 >                    general_away_time |
2459 >                    general_ignore_bogus_ts |
2460 >                    general_failed_oper_notice |
2461 >                    general_anti_nick_flood |
2462 >                    general_max_nick_time |
2463 >                    general_max_nick_changes |
2464 >                    general_max_accept |
2465 >                    general_anti_spam_exit_message_time |
2466 >                    general_ts_warn_delta |
2467 >                    general_ts_max_delta |
2468                      general_kill_chase_time_limit |
2469                      general_invisible_on_connect |
2470 <                    general_warn_no_nline | general_dots_in_ident |
2471 <                    general_stats_o_oper_only | general_stats_k_oper_only |
2472 <                    general_pace_wait | general_stats_i_oper_only |
2473 <                    general_pace_wait_simple | general_stats_P_oper_only |
2474 <                    general_short_motd | general_no_oper_flood |
2475 <                    general_true_no_oper_flood | general_oper_pass_resv |
2476 <                    general_message_locale |
2477 <                    general_oper_only_umodes | general_max_targets |
2478 <                    general_use_egd | general_egdpool_path |
2479 <                    general_oper_umodes | general_caller_id_wait |
2480 <                    general_opers_bypass_callerid | general_default_floodcount |
2481 <                    general_min_nonwildcard | general_min_nonwildcard_simple |
2482 <                    general_disable_remote_commands |
2483 <                    general_throttle_time | general_havent_read_conf |
2470 >                    general_warn_no_connect_block |
2471 >                    general_dots_in_ident |
2472 >                    general_stats_i_oper_only |
2473 >                    general_stats_k_oper_only |
2474 >                    general_stats_m_oper_only |
2475 >                    general_stats_o_oper_only |
2476 >                    general_stats_P_oper_only |
2477 >                    general_stats_u_oper_only |
2478 >                    general_pace_wait |
2479 >                    general_pace_wait_simple |
2480 >                    general_short_motd |
2481 >                    general_no_oper_flood |
2482 >                    general_oper_only_umodes |
2483 >                    general_max_targets |
2484 >                    general_oper_umodes |
2485 >                    general_caller_id_wait |
2486 >                    general_opers_bypass_callerid |
2487 >                    general_default_floodcount |
2488 >                    general_min_nonwildcard |
2489 >                    general_min_nonwildcard_simple |
2490 >                    general_throttle_count |
2491 >                    general_throttle_time |
2492                      general_ping_cookie |
2493 <                    general_disable_auth |
2494 <                    general_tkline_expire_notices | general_gline_enable |
2495 <                    general_gline_duration | general_gline_request_duration |
2496 <                    general_gline_min_cidr |
2497 <                    general_gline_min_cidr6 |
2498 <                    general_stats_e_disabled |
2499 <                    general_max_watch | general_services_name |
2500 <                    error;
2493 >                    general_disable_auth |
2494 >                    general_tkline_expire_notices |
2495 >                    general_dline_min_cidr |
2496 >                    general_dline_min_cidr6 |
2497 >                    general_kline_min_cidr |
2498 >                    general_kline_min_cidr6 |
2499 >                    general_stats_e_disabled |
2500 >                    general_max_watch |
2501 >                    general_cycle_on_host_change |
2502 >                    error;
2503  
2504  
2505 < general_max_watch: MAX_WATCH '=' NUMBER ';'
2505 > general_away_count: AWAY_COUNT '=' NUMBER ';'
2506   {
2507 <  ConfigFileEntry.max_watch = $3;
2507 >  ConfigGeneral.away_count = $3;
2508   };
2509  
2510 < general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2510 > general_away_time: AWAY_TIME '=' timespec ';'
2511   {
2512 <  if (conf_parser_ctx.pass == 2)
2442 <    ConfigFileEntry.glines = yylval.number;
2512 >  ConfigGeneral.away_time = $3;
2513   };
2514  
2515 < general_gline_duration: GLINE_DURATION '=' timespec ';'
2515 > general_max_watch: MAX_WATCH '=' NUMBER ';'
2516   {
2517 <  if (conf_parser_ctx.pass == 2)
2448 <    ConfigFileEntry.gline_time = $3;
2517 >  ConfigGeneral.max_watch = $3;
2518   };
2519  
2520 < general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2520 > general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2521   {
2522    if (conf_parser_ctx.pass == 2)
2523 <    ConfigFileEntry.gline_request_time = $3;
2523 >    ConfigGeneral.cycle_on_host_change = yylval.number;
2524   };
2525  
2526 < general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2526 > general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2527   {
2528 <  ConfigFileEntry.gline_min_cidr = $3;
2528 >  ConfigGeneral.dline_min_cidr = $3;
2529   };
2530  
2531 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2531 > general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2532   {
2533 <  ConfigFileEntry.gline_min_cidr6 = $3;
2533 >  ConfigGeneral.dline_min_cidr6 = $3;
2534   };
2535  
2536 < general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2536 > general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2537   {
2538 <  ConfigFileEntry.tkline_expire_notices = yylval.number;
2538 >  ConfigGeneral.kline_min_cidr = $3;
2539   };
2540  
2541 < general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2541 > general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2542   {
2543 <  ConfigFileEntry.kill_chase_time_limit = $3;
2543 >  ConfigGeneral.kline_min_cidr6 = $3;
2544   };
2545  
2546 < general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2546 > general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2547   {
2548 <  ConfigFileEntry.hide_spoof_ips = yylval.number;
2548 >  ConfigGeneral.tkline_expire_notices = yylval.number;
2549   };
2550  
2551 < general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2551 > general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2552   {
2553 <  ConfigFileEntry.ignore_bogus_ts = yylval.number;
2553 >  ConfigGeneral.kill_chase_time_limit = $3;
2554   };
2555  
2556 < general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2556 > general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2557   {
2558 <  ConfigFileEntry.disable_remote = yylval.number;
2558 >  ConfigGeneral.ignore_bogus_ts = yylval.number;
2559   };
2560  
2561   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2562   {
2563 <  ConfigFileEntry.failed_oper_notice = yylval.number;
2563 >  ConfigGeneral.failed_oper_notice = yylval.number;
2564   };
2565  
2566   general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2567   {
2568 <  ConfigFileEntry.anti_nick_flood = yylval.number;
2568 >  ConfigGeneral.anti_nick_flood = yylval.number;
2569   };
2570  
2571   general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2572   {
2573 <  ConfigFileEntry.max_nick_time = $3;
2573 >  ConfigGeneral.max_nick_time = $3;
2574   };
2575  
2576   general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2577   {
2578 <  ConfigFileEntry.max_nick_changes = $3;
2578 >  ConfigGeneral.max_nick_changes = $3;
2579   };
2580  
2581   general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2582   {
2583 <  ConfigFileEntry.max_accept = $3;
2583 >  ConfigGeneral.max_accept = $3;
2584   };
2585  
2586   general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2587   {
2588 <  ConfigFileEntry.anti_spam_exit_message_time = $3;
2588 >  ConfigGeneral.anti_spam_exit_message_time = $3;
2589   };
2590  
2591   general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2592   {
2593 <  ConfigFileEntry.ts_warn_delta = $3;
2593 >  ConfigGeneral.ts_warn_delta = $3;
2594   };
2595  
2596   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2597   {
2598    if (conf_parser_ctx.pass == 2)
2599 <    ConfigFileEntry.ts_max_delta = $3;
2599 >    ConfigGeneral.ts_max_delta = $3;
2600   };
2601  
2602 < general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2602 > general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2603   {
2604 <  if (($3 > 0) && conf_parser_ctx.pass == 1)
2536 <  {
2537 <    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2538 <    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2539 <    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2540 <    exit(0);
2541 <  }
2604 >  ConfigGeneral.invisible_on_connect = yylval.number;
2605   };
2606  
2607 < general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2607 > general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2608   {
2609 <  ConfigFileEntry.invisible_on_connect = yylval.number;
2609 >  ConfigGeneral.warn_no_connect_block = yylval.number;
2610   };
2611  
2612 < general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';'
2612 > general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2613   {
2614 <  ConfigFileEntry.warn_no_nline = yylval.number;
2614 >  ConfigGeneral.stats_e_disabled = yylval.number;
2615   };
2616  
2617 < general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2617 > general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2618   {
2619 <  ConfigFileEntry.stats_e_disabled = yylval.number;
2619 >  ConfigGeneral.stats_m_oper_only = yylval.number;
2620   };
2621  
2622   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2623   {
2624 <  ConfigFileEntry.stats_o_oper_only = yylval.number;
2624 >  ConfigGeneral.stats_o_oper_only = yylval.number;
2625   };
2626  
2627   general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2628   {
2629 <  ConfigFileEntry.stats_P_oper_only = yylval.number;
2629 >  ConfigGeneral.stats_P_oper_only = yylval.number;
2630 > };
2631 >
2632 > general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2633 > {
2634 >  ConfigGeneral.stats_u_oper_only = yylval.number;
2635   };
2636  
2637   general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2638   {
2639 <  ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2639 >  ConfigGeneral.stats_k_oper_only = 2 * yylval.number;
2640   } | STATS_K_OPER_ONLY '=' TMASKED ';'
2641   {
2642 <  ConfigFileEntry.stats_k_oper_only = 1;
2642 >  ConfigGeneral.stats_k_oper_only = 1;
2643   };
2644  
2645   general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2646   {
2647 <  ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2647 >  ConfigGeneral.stats_i_oper_only = 2 * yylval.number;
2648   } | STATS_I_OPER_ONLY '=' TMASKED ';'
2649   {
2650 <  ConfigFileEntry.stats_i_oper_only = 1;
2650 >  ConfigGeneral.stats_i_oper_only = 1;
2651   };
2652  
2653   general_pace_wait: PACE_WAIT '=' timespec ';'
2654   {
2655 <  ConfigFileEntry.pace_wait = $3;
2655 >  ConfigGeneral.pace_wait = $3;
2656   };
2657  
2658   general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2659   {
2660 <  ConfigFileEntry.caller_id_wait = $3;
2660 >  ConfigGeneral.caller_id_wait = $3;
2661   };
2662  
2663   general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2664   {
2665 <  ConfigFileEntry.opers_bypass_callerid = yylval.number;
2665 >  ConfigGeneral.opers_bypass_callerid = yylval.number;
2666   };
2667  
2668   general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2669   {
2670 <  ConfigFileEntry.pace_wait_simple = $3;
2670 >  ConfigGeneral.pace_wait_simple = $3;
2671   };
2672  
2673   general_short_motd: SHORT_MOTD '=' TBOOL ';'
2674   {
2675 <  ConfigFileEntry.short_motd = yylval.number;
2608 < };
2609 <  
2610 < general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2611 < {
2612 <  ConfigFileEntry.no_oper_flood = yylval.number;
2613 < };
2614 <
2615 < general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2616 < {
2617 <  ConfigFileEntry.true_no_oper_flood = yylval.number;
2675 >  ConfigGeneral.short_motd = yylval.number;
2676   };
2677  
2678 < general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2678 > general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2679   {
2680 <  ConfigFileEntry.oper_pass_resv = yylval.number;
2623 < };
2624 <
2625 < general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
2626 < {
2627 <  if (conf_parser_ctx.pass == 2)
2628 <  {
2629 <    if (strlen(yylval.string) > LOCALE_LENGTH-2)
2630 <      yylval.string[LOCALE_LENGTH-1] = '\0';
2631 <
2632 <    set_locale(yylval.string);
2633 <  }
2680 >  ConfigGeneral.no_oper_flood = yylval.number;
2681   };
2682  
2683   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2684   {
2685 <  ConfigFileEntry.dots_in_ident = $3;
2685 >  ConfigGeneral.dots_in_ident = $3;
2686   };
2687  
2688   general_max_targets: MAX_TARGETS '=' NUMBER ';'
2689   {
2690 <  ConfigFileEntry.max_targets = $3;
2644 < };
2645 <
2646 < general_use_egd: USE_EGD '=' TBOOL ';'
2647 < {
2648 <  ConfigFileEntry.use_egd = yylval.number;
2649 < };
2650 <
2651 < general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2652 < {
2653 <  if (conf_parser_ctx.pass == 2)
2654 <  {
2655 <    MyFree(ConfigFileEntry.egdpool_path);
2656 <    ConfigFileEntry.egdpool_path = xstrdup(yylval.string);
2657 <  }
2690 >  ConfigGeneral.max_targets = $3;
2691   };
2692  
2693 < general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2693 > general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2694   {
2695 <  if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2663 <  {
2664 <    MyFree(ConfigFileEntry.service_name);
2665 <    ConfigFileEntry.service_name = xstrdup(yylval.string);
2666 <  }
2695 >  ConfigGeneral.ping_cookie = yylval.number;
2696   };
2697  
2698 < general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2698 > general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2699   {
2700 <  ConfigFileEntry.ping_cookie = yylval.number;
2700 >  ConfigGeneral.disable_auth = yylval.number;
2701   };
2702  
2703 < general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2703 > general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2704   {
2705 <  ConfigFileEntry.disable_auth = yylval.number;
2705 >  ConfigGeneral.throttle_count = $3;
2706   };
2707  
2708   general_throttle_time: THROTTLE_TIME '=' timespec ';'
2709   {
2710 <  ConfigFileEntry.throttle_time = yylval.number;
2710 >  ConfigGeneral.throttle_time = $3;
2711   };
2712  
2713   general_oper_umodes: OPER_UMODES
2714   {
2715 <  ConfigFileEntry.oper_umodes = 0;
2715 >  ConfigGeneral.oper_umodes = 0;
2716   } '='  umode_oitems ';' ;
2717  
2718   umode_oitems:    umode_oitems ',' umode_oitem | umode_oitem;
2719   umode_oitem:     T_BOTS
2720   {
2721 <  ConfigFileEntry.oper_umodes |= UMODE_BOTS;
2721 >  ConfigGeneral.oper_umodes |= UMODE_BOTS;
2722   } | T_CCONN
2723   {
2724 <  ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2696 < } | T_CCONN_FULL
2697 < {
2698 <  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
2724 >  ConfigGeneral.oper_umodes |= UMODE_CCONN;
2725   } | T_DEAF
2726   {
2727 <  ConfigFileEntry.oper_umodes |= UMODE_DEAF;
2727 >  ConfigGeneral.oper_umodes |= UMODE_DEAF;
2728   } | T_DEBUG
2729   {
2730 <  ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
2730 >  ConfigGeneral.oper_umodes |= UMODE_DEBUG;
2731   } | T_FULL
2732   {
2733 <  ConfigFileEntry.oper_umodes |= UMODE_FULL;
2733 >  ConfigGeneral.oper_umodes |= UMODE_FULL;
2734   } | HIDDEN
2735   {
2736 <  ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2736 >  ConfigGeneral.oper_umodes |= UMODE_HIDDEN;
2737 > } | HIDE_CHANS
2738 > {
2739 >  ConfigGeneral.oper_umodes |= UMODE_HIDECHANS;
2740 > } | HIDE_IDLE
2741 > {
2742 >  ConfigGeneral.oper_umodes |= UMODE_HIDEIDLE;
2743   } | T_SKILL
2744   {
2745 <  ConfigFileEntry.oper_umodes |= UMODE_SKILL;
2745 >  ConfigGeneral.oper_umodes |= UMODE_SKILL;
2746   } | T_NCHANGE
2747   {
2748 <  ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
2748 >  ConfigGeneral.oper_umodes |= UMODE_NCHANGE;
2749   } | T_REJ
2750   {
2751 <  ConfigFileEntry.oper_umodes |= UMODE_REJ;
2751 >  ConfigGeneral.oper_umodes |= UMODE_REJ;
2752   } | T_UNAUTH
2753   {
2754 <  ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
2754 >  ConfigGeneral.oper_umodes |= UMODE_UNAUTH;
2755   } | T_SPY
2756   {
2757 <  ConfigFileEntry.oper_umodes |= UMODE_SPY;
2757 >  ConfigGeneral.oper_umodes |= UMODE_SPY;
2758   } | T_EXTERNAL
2759   {
2760 <  ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
2729 < } | T_OPERWALL
2730 < {
2731 <  ConfigFileEntry.oper_umodes |= UMODE_OPERWALL;
2760 >  ConfigGeneral.oper_umodes |= UMODE_EXTERNAL;
2761   } | T_SERVNOTICE
2762   {
2763 <  ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
2763 >  ConfigGeneral.oper_umodes |= UMODE_SERVNOTICE;
2764   } | T_INVISIBLE
2765   {
2766 <  ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
2766 >  ConfigGeneral.oper_umodes |= UMODE_INVISIBLE;
2767   } | T_WALLOP
2768   {
2769 <  ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
2769 >  ConfigGeneral.oper_umodes |= UMODE_WALLOP;
2770   } | T_SOFTCALLERID
2771   {
2772 <  ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
2772 >  ConfigGeneral.oper_umodes |= UMODE_SOFTCALLERID;
2773   } | T_CALLERID
2774   {
2775 <  ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
2775 >  ConfigGeneral.oper_umodes |= UMODE_CALLERID;
2776   } | T_LOCOPS
2777   {
2778 <  ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2778 >  ConfigGeneral.oper_umodes |= UMODE_LOCOPS;
2779 > } | T_NONONREG
2780 > {
2781 >  ConfigGeneral.oper_umodes |= UMODE_REGONLY;
2782 > } | T_FARCONNECT
2783 > {
2784 >  ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2785   };
2786  
2787 < general_oper_only_umodes: OPER_ONLY_UMODES
2787 > general_oper_only_umodes: OPER_ONLY_UMODES
2788   {
2789 <  ConfigFileEntry.oper_only_umodes = 0;
2789 >  ConfigGeneral.oper_only_umodes = 0;
2790   } '='  umode_items ';' ;
2791  
2792 < umode_items:    umode_items ',' umode_item | umode_item;
2793 < umode_item:     T_BOTS
2792 > umode_items:  umode_items ',' umode_item | umode_item;
2793 > umode_item:   T_BOTS
2794   {
2795 <  ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2795 >  ConfigGeneral.oper_only_umodes |= UMODE_BOTS;
2796   } | T_CCONN
2797   {
2798 <  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2764 < } | T_CCONN_FULL
2765 < {
2766 <  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
2798 >  ConfigGeneral.oper_only_umodes |= UMODE_CCONN;
2799   } | T_DEAF
2800   {
2801 <  ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
2801 >  ConfigGeneral.oper_only_umodes |= UMODE_DEAF;
2802   } | T_DEBUG
2803   {
2804 <  ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2804 >  ConfigGeneral.oper_only_umodes |= UMODE_DEBUG;
2805   } | T_FULL
2806 < {
2807 <  ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2806 > {
2807 >  ConfigGeneral.oper_only_umodes |= UMODE_FULL;
2808   } | T_SKILL
2809   {
2810 <  ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2810 >  ConfigGeneral.oper_only_umodes |= UMODE_SKILL;
2811   } | HIDDEN
2812   {
2813 <  ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
2813 >  ConfigGeneral.oper_only_umodes |= UMODE_HIDDEN;
2814   } | T_NCHANGE
2815   {
2816 <  ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
2816 >  ConfigGeneral.oper_only_umodes |= UMODE_NCHANGE;
2817   } | T_REJ
2818   {
2819 <  ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
2819 >  ConfigGeneral.oper_only_umodes |= UMODE_REJ;
2820   } | T_UNAUTH
2821   {
2822 <  ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
2822 >  ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH;
2823   } | T_SPY
2824   {
2825 <  ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
2825 >  ConfigGeneral.oper_only_umodes |= UMODE_SPY;
2826   } | T_EXTERNAL
2827   {
2828 <  ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
2797 < } | T_OPERWALL
2798 < {
2799 <  ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL;
2828 >  ConfigGeneral.oper_only_umodes |= UMODE_EXTERNAL;
2829   } | T_SERVNOTICE
2830   {
2831 <  ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
2831 >  ConfigGeneral.oper_only_umodes |= UMODE_SERVNOTICE;
2832   } | T_INVISIBLE
2833   {
2834 <  ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
2834 >  ConfigGeneral.oper_only_umodes |= UMODE_INVISIBLE;
2835   } | T_WALLOP
2836   {
2837 <  ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
2837 >  ConfigGeneral.oper_only_umodes |= UMODE_WALLOP;
2838   } | T_SOFTCALLERID
2839   {
2840 <  ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
2840 >  ConfigGeneral.oper_only_umodes |= UMODE_SOFTCALLERID;
2841   } | T_CALLERID
2842   {
2843 <  ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
2843 >  ConfigGeneral.oper_only_umodes |= UMODE_CALLERID;
2844   } | T_LOCOPS
2845   {
2846 <  ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
2846 >  ConfigGeneral.oper_only_umodes |= UMODE_LOCOPS;
2847 > } | T_NONONREG
2848 > {
2849 >  ConfigGeneral.oper_only_umodes |= UMODE_REGONLY;
2850 > } | T_FARCONNECT
2851 > {
2852 >  ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2853   };
2854  
2855   general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2856   {
2857 <  ConfigFileEntry.min_nonwildcard = $3;
2857 >  ConfigGeneral.min_nonwildcard = $3;
2858   };
2859  
2860   general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2861   {
2862 <  ConfigFileEntry.min_nonwildcard_simple = $3;
2862 >  ConfigGeneral.min_nonwildcard_simple = $3;
2863   };
2864  
2865   general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2866   {
2867 <  ConfigFileEntry.default_floodcount = $3;
2867 >  ConfigGeneral.default_floodcount = $3;
2868   };
2869  
2870  
2871   /***************************************************************************
2872 < *  section channel
2872 > * channel {} section
2873   ***************************************************************************/
2874 < channel_entry: CHANNEL
2840 <  '{' channel_items '}' ';';
2874 > channel_entry: CHANNEL '{' channel_items '}' ';';
2875  
2876   channel_items:      channel_items channel_item | channel_item;
2877   channel_item:       channel_max_bans |
2878 <                    channel_knock_delay | channel_knock_delay_channel |
2879 <                    channel_max_chans_per_user | channel_max_chans_per_oper |
2880 <                    channel_quiet_on_ban | channel_default_split_user_count |
2881 <                    channel_default_split_server_count |
2882 <                    channel_no_create_on_split | channel_restrict_channels |
2883 <                    channel_no_join_on_split |
2884 <                    channel_jflood_count | channel_jflood_time |
2885 <                    channel_disable_fake_channels | error;
2878 >                    channel_invite_client_count |
2879 >                    channel_invite_client_time |
2880 >                    channel_invite_delay_channel |
2881 >                    channel_knock_client_count |
2882 >                    channel_knock_client_time |
2883 >                    channel_knock_delay_channel |
2884 >                    channel_max_channels |
2885 >                    channel_default_join_flood_count |
2886 >                    channel_default_join_flood_time |
2887 >                    channel_disable_fake_channels |
2888 >                    error;
2889  
2890   channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2891   {
2892    ConfigChannel.disable_fake_channels = yylval.number;
2893   };
2894  
2895 < channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
2895 > channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2896   {
2897 <  ConfigChannel.restrict_channels = yylval.number;
2897 >  ConfigChannel.invite_client_count = $3;
2898   };
2899  
2900 < channel_knock_delay: KNOCK_DELAY '=' timespec ';'
2900 > channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2901   {
2902 <  ConfigChannel.knock_delay = $3;
2902 >  ConfigChannel.invite_client_time = $3;
2903   };
2904  
2905 < channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
2869 < {
2870 <  ConfigChannel.knock_delay_channel = $3;
2871 < };
2872 <
2873 < channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
2905 > channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2906   {
2907 <  ConfigChannel.max_chans_per_user = $3;
2907 >  ConfigChannel.invite_delay_channel = $3;
2908   };
2909  
2910 < channel_max_chans_per_oper: MAX_CHANS_PER_OPER '=' NUMBER ';'
2910 > channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2911   {
2912 <  ConfigChannel.max_chans_per_oper = $3;
2912 >  ConfigChannel.knock_client_count = $3;
2913   };
2914  
2915 < channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
2915 > channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2916   {
2917 <  ConfigChannel.quiet_on_ban = yylval.number;
2917 >  ConfigChannel.knock_client_time = $3;
2918   };
2919  
2920 < channel_max_bans: MAX_BANS '=' NUMBER ';'
2889 < {
2890 <  ConfigChannel.max_bans = $3;
2891 < };
2892 <
2893 < channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2920 > channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
2921   {
2922 <  ConfigChannel.default_split_user_count = $3;
2922 >  ConfigChannel.knock_delay_channel = $3;
2923   };
2924  
2925 < channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2925 > channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
2926   {
2927 <  ConfigChannel.default_split_server_count = $3;
2927 >  ConfigChannel.max_channels = $3;
2928   };
2929  
2930 < channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
2930 > channel_max_bans: MAX_BANS '=' NUMBER ';'
2931   {
2932 <  ConfigChannel.no_create_on_split = yylval.number;
2932 >  ConfigChannel.max_bans = $3;
2933   };
2934  
2935 < channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2935 > channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2936   {
2937 <  ConfigChannel.no_join_on_split = yylval.number;
2937 >  ConfigChannel.default_join_flood_count = yylval.number;
2938   };
2939  
2940 < channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2940 > channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2941   {
2942 <  GlobalSetOptions.joinfloodcount = yylval.number;
2942 >  ConfigChannel.default_join_flood_time = $3;
2943   };
2944  
2918 channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
2919 {
2920  GlobalSetOptions.joinfloodtime = yylval.number;
2921 };
2945  
2946   /***************************************************************************
2947 < *  section serverhide
2947 > * serverhide {} section
2948   ***************************************************************************/
2949 < serverhide_entry: SERVERHIDE
2927 <  '{' serverhide_items '}' ';';
2949 > serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2950  
2951   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2952 < serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
2953 <                    serverhide_links_delay |
2954 <                    serverhide_hidden | serverhide_hidden_name |
2955 <                    serverhide_hide_server_ips |
2952 > serverhide_item:    serverhide_flatten_links |
2953 >                    serverhide_flatten_links_delay |
2954 >                    serverhide_flatten_links_file |
2955 >                    serverhide_disable_remote_commands |
2956 >                    serverhide_hide_servers |
2957 >                    serverhide_hide_services |
2958 >                    serverhide_hidden |
2959 >                    serverhide_hidden_name |
2960 >                    serverhide_hide_server_ips |
2961                      error;
2962  
2963   serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
# Line 2939 | Line 2966 | serverhide_flatten_links: FLATTEN_LINKS
2966      ConfigServerHide.flatten_links = yylval.number;
2967   };
2968  
2969 < serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
2969 > serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2970   {
2971    if (conf_parser_ctx.pass == 2)
2972 <    ConfigServerHide.hide_servers = yylval.number;
2972 >  {
2973 >    if ($3 > 0)
2974 >    {
2975 >      event_write_links_file.when = $3;
2976 >      event_add(&event_write_links_file, NULL);
2977 >    }
2978 >    else
2979 >     event_delete(&event_write_links_file);
2980 >
2981 >    ConfigServerHide.flatten_links_delay = $3;
2982 >  }
2983   };
2984  
2985 < serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
2985 > serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
2986   {
2987    if (conf_parser_ctx.pass == 2)
2988    {
2989 <    MyFree(ConfigServerHide.hidden_name);
2990 <    ConfigServerHide.hidden_name = xstrdup(yylval.string);
2989 >    xfree(ConfigServerHide.flatten_links_file);
2990 >    ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
2991    }
2992   };
2993  
2994 < serverhide_links_delay: LINKS_DELAY '=' timespec ';'
2994 > serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2995   {
2996    if (conf_parser_ctx.pass == 2)
2997 <  {
2998 <    if (($3 > 0) && ConfigServerHide.links_disabled == 1)
2999 <    {
3000 <      eventAddIsh("write_links_file", write_links_file, NULL, $3);
3001 <      ConfigServerHide.links_disabled = 0;
3002 <    }
2997 >    ConfigServerHide.disable_remote_commands = yylval.number;
2998 > };
2999 >
3000 > serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3001 > {
3002 >  if (conf_parser_ctx.pass == 2)
3003 >    ConfigServerHide.hide_servers = yylval.number;
3004 > };
3005  
3006 <    ConfigServerHide.links_delay = $3;
3006 > serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
3007 > {
3008 >  if (conf_parser_ctx.pass == 2)
3009 >    ConfigServerHide.hide_services = yylval.number;
3010 > };
3011 >
3012 > serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3013 > {
3014 >  if (conf_parser_ctx.pass == 2)
3015 >  {
3016 >    xfree(ConfigServerHide.hidden_name);
3017 >    ConfigServerHide.hidden_name = xstrdup(yylval.string);
3018    }
3019   };
3020  

Diff Legend

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