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

Diff Legend

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