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