ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 2252
Committed: Sun Jun 16 13:29:13 2013 UTC (13 years, 3 months ago) by michael
File size: 74764 byte(s)
Log Message:
- conf_parser.y: don't attempt to copy ciphers if there aren't any

File Contents

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

Properties

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