ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 7121
Committed: Sun Jan 24 20:22:55 2016 UTC (10 years, 8 months ago) by michael
File size: 74279 byte(s)
Log Message:
- conf_parser.y: removed some cruft

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

Properties

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