ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 7624
Committed: Thu Jun 23 12:44:09 2016 UTC (10 years, 3 months ago) by michael
File size: 76399 byte(s)
Log Message:
- Change userhost.c to deal with ip addresses only. Also we no longer care about usernames/ident replies.
  Due to the hash function in hash.c not ideal for ip addresses, we'll be using either iphash.c, or
  patricia.c soon for this.

File Contents

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

Properties

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