ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 5933
Committed: Wed May 6 18:30:17 2015 UTC (11 years, 5 months ago) by michael
File size: 78770 byte(s)
Log Message:
- Removed the 'havent_read_conf' configuration directive as it only caused a whole lot more trouble than
  it actually helped

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

Properties

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