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 1753 by michael, Wed Jan 16 19:30:51 2013 UTC vs.
Revision 8792 by michael, Thu Jan 17 18:35:32 2019 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-2019 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"
32   #include "ircd.h"
33   #include "list.h"
34 + #include "parse.h"
35   #include "conf.h"
36   #include "conf_class.h"
37 + #include "conf_cluster.h"
38 + #include "conf_gecos.h"
39 + #include "conf_pseudo.h"
40 + #include "conf_resv.h"
41 + #include "conf_service.h"
42 + #include "conf_shared.h"
43   #include "event.h"
44 + #include "id.h"
45   #include "log.h"
39 #include "client.h"     /* for UMODE_ALL only */
46   #include "irc_string.h"
41 #include "sprintf_irc.h"
47   #include "memory.h"
48   #include "modules.h"
49 < #include "s_serv.h"
49 > #include "server.h"
50   #include "hostmask.h"
46 #include "send.h"
51   #include "listener.h"
52 < #include "resv.h"
53 < #include "numeric.h"
50 < #include "s_user.h"
51 <
52 < #ifdef HAVE_LIBCRYPTO
53 < #include <openssl/rsa.h>
54 < #include <openssl/bio.h>
55 < #include <openssl/pem.h>
56 < #include <openssl/dh.h>
57 < #endif
58 <
59 < #include "rsa.h"
52 > #include "user.h"
53 > #include "motd.h"
54  
55   int yylex(void);
56  
57   static struct
58   {
59 <  struct {
59 >  struct
60 >  {
61      dlink_list list;
62    } mask,
63      leaf,
64      hub;
65  
66 <  struct {
66 >  struct
67 >  {
68      char buf[IRCD_BUFSIZE];
69    } name,
70 +    nick,
71      user,
72      host,
73      addr,
74      bind,
75      file,
76      ciph,
77 +    cert,
78      rpass,
79      spass,
80 <    class;
80 >    whois,
81 >    class,
82 >    target,
83 >    prepend,
84 >    command;
85  
86 <  struct {
86 >  struct
87 >  {
88      unsigned int value;
89    } flags,
90      modes,
# Line 90 | Line 93 | static struct
93      port,
94      aftype,
95      ping_freq,
96 <    max_perip,
96 >    max_perip_local,
97 >    max_perip_global,
98      con_freq,
99 +    min_idle,
100 +    max_idle,
101      max_total,
96    max_global,
97    max_local,
98    max_ident,
102      max_sendq,
103      max_recvq,
104 +    max_channels,
105      cidr_bitlen_ipv4,
106      cidr_bitlen_ipv6,
107      number_per_cidr;
# Line 106 | 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 145 | 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  CIDR_BITLEN_IPV4
159 > %token  CIDR_BITLEN_IPV6
160   %token  CLASS
161 + %token  CLOSE
162   %token  CONNECT
163   %token  CONNECTFREQ
164 + %token  CYCLE_ON_HOST_CHANGE
165   %token  DEFAULT_FLOODCOUNT
166 < %token  DEFAULT_SPLIT_SERVER_COUNT
167 < %token  DEFAULT_SPLIT_USER_COUNT
166 > %token  DEFAULT_FLOODTIME
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
167 %token  EGDPOOL_PATH
179   %token  EMAIL
180   %token  ENCRYPTED
181   %token  EXCEED_LIMIT
182   %token  EXEMPT
183   %token  FAILED_OPER_NOTICE
173 %token  IRCD_FLAGS
184   %token  FLATTEN_LINKS
185 + %token  FLATTEN_LINKS_DELAY
186 + %token  FLATTEN_LINKS_FILE
187   %token  GECOS
188   %token  GENERAL
177 %token  GLINE
178 %token  GLINE_DURATION
179 %token  GLINE_ENABLE
180 %token  GLINE_EXEMPT
181 %token  GLINE_REQUEST_DURATION
182 %token  GLINE_MIN_CIDR
183 %token  GLINE_MIN_CIDR6
184 %token  GLOBAL_KILL
185 %token  IRCD_AUTH
186 %token  NEED_IDENT
187 %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
196 %token  IGNORE_BOGUS_TS
200   %token  INVISIBLE_ON_CONNECT
201 + %token  INVITE_CLIENT_COUNT
202 + %token  INVITE_CLIENT_TIME
203 + %token  INVITE_DELAY_CHANNEL
204 + %token  INVITE_EXPIRE_TIME
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
206 %token  LINKS_DELAY
220   %token  LISTEN
221 < %token  T_LOG
221 > %token  MASK
222   %token  MAX_ACCEPT
223   %token  MAX_BANS
224 < %token  MAX_CHANS_PER_OPER
225 < %token  MAX_CHANS_PER_USER
226 < %token  MAX_GLOBAL
227 < %token  MAX_IDENT
215 < %token  MAX_LOCAL
224 > %token  MAX_BANS_LARGE
225 > %token  MAX_CHANNELS
226 > %token  MAX_IDLE
227 > %token  MAX_INVITES
228   %token  MAX_NICK_CHANGES
229   %token  MAX_NICK_LENGTH
230   %token  MAX_NICK_TIME
# Line 220 | Line 232 | reset_block_state(void)
232   %token  MAX_TARGETS
233   %token  MAX_TOPIC_LENGTH
234   %token  MAX_WATCH
235 < %token  MESSAGE_LOCALE
235 > %token  MIN_IDLE
236   %token  MIN_NONWILDCARD
237   %token  MIN_NONWILDCARD_SIMPLE
238   %token  MODULE
239   %token  MODULES
240 + %token  MOTD
241   %token  NAME
242 + %token  NEED_IDENT
243   %token  NEED_PASSWORD
244   %token  NETWORK_DESC
245   %token  NETWORK_NAME
246   %token  NICK
233 %token  NICK_CHANGES
234 %token  NO_CREATE_ON_SPLIT
235 %token  NO_JOIN_ON_SPLIT
247   %token  NO_OPER_FLOOD
248   %token  NO_TILDE
249   %token  NUMBER
250   %token  NUMBER_PER_CIDR
251 < %token  NUMBER_PER_IP
252 < %token  OPERATOR
242 < %token  OPERS_BYPASS_CALLERID
251 > %token  NUMBER_PER_IP_GLOBAL
252 > %token  NUMBER_PER_IP_LOCAL
253   %token  OPER_ONLY_UMODES
244 %token  OPER_PASS_RESV
245 %token  OPER_SPY_T
254   %token  OPER_UMODES
255 < %token  JOIN_FLOOD_COUNT
256 < %token  JOIN_FLOOD_TIME
255 > %token  OPERATOR
256 > %token  OPERS_BYPASS_CALLERID
257   %token  PACE_WAIT
258   %token  PACE_WAIT_SIMPLE
259   %token  PASSWORD
# Line 254 | Line 262 | reset_block_state(void)
262   %token  PING_TIME
263   %token  PORT
264   %token  QSTRING
265 < %token  QUIET_ON_BAN
265 > %token  RANDOM_IDLE
266   %token  REASON
267   %token  REDIRPORT
268   %token  REDIRSERV
261 %token  REGEX_T
269   %token  REHASH
270   %token  REMOTE
271   %token  REMOTEBAN
265 %token  RESTRICT_CHANNELS
266 %token  RSA_PRIVATE_KEY_FILE
267 %token  RSA_PUBLIC_KEY_FILE
268 %token  SSL_CERTIFICATE_FILE
269 %token  SSL_DH_PARAM_FILE
270 %token  T_SSL_CLIENT_METHOD
271 %token  T_SSL_SERVER_METHOD
272 %token  T_SSLV3
273 %token  T_TLSV1
272   %token  RESV
273   %token  RESV_EXEMPT
274 < %token  SECONDS MINUTES HOURS DAYS WEEKS
275 < %token  SENDQ
274 > %token  RSA_PRIVATE_KEY_FILE
275 > %token  SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
276   %token  SEND_PASSWORD
277 + %token  SENDQ
278   %token  SERVERHIDE
279   %token  SERVERINFO
281 %token  IRCD_SID
282 %token  TKLINE_EXPIRE_NOTICES
283 %token  T_SHARED
284 %token  T_CLUSTER
285 %token  TYPE
280   %token  SHORT_MOTD
281   %token  SPOOF
282   %token  SPOOF_NOTICE
283 + %token  SQUIT
284 + %token  SSL_CERTIFICATE_FILE
285 + %token  SSL_CERTIFICATE_FINGERPRINT
286 + %token  SSL_CONNECTION_REQUIRED
287 + %token  SSL_DH_ELLIPTIC_CURVE
288 + %token  SSL_DH_PARAM_FILE
289 + %token  SSL_MESSAGE_DIGEST_ALGORITHM
290   %token  STATS_E_DISABLED
291   %token  STATS_I_OPER_ONLY
292   %token  STATS_K_OPER_ONLY
293 + %token  STATS_M_OPER_ONLY
294   %token  STATS_O_OPER_ONLY
295   %token  STATS_P_OPER_ONLY
296 < %token  TBOOL
295 < %token  TMASKED
296 < %token  TS_MAX_DELTA
297 < %token  TS_WARN_DELTA
298 < %token  TWODOTS
296 > %token  STATS_U_OPER_ONLY
297   %token  T_ALL
298   %token  T_BOTS
301 %token  T_SOFTCALLERID
299   %token  T_CALLERID
300   %token  T_CCONN
301 < %token  T_CCONN_FULL
302 < %token  T_SSL_CIPHER_LIST
301 > %token  T_COMMAND
302 > %token  T_CLUSTER
303   %token  T_DEAF
304   %token  T_DEBUG
305   %token  T_DLINE
306   %token  T_EXTERNAL
307 + %token  T_FARCONNECT
308 + %token  T_FILE
309   %token  T_FULL
310 + %token  T_GLOBOPS
311   %token  T_INVISIBLE
312   %token  T_IPV4
313   %token  T_IPV6
314   %token  T_LOCOPS
315 < %token  T_MAX_CLIENTS
315 > %token  T_LOG
316   %token  T_NCHANGE
317 < %token  T_OPERWALL
317 > %token  T_NONONREG
318 > %token  T_OPME
319 > %token  T_PREPEND
320 > %token  T_PSEUDO
321   %token  T_RECVQ
322   %token  T_REJ
323 + %token  T_RESTART
324   %token  T_SERVER
325 + %token  T_SERVICE
326   %token  T_SERVNOTICE
327   %token  T_SET
328 + %token  T_SHARED
329 + %token  T_SIZE
330   %token  T_SKILL
331 + %token  T_SOFTCALLERID
332   %token  T_SPY
333   %token  T_SSL
334 + %token  T_SSL_CIPHER_LIST
335 + %token  T_TARGET
336   %token  T_UMODES
337   %token  T_UNAUTH
338   %token  T_UNDLINE
339   %token  T_UNLIMITED
340   %token  T_UNRESV
341   %token  T_UNXLINE
332 %token  T_GLOBOPS
342   %token  T_WALLOP
343 + %token  T_WALLOPS
344   %token  T_WEBIRC
345 < %token  T_RESTART
346 < %token  T_SERVICE
337 < %token  T_SERVICES_NAME
345 > %token  TBOOL
346 > %token  THROTTLE_COUNT
347   %token  THROTTLE_TIME
348 < %token  TRUE_NO_OPER_FLOOD
348 > %token  TKLINE_EXPIRE_NOTICES
349 > %token  TMASKED
350 > %token  TS_MAX_DELTA
351 > %token  TS_WARN_DELTA
352 > %token  TWODOTS
353 > %token  TYPE
354   %token  UNKLINE
341 %token  USER
342 %token  USE_EGD
355   %token  USE_LOGGING
356 + %token  USER
357   %token  VHOST
358   %token  VHOST6
359 + %token  WARN_NO_CONNECT_BLOCK
360 + %token  WHOIS
361 + %token  WHOWAS_HISTORY_LENGTH
362   %token  XLINE
363 < %token  WARN_NO_NLINE
348 < %token  T_SIZE
349 < %token  T_FILE
363 > %token  XLINE_EXEMPT
364  
365 < %type <string> QSTRING
366 < %type <number> NUMBER
367 < %type <number> timespec
368 < %type <number> timespec_
369 < %type <number> sizespec
370 < %type <number> sizespec_
365 > %type  <string> QSTRING
366 > %type  <number> NUMBER
367 > %type  <number> timespec
368 > %type  <number> timespec_
369 > %type  <number> sizespec
370 > %type  <number> sizespec_
371  
372   %%
373 < conf:  
373 > conf:
374          | conf conf_item
375          ;
376  
377   conf_item:        admin_entry
378                  | logging_entry
379                  | oper_entry
380 <                | channel_entry
381 <                | class_entry
380 >                | channel_entry
381 >                | class_entry
382                  | listen_entry
383                  | auth_entry
384                  | serverinfo_entry
385 <                | serverhide_entry
385 >                | serverhide_entry
386                  | resv_entry
387                  | service_entry
388                  | shared_entry
389 <                | cluster_entry
389 >                | cluster_entry
390                  | connect_entry
391                  | kill_entry
392                  | deny_entry
393 <                | exempt_entry
394 <                | general_entry
393 >                | exempt_entry
394 >                | general_entry
395                  | gecos_entry
396                  | modules_entry
397 +                | motd_entry
398 +                | pseudo_entry
399                  | error ';'
400                  | error '}'
401          ;
402  
403  
404   timespec_: { $$ = 0; } | timespec;
405 < timespec:       NUMBER timespec_
406 <                {
407 <                        $$ = $1 + $2;
408 <                }
409 <                | NUMBER SECONDS timespec_
410 <                {
411 <                        $$ = $1 + $3;
412 <                }
413 <                | NUMBER MINUTES timespec_
414 <                {
415 <                        $$ = $1 * 60 + $3;
416 <                }
417 <                | NUMBER HOURS timespec_
418 <                {
419 <                        $$ = $1 * 60 * 60 + $3;
420 <                }
405 <                | NUMBER DAYS timespec_
406 <                {
407 <                        $$ = $1 * 60 * 60 * 24 + $3;
408 <                }
409 <                | NUMBER WEEKS timespec_
410 <                {
411 <                        $$ = $1 * 60 * 60 * 24 * 7 + $3;
412 <                }
413 <                ;
414 <
415 < sizespec_:      { $$ = 0; } | sizespec;
416 < sizespec:       NUMBER sizespec_ { $$ = $1 + $2; }
417 <                | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
418 <                | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
419 <                | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
420 <                ;
405 > timespec:  NUMBER timespec_         { $$ = $1 + $2; } |
406 >           NUMBER SECONDS timespec_ { $$ = $1 + $3; } |
407 >           NUMBER MINUTES timespec_ { $$ = $1 * 60 + $3; } |
408 >           NUMBER HOURS timespec_   { $$ = $1 * 60 * 60 + $3; } |
409 >           NUMBER DAYS timespec_    { $$ = $1 * 60 * 60 * 24 + $3; } |
410 >           NUMBER WEEKS timespec_   { $$ = $1 * 60 * 60 * 24 * 7 + $3; } |
411 >           NUMBER MONTHS timespec_  { $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3; } |
412 >           NUMBER YEARS timespec_   { $$ = $1 * 60 * 60 * 24 * 365 + $3; }
413 >           ;
414 >
415 > sizespec_:  { $$ = 0; } | sizespec;
416 > sizespec:   NUMBER sizespec_ { $$ = $1 + $2; } |
417 >            NUMBER BYTES sizespec_ { $$ = $1 + $3; } |
418 >            NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } |
419 >            NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
420 >            ;
421  
422  
423   /***************************************************************************
424 < *  section modules
424 > * modules {} section
425   ***************************************************************************/
426 < modules_entry: MODULES
427 <  '{' modules_items '}' ';';
426 > modules_entry: MODULES '{' modules_items '}' ';';
427  
428   modules_items:  modules_items modules_item | modules_item;
429   modules_item:   modules_module | modules_path | error ';' ;
# Line 442 | Line 441 | modules_path: PATH '=' QSTRING ';'
441   };
442  
443  
444 + /***************************************************************************
445 + * serverinfo {}  section
446 + ***************************************************************************/
447   serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
448  
449   serverinfo_items:       serverinfo_items serverinfo_item | serverinfo_item ;
450 < serverinfo_item:        serverinfo_name | serverinfo_vhost |
451 <                        serverinfo_hub | serverinfo_description |
452 <                        serverinfo_network_name | serverinfo_network_desc |
453 <                        serverinfo_max_clients | serverinfo_max_nick_length |
454 <                        serverinfo_max_topic_length | serverinfo_ssl_dh_param_file |
455 <                        serverinfo_rsa_private_key_file | serverinfo_vhost6 |
456 <                        serverinfo_sid | serverinfo_ssl_certificate_file |
457 <                        serverinfo_ssl_client_method | serverinfo_ssl_server_method |
450 > serverinfo_item:        serverinfo_name |
451 >                        serverinfo_vhost |
452 >                        serverinfo_hub |
453 >                        serverinfo_description |
454 >                        serverinfo_network_name |
455 >                        serverinfo_network_desc |
456 >                        serverinfo_default_max_clients |
457 >                        serverinfo_max_nick_length |
458 >                        serverinfo_max_topic_length |
459 >                        serverinfo_ssl_dh_param_file |
460 >                        serverinfo_ssl_dh_elliptic_curve |
461 >                        serverinfo_rsa_private_key_file |
462 >                        serverinfo_vhost6 |
463 >                        serverinfo_sid |
464 >                        serverinfo_ssl_certificate_file |
465                          serverinfo_ssl_cipher_list |
466 <                        error ';' ;
467 <
466 >                        serverinfo_ssl_message_digest_algorithm |
467 >                        error ';' ;
468  
460 serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
461 serverinfo_ssl_server_method: T_SSL_SERVER_METHOD '=' server_method_types ';' ;
469  
470 < client_method_types: client_method_types ',' client_method_type_item | client_method_type_item;
464 < client_method_type_item: T_SSLV3
465 < {
466 < #ifdef HAVE_LIBCRYPTO
467 <  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
468 <    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
469 < #endif
470 < } | T_TLSV1
470 > serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
471   {
472 < #ifdef HAVE_LIBCRYPTO
473 <  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
474 <    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
475 < #endif
472 >  if (conf_parser_ctx.pass == 2)
473 >  {
474 >    xfree(ConfigServerInfo.ssl_certificate_file);
475 >    ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string);
476 >  }
477   };
478  
479 < server_method_types: server_method_types ',' server_method_type_item | server_method_type_item;
479 < server_method_type_item: T_SSLV3
480 < {
481 < #ifdef HAVE_LIBCRYPTO
482 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
483 <    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
484 < #endif
485 < } | T_TLSV1
479 > serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
480   {
481 < #ifdef HAVE_LIBCRYPTO
482 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
483 <    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
484 < #endif
481 >  if (conf_parser_ctx.pass == 2)
482 >  {
483 >    xfree(ConfigServerInfo.rsa_private_key_file);
484 >    ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
485 >  }
486   };
487  
488 < serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
488 > serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
489   {
490 < #ifdef HAVE_LIBCRYPTO
496 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
490 >  if (conf_parser_ctx.pass == 2)
491    {
492 <    if (!ServerInfo.rsa_private_key_file)
493 <    {
500 <      conf_error_report("No rsa_private_key_file specified, SSL disabled");
501 <      break;
502 <    }
503 <
504 <    if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
505 <                                     SSL_FILETYPE_PEM) <= 0 ||
506 <        SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
507 <                                     SSL_FILETYPE_PEM) <= 0)
508 <    {
509 <      report_crypto_errors();
510 <      conf_error_report("Could not open/read certificate file");
511 <      break;
512 <    }
513 <
514 <    if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
515 <                                    SSL_FILETYPE_PEM) <= 0 ||
516 <        SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
517 <                                    SSL_FILETYPE_PEM) <= 0)
518 <    {
519 <      report_crypto_errors();
520 <      conf_error_report("Could not read RSA private key");
521 <      break;
522 <    }
523 <
524 <    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) ||
525 <        !SSL_CTX_check_private_key(ServerInfo.client_ctx))
526 <    {
527 <      report_crypto_errors();
528 <      conf_error_report("Could not read RSA private key");
529 <      break;
530 <    }
492 >    xfree(ConfigServerInfo.ssl_dh_param_file);
493 >    ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string);
494    }
532 #endif
495   };
496  
497 < serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
497 > serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
498   {
499 < #ifdef HAVE_LIBCRYPTO
538 <  if (conf_parser_ctx.pass == 1)
499 >  if (conf_parser_ctx.pass == 2)
500    {
501 <    BIO *file;
502 <
542 <    if (ServerInfo.rsa_private_key)
543 <    {
544 <      RSA_free(ServerInfo.rsa_private_key);
545 <      ServerInfo.rsa_private_key = NULL;
546 <    }
547 <
548 <    if (ServerInfo.rsa_private_key_file)
549 <    {
550 <      MyFree(ServerInfo.rsa_private_key_file);
551 <      ServerInfo.rsa_private_key_file = NULL;
552 <    }
553 <
554 <    ServerInfo.rsa_private_key_file = xstrdup(yylval.string);
555 <
556 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
557 <    {
558 <      conf_error_report("File open failed, ignoring");
559 <      break;
560 <    }
561 <
562 <    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
563 <
564 <    BIO_set_close(file, BIO_CLOSE);
565 <    BIO_free(file);
566 <
567 <    if (ServerInfo.rsa_private_key == NULL)
568 <    {
569 <      conf_error_report("Couldn't extract key, ignoring");
570 <      break;
571 <    }
572 <
573 <    if (!RSA_check_key(ServerInfo.rsa_private_key))
574 <    {
575 <      RSA_free(ServerInfo.rsa_private_key);
576 <      ServerInfo.rsa_private_key = NULL;
577 <
578 <      conf_error_report("Invalid key, ignoring");
579 <      break;
580 <    }
581 <
582 <    /* require 2048 bit (256 byte) key */
583 <    if (RSA_size(ServerInfo.rsa_private_key) != 256)
584 <    {
585 <      RSA_free(ServerInfo.rsa_private_key);
586 <      ServerInfo.rsa_private_key = NULL;
587 <
588 <      conf_error_report("Not a 2048 bit key, ignoring");
589 <    }
501 >    xfree(ConfigServerInfo.ssl_cipher_list);
502 >    ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string);
503    }
591 #endif
504   };
505  
506 < serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
506 > serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';'
507   {
508 < /* TBD - XXX: error reporting */
597 < #ifdef HAVE_LIBCRYPTO
598 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
508 >  if (conf_parser_ctx.pass == 2)
509    {
510 <    BIO *file = BIO_new_file(yylval.string, "r");
511 <
602 <    if (file)
603 <    {
604 <      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
605 <
606 <      BIO_free(file);
607 <
608 <      if (dh)
609 <      {
610 <        if (DH_size(dh) < 128)
611 <          conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
612 <        else
613 <          SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
614 <
615 <        DH_free(dh);
616 <      }
617 <    }
510 >    xfree(ConfigServerInfo.ssl_message_digest_algorithm);
511 >    ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string);
512    }
513 < #endif
620 < };
513 > }
514  
515 < serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
515 > serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';'
516   {
517 < #ifdef HAVE_LIBCRYPTO
518 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
519 <    SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
520 < #endif
517 >  if (conf_parser_ctx.pass == 2)
518 >  {
519 >    xfree(ConfigServerInfo.ssl_dh_elliptic_curve);
520 >    ConfigServerInfo.ssl_dh_elliptic_curve = xstrdup(yylval.string);
521 >  }
522   };
523  
524 < serverinfo_name: NAME '=' QSTRING ';'
524 > serverinfo_name: NAME '=' QSTRING ';'
525   {
526 <  /* this isn't rehashable */
527 <  if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
526 >  /* This isn't rehashable */
527 >  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
528    {
529 <    if (valid_servname(yylval.string))
530 <      ServerInfo.name = xstrdup(yylval.string);
529 >    if (server_valid_name(yylval.string) == true)
530 >      ConfigServerInfo.name = xstrdup(yylval.string);
531      else
532      {
533        conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting.");
534 <      exit(0);
534 >      exit(EXIT_FAILURE);
535      }
536    }
537   };
538  
539 < serverinfo_sid: IRCD_SID '=' QSTRING ';'
539 > serverinfo_sid: IRCD_SID '=' QSTRING ';'
540   {
541 <  /* this isn't rehashable */
542 <  if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
541 >  /* This isn't rehashable */
542 >  if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid)
543    {
544      if (valid_sid(yylval.string))
545 <      ServerInfo.sid = xstrdup(yylval.string);
545 >      ConfigServerInfo.sid = xstrdup(yylval.string);
546      else
547      {
548        conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting.");
549 <      exit(0);
549 >      exit(EXIT_FAILURE);
550      }
551    }
552   };
# Line 661 | Line 555 | serverinfo_description: DESCRIPTION '='
555   {
556    if (conf_parser_ctx.pass == 2)
557    {
558 <    MyFree(ServerInfo.description);
559 <    ServerInfo.description = xstrdup(yylval.string);
558 >    xfree(ConfigServerInfo.description);
559 >    ConfigServerInfo.description = xstrdup(yylval.string);
560 >    strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info));
561    }
562   };
563  
# Line 672 | Line 567 | serverinfo_network_name: NETWORK_NAME '=
567    {
568      char *p;
569  
570 <    if ((p = strchr(yylval.string, ' ')) != NULL)
571 <      p = '\0';
570 >    if ((p = strchr(yylval.string, ' ')))
571 >      *p = '\0';
572  
573 <    MyFree(ServerInfo.network_name);
574 <    ServerInfo.network_name = xstrdup(yylval.string);
573 >    xfree(ConfigServerInfo.network_name);
574 >    ConfigServerInfo.network_name = xstrdup(yylval.string);
575    }
576   };
577  
578   serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
579   {
580 <  if (conf_parser_ctx.pass == 2)
581 <  {
582 <    MyFree(ServerInfo.network_desc);
583 <    ServerInfo.network_desc = xstrdup(yylval.string);
584 <  }
580 >  if (conf_parser_ctx.pass != 2)
581 >    break;
582 >
583 >  xfree(ConfigServerInfo.network_desc);
584 >  ConfigServerInfo.network_desc = xstrdup(yylval.string);
585   };
586  
587   serverinfo_vhost: VHOST '=' QSTRING ';'
# Line 705 | Line 600 | serverinfo_vhost: VHOST '=' QSTRING ';'
600        ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
601      else
602      {
603 <      assert(res != NULL);
603 >      assert(res);
604  
605 <      memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen);
606 <      ServerInfo.ip.ss.ss_family = res->ai_family;
607 <      ServerInfo.ip.ss_len = res->ai_addrlen;
605 >      memcpy(&ConfigServerInfo.ip, res->ai_addr, res->ai_addrlen);
606 >      ConfigServerInfo.ip.ss.ss_family = res->ai_family;
607 >      ConfigServerInfo.ip.ss_len = res->ai_addrlen;
608        freeaddrinfo(res);
609  
610 <      ServerInfo.specific_ipv4_vhost = 1;
610 >      ConfigServerInfo.specific_ipv4_vhost = 1;
611      }
612    }
613   };
614  
615   serverinfo_vhost6: VHOST6 '=' QSTRING ';'
616   {
722 #ifdef IPV6
617    if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
618    {
619      struct addrinfo hints, *res;
# Line 734 | Line 628 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
628        ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
629      else
630      {
631 <      assert(res != NULL);
631 >      assert(res);
632  
633 <      memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen);
634 <      ServerInfo.ip6.ss.ss_family = res->ai_family;
635 <      ServerInfo.ip6.ss_len = res->ai_addrlen;
633 >      memcpy(&ConfigServerInfo.ip6, res->ai_addr, res->ai_addrlen);
634 >      ConfigServerInfo.ip6.ss.ss_family = res->ai_family;
635 >      ConfigServerInfo.ip6.ss_len = res->ai_addrlen;
636        freeaddrinfo(res);
637  
638 <      ServerInfo.specific_ipv6_vhost = 1;
638 >      ConfigServerInfo.specific_ipv6_vhost = 1;
639      }
640    }
747 #endif
641   };
642  
643 < serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
643 > serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';'
644   {
645    if (conf_parser_ctx.pass != 2)
646      break;
647  
648 <  if ($3 < MAXCLIENTS_MIN)
648 >  if ($3 < 1)
649    {
650 <    char buf[IRCD_BUFSIZE];
651 <
759 <    snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
760 <    conf_error_report(buf);
761 <    ServerInfo.max_clients = MAXCLIENTS_MIN;
650 >    conf_error_report("default_max_clients too low, setting to 1");
651 >    ConfigServerInfo.default_max_clients = 1;
652    }
653    else if ($3 > MAXCLIENTS_MAX)
654    {
655 <    char buf[IRCD_BUFSIZE];
655 >    char buf[IRCD_BUFSIZE] = "";
656  
657 <    snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
657 >    snprintf(buf, sizeof(buf), "default_max_clients too high, setting to %d", MAXCLIENTS_MAX);
658      conf_error_report(buf);
659 <    ServerInfo.max_clients = MAXCLIENTS_MAX;
659 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
660    }
661    else
662 <    ServerInfo.max_clients = $3;
662 >    ConfigServerInfo.default_max_clients = $3;
663   };
664  
665   serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';'
# Line 780 | Line 670 | serverinfo_max_nick_length: MAX_NICK_LEN
670    if ($3 < 9)
671    {
672      conf_error_report("max_nick_length too low, setting to 9");
673 <    ServerInfo.max_nick_length = 9;
673 >    ConfigServerInfo.max_nick_length = 9;
674    }
675    else if ($3 > NICKLEN)
676    {
677 <    char buf[IRCD_BUFSIZE];
677 >    char buf[IRCD_BUFSIZE] = "";
678  
679      snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN);
680      conf_error_report(buf);
681 <    ServerInfo.max_nick_length = NICKLEN;
681 >    ConfigServerInfo.max_nick_length = NICKLEN;
682    }
683    else
684 <    ServerInfo.max_nick_length = $3;
684 >    ConfigServerInfo.max_nick_length = $3;
685   };
686  
687   serverinfo_max_topic_length: MAX_TOPIC_LENGTH '=' NUMBER ';'
# Line 802 | Line 692 | serverinfo_max_topic_length: MAX_TOPIC_L
692    if ($3 < 80)
693    {
694      conf_error_report("max_topic_length too low, setting to 80");
695 <    ServerInfo.max_topic_length = 80;
695 >    ConfigServerInfo.max_topic_length = 80;
696    }
697    else if ($3 > TOPICLEN)
698    {
699 <    char buf[IRCD_BUFSIZE];
699 >    char buf[IRCD_BUFSIZE] = "";
700  
701      snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN);
702      conf_error_report(buf);
703 <    ServerInfo.max_topic_length = TOPICLEN;
703 >    ConfigServerInfo.max_topic_length = TOPICLEN;
704    }
705    else
706 <    ServerInfo.max_topic_length = $3;
706 >    ConfigServerInfo.max_topic_length = $3;
707   };
708  
709 < serverinfo_hub: HUB '=' TBOOL ';'
709 > serverinfo_hub: HUB '=' TBOOL ';'
710   {
711    if (conf_parser_ctx.pass == 2)
712 <    ServerInfo.hub = yylval.number;
712 >    ConfigServerInfo.hub = yylval.number;
713   };
714  
715 +
716   /***************************************************************************
717 < * admin section
717 > * admin {} section
718   ***************************************************************************/
719   admin_entry: ADMIN  '{' admin_items '}' ';' ;
720  
721   admin_items: admin_items admin_item | admin_item;
722 < admin_item:  admin_name | admin_description |
723 <             admin_email | error ';' ;
722 > admin_item:  admin_name |
723 >             admin_description |
724 >             admin_email |
725 >             error ';' ;
726  
727 < admin_name: NAME '=' QSTRING ';'
727 > admin_name: NAME '=' QSTRING ';'
728   {
729 <  if (conf_parser_ctx.pass == 2)
730 <  {
731 <    MyFree(AdminInfo.name);
732 <    AdminInfo.name = xstrdup(yylval.string);
733 <  }
729 >  if (conf_parser_ctx.pass != 2)
730 >    break;
731 >
732 >  xfree(ConfigAdminInfo.name);
733 >  ConfigAdminInfo.name = xstrdup(yylval.string);
734   };
735  
736   admin_email: EMAIL '=' QSTRING ';'
737   {
738 <  if (conf_parser_ctx.pass == 2)
739 <  {
740 <    MyFree(AdminInfo.email);
741 <    AdminInfo.email = xstrdup(yylval.string);
742 <  }
738 >  if (conf_parser_ctx.pass != 2)
739 >    break;
740 >
741 >  xfree(ConfigAdminInfo.email);
742 >  ConfigAdminInfo.email = xstrdup(yylval.string);
743   };
744  
745   admin_description: DESCRIPTION '=' QSTRING ';'
746   {
747 +  if (conf_parser_ctx.pass != 2)
748 +    break;
749 +
750 +  xfree(ConfigAdminInfo.description);
751 +  ConfigAdminInfo.description = xstrdup(yylval.string);
752 + };
753 +
754 +
755 + /***************************************************************************
756 + * motd {} section
757 + ***************************************************************************/
758 + motd_entry: MOTD
759 + {
760 +  if (conf_parser_ctx.pass == 2)
761 +    reset_block_state();
762 + } '{' motd_items '}' ';'
763 + {
764 +  dlink_node *node = NULL;
765 +
766 +  if (conf_parser_ctx.pass != 2)
767 +    break;
768 +
769 +  if (!block_state.file.buf[0])
770 +    break;
771 +
772 +  DLINK_FOREACH(node, block_state.mask.list.head)
773 +    motd_add(node->data, block_state.file.buf);
774 + };
775 +
776 + motd_items: motd_items motd_item | motd_item;
777 + motd_item:  motd_mask | motd_file | error ';' ;
778 +
779 + motd_mask: MASK '=' QSTRING ';'
780 + {
781 +  if (conf_parser_ctx.pass == 2)
782 +    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
783 + };
784 +
785 + motd_file: T_FILE '=' QSTRING ';'
786 + {
787 +  if (conf_parser_ctx.pass == 2)
788 +    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
789 + };
790 +
791 +
792 + /***************************************************************************
793 + * pseudo {} section
794 + ***************************************************************************/
795 + pseudo_entry: T_PSEUDO
796 + {
797 +  if (conf_parser_ctx.pass == 2)
798 +    reset_block_state();
799 + } '{' pseudo_items '}' ';'
800 + {
801 +  if (conf_parser_ctx.pass != 2)
802 +    break;
803 +
804 +  if (!block_state.command.buf[0] ||
805 +      !block_state.name.buf[0] ||
806 +      !block_state.nick.buf[0] ||
807 +      !block_state.host.buf[0])
808 +    break;
809 +
810 +  pseudo_register(block_state.name.buf, block_state.nick.buf, block_state.host.buf,
811 +                  block_state.prepend.buf, block_state.command.buf);
812 + };
813 +
814 + pseudo_items: pseudo_items pseudo_item | pseudo_item;
815 + pseudo_item:  pseudo_command | pseudo_prepend | pseudo_name | pseudo_target | error ';' ;
816 +
817 + pseudo_command: T_COMMAND '=' QSTRING ';'
818 + {
819 +  if (conf_parser_ctx.pass == 2)
820 +    strlcpy(block_state.command.buf, yylval.string, sizeof(block_state.command.buf));
821 + };
822 +
823 + pseudo_name: NAME '=' QSTRING ';'
824 + {
825 +  if (conf_parser_ctx.pass == 2)
826 +    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
827 + };
828 +
829 + pseudo_prepend: T_PREPEND '=' QSTRING ';'
830 + {
831 +  if (conf_parser_ctx.pass == 2)
832 +    strlcpy(block_state.prepend.buf, yylval.string, sizeof(block_state.prepend.buf));
833 + };
834 +
835 + pseudo_target: T_TARGET '=' QSTRING ';'
836 + {
837    if (conf_parser_ctx.pass == 2)
838    {
839 <    MyFree(AdminInfo.description);
840 <    AdminInfo.description = xstrdup(yylval.string);
839 >    struct split_nuh_item nuh;
840 >
841 >    nuh.nuhmask  = yylval.string;
842 >    nuh.nickptr  = NULL;
843 >    nuh.userptr  = block_state.nick.buf;
844 >    nuh.hostptr  = block_state.host.buf;
845 >    nuh.nicksize = 0;
846 >    nuh.usersize = sizeof(block_state.nick.buf);
847 >    nuh.hostsize = sizeof(block_state.host.buf);
848 >
849 >    split_nuh(&nuh);
850    }
851   };
852  
853 +
854   /***************************************************************************
855 < *  section logging
855 > * log {} section
856   ***************************************************************************/
857   logging_entry:          T_LOG  '{' logging_items '}' ';' ;
858   logging_items:          logging_items logging_item | logging_item ;
859  
860 < logging_item:           logging_use_logging | logging_file_entry |
861 <                        error ';' ;
860 > logging_item:           logging_use_logging | logging_file_entry |
861 >                        error ';' ;
862  
863   logging_use_logging: USE_LOGGING '=' TBOOL ';'
864   {
865    if (conf_parser_ctx.pass == 2)
866 <    ConfigLoggingEntry.use_logging = yylval.number;
866 >    ConfigLog.use_logging = yylval.number;
867   };
868  
869   logging_file_entry:
# Line 883 | Line 876 | logging_file_entry:
876      break;
877  
878    if (block_state.type.value && block_state.file.buf[0])
879 <    log_add_file(block_state.type.value, block_state.size.value,
879 >    log_set_file(block_state.type.value, block_state.size.value,
880                   block_state.file.buf);
881   };
882  
# Line 924 | Line 917 | logging_file_type_item:  USER
917   {
918    if (conf_parser_ctx.pass == 2)
919      block_state.type.value = LOG_TYPE_OPER;
920 < } | GLINE
920 > } | XLINE
921 > {
922 >  if (conf_parser_ctx.pass == 2)
923 >    block_state.type.value = LOG_TYPE_XLINE;
924 > } | RESV
925   {
926    if (conf_parser_ctx.pass == 2)
927 <    block_state.type.value = LOG_TYPE_GLINE;
927 >    block_state.type.value = LOG_TYPE_RESV;
928   } | T_DLINE
929   {
930    if (conf_parser_ctx.pass == 2)
# Line 948 | Line 945 | logging_file_type_item:  USER
945  
946  
947   /***************************************************************************
948 < * section oper
948 > * operator {} section
949   ***************************************************************************/
950 < oper_entry: OPERATOR
950 > oper_entry: OPERATOR
951   {
952    if (conf_parser_ctx.pass != 2)
953      break;
# Line 959 | Line 956 | oper_entry: OPERATOR
956    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
957   } '{' oper_items '}' ';'
958   {
959 <  dlink_node *ptr = NULL;
959 >  dlink_node *node = NULL;
960  
961    if (conf_parser_ctx.pass != 2)
962      break;
963  
964    if (!block_state.name.buf[0])
965      break;
966 < #ifdef HAVE_LIBCRYPTO
970 <  if (!(block_state.file.buf[0] ||
971 <        block_state.rpass.buf[0]))
972 <    break;
973 < #else
966 >
967    if (!block_state.rpass.buf[0])
968      break;
976 #endif
969  
970 <  DLINK_FOREACH(ptr, block_state.mask.list.head)
970 >  DLINK_FOREACH(node, block_state.mask.list.head)
971    {
972      struct MaskItem *conf = NULL;
973      struct split_nuh_item nuh;
974 +    char *s = node->data;
975  
976 <    nuh.nuhmask  = ptr->data;
976 >    if (EmptyString(s))
977 >      continue;
978 >
979 >    nuh.nuhmask  = s;
980      nuh.nickptr  = NULL;
981      nuh.userptr  = block_state.user.buf;
982      nuh.hostptr  = block_state.host.buf;
# Line 989 | Line 985 | oper_entry: OPERATOR
985      nuh.hostsize = sizeof(block_state.host.buf);
986      split_nuh(&nuh);
987  
988 <    conf        = conf_make(CONF_OPER);
989 <    conf->name  = xstrdup(block_state.name.buf);
990 <    conf->user  = xstrdup(block_state.user.buf);
991 <    conf->host  = xstrdup(block_state.host.buf);
988 >    conf         = conf_make(CONF_OPER);
989 >    conf->name   = xstrdup(block_state.name.buf);
990 >    conf->user   = xstrdup(block_state.user.buf);
991 >    conf->host   = xstrdup(block_state.host.buf);
992 >
993 >    if (block_state.cert.buf[0])
994 >      conf->certfp = xstrdup(block_state.cert.buf);
995  
996      if (block_state.rpass.buf[0])
997        conf->passwd = xstrdup(block_state.rpass.buf);
998  
999 +    if (block_state.whois.buf[0])
1000 +      conf->whois = xstrdup(block_state.whois.buf);
1001 +
1002      conf->flags = block_state.flags.value;
1003      conf->modes = block_state.modes.value;
1004      conf->port  = block_state.port.value;
1005      conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits);
1006  
1007      conf_add_class_to_conf(conf, block_state.class.buf);
1006
1007 #ifdef HAVE_LIBCRYPTO
1008    if (block_state.file.buf[0])
1009    {
1010      BIO *file = NULL;
1011      RSA *pkey = NULL;
1012
1013      if ((file = BIO_new_file(block_state.file.buf, "r")) == NULL)
1014      {
1015        conf_error_report("Ignoring rsa_public_key_file -- file doesn't exist");
1016        break;
1017      }
1018
1019      if ((pkey = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL)) == NULL)
1020        conf_error_report("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
1021
1022      conf->rsa_public_key = pkey;
1023      BIO_set_close(file, BIO_CLOSE);
1024      BIO_free(file);
1025    }
1026 #endif /* HAVE_LIBCRYPTO */
1008    }
1009   };
1010  
1011   oper_items:     oper_items oper_item | oper_item;
1012 < oper_item:      oper_name | oper_user | oper_password |
1013 <                oper_umodes | oper_class | oper_encrypted |
1014 <                oper_rsa_public_key_file | oper_flags | error ';' ;
1012 > oper_item:      oper_name |
1013 >                oper_user |
1014 >                oper_password |
1015 >                oper_whois |
1016 >                oper_umodes |
1017 >                oper_class |
1018 >                oper_encrypted |
1019 >                oper_ssl_certificate_fingerprint |
1020 >                oper_ssl_connection_required |
1021 >                oper_flags |
1022 >                error ';' ;
1023  
1024   oper_name: NAME '=' QSTRING ';'
1025   {
# Line 1050 | Line 1039 | oper_password: PASSWORD '=' QSTRING ';'
1039      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1040   };
1041  
1042 < oper_encrypted: ENCRYPTED '=' TBOOL ';'
1042 > oper_whois: WHOIS '=' QSTRING ';'
1043   {
1044    if (conf_parser_ctx.pass == 2)
1045 <  {
1057 <    if (yylval.number)
1058 <      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1059 <    else
1060 <      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1061 <  }
1045 >    strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf));
1046   };
1047  
1048 < oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1048 > oper_encrypted: ENCRYPTED '=' TBOOL ';'
1049 > {
1050 >  if (conf_parser_ctx.pass != 2)
1051 >    break;
1052 >
1053 >  if (yylval.number)
1054 >    block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1055 >  else
1056 >    block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1057 > };
1058 >
1059 > oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1060   {
1061    if (conf_parser_ctx.pass == 2)
1062 <    strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1062 >    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1063 > };
1064 >
1065 > oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1066 > {
1067 >  if (conf_parser_ctx.pass != 2)
1068 >    break;
1069 >
1070 >  if (yylval.number)
1071 >    block_state.flags.value |= CONF_FLAGS_SSL;
1072 >  else
1073 >    block_state.flags.value &= ~CONF_FLAGS_SSL;
1074   };
1075  
1076   oper_class: CLASS '=' QSTRING ';'
# Line 1088 | Line 1094 | oper_umodes_item:  T_BOTS
1094   {
1095    if (conf_parser_ctx.pass == 2)
1096      block_state.modes.value |= UMODE_CCONN;
1091 } | T_CCONN_FULL
1092 {
1093  if (conf_parser_ctx.pass == 2)
1094    block_state.modes.value |= UMODE_CCONN_FULL;
1097   } | T_DEAF
1098   {
1099    if (conf_parser_ctx.pass == 2)
# Line 1108 | Line 1110 | oper_umodes_item:  T_BOTS
1110   {
1111    if (conf_parser_ctx.pass == 2)
1112      block_state.modes.value |= UMODE_HIDDEN;
1113 + } | HIDE_CHANS
1114 + {
1115 +  if (conf_parser_ctx.pass == 2)
1116 +    block_state.modes.value |= UMODE_HIDECHANS;
1117 + } | HIDE_IDLE
1118 + {
1119 +  if (conf_parser_ctx.pass == 2)
1120 +    block_state.modes.value |= UMODE_HIDEIDLE;
1121   } | T_SKILL
1122   {
1123    if (conf_parser_ctx.pass == 2)
# Line 1132 | Line 1142 | oper_umodes_item:  T_BOTS
1142   {
1143    if (conf_parser_ctx.pass == 2)
1144      block_state.modes.value |= UMODE_EXTERNAL;
1135 } | T_OPERWALL
1136 {
1137  if (conf_parser_ctx.pass == 2)
1138    block_state.modes.value |= UMODE_OPERWALL;
1145   } | T_SERVNOTICE
1146   {
1147    if (conf_parser_ctx.pass == 2)
# Line 1160 | Line 1166 | oper_umodes_item:  T_BOTS
1166   {
1167    if (conf_parser_ctx.pass == 2)
1168      block_state.modes.value |= UMODE_LOCOPS;
1169 + } | T_NONONREG
1170 + {
1171 +  if (conf_parser_ctx.pass == 2)
1172 +    block_state.modes.value |= UMODE_REGONLY;
1173 + } | T_FARCONNECT
1174 + {
1175 +  if (conf_parser_ctx.pass == 2)
1176 +    block_state.modes.value |= UMODE_FARCONNECT;
1177   };
1178  
1179   oper_flags: IRCD_FLAGS
# Line 1169 | Line 1183 | oper_flags: IRCD_FLAGS
1183   } '='  oper_flags_items ';';
1184  
1185   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1186 < oper_flags_item: GLOBAL_KILL
1186 > oper_flags_item: KILL ':' REMOTE
1187 > {
1188 >  if (conf_parser_ctx.pass == 2)
1189 >    block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1190 > } | KILL
1191 > {
1192 >  if (conf_parser_ctx.pass == 2)
1193 >    block_state.port.value |= OPER_FLAG_KILL;
1194 > } | CONNECT ':' REMOTE
1195   {
1196    if (conf_parser_ctx.pass == 2)
1197 <    block_state.port.value |= OPER_FLAG_GLOBAL_KILL;
1198 < } | REMOTE
1197 >    block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1198 > } | CONNECT
1199   {
1200    if (conf_parser_ctx.pass == 2)
1201 <    block_state.port.value |= OPER_FLAG_REMOTE;
1201 >    block_state.port.value |= OPER_FLAG_CONNECT;
1202 > } | SQUIT ':' REMOTE
1203 > {
1204 >  if (conf_parser_ctx.pass == 2)
1205 >    block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1206 > } | SQUIT
1207 > {
1208 >  if (conf_parser_ctx.pass == 2)
1209 >    block_state.port.value |= OPER_FLAG_SQUIT;
1210   } | KLINE
1211   {
1212    if (conf_parser_ctx.pass == 2)
1213 <    block_state.port.value |= OPER_FLAG_K;
1213 >    block_state.port.value |= OPER_FLAG_KLINE;
1214   } | UNKLINE
1215   {
1216    if (conf_parser_ctx.pass == 2)
# Line 1196 | Line 1226 | oper_flags_item: GLOBAL_KILL
1226   } | XLINE
1227   {
1228    if (conf_parser_ctx.pass == 2)
1229 <    block_state.port.value |= OPER_FLAG_X;
1230 < } | GLINE
1229 >    block_state.port.value |= OPER_FLAG_XLINE;
1230 > } | T_UNXLINE
1231   {
1232    if (conf_parser_ctx.pass == 2)
1233 <    block_state.port.value |= OPER_FLAG_GLINE;
1233 >    block_state.port.value |= OPER_FLAG_UNXLINE;
1234   } | DIE
1235   {
1236    if (conf_parser_ctx.pass == 2)
# Line 1209 | Line 1239 | oper_flags_item: GLOBAL_KILL
1239   {
1240    if (conf_parser_ctx.pass == 2)
1241      block_state.port.value |= OPER_FLAG_RESTART;
1242 + } | REHASH ':' REMOTE
1243 + {
1244 +  if (conf_parser_ctx.pass == 2)
1245 +    block_state.port.value |= OPER_FLAG_REHASH_REMOTE;
1246   } | REHASH
1247   {
1248    if (conf_parser_ctx.pass == 2)
# Line 1217 | Line 1251 | oper_flags_item: GLOBAL_KILL
1251   {
1252    if (conf_parser_ctx.pass == 2)
1253      block_state.port.value |= OPER_FLAG_ADMIN;
1220 } | NICK_CHANGES
1221 {
1222  if (conf_parser_ctx.pass == 2)
1223    block_state.port.value |= OPER_FLAG_N;
1224 } | T_OPERWALL
1225 {
1226  if (conf_parser_ctx.pass == 2)
1227    block_state.port.value |= OPER_FLAG_OPERWALL;
1254   } | T_GLOBOPS
1255   {
1256    if (conf_parser_ctx.pass == 2)
1257      block_state.port.value |= OPER_FLAG_GLOBOPS;
1258 < } | OPER_SPY_T
1258 > } | T_WALLOPS
1259   {
1260    if (conf_parser_ctx.pass == 2)
1261 <    block_state.port.value |= OPER_FLAG_OPER_SPY;
1261 >    block_state.port.value |= OPER_FLAG_WALLOPS;
1262 > } | T_LOCOPS
1263 > {
1264 >  if (conf_parser_ctx.pass == 2)
1265 >    block_state.port.value |= OPER_FLAG_LOCOPS;
1266   } | REMOTEBAN
1267   {
1268    if (conf_parser_ctx.pass == 2)
# Line 1245 | Line 1275 | oper_flags_item: GLOBAL_KILL
1275   {
1276    if (conf_parser_ctx.pass == 2)
1277      block_state.port.value |= OPER_FLAG_MODULE;
1278 + } | T_OPME
1279 + {
1280 +  if (conf_parser_ctx.pass == 2)
1281 +    block_state.port.value |= OPER_FLAG_OPME;
1282 + } | NICK ':' RESV
1283 + {
1284 +  if (conf_parser_ctx.pass == 2)
1285 +    block_state.port.value |= OPER_FLAG_NICK_RESV;
1286 + } | JOIN ':' RESV
1287 + {
1288 +  if (conf_parser_ctx.pass == 2)
1289 +    block_state.port.value |= OPER_FLAG_JOIN_RESV;
1290 + } | RESV
1291 + {
1292 +  if (conf_parser_ctx.pass == 2)
1293 +    block_state.port.value |= OPER_FLAG_RESV;
1294 + } | T_UNRESV
1295 + {
1296 +  if (conf_parser_ctx.pass == 2)
1297 +    block_state.port.value |= OPER_FLAG_UNRESV;
1298 + } | CLOSE
1299 + {
1300 +  if (conf_parser_ctx.pass == 2)
1301 +    block_state.port.value |= OPER_FLAG_CLOSE;
1302   };
1303  
1304  
1305   /***************************************************************************
1306 < *  section class
1306 > * class {} section
1307   ***************************************************************************/
1308   class_entry: CLASS
1309   {
# Line 1263 | Line 1317 | class_entry: CLASS
1317    block_state.max_total.value = MAXIMUM_LINKS_DEFAULT;
1318    block_state.max_sendq.value = DEFAULT_SENDQ;
1319    block_state.max_recvq.value = DEFAULT_RECVQ;
1266
1320   } '{' class_items '}' ';'
1321   {
1322    struct ClassItem *class = NULL;
# Line 1274 | Line 1327 | class_entry: CLASS
1327    if (!block_state.class.buf[0])
1328      break;
1329  
1330 <  if (!(class = class_find(block_state.class.buf, 0)))
1330 >  if (!(class = class_find(block_state.class.buf, false)))
1331      class = class_make();
1332  
1333    class->active = 1;
1334 <  MyFree(class->name);
1334 >  xfree(class->name);
1335    class->name = xstrdup(block_state.class.buf);
1336    class->ping_freq = block_state.ping_freq.value;
1337 <  class->max_perip = block_state.max_perip.value;
1337 >  class->max_perip_local = block_state.max_perip_local.value;
1338 >  class->max_perip_global = block_state.max_perip_global.value;
1339    class->con_freq = block_state.con_freq.value;
1340    class->max_total = block_state.max_total.value;
1287  class->max_global = block_state.max_global.value;
1288  class->max_local = block_state.max_local.value;
1289  class->max_ident = block_state.max_ident.value;
1341    class->max_sendq = block_state.max_sendq.value;
1342    class->max_recvq = block_state.max_recvq.value;
1343 +  class->max_channels = block_state.max_channels.value;
1344  
1345 <  if (class->number_per_cidr && block_state.number_per_cidr.value)
1346 <    if ((class->cidr_bitlen_ipv4 && block_state.cidr_bitlen_ipv4.value) ||
1347 <        (class->cidr_bitlen_ipv6 && block_state.cidr_bitlen_ipv6.value))
1348 <      if ((class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value) ||
1349 <          (class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value))
1350 <        rebuild_cidr_list(class);
1345 >  if (block_state.min_idle.value > block_state.max_idle.value)
1346 >  {
1347 >    block_state.min_idle.value = 0;
1348 >    block_state.max_idle.value = 0;
1349 >    block_state.flags.value &= ~CLASS_FLAGS_FAKE_IDLE;
1350 >  }
1351 >
1352 >  class->flags = block_state.flags.value;
1353 >  class->min_idle = block_state.min_idle.value;
1354 >  class->max_idle = block_state.max_idle.value;
1355  
1356 +  int diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value ||
1357 +              class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value);
1358    class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1359    class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1360    class->number_per_cidr = block_state.number_per_cidr.value;
1361 +
1362 +  if (diff)
1363 +    class_ip_limit_rebuild(class);
1364   };
1365  
1366   class_items:    class_items class_item | class_item;
1367   class_item:     class_name |
1368 <                class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
1368 >                class_cidr_bitlen_ipv4 |
1369 >                class_cidr_bitlen_ipv6 |
1370                  class_ping_time |
1371 <                class_number_per_cidr |
1372 <                class_number_per_ip |
1371 >                class_number_per_cidr |
1372 >                class_number_per_ip_local |
1373 >                class_number_per_ip_global |
1374                  class_connectfreq |
1375 +                class_max_channels |
1376                  class_max_number |
1377 <                class_max_global |
1378 <                class_max_local |
1379 <                class_max_ident |
1380 <                class_sendq | class_recvq |
1381 <                error ';' ;
1377 >                class_sendq |
1378 >                class_recvq |
1379 >                class_min_idle |
1380 >                class_max_idle |
1381 >                class_flags |
1382 >                error ';' ;
1383  
1384 < class_name: NAME '=' QSTRING ';'
1384 > class_name: NAME '=' QSTRING ';'
1385   {
1386    if (conf_parser_ctx.pass == 1)
1387      strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
# Line 1328 | Line 1393 | class_ping_time: PING_TIME '=' timespec
1393      block_state.ping_freq.value = $3;
1394   };
1395  
1396 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1332 < {
1333 <  if (conf_parser_ctx.pass == 1)
1334 <    block_state.max_perip.value = $3;
1335 < };
1336 <
1337 < class_connectfreq: CONNECTFREQ '=' timespec ';'
1396 > class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';'
1397   {
1398    if (conf_parser_ctx.pass == 1)
1399 <    block_state.con_freq.value = $3;
1399 >    block_state.max_perip_local.value = $3;
1400   };
1401  
1402 < class_max_number: MAX_NUMBER '=' NUMBER ';'
1402 > class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';'
1403   {
1404    if (conf_parser_ctx.pass == 1)
1405 <    block_state.max_total.value = $3;
1405 >    block_state.max_perip_global.value = $3;
1406   };
1407  
1408 < class_max_global: MAX_GLOBAL '=' NUMBER ';'
1408 > class_connectfreq: CONNECTFREQ '=' timespec ';'
1409   {
1410    if (conf_parser_ctx.pass == 1)
1411 <    block_state.max_global.value = $3;
1411 >    block_state.con_freq.value = $3;
1412   };
1413  
1414 < class_max_local: MAX_LOCAL '=' NUMBER ';'
1414 > class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1415   {
1416    if (conf_parser_ctx.pass == 1)
1417 <    block_state.max_local.value = $3;
1417 >    block_state.max_channels.value = $3;
1418   };
1419  
1420 < class_max_ident: MAX_IDENT '=' NUMBER ';'
1420 > class_max_number: MAX_NUMBER '=' NUMBER ';'
1421   {
1422    if (conf_parser_ctx.pass == 1)
1423 <    block_state.max_ident.value = $3;
1423 >    block_state.max_total.value = $3;
1424   };
1425  
1426   class_sendq: SENDQ '=' sizespec ';'
# Line 1395 | Line 1454 | class_number_per_cidr: NUMBER_PER_CIDR '
1454      block_state.number_per_cidr.value = $3;
1455   };
1456  
1457 + class_min_idle: MIN_IDLE '=' timespec ';'
1458 + {
1459 +  if (conf_parser_ctx.pass != 1)
1460 +    break;
1461 +
1462 +  block_state.min_idle.value = $3;
1463 +  block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1464 + };
1465 +
1466 + class_max_idle: MAX_IDLE '=' timespec ';'
1467 + {
1468 +  if (conf_parser_ctx.pass != 1)
1469 +    break;
1470 +
1471 +  block_state.max_idle.value = $3;
1472 +  block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1473 + };
1474 +
1475 + class_flags: IRCD_FLAGS
1476 + {
1477 +  if (conf_parser_ctx.pass == 1)
1478 +    block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE;
1479 + } '='  class_flags_items ';';
1480 +
1481 + class_flags_items: class_flags_items ',' class_flags_item | class_flags_item;
1482 + class_flags_item: RANDOM_IDLE
1483 + {
1484 +  if (conf_parser_ctx.pass == 1)
1485 +    block_state.flags.value |= CLASS_FLAGS_RANDOM_IDLE;
1486 + } | HIDE_IDLE_FROM_OPERS
1487 + {
1488 +  if (conf_parser_ctx.pass == 1)
1489 +    block_state.flags.value |= CLASS_FLAGS_HIDE_IDLE_FROM_OPERS;
1490 + };
1491 +
1492 +
1493   /***************************************************************************
1494 < *  section listen
1494 > * listen {} section
1495   ***************************************************************************/
1496   listen_entry: LISTEN
1497   {
# Line 1435 | Line 1530 | port_item: NUMBER
1530   {
1531    if (conf_parser_ctx.pass == 2)
1532    {
1533 + #ifndef HAVE_TLS
1534      if (block_state.flags.value & LISTENER_SSL)
1535 < #ifdef HAVE_LIBCRYPTO
1536 <      if (!ServerInfo.server_ctx)
1535 >    {
1536 >      conf_error_report("TLS not available - port closed");
1537 >      break;
1538 >    }
1539   #endif
1540 <      {
1443 <        conf_error_report("SSL not available - port closed");
1444 <        break;
1445 <      }
1446 <    add_listener($1, block_state.addr.buf, block_state.flags.value);
1540 >    listener_add($1, block_state.addr.buf, block_state.flags.value);
1541    }
1542   } | NUMBER TWODOTS NUMBER
1543   {
1544    if (conf_parser_ctx.pass == 2)
1545    {
1546 <    int i;
1453 <
1546 > #ifndef HAVE_TLS
1547      if (block_state.flags.value & LISTENER_SSL)
1548 < #ifdef HAVE_LIBCRYPTO
1549 <      if (!ServerInfo.server_ctx)
1548 >    {
1549 >      conf_error_report("TLS not available - port closed");
1550 >      break;
1551 >    }
1552   #endif
1458      {
1459        conf_error_report("SSL not available - port closed");
1460        break;
1461      }
1553  
1554 <    for (i = $1; i <= $3; ++i)
1555 <      add_listener(i, block_state.addr.buf, block_state.flags.value);
1554 >    for (int i = $1; i <= $3; ++i)
1555 >      listener_add(i, block_state.addr.buf, block_state.flags.value);
1556    }
1557   };
1558  
# Line 1477 | Line 1568 | listen_host: HOST '=' QSTRING ';'
1568      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1569   };
1570  
1571 +
1572   /***************************************************************************
1573 < *  section auth
1573 > * auth {} section
1574   ***************************************************************************/
1575   auth_entry: IRCD_AUTH
1576   {
# Line 1486 | Line 1578 | auth_entry: IRCD_AUTH
1578      reset_block_state();
1579   } '{' auth_items '}' ';'
1580   {
1581 <  dlink_node *ptr = NULL;
1581 >  dlink_node *node = NULL;
1582  
1583    if (conf_parser_ctx.pass != 2)
1584      break;
1585  
1586 <  DLINK_FOREACH(ptr, block_state.mask.list.head)
1586 >  DLINK_FOREACH(node, block_state.mask.list.head)
1587    {
1588      struct MaskItem *conf = NULL;
1589      struct split_nuh_item nuh;
1590 +    char *s = node->data;
1591  
1592 <    nuh.nuhmask  = ptr->data;
1592 >    if (EmptyString(s))
1593 >      continue;
1594 >
1595 >    nuh.nuhmask  = s;
1596      nuh.nickptr  = NULL;
1597      nuh.userptr  = block_state.user.buf;
1598      nuh.hostptr  = block_state.host.buf;
# Line 1506 | Line 1602 | auth_entry: IRCD_AUTH
1602      split_nuh(&nuh);
1603  
1604      conf        = conf_make(CONF_CLIENT);
1605 <    conf->user  = xstrdup(collapse(block_state.user.buf));
1606 <    conf->host  = xstrdup(collapse(block_state.host.buf));
1605 >    conf->user  = xstrdup(block_state.user.buf);
1606 >    conf->host  = xstrdup(block_state.host.buf);
1607  
1608      if (block_state.rpass.buf[0])
1609        conf->passwd = xstrdup(block_state.rpass.buf);
1610      if (block_state.name.buf[0])
1611 <      conf->passwd = xstrdup(block_state.name.buf);
1611 >      conf->name = xstrdup(block_state.name.buf);
1612  
1613      conf->flags = block_state.flags.value;
1614      conf->port  = block_state.port.value;
# Line 1520 | Line 1616 | auth_entry: IRCD_AUTH
1616      conf_add_class_to_conf(conf, block_state.class.buf);
1617      add_conf_by_address(CONF_CLIENT, conf);
1618    }
1619 < };
1619 > };
1620  
1621   auth_items:     auth_items auth_item | auth_item;
1622 < auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
1623 <                auth_spoof | auth_redir_serv | auth_redir_port |
1624 <                auth_encrypted | error ';' ;
1622 > auth_item:      auth_user |
1623 >                auth_passwd |
1624 >                auth_class |
1625 >                auth_flags |
1626 >                auth_spoof |
1627 >                auth_redir_serv |
1628 >                auth_redir_port |
1629 >                auth_encrypted |
1630 >                error ';' ;
1631  
1632   auth_user: USER '=' QSTRING ';'
1633   {
# Line 1559 | Line 1661 | auth_encrypted: ENCRYPTED '=' TBOOL ';'
1661   auth_flags: IRCD_FLAGS
1662   {
1663    if (conf_parser_ctx.pass == 2)
1664 <    block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
1664 >    block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1665   } '='  auth_flags_items ';';
1666  
1667   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
# Line 1575 | Line 1677 | auth_flags_item: SPOOF_NOTICE
1677   {
1678    if (conf_parser_ctx.pass == 2)
1679      block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1680 + } | XLINE_EXEMPT
1681 + {
1682 +  if (conf_parser_ctx.pass == 2)
1683 +    block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1684   } | NEED_IDENT
1685   {
1686    if (conf_parser_ctx.pass == 2)
# Line 1587 | Line 1693 | auth_flags_item: SPOOF_NOTICE
1693   {
1694    if (conf_parser_ctx.pass == 2)
1695      block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1590 } | GLINE_EXEMPT
1591 {
1592  if (conf_parser_ctx.pass == 2)
1593    block_state.flags.value |= CONF_FLAGS_EXEMPTGLINE;
1696   } | RESV_EXEMPT
1697   {
1698    if (conf_parser_ctx.pass == 2)
# Line 1605 | Line 1707 | auth_flags_item: SPOOF_NOTICE
1707      block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1708   };
1709  
1710 < auth_spoof: SPOOF '=' QSTRING ';'
1710 > auth_spoof: SPOOF '=' QSTRING ';'
1711   {
1712    if (conf_parser_ctx.pass != 2)
1713      break;
1714  
1715 <  if (strlen(yylval.string) <= HOSTLEN && valid_hostname(yylval.string))
1715 >  if (valid_hostname(yylval.string))
1716    {
1717      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1718      block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
# Line 1639 | Line 1741 | auth_redir_port: REDIRPORT '=' NUMBER ';
1741  
1742  
1743   /***************************************************************************
1744 < *  section resv
1744 > * resv {} section
1745   ***************************************************************************/
1746   resv_entry: RESV
1747   {
# Line 1648 | Line 1750 | resv_entry: RESV
1750  
1751    reset_block_state();
1752    strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1753 < } '{' resv_items '}' ';';
1753 > } '{' resv_items '}' ';'
1754 > {
1755 >  if (conf_parser_ctx.pass != 2)
1756 >    break;
1757  
1758 < resv_items:     resv_items resv_item | resv_item;
1759 < resv_item:      resv_creason | resv_channel | resv_nick | error ';' ;
1758 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1759 > };
1760  
1761 < resv_creason: REASON '=' QSTRING ';'
1761 > resv_items:     resv_items resv_item | resv_item;
1762 > resv_item:      resv_mask | resv_reason | resv_exempt | error ';' ;
1763 >
1764 > resv_mask: MASK '=' QSTRING ';'
1765   {
1766    if (conf_parser_ctx.pass == 2)
1767 <    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1767 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1768   };
1769  
1770 < resv_channel: CHANNEL '=' QSTRING ';'
1770 > resv_reason: REASON '=' QSTRING ';'
1771   {
1772 <  if (conf_parser_ctx.pass != 2)
1773 <    break;
1666 <
1667 <  if (IsChanPrefix(*yylval.string))
1668 <    create_channel_resv(yylval.string, block_state.rpass.buf, 1);
1772 >  if (conf_parser_ctx.pass == 2)
1773 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1774   };
1775  
1776 < resv_nick: NICK '=' QSTRING ';'
1776 > resv_exempt: EXEMPT '=' QSTRING ';'
1777   {
1778    if (conf_parser_ctx.pass == 2)
1779 <    create_nick_resv(yylval.string, block_state.rpass.buf, 1);
1779 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1780   };
1781  
1782 +
1783   /***************************************************************************
1784 < *  section service
1784 > * service {} section
1785   ***************************************************************************/
1786   service_entry: T_SERVICE '{' service_items '}' ';';
1787  
# Line 1684 | Line 1790 | service_item:      service_name | error;
1790  
1791   service_name: NAME '=' QSTRING ';'
1792   {
1793 <  if (conf_parser_ctx.pass == 2)
1793 >  if (conf_parser_ctx.pass != 2)
1794 >    break;
1795 >
1796 >  if (server_valid_name(yylval.string) == true)
1797    {
1798 <    if (valid_servname(yylval.string))
1799 <    {
1691 <      struct MaskItem *conf = conf_make(CONF_SERVICE);
1692 <      conf->name = xstrdup(yylval.string);
1693 <    }
1798 >    struct ServiceItem *service = service_make();
1799 >    service->name = xstrdup(yylval.string);
1800    }
1801   };
1802  
1803 +
1804   /***************************************************************************
1805 < *  section shared, for sharing remote klines etc.
1805 > * shared {} section, for sharing remote klines etc.
1806   ***************************************************************************/
1807   shared_entry: T_SHARED
1808   {
# Line 1710 | Line 1817 | shared_entry: T_SHARED
1817    block_state.flags.value = SHARED_ALL;
1818   } '{' shared_items '}' ';'
1819   {
1713  struct MaskItem *conf = NULL;
1714
1820    if (conf_parser_ctx.pass != 2)
1821      break;
1822  
1823 <  conf = conf_make(CONF_ULINE);
1824 <  conf->flags = block_state.flags.value;
1825 <  conf->name = xstrdup(block_state.name.buf);
1826 <  conf->user = xstrdup(block_state.user.buf);
1827 <  conf->user = xstrdup(block_state.host.buf);
1823 >  struct SharedItem *shared = shared_make();
1824 >  shared->type = block_state.flags.value;
1825 >  shared->server = xstrdup(block_state.name.buf);
1826 >  shared->user = xstrdup(block_state.user.buf);
1827 >  shared->host = xstrdup(block_state.host.buf);
1828   };
1829  
1830   shared_items: shared_items shared_item | shared_item;
# Line 1799 | Line 1904 | shared_type_item: KLINE
1904      block_state.flags.value = SHARED_ALL;
1905   };
1906  
1907 +
1908   /***************************************************************************
1909 < *  section cluster
1909 > * cluster {} section
1910   ***************************************************************************/
1911   cluster_entry: T_CLUSTER
1912   {
# Line 1810 | Line 1916 | cluster_entry: T_CLUSTER
1916    reset_block_state();
1917  
1918    strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1919 <  block_state.flags.value = SHARED_ALL;
1919 >  block_state.flags.value = CLUSTER_ALL;
1920   } '{' cluster_items '}' ';'
1921   {
1816  struct MaskItem *conf = NULL;
1817
1922    if (conf_parser_ctx.pass != 2)
1923      break;
1924  
1925 <  conf = conf_make(CONF_CLUSTER);
1926 <  conf->flags = block_state.flags.value;
1927 <  conf->name = xstrdup(block_state.name.buf);
1925 >  struct ClusterItem *cluster = cluster_make();
1926 >  cluster->type = block_state.flags.value;
1927 >  cluster->server = xstrdup(block_state.name.buf);
1928   };
1929  
1930 < cluster_items:  cluster_items cluster_item | cluster_item;
1931 < cluster_item:   cluster_name | cluster_type | error ';' ;
1930 > cluster_items:  cluster_items cluster_item | cluster_item;
1931 > cluster_item:   cluster_name | cluster_type | error ';' ;
1932  
1933   cluster_name: NAME '=' QSTRING ';'
1934   {
# Line 1838 | Line 1942 | cluster_type: TYPE
1942      block_state.flags.value = 0;
1943   } '=' cluster_types ';' ;
1944  
1945 < cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
1945 > cluster_types:  cluster_types ',' cluster_type_item | cluster_type_item;
1946   cluster_type_item: KLINE
1947   {
1948    if (conf_parser_ctx.pass == 2)
1949 <    block_state.flags.value |= SHARED_KLINE;
1949 >    block_state.flags.value |= CLUSTER_KLINE;
1950   } | UNKLINE
1951   {
1952    if (conf_parser_ctx.pass == 2)
1953 <    block_state.flags.value |= SHARED_UNKLINE;
1953 >    block_state.flags.value |= CLUSTER_UNKLINE;
1954   } | T_DLINE
1955   {
1956    if (conf_parser_ctx.pass == 2)
1957 <    block_state.flags.value |= SHARED_DLINE;
1957 >    block_state.flags.value |= CLUSTER_DLINE;
1958   } | T_UNDLINE
1959   {
1960    if (conf_parser_ctx.pass == 2)
1961 <    block_state.flags.value |= SHARED_UNDLINE;
1961 >    block_state.flags.value |= CLUSTER_UNDLINE;
1962   } | XLINE
1963   {
1964    if (conf_parser_ctx.pass == 2)
1965 <    block_state.flags.value |= SHARED_XLINE;
1965 >    block_state.flags.value |= CLUSTER_XLINE;
1966   } | T_UNXLINE
1967   {
1968    if (conf_parser_ctx.pass == 2)
1969 <    block_state.flags.value |= SHARED_UNXLINE;
1969 >    block_state.flags.value |= CLUSTER_UNXLINE;
1970   } | RESV
1971   {
1972    if (conf_parser_ctx.pass == 2)
1973 <    block_state.flags.value |= SHARED_RESV;
1973 >    block_state.flags.value |= CLUSTER_RESV;
1974   } | T_UNRESV
1975   {
1976    if (conf_parser_ctx.pass == 2)
1977 <    block_state.flags.value |= SHARED_UNRESV;
1977 >    block_state.flags.value |= CLUSTER_UNRESV;
1978   } | T_LOCOPS
1979   {
1980    if (conf_parser_ctx.pass == 2)
1981 <    block_state.flags.value |= SHARED_LOCOPS;
1981 >    block_state.flags.value |= CLUSTER_LOCOPS;
1982   } | T_ALL
1983   {
1984    if (conf_parser_ctx.pass == 2)
1985 <    block_state.flags.value = SHARED_ALL;
1985 >    block_state.flags.value = CLUSTER_ALL;
1986   };
1987  
1988 +
1989   /***************************************************************************
1990 < *  section connect
1990 > * connect {}  section
1991   ***************************************************************************/
1992 < connect_entry: CONNECT  
1992 > connect_entry: CONNECT
1993   {
1994  
1995    if (conf_parser_ctx.pass != 2)
1996      break;
1997  
1998    reset_block_state();
1999 +  block_state.aftype.value = AF_INET;
2000    block_state.port.value = PORTNUM;
2001   } '{' connect_items '}' ';'
2002   {
# Line 1904 | Line 2010 | connect_entry: CONNECT
2010        !block_state.host.buf[0])
2011      break;
2012  
2013 <  if (!(block_state.rpass.buf[0] ||
2014 <        block_state.spass.buf[0]))
2013 >  if (!block_state.rpass.buf[0] ||
2014 >      !block_state.spass.buf[0])
2015      break;
2016  
2017    if (has_wildcards(block_state.name.buf) ||
# Line 1920 | Line 2026 | connect_entry: CONNECT
2026    conf->name = xstrdup(block_state.name.buf);
2027    conf->passwd = xstrdup(block_state.rpass.buf);
2028    conf->spasswd = xstrdup(block_state.spass.buf);
2029 <  conf->cipher_list = xstrdup(block_state.ciph.buf);
2029 >
2030 >  if (block_state.cert.buf[0])
2031 >    conf->certfp = xstrdup(block_state.cert.buf);
2032 >
2033 >  if (block_state.ciph.buf[0])
2034 >    conf->cipher_list = xstrdup(block_state.ciph.buf);
2035  
2036    dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2037    dlinkMoveList(&block_state.hub.list, &conf->hub_list);
# Line 1937 | Line 2048 | connect_entry: CONNECT
2048        ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2049      else
2050      {
2051 <      assert(res != NULL);
2051 >      assert(res);
2052  
2053        memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2054        conf->bind.ss.ss_family = res->ai_family;
# Line 1951 | Line 2062 | connect_entry: CONNECT
2062   };
2063  
2064   connect_items:  connect_items connect_item | connect_item;
2065 < connect_item:   connect_name | connect_host | connect_vhost |
2066 <                connect_send_password | connect_accept_password |
2067 <                connect_aftype | connect_port | connect_ssl_cipher_list |
2068 <                connect_flags | connect_hub_mask | connect_leaf_mask |
2069 <                connect_class | connect_encrypted |
2065 > connect_item:   connect_name |
2066 >                connect_host |
2067 >                connect_vhost |
2068 >                connect_send_password |
2069 >                connect_accept_password |
2070 >                connect_ssl_certificate_fingerprint |
2071 >                connect_aftype |
2072 >                connect_port |
2073 >                connect_ssl_cipher_list |
2074 >                connect_flags |
2075 >                connect_hub_mask |
2076 >                connect_leaf_mask |
2077 >                connect_class |
2078 >                connect_encrypted |
2079                  error ';' ;
2080  
2081   connect_name: NAME '=' QSTRING ';'
# Line 1964 | Line 2084 | connect_name: NAME '=' QSTRING ';'
2084      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2085   };
2086  
2087 < connect_host: HOST '=' QSTRING ';'
2087 > connect_host: HOST '=' QSTRING ';'
2088   {
2089    if (conf_parser_ctx.pass == 2)
2090      strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2091   };
2092  
2093 < connect_vhost: VHOST '=' QSTRING ';'
2093 > connect_vhost: VHOST '=' QSTRING ';'
2094   {
2095    if (conf_parser_ctx.pass == 2)
2096      strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2097   };
2098 <
2098 >
2099   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2100   {
2101    if (conf_parser_ctx.pass != 2)
# Line 1983 | Line 2103 | connect_send_password: SEND_PASSWORD '='
2103  
2104    if ($3[0] == ':')
2105      conf_error_report("Server passwords cannot begin with a colon");
2106 <  else if (strchr($3, ' ') != NULL)
2106 >  else if (strchr($3, ' '))
2107      conf_error_report("Server passwords cannot contain spaces");
2108    else
2109      strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
# Line 1996 | Line 2116 | connect_accept_password: ACCEPT_PASSWORD
2116  
2117    if ($3[0] == ':')
2118      conf_error_report("Server passwords cannot begin with a colon");
2119 <  else if (strchr($3, ' ') != NULL)
2119 >  else if (strchr($3, ' '))
2120      conf_error_report("Server passwords cannot contain spaces");
2121    else
2122      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2123   };
2124  
2125 + connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2126 + {
2127 +  if (conf_parser_ctx.pass == 2)
2128 +    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2129 + };
2130 +
2131   connect_port: PORT '=' NUMBER ';'
2132   {
2133    if (conf_parser_ctx.pass == 2)
# Line 2014 | Line 2140 | connect_aftype: AFTYPE '=' T_IPV4 ';'
2140      block_state.aftype.value = AF_INET;
2141   } | AFTYPE '=' T_IPV6 ';'
2142   {
2017 #ifdef IPV6
2143    if (conf_parser_ctx.pass == 2)
2144      block_state.aftype.value = AF_INET6;
2020 #endif
2145   };
2146  
2147   connect_flags: IRCD_FLAGS
# Line 2047 | Line 2171 | connect_encrypted: ENCRYPTED '=' TBOOL '
2171    }
2172   };
2173  
2174 < connect_hub_mask: HUB_MASK '=' QSTRING ';'
2174 > connect_hub_mask: HUB_MASK '=' QSTRING ';'
2175   {
2176    if (conf_parser_ctx.pass == 2)
2177      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2178   };
2179  
2180 < connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2180 > connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2181   {
2182    if (conf_parser_ctx.pass == 2)
2183      dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
# Line 2067 | Line 2191 | connect_class: CLASS '=' QSTRING ';'
2191  
2192   connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2193   {
2194 < #ifdef HAVE_LIBCRYPTO
2194 > #ifdef HAVE_TLS
2195    if (conf_parser_ctx.pass == 2)
2196      strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2197   #else
2198    if (conf_parser_ctx.pass == 2)
2199 <    conf_error_report("Ignoring connect::ciphers -- no OpenSSL support");
2199 >    conf_error_report("Ignoring connect::ciphers -- no TLS support");
2200   #endif
2201   };
2202  
2203  
2204   /***************************************************************************
2205 < *  section kill
2205 > * kill {} section
2206   ***************************************************************************/
2207   kill_entry: KILL
2208   {
# Line 2095 | Line 2219 | kill_entry: KILL
2219        !block_state.host.buf[0])
2220      break;
2221  
2222 +  conf = conf_make(CONF_KLINE);
2223 +  conf->user = xstrdup(block_state.user.buf);
2224 +  conf->host = xstrdup(block_state.host.buf);
2225  
2226 <  if (block_state.port.value == 1)
2227 <  {
2101 < #ifdef HAVE_LIBPCRE
2102 <    void *exp_user = NULL;
2103 <    void *exp_host = NULL;
2104 <    const char *errptr = NULL;
2105 <
2106 <    if (!(exp_user = ircd_pcre_compile(block_state.user.buf, &errptr)) ||
2107 <        !(exp_host = ircd_pcre_compile(block_state.host.buf, &errptr)))
2108 <    {
2109 <      ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2110 <           errptr);
2111 <      break;
2112 <    }
2113 <
2114 <    conf = conf_make(CONF_RKLINE);
2115 <    conf->regexuser = exp_user;
2116 <    conf->regexhost = exp_host;
2117 <
2118 <    conf->user = xstrdup(block_state.user.buf);
2119 <    conf->host = xstrdup(block_state.host.buf);
2120 <
2121 <    if (block_state.rpass.buf[0])
2122 <      conf->reason = xstrdup(block_state.rpass.buf);
2123 <    else
2124 <      conf->reason = xstrdup(CONF_NOREASON);
2125 < #else
2126 <    ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2127 <    break;
2128 < #endif
2129 <  }
2226 >  if (block_state.rpass.buf[0])
2227 >    conf->reason = xstrdup(block_state.rpass.buf);
2228    else
2229 <  {
2230 <    conf = conf_make(CONF_KLINE);
2133 <
2134 <    conf->user = xstrdup(block_state.user.buf);
2135 <    conf->host = xstrdup(block_state.host.buf);
2136 <
2137 <    if (block_state.rpass.buf[0])
2138 <      conf->reason = xstrdup(block_state.rpass.buf);
2139 <    else
2140 <      conf->reason = xstrdup(CONF_NOREASON);
2141 <    add_conf_by_address(CONF_KLINE, conf);
2142 <  }
2143 < };
2144 <
2145 < kill_type: TYPE
2146 < {
2147 <  if (conf_parser_ctx.pass == 2)
2148 <    block_state.port.value = 0;
2149 < } '='  kill_type_items ';';
2150 <
2151 < kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2152 < kill_type_item: REGEX_T
2153 < {
2154 <  if (conf_parser_ctx.pass == 2)
2155 <    block_state.port.value = 1;
2229 >    conf->reason = xstrdup(CONF_NOREASON);
2230 >  add_conf_by_address(CONF_KLINE, conf);
2231   };
2232  
2233   kill_items:     kill_items kill_item | kill_item;
2234 < kill_item:      kill_user | kill_reason | kill_type | error;
2234 > kill_item:      kill_user | kill_reason | error;
2235  
2236   kill_user: USER '=' QSTRING ';'
2237   {
# Line 2178 | Line 2253 | kill_user: USER '=' QSTRING ';'
2253    }
2254   };
2255  
2256 < kill_reason: REASON '=' QSTRING ';'
2256 > kill_reason: REASON '=' QSTRING ';'
2257   {
2258    if (conf_parser_ctx.pass == 2)
2259      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2260   };
2261  
2262 +
2263   /***************************************************************************
2264 < *  section deny
2264 > * deny {} section
2265   ***************************************************************************/
2266 < deny_entry: DENY
2266 > deny_entry: DENY
2267   {
2268    if (conf_parser_ctx.pass == 2)
2269      reset_block_state();
# Line 2212 | Line 2288 | deny_entry: DENY
2288        conf->reason = xstrdup(CONF_NOREASON);
2289      add_conf_by_address(CONF_DLINE, conf);
2290    }
2291 < };
2291 > };
2292  
2293   deny_items:     deny_items deny_item | deny_item;
2294   deny_item:      deny_ip | deny_reason | error;
# Line 2223 | Line 2299 | deny_ip: IP '=' QSTRING ';'
2299      strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2300   };
2301  
2302 < deny_reason: REASON '=' QSTRING ';'
2302 > deny_reason: REASON '=' QSTRING ';'
2303   {
2304    if (conf_parser_ctx.pass == 2)
2305      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2306   };
2307  
2308 +
2309   /***************************************************************************
2310 < *  section exempt
2310 > * exempt {} section
2311   ***************************************************************************/
2312   exempt_entry: EXEMPT '{' exempt_items '}' ';';
2313  
2314 < exempt_items:     exempt_items exempt_item | exempt_item;
2315 < exempt_item:      exempt_ip | error;
2314 > exempt_items: exempt_items exempt_item | exempt_item;
2315 > exempt_item:  exempt_ip | error;
2316  
2317   exempt_ip: IP '=' QSTRING ';'
2318   {
2319    if (conf_parser_ctx.pass == 2)
2320    {
2321 <    if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2321 >    if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2322      {
2323        struct MaskItem *conf = conf_make(CONF_EXEMPT);
2324        conf->host = xstrdup(yylval.string);
# Line 2252 | Line 2329 | exempt_ip: IP '=' QSTRING ';'
2329   };
2330  
2331   /***************************************************************************
2332 < *  section gecos
2332 > * gecos {} section
2333   ***************************************************************************/
2334   gecos_entry: GECOS
2335   {
# Line 2260 | Line 2337 | gecos_entry: GECOS
2337      reset_block_state();
2338   } '{' gecos_items '}' ';'
2339   {
2263  struct MaskItem *conf = NULL;
2264
2340    if (conf_parser_ctx.pass != 2)
2341      break;
2342  
2343    if (!block_state.name.buf[0])
2344      break;
2345  
2346 <  if (block_state.port.value == 1)
2347 <  {
2273 < #ifdef HAVE_LIBPCRE
2274 <    void *exp_p = NULL;
2275 <    const char *errptr = NULL;
2276 <
2277 <    if (!(exp_p = ircd_pcre_compile(block_state.name.buf, &errptr)))
2278 <    {
2279 <      ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2280 <           errptr);
2281 <      break;
2282 <    }
2283 <
2284 <    conf = conf_make(CONF_RXLINE);
2285 <    conf->regexuser = exp_p;
2286 < #else
2287 <    conf_error_report("Failed to add regular expression based X-Line: no PCRE support");
2288 <    break;
2289 < #endif
2290 <  }
2291 <  else
2292 <    conf = conf_make(CONF_XLINE);
2293 <
2294 <  conf->name = xstrdup(block_state.name.buf);
2346 >  struct GecosItem *gecos = gecos_make();
2347 >  gecos->mask = xstrdup(block_state.name.buf);
2348  
2349    if (block_state.rpass.buf[0])
2350 <    conf->reason = xstrdup(block_state.rpass.buf);
2350 >    gecos->reason = xstrdup(block_state.rpass.buf);
2351    else
2352 <    conf->reason = xstrdup(CONF_NOREASON);
2300 < };
2301 <
2302 < gecos_flags: TYPE
2303 < {
2304 <  if (conf_parser_ctx.pass == 2)
2305 <    block_state.port.value = 0;
2306 < } '='  gecos_flags_items ';';
2307 <
2308 < gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2309 < gecos_flags_item: REGEX_T
2310 < {
2311 <  if (conf_parser_ctx.pass == 2)
2312 <    block_state.port.value = 1;
2352 >    gecos->reason = xstrdup(CONF_NOREASON);
2353   };
2354  
2355   gecos_items: gecos_items gecos_item | gecos_item;
2356 < gecos_item:  gecos_name | gecos_reason | gecos_flags | error;
2356 > gecos_item:  gecos_name | gecos_reason | error;
2357  
2358 < gecos_name: NAME '=' QSTRING ';'
2358 > gecos_name: NAME '=' QSTRING ';'
2359   {
2360    if (conf_parser_ctx.pass == 2)
2361      strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2362   };
2363  
2364 < gecos_reason: REASON '=' QSTRING ';'
2364 > gecos_reason: REASON '=' QSTRING ';'
2365   {
2366    if (conf_parser_ctx.pass == 2)
2367      strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2368   };
2369  
2370 +
2371   /***************************************************************************
2372 < *  section general
2372 > * general {} section
2373   ***************************************************************************/
2374 < general_entry: GENERAL
2334 <  '{' general_items '}' ';';
2374 > general_entry: GENERAL '{' general_items '}' ';';
2375  
2376   general_items:      general_items general_item | general_item;
2377 < general_item:       general_hide_spoof_ips | general_ignore_bogus_ts |
2378 <                    general_failed_oper_notice | general_anti_nick_flood |
2379 <                    general_max_nick_time | general_max_nick_changes |
2380 <                    general_max_accept | general_anti_spam_exit_message_time |
2381 <                    general_ts_warn_delta | general_ts_max_delta |
2377 > general_item:       general_away_count |
2378 >                    general_away_time |
2379 >                    general_failed_oper_notice |
2380 >                    general_anti_nick_flood |
2381 >                    general_max_nick_time |
2382 >                    general_max_nick_changes |
2383 >                    general_max_accept |
2384 >                    general_whowas_history_length |
2385 >                    general_anti_spam_exit_message_time |
2386 >                    general_ts_warn_delta |
2387 >                    general_ts_max_delta |
2388                      general_kill_chase_time_limit |
2389                      general_invisible_on_connect |
2390 <                    general_warn_no_nline | general_dots_in_ident |
2391 <                    general_stats_o_oper_only | general_stats_k_oper_only |
2392 <                    general_pace_wait | general_stats_i_oper_only |
2393 <                    general_pace_wait_simple | general_stats_P_oper_only |
2394 <                    general_short_motd | general_no_oper_flood |
2395 <                    general_true_no_oper_flood | general_oper_pass_resv |
2396 <                    general_message_locale |
2397 <                    general_oper_only_umodes | general_max_targets |
2398 <                    general_use_egd | general_egdpool_path |
2399 <                    general_oper_umodes | general_caller_id_wait |
2400 <                    general_opers_bypass_callerid | general_default_floodcount |
2401 <                    general_min_nonwildcard | general_min_nonwildcard_simple |
2402 <                    general_disable_remote_commands |
2403 <                    general_throttle_time | general_havent_read_conf |
2390 >                    general_warn_no_connect_block |
2391 >                    general_dots_in_ident |
2392 >                    general_stats_i_oper_only |
2393 >                    general_stats_k_oper_only |
2394 >                    general_stats_m_oper_only |
2395 >                    general_stats_o_oper_only |
2396 >                    general_stats_P_oper_only |
2397 >                    general_stats_u_oper_only |
2398 >                    general_pace_wait |
2399 >                    general_pace_wait_simple |
2400 >                    general_short_motd |
2401 >                    general_no_oper_flood |
2402 >                    general_oper_only_umodes |
2403 >                    general_max_targets |
2404 >                    general_oper_umodes |
2405 >                    general_caller_id_wait |
2406 >                    general_opers_bypass_callerid |
2407 >                    general_default_floodcount |
2408 >                    general_default_floodtime |
2409 >                    general_min_nonwildcard |
2410 >                    general_min_nonwildcard_simple |
2411 >                    general_throttle_count |
2412 >                    general_throttle_time |
2413                      general_ping_cookie |
2414 <                    general_disable_auth |
2415 <                    general_tkline_expire_notices | general_gline_enable |
2416 <                    general_gline_duration | general_gline_request_duration |
2417 <                    general_gline_min_cidr |
2418 <                    general_gline_min_cidr6 |
2419 <                    general_stats_e_disabled |
2420 <                    general_max_watch | general_services_name |
2421 <                    error;
2414 >                    general_disable_auth |
2415 >                    general_tkline_expire_notices |
2416 >                    general_dline_min_cidr |
2417 >                    general_dline_min_cidr6 |
2418 >                    general_kline_min_cidr |
2419 >                    general_kline_min_cidr6 |
2420 >                    general_stats_e_disabled |
2421 >                    general_max_watch |
2422 >                    general_cycle_on_host_change |
2423 >                    error;
2424  
2425  
2426 < general_max_watch: MAX_WATCH '=' NUMBER ';'
2426 > general_away_count: AWAY_COUNT '=' NUMBER ';'
2427   {
2428 <  ConfigFileEntry.max_watch = $3;
2428 >  ConfigGeneral.away_count = $3;
2429   };
2430  
2431 < general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2431 > general_away_time: AWAY_TIME '=' timespec ';'
2432   {
2433 <  if (conf_parser_ctx.pass == 2)
2377 <    ConfigFileEntry.glines = yylval.number;
2433 >  ConfigGeneral.away_time = $3;
2434   };
2435  
2436 < general_gline_duration: GLINE_DURATION '=' timespec ';'
2436 > general_max_watch: MAX_WATCH '=' NUMBER ';'
2437   {
2438 <  if (conf_parser_ctx.pass == 2)
2383 <    ConfigFileEntry.gline_time = $3;
2438 >  ConfigGeneral.max_watch = $3;
2439   };
2440  
2441 < general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2441 > general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2442   {
2443 <  if (conf_parser_ctx.pass == 2)
2389 <    ConfigFileEntry.gline_request_time = $3;
2443 >  ConfigGeneral.whowas_history_length = $3;
2444   };
2445  
2446 < general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2446 > general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2447   {
2448 <  ConfigFileEntry.gline_min_cidr = $3;
2448 >  if (conf_parser_ctx.pass == 2)
2449 >    ConfigGeneral.cycle_on_host_change = yylval.number;
2450   };
2451  
2452 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2452 > general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2453   {
2454 <  ConfigFileEntry.gline_min_cidr6 = $3;
2454 >  ConfigGeneral.dline_min_cidr = $3;
2455   };
2456  
2457 < general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2457 > general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2458   {
2459 <  ConfigFileEntry.tkline_expire_notices = yylval.number;
2459 >  ConfigGeneral.dline_min_cidr6 = $3;
2460   };
2461  
2462 < general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2462 > general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2463   {
2464 <  ConfigFileEntry.kill_chase_time_limit = $3;
2464 >  ConfigGeneral.kline_min_cidr = $3;
2465   };
2466  
2467 < general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2467 > general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2468   {
2469 <  ConfigFileEntry.hide_spoof_ips = yylval.number;
2469 >  ConfigGeneral.kline_min_cidr6 = $3;
2470   };
2471  
2472 < general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2472 > general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2473   {
2474 <  ConfigFileEntry.ignore_bogus_ts = yylval.number;
2474 >  ConfigGeneral.tkline_expire_notices = yylval.number;
2475   };
2476  
2477 < general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2477 > general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2478   {
2479 <  ConfigFileEntry.disable_remote = yylval.number;
2479 >  ConfigGeneral.kill_chase_time_limit = $3;
2480   };
2481  
2482   general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2483   {
2484 <  ConfigFileEntry.failed_oper_notice = yylval.number;
2484 >  ConfigGeneral.failed_oper_notice = yylval.number;
2485   };
2486  
2487   general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2488   {
2489 <  ConfigFileEntry.anti_nick_flood = yylval.number;
2489 >  ConfigGeneral.anti_nick_flood = yylval.number;
2490   };
2491  
2492   general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2493   {
2494 <  ConfigFileEntry.max_nick_time = $3;
2494 >  ConfigGeneral.max_nick_time = $3;
2495   };
2496  
2497   general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2498   {
2499 <  ConfigFileEntry.max_nick_changes = $3;
2499 >  ConfigGeneral.max_nick_changes = $3;
2500   };
2501  
2502   general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2503   {
2504 <  ConfigFileEntry.max_accept = $3;
2504 >  ConfigGeneral.max_accept = $3;
2505   };
2506  
2507   general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2508   {
2509 <  ConfigFileEntry.anti_spam_exit_message_time = $3;
2509 >  ConfigGeneral.anti_spam_exit_message_time = $3;
2510   };
2511  
2512   general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2513   {
2514 <  ConfigFileEntry.ts_warn_delta = $3;
2514 >  ConfigGeneral.ts_warn_delta = $3;
2515   };
2516  
2517   general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2518   {
2519    if (conf_parser_ctx.pass == 2)
2520 <    ConfigFileEntry.ts_max_delta = $3;
2520 >    ConfigGeneral.ts_max_delta = $3;
2521   };
2522  
2523 < general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2523 > general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2524   {
2525 <  if (($3 > 0) && conf_parser_ctx.pass == 1)
2471 <  {
2472 <    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2473 <    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2474 <    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2475 <    exit(0);
2476 <  }
2525 >  ConfigGeneral.invisible_on_connect = yylval.number;
2526   };
2527  
2528 < general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2528 > general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2529   {
2530 <  ConfigFileEntry.invisible_on_connect = yylval.number;
2530 >  ConfigGeneral.warn_no_connect_block = yylval.number;
2531   };
2532  
2533 < general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';'
2533 > general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2534   {
2535 <  ConfigFileEntry.warn_no_nline = yylval.number;
2535 >  ConfigGeneral.stats_e_disabled = yylval.number;
2536   };
2537  
2538 < general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2538 > general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2539   {
2540 <  ConfigFileEntry.stats_e_disabled = yylval.number;
2540 >  ConfigGeneral.stats_m_oper_only = yylval.number;
2541   };
2542  
2543   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2544   {
2545 <  ConfigFileEntry.stats_o_oper_only = yylval.number;
2545 >  ConfigGeneral.stats_o_oper_only = yylval.number;
2546   };
2547  
2548   general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2549   {
2550 <  ConfigFileEntry.stats_P_oper_only = yylval.number;
2550 >  ConfigGeneral.stats_P_oper_only = yylval.number;
2551 > };
2552 >
2553 > general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2554 > {
2555 >  ConfigGeneral.stats_u_oper_only = yylval.number;
2556   };
2557  
2558   general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2559   {
2560 <  ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2560 >  ConfigGeneral.stats_k_oper_only = 2 * yylval.number;
2561   } | STATS_K_OPER_ONLY '=' TMASKED ';'
2562   {
2563 <  ConfigFileEntry.stats_k_oper_only = 1;
2563 >  ConfigGeneral.stats_k_oper_only = 1;
2564   };
2565  
2566   general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2567   {
2568 <  ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2568 >  ConfigGeneral.stats_i_oper_only = 2 * yylval.number;
2569   } | STATS_I_OPER_ONLY '=' TMASKED ';'
2570   {
2571 <  ConfigFileEntry.stats_i_oper_only = 1;
2571 >  ConfigGeneral.stats_i_oper_only = 1;
2572   };
2573  
2574   general_pace_wait: PACE_WAIT '=' timespec ';'
2575   {
2576 <  ConfigFileEntry.pace_wait = $3;
2576 >  ConfigGeneral.pace_wait = $3;
2577   };
2578  
2579   general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2580   {
2581 <  ConfigFileEntry.caller_id_wait = $3;
2581 >  ConfigGeneral.caller_id_wait = $3;
2582   };
2583  
2584   general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2585   {
2586 <  ConfigFileEntry.opers_bypass_callerid = yylval.number;
2586 >  ConfigGeneral.opers_bypass_callerid = yylval.number;
2587   };
2588  
2589   general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2590   {
2591 <  ConfigFileEntry.pace_wait_simple = $3;
2591 >  ConfigGeneral.pace_wait_simple = $3;
2592   };
2593  
2594   general_short_motd: SHORT_MOTD '=' TBOOL ';'
2595   {
2596 <  ConfigFileEntry.short_motd = yylval.number;
2543 < };
2544 <  
2545 < general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2546 < {
2547 <  ConfigFileEntry.no_oper_flood = yylval.number;
2596 >  ConfigGeneral.short_motd = yylval.number;
2597   };
2598  
2599 < general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2551 < {
2552 <  ConfigFileEntry.true_no_oper_flood = yylval.number;
2553 < };
2554 <
2555 < general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2556 < {
2557 <  ConfigFileEntry.oper_pass_resv = yylval.number;
2558 < };
2559 <
2560 < general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
2599 > general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2600   {
2601 <  if (conf_parser_ctx.pass == 2)
2563 <  {
2564 <    if (strlen(yylval.string) > LOCALE_LENGTH-2)
2565 <      yylval.string[LOCALE_LENGTH-1] = '\0';
2566 <
2567 <    set_locale(yylval.string);
2568 <  }
2601 >  ConfigGeneral.no_oper_flood = yylval.number;
2602   };
2603  
2604   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2605   {
2606 <  ConfigFileEntry.dots_in_ident = $3;
2606 >  ConfigGeneral.dots_in_ident = $3;
2607   };
2608  
2609   general_max_targets: MAX_TARGETS '=' NUMBER ';'
2610   {
2611 <  ConfigFileEntry.max_targets = $3;
2579 < };
2580 <
2581 < general_use_egd: USE_EGD '=' TBOOL ';'
2582 < {
2583 <  ConfigFileEntry.use_egd = yylval.number;
2611 >  ConfigGeneral.max_targets = $3;
2612   };
2613  
2614 < general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2587 < {
2588 <  if (conf_parser_ctx.pass == 2)
2589 <  {
2590 <    MyFree(ConfigFileEntry.egdpool_path);
2591 <    ConfigFileEntry.egdpool_path = xstrdup(yylval.string);
2592 <  }
2593 < };
2594 <
2595 < general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2614 > general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2615   {
2616 <  if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2598 <  {
2599 <    MyFree(ConfigFileEntry.service_name);
2600 <    ConfigFileEntry.service_name = xstrdup(yylval.string);
2601 <  }
2616 >  ConfigGeneral.ping_cookie = yylval.number;
2617   };
2618  
2619 < general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2619 > general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2620   {
2621 <  ConfigFileEntry.ping_cookie = yylval.number;
2621 >  ConfigGeneral.disable_auth = yylval.number;
2622   };
2623  
2624 < general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2624 > general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2625   {
2626 <  ConfigFileEntry.disable_auth = yylval.number;
2626 >  ConfigGeneral.throttle_count = $3;
2627   };
2628  
2629   general_throttle_time: THROTTLE_TIME '=' timespec ';'
2630   {
2631 <  ConfigFileEntry.throttle_time = yylval.number;
2631 >  ConfigGeneral.throttle_time = $3;
2632   };
2633  
2634   general_oper_umodes: OPER_UMODES
2635   {
2636 <  ConfigFileEntry.oper_umodes = 0;
2636 >  ConfigGeneral.oper_umodes = 0;
2637   } '='  umode_oitems ';' ;
2638  
2639   umode_oitems:    umode_oitems ',' umode_oitem | umode_oitem;
2640   umode_oitem:     T_BOTS
2641   {
2642 <  ConfigFileEntry.oper_umodes |= UMODE_BOTS;
2642 >  ConfigGeneral.oper_umodes |= UMODE_BOTS;
2643   } | T_CCONN
2644   {
2645 <  ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2631 < } | T_CCONN_FULL
2632 < {
2633 <  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
2645 >  ConfigGeneral.oper_umodes |= UMODE_CCONN;
2646   } | T_DEAF
2647   {
2648 <  ConfigFileEntry.oper_umodes |= UMODE_DEAF;
2648 >  ConfigGeneral.oper_umodes |= UMODE_DEAF;
2649   } | T_DEBUG
2650   {
2651 <  ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
2651 >  ConfigGeneral.oper_umodes |= UMODE_DEBUG;
2652   } | T_FULL
2653   {
2654 <  ConfigFileEntry.oper_umodes |= UMODE_FULL;
2654 >  ConfigGeneral.oper_umodes |= UMODE_FULL;
2655   } | HIDDEN
2656   {
2657 <  ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2657 >  ConfigGeneral.oper_umodes |= UMODE_HIDDEN;
2658 > } | HIDE_CHANS
2659 > {
2660 >  ConfigGeneral.oper_umodes |= UMODE_HIDECHANS;
2661 > } | HIDE_IDLE
2662 > {
2663 >  ConfigGeneral.oper_umodes |= UMODE_HIDEIDLE;
2664   } | T_SKILL
2665   {
2666 <  ConfigFileEntry.oper_umodes |= UMODE_SKILL;
2666 >  ConfigGeneral.oper_umodes |= UMODE_SKILL;
2667   } | T_NCHANGE
2668   {
2669 <  ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
2669 >  ConfigGeneral.oper_umodes |= UMODE_NCHANGE;
2670   } | T_REJ
2671   {
2672 <  ConfigFileEntry.oper_umodes |= UMODE_REJ;
2672 >  ConfigGeneral.oper_umodes |= UMODE_REJ;
2673   } | T_UNAUTH
2674   {
2675 <  ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
2675 >  ConfigGeneral.oper_umodes |= UMODE_UNAUTH;
2676   } | T_SPY
2677   {
2678 <  ConfigFileEntry.oper_umodes |= UMODE_SPY;
2678 >  ConfigGeneral.oper_umodes |= UMODE_SPY;
2679   } | T_EXTERNAL
2680   {
2681 <  ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
2664 < } | T_OPERWALL
2665 < {
2666 <  ConfigFileEntry.oper_umodes |= UMODE_OPERWALL;
2681 >  ConfigGeneral.oper_umodes |= UMODE_EXTERNAL;
2682   } | T_SERVNOTICE
2683   {
2684 <  ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
2684 >  ConfigGeneral.oper_umodes |= UMODE_SERVNOTICE;
2685   } | T_INVISIBLE
2686   {
2687 <  ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
2687 >  ConfigGeneral.oper_umodes |= UMODE_INVISIBLE;
2688   } | T_WALLOP
2689   {
2690 <  ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
2690 >  ConfigGeneral.oper_umodes |= UMODE_WALLOP;
2691   } | T_SOFTCALLERID
2692   {
2693 <  ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
2693 >  ConfigGeneral.oper_umodes |= UMODE_SOFTCALLERID;
2694   } | T_CALLERID
2695   {
2696 <  ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
2696 >  ConfigGeneral.oper_umodes |= UMODE_CALLERID;
2697   } | T_LOCOPS
2698   {
2699 <  ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2699 >  ConfigGeneral.oper_umodes |= UMODE_LOCOPS;
2700 > } | T_NONONREG
2701 > {
2702 >  ConfigGeneral.oper_umodes |= UMODE_REGONLY;
2703 > } | T_FARCONNECT
2704 > {
2705 >  ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2706   };
2707  
2708 < general_oper_only_umodes: OPER_ONLY_UMODES
2708 > general_oper_only_umodes: OPER_ONLY_UMODES
2709   {
2710 <  ConfigFileEntry.oper_only_umodes = 0;
2710 >  ConfigGeneral.oper_only_umodes = 0;
2711   } '='  umode_items ';' ;
2712  
2713 < umode_items:    umode_items ',' umode_item | umode_item;
2714 < umode_item:     T_BOTS
2713 > umode_items:  umode_items ',' umode_item | umode_item;
2714 > umode_item:   T_BOTS
2715   {
2716 <  ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2716 >  ConfigGeneral.oper_only_umodes |= UMODE_BOTS;
2717   } | T_CCONN
2718   {
2719 <  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2699 < } | T_CCONN_FULL
2700 < {
2701 <  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
2719 >  ConfigGeneral.oper_only_umodes |= UMODE_CCONN;
2720   } | T_DEAF
2721   {
2722 <  ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
2722 >  ConfigGeneral.oper_only_umodes |= UMODE_DEAF;
2723   } | T_DEBUG
2724   {
2725 <  ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2725 >  ConfigGeneral.oper_only_umodes |= UMODE_DEBUG;
2726   } | T_FULL
2727 < {
2728 <  ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2727 > {
2728 >  ConfigGeneral.oper_only_umodes |= UMODE_FULL;
2729   } | T_SKILL
2730   {
2731 <  ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2731 >  ConfigGeneral.oper_only_umodes |= UMODE_SKILL;
2732   } | HIDDEN
2733   {
2734 <  ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
2734 >  ConfigGeneral.oper_only_umodes |= UMODE_HIDDEN;
2735   } | T_NCHANGE
2736   {
2737 <  ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
2737 >  ConfigGeneral.oper_only_umodes |= UMODE_NCHANGE;
2738   } | T_REJ
2739   {
2740 <  ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
2740 >  ConfigGeneral.oper_only_umodes |= UMODE_REJ;
2741   } | T_UNAUTH
2742   {
2743 <  ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
2743 >  ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH;
2744   } | T_SPY
2745   {
2746 <  ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
2746 >  ConfigGeneral.oper_only_umodes |= UMODE_SPY;
2747   } | T_EXTERNAL
2748   {
2749 <  ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
2732 < } | T_OPERWALL
2733 < {
2734 <  ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL;
2749 >  ConfigGeneral.oper_only_umodes |= UMODE_EXTERNAL;
2750   } | T_SERVNOTICE
2751   {
2752 <  ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
2752 >  ConfigGeneral.oper_only_umodes |= UMODE_SERVNOTICE;
2753   } | T_INVISIBLE
2754   {
2755 <  ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
2755 >  ConfigGeneral.oper_only_umodes |= UMODE_INVISIBLE;
2756   } | T_WALLOP
2757   {
2758 <  ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
2758 >  ConfigGeneral.oper_only_umodes |= UMODE_WALLOP;
2759   } | T_SOFTCALLERID
2760   {
2761 <  ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
2761 >  ConfigGeneral.oper_only_umodes |= UMODE_SOFTCALLERID;
2762   } | T_CALLERID
2763   {
2764 <  ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
2764 >  ConfigGeneral.oper_only_umodes |= UMODE_CALLERID;
2765   } | T_LOCOPS
2766   {
2767 <  ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
2767 >  ConfigGeneral.oper_only_umodes |= UMODE_LOCOPS;
2768 > } | T_NONONREG
2769 > {
2770 >  ConfigGeneral.oper_only_umodes |= UMODE_REGONLY;
2771 > } | T_FARCONNECT
2772 > {
2773 >  ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2774   };
2775  
2776   general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2777   {
2778 <  ConfigFileEntry.min_nonwildcard = $3;
2778 >  ConfigGeneral.min_nonwildcard = $3;
2779   };
2780  
2781   general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2782   {
2783 <  ConfigFileEntry.min_nonwildcard_simple = $3;
2783 >  ConfigGeneral.min_nonwildcard_simple = $3;
2784   };
2785  
2786   general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2787   {
2788 <  ConfigFileEntry.default_floodcount = $3;
2788 >  ConfigGeneral.default_floodcount = $3;
2789 > };
2790 >
2791 > general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';'
2792 > {
2793 >  ConfigGeneral.default_floodtime = $3;
2794   };
2795  
2796  
2797   /***************************************************************************
2798 < *  section channel
2798 > * channel {} section
2799   ***************************************************************************/
2800 < channel_entry: CHANNEL
2775 <  '{' channel_items '}' ';';
2800 > channel_entry: CHANNEL '{' channel_items '}' ';';
2801  
2802   channel_items:      channel_items channel_item | channel_item;
2803   channel_item:       channel_max_bans |
2804 <                    channel_knock_delay | channel_knock_delay_channel |
2805 <                    channel_max_chans_per_user | channel_max_chans_per_oper |
2806 <                    channel_quiet_on_ban | channel_default_split_user_count |
2807 <                    channel_default_split_server_count |
2808 <                    channel_no_create_on_split | channel_restrict_channels |
2809 <                    channel_no_join_on_split |
2810 <                    channel_jflood_count | channel_jflood_time |
2811 <                    channel_disable_fake_channels | error;
2804 >                    channel_max_bans_large |
2805 >                    channel_invite_client_count |
2806 >                    channel_invite_client_time |
2807 >                    channel_invite_delay_channel |
2808 >                    channel_invite_expire_time |
2809 >                    channel_knock_client_count |
2810 >                    channel_knock_client_time |
2811 >                    channel_knock_delay_channel |
2812 >                    channel_max_channels |
2813 >                    channel_max_invites |
2814 >                    channel_default_join_flood_count |
2815 >                    channel_default_join_flood_time |
2816 >                    channel_disable_fake_channels |
2817 >                    error;
2818  
2819   channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2820   {
2821    ConfigChannel.disable_fake_channels = yylval.number;
2822   };
2823  
2824 < channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
2824 > channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2825   {
2826 <  ConfigChannel.restrict_channels = yylval.number;
2826 >  ConfigChannel.invite_client_count = $3;
2827   };
2828  
2829 < channel_knock_delay: KNOCK_DELAY '=' timespec ';'
2829 > channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2830   {
2831 <  ConfigChannel.knock_delay = $3;
2831 >  ConfigChannel.invite_client_time = $3;
2832   };
2833  
2834 < channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
2834 > channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2835   {
2836 <  ConfigChannel.knock_delay_channel = $3;
2836 >  ConfigChannel.invite_delay_channel = $3;
2837   };
2838  
2839 < channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
2839 > channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';'
2840   {
2841 <  ConfigChannel.max_chans_per_user = $3;
2841 >  ConfigChannel.invite_expire_time = $3;
2842   };
2843  
2844 < channel_max_chans_per_oper: MAX_CHANS_PER_OPER '=' NUMBER ';'
2844 > channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2845   {
2846 <  ConfigChannel.max_chans_per_oper = $3;
2846 >  ConfigChannel.knock_client_count = $3;
2847   };
2848  
2849 < channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
2849 > channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2850   {
2851 <  ConfigChannel.quiet_on_ban = yylval.number;
2851 >  ConfigChannel.knock_client_time = $3;
2852   };
2853  
2854 < channel_max_bans: MAX_BANS '=' NUMBER ';'
2854 > channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
2855   {
2856 <  ConfigChannel.max_bans = $3;
2856 >  ConfigChannel.knock_delay_channel = $3;
2857   };
2858  
2859 < channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2859 > channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
2860   {
2861 <  ConfigChannel.default_split_user_count = $3;
2861 >  ConfigChannel.max_channels = $3;
2862   };
2863  
2864 < channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2864 > channel_max_invites: MAX_INVITES '=' NUMBER ';'
2865   {
2866 <  ConfigChannel.default_split_server_count = $3;
2866 >  ConfigChannel.max_invites = $3;
2867   };
2868  
2869 < channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
2869 > channel_max_bans: MAX_BANS '=' NUMBER ';'
2870   {
2871 <  ConfigChannel.no_create_on_split = yylval.number;
2871 >  ConfigChannel.max_bans = $3;
2872   };
2873  
2874 < channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2874 > channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';'
2875   {
2876 <  ConfigChannel.no_join_on_split = yylval.number;
2876 >  ConfigChannel.max_bans_large = $3;
2877   };
2878  
2879 < channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2879 > channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2880   {
2881 <  GlobalSetOptions.joinfloodcount = yylval.number;
2881 >  ConfigChannel.default_join_flood_count = yylval.number;
2882   };
2883  
2884 < channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
2884 > channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2885   {
2886 <  GlobalSetOptions.joinfloodtime = yylval.number;
2886 >  ConfigChannel.default_join_flood_time = $3;
2887   };
2888  
2889 +
2890   /***************************************************************************
2891 < *  section serverhide
2891 > * serverhide {} section
2892   ***************************************************************************/
2893 < serverhide_entry: SERVERHIDE
2862 <  '{' serverhide_items '}' ';';
2893 > serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2894  
2895   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
2896 < serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
2897 <                    serverhide_links_delay |
2898 <                    serverhide_hidden | serverhide_hidden_name |
2899 <                    serverhide_hide_server_ips |
2896 > serverhide_item:    serverhide_flatten_links |
2897 >                    serverhide_flatten_links_delay |
2898 >                    serverhide_flatten_links_file |
2899 >                    serverhide_disable_remote_commands |
2900 >                    serverhide_hide_servers |
2901 >                    serverhide_hide_services |
2902 >                    serverhide_hidden |
2903 >                    serverhide_hidden_name |
2904 >                    serverhide_hide_server_ips |
2905                      error;
2906  
2907   serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
# Line 2874 | Line 2910 | serverhide_flatten_links: FLATTEN_LINKS
2910      ConfigServerHide.flatten_links = yylval.number;
2911   };
2912  
2913 < serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
2913 > serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2914   {
2915    if (conf_parser_ctx.pass == 2)
2916 <    ConfigServerHide.hide_servers = yylval.number;
2916 >  {
2917 >    if ($3 > 0)
2918 >    {
2919 >      event_write_links_file.when = $3;
2920 >      event_add(&event_write_links_file, NULL);
2921 >    }
2922 >    else
2923 >     event_delete(&event_write_links_file);
2924 >
2925 >    ConfigServerHide.flatten_links_delay = $3;
2926 >  }
2927   };
2928  
2929 < serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
2929 > serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
2930   {
2931    if (conf_parser_ctx.pass == 2)
2932    {
2933 <    MyFree(ConfigServerHide.hidden_name);
2934 <    ConfigServerHide.hidden_name = xstrdup(yylval.string);
2933 >    xfree(ConfigServerHide.flatten_links_file);
2934 >    ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
2935    }
2936   };
2937  
2938 < serverhide_links_delay: LINKS_DELAY '=' timespec ';'
2938 > serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2939   {
2940    if (conf_parser_ctx.pass == 2)
2941 <  {
2942 <    if (($3 > 0) && ConfigServerHide.links_disabled == 1)
2943 <    {
2944 <      eventAddIsh("write_links_file", write_links_file, NULL, $3);
2945 <      ConfigServerHide.links_disabled = 0;
2946 <    }
2941 >    ConfigServerHide.disable_remote_commands = yylval.number;
2942 > };
2943 >
2944 > serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
2945 > {
2946 >  if (conf_parser_ctx.pass == 2)
2947 >    ConfigServerHide.hide_servers = yylval.number;
2948 > };
2949  
2950 <    ConfigServerHide.links_delay = $3;
2950 > serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
2951 > {
2952 >  if (conf_parser_ctx.pass == 2)
2953 >    ConfigServerHide.hide_services = yylval.number;
2954 > };
2955 >
2956 > serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
2957 > {
2958 >  if (conf_parser_ctx.pass == 2)
2959 >  {
2960 >    xfree(ConfigServerHide.hidden_name);
2961 >    ConfigServerHide.hidden_name = xstrdup(yylval.string);
2962    }
2963   };
2964  

Comparing ircd-hybrid/trunk/src/conf_parser.y (property svn:keywords):
Revision 1753 by michael, Wed Jan 16 19:30:51 2013 UTC vs.
Revision 8792 by michael, Thu Jan 17 18:35:32 2019 UTC

# Line 1 | Line 1
1 < Id Revision
1 > Id

Diff Legend

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