ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 4254
Committed: Fri Jul 18 19:07:27 2014 UTC (11 years, 1 month ago) by michael
File size: 77716 byte(s)
Log Message:
- Cleaned up and sanitized /challenge related code
- rsa.c:get_randomness(): removed EGD support; also don't fall back to RAND_pseudo_bytes()
  if RAND_bytes() fails. If RAND_bytes() fails, just reject the /challenge request.

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 4254 conf_error_report("Ignoring rsa_public_key_file -- key invalid; check key syntax.");
1091 adx 30
1092 michael 4254 if (RSA_size(ServerInfo.rsa_private_key) > 128)
1093     conf_error_report("Ignoring rsa_public_key_file -- key size must be 1024 or below");
1094     else
1095     conf->rsa_public_key = pkey;
1096    
1097 michael 1646 BIO_set_close(file, BIO_CLOSE);
1098     BIO_free(file);
1099 adx 30 }
1100 michael 1646 #endif /* HAVE_LIBCRYPTO */
1101 adx 30 }
1102 michael 1646 };
1103 adx 30
1104     oper_items: oper_items oper_item | oper_item;
1105 michael 3439 oper_item: oper_name |
1106     oper_user |
1107     oper_password |
1108     oper_umodes |
1109     oper_class |
1110     oper_encrypted |
1111     oper_rsa_public_key_file |
1112     oper_ssl_certificate_fingerprint |
1113     oper_ssl_connection_required |
1114     oper_flags |
1115     error ';' ;
1116 adx 30
1117     oper_name: NAME '=' QSTRING ';'
1118     {
1119 michael 967 if (conf_parser_ctx.pass == 2)
1120 michael 1646 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1121 adx 30 };
1122    
1123     oper_user: USER '=' QSTRING ';'
1124     {
1125 michael 967 if (conf_parser_ctx.pass == 2)
1126 michael 1646 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1127 adx 30 };
1128    
1129     oper_password: PASSWORD '=' QSTRING ';'
1130     {
1131 michael 967 if (conf_parser_ctx.pass == 2)
1132 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1133 adx 30 };
1134    
1135     oper_encrypted: ENCRYPTED '=' TBOOL ';'
1136     {
1137 michael 2129 if (conf_parser_ctx.pass != 2)
1138     break;
1139    
1140     if (yylval.number)
1141     block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1142     else
1143     block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1144 adx 30 };
1145    
1146     oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1147     {
1148 michael 967 if (conf_parser_ctx.pass == 2)
1149 michael 1646 strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1150 adx 30 };
1151    
1152 michael 2244 oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1153 michael 2228 {
1154     if (conf_parser_ctx.pass == 2)
1155 michael 2229 strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1156 michael 2228 };
1157    
1158 michael 2248 oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1159     {
1160     if (conf_parser_ctx.pass != 2)
1161     break;
1162    
1163     if (yylval.number)
1164     block_state.flags.value |= CONF_FLAGS_SSL;
1165     else
1166     block_state.flags.value &= ~CONF_FLAGS_SSL;
1167     };
1168    
1169 adx 30 oper_class: CLASS '=' QSTRING ';'
1170     {
1171 michael 967 if (conf_parser_ctx.pass == 2)
1172 michael 1646 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1173 adx 30 };
1174    
1175 michael 56 oper_umodes: T_UMODES
1176     {
1177 michael 967 if (conf_parser_ctx.pass == 2)
1178 michael 1646 block_state.modes.value = 0;
1179 michael 56 } '=' oper_umodes_items ';' ;
1180    
1181     oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1182     oper_umodes_item: T_BOTS
1183     {
1184 michael 967 if (conf_parser_ctx.pass == 2)
1185 michael 1646 block_state.modes.value |= UMODE_BOTS;
1186 michael 56 } | T_CCONN
1187     {
1188 michael 967 if (conf_parser_ctx.pass == 2)
1189 michael 1646 block_state.modes.value |= UMODE_CCONN;
1190 michael 56 } | T_DEAF
1191     {
1192 michael 967 if (conf_parser_ctx.pass == 2)
1193 michael 1646 block_state.modes.value |= UMODE_DEAF;
1194 michael 56 } | T_DEBUG
1195     {
1196 michael 967 if (conf_parser_ctx.pass == 2)
1197 michael 1646 block_state.modes.value |= UMODE_DEBUG;
1198 michael 56 } | T_FULL
1199     {
1200 michael 967 if (conf_parser_ctx.pass == 2)
1201 michael 1646 block_state.modes.value |= UMODE_FULL;
1202 michael 1294 } | HIDDEN
1203     {
1204     if (conf_parser_ctx.pass == 2)
1205 michael 1646 block_state.modes.value |= UMODE_HIDDEN;
1206 michael 3513 } | HIDE_CHANS
1207     {
1208     if (conf_parser_ctx.pass == 2)
1209     block_state.modes.value |= UMODE_HIDECHANS;
1210 michael 3506 } | HIDE_IDLE
1211     {
1212     if (conf_parser_ctx.pass == 2)
1213     block_state.modes.value |= UMODE_HIDEIDLE;
1214 michael 56 } | T_SKILL
1215     {
1216 michael 967 if (conf_parser_ctx.pass == 2)
1217 michael 1646 block_state.modes.value |= UMODE_SKILL;
1218 michael 56 } | T_NCHANGE
1219     {
1220 michael 967 if (conf_parser_ctx.pass == 2)
1221 michael 1646 block_state.modes.value |= UMODE_NCHANGE;
1222 michael 56 } | T_REJ
1223     {
1224 michael 967 if (conf_parser_ctx.pass == 2)
1225 michael 1646 block_state.modes.value |= UMODE_REJ;
1226 michael 56 } | T_UNAUTH
1227     {
1228 michael 967 if (conf_parser_ctx.pass == 2)
1229 michael 1646 block_state.modes.value |= UMODE_UNAUTH;
1230 michael 56 } | T_SPY
1231     {
1232 michael 967 if (conf_parser_ctx.pass == 2)
1233 michael 1646 block_state.modes.value |= UMODE_SPY;
1234 michael 56 } | T_EXTERNAL
1235     {
1236 michael 967 if (conf_parser_ctx.pass == 2)
1237 michael 1646 block_state.modes.value |= UMODE_EXTERNAL;
1238 michael 56 } | T_SERVNOTICE
1239     {
1240 michael 967 if (conf_parser_ctx.pass == 2)
1241 michael 1646 block_state.modes.value |= UMODE_SERVNOTICE;
1242 michael 56 } | T_INVISIBLE
1243     {
1244 michael 967 if (conf_parser_ctx.pass == 2)
1245 michael 1646 block_state.modes.value |= UMODE_INVISIBLE;
1246 michael 56 } | T_WALLOP
1247     {
1248 michael 967 if (conf_parser_ctx.pass == 2)
1249 michael 1646 block_state.modes.value |= UMODE_WALLOP;
1250 michael 56 } | T_SOFTCALLERID
1251     {
1252 michael 967 if (conf_parser_ctx.pass == 2)
1253 michael 1646 block_state.modes.value |= UMODE_SOFTCALLERID;
1254 michael 56 } | T_CALLERID
1255     {
1256 michael 967 if (conf_parser_ctx.pass == 2)
1257 michael 1646 block_state.modes.value |= UMODE_CALLERID;
1258 michael 56 } | T_LOCOPS
1259     {
1260 michael 967 if (conf_parser_ctx.pass == 2)
1261 michael 1646 block_state.modes.value |= UMODE_LOCOPS;
1262 michael 1855 } | T_NONONREG
1263     {
1264     if (conf_parser_ctx.pass == 2)
1265     block_state.modes.value |= UMODE_REGONLY;
1266 michael 1976 } | T_FARCONNECT
1267     {
1268     if (conf_parser_ctx.pass == 2)
1269     block_state.modes.value |= UMODE_FARCONNECT;
1270 michael 56 };
1271    
1272 adx 30 oper_flags: IRCD_FLAGS
1273     {
1274 michael 1228 if (conf_parser_ctx.pass == 2)
1275 michael 1646 block_state.port.value = 0;
1276 adx 30 } '=' oper_flags_items ';';
1277    
1278     oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1279 michael 2012 oper_flags_item: KILL ':' REMOTE
1280 adx 30 {
1281 michael 967 if (conf_parser_ctx.pass == 2)
1282 michael 2012 block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1283     } | KILL
1284 adx 30 {
1285 michael 967 if (conf_parser_ctx.pass == 2)
1286 michael 2012 block_state.port.value |= OPER_FLAG_KILL;
1287     } | CONNECT ':' REMOTE
1288     {
1289     if (conf_parser_ctx.pass == 2)
1290     block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1291     } | CONNECT
1292     {
1293     if (conf_parser_ctx.pass == 2)
1294     block_state.port.value |= OPER_FLAG_CONNECT;
1295     } | SQUIT ':' REMOTE
1296     {
1297     if (conf_parser_ctx.pass == 2)
1298     block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1299     } | SQUIT
1300     {
1301     if (conf_parser_ctx.pass == 2)
1302     block_state.port.value |= OPER_FLAG_SQUIT;
1303 adx 30 } | KLINE
1304     {
1305 michael 967 if (conf_parser_ctx.pass == 2)
1306 michael 4019 block_state.port.value |= OPER_FLAG_KLINE;
1307 adx 30 } | UNKLINE
1308     {
1309 michael 967 if (conf_parser_ctx.pass == 2)
1310 michael 1646 block_state.port.value |= OPER_FLAG_UNKLINE;
1311 michael 1301 } | T_DLINE
1312     {
1313     if (conf_parser_ctx.pass == 2)
1314 michael 1646 block_state.port.value |= OPER_FLAG_DLINE;
1315 michael 1301 } | T_UNDLINE
1316     {
1317     if (conf_parser_ctx.pass == 2)
1318 michael 1646 block_state.port.value |= OPER_FLAG_UNDLINE;
1319 adx 30 } | XLINE
1320     {
1321 michael 967 if (conf_parser_ctx.pass == 2)
1322 michael 2852 block_state.port.value |= OPER_FLAG_XLINE;
1323     } | T_UNXLINE
1324     {
1325     if (conf_parser_ctx.pass == 2)
1326     block_state.port.value |= OPER_FLAG_UNXLINE;
1327 adx 30 } | GLINE
1328     {
1329 michael 967 if (conf_parser_ctx.pass == 2)
1330 michael 1646 block_state.port.value |= OPER_FLAG_GLINE;
1331 adx 30 } | DIE
1332     {
1333 michael 967 if (conf_parser_ctx.pass == 2)
1334 michael 1646 block_state.port.value |= OPER_FLAG_DIE;
1335 michael 1228 } | T_RESTART
1336     {
1337     if (conf_parser_ctx.pass == 2)
1338 michael 1646 block_state.port.value |= OPER_FLAG_RESTART;
1339 adx 30 } | REHASH
1340     {
1341 michael 967 if (conf_parser_ctx.pass == 2)
1342 michael 1646 block_state.port.value |= OPER_FLAG_REHASH;
1343 adx 30 } | ADMIN
1344     {
1345 michael 967 if (conf_parser_ctx.pass == 2)
1346 michael 1646 block_state.port.value |= OPER_FLAG_ADMIN;
1347 michael 1216 } | T_GLOBOPS
1348     {
1349     if (conf_parser_ctx.pass == 2)
1350 michael 1646 block_state.port.value |= OPER_FLAG_GLOBOPS;
1351 michael 2038 } | T_WALLOPS
1352     {
1353     if (conf_parser_ctx.pass == 2)
1354     block_state.port.value |= OPER_FLAG_WALLOPS;
1355     } | T_LOCOPS
1356     {
1357     if (conf_parser_ctx.pass == 2)
1358     block_state.port.value |= OPER_FLAG_LOCOPS;
1359 adx 30 } | REMOTEBAN
1360     {
1361 michael 967 if (conf_parser_ctx.pass == 2)
1362 michael 1646 block_state.port.value |= OPER_FLAG_REMOTEBAN;
1363 michael 1460 } | T_SET
1364     {
1365     if (conf_parser_ctx.pass == 2)
1366 michael 1646 block_state.port.value |= OPER_FLAG_SET;
1367 michael 1228 } | MODULE
1368 adx 30 {
1369 michael 967 if (conf_parser_ctx.pass == 2)
1370 michael 1646 block_state.port.value |= OPER_FLAG_MODULE;
1371 adx 30 };
1372    
1373    
1374     /***************************************************************************
1375     * section class
1376     ***************************************************************************/
1377     class_entry: CLASS
1378     {
1379 michael 1651 if (conf_parser_ctx.pass != 1)
1380     break;
1381    
1382     reset_block_state();
1383    
1384     block_state.ping_freq.value = DEFAULT_PINGFREQUENCY;
1385     block_state.con_freq.value = DEFAULT_CONNECTFREQUENCY;
1386     block_state.max_total.value = MAXIMUM_LINKS_DEFAULT;
1387     block_state.max_sendq.value = DEFAULT_SENDQ;
1388     block_state.max_recvq.value = DEFAULT_RECVQ;
1389 michael 1285 } '{' class_items '}' ';'
1390 adx 30 {
1391 michael 1647 struct ClassItem *class = NULL;
1392 adx 30
1393 michael 1647 if (conf_parser_ctx.pass != 1)
1394     break;
1395 adx 30
1396 michael 1647 if (!block_state.class.buf[0])
1397     break;
1398 michael 671
1399 michael 1647 if (!(class = class_find(block_state.class.buf, 0)))
1400     class = class_make();
1401 michael 671
1402 michael 1647 class->active = 1;
1403     MyFree(class->name);
1404     class->name = xstrdup(block_state.class.buf);
1405     class->ping_freq = block_state.ping_freq.value;
1406     class->max_perip = block_state.max_perip.value;
1407     class->con_freq = block_state.con_freq.value;
1408     class->max_total = block_state.max_total.value;
1409     class->max_global = block_state.max_global.value;
1410     class->max_local = block_state.max_local.value;
1411     class->max_ident = block_state.max_ident.value;
1412     class->max_sendq = block_state.max_sendq.value;
1413     class->max_recvq = block_state.max_recvq.value;
1414 michael 3933 class->max_channels = block_state.max_channels.value;
1415 michael 671
1416 michael 1785 if (block_state.min_idle.value > block_state.max_idle.value)
1417     {
1418     block_state.min_idle.value = 0;
1419     block_state.max_idle.value = 0;
1420     block_state.flags.value &= ~CLASS_FLAGS_FAKE_IDLE;
1421     }
1422    
1423     class->flags = block_state.flags.value;
1424     class->min_idle = block_state.min_idle.value;
1425     class->max_idle = block_state.max_idle.value;
1426    
1427 michael 1647 if (class->number_per_cidr && block_state.number_per_cidr.value)
1428     if ((class->cidr_bitlen_ipv4 && block_state.cidr_bitlen_ipv4.value) ||
1429     (class->cidr_bitlen_ipv6 && block_state.cidr_bitlen_ipv6.value))
1430     if ((class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value) ||
1431     (class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value))
1432     rebuild_cidr_list(class);
1433 adx 30
1434 michael 1647 class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1435     class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1436     class->number_per_cidr = block_state.number_per_cidr.value;
1437 adx 30 };
1438    
1439     class_items: class_items class_item | class_item;
1440     class_item: class_name |
1441 michael 3439 class_cidr_bitlen_ipv4 |
1442     class_cidr_bitlen_ipv6 |
1443 adx 30 class_ping_time |
1444 michael 3439 class_number_per_cidr |
1445 adx 30 class_number_per_ip |
1446     class_connectfreq |
1447 michael 3933 class_max_channels |
1448 adx 30 class_max_number |
1449 michael 3439 class_max_global |
1450     class_max_local |
1451     class_max_ident |
1452 michael 1516 class_sendq | class_recvq |
1453 michael 1783 class_min_idle |
1454     class_max_idle |
1455     class_flags |
1456 michael 3439 error ';' ;
1457 adx 30
1458 michael 2916 class_name: NAME '=' QSTRING ';'
1459 adx 30 {
1460 michael 967 if (conf_parser_ctx.pass == 1)
1461 michael 1647 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1462 adx 30 };
1463    
1464     class_ping_time: PING_TIME '=' timespec ';'
1465     {
1466 michael 967 if (conf_parser_ctx.pass == 1)
1467 michael 1647 block_state.ping_freq.value = $3;
1468 adx 30 };
1469    
1470     class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1471     {
1472 michael 967 if (conf_parser_ctx.pass == 1)
1473 michael 1647 block_state.max_perip.value = $3;
1474 adx 30 };
1475    
1476     class_connectfreq: CONNECTFREQ '=' timespec ';'
1477     {
1478 michael 967 if (conf_parser_ctx.pass == 1)
1479 michael 1647 block_state.con_freq.value = $3;
1480 adx 30 };
1481    
1482 michael 3933 class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1483     {
1484     if (conf_parser_ctx.pass == 1)
1485     block_state.max_channels.value = $3;
1486     };
1487    
1488 adx 30 class_max_number: MAX_NUMBER '=' NUMBER ';'
1489     {
1490 michael 967 if (conf_parser_ctx.pass == 1)
1491 michael 1647 block_state.max_total.value = $3;
1492 adx 30 };
1493    
1494     class_max_global: MAX_GLOBAL '=' NUMBER ';'
1495     {
1496 michael 967 if (conf_parser_ctx.pass == 1)
1497 michael 1647 block_state.max_global.value = $3;
1498 adx 30 };
1499    
1500     class_max_local: MAX_LOCAL '=' NUMBER ';'
1501     {
1502 michael 967 if (conf_parser_ctx.pass == 1)
1503 michael 1647 block_state.max_local.value = $3;
1504 adx 30 };
1505    
1506     class_max_ident: MAX_IDENT '=' NUMBER ';'
1507     {
1508 michael 967 if (conf_parser_ctx.pass == 1)
1509 michael 1647 block_state.max_ident.value = $3;
1510 adx 30 };
1511    
1512     class_sendq: SENDQ '=' sizespec ';'
1513     {
1514 michael 967 if (conf_parser_ctx.pass == 1)
1515 michael 1647 block_state.max_sendq.value = $3;
1516 adx 30 };
1517    
1518 michael 1516 class_recvq: T_RECVQ '=' sizespec ';'
1519     {
1520     if (conf_parser_ctx.pass == 1)
1521     if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1522 michael 1647 block_state.max_recvq.value = $3;
1523 michael 1516 };
1524    
1525 adx 30 class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1526     {
1527 michael 967 if (conf_parser_ctx.pass == 1)
1528 michael 1647 block_state.cidr_bitlen_ipv4.value = $3 > 32 ? 32 : $3;
1529 adx 30 };
1530    
1531     class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1532     {
1533 michael 967 if (conf_parser_ctx.pass == 1)
1534 michael 1647 block_state.cidr_bitlen_ipv6.value = $3 > 128 ? 128 : $3;
1535 adx 30 };
1536    
1537     class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1538     {
1539 michael 967 if (conf_parser_ctx.pass == 1)
1540 michael 1647 block_state.number_per_cidr.value = $3;
1541 adx 30 };
1542    
1543 michael 1783 class_min_idle: MIN_IDLE '=' timespec ';'
1544     {
1545 michael 1785 if (conf_parser_ctx.pass != 1)
1546     break;
1547    
1548     block_state.min_idle.value = $3;
1549     block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1550 michael 1783 };
1551    
1552     class_max_idle: MAX_IDLE '=' timespec ';'
1553     {
1554 michael 1785 if (conf_parser_ctx.pass != 1)
1555     break;
1556    
1557     block_state.max_idle.value = $3;
1558     block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1559 michael 1783 };
1560    
1561     class_flags: IRCD_FLAGS
1562     {
1563     if (conf_parser_ctx.pass == 1)
1564 michael 1785 block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE;
1565 michael 1783 } '=' class_flags_items ';';
1566    
1567     class_flags_items: class_flags_items ',' class_flags_item | class_flags_item;
1568     class_flags_item: RANDOM_IDLE
1569     {
1570     if (conf_parser_ctx.pass == 1)
1571     block_state.flags.value |= CLASS_FLAGS_RANDOM_IDLE;
1572     } | HIDE_IDLE_FROM_OPERS
1573     {
1574     if (conf_parser_ctx.pass == 1)
1575     block_state.flags.value |= CLASS_FLAGS_HIDE_IDLE_FROM_OPERS;
1576     };
1577    
1578    
1579 adx 30 /***************************************************************************
1580     * section listen
1581     ***************************************************************************/
1582     listen_entry: LISTEN
1583     {
1584 michael 967 if (conf_parser_ctx.pass == 2)
1585 michael 1646 reset_block_state();
1586     } '{' listen_items '}' ';';
1587 adx 30
1588     listen_flags: IRCD_FLAGS
1589     {
1590 michael 1646 block_state.flags.value = 0;
1591 adx 30 } '=' listen_flags_items ';';
1592    
1593     listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1594     listen_flags_item: T_SSL
1595     {
1596 michael 967 if (conf_parser_ctx.pass == 2)
1597 michael 1646 block_state.flags.value |= LISTENER_SSL;
1598 adx 30 } | HIDDEN
1599     {
1600 michael 967 if (conf_parser_ctx.pass == 2)
1601 michael 1647 block_state.flags.value |= LISTENER_HIDDEN;
1602 michael 900 } | T_SERVER
1603     {
1604 michael 967 if (conf_parser_ctx.pass == 2)
1605 michael 1647 block_state.flags.value |= LISTENER_SERVER;
1606 adx 30 };
1607    
1608     listen_items: listen_items listen_item | listen_item;
1609 michael 440 listen_item: listen_port | listen_flags | listen_address | listen_host | error ';';
1610 adx 30
1611 michael 1648 listen_port: PORT '=' port_items { block_state.flags.value = 0; } ';';
1612 adx 30
1613     port_items: port_items ',' port_item | port_item;
1614    
1615     port_item: NUMBER
1616     {
1617 michael 967 if (conf_parser_ctx.pass == 2)
1618 adx 30 {
1619 michael 1646 if (block_state.flags.value & LISTENER_SSL)
1620 adx 30 #ifdef HAVE_LIBCRYPTO
1621 michael 967 if (!ServerInfo.server_ctx)
1622 adx 30 #endif
1623     {
1624 michael 1752 conf_error_report("SSL not available - port closed");
1625 michael 3439 break;
1626 adx 30 }
1627 michael 1646 add_listener($1, block_state.addr.buf, block_state.flags.value);
1628 adx 30 }
1629     } | NUMBER TWODOTS NUMBER
1630     {
1631 michael 967 if (conf_parser_ctx.pass == 2)
1632 adx 30 {
1633 michael 1646 if (block_state.flags.value & LISTENER_SSL)
1634 adx 30 #ifdef HAVE_LIBCRYPTO
1635 michael 967 if (!ServerInfo.server_ctx)
1636 adx 30 #endif
1637     {
1638 michael 1752 conf_error_report("SSL not available - port closed");
1639 michael 3439 break;
1640 adx 30 }
1641    
1642 michael 3439 for (int i = $1; i <= $3; ++i)
1643 michael 1646 add_listener(i, block_state.addr.buf, block_state.flags.value);
1644 adx 30 }
1645     };
1646    
1647     listen_address: IP '=' QSTRING ';'
1648     {
1649 michael 967 if (conf_parser_ctx.pass == 2)
1650 michael 1646 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1651 adx 30 };
1652    
1653     listen_host: HOST '=' QSTRING ';'
1654     {
1655 michael 967 if (conf_parser_ctx.pass == 2)
1656 michael 1646 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1657 adx 30 };
1658    
1659     /***************************************************************************
1660     * section auth
1661     ***************************************************************************/
1662     auth_entry: IRCD_AUTH
1663     {
1664 michael 967 if (conf_parser_ctx.pass == 2)
1665 michael 1646 reset_block_state();
1666 adx 30 } '{' auth_items '}' ';'
1667     {
1668 michael 1646 dlink_node *ptr = NULL;
1669 adx 30
1670 michael 1646 if (conf_parser_ctx.pass != 2)
1671     break;
1672 adx 30
1673 michael 1646 DLINK_FOREACH(ptr, block_state.mask.list.head)
1674     {
1675     struct MaskItem *conf = NULL;
1676     struct split_nuh_item nuh;
1677 adx 30
1678 michael 1646 nuh.nuhmask = ptr->data;
1679     nuh.nickptr = NULL;
1680 michael 1647 nuh.userptr = block_state.user.buf;
1681     nuh.hostptr = block_state.host.buf;
1682 michael 1646 nuh.nicksize = 0;
1683 michael 1647 nuh.usersize = sizeof(block_state.user.buf);
1684     nuh.hostsize = sizeof(block_state.host.buf);
1685 michael 1646 split_nuh(&nuh);
1686 adx 30
1687 michael 1646 conf = conf_make(CONF_CLIENT);
1688 michael 2106 conf->user = xstrdup(block_state.user.buf);
1689     conf->host = xstrdup(block_state.host.buf);
1690 adx 30
1691 michael 1647 if (block_state.rpass.buf[0])
1692     conf->passwd = xstrdup(block_state.rpass.buf);
1693 michael 1646 if (block_state.name.buf[0])
1694 michael 1911 conf->name = xstrdup(block_state.name.buf);
1695 adx 30
1696 michael 1646 conf->flags = block_state.flags.value;
1697     conf->port = block_state.port.value;
1698 adx 30
1699 michael 1646 conf_add_class_to_conf(conf, block_state.class.buf);
1700     add_conf_by_address(CONF_CLIENT, conf);
1701 adx 30 }
1702 michael 2916 };
1703 adx 30
1704     auth_items: auth_items auth_item | auth_item;
1705 michael 3439 auth_item: auth_user |
1706     auth_passwd |
1707     auth_class |
1708     auth_flags |
1709     auth_spoof |
1710 michael 3441 auth_redir_serv |
1711 michael 3439 auth_redir_port |
1712     auth_encrypted |
1713     error ';' ;
1714 adx 30
1715     auth_user: USER '=' QSTRING ';'
1716     {
1717 michael 967 if (conf_parser_ctx.pass == 2)
1718 michael 1646 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1719 adx 30 };
1720    
1721     auth_passwd: PASSWORD '=' QSTRING ';'
1722     {
1723 michael 967 if (conf_parser_ctx.pass == 2)
1724 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1725 adx 30 };
1726    
1727     auth_class: CLASS '=' QSTRING ';'
1728     {
1729 michael 967 if (conf_parser_ctx.pass == 2)
1730 michael 1646 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1731 adx 30 };
1732    
1733     auth_encrypted: ENCRYPTED '=' TBOOL ';'
1734     {
1735 michael 967 if (conf_parser_ctx.pass == 2)
1736 adx 30 {
1737     if (yylval.number)
1738 michael 1646 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1739 adx 30 else
1740 michael 1646 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1741 adx 30 }
1742     };
1743    
1744     auth_flags: IRCD_FLAGS
1745     {
1746 michael 1646 if (conf_parser_ctx.pass == 2)
1747 michael 2093 block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1748 adx 30 } '=' auth_flags_items ';';
1749    
1750     auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1751 michael 1228 auth_flags_item: SPOOF_NOTICE
1752 adx 30 {
1753 michael 967 if (conf_parser_ctx.pass == 2)
1754 michael 1646 block_state.flags.value |= CONF_FLAGS_SPOOF_NOTICE;
1755 adx 30 } | EXCEED_LIMIT
1756     {
1757 michael 967 if (conf_parser_ctx.pass == 2)
1758 michael 1646 block_state.flags.value |= CONF_FLAGS_NOLIMIT;
1759 adx 30 } | KLINE_EXEMPT
1760     {
1761 michael 967 if (conf_parser_ctx.pass == 2)
1762 michael 1646 block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1763 adx 30 } | NEED_IDENT
1764     {
1765 michael 967 if (conf_parser_ctx.pass == 2)
1766 michael 1646 block_state.flags.value |= CONF_FLAGS_NEED_IDENTD;
1767 adx 30 } | CAN_FLOOD
1768     {
1769 michael 967 if (conf_parser_ctx.pass == 2)
1770 michael 1646 block_state.flags.value |= CONF_FLAGS_CAN_FLOOD;
1771 adx 30 } | NO_TILDE
1772     {
1773 michael 967 if (conf_parser_ctx.pass == 2)
1774 michael 1646 block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1775 adx 30 } | GLINE_EXEMPT
1776     {
1777 michael 967 if (conf_parser_ctx.pass == 2)
1778 michael 1646 block_state.flags.value |= CONF_FLAGS_EXEMPTGLINE;
1779 adx 30 } | RESV_EXEMPT
1780     {
1781 michael 967 if (conf_parser_ctx.pass == 2)
1782 michael 1646 block_state.flags.value |= CONF_FLAGS_EXEMPTRESV;
1783 michael 1715 } | T_WEBIRC
1784     {
1785     if (conf_parser_ctx.pass == 2)
1786     block_state.flags.value |= CONF_FLAGS_WEBIRC;
1787 adx 30 } | NEED_PASSWORD
1788     {
1789 michael 967 if (conf_parser_ctx.pass == 2)
1790 michael 1646 block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1791 adx 30 };
1792    
1793 michael 2916 auth_spoof: SPOOF '=' QSTRING ';'
1794 adx 30 {
1795 michael 1646 if (conf_parser_ctx.pass != 2)
1796     break;
1797    
1798 michael 3441 if (valid_hostname(yylval.string))
1799 adx 30 {
1800 michael 1646 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1801     block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
1802 adx 30 }
1803 michael 1646 else
1804     ilog(LOG_TYPE_IRCD, "Spoof either is too long or contains invalid characters. Ignoring it.");
1805 adx 30 };
1806    
1807     auth_redir_serv: REDIRSERV '=' QSTRING ';'
1808     {
1809 michael 1646 if (conf_parser_ctx.pass != 2)
1810     break;
1811    
1812     strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1813     block_state.flags.value |= CONF_FLAGS_REDIR;
1814 adx 30 };
1815    
1816     auth_redir_port: REDIRPORT '=' NUMBER ';'
1817     {
1818 michael 1646 if (conf_parser_ctx.pass != 2)
1819     break;
1820 michael 1647
1821 michael 1646 block_state.flags.value |= CONF_FLAGS_REDIR;
1822     block_state.port.value = $3;
1823 adx 30 };
1824    
1825    
1826     /***************************************************************************
1827     * section resv
1828     ***************************************************************************/
1829     resv_entry: RESV
1830     {
1831 michael 1647 if (conf_parser_ctx.pass != 2)
1832     break;
1833 adx 30
1834 michael 1647 reset_block_state();
1835     strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1836 michael 1823 } '{' resv_items '}' ';'
1837     {
1838 michael 1858 if (conf_parser_ctx.pass != 2)
1839     break;
1840    
1841     create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1842 michael 1823 };
1843 michael 1647
1844 michael 3439 resv_items: resv_items resv_item | resv_item;
1845     resv_item: resv_mask | resv_reason | resv_exempt | error ';' ;
1846 adx 30
1847 michael 1858 resv_mask: MASK '=' QSTRING ';'
1848 adx 30 {
1849 michael 967 if (conf_parser_ctx.pass == 2)
1850 michael 1858 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1851 adx 30 };
1852    
1853 michael 1858 resv_reason: REASON '=' QSTRING ';'
1854 adx 30 {
1855 michael 1823 if (conf_parser_ctx.pass == 2)
1856 michael 1858 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1857 adx 30 };
1858    
1859 michael 1858 resv_exempt: EXEMPT '=' QSTRING ';'
1860 adx 30 {
1861 michael 967 if (conf_parser_ctx.pass == 2)
1862 michael 1858 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1863 adx 30 };
1864    
1865 michael 1858
1866 adx 30 /***************************************************************************
1867 michael 1157 * section service
1868     ***************************************************************************/
1869     service_entry: T_SERVICE '{' service_items '}' ';';
1870    
1871     service_items: service_items service_item | service_item;
1872     service_item: service_name | error;
1873    
1874     service_name: NAME '=' QSTRING ';'
1875     {
1876 michael 2129 if (conf_parser_ctx.pass != 2)
1877     break;
1878    
1879     if (valid_servname(yylval.string))
1880 michael 1157 {
1881 michael 2129 struct MaskItem *conf = conf_make(CONF_SERVICE);
1882     conf->name = xstrdup(yylval.string);
1883 michael 1157 }
1884     };
1885    
1886     /***************************************************************************
1887 adx 30 * section shared, for sharing remote klines etc.
1888     ***************************************************************************/
1889     shared_entry: T_SHARED
1890     {
1891 michael 1647 if (conf_parser_ctx.pass != 2)
1892     break;
1893    
1894     reset_block_state();
1895    
1896     strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1897     strlcpy(block_state.user.buf, "*", sizeof(block_state.user.buf));
1898     strlcpy(block_state.host.buf, "*", sizeof(block_state.host.buf));
1899     block_state.flags.value = SHARED_ALL;
1900 adx 30 } '{' shared_items '}' ';'
1901     {
1902 michael 1647 struct MaskItem *conf = NULL;
1903    
1904     if (conf_parser_ctx.pass != 2)
1905     break;
1906    
1907     conf = conf_make(CONF_ULINE);
1908     conf->flags = block_state.flags.value;
1909     conf->name = xstrdup(block_state.name.buf);
1910     conf->user = xstrdup(block_state.user.buf);
1911 michael 1911 conf->host = xstrdup(block_state.host.buf);
1912 adx 30 };
1913    
1914     shared_items: shared_items shared_item | shared_item;
1915     shared_item: shared_name | shared_user | shared_type | error ';' ;
1916    
1917     shared_name: NAME '=' QSTRING ';'
1918     {
1919 michael 967 if (conf_parser_ctx.pass == 2)
1920 michael 1647 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1921 adx 30 };
1922    
1923     shared_user: USER '=' QSTRING ';'
1924     {
1925 michael 967 if (conf_parser_ctx.pass == 2)
1926 adx 30 {
1927 michael 593 struct split_nuh_item nuh;
1928    
1929     nuh.nuhmask = yylval.string;
1930     nuh.nickptr = NULL;
1931 michael 1647 nuh.userptr = block_state.user.buf;
1932     nuh.hostptr = block_state.host.buf;
1933 michael 593
1934     nuh.nicksize = 0;
1935 michael 1647 nuh.usersize = sizeof(block_state.user.buf);
1936     nuh.hostsize = sizeof(block_state.host.buf);
1937 michael 593
1938     split_nuh(&nuh);
1939 adx 30 }
1940     };
1941    
1942     shared_type: TYPE
1943     {
1944 michael 967 if (conf_parser_ctx.pass == 2)
1945 michael 1647 block_state.flags.value = 0;
1946 adx 30 } '=' shared_types ';' ;
1947    
1948     shared_types: shared_types ',' shared_type_item | shared_type_item;
1949     shared_type_item: KLINE
1950     {
1951 michael 967 if (conf_parser_ctx.pass == 2)
1952 michael 1647 block_state.flags.value |= SHARED_KLINE;
1953 michael 1301 } | UNKLINE
1954 adx 30 {
1955 michael 967 if (conf_parser_ctx.pass == 2)
1956 michael 1647 block_state.flags.value |= SHARED_UNKLINE;
1957 michael 1301 } | T_DLINE
1958 adx 30 {
1959 michael 967 if (conf_parser_ctx.pass == 2)
1960 michael 1647 block_state.flags.value |= SHARED_DLINE;
1961 michael 1301 } | T_UNDLINE
1962     {
1963     if (conf_parser_ctx.pass == 2)
1964 michael 1647 block_state.flags.value |= SHARED_UNDLINE;
1965 adx 30 } | XLINE
1966     {
1967 michael 967 if (conf_parser_ctx.pass == 2)
1968 michael 1647 block_state.flags.value |= SHARED_XLINE;
1969 adx 30 } | T_UNXLINE
1970     {
1971 michael 967 if (conf_parser_ctx.pass == 2)
1972 michael 1647 block_state.flags.value |= SHARED_UNXLINE;
1973 adx 30 } | RESV
1974     {
1975 michael 967 if (conf_parser_ctx.pass == 2)
1976 michael 1647 block_state.flags.value |= SHARED_RESV;
1977 adx 30 } | T_UNRESV
1978     {
1979 michael 967 if (conf_parser_ctx.pass == 2)
1980 michael 1647 block_state.flags.value |= SHARED_UNRESV;
1981 adx 30 } | T_LOCOPS
1982     {
1983 michael 967 if (conf_parser_ctx.pass == 2)
1984 michael 1647 block_state.flags.value |= SHARED_LOCOPS;
1985 adx 30 } | T_ALL
1986     {
1987 michael 967 if (conf_parser_ctx.pass == 2)
1988 michael 1647 block_state.flags.value = SHARED_ALL;
1989 adx 30 };
1990    
1991     /***************************************************************************
1992     * section cluster
1993     ***************************************************************************/
1994     cluster_entry: T_CLUSTER
1995     {
1996 michael 1647 if (conf_parser_ctx.pass != 2)
1997     break;
1998    
1999     reset_block_state();
2000    
2001     strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
2002     block_state.flags.value = SHARED_ALL;
2003 adx 30 } '{' cluster_items '}' ';'
2004     {
2005 michael 1647 struct MaskItem *conf = NULL;
2006    
2007     if (conf_parser_ctx.pass != 2)
2008     break;
2009    
2010     conf = conf_make(CONF_CLUSTER);
2011     conf->flags = block_state.flags.value;
2012     conf->name = xstrdup(block_state.name.buf);
2013 adx 30 };
2014    
2015 michael 3439 cluster_items: cluster_items cluster_item | cluster_item;
2016     cluster_item: cluster_name | cluster_type | error ';' ;
2017 adx 30
2018     cluster_name: NAME '=' QSTRING ';'
2019     {
2020 michael 967 if (conf_parser_ctx.pass == 2)
2021 michael 1647 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2022 adx 30 };
2023    
2024     cluster_type: TYPE
2025     {
2026 michael 967 if (conf_parser_ctx.pass == 2)
2027 michael 1647 block_state.flags.value = 0;
2028 adx 30 } '=' cluster_types ';' ;
2029    
2030 michael 3439 cluster_types: cluster_types ',' cluster_type_item | cluster_type_item;
2031 adx 30 cluster_type_item: KLINE
2032     {
2033 michael 967 if (conf_parser_ctx.pass == 2)
2034 michael 1647 block_state.flags.value |= SHARED_KLINE;
2035 michael 1301 } | UNKLINE
2036 adx 30 {
2037 michael 967 if (conf_parser_ctx.pass == 2)
2038 michael 1647 block_state.flags.value |= SHARED_UNKLINE;
2039 michael 1301 } | T_DLINE
2040 adx 30 {
2041 michael 967 if (conf_parser_ctx.pass == 2)
2042 michael 1647 block_state.flags.value |= SHARED_DLINE;
2043 michael 1301 } | T_UNDLINE
2044     {
2045     if (conf_parser_ctx.pass == 2)
2046 michael 1647 block_state.flags.value |= SHARED_UNDLINE;
2047 adx 30 } | XLINE
2048     {
2049 michael 967 if (conf_parser_ctx.pass == 2)
2050 michael 1647 block_state.flags.value |= SHARED_XLINE;
2051 adx 30 } | T_UNXLINE
2052     {
2053 michael 967 if (conf_parser_ctx.pass == 2)
2054 michael 1647 block_state.flags.value |= SHARED_UNXLINE;
2055 adx 30 } | RESV
2056     {
2057 michael 967 if (conf_parser_ctx.pass == 2)
2058 michael 1647 block_state.flags.value |= SHARED_RESV;
2059 adx 30 } | T_UNRESV
2060     {
2061 michael 967 if (conf_parser_ctx.pass == 2)
2062 michael 1647 block_state.flags.value |= SHARED_UNRESV;
2063 adx 30 } | T_LOCOPS
2064     {
2065 michael 967 if (conf_parser_ctx.pass == 2)
2066 michael 1647 block_state.flags.value |= SHARED_LOCOPS;
2067 adx 30 } | T_ALL
2068     {
2069 michael 967 if (conf_parser_ctx.pass == 2)
2070 michael 1647 block_state.flags.value = SHARED_ALL;
2071 adx 30 };
2072    
2073     /***************************************************************************
2074     * section connect
2075     ***************************************************************************/
2076 michael 2916 connect_entry: CONNECT
2077 adx 30 {
2078 michael 1265
2079 michael 1647 if (conf_parser_ctx.pass != 2)
2080     break;
2081    
2082     reset_block_state();
2083 michael 2397 block_state.aftype.value = AF_INET;
2084 michael 1647 block_state.port.value = PORTNUM;
2085 michael 1285 } '{' connect_items '}' ';'
2086 adx 30 {
2087 michael 1647 struct MaskItem *conf = NULL;
2088     struct addrinfo hints, *res;
2089    
2090     if (conf_parser_ctx.pass != 2)
2091     break;
2092    
2093 michael 1648 if (!block_state.name.buf[0] ||
2094     !block_state.host.buf[0])
2095 michael 1647 break;
2096    
2097 michael 2126 if (!block_state.rpass.buf[0] ||
2098     !block_state.spass.buf[0])
2099 michael 1647 break;
2100    
2101     if (has_wildcards(block_state.name.buf) ||
2102     has_wildcards(block_state.host.buf))
2103     break;
2104    
2105     conf = conf_make(CONF_SERVER);
2106     conf->port = block_state.port.value;
2107     conf->flags = block_state.flags.value;
2108     conf->aftype = block_state.aftype.value;
2109     conf->host = xstrdup(block_state.host.buf);
2110     conf->name = xstrdup(block_state.name.buf);
2111     conf->passwd = xstrdup(block_state.rpass.buf);
2112     conf->spasswd = xstrdup(block_state.spass.buf);
2113 michael 2228
2114     if (block_state.cert.buf[0])
2115     conf->certfp = xstrdup(block_state.cert.buf);
2116    
2117 michael 2252 if (block_state.ciph.buf[0])
2118     conf->cipher_list = xstrdup(block_state.ciph.buf);
2119 michael 1647
2120     dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2121     dlinkMoveList(&block_state.hub.list, &conf->hub_list);
2122    
2123     if (block_state.bind.buf[0])
2124 adx 30 {
2125 michael 1647 memset(&hints, 0, sizeof(hints));
2126    
2127     hints.ai_family = AF_UNSPEC;
2128     hints.ai_socktype = SOCK_STREAM;
2129     hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2130    
2131     if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2132     ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2133 michael 1302 else
2134     {
2135 michael 3443 assert(res);
2136 adx 30
2137 michael 1647 memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2138     conf->bind.ss.ss_family = res->ai_family;
2139     conf->bind.ss_len = res->ai_addrlen;
2140     freeaddrinfo(res);
2141 michael 1302 }
2142 michael 1647 }
2143 adx 30
2144 michael 1647 conf_add_class_to_conf(conf, block_state.class.buf);
2145     lookup_confhost(conf);
2146 adx 30 };
2147    
2148     connect_items: connect_items connect_item | connect_item;
2149 michael 3439 connect_item: connect_name |
2150     connect_host |
2151     connect_vhost |
2152     connect_send_password |
2153     connect_accept_password |
2154     connect_ssl_certificate_fingerprint |
2155     connect_aftype |
2156     connect_port |
2157     connect_ssl_cipher_list |
2158     connect_flags |
2159     connect_hub_mask |
2160     connect_leaf_mask |
2161     connect_class |
2162     connect_encrypted |
2163 michael 1076 error ';' ;
2164 adx 30
2165     connect_name: NAME '=' QSTRING ';'
2166     {
2167 michael 967 if (conf_parser_ctx.pass == 2)
2168 michael 1647 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2169 adx 30 };
2170    
2171 michael 2916 connect_host: HOST '=' QSTRING ';'
2172 adx 30 {
2173 michael 967 if (conf_parser_ctx.pass == 2)
2174 michael 1647 strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2175 adx 30 };
2176    
2177 michael 2916 connect_vhost: VHOST '=' QSTRING ';'
2178 adx 30 {
2179 michael 967 if (conf_parser_ctx.pass == 2)
2180 michael 1647 strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2181 adx 30 };
2182 michael 2916
2183 adx 30 connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2184     {
2185 michael 1647 if (conf_parser_ctx.pass != 2)
2186     break;
2187 adx 30
2188 michael 1647 if ($3[0] == ':')
2189 michael 1752 conf_error_report("Server passwords cannot begin with a colon");
2190 michael 3443 else if (strchr($3, ' '))
2191 michael 1752 conf_error_report("Server passwords cannot contain spaces");
2192 michael 1647 else
2193     strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
2194 adx 30 };
2195    
2196     connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2197     {
2198 michael 1647 if (conf_parser_ctx.pass != 2)
2199     break;
2200 adx 30
2201 michael 1647 if ($3[0] == ':')
2202 michael 1752 conf_error_report("Server passwords cannot begin with a colon");
2203 michael 3443 else if (strchr($3, ' '))
2204 michael 1752 conf_error_report("Server passwords cannot contain spaces");
2205 michael 1647 else
2206     strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2207 adx 30 };
2208    
2209 michael 2244 connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2210 michael 2228 {
2211     if (conf_parser_ctx.pass == 2)
2212 michael 2229 strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2213 michael 2228 };
2214    
2215 adx 30 connect_port: PORT '=' NUMBER ';'
2216     {
2217 michael 967 if (conf_parser_ctx.pass == 2)
2218 michael 1647 block_state.port.value = $3;
2219 adx 30 };
2220    
2221     connect_aftype: AFTYPE '=' T_IPV4 ';'
2222     {
2223 michael 967 if (conf_parser_ctx.pass == 2)
2224 michael 1647 block_state.aftype.value = AF_INET;
2225 adx 30 } | AFTYPE '=' T_IPV6 ';'
2226     {
2227     #ifdef IPV6
2228 michael 967 if (conf_parser_ctx.pass == 2)
2229 michael 1647 block_state.aftype.value = AF_INET6;
2230 adx 30 #endif
2231     };
2232    
2233     connect_flags: IRCD_FLAGS
2234     {
2235 michael 1648 block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2236 adx 30 } '=' connect_flags_items ';';
2237    
2238     connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2239 michael 1302 connect_flags_item: AUTOCONN
2240 adx 30 {
2241 michael 967 if (conf_parser_ctx.pass == 2)
2242 michael 1647 block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN;
2243 michael 1303 } | T_SSL
2244     {
2245     if (conf_parser_ctx.pass == 2)
2246 michael 1647 block_state.flags.value |= CONF_FLAGS_SSL;
2247 michael 1228 };
2248 adx 30
2249     connect_encrypted: ENCRYPTED '=' TBOOL ';'
2250     {
2251 michael 967 if (conf_parser_ctx.pass == 2)
2252 adx 30 {
2253     if (yylval.number)
2254 michael 1647 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
2255 adx 30 else
2256 michael 1647 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
2257 adx 30 }
2258     };
2259    
2260 michael 2916 connect_hub_mask: HUB_MASK '=' QSTRING ';'
2261 adx 30 {
2262 michael 967 if (conf_parser_ctx.pass == 2)
2263 michael 1647 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2264 adx 30 };
2265    
2266 michael 2916 connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2267 adx 30 {
2268 michael 967 if (conf_parser_ctx.pass == 2)
2269 michael 1647 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
2270 adx 30 };
2271    
2272     connect_class: CLASS '=' QSTRING ';'
2273     {
2274 michael 967 if (conf_parser_ctx.pass == 2)
2275 michael 1647 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
2276 adx 30 };
2277    
2278 michael 1306 connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2279     {
2280     #ifdef HAVE_LIBCRYPTO
2281     if (conf_parser_ctx.pass == 2)
2282 michael 1647 strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2283 michael 1306 #else
2284     if (conf_parser_ctx.pass == 2)
2285 michael 1752 conf_error_report("Ignoring connect::ciphers -- no OpenSSL support");
2286 michael 1306 #endif
2287     };
2288    
2289    
2290 adx 30 /***************************************************************************
2291     * section kill
2292     ***************************************************************************/
2293     kill_entry: KILL
2294     {
2295 michael 967 if (conf_parser_ctx.pass == 2)
2296 michael 1647 reset_block_state();
2297 adx 30 } '{' kill_items '}' ';'
2298     {
2299 michael 1647 struct MaskItem *conf = NULL;
2300    
2301     if (conf_parser_ctx.pass != 2)
2302     break;
2303    
2304     if (!block_state.user.buf[0] ||
2305     !block_state.host.buf[0])
2306     break;
2307    
2308 michael 1921 conf = conf_make(CONF_KLINE);
2309     conf->user = xstrdup(block_state.user.buf);
2310     conf->host = xstrdup(block_state.host.buf);
2311 michael 1647
2312 michael 1921 if (block_state.rpass.buf[0])
2313     conf->reason = xstrdup(block_state.rpass.buf);
2314 michael 1647 else
2315 michael 1921 conf->reason = xstrdup(CONF_NOREASON);
2316     add_conf_by_address(CONF_KLINE, conf);
2317 michael 2916 };
2318 adx 30
2319     kill_items: kill_items kill_item | kill_item;
2320 michael 1921 kill_item: kill_user | kill_reason | error;
2321 adx 30
2322     kill_user: USER '=' QSTRING ';'
2323     {
2324 michael 1647
2325 michael 967 if (conf_parser_ctx.pass == 2)
2326 adx 30 {
2327 michael 593 struct split_nuh_item nuh;
2328 adx 30
2329 michael 593 nuh.nuhmask = yylval.string;
2330     nuh.nickptr = NULL;
2331 michael 1647 nuh.userptr = block_state.user.buf;
2332     nuh.hostptr = block_state.host.buf;
2333 adx 30
2334 michael 593 nuh.nicksize = 0;
2335 michael 1647 nuh.usersize = sizeof(block_state.user.buf);
2336     nuh.hostsize = sizeof(block_state.host.buf);
2337 adx 30
2338 michael 593 split_nuh(&nuh);
2339 adx 30 }
2340     };
2341    
2342 michael 2916 kill_reason: REASON '=' QSTRING ';'
2343 adx 30 {
2344 michael 967 if (conf_parser_ctx.pass == 2)
2345 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2346 adx 30 };
2347    
2348     /***************************************************************************
2349     * section deny
2350     ***************************************************************************/
2351 michael 2916 deny_entry: DENY
2352 adx 30 {
2353 michael 967 if (conf_parser_ctx.pass == 2)
2354 michael 1646 reset_block_state();
2355 adx 30 } '{' deny_items '}' ';'
2356     {
2357 michael 1646 struct MaskItem *conf = NULL;
2358    
2359     if (conf_parser_ctx.pass != 2)
2360     break;
2361    
2362     if (!block_state.addr.buf[0])
2363     break;
2364    
2365     if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2366 adx 30 {
2367 michael 1646 conf = conf_make(CONF_DLINE);
2368     conf->host = xstrdup(block_state.addr.buf);
2369 michael 1005
2370 michael 1647 if (block_state.rpass.buf[0])
2371     conf->reason = xstrdup(block_state.rpass.buf);
2372 michael 1646 else
2373     conf->reason = xstrdup(CONF_NOREASON);
2374     add_conf_by_address(CONF_DLINE, conf);
2375 adx 30 }
2376 michael 2916 };
2377 adx 30
2378     deny_items: deny_items deny_item | deny_item;
2379     deny_item: deny_ip | deny_reason | error;
2380    
2381     deny_ip: IP '=' QSTRING ';'
2382     {
2383 michael 967 if (conf_parser_ctx.pass == 2)
2384 michael 1646 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2385 adx 30 };
2386    
2387 michael 2916 deny_reason: REASON '=' QSTRING ';'
2388 adx 30 {
2389 michael 967 if (conf_parser_ctx.pass == 2)
2390 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2391 adx 30 };
2392    
2393     /***************************************************************************
2394     * section exempt
2395     ***************************************************************************/
2396     exempt_entry: EXEMPT '{' exempt_items '}' ';';
2397    
2398     exempt_items: exempt_items exempt_item | exempt_item;
2399     exempt_item: exempt_ip | error;
2400    
2401     exempt_ip: IP '=' QSTRING ';'
2402     {
2403 michael 967 if (conf_parser_ctx.pass == 2)
2404 adx 30 {
2405     if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2406     {
2407 michael 1646 struct MaskItem *conf = conf_make(CONF_EXEMPT);
2408     conf->host = xstrdup(yylval.string);
2409 adx 30
2410 michael 1646 add_conf_by_address(CONF_EXEMPT, conf);
2411 adx 30 }
2412     }
2413     };
2414    
2415     /***************************************************************************
2416     * section gecos
2417     ***************************************************************************/
2418     gecos_entry: GECOS
2419     {
2420 michael 967 if (conf_parser_ctx.pass == 2)
2421 michael 1646 reset_block_state();
2422 adx 30 } '{' gecos_items '}' ';'
2423     {
2424 michael 1646 struct MaskItem *conf = NULL;
2425    
2426     if (conf_parser_ctx.pass != 2)
2427     break;
2428    
2429     if (!block_state.name.buf[0])
2430     break;
2431    
2432 michael 1921 conf = conf_make(CONF_XLINE);
2433 michael 1646 conf->name = xstrdup(block_state.name.buf);
2434 adx 30
2435 michael 1647 if (block_state.rpass.buf[0])
2436     conf->reason = xstrdup(block_state.rpass.buf);
2437 michael 1646 else
2438     conf->reason = xstrdup(CONF_NOREASON);
2439 adx 30 };
2440    
2441     gecos_items: gecos_items gecos_item | gecos_item;
2442 michael 1921 gecos_item: gecos_name | gecos_reason | error;
2443 adx 30
2444 michael 2916 gecos_name: NAME '=' QSTRING ';'
2445 adx 30 {
2446 michael 967 if (conf_parser_ctx.pass == 2)
2447 michael 1646 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2448 adx 30 };
2449    
2450 michael 2916 gecos_reason: REASON '=' QSTRING ';'
2451 adx 30 {
2452 michael 967 if (conf_parser_ctx.pass == 2)
2453 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2454 adx 30 };
2455    
2456     /***************************************************************************
2457     * section general
2458     ***************************************************************************/
2459     general_entry: GENERAL
2460     '{' general_items '}' ';';
2461    
2462     general_items: general_items general_item | general_item;
2463 michael 3439 general_item: general_hide_spoof_ips |
2464     general_ignore_bogus_ts |
2465     general_failed_oper_notice |
2466     general_anti_nick_flood |
2467     general_max_nick_time |
2468     general_max_nick_changes |
2469     general_max_accept |
2470     general_anti_spam_exit_message_time |
2471     general_ts_warn_delta |
2472     general_ts_max_delta |
2473 michael 1549 general_kill_chase_time_limit |
2474     general_invisible_on_connect |
2475 michael 3473 general_warn_no_connect_block |
2476 michael 3439 general_dots_in_ident |
2477     general_stats_o_oper_only |
2478     general_stats_k_oper_only |
2479     general_pace_wait |
2480     general_stats_i_oper_only |
2481     general_pace_wait_simple |
2482     general_stats_P_oper_only |
2483 michael 2269 general_stats_u_oper_only |
2484 michael 3439 general_short_motd |
2485     general_no_oper_flood |
2486     general_true_no_oper_flood |
2487     general_oper_pass_resv |
2488     general_oper_only_umodes |
2489     general_max_targets |
2490     general_oper_umodes |
2491     general_caller_id_wait |
2492     general_opers_bypass_callerid |
2493     general_default_floodcount |
2494     general_min_nonwildcard |
2495     general_min_nonwildcard_simple |
2496 michael 3877 general_throttle_count |
2497 michael 3439 general_throttle_time |
2498     general_havent_read_conf |
2499 michael 1072 general_ping_cookie |
2500 michael 2916 general_disable_auth |
2501 michael 3439 general_tkline_expire_notices |
2502     general_gline_enable |
2503     general_gline_duration |
2504     general_gline_request_duration |
2505 michael 1459 general_gline_min_cidr |
2506 michael 1547 general_gline_min_cidr6 |
2507 michael 3439 general_stats_e_disabled |
2508     general_max_watch |
2509     general_services_name |
2510     general_cycle_on_host_change |
2511     error;
2512 adx 30
2513    
2514 michael 876 general_max_watch: MAX_WATCH '=' NUMBER ';'
2515     {
2516     ConfigFileEntry.max_watch = $3;
2517     };
2518 adx 30
2519 michael 2283 general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2520     {
2521     if (conf_parser_ctx.pass == 2)
2522     ConfigFileEntry.cycle_on_host_change = yylval.number;
2523     };
2524    
2525 michael 1459 general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2526     {
2527     if (conf_parser_ctx.pass == 2)
2528     ConfigFileEntry.glines = yylval.number;
2529     };
2530    
2531     general_gline_duration: GLINE_DURATION '=' timespec ';'
2532     {
2533     if (conf_parser_ctx.pass == 2)
2534     ConfigFileEntry.gline_time = $3;
2535     };
2536    
2537     general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2538     {
2539     if (conf_parser_ctx.pass == 2)
2540     ConfigFileEntry.gline_request_time = $3;
2541     };
2542    
2543 adx 30 general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2544     {
2545     ConfigFileEntry.gline_min_cidr = $3;
2546     };
2547    
2548     general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2549     {
2550     ConfigFileEntry.gline_min_cidr6 = $3;
2551     };
2552    
2553     general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2554     {
2555     ConfigFileEntry.tkline_expire_notices = yylval.number;
2556     };
2557    
2558 michael 1074 general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2559 adx 30 {
2560     ConfigFileEntry.kill_chase_time_limit = $3;
2561     };
2562    
2563     general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2564     {
2565     ConfigFileEntry.hide_spoof_ips = yylval.number;
2566     };
2567    
2568     general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2569     {
2570     ConfigFileEntry.ignore_bogus_ts = yylval.number;
2571     };
2572    
2573     general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2574     {
2575     ConfigFileEntry.failed_oper_notice = yylval.number;
2576     };
2577    
2578     general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2579     {
2580     ConfigFileEntry.anti_nick_flood = yylval.number;
2581     };
2582    
2583     general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2584     {
2585 michael 2916 ConfigFileEntry.max_nick_time = $3;
2586 adx 30 };
2587    
2588     general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2589     {
2590     ConfigFileEntry.max_nick_changes = $3;
2591     };
2592    
2593     general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2594     {
2595     ConfigFileEntry.max_accept = $3;
2596     };
2597    
2598     general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2599     {
2600     ConfigFileEntry.anti_spam_exit_message_time = $3;
2601     };
2602    
2603     general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2604     {
2605     ConfigFileEntry.ts_warn_delta = $3;
2606     };
2607    
2608     general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2609     {
2610 michael 967 if (conf_parser_ctx.pass == 2)
2611 adx 30 ConfigFileEntry.ts_max_delta = $3;
2612     };
2613    
2614     general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2615     {
2616 michael 967 if (($3 > 0) && conf_parser_ctx.pass == 1)
2617 adx 30 {
2618 michael 1247 ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2619     ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2620     ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2621 adx 30 exit(0);
2622     }
2623     };
2624    
2625     general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2626     {
2627     ConfigFileEntry.invisible_on_connect = yylval.number;
2628     };
2629    
2630 michael 3473 general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2631 adx 30 {
2632 michael 3473 ConfigFileEntry.warn_no_connect_block = yylval.number;
2633 adx 30 };
2634    
2635 michael 584 general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2636     {
2637     ConfigFileEntry.stats_e_disabled = yylval.number;
2638     };
2639    
2640 adx 30 general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2641     {
2642     ConfigFileEntry.stats_o_oper_only = yylval.number;
2643     };
2644    
2645     general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2646     {
2647     ConfigFileEntry.stats_P_oper_only = yylval.number;
2648     };
2649    
2650 michael 2269 general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2651     {
2652     ConfigFileEntry.stats_u_oper_only = yylval.number;
2653     };
2654    
2655 adx 30 general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2656     {
2657     ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2658     } | STATS_K_OPER_ONLY '=' TMASKED ';'
2659     {
2660     ConfigFileEntry.stats_k_oper_only = 1;
2661     };
2662    
2663     general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2664     {
2665     ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2666     } | STATS_I_OPER_ONLY '=' TMASKED ';'
2667     {
2668     ConfigFileEntry.stats_i_oper_only = 1;
2669     };
2670    
2671     general_pace_wait: PACE_WAIT '=' timespec ';'
2672     {
2673     ConfigFileEntry.pace_wait = $3;
2674     };
2675    
2676     general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2677     {
2678     ConfigFileEntry.caller_id_wait = $3;
2679     };
2680    
2681     general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2682     {
2683     ConfigFileEntry.opers_bypass_callerid = yylval.number;
2684     };
2685    
2686     general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2687     {
2688     ConfigFileEntry.pace_wait_simple = $3;
2689     };
2690    
2691     general_short_motd: SHORT_MOTD '=' TBOOL ';'
2692     {
2693     ConfigFileEntry.short_motd = yylval.number;
2694     };
2695 michael 2916
2696 adx 30 general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2697     {
2698     ConfigFileEntry.no_oper_flood = yylval.number;
2699     };
2700    
2701     general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2702     {
2703     ConfigFileEntry.true_no_oper_flood = yylval.number;
2704     };
2705    
2706     general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2707     {
2708     ConfigFileEntry.oper_pass_resv = yylval.number;
2709     };
2710    
2711     general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2712     {
2713     ConfigFileEntry.dots_in_ident = $3;
2714     };
2715    
2716     general_max_targets: MAX_TARGETS '=' NUMBER ';'
2717     {
2718     ConfigFileEntry.max_targets = $3;
2719     };
2720    
2721 michael 1176 general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2722 michael 1157 {
2723 michael 1176 if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2724 michael 1157 {
2725     MyFree(ConfigFileEntry.service_name);
2726 michael 1646 ConfigFileEntry.service_name = xstrdup(yylval.string);
2727 michael 1157 }
2728     };
2729    
2730 adx 30 general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2731     {
2732     ConfigFileEntry.ping_cookie = yylval.number;
2733     };
2734    
2735     general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2736     {
2737     ConfigFileEntry.disable_auth = yylval.number;
2738     };
2739    
2740 michael 3877 general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2741     {
2742     ConfigFileEntry.throttle_count = $3;
2743     };
2744    
2745 adx 30 general_throttle_time: THROTTLE_TIME '=' timespec ';'
2746     {
2747 michael 3435 ConfigFileEntry.throttle_time = $3;
2748 adx 30 };
2749    
2750     general_oper_umodes: OPER_UMODES
2751     {
2752     ConfigFileEntry.oper_umodes = 0;
2753     } '=' umode_oitems ';' ;
2754    
2755     umode_oitems: umode_oitems ',' umode_oitem | umode_oitem;
2756     umode_oitem: T_BOTS
2757     {
2758     ConfigFileEntry.oper_umodes |= UMODE_BOTS;
2759     } | T_CCONN
2760     {
2761     ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2762     } | T_DEAF
2763     {
2764     ConfigFileEntry.oper_umodes |= UMODE_DEAF;
2765     } | T_DEBUG
2766     {
2767     ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
2768     } | T_FULL
2769     {
2770     ConfigFileEntry.oper_umodes |= UMODE_FULL;
2771 michael 1294 } | HIDDEN
2772     {
2773     ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2774 michael 3513 } | HIDE_CHANS
2775     {
2776     ConfigFileEntry.oper_umodes |= UMODE_HIDECHANS;
2777 michael 3506 } | HIDE_IDLE
2778     {
2779     ConfigFileEntry.oper_umodes |= UMODE_HIDEIDLE;
2780 adx 30 } | T_SKILL
2781     {
2782     ConfigFileEntry.oper_umodes |= UMODE_SKILL;
2783     } | T_NCHANGE
2784     {
2785     ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
2786     } | T_REJ
2787     {
2788     ConfigFileEntry.oper_umodes |= UMODE_REJ;
2789     } | T_UNAUTH
2790     {
2791     ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
2792     } | T_SPY
2793     {
2794     ConfigFileEntry.oper_umodes |= UMODE_SPY;
2795     } | T_EXTERNAL
2796     {
2797     ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
2798     } | T_SERVNOTICE
2799     {
2800     ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
2801     } | T_INVISIBLE
2802     {
2803     ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
2804     } | T_WALLOP
2805     {
2806     ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
2807     } | T_SOFTCALLERID
2808     {
2809     ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
2810     } | T_CALLERID
2811     {
2812     ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
2813     } | T_LOCOPS
2814     {
2815     ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2816 michael 1979 } | T_NONONREG
2817     {
2818     ConfigFileEntry.oper_umodes |= UMODE_REGONLY;
2819 michael 1976 } | T_FARCONNECT
2820     {
2821     ConfigFileEntry.oper_umodes |= UMODE_FARCONNECT;
2822 adx 30 };
2823    
2824 michael 2916 general_oper_only_umodes: OPER_ONLY_UMODES
2825 adx 30 {
2826     ConfigFileEntry.oper_only_umodes = 0;
2827     } '=' umode_items ';' ;
2828    
2829 michael 3439 umode_items: umode_items ',' umode_item | umode_item;
2830     umode_item: T_BOTS
2831 adx 30 {
2832     ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2833     } | T_CCONN
2834     {
2835     ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2836     } | T_DEAF
2837     {
2838     ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
2839     } | T_DEBUG
2840     {
2841     ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2842     } | T_FULL
2843 michael 2916 {
2844 adx 30 ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2845     } | T_SKILL
2846     {
2847     ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2848 michael 1294 } | HIDDEN
2849     {
2850     ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
2851 adx 30 } | T_NCHANGE
2852     {
2853     ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
2854     } | T_REJ
2855     {
2856     ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
2857     } | T_UNAUTH
2858     {
2859     ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
2860     } | T_SPY
2861     {
2862     ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
2863     } | T_EXTERNAL
2864     {
2865     ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
2866     } | T_SERVNOTICE
2867     {
2868     ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
2869     } | T_INVISIBLE
2870     {
2871     ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
2872     } | T_WALLOP
2873     {
2874     ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
2875     } | T_SOFTCALLERID
2876     {
2877     ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
2878     } | T_CALLERID
2879     {
2880     ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
2881     } | T_LOCOPS
2882     {
2883     ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
2884 michael 1855 } | T_NONONREG
2885     {
2886     ConfigFileEntry.oper_only_umodes |= UMODE_REGONLY;
2887 michael 1976 } | T_FARCONNECT
2888     {
2889     ConfigFileEntry.oper_only_umodes |= UMODE_FARCONNECT;
2890 adx 30 };
2891    
2892     general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2893     {
2894     ConfigFileEntry.min_nonwildcard = $3;
2895     };
2896    
2897     general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2898     {
2899     ConfigFileEntry.min_nonwildcard_simple = $3;
2900     };
2901    
2902     general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2903     {
2904     ConfigFileEntry.default_floodcount = $3;
2905     };
2906    
2907    
2908     /***************************************************************************
2909     * section channel
2910     ***************************************************************************/
2911     channel_entry: CHANNEL
2912     '{' channel_items '}' ';';
2913    
2914     channel_items: channel_items channel_item | channel_item;
2915 michael 1495 channel_item: channel_max_bans |
2916 michael 3860 channel_invite_client_count |
2917     channel_invite_client_time |
2918     channel_knock_client_count |
2919     channel_knock_client_time |
2920 michael 3439 channel_knock_delay_channel |
2921 michael 3933 channel_max_channels |
2922 michael 1946 channel_default_split_user_count |
2923 adx 201 channel_default_split_server_count |
2924 michael 1858 channel_no_create_on_split |
2925 michael 1401 channel_no_join_on_split |
2926 michael 3439 channel_jflood_count |
2927     channel_jflood_time |
2928     channel_disable_fake_channels |
2929     error;
2930 adx 30
2931 michael 632 channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2932     {
2933     ConfigChannel.disable_fake_channels = yylval.number;
2934     };
2935    
2936 michael 3860 channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2937 adx 30 {
2938 michael 3860 ConfigChannel.invite_client_count = $3;
2939 adx 30 };
2940    
2941 michael 3860 channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2942 adx 30 {
2943 michael 3860 ConfigChannel.invite_client_time = $3;
2944 adx 30 };
2945    
2946 michael 3860 channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2947 michael 3762 {
2948 michael 3860 ConfigChannel.knock_client_count = $3;
2949 michael 3762 };
2950    
2951 michael 3860 channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2952 michael 3762 {
2953 michael 3860 ConfigChannel.knock_client_time = $3;
2954 michael 3762 };
2955    
2956 michael 3860 channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
2957     {
2958     ConfigChannel.knock_delay_channel = $3;
2959     };
2960    
2961 michael 3933 channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
2962 adx 30 {
2963 michael 3933 ConfigChannel.max_channels = $3;
2964 adx 30 };
2965    
2966     channel_max_bans: MAX_BANS '=' NUMBER ';'
2967     {
2968     ConfigChannel.max_bans = $3;
2969     };
2970    
2971     channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2972     {
2973     ConfigChannel.default_split_user_count = $3;
2974     };
2975    
2976     channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2977     {
2978     ConfigChannel.default_split_server_count = $3;
2979     };
2980    
2981     channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
2982     {
2983     ConfigChannel.no_create_on_split = yylval.number;
2984     };
2985    
2986     channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2987     {
2988     ConfigChannel.no_join_on_split = yylval.number;
2989     };
2990    
2991     channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2992     {
2993     GlobalSetOptions.joinfloodcount = yylval.number;
2994     };
2995    
2996     channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
2997     {
2998 michael 3435 GlobalSetOptions.joinfloodtime = $3;
2999 adx 30 };
3000    
3001     /***************************************************************************
3002     * section serverhide
3003     ***************************************************************************/
3004     serverhide_entry: SERVERHIDE
3005     '{' serverhide_items '}' ';';
3006    
3007     serverhide_items: serverhide_items serverhide_item | serverhide_item;
3008 michael 3439 serverhide_item: serverhide_flatten_links |
3009     serverhide_disable_remote_commands |
3010 michael 2196 serverhide_hide_servers |
3011 michael 3439 serverhide_hide_services |
3012     serverhide_links_delay |
3013     serverhide_hidden |
3014     serverhide_hidden_name |
3015     serverhide_hide_server_ips |
3016 adx 30 error;
3017    
3018     serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3019     {
3020 michael 967 if (conf_parser_ctx.pass == 2)
3021 adx 30 ConfigServerHide.flatten_links = yylval.number;
3022     };
3023    
3024 michael 2196 serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
3025     {
3026     if (conf_parser_ctx.pass == 2)
3027     ConfigServerHide.disable_remote_commands = yylval.number;
3028     };
3029    
3030 adx 30 serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3031     {
3032 michael 967 if (conf_parser_ctx.pass == 2)
3033 adx 30 ConfigServerHide.hide_servers = yylval.number;
3034     };
3035    
3036 michael 1851 serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
3037     {
3038     if (conf_parser_ctx.pass == 2)
3039     ConfigServerHide.hide_services = yylval.number;
3040     };
3041    
3042 adx 30 serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3043     {
3044 michael 967 if (conf_parser_ctx.pass == 2)
3045 adx 30 {
3046     MyFree(ConfigServerHide.hidden_name);
3047 michael 1646 ConfigServerHide.hidden_name = xstrdup(yylval.string);
3048 adx 30 }
3049     };
3050    
3051     serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3052     {
3053 michael 967 if (conf_parser_ctx.pass == 2)
3054 adx 30 {
3055     if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3056     {
3057 michael 4094 event_write_links_file.when = $3;
3058     event_addish(&event_write_links_file, NULL);
3059 adx 30 ConfigServerHide.links_disabled = 0;
3060     }
3061    
3062     ConfigServerHide.links_delay = $3;
3063     }
3064     };
3065    
3066     serverhide_hidden: HIDDEN '=' TBOOL ';'
3067     {
3068 michael 967 if (conf_parser_ctx.pass == 2)
3069 adx 30 ConfigServerHide.hidden = yylval.number;
3070     };
3071    
3072     serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3073     {
3074 michael 967 if (conf_parser_ctx.pass == 2)
3075 adx 30 ConfigServerHide.hide_server_ips = yylval.number;
3076     };

Properties

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