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 7766 by michael, Fri Oct 7 16:27:37 2016 UTC

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

Comparing:
ircd-hybrid-8/src/conf_parser.y (property svn:keywords), Revision 1352 by michael, Fri Apr 13 09:57:08 2012 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (property svn:keywords), Revision 7766 by michael, Fri Oct 7 16:27:37 2016 UTC

# Line 1 | Line 1
1 < Id Revision
1 > Id

Diff Legend

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