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/ircd_parser.y (file contents), Revision 1264 by michael, Tue Jan 17 12:30:57 2012 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (file contents), Revision 5025 by michael, Fri Dec 12 15:18:43 2014 UTC

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

Diff Legend

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