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-7.3/src/ircd_parser.y (file contents), Revision 1123 by michael, Sun Feb 6 21:57:50 2011 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (file contents), Revision 6367 by michael, Wed Aug 19 10:25:00 2015 UTC

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

Diff Legend

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