ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 7159
Committed: Thu Jan 28 11:26:51 2016 UTC (10 years, 8 months ago) by michael
File size: 74144 byte(s)
Log Message:
- Fixed bug where shared & cluster confs would not get removed from their associated list and memory free'd
  (SHARED_ALL sets all bits and therefore IsConfDatabase(x) == true

File Contents

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

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision