ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 4162
Committed: Thu Jul 3 19:39:31 2014 UTC (12 years, 3 months ago) by michael
File size: 77923 byte(s)
Log Message:
- Removed ssl_server_method and ssl_client_method configuration options.
  ircd now only allows TLSv1, TLSv1.1 and TLSv1.2 protocols depending
  on the OpenSSL version.

File Contents

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

Properties

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