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

Diff Legend

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