ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
(Generate patch)

Comparing:
ircd-hybrid-8/src/conf_parser.y (file contents), Revision 1352 by michael, Fri Apr 13 09:57:08 2012 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (file contents), Revision 5347 by michael, Sun Jan 11 12:42:20 2015 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  conf_parser.y: Parses the ircd configuration file.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2005 by the past and present ircd coders, and others.
4 > *  Copyright (c) 2000-2015 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 16 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
21 *
22 *  $Id$
20   */
21  
22 + /*! \file conf_parser.y
23 + * \brief Parses the ircd configuration file.
24 + * \version $Id$
25 + */
26 +
27 +
28   %{
29  
30   #define YY_NO_UNPUT
# Line 33 | Line 36
36   #include "ircd.h"
37   #include "list.h"
38   #include "conf.h"
39 + #include "conf_class.h"
40 + #include "conf_pseudo.h"
41   #include "event.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>
# Line 55 | Line 60
60   #include <openssl/dh.h>
61   #endif
62  
63 < int yylex(void);
63 > #include "rsa.h"
64  
65 < static char *class_name = NULL;
61 < static struct ConfItem *yy_conf = NULL;
62 < static struct AccessItem *yy_aconf = NULL;
63 < static struct MatchItem *yy_match_item = NULL;
64 < static struct ClassItem *yy_class = NULL;
65 < static char *yy_class_name = NULL;
66 <
67 < static dlink_list col_conf_list  = { NULL, NULL, 0 };
68 < static dlink_list hub_conf_list  = { NULL, NULL, 0 };
69 < static dlink_list leaf_conf_list = { NULL, NULL, 0 };
70 < static unsigned int listener_flags = 0;
71 < static unsigned int regex_ban = 0;
72 < static char userbuf[IRCD_BUFSIZE];
73 < static char hostbuf[IRCD_BUFSIZE];
74 < static char reasonbuf[REASONLEN + 1];
75 < static char gecos_name[REALLEN * 4];
76 < static char lfile[IRCD_BUFSIZE];
77 < static unsigned int ltype = 0;
78 < static unsigned int lsize = 0;
79 < static char *resv_reason = NULL;
80 < static char *listener_address = NULL;
81 <
82 < struct CollectItem
83 < {
84 <  dlink_node node;
85 <  char *name;
86 <  char *user;
87 <  char *host;
88 <  char *passwd;
89 <  int  port;
90 <  int  flags;
91 < #ifdef HAVE_LIBCRYPTO
92 <  char *rsa_public_key_file;
93 <  RSA *rsa_public_key;
94 < #endif
95 < };
65 > int yylex(void);
66  
67 < static void
98 < free_collect_item(struct CollectItem *item)
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;
114 <  dlink_node *next_ptr;
115 <  struct CollectItem *yy_hconf;
116 <  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 138 | Line 155 | unhook_hub_leaf_confs(void)
155   }
156  
157   %token  ACCEPT_PASSWORD
141 %token  ACTION
158   %token  ADMIN
159   %token  AFTYPE
144 %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
151 < %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
169 > %token  CIDR_BITLEN_IPV4
170 > %token  CIDR_BITLEN_IPV6
171   %token  CLASS
172   %token  CONNECT
173   %token  CONNECTFREQ
174 + %token  CYCLE_ON_HOST_CHANGE
175   %token  DEFAULT_FLOODCOUNT
176   %token  DEFAULT_SPLIT_SERVER_COUNT
177   %token  DEFAULT_SPLIT_USER_COUNT
# Line 165 | Line 180 | unhook_hub_leaf_confs(void)
180   %token  DIE
181   %token  DISABLE_AUTH
182   %token  DISABLE_FAKE_CHANNELS
168 %token  DISABLE_HIDDEN
169 %token  DISABLE_LOCAL_CHANNELS
183   %token  DISABLE_REMOTE_COMMANDS
184   %token  DOTS_IN_IDENT
172 %token  DURATION
185   %token  EGDPOOL_PATH
186   %token  EMAIL
175 %token  ENABLE
187   %token  ENCRYPTED
188   %token  EXCEED_LIMIT
189   %token  EXEMPT
190   %token  FAILED_OPER_NOTICE
180 %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
187 %token  GLINE_TIME
198   %token  GLINE_MIN_CIDR
199   %token  GLINE_MIN_CIDR6
200 + %token  GLINE_REQUEST_DURATION
201   %token  GLOBAL_KILL
191 %token  IRCD_AUTH
192 %token  NEED_IDENT
202   %token  HAVENT_READ_CONF
203   %token  HIDDEN
204 < %token  HIDDEN_NAME
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
211 < %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
238 %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
244 %token  NUMBER_PER_IDENT
267   %token  NUMBER_PER_CIDR
268   %token  NUMBER_PER_IP
247 %token  NUMBER_PER_IP_GLOBAL
248 %token  OPERATOR
249 %token  OPERS_BYPASS_CALLERID
269   %token  OPER_ONLY_UMODES
270   %token  OPER_PASS_RESV
252 %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
262 %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
269 %token  REGEX_T
286   %token  REHASH
271 %token  TREJECT_HOLD_TIME
287   %token  REMOTE
288   %token  REMOTEBAN
274 %token  RESTRICT_CHANNELS
275 %token  RESTRICTED
276 %token  RSA_PRIVATE_KEY_FILE
277 %token  RSA_PUBLIC_KEY_FILE
278 %token  SSL_CERTIFICATE_FILE
279 %token  SSL_DH_PARAM_FILE
280 %token  T_SSL_CLIENT_METHOD
281 %token  T_SSL_SERVER_METHOD
282 %token  T_SSLV3
283 %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
291 %token  IRCD_SID
292 %token  TKLINE_EXPIRE_NOTICES
293 %token  T_SHARED
294 %token  T_CLUSTER
295 %token  TYPE
298   %token  SHORT_MOTD
297 %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
306 < %token  TMASKED
307 < %token  T_REJECT
308 < %token  TS_MAX_DELTA
309 < %token  TS_WARN_DELTA
310 < %token  TWODOTS
314 > %token  STATS_U_OPER_ONLY
315   %token  T_ALL
316   %token  T_BOTS
313 %token  T_SOFTCALLERID
317   %token  T_CALLERID
318   %token  T_CCONN
319 < %token  T_CCONN_FULL
320 < %token  T_SSL_CIPHER_LIST
318 < %token  T_CLIENT_FLOOD
319 > %token  T_COMMAND
320 > %token  T_CLUSTER
321   %token  T_DEAF
322   %token  T_DEBUG
323   %token  T_DLINE
322 %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
344 %token  T_GLOBOPS
361   %token  T_WALLOP
362 < %token  T_RESTART
363 < %token  T_SERVICE
364 < %token  T_SERVICES_NAME
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
356 %token  USER
374   %token  USE_EGD
358 %token  USE_EXCEPT
359 %token  USE_INVEX
360 %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
366 %token  WARN
367 %token  WARN_NO_NLINE
368 %token  T_SIZE
369 %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
401 <                | 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 <                }
426 <                | NUMBER DAYS timespec_
427 <                {
428 <                        $$ = $1 * 60 * 60 * 24 + $3;
429 <                }
430 <                | NUMBER WEEKS timespec_
431 <                {
432 <                        $$ = $1 * 60 * 60 * 24 * 7 + $3;
433 <                }
434 <                ;
435 <
436 < sizespec_:      { $$ = 0; } | sizespec;
437 < sizespec:       NUMBER sizespec_ { $$ = $1 + $2; }
438 <                | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
439 <                | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
440 <                | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
441 <                ;
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 466 | 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 | serverinfo_ssl_dh_param_file |
469 <                        serverinfo_rsa_private_key_file | serverinfo_vhost6 |
470 <                        serverinfo_sid | serverinfo_ssl_certificate_file |
471 <                        serverinfo_ssl_client_method | serverinfo_ssl_server_method |
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 <                        error ';' ;
482 <
479 <
480 < serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
481 < serverinfo_ssl_server_method: T_SSL_SERVER_METHOD '=' server_method_types ';' ;
482 <
483 < client_method_types: client_method_types ',' client_method_type_item | client_method_type_item;
484 < client_method_type_item: T_SSLV3
485 < {
486 < #ifdef HAVE_LIBCRYPTO
487 <  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
488 <    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
489 < #endif
490 < } | T_TLSV1
491 < {
492 < #ifdef HAVE_LIBCRYPTO
493 <  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
494 <    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
495 < #endif
496 < };
481 >                        serverinfo_ssl_message_digest_algorithm |
482 >                        error ';' ;
483  
498 server_method_types: server_method_types ',' server_method_type_item | server_method_type_item;
499 server_method_type_item: T_SSLV3
500 {
501 #ifdef HAVE_LIBCRYPTO
502  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
503    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
504 #endif
505 } | T_TLSV1
506 {
507 #ifdef HAVE_LIBCRYPTO
508  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
509    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
510 #endif
511 };
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 ||
526 <        SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
527 <                                     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(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
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) ||
515 <        !SSL_CTX_check_private_key(ServerInfo.client_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 552 | 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)
556 <  {
557 <    BIO *file;
528 >  BIO *file = NULL;
529  
530 <    if (ServerInfo.rsa_private_key)
531 <    {
561 <      RSA_free(ServerInfo.rsa_private_key);
562 <      ServerInfo.rsa_private_key = NULL;
563 <    }
530 >  if (conf_parser_ctx.pass != 1)
531 >    break;
532  
533 <    if (ServerInfo.rsa_private_key_file)
534 <    {
535 <      MyFree(ServerInfo.rsa_private_key_file);
536 <      ServerInfo.rsa_private_key_file = NULL;
537 <    }
533 >  if (ConfigServerInfo.rsa_private_key)
534 >  {
535 >    RSA_free(ConfigServerInfo.rsa_private_key);
536 >    ConfigServerInfo.rsa_private_key = NULL;
537 >  }
538  
539 <    DupString(ServerInfo.rsa_private_key_file, yylval.string);
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 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
574 <    {
575 <      yyerror("File open failed, ignoring");
576 <      break;
577 <    }
545 >  ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
546  
547 <    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
547 >  if ((file = BIO_new_file(yylval.string, "r")) == NULL)
548 >  {
549 >    conf_error_report("File open failed, ignoring");
550 >    break;
551 >  }
552  
553 <    BIO_set_close(file, BIO_CLOSE);
582 <    BIO_free(file);
553 >  ConfigServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
554  
555 <    if (ServerInfo.rsa_private_key == NULL)
556 <    {
586 <      yyerror("Couldn't extract key, ignoring");
587 <      break;
588 <    }
555 >  BIO_set_close(file, BIO_CLOSE);
556 >  BIO_free(file);
557  
558 <    if (!RSA_check_key(ServerInfo.rsa_private_key))
559 <    {
560 <      RSA_free(ServerInfo.rsa_private_key);
561 <      ServerInfo.rsa_private_key = NULL;
558 >  if (ConfigServerInfo.rsa_private_key == NULL)
559 >  {
560 >    conf_error_report("Couldn't extract key, ignoring");
561 >    break;
562 >  }
563  
564 <      yyerror("Invalid key, ignoring");
565 <      break;
566 <    }
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 <    /* require 2048 bit (256 byte) key */
570 <    if (RSA_size(ServerInfo.rsa_private_key) != 256)
571 <    {
602 <      RSA_free(ServerInfo.rsa_private_key);
603 <      ServerInfo.rsa_private_key = NULL;
569 >    conf_error_report("Invalid key, ignoring");
570 >    break;
571 >  }
572  
573 <      yyerror("Not a 2048 bit key, ignoring");
574 <    }
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   {
613 /* TBD - XXX: error reporting */
585   #ifdef HAVE_LIBCRYPTO
586 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
586 >  if (conf_parser_ctx.pass == 2)
587    {
588      BIO *file = BIO_new_file(yylval.string, "r");
589  
# Line 625 | Line 596 | serverinfo_ssl_dh_param_file: SSL_DH_PAR
596        if (dh)
597        {
598          if (DH_size(dh) < 128)
599 <          ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
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(ServerInfo.server_ctx, dh);
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   };
# Line 639 | Line 612 | serverinfo_ssl_dh_param_file: SSL_DH_PAR
612   serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
613   {
614   #ifdef HAVE_LIBCRYPTO
615 <  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
616 <    SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
615 >  if (conf_parser_ctx.pass == 2)
616 >    SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, yylval.string);
617 > #endif
618 > };
619 >
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 >      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_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 (conf_parser_ctx.pass == 2)
642 >  {
643 >    if ((nid = OBJ_sn2nid(yylval.string)) == 0)
644 >    {
645 >        conf_error_report("Ignoring serverinfo::serverinfo_ssl_dh_elliptic_curve -- unknown curve name");
646 >        break;
647 >    }
648 >
649 >    if ((key = EC_KEY_new_by_curve_name(nid)) == NULL)
650 >    {
651 >      conf_error_report("Ignoring serverinfo::serverinfo_ssl_dh_elliptic_curve -- could not create curve");
652 >      break;
653 >    }
654 >
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 678 | 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 689 | 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 722 | 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   {
739 #ifdef IPV6
755    if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
756    {
757      struct addrinfo hints, *res;
# Line 751 | 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    }
764 #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 799 | 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 835 | 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_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;
1005 >    ConfigLog.use_logging = yylval.number;
1006   };
1007  
1008   logging_file_entry:
1009   {
1010 <  lfile[0] = '\0';
1011 <  ltype = 0;
851 <  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 863 | 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 */
925 <  }
926 <  else
927 <  {
928 <    MyFree(class_name);
929 <    class_name = NULL;
930 <  }
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)
934 <  {
935 <    struct CollectItem *yy_tmp;
936 <    dlink_node *ptr;
937 <    dlink_node *next_ptr;
1102 >  dlink_node *node = NULL;
1103  
1104 <    conf_add_class_to_conf(yy_conf, class_name);
1104 >  if (conf_parser_ctx.pass != 2)
1105 >    break;
1106  
1107 <    /* Now, make sure there is a copy of the "base" given oper
1108 <     * block in each of the collected copies
1109 <     */
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_SAFE(ptr, next_ptr, col_conf_list.head)
1119 <    {
1120 <      struct AccessItem *new_aconf;
1121 <      struct ConfItem *new_conf;
949 <      yy_tmp = ptr->data;
950 <
951 <      new_conf = make_conf_item(OPER_TYPE);
952 <      new_aconf = (struct AccessItem *)map_to_conf(new_conf);
953 <
954 <      new_aconf->flags = yy_aconf->flags;
955 <
956 <      if (yy_conf->name != NULL)
957 <        DupString(new_conf->name, yy_conf->name);
958 <      if (yy_tmp->user != NULL)
959 <        DupString(new_aconf->user, yy_tmp->user);
960 <      else
961 <        DupString(new_aconf->user, "*");
962 <      if (yy_tmp->host != NULL)
963 <        DupString(new_aconf->host, yy_tmp->host);
964 <      else
965 <        DupString(new_aconf->host, "*");
1118 >  DLINK_FOREACH(node, block_state.mask.list.head)
1119 >  {
1120 >    struct MaskItem *conf = NULL;
1121 >    struct split_nuh_item nuh;
1122  
1123 <      new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->ipnum,
1124 <                                     &new_aconf->bits);
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 <      conf_add_class_to_conf(new_conf, class_name);
1133 <      if (yy_aconf->passwd != NULL)
1134 <        DupString(new_aconf->passwd, yy_aconf->passwd);
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 <      new_aconf->port = yy_aconf->port;
975 < #ifdef HAVE_LIBCRYPTO
976 <      if (yy_aconf->rsa_public_key_file != NULL)
977 <      {
978 <        BIO *file;
1148 >    conf_add_class_to_conf(conf, block_state.class.buf);
1149  
1150 <        DupString(new_aconf->rsa_public_key_file,
1151 <                  yy_aconf->rsa_public_key_file);
1150 > #ifdef HAVE_LIBCRYPTO
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);
987 <        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        }
989 #endif
1161  
1162 < #ifdef HAVE_LIBCRYPTO
1163 <      if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key)
1164 <          && yy_tmp->host)
994 < #else
995 <      if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host)
996 < #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 <
1007 <    yy_conf = NULL;
1008 <    yy_aconf = NULL;
1009 <
1010 <
1011 <    MyFree(class_name);
1012 <    class_name = NULL;
1175 > #endif /* HAVE_LIBCRYPTO */
1176    }
1177 < };
1177 > };
1178  
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 <  {
1025 <    if (strlen(yylval.string) > OPERNICKLEN)
1026 <      yylval.string[OPERNICKLEN] = '\0';
1027 <
1028 <    MyFree(yy_conf->name);
1029 <    DupString(yy_conf->name, yylval.string);
1030 <  }
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 <  {
1037 <    struct split_nuh_item nuh;
1038 <
1039 <    nuh.nuhmask  = yylval.string;
1040 <    nuh.nickptr  = NULL;
1041 <    nuh.userptr  = userbuf;
1042 <    nuh.hostptr  = hostbuf;
1043 <
1044 <    nuh.nicksize = 0;
1045 <    nuh.usersize = sizeof(userbuf);
1046 <    nuh.hostsize = sizeof(hostbuf);
1047 <
1048 <    split_nuh(&nuh);
1049 <
1050 <    if (yy_aconf->user == NULL)
1051 <    {
1052 <      DupString(yy_aconf->user, userbuf);
1053 <      DupString(yy_aconf->host, hostbuf);
1054 <
1055 <      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->ipnum,
1056 <                                    &yy_aconf->bits);
1057 <    }
1058 <    else
1059 <    {
1060 <      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1061 <
1062 <      DupString(yy_tmp->user, userbuf);
1063 <      DupString(yy_tmp->host, hostbuf);
1064 <
1065 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1066 <    }
1067 <  }
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 <  {
1074 <    if (yy_aconf->passwd != NULL)
1075 <      memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1076 <
1077 <    MyFree(yy_aconf->passwd);
1078 <    DupString(yy_aconf->passwd, yylval.string);
1079 <  }
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   {
1095 #ifdef HAVE_LIBCRYPTO
1223    if (conf_parser_ctx.pass == 2)
1224 <  {
1225 <    BIO *file;
1099 <
1100 <    if (yy_aconf->rsa_public_key != NULL)
1101 <    {
1102 <      RSA_free(yy_aconf->rsa_public_key);
1103 <      yy_aconf->rsa_public_key = NULL;
1104 <    }
1105 <
1106 <    if (yy_aconf->rsa_public_key_file != NULL)
1107 <    {
1108 <      MyFree(yy_aconf->rsa_public_key_file);
1109 <      yy_aconf->rsa_public_key_file = NULL;
1110 <    }
1111 <
1112 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
1113 <    file = BIO_new_file(yylval.string, "r");
1114 <
1115 <    if (file == NULL)
1116 <    {
1117 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
1118 <      break;
1119 <    }
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;
1127 <    }
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 <  {
1139 <    MyFree(class_name);
1140 <    DupString(class_name, yylval.string);
1141 <  }
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;
1159 < } | T_CCONN_FULL
1160 < {
1161 <  if (conf_parser_ctx.pass == 2)
1162 <    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 <    yy_aconf->modes |= UMODE_HIDDEN;
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;
1203 < } | T_OPERWALL
1204 < {
1205 <  if (conf_parser_ctx.pass == 2)
1206 <    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 <    yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1362 < } | REMOTE
1361 >    block_state.port.value |= OPER_FLAG_KILL;
1362 > } | CONNECT ':' REMOTE
1363   {
1364    if (conf_parser_ctx.pass == 2)
1365 <    yy_aconf->port |= OPER_FLAG_REMOTE;
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 >    block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1374 > } | SQUIT
1375 > {
1376 >  if (conf_parser_ctx.pass == 2)
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 <    yy_aconf->port |= OPER_FLAG_DLINE;
1389 >    block_state.port.value |= OPER_FLAG_DLINE;
1390   } | T_UNDLINE
1391   {
1392    if (conf_parser_ctx.pass == 2)
1393 <    yy_aconf->port |= OPER_FLAG_UNDLINE;
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 < } | 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 < } | REMOTEBAN
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_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_MODULE;
1445 >    block_state.port.value |= OPER_FLAG_MODULE;
1446 > } | T_OPME
1447 > {
1448 >  if (conf_parser_ctx.pass == 2)
1449 >    block_state.port.value |= OPER_FLAG_OPME;
1450   };
1451  
1452  
# Line 1317 | Line 1455 | oper_flags_item: GLOBAL_KILL
1455   ***************************************************************************/
1456   class_entry: CLASS
1457   {
1458 <  if (conf_parser_ctx.pass == 1)
1459 <  {
1322 <    yy_conf = make_conf_item(CLASS_TYPE);
1323 <    yy_class = map_to_conf(yy_conf);
1324 <  }
1325 < } '{' class_items '}' ';'
1326 < {
1327 <  if (conf_parser_ctx.pass == 1)
1328 <  {
1329 <    struct ConfItem *cconf = NULL;
1330 <    struct ClassItem *class = NULL;
1331 <
1332 <    if (yy_class_name == NULL)
1333 <      delete_conf_item(yy_conf);
1334 <    else
1335 <    {
1336 <      cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1337 <
1338 <      if (cconf != NULL)                /* The class existed already */
1339 <      {
1340 <        int user_count = 0;
1458 >  if (conf_parser_ctx.pass != 1)
1459 >    break;
1460  
1461 <        rebuild_cidr_class(cconf, yy_class);
1461 >  reset_block_state();
1462  
1463 <        class = map_to_conf(cconf);
1464 <
1465 <        user_count = class->curr_user_count;
1466 <        memcpy(class, yy_class, sizeof(*class));
1467 <        class->curr_user_count = user_count;
1468 <        class->active = 1;
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 <        delete_conf_item(yy_conf);
1472 >  if (conf_parser_ctx.pass != 1)
1473 >    break;
1474  
1475 <        MyFree(cconf->name);            /* Allows case change of class name */
1476 <        cconf->name = yy_class_name;
1355 <      }
1356 <      else      /* Brand new class */
1357 <      {
1358 <        MyFree(yy_conf->name);          /* just in case it was allocated */
1359 <        yy_conf->name = yy_class_name;
1360 <        yy_class->active = 1;
1361 <      }
1362 <    }
1475 >  if (!block_state.class.buf[0])
1476 >    break;
1477  
1478 <    yy_class_name = NULL;
1479 <  }
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  
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 |
1373 <                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 ';' ;
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: NAME '=' QSTRING ';'
1537 > class_name: NAME '=' QSTRING ';'
1538   {
1539    if (conf_parser_ctx.pass == 1)
1540 <  {
1387 <    MyFree(yy_class_name);
1388 <    DupString(yy_class_name, yylval.string);
1389 <  }
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;
1472 <    listener_flags = 0;
1473 <  }
1474 < } '{' listen_items '}' ';'
1475 < {
1476 <  if (conf_parser_ctx.pass == 2)
1477 <  {
1478 <    MyFree(listener_address);
1479 <    listener_address = NULL;
1480 <  }
1481 < };
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  
1503
1504
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 1513 | 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 <      {
1521 <        yyerror("SSL not available - port closed");
1522 <        break;
1523 <      }
1524 <    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
1536      {
1537        yyerror("SSL not available - port closed");
1538        break;
1539      }
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 <  {
1550 <    MyFree(listener_address);
1551 <    DupString(listener_address, yylval.string);
1552 <  }
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 <  {
1559 <    MyFree(listener_address);
1560 <    DupString(listener_address, yylval.string);
1561 <  }
1733 >    strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1734   };
1735  
1736   /***************************************************************************
# Line 1567 | Line 1739 | listen_host: HOST '=' QSTRING ';'
1739   auth_entry: IRCD_AUTH
1740   {
1741    if (conf_parser_ctx.pass == 2)
1742 <  {
1571 <    yy_conf = make_conf_item(CLIENT_TYPE);
1572 <    yy_aconf = map_to_conf(yy_conf);
1573 <  }
1574 <  else
1575 <  {
1576 <    MyFree(class_name);
1577 <    class_name = NULL;
1578 <  }
1742 >    reset_block_state();
1743   } '{' auth_items '}' ';'
1744   {
1745 <  if (conf_parser_ctx.pass == 2)
1582 <  {
1583 <    struct CollectItem *yy_tmp = NULL;
1584 <    dlink_node *ptr = NULL, *next_ptr = NULL;
1585 <
1586 <    if (yy_aconf->user && yy_aconf->host)
1587 <    {
1588 <      conf_add_class_to_conf(yy_conf, class_name);
1589 <      add_conf_by_address(CONF_CLIENT, yy_aconf);
1590 <    }
1591 <    else
1592 <      delete_conf_item(yy_conf);
1593 <
1594 <    /* copy over settings from first struct */
1595 <    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
1596 <    {
1597 <      struct AccessItem *new_aconf;
1598 <      struct ConfItem *new_conf;
1599 <
1600 <      new_conf = make_conf_item(CLIENT_TYPE);
1601 <      new_aconf = map_to_conf(new_conf);
1602 <
1603 <      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)
1608 <        DupString(new_aconf->passwd, yy_aconf->passwd);
1609 <      if (yy_conf->name != NULL)
1610 <        DupString(new_conf->name, yy_conf->name);
1611 <      if (yy_aconf->passwd != NULL)
1612 <        DupString(new_aconf->passwd, yy_aconf->passwd);
1613 <
1614 <      new_aconf->flags = yy_aconf->flags;
1615 <      new_aconf->port  = yy_aconf->port;
1616 <
1617 <      DupString(new_aconf->user, yy_tmp->user);
1618 <      collapse(new_aconf->user);
1619 <
1620 <      DupString(new_aconf->host, yy_tmp->host);
1621 <      collapse(new_aconf->host);
1622 <
1623 <      conf_add_class_to_conf(new_conf, class_name);
1624 <      add_conf_by_address(CONF_CLIENT, new_aconf);
1625 <      dlinkDelete(&yy_tmp->node, &col_conf_list);
1626 <      free_collect_item(yy_tmp);
1627 <    }
1628 <
1629 <    MyFree(class_name);
1630 <    class_name = NULL;
1631 <    yy_conf = NULL;
1632 <    yy_aconf = NULL;
1633 <  }
1634 < };
1635 <
1636 < auth_items:     auth_items auth_item | auth_item;
1637 < auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
1638 <                auth_spoof | auth_redir_serv | auth_redir_port |
1639 <                auth_encrypted | error ';' ;
1640 <
1641 < auth_user: USER '=' QSTRING ';'
1642 < {
1643 <  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;
1652 <
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);
1656 <
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 */
1683 <    if (yy_aconf->passwd != NULL)
1684 <      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 <  {
1695 <    MyFree(class_name);
1696 <    DupString(class_name, yylval.string);
1697 <  }
1807 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1808   };
1809  
1810   auth_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 1702 | 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 */
1755 < auth_spoof: SPOOF '=' QSTRING ';'
1870 > auth_spoof: SPOOF '=' QSTRING ';'
1871   {
1872 <  if (conf_parser_ctx.pass == 2)
1873 <  {
1759 <    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;
1765 <    }
1766 <    else
1767 <    {
1768 <      ilog(LOG_TYPE_IRCD, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1769 <      yy_conf->name = NULL;
1770 <    }
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);
1781 <  }
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 1796 | 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;
1810 <  }
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 <  {
1820 <    MyFree(resv_reason);
1821 <    DupString(resv_reason, yylval.string);
1822 <  }
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 <  {
1829 <    if (IsChanPrefix(*yylval.string))
1830 <    {
1831 <      char def_reason[] = "No reason";
1832 <
1833 <      create_channel_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
1834 <    }
1835 <  }
1836 <  /* ignore it for now.. but we really should make a warning if
1837 <   * 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 <  {
1844 <    char def_reason[] = "No reason";
1845 <
1846 <    create_nick_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
1847 <  }
1939 >    dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1940   };
1941  
1942 +
1943   /***************************************************************************
1944   *  section service
1945   ***************************************************************************/
# Line 1857 | 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 <    {
1864 <      yy_conf = make_conf_item(SERVICE_TYPE);
1865 <      DupString(yy_conf->name, yylval.string);
1866 <    }
1958 >    struct MaskItem *conf = conf_make(CONF_SERVICE);
1959 >    conf->name = xstrdup(yylval.string);
1960    }
1961   };
1962  
# Line 1872 | 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 1892 | Line 1994 | shared_item:  shared_name | shared_user
1994   shared_name: NAME '=' QSTRING ';'
1995   {
1996    if (conf_parser_ctx.pass == 2)
1997 <  {
1896 <    MyFree(yy_conf->name);
1897 <    DupString(yy_conf->name, yylval.string);
1898 <  }
1997 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1998   };
1999  
2000   shared_user: USER '=' QSTRING ';'
# Line 1906 | 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);
1917
1918    DupString(yy_match_item->user, userbuf);
1919    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;
2029 >    block_state.flags.value |= SHARED_KLINE;
2030   } | UNKLINE
2031   {
2032    if (conf_parser_ctx.pass == 2)
2033 <    yy_match_item->action |= SHARED_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_DLINE;
2037 >    block_state.flags.value |= SHARED_DLINE;
2038   } | T_UNDLINE
2039   {
2040    if (conf_parser_ctx.pass == 2)
2041 <    yy_match_item->action |= SHARED_UNDLINE;
2041 >    block_state.flags.value |= SHARED_UNDLINE;
2042   } | XLINE
2043   {
2044    if (conf_parser_ctx.pass == 2)
2045 <    yy_match_item->action |= SHARED_XLINE;
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;
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 1974 | 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;
2111 >    block_state.flags.value |= SHARED_KLINE;
2112   } | UNKLINE
2113   {
2114    if (conf_parser_ctx.pass == 2)
2115 <    yy_conf->flags |= SHARED_UNKLINE;
2115 >    block_state.flags.value |= SHARED_UNKLINE;
2116   } | T_DLINE
2117   {
2118    if (conf_parser_ctx.pass == 2)
2119 <    yy_conf->flags |= SHARED_DLINE;
2119 >    block_state.flags.value |= SHARED_DLINE;
2120   } | T_UNDLINE
2121   {
2122    if (conf_parser_ctx.pass == 2)
2123 <    yy_conf->flags |= SHARED_UNDLINE;
2123 >    block_state.flags.value |= SHARED_UNDLINE;
2124   } | XLINE
2125   {
2126    if (conf_parser_ctx.pass == 2)
2127 <    yy_conf->flags |= SHARED_XLINE;
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;
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   {
2055  if (conf_parser_ctx.pass == 2)
2056  {
2057    yy_conf = make_conf_item(SERVER_TYPE);
2058    yy_aconf = map_to_conf(yy_conf);
2155  
2156 <    /* defaults */
2157 <    yy_aconf->port = PORTNUM;
2158 <  }
2159 <  else
2160 <  {
2161 <    MyFree(class_name);
2066 <    class_name = NULL;
2067 <  }
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 <  {
2072 <    struct CollectItem *yy_hconf=NULL;
2073 <    struct CollectItem *yy_lconf=NULL;
2074 <    dlink_node *ptr = NULL, *next_ptr = NULL;
2075 <
2076 <    if (yy_aconf->host &&
2077 <        yy_aconf->passwd && yy_aconf->spasswd)
2078 <    {
2079 <      if (conf_add_server(yy_conf, class_name) == -1)
2080 <      {
2081 <        delete_conf_item(yy_conf);
2082 <        yy_conf = NULL;
2083 <        yy_aconf = NULL;
2084 <      }
2085 <    }
2086 <    else
2087 <    {
2088 <      /* Even if yy_conf ->name is NULL
2089 <       * should still unhook any hub/leaf confs still pending
2090 <       */
2091 <      unhook_hub_leaf_confs();
2092 <
2093 <      if (yy_conf->name != NULL)
2094 <      {
2095 <        if (yy_aconf->host == NULL)
2096 <          yyerror("Ignoring connect block -- missing host");
2097 <        else if (!yy_aconf->passwd || !yy_aconf->spasswd)
2098 <          yyerror("Ignoring connect block -- missing password");
2099 <      }
2100 <
2164 >  struct MaskItem *conf = NULL;
2165 >  struct addrinfo hints, *res;
2166  
2167 <      /* XXX
2168 <       * This fixes a try_connections() core (caused by invalid class_ptr
2104 <       * pointers) reported by metalrock. That's an ugly fix, but there
2105 <       * is currently no better way. The entire config subsystem needs an
2106 <       * rewrite ASAP. make_conf_item() shouldn't really add things onto
2107 <       * a doubly linked list immediately without any sanity checks!  -Michael
2108 <       */
2109 <      delete_conf_item(yy_conf);
2167 >  if (conf_parser_ctx.pass != 2)
2168 >    break;
2169  
2170 <      yy_aconf = NULL;
2171 <      yy_conf = NULL;
2172 <    }
2173 <
2174 <      /*
2175 <       * yy_conf is still pointing at the server that is having
2176 <       * a connect block built for it. This means, y_aconf->name
2177 <       * points to the actual irc name this server will be known as.
2178 <       * Now this new server has a set or even just one hub_mask (or leaf_mask)
2179 <       * given in the link list at yy_hconf. Fill in the HUB confs
2180 <       * from this link list now.
2181 <       */        
2182 <      DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
2183 <      {
2184 <        struct ConfItem *new_hub_conf;
2185 <        struct MatchItem *match_item;
2170 >  if (!block_state.name.buf[0] ||
2171 >      !block_state.host.buf[0])
2172 >    break;
2173 >
2174 >  if (!block_state.rpass.buf[0] ||
2175 >      !block_state.spass.buf[0])
2176 >    break;
2177 >
2178 >  if (has_wildcards(block_state.name.buf) ||
2179 >      has_wildcards(block_state.host.buf))
2180 >    break;
2181 >
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 >  if (block_state.cert.buf[0])
2192 >    conf->certfp = xstrdup(block_state.cert.buf);
2193  
2194 <        yy_hconf = ptr->data;
2194 >  if (block_state.ciph.buf[0])
2195 >    conf->cipher_list = xstrdup(block_state.ciph.buf);
2196  
2197 <        /* yy_conf == NULL is a fatal error for this connect block! */
2198 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2132 <        {
2133 <          new_hub_conf = make_conf_item(HUB_TYPE);
2134 <          match_item = (struct MatchItem *)map_to_conf(new_hub_conf);
2135 <          DupString(new_hub_conf->name, yy_conf->name);
2136 <          if (yy_hconf->user != NULL)
2137 <            DupString(match_item->user, yy_hconf->user);
2138 <          else
2139 <            DupString(match_item->user, "*");
2140 <          if (yy_hconf->host != NULL)
2141 <            DupString(match_item->host, yy_hconf->host);
2142 <          else
2143 <            DupString(match_item->host, "*");
2144 <        }
2145 <        dlinkDelete(&yy_hconf->node, &hub_conf_list);
2146 <        free_collect_item(yy_hconf);
2147 <      }
2197 >  dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2198 >  dlinkMoveList(&block_state.hub.list, &conf->hub_list);
2199  
2200 <      /* Ditto for the LEAF confs */
2200 >  if (block_state.bind.buf[0])
2201 >  {
2202 >    memset(&hints, 0, sizeof(hints));
2203  
2204 <      DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
2205 <      {
2206 <        struct ConfItem *new_leaf_conf;
2154 <        struct MatchItem *match_item;
2204 >    hints.ai_family   = AF_UNSPEC;
2205 >    hints.ai_socktype = SOCK_STREAM;
2206 >    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2207  
2208 <        yy_lconf = ptr->data;
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 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2215 <        {
2216 <          new_leaf_conf = make_conf_item(LEAF_TYPE);
2217 <          match_item = (struct MatchItem *)map_to_conf(new_leaf_conf);
2218 <          DupString(new_leaf_conf->name, yy_conf->name);
2163 <          if (yy_lconf->user != NULL)
2164 <            DupString(match_item->user, yy_lconf->user);
2165 <          else
2166 <            DupString(match_item->user, "*");
2167 <          if (yy_lconf->host != NULL)
2168 <            DupString(match_item->host, yy_lconf->host);
2169 <          else
2170 <            DupString(match_item->host, "*");
2171 <        }
2172 <        dlinkDelete(&yy_lconf->node, &leaf_conf_list);
2173 <        free_collect_item(yy_lconf);
2174 <      }
2175 <      MyFree(class_name);
2176 <      class_name = NULL;
2177 <      yy_conf = NULL;
2178 <      yy_aconf = NULL;
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  
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 | connect_ssl_cipher_list |
2229 <                connect_flags | connect_hub_mask | connect_leaf_mask |
2230 <                connect_class | connect_encrypted |
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 <  {
2194 <    if (yy_conf->name != NULL)
2195 <      yyerror("Multiple connect name entry");
2196 <
2197 <    MyFree(yy_conf->name);
2198 <    DupString(yy_conf->name, yylval.string);
2199 <  }
2245 >    strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2246   };
2247  
2248 < connect_host: HOST '=' QSTRING ';'
2248 > connect_host: HOST '=' QSTRING ';'
2249   {
2250    if (conf_parser_ctx.pass == 2)
2251 <  {
2206 <    MyFree(yy_aconf->host);
2207 <    DupString(yy_aconf->host, yylval.string);
2208 <  }
2251 >    strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2252   };
2253  
2254 < connect_vhost: VHOST '=' QSTRING ';'
2254 > connect_vhost: VHOST '=' QSTRING ';'
2255   {
2256    if (conf_parser_ctx.pass == 2)
2257 <  {
2215 <    struct addrinfo hints, *res;
2216 <
2217 <    memset(&hints, 0, sizeof(hints));
2218 <
2219 <    hints.ai_family   = AF_UNSPEC;
2220 <    hints.ai_socktype = SOCK_STREAM;
2221 <    hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2222 <
2223 <    if (getaddrinfo(yylval.string, NULL, &hints, &res))
2224 <      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2225 <    else
2226 <    {
2227 <      assert(res != NULL);
2228 <
2229 <      memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen);
2230 <      yy_aconf->my_ipnum.ss.ss_family = res->ai_family;
2231 <      yy_aconf->my_ipnum.ss_len = res->ai_addrlen;
2232 <      freeaddrinfo(res);
2233 <    }
2234 <  }
2257 >    strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2258   };
2259 <
2259 >
2260   connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2261   {
2262 <  if (conf_parser_ctx.pass == 2)
2263 <  {
2241 <    if ($3[0] == ':')
2242 <      yyerror("Server passwords cannot begin with a colon");
2243 <    else if (strchr($3, ' ') != NULL)
2244 <      yyerror("Server passwords cannot contain spaces");
2245 <    else {
2246 <      if (yy_aconf->spasswd != NULL)
2247 <        memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2262 >  if (conf_parser_ctx.pass != 2)
2263 >    break;
2264  
2265 <      MyFree(yy_aconf->spasswd);
2266 <      DupString(yy_aconf->spasswd, yylval.string);
2267 <    }
2268 <  }
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_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2274   {
2275 <  if (conf_parser_ctx.pass == 2)
2276 <  {
2259 <    if ($3[0] == ':')
2260 <      yyerror("Server passwords cannot begin with a colon");
2261 <    else if (strchr($3, ' ') != NULL)
2262 <      yyerror("Server passwords cannot contain spaces");
2263 <    else {
2264 <      if (yy_aconf->passwd != NULL)
2265 <        memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2275 >  if (conf_parser_ctx.pass != 2)
2276 >    break;
2277  
2278 <      MyFree(yy_aconf->passwd);
2279 <      DupString(yy_aconf->passwd, 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_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2287 > {
2288 >  if (conf_parser_ctx.pass == 2)
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   {
2285 #ifdef IPV6
2304    if (conf_parser_ctx.pass == 2)
2305 <    yy_aconf->aftype = AF_INET6;
2288 < #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: AUTOCONN
2315   {
2316    if (conf_parser_ctx.pass == 2)
2317 <    SetConfAllowAutoConn(yy_aconf);
2300 < } | BURST_AWAY
2301 < {
2302 <  if (conf_parser_ctx.pass == 2)
2303 <    SetConfAwayBurst(yy_aconf);
2304 < } | TOPICBURST
2305 < {
2306 <  if (conf_parser_ctx.pass == 2)
2307 <    SetConfTopicBurst(yy_aconf);
2317 >    block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN;
2318   } | T_SSL
2319   {
2320    if (conf_parser_ctx.pass == 2)
2321 <    SetConfSSL(yy_aconf);
2321 >    block_state.flags.value |= CONF_FLAGS_SSL;
2322   };
2323  
2324   connect_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 2316 | 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 <  {
2329 <    struct CollectItem *yy_tmp;
2330 <
2331 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2332 <    DupString(yy_tmp->host, yylval.string);
2333 <    DupString(yy_tmp->user, "*");
2334 <    dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list);
2335 <  }
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 <  {
2342 <    struct CollectItem *yy_tmp;
2343 <
2344 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2345 <    DupString(yy_tmp->host, yylval.string);
2346 <    DupString(yy_tmp->user, "*");
2347 <    dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list);
2348 <  }
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 <  {
2355 <    MyFree(class_name);
2356 <    DupString(class_name, yylval.string);
2357 <  }
2350 >    strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
2351   };
2352  
2353   connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2354   {
2355   #ifdef HAVE_LIBCRYPTO
2356    if (conf_parser_ctx.pass == 2)
2357 <  {
2365 <    MyFree(yy_aconf->cipher_list);
2366 <    DupString(yy_aconf->cipher_list, yylval.string);
2367 <  }
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 connect::ciphers -- no OpenSSL support");
2360 >    conf_error_report("Ignoring connect::ciphers -- no OpenSSL support");
2361   #endif
2362   };
2363  
# Line 2378 | Line 2368 | connect_ssl_cipher_list: T_SSL_CIPHER_LI
2368   kill_entry: KILL
2369   {
2370    if (conf_parser_ctx.pass == 2)
2371 <  {
2382 <    userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2383 <    regex_ban = 0;
2384 <  }
2371 >    reset_block_state();
2372   } '{' kill_items '}' ';'
2373   {
2374 <  if (conf_parser_ctx.pass == 2)
2388 <  {
2389 <    if (userbuf[0] && hostbuf[0])
2390 <    {
2391 <      if (regex_ban)
2392 <      {
2393 < #ifdef HAVE_LIBPCRE
2394 <        void *exp_user = NULL;
2395 <        void *exp_host = NULL;
2396 <        const char *errptr = NULL;
2397 <
2398 <        if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2399 <            !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2400 <        {
2401 <          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2402 <               errptr);
2403 <          break;
2404 <        }
2405 <
2406 <        yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE));
2407 <        yy_aconf->regexuser = exp_user;
2408 <        yy_aconf->regexhost = exp_host;
2409 <
2410 <        DupString(yy_aconf->user, userbuf);
2411 <        DupString(yy_aconf->host, hostbuf);
2412 <
2413 <        if (reasonbuf[0])
2414 <          DupString(yy_aconf->reason, reasonbuf);
2415 <        else
2416 <          DupString(yy_aconf->reason, "No reason");
2417 < #else
2418 <        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2419 <        break;
2420 < #endif
2421 <      }
2422 <      else
2423 <      {
2424 <        yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2374 >  struct MaskItem *conf = NULL;
2375  
2376 <        DupString(yy_aconf->user, userbuf);
2377 <        DupString(yy_aconf->host, hostbuf);
2376 >  if (conf_parser_ctx.pass != 2)
2377 >    break;
2378  
2379 <        if (reasonbuf[0])
2380 <          DupString(yy_aconf->reason, reasonbuf);
2381 <        else
2432 <          DupString(yy_aconf->reason, "No reason");
2433 <        add_conf_by_address(CONF_KILL, yy_aconf);
2434 <      }
2435 <    }
2436 <
2437 <    yy_aconf = NULL;
2438 <  }
2439 < };
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 <    {
2493 <      yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2494 <      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);
2501 <      yy_aconf = NULL;
2502 <    }
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 2509 | 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 2532 | 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);
2539 <      yy_aconf = NULL;
2485 >      add_conf_by_address(CONF_EXEMPT, conf);
2486      }
2487    }
2488   };
# Line 2547 | Line 2493 | exempt_ip: IP '=' QSTRING ';'
2493   gecos_entry: GECOS
2494   {
2495    if (conf_parser_ctx.pass == 2)
2496 <  {
2551 <    regex_ban = 0;
2552 <    reasonbuf[0] = gecos_name[0] = '\0';
2553 <  }
2496 >    reset_block_state();
2497   } '{' gecos_items '}' ';'
2498   {
2499 <  if (conf_parser_ctx.pass == 2)
2557 <  {
2558 <    if (gecos_name[0])
2559 <    {
2560 <      if (regex_ban)
2561 <      {
2562 < #ifdef HAVE_LIBPCRE
2563 <        void *exp_p = NULL;
2564 <        const char *errptr = NULL;
2565 <
2566 <        if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2567 <        {
2568 <          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2569 <               errptr);
2570 <          break;
2571 <        }
2572 <
2573 <        yy_conf = make_conf_item(RXLINE_TYPE);
2574 <        yy_conf->regexpname = exp_p;
2575 < #else
2576 <        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2577 <        break;
2578 < #endif
2579 <      }
2580 <      else
2581 <        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);
2588 <      else
2589 <        DupString(yy_match_item->reason, "No reason");
2590 <    }
2591 <  }
2592 < };
2504 >  if (!block_state.name.buf[0])
2505 >    break;
2506  
2507 < gecos_flags: TYPE
2508 < {
2596 < } '='  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)
2602 <    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 2624 | 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_disable_remote_commands |
2558 <                    general_client_flood |
2559 <                    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 2757 | 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)
2768 <  {
2769 <    MyFree(ConfigFileEntry.kline_reason);
2770 <    DupString(ConfigFileEntry.kline_reason, yylval.string);
2771 <  }
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;
2838 < };
2839 <  
2840 < general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2841 < {
2842 <  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;
2853 < };
2854 <
2855 < general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
2856 < {
2857 <  if (conf_parser_ctx.pass == 2)
2858 <  {
2859 <    if (strlen(yylval.string) > LOCALE_LENGTH-2)
2860 <      yylval.string[LOCALE_LENGTH-1] = '\0';
2861 <
2862 <    set_locale(yylval.string);
2863 <  }
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;
2874 < };
2875 <
2876 < general_use_egd: USE_EGD '=' TBOOL ';'
2877 < {
2878 <  ConfigFileEntry.use_egd = yylval.number;
2879 < };
2880 <
2881 < general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2882 < {
2883 <  if (conf_parser_ctx.pass == 2)
2884 <  {
2885 <    MyFree(ConfigFileEntry.egdpool_path);
2886 <    DupString(ConfigFileEntry.egdpool_path, yylval.string);
2887 <  }
2798 >  ConfigGeneral.max_targets = $3;
2799   };
2800  
2801 < general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2801 > general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2802   {
2803 <  if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2893 <  {
2894 <    MyFree(ConfigFileEntry.service_name);
2895 <    DupString(ConfigFileEntry.service_name, yylval.string);
2896 <  }
2803 >  ConfigGeneral.ping_cookie = yylval.number;
2804   };
2805  
2806 < general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2806 > general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2807   {
2808 <  ConfigFileEntry.ping_cookie = yylval.number;
2808 >  ConfigGeneral.disable_auth = yylval.number;
2809   };
2810  
2811 < general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2811 > general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2812   {
2813 <  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;
2926 < } | T_CCONN_FULL
2927 < {
2928 <  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 <  ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
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;
2959 < } | T_OPERWALL
2960 < {
2961 <  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;
2994 < } | T_CCONN_FULL
2995 < {
2996 <  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 <  ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
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;
3027 < } | T_OPERWALL
3028 < {
3029 <  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;
3063 < };
3064 <
3065 < general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
3066 < {
3067 <  ConfigFileEntry.client_flood = $3;
3068 < };
3069 <
3070 <
3071 < /***************************************************************************
3072 < *  section glines
3073 < ***************************************************************************/
3074 < gline_entry: GLINES
3075 < {
3076 <  if (conf_parser_ctx.pass == 2)
3077 <  {
3078 <    yy_conf = make_conf_item(GDENY_TYPE);
3079 <    yy_aconf = map_to_conf(yy_conf);
3080 <  }
3081 < } '{' gline_items '}' ';'
3082 < {
3083 <  if (conf_parser_ctx.pass == 2)
3084 <  {
3085 <    /*
3086 <     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3087 <     * end we will have one extra, so we should free it.
3088 <     */
3089 <    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3090 <    {
3091 <      delete_conf_item(yy_conf);
3092 <      yy_conf = NULL;
3093 <      yy_aconf = NULL;
3094 <    }
3095 <  }
3096 < };
3097 <
3098 < gline_items:        gline_items gline_item | gline_item;
3099 < gline_item:         gline_enable |
3100 <                    gline_duration |
3101 <                    gline_logging |
3102 <                    gline_user |
3103 <                    gline_server |
3104 <                    gline_action |
3105 <                    error;
3106 <
3107 < gline_enable: ENABLE '=' TBOOL ';'
3108 < {
3109 <  if (conf_parser_ctx.pass == 2)
3110 <    ConfigFileEntry.glines = yylval.number;
3111 < };
3112 <
3113 < gline_duration: DURATION '=' timespec ';'
3114 < {
3115 <  if (conf_parser_ctx.pass == 2)
3116 <    ConfigFileEntry.gline_time = $3;
3117 < };
3118 <
3119 < gline_logging: T_LOG
3120 < {
3121 <  if (conf_parser_ctx.pass == 2)
3122 <    ConfigFileEntry.gline_logging = 0;
3123 < } '=' gline_logging_types ';';
3124 < gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3125 < gline_logging_type_item: T_REJECT
3126 < {
3127 <  if (conf_parser_ctx.pass == 2)
3128 <    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3129 < } | T_BLOCK
3130 < {
3131 <  if (conf_parser_ctx.pass == 2)
3132 <    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3133 < };
3134 <
3135 < gline_user: USER '=' QSTRING ';'
3136 < {
3137 <  if (conf_parser_ctx.pass == 2)
3138 <  {
3139 <    struct split_nuh_item nuh;
3140 <
3141 <    nuh.nuhmask  = yylval.string;
3142 <    nuh.nickptr  = NULL;
3143 <    nuh.userptr  = userbuf;
3144 <    nuh.hostptr  = hostbuf;
3145 <
3146 <    nuh.nicksize = 0;
3147 <    nuh.usersize = sizeof(userbuf);
3148 <    nuh.hostsize = sizeof(hostbuf);
3149 <
3150 <    split_nuh(&nuh);
3151 <
3152 <    if (yy_aconf->user == NULL)
3153 <    {
3154 <      DupString(yy_aconf->user, userbuf);
3155 <      DupString(yy_aconf->host, hostbuf);
3156 <    }
3157 <    else
3158 <    {
3159 <      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3160 <
3161 <      DupString(yy_tmp->user, userbuf);
3162 <      DupString(yy_tmp->host, hostbuf);
3163 <
3164 <      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3165 <    }
3166 <  }
3167 < };
3168 <
3169 < gline_server: NAME '=' QSTRING ';'
3170 < {
3171 <  if (conf_parser_ctx.pass == 2)  
3172 <  {
3173 <    MyFree(yy_conf->name);
3174 <    DupString(yy_conf->name, yylval.string);
3175 <  }
3176 < };
3177 <
3178 < gline_action: ACTION
3179 < {
3180 <  if (conf_parser_ctx.pass == 2)
3181 <    yy_aconf->flags = 0;
3182 < } '=' gdeny_types ';'
3183 < {
3184 <  if (conf_parser_ctx.pass == 2)
3185 <  {
3186 <    struct CollectItem *yy_tmp = NULL;
3187 <    dlink_node *ptr, *next_ptr;
3188 <
3189 <    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3190 <    {
3191 <      struct AccessItem *new_aconf;
3192 <      struct ConfItem *new_conf;
3193 <
3194 <      yy_tmp = ptr->data;
3195 <      new_conf = make_conf_item(GDENY_TYPE);
3196 <      new_aconf = map_to_conf(new_conf);
3197 <
3198 <      new_aconf->flags = yy_aconf->flags;
3199 <
3200 <      if (yy_conf->name != NULL)
3201 <        DupString(new_conf->name, yy_conf->name);
3202 <      else
3203 <        DupString(new_conf->name, "*");
3204 <      if (yy_aconf->user != NULL)
3205 <         DupString(new_aconf->user, yy_tmp->user);
3206 <      else  
3207 <        DupString(new_aconf->user, "*");
3208 <      if (yy_aconf->host != NULL)
3209 <        DupString(new_aconf->host, yy_tmp->host);
3210 <      else
3211 <        DupString(new_aconf->host, "*");
3212 <
3213 <      dlinkDelete(&yy_tmp->node, &col_conf_list);
3214 <    }
3215 <
3216 <    /*
3217 <     * In case someone has fed us with more than one action= after user/name
3218 <     * which would leak memory  -Michael
3219 <     */
3220 <    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3221 <      delete_conf_item(yy_conf);
3222 <
3223 <    yy_conf = make_conf_item(GDENY_TYPE);
3224 <    yy_aconf = map_to_conf(yy_conf);
3225 <  }
2975 >  ConfigGeneral.default_floodcount = $3;
2976   };
2977  
3228 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3229 gdeny_type_item: T_REJECT
3230 {
3231  if (conf_parser_ctx.pass == 2)
3232    yy_aconf->flags |= GDENY_REJECT;
3233 } | T_BLOCK
3234 {
3235  if (conf_parser_ctx.pass == 2)
3236    yy_aconf->flags |= GDENY_BLOCK;
3237 };
2978  
2979   /***************************************************************************
2980   *  section channel
# Line 3243 | 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 ';'
3263 < {
3264 <  ConfigChannel.restrict_channels = yylval.number;
3265 < };
3266 <
3267 < channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
3007 > channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
3008   {
3009 <  ConfigChannel.disable_local_channels = yylval.number;
3009 >  ConfigChannel.invite_client_count = $3;
3010   };
3011  
3012 < channel_use_except: USE_EXCEPT '=' TBOOL ';'
3012 > channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
3013   {
3014 <  ConfigChannel.use_except = yylval.number;
3014 >  ConfigChannel.invite_client_time = $3;
3015   };
3016  
3017 < channel_use_invex: USE_INVEX '=' TBOOL ';'
3017 > channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
3018   {
3019 <  ConfigChannel.use_invex = yylval.number;
3019 >  ConfigChannel.knock_client_count = $3;
3020   };
3021  
3022 < channel_use_knock: USE_KNOCK '=' TBOOL ';'
3022 > channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
3023   {
3024 <  ConfigChannel.use_knock = yylval.number;
3285 < };
3286 <
3287 < channel_knock_delay: KNOCK_DELAY '=' timespec ';'
3288 < {
3289 <  ConfigChannel.knock_delay = $3;
3024 >  ConfigChannel.knock_client_time = $3;
3025   };
3026  
3027   channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
# Line 3294 | 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 ';'
3032 > channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
3033   {
3034 <  ConfigChannel.max_chans_per_user = $3;
3300 < };
3301 <
3302 < channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
3303 < {
3304 <  ConfigChannel.quiet_on_ban = yylval.number;
3034 >  ConfigChannel.max_channels = $3;
3035   };
3036  
3037   channel_max_bans: MAX_BANS '=' NUMBER ';'
# Line 3329 | Line 3059 | channel_no_join_on_split: NO_JOIN_ON_SPL
3059    ConfigChannel.no_join_on_split = yylval.number;
3060   };
3061  
3332 channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
3333 {
3334  ConfigChannel.burst_topicwho = yylval.number;
3335 };
3336
3062   channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3063   {
3064    GlobalSetOptions.joinfloodcount = yylval.number;
# Line 3341 | 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 3351 | 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 3364 | 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 3385 | 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 3399 | Line 3140 | serverhide_hidden: HIDDEN '=' TBOOL ';'
3140      ConfigServerHide.hidden = yylval.number;
3141   };
3142  
3402 serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3403 {
3404  if (conf_parser_ctx.pass == 2)
3405    ConfigServerHide.disable_hidden = yylval.number;
3406 };
3407
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)