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

Diff Legend

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