ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 2150
Committed: Fri May 31 18:39:43 2013 UTC (13 years, 4 months ago) by michael
File size: 73946 byte(s)
Log Message:
- Implement motd{} configuration blocks based on ircu's implementation

File Contents

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

Properties

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