ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 4094
Committed: Sun Jun 29 11:48:50 2014 UTC (11 years, 1 month ago) by michael
File size: 78630 byte(s)
Log Message:
- Merged Adam's event system rewrite

File Contents

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

Properties

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