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-8/src/conf_parser.y (file contents), Revision 1389 by michael, Tue May 1 13:08:29 2012 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (file contents), 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"
38 #include "client.h"     /* for UMODE_ALL only */
46   #include "irc_string.h"
40 #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"
45 #include "send.h"
51   #include "listener.h"
52 < #include "resv.h"
53 < #include "numeric.h"
49 < #include "s_user.h"
50 <
51 < #ifdef HAVE_LIBCRYPTO
52 < #include <openssl/rsa.h>
53 < #include <openssl/bio.h>
54 < #include <openssl/pem.h>
55 < #include <openssl/dh.h>
56 < #endif
52 > #include "user.h"
53 > #include "motd.h"
54  
55   int yylex(void);
56  
57 < static char *class_name = NULL;
58 < static struct ConfItem *yy_conf = NULL;
59 < static struct AccessItem *yy_aconf = NULL;
60 < static struct MatchItem *yy_match_item = NULL;
61 < static struct ClassItem *yy_class = NULL;
62 < static char *yy_class_name = NULL;
63 <
64 < static dlink_list col_conf_list  = { NULL, NULL, 0 };
65 < static unsigned int listener_flags = 0;
66 < static unsigned int regex_ban = 0;
67 < static char userbuf[IRCD_BUFSIZE];
68 < static char hostbuf[IRCD_BUFSIZE];
69 < static char reasonbuf[REASONLEN + 1];
70 < static char gecos_name[REALLEN * 4];
71 < static char lfile[IRCD_BUFSIZE];
72 < static unsigned int ltype = 0;
73 < static unsigned int lsize = 0;
74 < static char *resv_reason = NULL;
75 < static char *listener_address = NULL;
76 <
77 < struct CollectItem
78 < {
79 <  dlink_node node;
80 <  char *name;
81 <  char *user;
82 <  char *host;
83 <  char *passwd;
84 <  int  port;
85 <  int  flags;
86 < #ifdef HAVE_LIBCRYPTO
87 <  char *rsa_public_key_file;
88 <  RSA *rsa_public_key;
89 < #endif
90 < };
57 > static struct
58 > {
59 >  struct
60 >  {
61 >    dlink_list list;
62 >  } mask,
63 >    leaf,
64 >    hub;
65 >
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 >    whois,
81 >    class,
82 >    target,
83 >    prepend,
84 >    command;
85 >
86 >  struct
87 >  {
88 >    unsigned int value;
89 >  } flags,
90 >    modes,
91 >    size,
92 >    type,
93 >    port,
94 >    aftype,
95 >    ping_freq,
96 >    max_perip_local,
97 >    max_perip_global,
98 >    con_freq,
99 >    min_idle,
100 >    max_idle,
101 >    max_total,
102 >    max_sendq,
103 >    max_recvq,
104 >    max_channels,
105 >    cidr_bitlen_ipv4,
106 >    cidr_bitlen_ipv6,
107 >    number_per_cidr;
108 > } block_state;
109  
110   static void
111 < free_collect_item(struct CollectItem *item)
111 > reset_block_state(void)
112   {
113 <  MyFree(item->name);
114 <  MyFree(item->user);
115 <  MyFree(item->host);
116 <  MyFree(item->passwd);
117 < #ifdef HAVE_LIBCRYPTO
118 <  MyFree(item->rsa_public_key_file);
119 < #endif
120 <  MyFree(item);
113 >  dlink_node *node = NULL, *node_next = NULL;
114 >
115 >  DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head)
116 >  {
117 >    xfree(node->data);
118 >    dlinkDelete(node, &block_state.mask.list);
119 >    free_dlink_node(node);
120 >  }
121 >
122 >  DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head)
123 >  {
124 >    xfree(node->data);
125 >    dlinkDelete(node, &block_state.leaf.list);
126 >    free_dlink_node(node);
127 >  }
128 >
129 >  DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head)
130 >  {
131 >    xfree(node->data);
132 >    dlinkDelete(node, &block_state.hub.list);
133 >    free_dlink_node(node);
134 >  }
135 >
136 >  memset(&block_state, 0, sizeof(block_state));
137   }
138  
139   %}
# Line 113 | Line 144 | free_collect_item(struct CollectItem *it
144   }
145  
146   %token  ACCEPT_PASSWORD
116 %token  ACTION
147   %token  ADMIN
148   %token  AFTYPE
119 %token  T_ALLOW
149   %token  ANTI_NICK_FLOOD
150   %token  ANTI_SPAM_EXIT_MESSAGE_TIME
151   %token  AUTOCONN
152 < %token  T_BLOCK
153 < %token  BURST_AWAY
154 < %token  BURST_TOPICWHO
126 < %token  BYTES KBYTES MBYTES GBYTES TBYTES
152 > %token  AWAY_COUNT
153 > %token  AWAY_TIME
154 > %token  BYTES KBYTES MBYTES
155   %token  CALLER_ID_WAIT
156   %token  CAN_FLOOD
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
143 %token  DISABLE_HIDDEN
144 %token  DISABLE_LOCAL_CHANNELS
175   %token  DISABLE_REMOTE_COMMANDS
176 + %token  DLINE_MIN_CIDR
177 + %token  DLINE_MIN_CIDR6
178   %token  DOTS_IN_IDENT
147 %token  DURATION
148 %token  EGDPOOL_PATH
179   %token  EMAIL
150 %token  ENABLE
180   %token  ENCRYPTED
181   %token  EXCEED_LIMIT
182   %token  EXEMPT
183   %token  FAILED_OPER_NOTICE
155 %token  IRCD_FLAGS
184   %token  FLATTEN_LINKS
185 + %token  FLATTEN_LINKS_DELAY
186 + %token  FLATTEN_LINKS_FILE
187   %token  GECOS
188   %token  GENERAL
159 %token  GLINE
160 %token  GLINES
161 %token  GLINE_EXEMPT
162 %token  GLINE_TIME
163 %token  GLINE_MIN_CIDR
164 %token  GLINE_MIN_CIDR6
165 %token  GLOBAL_KILL
166 %token  IRCD_AUTH
167 %token  NEED_IDENT
168 %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
177 %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  KLINE_REASON
215 < %token  KLINE_WITH_REASON
216 < %token  KNOCK_DELAY
214 > %token  KLINE_MIN_CIDR
215 > %token  KLINE_MIN_CIDR6
216 > %token  KNOCK_CLIENT_COUNT
217 > %token  KNOCK_CLIENT_TIME
218   %token  KNOCK_DELAY_CHANNEL
219   %token  LEAF_MASK
189 %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_USER
225 < %token  MAX_GLOBAL
226 < %token  MAX_IDENT
227 < %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
231   %token  MAX_NUMBER
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
213 %token  NICK_CHANGES
214 %token  NO_CREATE_ON_SPLIT
215 %token  NO_JOIN_ON_SPLIT
247   %token  NO_OPER_FLOOD
248   %token  NO_TILDE
249   %token  NUMBER
219 %token  NUMBER_PER_IDENT
250   %token  NUMBER_PER_CIDR
221 %token  NUMBER_PER_IP
251   %token  NUMBER_PER_IP_GLOBAL
252 < %token  OPERATOR
224 < %token  OPERS_BYPASS_CALLERID
252 > %token  NUMBER_PER_IP_LOCAL
253   %token  OPER_ONLY_UMODES
226 %token  OPER_PASS_RESV
227 %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
260   %token  PATH
261   %token  PING_COOKIE
262   %token  PING_TIME
237 %token  PING_WARNING
263   %token  PORT
264   %token  QSTRING
265 < %token  QUIET_ON_BAN
265 > %token  RANDOM_IDLE
266   %token  REASON
267   %token  REDIRPORT
268   %token  REDIRSERV
244 %token  REGEX_T
269   %token  REHASH
246 %token  TREJECT_HOLD_TIME
270   %token  REMOTE
271   %token  REMOTEBAN
249 %token  RESTRICT_CHANNELS
250 %token  RESTRICTED
251 %token  RSA_PRIVATE_KEY_FILE
252 %token  RSA_PUBLIC_KEY_FILE
253 %token  SSL_CERTIFICATE_FILE
254 %token  SSL_DH_PARAM_FILE
255 %token  T_SSL_CLIENT_METHOD
256 %token  T_SSL_SERVER_METHOD
257 %token  T_SSLV3
258 %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
266 %token  IRCD_SID
267 %token  TKLINE_EXPIRE_NOTICES
268 %token  T_SHARED
269 %token  T_CLUSTER
270 %token  TYPE
280   %token  SHORT_MOTD
272 %token  SILENT
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
281 < %token  TMASKED
282 < %token  T_REJECT
283 < %token  TS_MAX_DELTA
284 < %token  TS_WARN_DELTA
285 < %token  TWODOTS
296 > %token  STATS_U_OPER_ONLY
297   %token  T_ALL
298   %token  T_BOTS
288 %token  T_SOFTCALLERID
299   %token  T_CALLERID
300   %token  T_CCONN
301 < %token  T_CCONN_FULL
302 < %token  T_SSL_CIPHER_LIST
293 < %token  T_CLIENT_FLOOD
301 > %token  T_COMMAND
302 > %token  T_CLUSTER
303   %token  T_DEAF
304   %token  T_DEBUG
305   %token  T_DLINE
297 %token  T_DRONE
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
319 %token  T_GLOBOPS
342   %token  T_WALLOP
343 < %token  T_RESTART
344 < %token  T_SERVICE
345 < %token  T_SERVICES_NAME
343 > %token  T_WALLOPS
344 > %token  T_WEBIRC
345 > %token  TBOOL
346 > %token  THROTTLE_COUNT
347   %token  THROTTLE_TIME
348 < %token  TOPICBURST
349 < %token  TRUE_NO_OPER_FLOOD
350 < %token  TKLINE
351 < %token  TXLINE
352 < %token  TRESV
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
331 %token  USER
332 %token  USE_EGD
333 %token  USE_EXCEPT
334 %token  USE_INVEX
335 %token  USE_KNOCK
355   %token  USE_LOGGING
356 < %token  USE_WHOIS_ACTUALLY
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
342 < %token  WARN_NO_NLINE
343 < %token  T_SIZE
344 < %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
376 <                | gline_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 <                }
401 <                | NUMBER DAYS timespec_
402 <                {
403 <                        $$ = $1 * 60 * 60 * 24 + $3;
404 <                }
405 <                | NUMBER WEEKS timespec_
406 <                {
407 <                        $$ = $1 * 60 * 60 * 24 * 7 + $3;
408 <                }
409 <                ;
410 <
411 < sizespec_:      { $$ = 0; } | sizespec;
412 < sizespec:       NUMBER sizespec_ { $$ = $1 + $2; }
413 <                | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
414 <                | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
415 <                | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
416 <                ;
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
423 <  '{' 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 438 | 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_ssl_dh_param_file |
454 <                        serverinfo_rsa_private_key_file | serverinfo_vhost6 |
455 <                        serverinfo_sid | serverinfo_ssl_certificate_file |
456 <                        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  
455 serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
456 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;
459 < client_method_type_item: T_SSLV3
460 < {
461 < #ifdef HAVE_LIBCRYPTO
462 <  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
463 <    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
464 < #endif
465 < } | 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;
474 < server_method_type_item: T_SSLV3
475 < {
476 < #ifdef HAVE_LIBCRYPTO
477 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
478 <    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
479 < #endif
480 < } | 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
491 <  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 <    {
495 <      yyerror("No rsa_private_key_file specified, SSL disabled");
496 <      break;
497 <    }
498 <
499 <    if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
500 <                                     SSL_FILETYPE_PEM) <= 0 ||
501 <        SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
502 <                                     SSL_FILETYPE_PEM) <= 0)
503 <    {
504 <      yyerror(ERR_lib_error_string(ERR_get_error()));
505 <      break;
506 <    }
507 <
508 <    if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
509 <                                    SSL_FILETYPE_PEM) <= 0 ||
510 <        SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
511 <                                    SSL_FILETYPE_PEM) <= 0)
512 <    {
513 <      yyerror(ERR_lib_error_string(ERR_get_error()));
514 <      break;
515 <    }
516 <
517 <    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) ||
518 <        !SSL_CTX_check_private_key(ServerInfo.client_ctx))
519 <    {
520 <      yyerror(ERR_lib_error_string(ERR_get_error()));
521 <      break;
522 <    }
492 >    xfree(ConfigServerInfo.ssl_dh_param_file);
493 >    ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string);
494    }
524 #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
530 <  if (conf_parser_ctx.pass == 1)
499 >  if (conf_parser_ctx.pass == 2)
500    {
501 <    BIO *file;
502 <
534 <    if (ServerInfo.rsa_private_key)
535 <    {
536 <      RSA_free(ServerInfo.rsa_private_key);
537 <      ServerInfo.rsa_private_key = NULL;
538 <    }
539 <
540 <    if (ServerInfo.rsa_private_key_file)
541 <    {
542 <      MyFree(ServerInfo.rsa_private_key_file);
543 <      ServerInfo.rsa_private_key_file = NULL;
544 <    }
545 <
546 <    DupString(ServerInfo.rsa_private_key_file, yylval.string);
547 <
548 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
549 <    {
550 <      yyerror("File open failed, ignoring");
551 <      break;
552 <    }
553 <
554 <    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
555 <
556 <    BIO_set_close(file, BIO_CLOSE);
557 <    BIO_free(file);
558 <
559 <    if (ServerInfo.rsa_private_key == NULL)
560 <    {
561 <      yyerror("Couldn't extract key, ignoring");
562 <      break;
563 <    }
564 <
565 <    if (!RSA_check_key(ServerInfo.rsa_private_key))
566 <    {
567 <      RSA_free(ServerInfo.rsa_private_key);
568 <      ServerInfo.rsa_private_key = NULL;
569 <
570 <      yyerror("Invalid key, ignoring");
571 <      break;
572 <    }
573 <
574 <    /* require 2048 bit (256 byte) key */
575 <    if (RSA_size(ServerInfo.rsa_private_key) != 256)
576 <    {
577 <      RSA_free(ServerInfo.rsa_private_key);
578 <      ServerInfo.rsa_private_key = NULL;
579 <
580 <      yyerror("Not a 2048 bit key, ignoring");
581 <    }
501 >    xfree(ConfigServerInfo.ssl_cipher_list);
502 >    ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string);
503    }
583 #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 */
589 < #ifdef HAVE_LIBCRYPTO
590 <  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 <
594 <    if (file)
595 <    {
596 <      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
597 <
598 <      BIO_free(file);
599 <
600 <      if (dh)
601 <      {
602 <        if (DH_size(dh) < 128)
603 <          ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
604 <        else
605 <          SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
606 <
607 <        DH_free(dh);
608 <      }
609 <    }
510 >    xfree(ConfigServerInfo.ssl_message_digest_algorithm);
511 >    ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string);
512    }
513 < #endif
612 < };
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 <      DupString(ServerInfo.name, yylval.string);
529 >    if (server_valid_name(yylval.string) == true)
530 >      ConfigServerInfo.name = xstrdup(yylval.string);
531      else
532      {
533 <      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::name -- invalid name. Aborting.");
534 <      exit(0);
533 >      conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting.");
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 <      DupString(ServerInfo.sid, yylval.string);
545 >      ConfigServerInfo.sid = xstrdup(yylval.string);
546      else
547      {
548 <      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
549 <      exit(0);
548 >      conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting.");
549 >      exit(EXIT_FAILURE);
550      }
551    }
552   };
# Line 653 | Line 555 | serverinfo_description: DESCRIPTION '='
555   {
556    if (conf_parser_ctx.pass == 2)
557    {
558 <    MyFree(ServerInfo.description);
559 <    DupString(ServerInfo.description,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 664 | 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 <    DupString(ServerInfo.network_name, 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 <    DupString(ServerInfo.network_desc, 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 697 | 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   {
714 #ifdef IPV6
617    if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
618    {
619      struct addrinfo hints, *res;
# Line 726 | 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    }
739 #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)
645 >  if (conf_parser_ctx.pass != 2)
646 >    break;
647 >
648 >  if ($3 < 1)
649    {
650 <    recalc_fdlimit(NULL);
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] = "";
656  
657 <    if ($3 < MAXCLIENTS_MIN)
658 <    {
659 <      char buf[IRCD_BUFSIZE];
660 <      ircsprintf(buf, "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
661 <      yyerror(buf);
662 <    }
663 <    else if ($3 > MAXCLIENTS_MAX)
664 <    {
665 <      char buf[IRCD_BUFSIZE];
666 <      ircsprintf(buf, "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
667 <      yyerror(buf);
668 <    }
669 <    else
670 <      ServerInfo.max_clients = $3;
657 >    snprintf(buf, sizeof(buf), "default_max_clients too high, setting to %d", MAXCLIENTS_MAX);
658 >    conf_error_report(buf);
659 >    ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
660 >  }
661 >  else
662 >    ConfigServerInfo.default_max_clients = $3;
663 > };
664 >
665 > serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';'
666 > {
667 >  if (conf_parser_ctx.pass != 2)
668 >    break;
669 >
670 >  if ($3 < 9)
671 >  {
672 >    conf_error_report("max_nick_length too low, setting to 9");
673 >    ConfigServerInfo.max_nick_length = 9;
674 >  }
675 >  else if ($3 > NICKLEN)
676 >  {
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 >    ConfigServerInfo.max_nick_length = NICKLEN;
682 >  }
683 >  else
684 >    ConfigServerInfo.max_nick_length = $3;
685 > };
686 >
687 > serverinfo_max_topic_length: MAX_TOPIC_LENGTH '=' NUMBER ';'
688 > {
689 >  if (conf_parser_ctx.pass != 2)
690 >    break;
691 >
692 >  if ($3 < 80)
693 >  {
694 >    conf_error_report("max_topic_length too low, setting to 80");
695 >    ConfigServerInfo.max_topic_length = 80;
696    }
697 +  else if ($3 > TOPICLEN)
698 +  {
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 +    ConfigServerInfo.max_topic_length = TOPICLEN;
704 +  }
705 +  else
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 <    DupString(AdminInfo.name, 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 <    DupString(AdminInfo.email, 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 <    DupString(AdminInfo.description, 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:
870   {
871 <  lfile[0] = '\0';
872 <  ltype = 0;
826 <  lsize = 0;
871 >  if (conf_parser_ctx.pass == 2)
872 >    reset_block_state();
873   } T_FILE  '{' logging_file_items '}' ';'
874   {
875 <  if (conf_parser_ctx.pass == 2 && ltype > 0)
876 <    log_add_file(ltype, lsize, lfile);
875 >  if (conf_parser_ctx.pass != 2)
876 >    break;
877 >
878 >  if (block_state.type.value && block_state.file.buf[0])
879 >    log_set_file(block_state.type.value, block_state.size.value,
880 >                 block_state.file.buf);
881   };
882  
883   logging_file_items: logging_file_items logging_file_item |
# Line 838 | Line 888 | logging_file_item:  logging_file_name |
888  
889   logging_file_name: NAME '=' QSTRING ';'
890   {
891 <  strlcpy(lfile, yylval.string, sizeof(lfile));
891 >  if (conf_parser_ctx.pass != 2)
892 >    break;
893 >
894 >  strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
895   }
896  
897   logging_file_size: T_SIZE '=' sizespec ';'
898   {
899 <  lsize = $3;
899 >  block_state.size.value = $3;
900   } | T_SIZE '=' T_UNLIMITED ';'
901   {
902 <  lsize = 0;
902 >  block_state.size.value = 0;
903   };
904  
905   logging_file_type: TYPE
906   {
907    if (conf_parser_ctx.pass == 2)
908 <    ltype = 0;
908 >    block_state.type.value = 0;
909   } '='  logging_file_type_items ';' ;
910  
911   logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
912   logging_file_type_item:  USER
913   {
914    if (conf_parser_ctx.pass == 2)
915 <    ltype = LOG_TYPE_USER;
915 >    block_state.type.value = LOG_TYPE_USER;
916   } | OPERATOR
917   {
918    if (conf_parser_ctx.pass == 2)
919 <    ltype = LOG_TYPE_OPER;
920 < } | GLINE
919 >    block_state.type.value = LOG_TYPE_OPER;
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 <    ltype = LOG_TYPE_GLINE;
927 >    block_state.type.value = LOG_TYPE_RESV;
928   } | T_DLINE
929   {
930    if (conf_parser_ctx.pass == 2)
931 <    ltype = LOG_TYPE_DLINE;
931 >    block_state.type.value = LOG_TYPE_DLINE;
932   } | KLINE
933   {
934    if (conf_parser_ctx.pass == 2)
935 <    ltype = LOG_TYPE_KLINE;
935 >    block_state.type.value = LOG_TYPE_KLINE;
936   } | KILL
937   {
938    if (conf_parser_ctx.pass == 2)
939 <    ltype = LOG_TYPE_KILL;
939 >    block_state.type.value = LOG_TYPE_KILL;
940   } | T_DEBUG
941   {
942    if (conf_parser_ctx.pass == 2)
943 <    ltype = LOG_TYPE_DEBUG;
943 >    block_state.type.value = LOG_TYPE_DEBUG;
944   };
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 <  {
954 <    yy_conf = make_conf_item(OPER_TYPE);
955 <    yy_aconf = map_to_conf(yy_conf);
956 <    SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */
900 <  }
901 <  else
902 <  {
903 <    MyFree(class_name);
904 <    class_name = NULL;
905 <  }
952 >  if (conf_parser_ctx.pass != 2)
953 >    break;
954 >
955 >  reset_block_state();
956 >  block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
957   } '{' oper_items '}' ';'
958   {
959 <  if (conf_parser_ctx.pass == 2)
909 <  {
910 <    struct CollectItem *yy_tmp;
911 <    dlink_node *ptr;
912 <    dlink_node *next_ptr;
959 >  dlink_node *node = NULL;
960  
961 <    conf_add_class_to_conf(yy_conf, class_name);
961 >  if (conf_parser_ctx.pass != 2)
962 >    break;
963  
964 <    /* Now, make sure there is a copy of the "base" given oper
965 <     * block in each of the collected copies
918 <     */
964 >  if (!block_state.name.buf[0])
965 >    break;
966  
967 <    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
968 <    {
922 <      struct AccessItem *new_aconf;
923 <      struct ConfItem *new_conf;
924 <      yy_tmp = ptr->data;
925 <
926 <      new_conf = make_conf_item(OPER_TYPE);
927 <      new_aconf = (struct AccessItem *)map_to_conf(new_conf);
928 <
929 <      new_aconf->flags = yy_aconf->flags;
930 <
931 <      if (yy_conf->name != NULL)
932 <        DupString(new_conf->name, yy_conf->name);
933 <      if (yy_tmp->user != NULL)
934 <        DupString(new_aconf->user, yy_tmp->user);
935 <      else
936 <        DupString(new_aconf->user, "*");
937 <      if (yy_tmp->host != NULL)
938 <        DupString(new_aconf->host, yy_tmp->host);
939 <      else
940 <        DupString(new_aconf->host, "*");
941 <
942 <      new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->addr,
943 <                                     &new_aconf->bits);
944 <
945 <      conf_add_class_to_conf(new_conf, class_name);
946 <      if (yy_aconf->passwd != NULL)
947 <        DupString(new_aconf->passwd, yy_aconf->passwd);
948 <
949 <      new_aconf->port = yy_aconf->port;
950 < #ifdef HAVE_LIBCRYPTO
951 <      if (yy_aconf->rsa_public_key_file != NULL)
952 <      {
953 <        BIO *file;
954 <
955 <        DupString(new_aconf->rsa_public_key_file,
956 <                  yy_aconf->rsa_public_key_file);
957 <
958 <        file = BIO_new_file(yy_aconf->rsa_public_key_file, "r");
959 <        new_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file,
960 <                                                           NULL, 0, NULL);
961 <        BIO_set_close(file, BIO_CLOSE);
962 <        BIO_free(file);
963 <      }
964 < #endif
967 >  if (!block_state.rpass.buf[0])
968 >    break;
969  
970 < #ifdef HAVE_LIBCRYPTO
971 <      if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key)
972 <          && yy_tmp->host)
973 < #else
974 <      if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host)
971 < #endif
972 <      {
973 <        conf_add_class_to_conf(new_conf, class_name);
974 <        if (yy_tmp->name != NULL)
975 <          DupString(new_conf->name, yy_tmp->name);
976 <      }
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 <      dlinkDelete(&yy_tmp->node, &col_conf_list);
977 <      free_collect_item(yy_tmp);
980 <    }
976 >    if (EmptyString(s))
977 >      continue;
978  
979 <    yy_conf = NULL;
980 <    yy_aconf = NULL;
979 >    nuh.nuhmask  = s;
980 >    nuh.nickptr  = NULL;
981 >    nuh.userptr  = block_state.user.buf;
982 >    nuh.hostptr  = block_state.host.buf;
983 >    nuh.nicksize = 0;
984 >    nuh.usersize = sizeof(block_state.user.buf);
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);
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 <    MyFree(class_name);
987 <    class_name = NULL;
1007 >    conf_add_class_to_conf(conf, block_state.class.buf);
1008    }
1009 < };
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   {
1026    if (conf_parser_ctx.pass == 2)
1027 <  {
1000 <    MyFree(yy_conf->name);
1001 <    DupString(yy_conf->name, yylval.string);
1002 <  }
1027 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1028   };
1029  
1030   oper_user: USER '=' QSTRING ';'
1031   {
1032    if (conf_parser_ctx.pass == 2)
1033 <  {
1009 <    struct split_nuh_item nuh;
1010 <
1011 <    nuh.nuhmask  = yylval.string;
1012 <    nuh.nickptr  = NULL;
1013 <    nuh.userptr  = userbuf;
1014 <    nuh.hostptr  = hostbuf;
1015 <
1016 <    nuh.nicksize = 0;
1017 <    nuh.usersize = sizeof(userbuf);
1018 <    nuh.hostsize = sizeof(hostbuf);
1019 <
1020 <    split_nuh(&nuh);
1021 <
1022 <    if (yy_aconf->user == NULL)
1023 <    {
1024 <      DupString(yy_aconf->user, userbuf);
1025 <      DupString(yy_aconf->host, hostbuf);
1026 <
1027 <      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->addr,
1028 <                                    &yy_aconf->bits);
1029 <    }
1030 <    else
1031 <    {
1032 <      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1033 <
1034 <      DupString(yy_tmp->user, userbuf);
1035 <      DupString(yy_tmp->host, hostbuf);
1036 <
1037 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1038 <    }
1039 <  }
1033 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1034   };
1035  
1036   oper_password: PASSWORD '=' QSTRING ';'
1037   {
1038    if (conf_parser_ctx.pass == 2)
1039 <  {
1046 <    if (yy_aconf->passwd != NULL)
1047 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1048 <
1049 <    MyFree(yy_aconf->passwd);
1050 <    DupString(yy_aconf->passwd, yylval.string);
1051 <  }
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 <  {
1058 <    if (yylval.number)
1059 <      SetConfEncrypted(yy_aconf);
1060 <    else
1061 <      ClearConfEncrypted(yy_aconf);
1062 <  }
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 < #ifdef HAVE_LIBCRYPTO
1051 <  if (conf_parser_ctx.pass == 2)
1069 <  {
1070 <    BIO *file;
1071 <
1072 <    if (yy_aconf->rsa_public_key != NULL)
1073 <    {
1074 <      RSA_free(yy_aconf->rsa_public_key);
1075 <      yy_aconf->rsa_public_key = NULL;
1076 <    }
1077 <
1078 <    if (yy_aconf->rsa_public_key_file != NULL)
1079 <    {
1080 <      MyFree(yy_aconf->rsa_public_key_file);
1081 <      yy_aconf->rsa_public_key_file = NULL;
1082 <    }
1083 <
1084 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
1085 <    file = BIO_new_file(yylval.string, "r");
1050 >  if (conf_parser_ctx.pass != 2)
1051 >    break;
1052  
1053 <    if (file == NULL)
1054 <    {
1055 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
1056 <      break;
1057 <    }
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 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
1059 > oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1060 > {
1061 >  if (conf_parser_ctx.pass == 2)
1062 >    strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1063 > };
1064  
1065 <    if (yy_aconf->rsa_public_key == NULL)
1066 <    {
1067 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
1068 <      break;
1099 <    }
1065 > oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1066 > {
1067 >  if (conf_parser_ctx.pass != 2)
1068 >    break;
1069  
1070 <    BIO_set_close(file, BIO_CLOSE);
1071 <    BIO_free(file);
1072 <  }
1073 < #endif /* HAVE_LIBCRYPTO */
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 ';'
1077   {
1078    if (conf_parser_ctx.pass == 2)
1079 <  {
1111 <    MyFree(class_name);
1112 <    DupString(class_name, yylval.string);
1113 <  }
1079 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1080   };
1081  
1082   oper_umodes: T_UMODES
1083   {
1084    if (conf_parser_ctx.pass == 2)
1085 <    yy_aconf->modes = 0;
1085 >    block_state.modes.value = 0;
1086   } '='  oper_umodes_items ';' ;
1087  
1088   oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1089   oper_umodes_item:  T_BOTS
1090   {
1091    if (conf_parser_ctx.pass == 2)
1092 <    yy_aconf->modes |= UMODE_BOTS;
1092 >    block_state.modes.value |= UMODE_BOTS;
1093   } | T_CCONN
1094   {
1095    if (conf_parser_ctx.pass == 2)
1096 <    yy_aconf->modes |= UMODE_CCONN;
1131 < } | T_CCONN_FULL
1132 < {
1133 <  if (conf_parser_ctx.pass == 2)
1134 <    yy_aconf->modes |= UMODE_CCONN_FULL;
1096 >    block_state.modes.value |= UMODE_CCONN;
1097   } | T_DEAF
1098   {
1099    if (conf_parser_ctx.pass == 2)
1100 <    yy_aconf->modes |= UMODE_DEAF;
1100 >    block_state.modes.value |= UMODE_DEAF;
1101   } | T_DEBUG
1102   {
1103    if (conf_parser_ctx.pass == 2)
1104 <    yy_aconf->modes |= UMODE_DEBUG;
1104 >    block_state.modes.value |= UMODE_DEBUG;
1105   } | T_FULL
1106   {
1107    if (conf_parser_ctx.pass == 2)
1108 <    yy_aconf->modes |= UMODE_FULL;
1108 >    block_state.modes.value |= UMODE_FULL;
1109   } | HIDDEN
1110   {
1111    if (conf_parser_ctx.pass == 2)
1112 <    yy_aconf->modes |= UMODE_HIDDEN;
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)
1124 <    yy_aconf->modes |= UMODE_SKILL;
1124 >    block_state.modes.value |= UMODE_SKILL;
1125   } | T_NCHANGE
1126   {
1127    if (conf_parser_ctx.pass == 2)
1128 <    yy_aconf->modes |= UMODE_NCHANGE;
1128 >    block_state.modes.value |= UMODE_NCHANGE;
1129   } | T_REJ
1130   {
1131    if (conf_parser_ctx.pass == 2)
1132 <    yy_aconf->modes |= UMODE_REJ;
1132 >    block_state.modes.value |= UMODE_REJ;
1133   } | T_UNAUTH
1134   {
1135    if (conf_parser_ctx.pass == 2)
1136 <    yy_aconf->modes |= UMODE_UNAUTH;
1136 >    block_state.modes.value |= UMODE_UNAUTH;
1137   } | T_SPY
1138   {
1139    if (conf_parser_ctx.pass == 2)
1140 <    yy_aconf->modes |= UMODE_SPY;
1140 >    block_state.modes.value |= UMODE_SPY;
1141   } | T_EXTERNAL
1142   {
1143    if (conf_parser_ctx.pass == 2)
1144 <    yy_aconf->modes |= UMODE_EXTERNAL;
1175 < } | T_OPERWALL
1176 < {
1177 <  if (conf_parser_ctx.pass == 2)
1178 <    yy_aconf->modes |= UMODE_OPERWALL;
1144 >    block_state.modes.value |= UMODE_EXTERNAL;
1145   } | T_SERVNOTICE
1146   {
1147    if (conf_parser_ctx.pass == 2)
1148 <    yy_aconf->modes |= UMODE_SERVNOTICE;
1148 >    block_state.modes.value |= UMODE_SERVNOTICE;
1149   } | T_INVISIBLE
1150   {
1151    if (conf_parser_ctx.pass == 2)
1152 <    yy_aconf->modes |= UMODE_INVISIBLE;
1152 >    block_state.modes.value |= UMODE_INVISIBLE;
1153   } | T_WALLOP
1154   {
1155    if (conf_parser_ctx.pass == 2)
1156 <    yy_aconf->modes |= UMODE_WALLOP;
1156 >    block_state.modes.value |= UMODE_WALLOP;
1157   } | T_SOFTCALLERID
1158   {
1159    if (conf_parser_ctx.pass == 2)
1160 <    yy_aconf->modes |= UMODE_SOFTCALLERID;
1160 >    block_state.modes.value |= UMODE_SOFTCALLERID;
1161   } | T_CALLERID
1162   {
1163    if (conf_parser_ctx.pass == 2)
1164 <    yy_aconf->modes |= UMODE_CALLERID;
1164 >    block_state.modes.value |= UMODE_CALLERID;
1165   } | T_LOCOPS
1166   {
1167    if (conf_parser_ctx.pass == 2)
1168 <    yy_aconf->modes |= UMODE_LOCOPS;
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
1180   {
1181    if (conf_parser_ctx.pass == 2)
1182 <    yy_aconf->port = 0;
1182 >    block_state.port.value = 0;
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_CONNECT_REMOTE;
1198 > } | CONNECT
1199 > {
1200 >  if (conf_parser_ctx.pass == 2)
1201 >    block_state.port.value |= OPER_FLAG_CONNECT;
1202 > } | SQUIT ':' REMOTE
1203   {
1204    if (conf_parser_ctx.pass == 2)
1205 <    yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1206 < } | REMOTE
1205 >    block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1206 > } | SQUIT
1207   {
1208    if (conf_parser_ctx.pass == 2)
1209 <    yy_aconf->port |= OPER_FLAG_REMOTE;
1209 >    block_state.port.value |= OPER_FLAG_SQUIT;
1210   } | KLINE
1211   {
1212    if (conf_parser_ctx.pass == 2)
1213 <    yy_aconf->port |= OPER_FLAG_K;
1213 >    block_state.port.value |= OPER_FLAG_KLINE;
1214   } | UNKLINE
1215   {
1216    if (conf_parser_ctx.pass == 2)
1217 <    yy_aconf->port |= OPER_FLAG_UNKLINE;
1217 >    block_state.port.value |= OPER_FLAG_UNKLINE;
1218   } | T_DLINE
1219   {
1220    if (conf_parser_ctx.pass == 2)
1221 <    yy_aconf->port |= OPER_FLAG_DLINE;
1221 >    block_state.port.value |= OPER_FLAG_DLINE;
1222   } | T_UNDLINE
1223   {
1224    if (conf_parser_ctx.pass == 2)
1225 <    yy_aconf->port |= OPER_FLAG_UNDLINE;
1225 >    block_state.port.value |= OPER_FLAG_UNDLINE;
1226   } | XLINE
1227   {
1228    if (conf_parser_ctx.pass == 2)
1229 <    yy_aconf->port |= 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 <    yy_aconf->port |= OPER_FLAG_GLINE;
1233 >    block_state.port.value |= OPER_FLAG_UNXLINE;
1234   } | DIE
1235   {
1236    if (conf_parser_ctx.pass == 2)
1237 <    yy_aconf->port |= OPER_FLAG_DIE;
1237 >    block_state.port.value |= OPER_FLAG_DIE;
1238   } | T_RESTART
1239   {
1240    if (conf_parser_ctx.pass == 2)
1241 <    yy_aconf->port |= OPER_FLAG_RESTART;
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)
1249 <    yy_aconf->port |= OPER_FLAG_REHASH;
1249 >    block_state.port.value |= OPER_FLAG_REHASH;
1250   } | ADMIN
1251   {
1252    if (conf_parser_ctx.pass == 2)
1253 <    yy_aconf->port |= OPER_FLAG_ADMIN;
1254 < } | NICK_CHANGES
1253 >    block_state.port.value |= OPER_FLAG_ADMIN;
1254 > } | T_GLOBOPS
1255   {
1256    if (conf_parser_ctx.pass == 2)
1257 <    yy_aconf->port |= OPER_FLAG_N;
1258 < } | T_OPERWALL
1257 >    block_state.port.value |= OPER_FLAG_GLOBOPS;
1258 > } | T_WALLOPS
1259   {
1260    if (conf_parser_ctx.pass == 2)
1261 <    yy_aconf->port |= OPER_FLAG_OPERWALL;
1262 < } | T_GLOBOPS
1261 >    block_state.port.value |= OPER_FLAG_WALLOPS;
1262 > } | T_LOCOPS
1263   {
1264    if (conf_parser_ctx.pass == 2)
1265 <    yy_aconf->port |= OPER_FLAG_GLOBOPS;
1266 < } | OPER_SPY_T
1265 >    block_state.port.value |= OPER_FLAG_LOCOPS;
1266 > } | REMOTEBAN
1267   {
1268    if (conf_parser_ctx.pass == 2)
1269 <    yy_aconf->port |= OPER_FLAG_OPER_SPY;
1270 < } | REMOTEBAN
1269 >    block_state.port.value |= OPER_FLAG_REMOTEBAN;
1270 > } | T_SET
1271   {
1272    if (conf_parser_ctx.pass == 2)
1273 <    yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1273 >    block_state.port.value |= OPER_FLAG_SET;
1274   } | MODULE
1275   {
1276    if (conf_parser_ctx.pass == 2)
1277 <    yy_aconf->port |= OPER_FLAG_MODULE;
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   {
1310 <  if (conf_parser_ctx.pass == 1)
1311 <  {
1312 <    yy_conf = make_conf_item(CLASS_TYPE);
1313 <    yy_class = map_to_conf(yy_conf);
1314 <  }
1310 >  if (conf_parser_ctx.pass != 1)
1311 >    break;
1312 >
1313 >  reset_block_state();
1314 >
1315 >  block_state.ping_freq.value = DEFAULT_PINGFREQUENCY;
1316 >  block_state.con_freq.value  = DEFAULT_CONNECTFREQUENCY;
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;
1320   } '{' class_items '}' ';'
1321   {
1322 <  if (conf_parser_ctx.pass == 1)
1300 <  {
1301 <    struct ConfItem *cconf = NULL;
1302 <    struct ClassItem *class = NULL;
1322 >  struct ClassItem *class = NULL;
1323  
1324 <    if (yy_class_name == NULL)
1325 <      delete_conf_item(yy_conf);
1306 <    else
1307 <    {
1308 <      cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1324 >  if (conf_parser_ctx.pass != 1)
1325 >    break;
1326  
1327 <      if (cconf != NULL)                /* The class existed already */
1328 <      {
1312 <        int user_count = 0;
1313 <
1314 <        rebuild_cidr_class(cconf, yy_class);
1315 <
1316 <        class = map_to_conf(cconf);
1317 <
1318 <        user_count = class->curr_user_count;
1319 <        memcpy(class, yy_class, sizeof(*class));
1320 <        class->curr_user_count = user_count;
1321 <        class->active = 1;
1322 <
1323 <        delete_conf_item(yy_conf);
1324 <
1325 <        MyFree(cconf->name);            /* Allows case change of class name */
1326 <        cconf->name = yy_class_name;
1327 <      }
1328 <      else      /* Brand new class */
1329 <      {
1330 <        MyFree(yy_conf->name);          /* just in case it was allocated */
1331 <        yy_conf->name = yy_class_name;
1332 <        yy_class->active = 1;
1333 <      }
1334 <    }
1327 >  if (!block_state.class.buf[0])
1328 >    break;
1329  
1330 <    yy_class_name = NULL;
1331 <  }
1330 >  if (!(class = class_find(block_state.class.buf, false)))
1331 >    class = class_make();
1332 >
1333 >  class->active = 1;
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_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;
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 (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_ping_warning |
1372 <                class_number_per_cidr |
1373 <                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 |
1349                class_max_global |
1350                class_max_local |
1351                class_max_ident |
1377                  class_sendq |
1378 <                error ';' ;
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 <  {
1359 <    MyFree(yy_class_name);
1360 <    DupString(yy_class_name, yylval.string);
1361 <  }
1387 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1388   };
1389  
1390   class_ping_time: PING_TIME '=' timespec ';'
1391   {
1392    if (conf_parser_ctx.pass == 1)
1393 <    yy_class->ping_freq = $3;
1393 >    block_state.ping_freq.value = $3;
1394   };
1395  
1396 < class_ping_warning: PING_WARNING '=' timespec ';'
1396 > class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';'
1397   {
1398    if (conf_parser_ctx.pass == 1)
1399 <    yy_class->ping_warning = $3;
1399 >    block_state.max_perip_local.value = $3;
1400   };
1401  
1402 < class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1402 > class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';'
1403   {
1404    if (conf_parser_ctx.pass == 1)
1405 <    yy_class->max_perip = $3;
1405 >    block_state.max_perip_global.value = $3;
1406   };
1407  
1408   class_connectfreq: CONNECTFREQ '=' timespec ';'
1409   {
1410    if (conf_parser_ctx.pass == 1)
1411 <    yy_class->con_freq = $3;
1411 >    block_state.con_freq.value = $3;
1412   };
1413  
1414 < class_max_number: MAX_NUMBER '=' NUMBER ';'
1414 > class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1415   {
1416    if (conf_parser_ctx.pass == 1)
1417 <    yy_class->max_total = $3;
1417 >    block_state.max_channels.value = $3;
1418   };
1419  
1420 < class_max_global: MAX_GLOBAL '=' NUMBER ';'
1420 > class_max_number: MAX_NUMBER '=' NUMBER ';'
1421   {
1422    if (conf_parser_ctx.pass == 1)
1423 <    yy_class->max_global = $3;
1423 >    block_state.max_total.value = $3;
1424   };
1425  
1426 < class_max_local: MAX_LOCAL '=' NUMBER ';'
1426 > class_sendq: SENDQ '=' sizespec ';'
1427   {
1428    if (conf_parser_ctx.pass == 1)
1429 <    yy_class->max_local = $3;
1429 >    block_state.max_sendq.value = $3;
1430   };
1431  
1432 < class_max_ident: MAX_IDENT '=' NUMBER ';'
1432 > class_recvq: T_RECVQ '=' sizespec ';'
1433   {
1434    if (conf_parser_ctx.pass == 1)
1435 <    yy_class->max_ident = $3;
1435 >    if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1436 >      block_state.max_recvq.value = $3;
1437   };
1438  
1439 < class_sendq: SENDQ '=' sizespec ';'
1439 > class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1440   {
1441    if (conf_parser_ctx.pass == 1)
1442 <    yy_class->max_sendq = $3;
1442 >    block_state.cidr_bitlen_ipv4.value = $3 > 32 ? 32 : $3;
1443   };
1444  
1445 < class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1445 > class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1446   {
1447    if (conf_parser_ctx.pass == 1)
1448 <    yy_class->cidr_bitlen_ipv4 = $3;
1448 >    block_state.cidr_bitlen_ipv6.value = $3 > 128 ? 128 : $3;
1449   };
1450  
1451 < class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1451 > class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1452   {
1453    if (conf_parser_ctx.pass == 1)
1454 <    yy_class->cidr_bitlen_ipv6 = $3;
1454 >    block_state.number_per_cidr.value = $3;
1455   };
1456  
1457 < class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
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 <    yy_class->number_per_cidr = $3;
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   {
1498    if (conf_parser_ctx.pass == 2)
1499 <  {
1500 <    listener_address = NULL;
1444 <    listener_flags = 0;
1445 <  }
1446 < } '{' listen_items '}' ';'
1447 < {
1448 <  if (conf_parser_ctx.pass == 2)
1449 <  {
1450 <    MyFree(listener_address);
1451 <    listener_address = NULL;
1452 <  }
1453 < };
1499 >    reset_block_state();
1500 > } '{' listen_items '}' ';';
1501  
1502   listen_flags: IRCD_FLAGS
1503   {
1504 <  listener_flags = 0;
1504 >  block_state.flags.value = 0;
1505   } '='  listen_flags_items ';';
1506  
1507   listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1508   listen_flags_item: T_SSL
1509   {
1510    if (conf_parser_ctx.pass == 2)
1511 <    listener_flags |= LISTENER_SSL;
1511 >    block_state.flags.value |= LISTENER_SSL;
1512   } | HIDDEN
1513   {
1514    if (conf_parser_ctx.pass == 2)
1515 <    listener_flags |= LISTENER_HIDDEN;
1515 >    block_state.flags.value |= LISTENER_HIDDEN;
1516   } | T_SERVER
1517   {
1518    if (conf_parser_ctx.pass == 2)
1519 <    listener_flags |= LISTENER_SERVER;
1519 >   block_state.flags.value |= LISTENER_SERVER;
1520   };
1521  
1475
1476
1522   listen_items:   listen_items listen_item | listen_item;
1523   listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';';
1524  
1525 < listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1525 > listen_port: PORT '=' port_items { block_state.flags.value = 0; } ';';
1526  
1527   port_items: port_items ',' port_item | port_item;
1528  
# Line 1485 | Line 1530 | port_item: NUMBER
1530   {
1531    if (conf_parser_ctx.pass == 2)
1532    {
1533 <    if ((listener_flags & LISTENER_SSL))
1534 < #ifdef HAVE_LIBCRYPTO
1535 <      if (!ServerInfo.server_ctx)
1533 > #ifndef HAVE_TLS
1534 >    if (block_state.flags.value & LISTENER_SSL)
1535 >    {
1536 >      conf_error_report("TLS not available - port closed");
1537 >      break;
1538 >    }
1539   #endif
1540 <      {
1493 <        yyerror("SSL not available - port closed");
1494 <        break;
1495 <      }
1496 <    add_listener($1, listener_address, listener_flags);
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;
1547 <
1548 <    if ((listener_flags & LISTENER_SSL))
1549 < #ifdef HAVE_LIBCRYPTO
1550 <      if (!ServerInfo.server_ctx)
1546 > #ifndef HAVE_TLS
1547 >    if (block_state.flags.value & LISTENER_SSL)
1548 >    {
1549 >      conf_error_report("TLS not available - port closed");
1550 >      break;
1551 >    }
1552   #endif
1508      {
1509        yyerror("SSL not available - port closed");
1510        break;
1511      }
1553  
1554 <    for (i = $1; i <= $3; ++i)
1555 <      add_listener(i, listener_address, listener_flags);
1554 >    for (int i = $1; i <= $3; ++i)
1555 >      listener_add(i, block_state.addr.buf, block_state.flags.value);
1556    }
1557   };
1558  
1559   listen_address: IP '=' QSTRING ';'
1560   {
1561    if (conf_parser_ctx.pass == 2)
1562 <  {
1522 <    MyFree(listener_address);
1523 <    DupString(listener_address, yylval.string);
1524 <  }
1562 >    strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1563   };
1564  
1565   listen_host: HOST '=' QSTRING ';'
1566   {
1567    if (conf_parser_ctx.pass == 2)
1568 <  {
1531 <    MyFree(listener_address);
1532 <    DupString(listener_address, yylval.string);
1533 <  }
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   {
1577    if (conf_parser_ctx.pass == 2)
1578 <  {
1543 <    yy_conf = make_conf_item(CLIENT_TYPE);
1544 <    yy_aconf = map_to_conf(yy_conf);
1545 <  }
1546 <  else
1547 <  {
1548 <    MyFree(class_name);
1549 <    class_name = NULL;
1550 <  }
1578 >    reset_block_state();
1579   } '{' auth_items '}' ';'
1580   {
1581 <  if (conf_parser_ctx.pass == 2)
1554 <  {
1555 <    struct CollectItem *yy_tmp = NULL;
1556 <    dlink_node *ptr = NULL, *next_ptr = NULL;
1557 <
1558 <    if (yy_aconf->user && yy_aconf->host)
1559 <    {
1560 <      conf_add_class_to_conf(yy_conf, class_name);
1561 <      add_conf_by_address(CONF_CLIENT, yy_aconf);
1562 <    }
1563 <    else
1564 <      delete_conf_item(yy_conf);
1565 <
1566 <    /* copy over settings from first struct */
1567 <    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
1568 <    {
1569 <      struct AccessItem *new_aconf;
1570 <      struct ConfItem *new_conf;
1571 <
1572 <      new_conf = make_conf_item(CLIENT_TYPE);
1573 <      new_aconf = map_to_conf(new_conf);
1574 <
1575 <      yy_tmp = ptr->data;
1581 >  dlink_node *node = NULL;
1582  
1583 <      assert(yy_tmp->user && yy_tmp->host);
1583 >  if (conf_parser_ctx.pass != 2)
1584 >    break;
1585  
1586 <      if (yy_aconf->passwd != NULL)
1587 <        DupString(new_aconf->passwd, yy_aconf->passwd);
1588 <      if (yy_conf->name != NULL)
1589 <        DupString(new_conf->name, yy_conf->name);
1590 <      if (yy_aconf->passwd != NULL)
1584 <        DupString(new_aconf->passwd, yy_aconf->passwd);
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 <      new_aconf->flags = yy_aconf->flags;
1593 <      new_aconf->port  = yy_aconf->port;
1592 >    if (EmptyString(s))
1593 >      continue;
1594  
1595 <      DupString(new_aconf->user, yy_tmp->user);
1596 <      collapse(new_aconf->user);
1595 >    nuh.nuhmask  = s;
1596 >    nuh.nickptr  = NULL;
1597 >    nuh.userptr  = block_state.user.buf;
1598 >    nuh.hostptr  = block_state.host.buf;
1599 >    nuh.nicksize = 0;
1600 >    nuh.usersize = sizeof(block_state.user.buf);
1601 >    nuh.hostsize = sizeof(block_state.host.buf);
1602 >    split_nuh(&nuh);
1603  
1604 <      DupString(new_aconf->host, yy_tmp->host);
1605 <      collapse(new_aconf->host);
1604 >    conf        = conf_make(CONF_CLIENT);
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->name = xstrdup(block_state.name.buf);
1612  
1613 <      conf_add_class_to_conf(new_conf, class_name);
1614 <      add_conf_by_address(CONF_CLIENT, new_aconf);
1597 <      dlinkDelete(&yy_tmp->node, &col_conf_list);
1598 <      free_collect_item(yy_tmp);
1599 <    }
1613 >    conf->flags = block_state.flags.value;
1614 >    conf->port  = block_state.port.value;
1615  
1616 <    MyFree(class_name);
1617 <    class_name = NULL;
1603 <    yy_conf = NULL;
1604 <    yy_aconf = NULL;
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   {
1634    if (conf_parser_ctx.pass == 2)
1635 <  {
1617 <    struct CollectItem *yy_tmp = NULL;
1618 <    struct split_nuh_item nuh;
1619 <
1620 <    nuh.nuhmask  = yylval.string;
1621 <    nuh.nickptr  = NULL;
1622 <    nuh.userptr  = userbuf;
1623 <    nuh.hostptr  = hostbuf;
1624 <
1625 <    nuh.nicksize = 0;
1626 <    nuh.usersize = sizeof(userbuf);
1627 <    nuh.hostsize = sizeof(hostbuf);
1628 <
1629 <    split_nuh(&nuh);
1630 <
1631 <    if (yy_aconf->user == NULL)
1632 <    {
1633 <      DupString(yy_aconf->user, userbuf);
1634 <      DupString(yy_aconf->host, hostbuf);
1635 <    }
1636 <    else
1637 <    {
1638 <      yy_tmp = MyMalloc(sizeof(struct CollectItem));
1639 <
1640 <      DupString(yy_tmp->user, userbuf);
1641 <      DupString(yy_tmp->host, hostbuf);
1642 <
1643 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1644 <    }
1645 <  }
1635 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1636   };
1637  
1648 /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1649
1638   auth_passwd: PASSWORD '=' QSTRING ';'
1639   {
1640    if (conf_parser_ctx.pass == 2)
1641 <  {
1654 <    /* be paranoid */
1655 <    if (yy_aconf->passwd != NULL)
1656 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1657 <
1658 <    MyFree(yy_aconf->passwd);
1659 <    DupString(yy_aconf->passwd, yylval.string);
1660 <  }
1641 >    strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1642   };
1643  
1644   auth_class: CLASS '=' QSTRING ';'
1645   {
1646    if (conf_parser_ctx.pass == 2)
1647 <  {
1667 <    MyFree(class_name);
1668 <    DupString(class_name, yylval.string);
1669 <  }
1647 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1648   };
1649  
1650   auth_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 1674 | Line 1652 | auth_encrypted: ENCRYPTED '=' TBOOL ';'
1652    if (conf_parser_ctx.pass == 2)
1653    {
1654      if (yylval.number)
1655 <      SetConfEncrypted(yy_aconf);
1655 >      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1656      else
1657 <      ClearConfEncrypted(yy_aconf);
1657 >      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1658    }
1659   };
1660  
1661   auth_flags: IRCD_FLAGS
1662   {
1663 +  if (conf_parser_ctx.pass == 2)
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;
1668   auth_flags_item: SPOOF_NOTICE
1669   {
1670    if (conf_parser_ctx.pass == 2)
1671 <    yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1671 >    block_state.flags.value |= CONF_FLAGS_SPOOF_NOTICE;
1672   } | EXCEED_LIMIT
1673   {
1674    if (conf_parser_ctx.pass == 2)
1675 <    yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1675 >    block_state.flags.value |= CONF_FLAGS_NOLIMIT;
1676   } | KLINE_EXEMPT
1677   {
1678    if (conf_parser_ctx.pass == 2)
1679 <    yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
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)
1687 <    yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1687 >    block_state.flags.value |= CONF_FLAGS_NEED_IDENTD;
1688   } | CAN_FLOOD
1689   {
1690    if (conf_parser_ctx.pass == 2)
1691 <    yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1691 >    block_state.flags.value |= CONF_FLAGS_CAN_FLOOD;
1692   } | NO_TILDE
1693   {
1694    if (conf_parser_ctx.pass == 2)
1695 <    yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1696 < } | GLINE_EXEMPT
1695 >    block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1696 > } | RESV_EXEMPT
1697   {
1698    if (conf_parser_ctx.pass == 2)
1699 <    yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1700 < } | RESV_EXEMPT
1699 >    block_state.flags.value |= CONF_FLAGS_EXEMPTRESV;
1700 > } | T_WEBIRC
1701   {
1702    if (conf_parser_ctx.pass == 2)
1703 <    yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1703 >    block_state.flags.value |= CONF_FLAGS_WEBIRC;
1704   } | NEED_PASSWORD
1705   {
1706    if (conf_parser_ctx.pass == 2)
1707 <    yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1707 >    block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1708   };
1709  
1710 < /* XXX - need check for illegal hostnames here */
1727 < auth_spoof: SPOOF '=' QSTRING ';'
1710 > auth_spoof: SPOOF '=' QSTRING ';'
1711   {
1712 <  if (conf_parser_ctx.pass == 2)
1713 <  {
1731 <    MyFree(yy_conf->name);
1712 >  if (conf_parser_ctx.pass != 2)
1713 >    break;
1714  
1715 <    if (strlen(yylval.string) < HOSTLEN)
1716 <    {    
1717 <      DupString(yy_conf->name, yylval.string);
1718 <      yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
1737 <    }
1738 <    else
1739 <    {
1740 <      ilog(LOG_TYPE_IRCD, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1741 <      yy_conf->name = NULL;
1742 <    }
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;
1719    }
1720 +  else
1721 +    ilog(LOG_TYPE_IRCD, "Spoof either is too long or contains invalid characters. Ignoring it.");
1722   };
1723  
1724   auth_redir_serv: REDIRSERV '=' QSTRING ';'
1725   {
1726 <  if (conf_parser_ctx.pass == 2)
1727 <  {
1728 <    yy_aconf->flags |= CONF_FLAGS_REDIR;
1729 <    MyFree(yy_conf->name);
1730 <    DupString(yy_conf->name, yylval.string);
1753 <  }
1726 >  if (conf_parser_ctx.pass != 2)
1727 >    break;
1728 >
1729 >  strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1730 >  block_state.flags.value |= CONF_FLAGS_REDIR;
1731   };
1732  
1733   auth_redir_port: REDIRPORT '=' NUMBER ';'
1734   {
1735 <  if (conf_parser_ctx.pass == 2)
1736 <  {
1737 <    yy_aconf->flags |= CONF_FLAGS_REDIR;
1738 <    yy_aconf->port = $3;
1739 <  }
1735 >  if (conf_parser_ctx.pass != 2)
1736 >    break;
1737 >
1738 >  block_state.flags.value |= CONF_FLAGS_REDIR;
1739 >  block_state.port.value = $3;
1740   };
1741  
1742  
1743   /***************************************************************************
1744 < *  section resv
1744 > * resv {} section
1745   ***************************************************************************/
1746   resv_entry: RESV
1747   {
1748 <  if (conf_parser_ctx.pass == 2)
1749 <  {
1750 <    MyFree(resv_reason);
1751 <    resv_reason = NULL;
1752 <  }
1748 >  if (conf_parser_ctx.pass != 2)
1749 >    break;
1750 >
1751 >  reset_block_state();
1752 >  strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1753   } '{' resv_items '}' ';'
1754   {
1755 <  if (conf_parser_ctx.pass == 2)
1756 <  {
1757 <    MyFree(resv_reason);
1758 <    resv_reason = NULL;
1782 <  }
1755 >  if (conf_parser_ctx.pass != 2)
1756 >    break;
1757 >
1758 >  resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1759   };
1760  
1761 < resv_items:     resv_items resv_item | resv_item;
1762 < resv_item:      resv_creason | resv_channel | resv_nick | error ';' ;
1761 > resv_items:     resv_items resv_item | resv_item;
1762 > resv_item:      resv_mask | resv_reason | resv_exempt | error ';' ;
1763  
1764 < resv_creason: REASON '=' QSTRING ';'
1764 > resv_mask: MASK '=' QSTRING ';'
1765   {
1766    if (conf_parser_ctx.pass == 2)
1767 <  {
1792 <    MyFree(resv_reason);
1793 <    DupString(resv_reason, yylval.string);
1794 <  }
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 <  {
1801 <    if (IsChanPrefix(*yylval.string))
1802 <    {
1803 <      char def_reason[] = "No reason";
1804 <
1805 <      create_channel_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
1806 <    }
1807 <  }
1808 <  /* ignore it for now.. but we really should make a warning if
1809 <   * its an erroneous name --fl_ */
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 <  {
1816 <    char def_reason[] = "No reason";
1817 <
1818 <    create_nick_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
1819 <  }
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 1829 | 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 <    {
1836 <      yy_conf = make_conf_item(SERVICE_TYPE);
1837 <      DupString(yy_conf->name, yylval.string);
1838 <    }
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   {
1809 <  if (conf_parser_ctx.pass == 2)
1810 <  {
1811 <    yy_conf = make_conf_item(ULINE_TYPE);
1812 <    yy_match_item = map_to_conf(yy_conf);
1813 <    yy_match_item->action = SHARED_ALL;
1814 <  }
1809 >  if (conf_parser_ctx.pass != 2)
1810 >    break;
1811 >
1812 >  reset_block_state();
1813 >
1814 >  strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1815 >  strlcpy(block_state.user.buf, "*", sizeof(block_state.user.buf));
1816 >  strlcpy(block_state.host.buf, "*", sizeof(block_state.host.buf));
1817 >  block_state.flags.value = SHARED_ALL;
1818   } '{' shared_items '}' ';'
1819   {
1820 <  if (conf_parser_ctx.pass == 2)
1821 <  {
1822 <    yy_conf = NULL;
1823 <  }
1820 >  if (conf_parser_ctx.pass != 2)
1821 >    break;
1822 >
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 1864 | Line 1833 | shared_item:  shared_name | shared_user
1833   shared_name: NAME '=' QSTRING ';'
1834   {
1835    if (conf_parser_ctx.pass == 2)
1836 <  {
1868 <    MyFree(yy_conf->name);
1869 <    DupString(yy_conf->name, yylval.string);
1870 <  }
1836 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1837   };
1838  
1839   shared_user: USER '=' QSTRING ';'
# Line 1878 | Line 1844 | shared_user: USER '=' QSTRING ';'
1844  
1845      nuh.nuhmask  = yylval.string;
1846      nuh.nickptr  = NULL;
1847 <    nuh.userptr  = userbuf;
1848 <    nuh.hostptr  = hostbuf;
1847 >    nuh.userptr  = block_state.user.buf;
1848 >    nuh.hostptr  = block_state.host.buf;
1849  
1850      nuh.nicksize = 0;
1851 <    nuh.usersize = sizeof(userbuf);
1852 <    nuh.hostsize = sizeof(hostbuf);
1851 >    nuh.usersize = sizeof(block_state.user.buf);
1852 >    nuh.hostsize = sizeof(block_state.host.buf);
1853  
1854      split_nuh(&nuh);
1889
1890    DupString(yy_match_item->user, userbuf);
1891    DupString(yy_match_item->host, hostbuf);
1855    }
1856   };
1857  
1858   shared_type: TYPE
1859   {
1860    if (conf_parser_ctx.pass == 2)
1861 <    yy_match_item->action = 0;
1861 >    block_state.flags.value = 0;
1862   } '=' shared_types ';' ;
1863  
1864   shared_types: shared_types ',' shared_type_item | shared_type_item;
1865   shared_type_item: KLINE
1866   {
1867    if (conf_parser_ctx.pass == 2)
1868 <    yy_match_item->action |= SHARED_KLINE;
1868 >    block_state.flags.value |= SHARED_KLINE;
1869   } | UNKLINE
1870   {
1871    if (conf_parser_ctx.pass == 2)
1872 <    yy_match_item->action |= SHARED_UNKLINE;
1872 >    block_state.flags.value |= SHARED_UNKLINE;
1873   } | T_DLINE
1874   {
1875    if (conf_parser_ctx.pass == 2)
1876 <    yy_match_item->action |= SHARED_DLINE;
1876 >    block_state.flags.value |= SHARED_DLINE;
1877   } | T_UNDLINE
1878   {
1879    if (conf_parser_ctx.pass == 2)
1880 <    yy_match_item->action |= SHARED_UNDLINE;
1880 >    block_state.flags.value |= SHARED_UNDLINE;
1881   } | XLINE
1882   {
1883    if (conf_parser_ctx.pass == 2)
1884 <    yy_match_item->action |= SHARED_XLINE;
1884 >    block_state.flags.value |= SHARED_XLINE;
1885   } | T_UNXLINE
1886   {
1887    if (conf_parser_ctx.pass == 2)
1888 <    yy_match_item->action |= SHARED_UNXLINE;
1888 >    block_state.flags.value |= SHARED_UNXLINE;
1889   } | RESV
1890   {
1891    if (conf_parser_ctx.pass == 2)
1892 <    yy_match_item->action |= SHARED_RESV;
1892 >    block_state.flags.value |= SHARED_RESV;
1893   } | T_UNRESV
1894   {
1895    if (conf_parser_ctx.pass == 2)
1896 <    yy_match_item->action |= SHARED_UNRESV;
1896 >    block_state.flags.value |= SHARED_UNRESV;
1897   } | T_LOCOPS
1898   {
1899    if (conf_parser_ctx.pass == 2)
1900 <    yy_match_item->action |= SHARED_LOCOPS;
1900 >    block_state.flags.value |= SHARED_LOCOPS;
1901   } | T_ALL
1902   {
1903    if (conf_parser_ctx.pass == 2)
1904 <    yy_match_item->action = SHARED_ALL;
1904 >    block_state.flags.value = SHARED_ALL;
1905   };
1906  
1907 +
1908   /***************************************************************************
1909 < *  section cluster
1909 > * cluster {} section
1910   ***************************************************************************/
1911   cluster_entry: T_CLUSTER
1912   {
1913 <  if (conf_parser_ctx.pass == 2)
1914 <  {
1915 <    yy_conf = make_conf_item(CLUSTER_TYPE);
1916 <    yy_conf->flags = SHARED_ALL;
1917 <  }
1913 >  if (conf_parser_ctx.pass != 2)
1914 >    break;
1915 >
1916 >  reset_block_state();
1917 >
1918 >  strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1919 >  block_state.flags.value = CLUSTER_ALL;
1920   } '{' cluster_items '}' ';'
1921   {
1922 <  if (conf_parser_ctx.pass == 2)
1923 <  {
1924 <    if (yy_conf->name == NULL)
1925 <      DupString(yy_conf->name, "*");
1926 <    yy_conf = NULL;
1927 <  }
1922 >  if (conf_parser_ctx.pass != 2)
1923 >    break;
1924 >
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   {
1935    if (conf_parser_ctx.pass == 2)
1936 <    DupString(yy_conf->name, yylval.string);
1936 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1937   };
1938  
1939   cluster_type: TYPE
1940   {
1941    if (conf_parser_ctx.pass == 2)
1942 <    yy_conf->flags = 0;
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 <    yy_conf->flags |= SHARED_KLINE;
1949 >    block_state.flags.value |= CLUSTER_KLINE;
1950   } | UNKLINE
1951   {
1952    if (conf_parser_ctx.pass == 2)
1953 <    yy_conf->flags |= SHARED_UNKLINE;
1953 >    block_state.flags.value |= CLUSTER_UNKLINE;
1954   } | T_DLINE
1955   {
1956    if (conf_parser_ctx.pass == 2)
1957 <    yy_conf->flags |= SHARED_DLINE;
1957 >    block_state.flags.value |= CLUSTER_DLINE;
1958   } | T_UNDLINE
1959   {
1960    if (conf_parser_ctx.pass == 2)
1961 <    yy_conf->flags |= SHARED_UNDLINE;
1961 >    block_state.flags.value |= CLUSTER_UNDLINE;
1962   } | XLINE
1963   {
1964    if (conf_parser_ctx.pass == 2)
1965 <    yy_conf->flags |= SHARED_XLINE;
1965 >    block_state.flags.value |= CLUSTER_XLINE;
1966   } | T_UNXLINE
1967   {
1968    if (conf_parser_ctx.pass == 2)
1969 <    yy_conf->flags |= SHARED_UNXLINE;
1969 >    block_state.flags.value |= CLUSTER_UNXLINE;
1970   } | RESV
1971   {
1972    if (conf_parser_ctx.pass == 2)
1973 <    yy_conf->flags |= SHARED_RESV;
1973 >    block_state.flags.value |= CLUSTER_RESV;
1974   } | T_UNRESV
1975   {
1976    if (conf_parser_ctx.pass == 2)
1977 <    yy_conf->flags |= SHARED_UNRESV;
1977 >    block_state.flags.value |= CLUSTER_UNRESV;
1978   } | T_LOCOPS
1979   {
1980    if (conf_parser_ctx.pass == 2)
1981 <    yy_conf->flags |= SHARED_LOCOPS;
1981 >    block_state.flags.value |= CLUSTER_LOCOPS;
1982   } | T_ALL
1983   {
1984    if (conf_parser_ctx.pass == 2)
1985 <    yy_conf->flags = 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   {
2027  if (conf_parser_ctx.pass == 2)
2028  {
2029    yy_conf = make_conf_item(SERVER_TYPE);
2030    yy_aconf = map_to_conf(yy_conf);
1994  
1995 <    /* defaults */
1996 <    yy_aconf->port = PORTNUM;
1997 <  }
1998 <  else
1999 <  {
2000 <    MyFree(class_name);
2038 <    class_name = NULL;
2039 <  }
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   {
2003 <  if (conf_parser_ctx.pass == 2)
2003 >  struct MaskItem *conf = NULL;
2004 >  struct addrinfo hints, *res;
2005 >
2006 >  if (conf_parser_ctx.pass != 2)
2007 >    break;
2008 >
2009 >  if (!block_state.name.buf[0] ||
2010 >      !block_state.host.buf[0])
2011 >    break;
2012 >
2013 >  if (!block_state.rpass.buf[0] ||
2014 >      !block_state.spass.buf[0])
2015 >    break;
2016 >
2017 >  if (has_wildcards(block_state.name.buf) ||
2018 >      has_wildcards(block_state.host.buf))
2019 >    break;
2020 >
2021 >  conf = conf_make(CONF_SERVER);
2022 >  conf->port = block_state.port.value;
2023 >  conf->flags = block_state.flags.value;
2024 >  conf->aftype = block_state.aftype.value;
2025 >  conf->host = xstrdup(block_state.host.buf);
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 >
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);
2038 >
2039 >  if (block_state.bind.buf[0])
2040    {
2041 <    if (yy_aconf->host && yy_aconf->passwd && yy_aconf->spasswd)
2042 <    {
2043 <      if (conf_add_server(yy_conf, class_name) == -1)
2044 <        delete_conf_item(yy_conf);
2045 <    }
2041 >    memset(&hints, 0, sizeof(hints));
2042 >
2043 >    hints.ai_family   = AF_UNSPEC;
2044 >    hints.ai_socktype = SOCK_STREAM;
2045 >    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2046 >
2047 >    if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2048 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2049      else
2050      {
2051 <      if (yy_conf->name != NULL)
2052 <      {
2053 <        if (yy_aconf->host == NULL)
2054 <          yyerror("Ignoring connect block -- missing host");
2055 <        else if (!yy_aconf->passwd || !yy_aconf->spasswd)
2056 <          yyerror("Ignoring connect block -- missing password");
2057 <      }
2058 <
2059 <      /* XXX
2060 <       * This fixes a try_connections() core (caused by invalid class_ptr
2061 <       * pointers) reported by metalrock. That's an ugly fix, but there
2062 <       * is currently no better way. The entire config subsystem needs an
2063 <       * rewrite ASAP. make_conf_item() shouldn't really add things onto
2064 <       * a doubly linked list immediately without any sanity checks!  -Michael
2065 <       */
2066 <      delete_conf_item(yy_conf);
2067 <    }
2051 >      assert(res);
2052  
2053 <    MyFree(class_name);
2054 <    class_name = NULL;
2055 <    yy_conf = NULL;
2056 <    yy_aconf = NULL;
2053 >      memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2054 >      conf->bind.ss.ss_family = res->ai_family;
2055 >      conf->bind.ss_len = res->ai_addrlen;
2056 >      freeaddrinfo(res);
2057 >    }
2058    }
2059 +
2060 +  conf_add_class_to_conf(conf, block_state.class.buf);
2061 +  lookup_confhost(conf);
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 ';'
2082   {
2083    if (conf_parser_ctx.pass == 2)
2084 <  {
2088 <    MyFree(yy_conf->name);
2089 <    DupString(yy_conf->name, yylval.string);
2090 <  }
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 <  {
2097 <    MyFree(yy_aconf->host);
2098 <    DupString(yy_aconf->host, yylval.string);
2099 <  }
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 <  {
2106 <    struct addrinfo hints, *res;
2107 <
2108 <    memset(&hints, 0, sizeof(hints));
2109 <
2110 <    hints.ai_family   = AF_UNSPEC;
2111 <    hints.ai_socktype = SOCK_STREAM;
2112 <    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2113 <
2114 <    if (getaddrinfo(yylval.string, NULL, &hints, &res))
2115 <      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2116 <    else
2117 <    {
2118 <      assert(res != NULL);
2119 <
2120 <      memcpy(&yy_aconf->bind, res->ai_addr, res->ai_addrlen);
2121 <      yy_aconf->bind.ss.ss_family = res->ai_family;
2122 <      yy_aconf->bind.ss_len = res->ai_addrlen;
2123 <      freeaddrinfo(res);
2124 <    }
2125 <  }
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)
2102 <  {
2132 <    if ($3[0] == ':')
2133 <      yyerror("Server passwords cannot begin with a colon");
2134 <    else if (strchr($3, ' ') != NULL)
2135 <      yyerror("Server passwords cannot contain spaces");
2136 <    else {
2137 <      if (yy_aconf->spasswd != NULL)
2138 <        memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2101 >  if (conf_parser_ctx.pass != 2)
2102 >    break;
2103  
2104 <      MyFree(yy_aconf->spasswd);
2105 <      DupString(yy_aconf->spasswd, yylval.string);
2106 <    }
2107 <  }
2104 >  if ($3[0] == ':')
2105 >    conf_error_report("Server passwords cannot begin with a colon");
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));
2110   };
2111  
2112   connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2113   {
2114 <  if (conf_parser_ctx.pass == 2)
2115 <  {
2150 <    if ($3[0] == ':')
2151 <      yyerror("Server passwords cannot begin with a colon");
2152 <    else if (strchr($3, ' ') != NULL)
2153 <      yyerror("Server passwords cannot contain spaces");
2154 <    else {
2155 <      if (yy_aconf->passwd != NULL)
2156 <        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2114 >  if (conf_parser_ctx.pass != 2)
2115 >    break;
2116  
2117 <      MyFree(yy_aconf->passwd);
2118 <      DupString(yy_aconf->passwd, yylval.string);
2119 <    }
2120 <  }
2117 >  if ($3[0] == ':')
2118 >    conf_error_report("Server passwords cannot begin with a colon");
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)
2134 <    yy_aconf->port = $3;
2134 >    block_state.port.value = $3;
2135   };
2136  
2137   connect_aftype: AFTYPE '=' T_IPV4 ';'
2138   {
2139    if (conf_parser_ctx.pass == 2)
2140 <    yy_aconf->aftype = AF_INET;
2140 >    block_state.aftype.value = AF_INET;
2141   } | AFTYPE '=' T_IPV6 ';'
2142   {
2176 #ifdef IPV6
2143    if (conf_parser_ctx.pass == 2)
2144 <    yy_aconf->aftype = AF_INET6;
2179 < #endif
2144 >    block_state.aftype.value = AF_INET6;
2145   };
2146  
2147   connect_flags: IRCD_FLAGS
2148   {
2149 +  block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2150   } '='  connect_flags_items ';';
2151  
2152   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2153   connect_flags_item: AUTOCONN
2154   {
2155    if (conf_parser_ctx.pass == 2)
2156 <    SetConfAllowAutoConn(yy_aconf);
2191 < } | BURST_AWAY
2192 < {
2193 <  if (conf_parser_ctx.pass == 2)
2194 <    SetConfAwayBurst(yy_aconf);
2195 < } | TOPICBURST
2196 < {
2197 <  if (conf_parser_ctx.pass == 2)
2198 <    SetConfTopicBurst(yy_aconf);
2156 >    block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN;
2157   } | T_SSL
2158   {
2159    if (conf_parser_ctx.pass == 2)
2160 <    SetConfSSL(yy_aconf);
2160 >    block_state.flags.value |= CONF_FLAGS_SSL;
2161   };
2162  
2163   connect_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 2207 | Line 2165 | connect_encrypted: ENCRYPTED '=' TBOOL '
2165    if (conf_parser_ctx.pass == 2)
2166    {
2167      if (yylval.number)
2168 <      yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
2168 >      block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
2169      else
2170 <      yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED;
2170 >      block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
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 <  {
2220 <    char *mask;
2221 <
2222 <    DupString(mask, yylval.string);
2223 <    dlinkAdd(mask, make_dlink_node(), &yy_aconf->hub_list);
2224 <  }
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 <  {
2231 <    char *mask;
2232 <
2233 <    DupString(mask, yylval.string);
2234 <    dlinkAdd(mask, make_dlink_node(), &yy_aconf->leaf_list);
2235 <  }
2183 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
2184   };
2185  
2186   connect_class: CLASS '=' QSTRING ';'
2187   {
2188    if (conf_parser_ctx.pass == 2)
2189 <  {
2242 <    MyFree(class_name);
2243 <    DupString(class_name, yylval.string);
2244 <  }
2189 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
2190   };
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 <  {
2252 <    MyFree(yy_aconf->cipher_list);
2253 <    DupString(yy_aconf->cipher_list, yylval.string);
2254 <  }
2196 >    strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2197   #else
2198    if (conf_parser_ctx.pass == 2)
2199 <    yyerror("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   {
2209    if (conf_parser_ctx.pass == 2)
2210 <  {
2269 <    userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2270 <    regex_ban = 0;
2271 <  }
2210 >    reset_block_state();
2211   } '{' kill_items '}' ';'
2212   {
2213 <  if (conf_parser_ctx.pass == 2)
2275 <  {
2276 <    if (userbuf[0] && hostbuf[0])
2277 <    {
2278 <      if (regex_ban)
2279 <      {
2280 < #ifdef HAVE_LIBPCRE
2281 <        void *exp_user = NULL;
2282 <        void *exp_host = NULL;
2283 <        const char *errptr = NULL;
2284 <
2285 <        if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2286 <            !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2287 <        {
2288 <          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2289 <               errptr);
2290 <          break;
2291 <        }
2292 <
2293 <        yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE));
2294 <        yy_aconf->regexuser = exp_user;
2295 <        yy_aconf->regexhost = exp_host;
2296 <
2297 <        DupString(yy_aconf->user, userbuf);
2298 <        DupString(yy_aconf->host, hostbuf);
2299 <
2300 <        if (reasonbuf[0])
2301 <          DupString(yy_aconf->reason, reasonbuf);
2302 <        else
2303 <          DupString(yy_aconf->reason, "No reason");
2304 < #else
2305 <        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2306 <        break;
2307 < #endif
2308 <      }
2309 <      else
2310 <      {
2311 <        find_and_delete_temporary(userbuf, hostbuf, CONF_KLINE);
2312 <
2313 <        yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2314 <
2315 <        DupString(yy_aconf->user, userbuf);
2316 <        DupString(yy_aconf->host, hostbuf);
2317 <
2318 <        if (reasonbuf[0])
2319 <          DupString(yy_aconf->reason, reasonbuf);
2320 <        else
2321 <          DupString(yy_aconf->reason, "No reason");
2322 <        add_conf_by_address(CONF_KLINE, yy_aconf);
2323 <      }
2324 <    }
2213 >  struct MaskItem *conf = NULL;
2214  
2215 <    yy_aconf = NULL;
2216 <  }
2328 < };
2215 >  if (conf_parser_ctx.pass != 2)
2216 >    break;
2217  
2218 < kill_type: TYPE
2219 < {
2220 < } '='  kill_type_items ';';
2218 >  if (!block_state.user.buf[0] ||
2219 >      !block_state.host.buf[0])
2220 >    break;
2221  
2222 < kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2223 < kill_type_item: REGEX_T
2224 < {
2225 <  if (conf_parser_ctx.pass == 2)
2226 <    regex_ban = 1;
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.rpass.buf[0])
2227 >    conf->reason = xstrdup(block_state.rpass.buf);
2228 >  else
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   {
2238 +
2239    if (conf_parser_ctx.pass == 2)
2240    {
2241      struct split_nuh_item nuh;
2242  
2243      nuh.nuhmask  = yylval.string;
2244      nuh.nickptr  = NULL;
2245 <    nuh.userptr  = userbuf;
2246 <    nuh.hostptr  = hostbuf;
2245 >    nuh.userptr  = block_state.user.buf;
2246 >    nuh.hostptr  = block_state.host.buf;
2247  
2248      nuh.nicksize = 0;
2249 <    nuh.usersize = sizeof(userbuf);
2250 <    nuh.hostsize = sizeof(hostbuf);
2249 >    nuh.usersize = sizeof(block_state.user.buf);
2250 >    nuh.hostsize = sizeof(block_state.host.buf);
2251  
2252      split_nuh(&nuh);
2253    }
2254   };
2255  
2256 < kill_reason: REASON '=' QSTRING ';'
2256 > kill_reason: REASON '=' QSTRING ';'
2257   {
2258    if (conf_parser_ctx.pass == 2)
2259 <    strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
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 <    hostbuf[0] = reasonbuf[0] = '\0';
2269 >    reset_block_state();
2270   } '{' deny_items '}' ';'
2271   {
2272 <  if (conf_parser_ctx.pass == 2)
2379 <  {
2380 <    if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
2381 <    {
2382 <      find_and_delete_temporary(NULL, hostbuf, CONF_DLINE);
2272 >  struct MaskItem *conf = NULL;
2273  
2274 <      yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2275 <      DupString(yy_aconf->host, hostbuf);
2274 >  if (conf_parser_ctx.pass != 2)
2275 >    break;
2276  
2277 <      if (reasonbuf[0])
2278 <        DupString(yy_aconf->reason, reasonbuf);
2279 <      else
2280 <        DupString(yy_aconf->reason, "No reason");
2281 <      add_conf_by_address(CONF_DLINE, yy_aconf);
2282 <      yy_aconf = NULL;
2283 <    }
2277 >  if (!block_state.addr.buf[0])
2278 >    break;
2279 >
2280 >  if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2281 >  {
2282 >    conf = conf_make(CONF_DLINE);
2283 >    conf->host = xstrdup(block_state.addr.buf);
2284 >
2285 >    if (block_state.rpass.buf[0])
2286 >      conf->reason = xstrdup(block_state.rpass.buf);
2287 >    else
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 2400 | Line 2296 | deny_item:      deny_ip | deny_reason |
2296   deny_ip: IP '=' QSTRING ';'
2297   {
2298    if (conf_parser_ctx.pass == 2)
2299 <    strlcpy(hostbuf, yylval.string, sizeof(hostbuf));
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(reasonbuf, yylval.string, sizeof(reasonbuf));
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 <      yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE));
2324 <      DupString(yy_aconf->host, yylval.string);
2323 >      struct MaskItem *conf = conf_make(CONF_EXEMPT);
2324 >      conf->host = xstrdup(yylval.string);
2325  
2326 <      add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
2430 <      yy_aconf = NULL;
2326 >      add_conf_by_address(CONF_EXEMPT, conf);
2327      }
2328    }
2329   };
2330  
2331   /***************************************************************************
2332 < *  section gecos
2332 > * gecos {} section
2333   ***************************************************************************/
2334   gecos_entry: GECOS
2335   {
2336    if (conf_parser_ctx.pass == 2)
2337 <  {
2442 <    regex_ban = 0;
2443 <    reasonbuf[0] = gecos_name[0] = '\0';
2444 <  }
2337 >    reset_block_state();
2338   } '{' gecos_items '}' ';'
2339   {
2340 <  if (conf_parser_ctx.pass == 2)
2341 <  {
2449 <    if (gecos_name[0])
2450 <    {
2451 <      if (regex_ban)
2452 <      {
2453 < #ifdef HAVE_LIBPCRE
2454 <        void *exp_p = NULL;
2455 <        const char *errptr = NULL;
2456 <
2457 <        if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2458 <        {
2459 <          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2460 <               errptr);
2461 <          break;
2462 <        }
2340 >  if (conf_parser_ctx.pass != 2)
2341 >    break;
2342  
2343 <        yy_conf = make_conf_item(RXLINE_TYPE);
2344 <        yy_conf->regexpname = exp_p;
2466 < #else
2467 <        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2468 <        break;
2469 < #endif
2470 <      }
2471 <      else
2472 <        yy_conf = make_conf_item(XLINE_TYPE);
2473 <
2474 <      yy_match_item = map_to_conf(yy_conf);
2475 <      DupString(yy_conf->name, gecos_name);
2476 <
2477 <      if (reasonbuf[0])
2478 <        DupString(yy_match_item->reason, reasonbuf);
2479 <      else
2480 <        DupString(yy_match_item->reason, "No reason");
2481 <    }
2482 <  }
2483 < };
2343 >  if (!block_state.name.buf[0])
2344 >    break;
2345  
2346 < gecos_flags: TYPE
2347 < {
2487 < } '='  gecos_flags_items ';';
2346 >  struct GecosItem *gecos = gecos_make();
2347 >  gecos->mask = xstrdup(block_state.name.buf);
2348  
2349 < gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2350 < gecos_flags_item: REGEX_T
2351 < {
2352 <  if (conf_parser_ctx.pass == 2)
2493 <    regex_ban = 1;
2349 >  if (block_state.rpass.buf[0])
2350 >    gecos->reason = xstrdup(block_state.rpass.buf);
2351 >  else
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(gecos_name, yylval.string, sizeof(gecos_name));
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(reasonbuf, yylval.string, sizeof(reasonbuf));
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
2515 <  '{' 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 |
2382 <                    general_kill_chase_time_limit | general_kline_with_reason |
2383 <                    general_kline_reason | general_invisible_on_connect |
2384 <                    general_warn_no_nline | general_dots_in_ident |
2385 <                    general_stats_o_oper_only | general_stats_k_oper_only |
2386 <                    general_pace_wait | general_stats_i_oper_only |
2387 <                    general_pace_wait_simple | general_stats_P_oper_only |
2388 <                    general_short_motd | general_no_oper_flood |
2389 <                    general_true_no_oper_flood | general_oper_pass_resv |
2390 <                    general_message_locale |
2391 <                    general_oper_only_umodes | general_max_targets |
2392 <                    general_use_egd | general_egdpool_path |
2393 <                    general_oper_umodes | general_caller_id_wait |
2394 <                    general_opers_bypass_callerid | general_default_floodcount |
2395 <                    general_min_nonwildcard | general_min_nonwildcard_simple |
2396 <                    general_disable_remote_commands |
2397 <                    general_client_flood |
2398 <                    general_throttle_time | general_havent_read_conf |
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_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_min_cidr |
2416 <                    general_gline_min_cidr6 | general_use_whois_actually |
2417 <                    general_reject_hold_time | general_stats_e_disabled |
2418 <                    general_max_watch | general_services_name |
2419 <                    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_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2431 > general_away_time: AWAY_TIME '=' timespec ';'
2432   {
2433 <  ConfigFileEntry.gline_min_cidr = $3;
2433 >  ConfigGeneral.away_time = $3;
2434   };
2435  
2436 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2436 > general_max_watch: MAX_WATCH '=' NUMBER ';'
2437   {
2438 <  ConfigFileEntry.gline_min_cidr6 = $3;
2438 >  ConfigGeneral.max_watch = $3;
2439   };
2440  
2441 < general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2441 > general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2442   {
2443 <  ConfigFileEntry.use_whois_actually = yylval.number;
2443 >  ConfigGeneral.whowas_history_length = $3;
2444   };
2445  
2446 < general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';'
2446 > general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2447   {
2448 <  GlobalSetOptions.rejecttime = yylval.number;
2448 >  if (conf_parser_ctx.pass == 2)
2449 >    ConfigGeneral.cycle_on_host_change = yylval.number;
2450   };
2451  
2452 < general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2452 > general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2453   {
2454 <  ConfigFileEntry.tkline_expire_notices = yylval.number;
2454 >  ConfigGeneral.dline_min_cidr = $3;
2455   };
2456  
2457 < general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2457 > general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2458   {
2459 <  ConfigFileEntry.kill_chase_time_limit = $3;
2459 >  ConfigGeneral.dline_min_cidr6 = $3;
2460   };
2461  
2462 < general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2462 > general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2463   {
2464 <  ConfigFileEntry.hide_spoof_ips = yylval.number;
2464 >  ConfigGeneral.kline_min_cidr = $3;
2465   };
2466  
2467 < general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2467 > general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2468   {
2469 <  ConfigFileEntry.ignore_bogus_ts = yylval.number;
2469 >  ConfigGeneral.kline_min_cidr6 = $3;
2470   };
2471  
2472 < general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2472 > general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2473   {
2474 <  ConfigFileEntry.disable_remote = yylval.number;
2474 >  ConfigGeneral.tkline_expire_notices = yylval.number;
2475 > };
2476 >
2477 > general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2478 > {
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 ';'
2641 < {
2642 <  if (($3 > 0) && conf_parser_ctx.pass == 1)
2643 <  {
2644 <    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2645 <    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2646 <    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2647 <    exit(0);
2648 <  }
2649 < };
2650 <
2651 < general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
2523 > general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2524   {
2525 <  ConfigFileEntry.kline_with_reason = yylval.number;
2525 >  ConfigGeneral.invisible_on_connect = yylval.number;
2526   };
2527  
2528 < general_kline_reason: KLINE_REASON '=' QSTRING ';'
2528 > general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2529   {
2530 <  if (conf_parser_ctx.pass == 2)
2659 <  {
2660 <    MyFree(ConfigFileEntry.kline_reason);
2661 <    DupString(ConfigFileEntry.kline_reason, yylval.string);
2662 <  }
2530 >  ConfigGeneral.warn_no_connect_block = yylval.number;
2531   };
2532  
2533 < general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2533 > general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2534   {
2535 <  ConfigFileEntry.invisible_on_connect = yylval.number;
2535 >  ConfigGeneral.stats_e_disabled = yylval.number;
2536   };
2537  
2538 < general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';'
2538 > general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2539   {
2540 <  ConfigFileEntry.warn_no_nline = yylval.number;
2540 >  ConfigGeneral.stats_m_oper_only = yylval.number;
2541   };
2542  
2543 < general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2543 > general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2544   {
2545 <  ConfigFileEntry.stats_e_disabled = yylval.number;
2545 >  ConfigGeneral.stats_o_oper_only = yylval.number;
2546   };
2547  
2548 < general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2548 > general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2549   {
2550 <  ConfigFileEntry.stats_o_oper_only = yylval.number;
2550 >  ConfigGeneral.stats_P_oper_only = yylval.number;
2551   };
2552  
2553 < general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2553 > general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2554   {
2555 <  ConfigFileEntry.stats_P_oper_only = yylval.number;
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;
2729 < };
2730 <  
2731 < general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2732 < {
2733 <  ConfigFileEntry.no_oper_flood = yylval.number;
2734 < };
2735 <
2736 < general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2737 < {
2738 <  ConfigFileEntry.true_no_oper_flood = yylval.number;
2596 >  ConfigGeneral.short_motd = yylval.number;
2597   };
2598  
2599 < general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2599 > general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2600   {
2601 <  ConfigFileEntry.oper_pass_resv = yylval.number;
2744 < };
2745 <
2746 < general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
2747 < {
2748 <  if (conf_parser_ctx.pass == 2)
2749 <  {
2750 <    if (strlen(yylval.string) > LOCALE_LENGTH-2)
2751 <      yylval.string[LOCALE_LENGTH-1] = '\0';
2752 <
2753 <    set_locale(yylval.string);
2754 <  }
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;
2765 < };
2766 <
2767 < general_use_egd: USE_EGD '=' TBOOL ';'
2768 < {
2769 <  ConfigFileEntry.use_egd = yylval.number;
2611 >  ConfigGeneral.max_targets = $3;
2612   };
2613  
2614 < general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2773 < {
2774 <  if (conf_parser_ctx.pass == 2)
2775 <  {
2776 <    MyFree(ConfigFileEntry.egdpool_path);
2777 <    DupString(ConfigFileEntry.egdpool_path, yylval.string);
2778 <  }
2779 < };
2780 <
2781 < 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))
2784 <  {
2785 <    MyFree(ConfigFileEntry.service_name);
2786 <    DupString(ConfigFileEntry.service_name, yylval.string);
2787 <  }
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;
2817 < } | T_CCONN_FULL
2818 < {
2819 <  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;
2850 < } | T_OPERWALL
2851 < {
2852 <  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;
2885 < } | T_CCONN_FULL
2886 < {
2887 <  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;
2918 < } | T_OPERWALL
2919 < {
2920 <  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_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
2791 > general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';'
2792   {
2793 <  ConfigFileEntry.client_flood = $3;
2793 >  ConfigGeneral.default_floodtime = $3;
2794   };
2795  
2796  
2962 /***************************************************************************
2963 *  section glines
2964 ***************************************************************************/
2965 gline_entry: GLINES
2966 {
2967  if (conf_parser_ctx.pass == 2)
2968  {
2969    yy_conf = make_conf_item(GDENY_TYPE);
2970    yy_aconf = map_to_conf(yy_conf);
2971  }
2972 } '{' gline_items '}' ';'
2973 {
2974  if (conf_parser_ctx.pass == 2)
2975  {
2976    /*
2977     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
2978     * end we will have one extra, so we should free it.
2979     */
2980    if (yy_conf->name == NULL || yy_aconf->user == NULL)
2981    {
2982      delete_conf_item(yy_conf);
2983      yy_conf = NULL;
2984      yy_aconf = NULL;
2985    }
2986  }
2987 };
2988
2989 gline_items:        gline_items gline_item | gline_item;
2990 gline_item:         gline_enable |
2991                    gline_duration |
2992                    gline_logging |
2993                    gline_user |
2994                    gline_server |
2995                    gline_action |
2996                    error;
2997
2998 gline_enable: ENABLE '=' TBOOL ';'
2999 {
3000  if (conf_parser_ctx.pass == 2)
3001    ConfigFileEntry.glines = yylval.number;
3002 };
3003
3004 gline_duration: DURATION '=' timespec ';'
3005 {
3006  if (conf_parser_ctx.pass == 2)
3007    ConfigFileEntry.gline_time = $3;
3008 };
3009
3010 gline_logging: T_LOG
3011 {
3012  if (conf_parser_ctx.pass == 2)
3013    ConfigFileEntry.gline_logging = 0;
3014 } '=' gline_logging_types ';';
3015 gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3016 gline_logging_type_item: T_REJECT
3017 {
3018  if (conf_parser_ctx.pass == 2)
3019    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3020 } | T_BLOCK
3021 {
3022  if (conf_parser_ctx.pass == 2)
3023    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3024 };
3025
3026 gline_user: USER '=' QSTRING ';'
3027 {
3028  if (conf_parser_ctx.pass == 2)
3029  {
3030    struct split_nuh_item nuh;
3031
3032    nuh.nuhmask  = yylval.string;
3033    nuh.nickptr  = NULL;
3034    nuh.userptr  = userbuf;
3035    nuh.hostptr  = hostbuf;
3036
3037    nuh.nicksize = 0;
3038    nuh.usersize = sizeof(userbuf);
3039    nuh.hostsize = sizeof(hostbuf);
3040
3041    split_nuh(&nuh);
3042
3043    if (yy_aconf->user == NULL)
3044    {
3045      DupString(yy_aconf->user, userbuf);
3046      DupString(yy_aconf->host, hostbuf);
3047    }
3048    else
3049    {
3050      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3051
3052      DupString(yy_tmp->user, userbuf);
3053      DupString(yy_tmp->host, hostbuf);
3054
3055      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3056    }
3057  }
3058 };
3059
3060 gline_server: NAME '=' QSTRING ';'
3061 {
3062  if (conf_parser_ctx.pass == 2)  
3063  {
3064    MyFree(yy_conf->name);
3065    DupString(yy_conf->name, yylval.string);
3066  }
3067 };
3068
3069 gline_action: ACTION
3070 {
3071  if (conf_parser_ctx.pass == 2)
3072    yy_aconf->flags = 0;
3073 } '=' gdeny_types ';'
3074 {
3075  if (conf_parser_ctx.pass == 2)
3076  {
3077    struct CollectItem *yy_tmp = NULL;
3078    dlink_node *ptr, *next_ptr;
3079
3080    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3081    {
3082      struct AccessItem *new_aconf;
3083      struct ConfItem *new_conf;
3084
3085      yy_tmp = ptr->data;
3086      new_conf = make_conf_item(GDENY_TYPE);
3087      new_aconf = map_to_conf(new_conf);
3088
3089      new_aconf->flags = yy_aconf->flags;
3090
3091      if (yy_conf->name != NULL)
3092        DupString(new_conf->name, yy_conf->name);
3093      else
3094        DupString(new_conf->name, "*");
3095      if (yy_aconf->user != NULL)
3096         DupString(new_aconf->user, yy_tmp->user);
3097      else  
3098        DupString(new_aconf->user, "*");
3099      if (yy_aconf->host != NULL)
3100        DupString(new_aconf->host, yy_tmp->host);
3101      else
3102        DupString(new_aconf->host, "*");
3103
3104      dlinkDelete(&yy_tmp->node, &col_conf_list);
3105    }
3106
3107    /*
3108     * In case someone has fed us with more than one action= after user/name
3109     * which would leak memory  -Michael
3110     */
3111    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3112      delete_conf_item(yy_conf);
3113
3114    yy_conf = make_conf_item(GDENY_TYPE);
3115    yy_aconf = map_to_conf(yy_conf);
3116  }
3117 };
3118
3119 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3120 gdeny_type_item: T_REJECT
3121 {
3122  if (conf_parser_ctx.pass == 2)
3123    yy_aconf->flags |= GDENY_REJECT;
3124 } | T_BLOCK
3125 {
3126  if (conf_parser_ctx.pass == 2)
3127    yy_aconf->flags |= GDENY_BLOCK;
3128 };
3129
2797   /***************************************************************************
2798 < *  section channel
2798 > * channel {} section
2799   ***************************************************************************/
2800 < channel_entry: CHANNEL
3134 <  '{' channel_items '}' ';';
2800 > channel_entry: CHANNEL '{' channel_items '}' ';';
2801  
2802   channel_items:      channel_items channel_item | channel_item;
2803 < channel_item:       channel_disable_local_channels | channel_use_except |
2804 <                    channel_use_invex | channel_use_knock |
2805 <                    channel_max_bans | channel_knock_delay |
2806 <                    channel_knock_delay_channel | channel_max_chans_per_user |
2807 <                    channel_quiet_on_ban | channel_default_split_user_count |
2808 <                    channel_default_split_server_count |
2809 <                    channel_no_create_on_split | channel_restrict_channels |
2810 <                    channel_no_join_on_split | channel_burst_topicwho |
2811 <                    channel_jflood_count | channel_jflood_time |
2812 <                    channel_disable_fake_channels | error;
2803 > channel_item:       channel_max_bans |
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_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
2829 > channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2830   {
2831 <  ConfigChannel.disable_local_channels = yylval.number;
2831 >  ConfigChannel.invite_client_time = $3;
2832   };
2833  
2834 < channel_use_except: USE_EXCEPT '=' TBOOL ';'
2834 > channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2835   {
2836 <  ConfigChannel.use_except = yylval.number;
2836 >  ConfigChannel.invite_delay_channel = $3;
2837   };
2838  
2839 < channel_use_invex: USE_INVEX '=' TBOOL ';'
2839 > channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';'
2840   {
2841 <  ConfigChannel.use_invex = yylval.number;
2841 >  ConfigChannel.invite_expire_time = $3;
2842   };
2843  
2844 < channel_use_knock: USE_KNOCK '=' TBOOL ';'
2844 > channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2845   {
2846 <  ConfigChannel.use_knock = yylval.number;
2846 >  ConfigChannel.knock_client_count = $3;
2847   };
2848  
2849 < channel_knock_delay: KNOCK_DELAY '=' timespec ';'
2849 > channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2850   {
2851 <  ConfigChannel.knock_delay = $3;
2851 >  ConfigChannel.knock_client_time = $3;
2852   };
2853  
2854   channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
# Line 3185 | Line 2856 | channel_knock_delay_channel: KNOCK_DELAY
2856    ConfigChannel.knock_delay_channel = $3;
2857   };
2858  
2859 < channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
2859 > channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
2860   {
2861 <  ConfigChannel.max_chans_per_user = $3;
2861 >  ConfigChannel.max_channels = $3;
2862   };
2863  
2864 < channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
2864 > channel_max_invites: MAX_INVITES '=' NUMBER ';'
2865   {
2866 <  ConfigChannel.quiet_on_ban = yylval.number;
2866 >  ConfigChannel.max_invites = $3;
2867   };
2868  
2869   channel_max_bans: MAX_BANS '=' NUMBER ';'
# Line 3200 | Line 2871 | channel_max_bans: MAX_BANS '=' NUMBER ';
2871    ConfigChannel.max_bans = $3;
2872   };
2873  
2874 < channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2874 > channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';'
2875   {
2876 <  ConfigChannel.default_split_user_count = $3;
2876 >  ConfigChannel.max_bans_large = $3;
2877   };
2878  
2879 < channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2879 > channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2880   {
2881 <  ConfigChannel.default_split_server_count = $3;
2881 >  ConfigChannel.default_join_flood_count = yylval.number;
2882   };
2883  
2884 < channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
2884 > channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2885   {
2886 <  ConfigChannel.no_create_on_split = yylval.number;
2886 >  ConfigChannel.default_join_flood_time = $3;
2887   };
2888  
3218 channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
3219 {
3220  ConfigChannel.no_join_on_split = yylval.number;
3221 };
3222
3223 channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
3224 {
3225  ConfigChannel.burst_topicwho = yylval.number;
3226 };
3227
3228 channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3229 {
3230  GlobalSetOptions.joinfloodcount = yylval.number;
3231 };
3232
3233 channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
3234 {
3235  GlobalSetOptions.joinfloodtime = yylval.number;
3236 };
2889  
2890   /***************************************************************************
2891 < *  section serverhide
2891 > * serverhide {} section
2892   ***************************************************************************/
2893 < serverhide_entry: SERVERHIDE
3242 <  '{' 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_disable_hidden |
2899 <                    serverhide_hidden | serverhide_hidden_name |
2900 <                    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 3255 | 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 <    DupString(ConfigServerHide.hidden_name, 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)
3278 <    {
3279 <      eventAddIsh("write_links_file", write_links_file, NULL, $3);
3280 <      ConfigServerHide.links_disabled = 0;
3281 <    }
2941 >    ConfigServerHide.disable_remote_commands = yylval.number;
2942 > };
2943  
2944 <    ConfigServerHide.links_delay = $3;
2945 <  }
2944 > serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
2945 > {
2946 >  if (conf_parser_ctx.pass == 2)
2947 >    ConfigServerHide.hide_servers = yylval.number;
2948   };
2949  
2950 < serverhide_hidden: HIDDEN '=' TBOOL ';'
2950 > serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
2951   {
2952    if (conf_parser_ctx.pass == 2)
2953 <    ConfigServerHide.hidden = yylval.number;
2953 >    ConfigServerHide.hide_services = yylval.number;
2954   };
2955  
2956 < serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
2956 > serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
2957   {
2958    if (conf_parser_ctx.pass == 2)
2959 <    ConfigServerHide.disable_hidden = yylval.number;
2959 >  {
2960 >    xfree(ConfigServerHide.hidden_name);
2961 >    ConfigServerHide.hidden_name = xstrdup(yylval.string);
2962 >  }
2963 > };
2964 >
2965 > serverhide_hidden: HIDDEN '=' TBOOL ';'
2966 > {
2967 >  if (conf_parser_ctx.pass == 2)
2968 >    ConfigServerHide.hidden = yylval.number;
2969   };
2970  
2971   serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'

Comparing:
ircd-hybrid-8/src/conf_parser.y (property svn:keywords), Revision 1389 by michael, Tue May 1 13:08:29 2012 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (property svn:keywords), 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)