1 |
/* |
2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
* ircd_parser.y: Parses the ircd configuration file. |
4 |
* |
5 |
* Copyright (C) 2005 by the past and present ircd coders, and others. |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License as published by |
9 |
* the Free Software Foundation; either version 2 of the License, or |
10 |
* (at your option) any later version. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
* USA |
21 |
* |
22 |
* $Id$ |
23 |
*/ |
24 |
|
25 |
%{ |
26 |
|
27 |
#define YY_NO_UNPUT |
28 |
#include <sys/types.h> |
29 |
#include <string.h> |
30 |
|
31 |
#include "config.h" |
32 |
#include "stdinc.h" |
33 |
#include "ircd.h" |
34 |
#include "list.h" |
35 |
#include "s_conf.h" |
36 |
#include "event.h" |
37 |
#include "s_log.h" |
38 |
#include "client.h" /* for UMODE_ALL only */ |
39 |
#include "irc_string.h" |
40 |
#include "irc_getaddrinfo.h" |
41 |
#include "sprintf_irc.h" |
42 |
#include "memory.h" |
43 |
#include "modules.h" |
44 |
#include "s_serv.h" |
45 |
#include "hostmask.h" |
46 |
#include "send.h" |
47 |
#include "listener.h" |
48 |
#include "resv.h" |
49 |
#include "numeric.h" |
50 |
#include "s_user.h" |
51 |
|
52 |
#ifdef HAVE_LIBCRYPTO |
53 |
#include <openssl/rsa.h> |
54 |
#include <openssl/bio.h> |
55 |
#include <openssl/pem.h> |
56 |
#endif |
57 |
|
58 |
static char *class_name = NULL; |
59 |
static struct ConfItem *yy_conf = NULL; |
60 |
static struct AccessItem *yy_aconf = NULL; |
61 |
static struct MatchItem *yy_match_item = NULL; |
62 |
static struct ClassItem *yy_class = NULL; |
63 |
static char *yy_class_name = NULL; |
64 |
|
65 |
static dlink_list col_conf_list = { NULL, NULL, 0 }; |
66 |
static dlink_list hub_conf_list = { NULL, NULL, 0 }; |
67 |
static dlink_list leaf_conf_list = { NULL, NULL, 0 }; |
68 |
static unsigned int listener_flags = 0; |
69 |
static unsigned int regex_ban = 0; |
70 |
static char userbuf[IRCD_BUFSIZE]; |
71 |
static char hostbuf[IRCD_BUFSIZE]; |
72 |
static char reasonbuf[REASONLEN + 1]; |
73 |
static char gecos_name[REALLEN * 4]; |
74 |
|
75 |
static char *resv_reason = NULL; |
76 |
static char *listener_address = NULL; |
77 |
static int not_atom = 0; |
78 |
|
79 |
struct CollectItem |
80 |
{ |
81 |
dlink_node node; |
82 |
char *name; |
83 |
char *user; |
84 |
char *host; |
85 |
char *passwd; |
86 |
int port; |
87 |
int flags; |
88 |
#ifdef HAVE_LIBCRYPTO |
89 |
char *rsa_public_key_file; |
90 |
RSA *rsa_public_key; |
91 |
#endif |
92 |
}; |
93 |
|
94 |
static void |
95 |
free_collect_item(struct CollectItem *item) |
96 |
{ |
97 |
MyFree(item->name); |
98 |
MyFree(item->user); |
99 |
MyFree(item->host); |
100 |
MyFree(item->passwd); |
101 |
#ifdef HAVE_LIBCRYPTO |
102 |
MyFree(item->rsa_public_key_file); |
103 |
#endif |
104 |
MyFree(item); |
105 |
} |
106 |
|
107 |
static void |
108 |
unhook_hub_leaf_confs(void) |
109 |
{ |
110 |
dlink_node *ptr; |
111 |
dlink_node *next_ptr; |
112 |
struct CollectItem *yy_hconf; |
113 |
struct CollectItem *yy_lconf; |
114 |
|
115 |
DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head) |
116 |
{ |
117 |
yy_hconf = ptr->data; |
118 |
dlinkDelete(&yy_hconf->node, &hub_conf_list); |
119 |
free_collect_item(yy_hconf); |
120 |
} |
121 |
|
122 |
DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head) |
123 |
{ |
124 |
yy_lconf = ptr->data; |
125 |
dlinkDelete(&yy_lconf->node, &leaf_conf_list); |
126 |
free_collect_item(yy_lconf); |
127 |
} |
128 |
} |
129 |
|
130 |
%} |
131 |
|
132 |
%union { |
133 |
int number; |
134 |
char *string; |
135 |
} |
136 |
|
137 |
%token ACCEPT_PASSWORD |
138 |
%token ACTION |
139 |
%token ADMIN |
140 |
%token AFTYPE |
141 |
%token T_ALLOW |
142 |
%token ANTI_NICK_FLOOD |
143 |
%token ANTI_SPAM_EXIT_MESSAGE_TIME |
144 |
%token AUTOCONN |
145 |
%token T_BLOCK |
146 |
%token BURST_AWAY |
147 |
%token BURST_TOPICWHO |
148 |
%token BYTES KBYTES MBYTES GBYTES TBYTES |
149 |
%token CALLER_ID_WAIT |
150 |
%token CAN_FLOOD |
151 |
%token CAN_IDLE |
152 |
%token CHANNEL |
153 |
%token CIDR_BITLEN_IPV4 |
154 |
%token CIDR_BITLEN_IPV6 |
155 |
%token CIPHER_PREFERENCE |
156 |
%token CLASS |
157 |
%token COMPRESSED |
158 |
%token COMPRESSION_LEVEL |
159 |
%token CONNECT |
160 |
%token CONNECTFREQ |
161 |
%token CRYPTLINK |
162 |
%token DEFAULT_CIPHER_PREFERENCE |
163 |
%token DEFAULT_FLOODCOUNT |
164 |
%token DEFAULT_SPLIT_SERVER_COUNT |
165 |
%token DEFAULT_SPLIT_USER_COUNT |
166 |
%token DENY |
167 |
%token DESCRIPTION |
168 |
%token DIE |
169 |
%token DISABLE_AUTH |
170 |
%token DISABLE_FAKE_CHANNELS |
171 |
%token DISABLE_HIDDEN |
172 |
%token DISABLE_LOCAL_CHANNELS |
173 |
%token DISABLE_REMOTE_COMMANDS |
174 |
%token DOTS_IN_IDENT |
175 |
%token DURATION |
176 |
%token EGDPOOL_PATH |
177 |
%token EMAIL |
178 |
%token ENABLE |
179 |
%token ENCRYPTED |
180 |
%token EXCEED_LIMIT |
181 |
%token EXEMPT |
182 |
%token FAILED_OPER_NOTICE |
183 |
%token FAKENAME |
184 |
%token IRCD_FLAGS |
185 |
%token FLATTEN_LINKS |
186 |
%token FFAILED_OPERLOG |
187 |
%token FKILLLOG |
188 |
%token FKLINELOG |
189 |
%token FGLINELOG |
190 |
%token FIOERRLOG |
191 |
%token FOPERLOG |
192 |
%token FOPERSPYLOG |
193 |
%token FUSERLOG |
194 |
%token GECOS |
195 |
%token GENERAL |
196 |
%token GLINE |
197 |
%token GLINES |
198 |
%token GLINE_EXEMPT |
199 |
%token GLINE_LOG |
200 |
%token GLINE_TIME |
201 |
%token GLINE_MIN_CIDR |
202 |
%token GLINE_MIN_CIDR6 |
203 |
%token GLOBAL_KILL |
204 |
%token IRCD_AUTH |
205 |
%token NEED_IDENT |
206 |
%token HAVENT_READ_CONF |
207 |
%token HIDDEN |
208 |
%token HIDDEN_ADMIN |
209 |
%token HIDDEN_NAME |
210 |
%token HIDDEN_OPER |
211 |
%token HIDE_SERVER_IPS |
212 |
%token HIDE_SERVERS |
213 |
%token HIDE_SPOOF_IPS |
214 |
%token HOST |
215 |
%token HUB |
216 |
%token HUB_MASK |
217 |
%token IDLETIME |
218 |
%token IGNORE_BOGUS_TS |
219 |
%token INVISIBLE_ON_CONNECT |
220 |
%token IP |
221 |
%token KILL |
222 |
%token KILL_CHASE_TIME_LIMIT |
223 |
%token KLINE |
224 |
%token KLINE_EXEMPT |
225 |
%token KLINE_REASON |
226 |
%token KLINE_WITH_REASON |
227 |
%token KNOCK_DELAY |
228 |
%token KNOCK_DELAY_CHANNEL |
229 |
%token LEAF_MASK |
230 |
%token LINKS_DELAY |
231 |
%token LISTEN |
232 |
%token T_LOG |
233 |
%token LOGGING |
234 |
%token LOG_LEVEL |
235 |
%token MAX_ACCEPT |
236 |
%token MAX_BANS |
237 |
%token MAX_CHANS_PER_USER |
238 |
%token MAX_GLOBAL |
239 |
%token MAX_IDENT |
240 |
%token MAX_LOCAL |
241 |
%token MAX_NICK_CHANGES |
242 |
%token MAX_NICK_TIME |
243 |
%token MAX_NUMBER |
244 |
%token MAX_TARGETS |
245 |
%token MAX_WATCH |
246 |
%token MESSAGE_LOCALE |
247 |
%token MIN_NONWILDCARD |
248 |
%token MIN_NONWILDCARD_SIMPLE |
249 |
%token MODULE |
250 |
%token MODULES |
251 |
%token NAME |
252 |
%token NEED_PASSWORD |
253 |
%token NETWORK_DESC |
254 |
%token NETWORK_NAME |
255 |
%token NICK |
256 |
%token NICK_CHANGES |
257 |
%token NO_CREATE_ON_SPLIT |
258 |
%token NO_JOIN_ON_SPLIT |
259 |
%token NO_OPER_FLOOD |
260 |
%token NO_TILDE |
261 |
%token NOT |
262 |
%token NUMBER |
263 |
%token NUMBER_PER_IDENT |
264 |
%token NUMBER_PER_CIDR |
265 |
%token NUMBER_PER_IP |
266 |
%token NUMBER_PER_IP_GLOBAL |
267 |
%token OPERATOR |
268 |
%token OPERS_BYPASS_CALLERID |
269 |
%token OPER_LOG |
270 |
%token OPER_ONLY_UMODES |
271 |
%token OPER_PASS_RESV |
272 |
%token OPER_SPY_T |
273 |
%token OPER_UMODES |
274 |
%token JOIN_FLOOD_COUNT |
275 |
%token JOIN_FLOOD_TIME |
276 |
%token PACE_WAIT |
277 |
%token PACE_WAIT_SIMPLE |
278 |
%token PASSWORD |
279 |
%token PATH |
280 |
%token PING_COOKIE |
281 |
%token PING_TIME |
282 |
%token PING_WARNING |
283 |
%token PORT |
284 |
%token QSTRING |
285 |
%token QUIET_ON_BAN |
286 |
%token REASON |
287 |
%token REDIRPORT |
288 |
%token REDIRSERV |
289 |
%token REGEX_T |
290 |
%token REHASH |
291 |
%token TREJECT_HOLD_TIME |
292 |
%token REMOTE |
293 |
%token REMOTEBAN |
294 |
%token RESTRICT_CHANNELS |
295 |
%token RESTRICTED |
296 |
%token RSA_PRIVATE_KEY_FILE |
297 |
%token RSA_PUBLIC_KEY_FILE |
298 |
%token SSL_CERTIFICATE_FILE |
299 |
%token T_SSL_CONNECTION_METHOD |
300 |
%token T_SSLV3 |
301 |
%token T_TLSV1 |
302 |
%token RESV |
303 |
%token RESV_EXEMPT |
304 |
%token SECONDS MINUTES HOURS DAYS WEEKS |
305 |
%token SENDQ |
306 |
%token SEND_PASSWORD |
307 |
%token SERVERHIDE |
308 |
%token SERVERINFO |
309 |
%token SERVLINK_PATH |
310 |
%token IRCD_SID |
311 |
%token TKLINE_EXPIRE_NOTICES |
312 |
%token T_SHARED |
313 |
%token T_CLUSTER |
314 |
%token TYPE |
315 |
%token SHORT_MOTD |
316 |
%token SILENT |
317 |
%token SPOOF |
318 |
%token SPOOF_NOTICE |
319 |
%token STATS_E_DISABLED |
320 |
%token STATS_I_OPER_ONLY |
321 |
%token STATS_K_OPER_ONLY |
322 |
%token STATS_O_OPER_ONLY |
323 |
%token STATS_P_OPER_ONLY |
324 |
%token TBOOL |
325 |
%token TMASKED |
326 |
%token T_REJECT |
327 |
%token TS_MAX_DELTA |
328 |
%token TS_WARN_DELTA |
329 |
%token TWODOTS |
330 |
%token T_ALL |
331 |
%token T_BOTS |
332 |
%token T_SOFTCALLERID |
333 |
%token T_CALLERID |
334 |
%token T_CCONN |
335 |
%token T_CCONN_FULL |
336 |
%token T_CLIENT_FLOOD |
337 |
%token T_DEAF |
338 |
%token T_DEBUG |
339 |
%token T_DRONE |
340 |
%token T_EXTERNAL |
341 |
%token T_FULL |
342 |
%token T_INVISIBLE |
343 |
%token T_IPV4 |
344 |
%token T_IPV6 |
345 |
%token T_LOCOPS |
346 |
%token T_LOGPATH |
347 |
%token T_L_CRIT |
348 |
%token T_L_DEBUG |
349 |
%token T_L_ERROR |
350 |
%token T_L_INFO |
351 |
%token T_L_NOTICE |
352 |
%token T_L_TRACE |
353 |
%token T_L_WARN |
354 |
%token T_MAX_CLIENTS |
355 |
%token T_NCHANGE |
356 |
%token T_OPERWALL |
357 |
%token T_REJ |
358 |
%token T_SERVER |
359 |
%token T_SERVNOTICE |
360 |
%token T_SKILL |
361 |
%token T_SPY |
362 |
%token T_SSL |
363 |
%token T_UMODES |
364 |
%token T_UNAUTH |
365 |
%token T_UNRESV |
366 |
%token T_UNXLINE |
367 |
%token T_WALLOP |
368 |
%token THROTTLE_TIME |
369 |
%token TOPICBURST |
370 |
%token TRUE_NO_OPER_FLOOD |
371 |
%token TKLINE |
372 |
%token TXLINE |
373 |
%token TRESV |
374 |
%token UNKLINE |
375 |
%token USER |
376 |
%token USE_EGD |
377 |
%token USE_EXCEPT |
378 |
%token USE_INVEX |
379 |
%token USE_KNOCK |
380 |
%token USE_LOGGING |
381 |
%token USE_WHOIS_ACTUALLY |
382 |
%token VHOST |
383 |
%token VHOST6 |
384 |
%token XLINE |
385 |
%token WARN |
386 |
%token WARN_NO_NLINE |
387 |
|
388 |
%type <string> QSTRING |
389 |
%type <number> NUMBER |
390 |
%type <number> timespec |
391 |
%type <number> timespec_ |
392 |
%type <number> sizespec |
393 |
%type <number> sizespec_ |
394 |
|
395 |
%% |
396 |
conf: |
397 |
| conf conf_item |
398 |
; |
399 |
|
400 |
conf_item: admin_entry |
401 |
| logging_entry |
402 |
| oper_entry |
403 |
| channel_entry |
404 |
| class_entry |
405 |
| listen_entry |
406 |
| auth_entry |
407 |
| serverinfo_entry |
408 |
| serverhide_entry |
409 |
| resv_entry |
410 |
| shared_entry |
411 |
| cluster_entry |
412 |
| connect_entry |
413 |
| kill_entry |
414 |
| deny_entry |
415 |
| exempt_entry |
416 |
| general_entry |
417 |
| gline_entry |
418 |
| gecos_entry |
419 |
| modules_entry |
420 |
| error ';' |
421 |
| error '}' |
422 |
; |
423 |
|
424 |
|
425 |
timespec_: { $$ = 0; } | timespec; |
426 |
timespec: NUMBER timespec_ |
427 |
{ |
428 |
$$ = $1 + $2; |
429 |
} |
430 |
| NUMBER SECONDS timespec_ |
431 |
{ |
432 |
$$ = $1 + $3; |
433 |
} |
434 |
| NUMBER MINUTES timespec_ |
435 |
{ |
436 |
$$ = $1 * 60 + $3; |
437 |
} |
438 |
| NUMBER HOURS timespec_ |
439 |
{ |
440 |
$$ = $1 * 60 * 60 + $3; |
441 |
} |
442 |
| NUMBER DAYS timespec_ |
443 |
{ |
444 |
$$ = $1 * 60 * 60 * 24 + $3; |
445 |
} |
446 |
| NUMBER WEEKS timespec_ |
447 |
{ |
448 |
$$ = $1 * 60 * 60 * 24 * 7 + $3; |
449 |
} |
450 |
; |
451 |
|
452 |
sizespec_: { $$ = 0; } | sizespec; |
453 |
sizespec: NUMBER sizespec_ { $$ = $1 + $2; } |
454 |
| NUMBER BYTES sizespec_ { $$ = $1 + $3; } |
455 |
| NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } |
456 |
| NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; } |
457 |
; |
458 |
|
459 |
|
460 |
/*************************************************************************** |
461 |
* section modules |
462 |
***************************************************************************/ |
463 |
modules_entry: MODULES |
464 |
'{' modules_items '}' ';'; |
465 |
|
466 |
modules_items: modules_items modules_item | modules_item; |
467 |
modules_item: modules_module | modules_path | error ';' ; |
468 |
|
469 |
modules_module: MODULE '=' QSTRING ';' |
470 |
{ |
471 |
#ifndef STATIC_MODULES /* NOOP in the static case */ |
472 |
if (conf_parser_ctx.pass == 2) |
473 |
add_conf_module(libio_basename(yylval.string)); |
474 |
#endif |
475 |
}; |
476 |
|
477 |
modules_path: PATH '=' QSTRING ';' |
478 |
{ |
479 |
#ifndef STATIC_MODULES |
480 |
if (conf_parser_ctx.pass == 2) |
481 |
mod_add_path(yylval.string); |
482 |
#endif |
483 |
}; |
484 |
|
485 |
|
486 |
serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';'; |
487 |
|
488 |
serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ; |
489 |
serverinfo_item: serverinfo_name | serverinfo_vhost | |
490 |
serverinfo_hub | serverinfo_description | |
491 |
serverinfo_network_name | serverinfo_network_desc | |
492 |
serverinfo_max_clients | |
493 |
serverinfo_rsa_private_key_file | serverinfo_vhost6 | |
494 |
serverinfo_sid | serverinfo_ssl_certificate_file | |
495 |
serverinfo_ssl_connection_method | |
496 |
error ';' ; |
497 |
|
498 |
|
499 |
serverinfo_ssl_connection_method: T_SSL_CONNECTION_METHOD |
500 |
{ |
501 |
#ifdef HAVE_LIBCRYPTO |
502 |
if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2) |
503 |
ServerInfo.tls_version = 0; |
504 |
#endif |
505 |
} '=' method_types ';' |
506 |
{ |
507 |
#ifdef HAVE_LIBCRYPTO |
508 |
if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2) |
509 |
{ |
510 |
if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3)) |
511 |
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3); |
512 |
if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1)) |
513 |
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1); |
514 |
} |
515 |
#endif |
516 |
}; |
517 |
|
518 |
method_types: method_types ',' method_type_item | method_type_item; |
519 |
method_type_item: T_SSLV3 |
520 |
{ |
521 |
#ifdef HAVE_LIBCRYPTO |
522 |
if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2) |
523 |
ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_SSLV3; |
524 |
#endif |
525 |
} | T_TLSV1 |
526 |
{ |
527 |
#ifdef HAVE_LIBCRYPTO |
528 |
if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2) |
529 |
ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_TLSV1; |
530 |
#endif |
531 |
}; |
532 |
|
533 |
serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';' |
534 |
{ |
535 |
#ifdef HAVE_LIBCRYPTO |
536 |
if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) |
537 |
{ |
538 |
if (!ServerInfo.rsa_private_key_file) |
539 |
{ |
540 |
yyerror("No rsa_private_key_file specified, SSL disabled"); |
541 |
break; |
542 |
} |
543 |
|
544 |
if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string, |
545 |
SSL_FILETYPE_PEM) <= 0) |
546 |
{ |
547 |
yyerror(ERR_lib_error_string(ERR_get_error())); |
548 |
break; |
549 |
} |
550 |
|
551 |
if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file, |
552 |
SSL_FILETYPE_PEM) <= 0) |
553 |
{ |
554 |
yyerror(ERR_lib_error_string(ERR_get_error())); |
555 |
break; |
556 |
} |
557 |
|
558 |
if (!SSL_CTX_check_private_key(ServerInfo.server_ctx)) |
559 |
{ |
560 |
yyerror(ERR_lib_error_string(ERR_get_error())); |
561 |
break; |
562 |
} |
563 |
} |
564 |
#endif |
565 |
}; |
566 |
|
567 |
serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';' |
568 |
{ |
569 |
#ifdef HAVE_LIBCRYPTO |
570 |
if (conf_parser_ctx.pass == 1) |
571 |
{ |
572 |
BIO *file; |
573 |
|
574 |
if (ServerInfo.rsa_private_key) |
575 |
{ |
576 |
RSA_free(ServerInfo.rsa_private_key); |
577 |
ServerInfo.rsa_private_key = NULL; |
578 |
} |
579 |
|
580 |
if (ServerInfo.rsa_private_key_file) |
581 |
{ |
582 |
MyFree(ServerInfo.rsa_private_key_file); |
583 |
ServerInfo.rsa_private_key_file = NULL; |
584 |
} |
585 |
|
586 |
DupString(ServerInfo.rsa_private_key_file, yylval.string); |
587 |
|
588 |
if ((file = BIO_new_file(yylval.string, "r")) == NULL) |
589 |
{ |
590 |
yyerror("File open failed, ignoring"); |
591 |
break; |
592 |
} |
593 |
|
594 |
ServerInfo.rsa_private_key = (RSA *)PEM_read_bio_RSAPrivateKey(file, NULL, |
595 |
0, NULL); |
596 |
|
597 |
BIO_set_close(file, BIO_CLOSE); |
598 |
BIO_free(file); |
599 |
|
600 |
if (ServerInfo.rsa_private_key == NULL) |
601 |
{ |
602 |
yyerror("Couldn't extract key, ignoring"); |
603 |
break; |
604 |
} |
605 |
|
606 |
if (!RSA_check_key(ServerInfo.rsa_private_key)) |
607 |
{ |
608 |
RSA_free(ServerInfo.rsa_private_key); |
609 |
ServerInfo.rsa_private_key = NULL; |
610 |
|
611 |
yyerror("Invalid key, ignoring"); |
612 |
break; |
613 |
} |
614 |
|
615 |
/* require 2048 bit (256 byte) key */ |
616 |
if (RSA_size(ServerInfo.rsa_private_key) != 256) |
617 |
{ |
618 |
RSA_free(ServerInfo.rsa_private_key); |
619 |
ServerInfo.rsa_private_key = NULL; |
620 |
|
621 |
yyerror("Not a 2048 bit key, ignoring"); |
622 |
} |
623 |
} |
624 |
#endif |
625 |
}; |
626 |
|
627 |
serverinfo_name: NAME '=' QSTRING ';' |
628 |
{ |
629 |
/* this isn't rehashable */ |
630 |
if (conf_parser_ctx.pass == 2 && !ServerInfo.name) |
631 |
{ |
632 |
if (valid_servname(yylval.string)) |
633 |
DupString(ServerInfo.name, yylval.string); |
634 |
else |
635 |
{ |
636 |
ilog(L_ERROR, "Ignoring serverinfo::name -- invalid name. Aborting."); |
637 |
exit(0); |
638 |
} |
639 |
} |
640 |
}; |
641 |
|
642 |
serverinfo_sid: IRCD_SID '=' QSTRING ';' |
643 |
{ |
644 |
/* this isn't rehashable */ |
645 |
if (conf_parser_ctx.pass == 2 && !ServerInfo.sid) |
646 |
{ |
647 |
if (valid_sid(yylval.string)) |
648 |
DupString(ServerInfo.sid, yylval.string); |
649 |
else |
650 |
{ |
651 |
ilog(L_ERROR, "Ignoring serverinfo::sid -- invalid SID. Aborting."); |
652 |
exit(0); |
653 |
} |
654 |
} |
655 |
}; |
656 |
|
657 |
serverinfo_description: DESCRIPTION '=' QSTRING ';' |
658 |
{ |
659 |
if (conf_parser_ctx.pass == 2) |
660 |
{ |
661 |
MyFree(ServerInfo.description); |
662 |
DupString(ServerInfo.description,yylval.string); |
663 |
} |
664 |
}; |
665 |
|
666 |
serverinfo_network_name: NETWORK_NAME '=' QSTRING ';' |
667 |
{ |
668 |
if (conf_parser_ctx.pass == 2) |
669 |
{ |
670 |
char *p; |
671 |
|
672 |
if ((p = strchr(yylval.string, ' ')) != NULL) |
673 |
p = '\0'; |
674 |
|
675 |
MyFree(ServerInfo.network_name); |
676 |
DupString(ServerInfo.network_name, yylval.string); |
677 |
} |
678 |
}; |
679 |
|
680 |
serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';' |
681 |
{ |
682 |
if (conf_parser_ctx.pass == 2) |
683 |
{ |
684 |
MyFree(ServerInfo.network_desc); |
685 |
DupString(ServerInfo.network_desc, yylval.string); |
686 |
} |
687 |
}; |
688 |
|
689 |
serverinfo_vhost: VHOST '=' QSTRING ';' |
690 |
{ |
691 |
if (conf_parser_ctx.pass == 2 && *yylval.string != '*') |
692 |
{ |
693 |
struct addrinfo hints, *res; |
694 |
|
695 |
memset(&hints, 0, sizeof(hints)); |
696 |
|
697 |
hints.ai_family = AF_UNSPEC; |
698 |
hints.ai_socktype = SOCK_STREAM; |
699 |
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
700 |
|
701 |
if (irc_getaddrinfo(yylval.string, NULL, &hints, &res)) |
702 |
ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string); |
703 |
else |
704 |
{ |
705 |
assert(res != NULL); |
706 |
|
707 |
memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen); |
708 |
ServerInfo.ip.ss.ss_family = res->ai_family; |
709 |
ServerInfo.ip.ss_len = res->ai_addrlen; |
710 |
irc_freeaddrinfo(res); |
711 |
|
712 |
ServerInfo.specific_ipv4_vhost = 1; |
713 |
} |
714 |
} |
715 |
}; |
716 |
|
717 |
serverinfo_vhost6: VHOST6 '=' QSTRING ';' |
718 |
{ |
719 |
#ifdef IPV6 |
720 |
if (conf_parser_ctx.pass == 2 && *yylval.string != '*') |
721 |
{ |
722 |
struct addrinfo hints, *res; |
723 |
|
724 |
memset(&hints, 0, sizeof(hints)); |
725 |
|
726 |
hints.ai_family = AF_UNSPEC; |
727 |
hints.ai_socktype = SOCK_STREAM; |
728 |
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
729 |
|
730 |
if (irc_getaddrinfo(yylval.string, NULL, &hints, &res)) |
731 |
ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string); |
732 |
else |
733 |
{ |
734 |
assert(res != NULL); |
735 |
|
736 |
memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen); |
737 |
ServerInfo.ip6.ss.ss_family = res->ai_family; |
738 |
ServerInfo.ip6.ss_len = res->ai_addrlen; |
739 |
irc_freeaddrinfo(res); |
740 |
|
741 |
ServerInfo.specific_ipv6_vhost = 1; |
742 |
} |
743 |
} |
744 |
#endif |
745 |
}; |
746 |
|
747 |
serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';' |
748 |
{ |
749 |
if (conf_parser_ctx.pass == 2) |
750 |
{ |
751 |
recalc_fdlimit(NULL); |
752 |
|
753 |
if ($3 < MAXCLIENTS_MIN) |
754 |
{ |
755 |
char buf[IRCD_BUFSIZE]; |
756 |
ircsprintf(buf, "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN); |
757 |
yyerror(buf); |
758 |
} |
759 |
else if ($3 > MAXCLIENTS_MAX) |
760 |
{ |
761 |
char buf[IRCD_BUFSIZE]; |
762 |
ircsprintf(buf, "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX); |
763 |
yyerror(buf); |
764 |
} |
765 |
else |
766 |
ServerInfo.max_clients = $3; |
767 |
} |
768 |
}; |
769 |
|
770 |
serverinfo_hub: HUB '=' TBOOL ';' |
771 |
{ |
772 |
if (conf_parser_ctx.pass == 2) |
773 |
{ |
774 |
if (yylval.number) |
775 |
{ |
776 |
ServerInfo.hub = 1; |
777 |
delete_capability("HUB"); |
778 |
add_capability("HUB", CAP_HUB, 1); |
779 |
} |
780 |
else if (ServerInfo.hub) |
781 |
{ |
782 |
|
783 |
ServerInfo.hub = 0; |
784 |
delete_capability("HUB"); |
785 |
} |
786 |
} |
787 |
}; |
788 |
|
789 |
/*************************************************************************** |
790 |
* admin section |
791 |
***************************************************************************/ |
792 |
admin_entry: ADMIN '{' admin_items '}' ';' ; |
793 |
|
794 |
admin_items: admin_items admin_item | admin_item; |
795 |
admin_item: admin_name | admin_description | |
796 |
admin_email | error ';' ; |
797 |
|
798 |
admin_name: NAME '=' QSTRING ';' |
799 |
{ |
800 |
if (conf_parser_ctx.pass == 2) |
801 |
{ |
802 |
MyFree(AdminInfo.name); |
803 |
DupString(AdminInfo.name, yylval.string); |
804 |
} |
805 |
}; |
806 |
|
807 |
admin_email: EMAIL '=' QSTRING ';' |
808 |
{ |
809 |
if (conf_parser_ctx.pass == 2) |
810 |
{ |
811 |
MyFree(AdminInfo.email); |
812 |
DupString(AdminInfo.email, yylval.string); |
813 |
} |
814 |
}; |
815 |
|
816 |
admin_description: DESCRIPTION '=' QSTRING ';' |
817 |
{ |
818 |
if (conf_parser_ctx.pass == 2) |
819 |
{ |
820 |
MyFree(AdminInfo.description); |
821 |
DupString(AdminInfo.description, yylval.string); |
822 |
} |
823 |
}; |
824 |
|
825 |
/*************************************************************************** |
826 |
* section logging |
827 |
***************************************************************************/ |
828 |
/* XXX */ |
829 |
logging_entry: LOGGING '{' logging_items '}' ';' ; |
830 |
|
831 |
logging_items: logging_items logging_item | |
832 |
logging_item ; |
833 |
|
834 |
logging_item: logging_path | logging_oper_log | |
835 |
logging_log_level | |
836 |
logging_use_logging | logging_fuserlog | |
837 |
logging_foperlog | logging_fglinelog | |
838 |
logging_fklinelog | logging_killlog | |
839 |
logging_foperspylog | logging_ioerrlog | |
840 |
logging_ffailed_operlog | |
841 |
error ';' ; |
842 |
|
843 |
logging_path: T_LOGPATH '=' QSTRING ';' |
844 |
{ |
845 |
}; |
846 |
|
847 |
logging_oper_log: OPER_LOG '=' QSTRING ';' |
848 |
{ |
849 |
}; |
850 |
|
851 |
logging_fuserlog: FUSERLOG '=' QSTRING ';' |
852 |
{ |
853 |
if (conf_parser_ctx.pass == 2) |
854 |
strlcpy(ConfigLoggingEntry.userlog, yylval.string, |
855 |
sizeof(ConfigLoggingEntry.userlog)); |
856 |
}; |
857 |
|
858 |
logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';' |
859 |
{ |
860 |
if (conf_parser_ctx.pass == 2) |
861 |
strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string, |
862 |
sizeof(ConfigLoggingEntry.failed_operlog)); |
863 |
}; |
864 |
|
865 |
logging_foperlog: FOPERLOG '=' QSTRING ';' |
866 |
{ |
867 |
if (conf_parser_ctx.pass == 2) |
868 |
strlcpy(ConfigLoggingEntry.operlog, yylval.string, |
869 |
sizeof(ConfigLoggingEntry.operlog)); |
870 |
}; |
871 |
|
872 |
logging_foperspylog: FOPERSPYLOG '=' QSTRING ';' |
873 |
{ |
874 |
if (conf_parser_ctx.pass == 2) |
875 |
strlcpy(ConfigLoggingEntry.operspylog, yylval.string, |
876 |
sizeof(ConfigLoggingEntry.operspylog)); |
877 |
}; |
878 |
|
879 |
logging_fglinelog: FGLINELOG '=' QSTRING ';' |
880 |
{ |
881 |
if (conf_parser_ctx.pass == 2) |
882 |
strlcpy(ConfigLoggingEntry.glinelog, yylval.string, |
883 |
sizeof(ConfigLoggingEntry.glinelog)); |
884 |
}; |
885 |
|
886 |
logging_fklinelog: FKLINELOG '=' QSTRING ';' |
887 |
{ |
888 |
if (conf_parser_ctx.pass == 2) |
889 |
strlcpy(ConfigLoggingEntry.klinelog, yylval.string, |
890 |
sizeof(ConfigLoggingEntry.klinelog)); |
891 |
}; |
892 |
|
893 |
logging_ioerrlog: FIOERRLOG '=' QSTRING ';' |
894 |
{ |
895 |
if (conf_parser_ctx.pass == 2) |
896 |
strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string, |
897 |
sizeof(ConfigLoggingEntry.ioerrlog)); |
898 |
}; |
899 |
|
900 |
logging_killlog: FKILLLOG '=' QSTRING ';' |
901 |
{ |
902 |
if (conf_parser_ctx.pass == 2) |
903 |
strlcpy(ConfigLoggingEntry.killlog, yylval.string, |
904 |
sizeof(ConfigLoggingEntry.killlog)); |
905 |
}; |
906 |
|
907 |
logging_log_level: LOG_LEVEL '=' T_L_CRIT ';' |
908 |
{ |
909 |
if (conf_parser_ctx.pass == 2) |
910 |
set_log_level(L_CRIT); |
911 |
} | LOG_LEVEL '=' T_L_ERROR ';' |
912 |
{ |
913 |
if (conf_parser_ctx.pass == 2) |
914 |
set_log_level(L_ERROR); |
915 |
} | LOG_LEVEL '=' T_L_WARN ';' |
916 |
{ |
917 |
if (conf_parser_ctx.pass == 2) |
918 |
set_log_level(L_WARN); |
919 |
} | LOG_LEVEL '=' T_L_NOTICE ';' |
920 |
{ |
921 |
if (conf_parser_ctx.pass == 2) |
922 |
set_log_level(L_NOTICE); |
923 |
} | LOG_LEVEL '=' T_L_TRACE ';' |
924 |
{ |
925 |
if (conf_parser_ctx.pass == 2) |
926 |
set_log_level(L_TRACE); |
927 |
} | LOG_LEVEL '=' T_L_INFO ';' |
928 |
{ |
929 |
if (conf_parser_ctx.pass == 2) |
930 |
set_log_level(L_INFO); |
931 |
} | LOG_LEVEL '=' T_L_DEBUG ';' |
932 |
{ |
933 |
if (conf_parser_ctx.pass == 2) |
934 |
set_log_level(L_DEBUG); |
935 |
}; |
936 |
|
937 |
logging_use_logging: USE_LOGGING '=' TBOOL ';' |
938 |
{ |
939 |
if (conf_parser_ctx.pass == 2) |
940 |
ConfigLoggingEntry.use_logging = yylval.number; |
941 |
}; |
942 |
|
943 |
/*************************************************************************** |
944 |
* section oper |
945 |
***************************************************************************/ |
946 |
oper_entry: OPERATOR |
947 |
{ |
948 |
if (conf_parser_ctx.pass == 2) |
949 |
{ |
950 |
yy_conf = make_conf_item(OPER_TYPE); |
951 |
yy_aconf = map_to_conf(yy_conf); |
952 |
SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */ |
953 |
} |
954 |
else |
955 |
{ |
956 |
MyFree(class_name); |
957 |
class_name = NULL; |
958 |
} |
959 |
} oper_name_b '{' oper_items '}' ';' |
960 |
{ |
961 |
if (conf_parser_ctx.pass == 2) |
962 |
{ |
963 |
struct CollectItem *yy_tmp; |
964 |
dlink_node *ptr; |
965 |
dlink_node *next_ptr; |
966 |
|
967 |
conf_add_class_to_conf(yy_conf, class_name); |
968 |
|
969 |
/* Now, make sure there is a copy of the "base" given oper |
970 |
* block in each of the collected copies |
971 |
*/ |
972 |
|
973 |
DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) |
974 |
{ |
975 |
struct AccessItem *new_aconf; |
976 |
struct ConfItem *new_conf; |
977 |
yy_tmp = ptr->data; |
978 |
|
979 |
new_conf = make_conf_item(OPER_TYPE); |
980 |
new_aconf = (struct AccessItem *)map_to_conf(new_conf); |
981 |
|
982 |
new_aconf->flags = yy_aconf->flags; |
983 |
|
984 |
if (yy_conf->name != NULL) |
985 |
DupString(new_conf->name, yy_conf->name); |
986 |
if (yy_tmp->user != NULL) |
987 |
DupString(new_aconf->user, yy_tmp->user); |
988 |
else |
989 |
DupString(new_aconf->user, "*"); |
990 |
if (yy_tmp->host != NULL) |
991 |
DupString(new_aconf->host, yy_tmp->host); |
992 |
else |
993 |
DupString(new_aconf->host, "*"); |
994 |
conf_add_class_to_conf(new_conf, class_name); |
995 |
if (yy_aconf->passwd != NULL) |
996 |
DupString(new_aconf->passwd, yy_aconf->passwd); |
997 |
|
998 |
new_aconf->port = yy_aconf->port; |
999 |
#ifdef HAVE_LIBCRYPTO |
1000 |
if (yy_aconf->rsa_public_key_file != NULL) |
1001 |
{ |
1002 |
BIO *file; |
1003 |
|
1004 |
DupString(new_aconf->rsa_public_key_file, |
1005 |
yy_aconf->rsa_public_key_file); |
1006 |
|
1007 |
file = BIO_new_file(yy_aconf->rsa_public_key_file, "r"); |
1008 |
new_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, |
1009 |
NULL, 0, NULL); |
1010 |
BIO_set_close(file, BIO_CLOSE); |
1011 |
BIO_free(file); |
1012 |
} |
1013 |
#endif |
1014 |
|
1015 |
#ifdef HAVE_LIBCRYPTO |
1016 |
if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key) |
1017 |
&& yy_tmp->host) |
1018 |
#else |
1019 |
if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host) |
1020 |
#endif |
1021 |
{ |
1022 |
conf_add_class_to_conf(new_conf, class_name); |
1023 |
if (yy_tmp->name != NULL) |
1024 |
DupString(new_conf->name, yy_tmp->name); |
1025 |
} |
1026 |
|
1027 |
dlinkDelete(&yy_tmp->node, &col_conf_list); |
1028 |
free_collect_item(yy_tmp); |
1029 |
} |
1030 |
|
1031 |
yy_conf = NULL; |
1032 |
yy_aconf = NULL; |
1033 |
|
1034 |
|
1035 |
MyFree(class_name); |
1036 |
class_name = NULL; |
1037 |
} |
1038 |
}; |
1039 |
|
1040 |
oper_name_b: | oper_name_t; |
1041 |
oper_items: oper_items oper_item | oper_item; |
1042 |
oper_item: oper_name | oper_user | oper_password | |
1043 |
oper_umodes | oper_class | oper_encrypted | |
1044 |
oper_rsa_public_key_file | oper_flags | error ';' ; |
1045 |
|
1046 |
oper_name: NAME '=' QSTRING ';' |
1047 |
{ |
1048 |
if (conf_parser_ctx.pass == 2) |
1049 |
{ |
1050 |
if (strlen(yylval.string) > OPERNICKLEN) |
1051 |
yylval.string[OPERNICKLEN] = '\0'; |
1052 |
|
1053 |
MyFree(yy_conf->name); |
1054 |
DupString(yy_conf->name, yylval.string); |
1055 |
} |
1056 |
}; |
1057 |
|
1058 |
oper_name_t: QSTRING |
1059 |
{ |
1060 |
if (conf_parser_ctx.pass == 2) |
1061 |
{ |
1062 |
if (strlen(yylval.string) > OPERNICKLEN) |
1063 |
yylval.string[OPERNICKLEN] = '\0'; |
1064 |
|
1065 |
MyFree(yy_conf->name); |
1066 |
DupString(yy_conf->name, yylval.string); |
1067 |
} |
1068 |
}; |
1069 |
|
1070 |
oper_user: USER '=' QSTRING ';' |
1071 |
{ |
1072 |
if (conf_parser_ctx.pass == 2) |
1073 |
{ |
1074 |
struct split_nuh_item nuh; |
1075 |
|
1076 |
nuh.nuhmask = yylval.string; |
1077 |
nuh.nickptr = NULL; |
1078 |
nuh.userptr = userbuf; |
1079 |
nuh.hostptr = hostbuf; |
1080 |
|
1081 |
nuh.nicksize = 0; |
1082 |
nuh.usersize = sizeof(userbuf); |
1083 |
nuh.hostsize = sizeof(hostbuf); |
1084 |
|
1085 |
split_nuh(&nuh); |
1086 |
|
1087 |
if (yy_aconf->user == NULL) |
1088 |
{ |
1089 |
DupString(yy_aconf->user, userbuf); |
1090 |
DupString(yy_aconf->host, hostbuf); |
1091 |
} |
1092 |
else |
1093 |
{ |
1094 |
struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem)); |
1095 |
|
1096 |
DupString(yy_tmp->user, userbuf); |
1097 |
DupString(yy_tmp->host, hostbuf); |
1098 |
|
1099 |
dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list); |
1100 |
} |
1101 |
} |
1102 |
}; |
1103 |
|
1104 |
oper_password: PASSWORD '=' QSTRING ';' |
1105 |
{ |
1106 |
if (conf_parser_ctx.pass == 2) |
1107 |
{ |
1108 |
if (yy_aconf->passwd != NULL) |
1109 |
memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); |
1110 |
|
1111 |
MyFree(yy_aconf->passwd); |
1112 |
DupString(yy_aconf->passwd, yylval.string); |
1113 |
} |
1114 |
}; |
1115 |
|
1116 |
oper_encrypted: ENCRYPTED '=' TBOOL ';' |
1117 |
{ |
1118 |
if (conf_parser_ctx.pass == 2) |
1119 |
{ |
1120 |
if (yylval.number) |
1121 |
SetConfEncrypted(yy_aconf); |
1122 |
else |
1123 |
ClearConfEncrypted(yy_aconf); |
1124 |
} |
1125 |
}; |
1126 |
|
1127 |
oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';' |
1128 |
{ |
1129 |
#ifdef HAVE_LIBCRYPTO |
1130 |
if (conf_parser_ctx.pass == 2) |
1131 |
{ |
1132 |
BIO *file; |
1133 |
|
1134 |
if (yy_aconf->rsa_public_key != NULL) |
1135 |
{ |
1136 |
RSA_free(yy_aconf->rsa_public_key); |
1137 |
yy_aconf->rsa_public_key = NULL; |
1138 |
} |
1139 |
|
1140 |
if (yy_aconf->rsa_public_key_file != NULL) |
1141 |
{ |
1142 |
MyFree(yy_aconf->rsa_public_key_file); |
1143 |
yy_aconf->rsa_public_key_file = NULL; |
1144 |
} |
1145 |
|
1146 |
DupString(yy_aconf->rsa_public_key_file, yylval.string); |
1147 |
file = BIO_new_file(yylval.string, "r"); |
1148 |
|
1149 |
if (file == NULL) |
1150 |
{ |
1151 |
yyerror("Ignoring rsa_public_key_file -- file doesn't exist"); |
1152 |
break; |
1153 |
} |
1154 |
|
1155 |
yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); |
1156 |
|
1157 |
if (yy_aconf->rsa_public_key == NULL) |
1158 |
{ |
1159 |
yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax."); |
1160 |
break; |
1161 |
} |
1162 |
|
1163 |
BIO_set_close(file, BIO_CLOSE); |
1164 |
BIO_free(file); |
1165 |
} |
1166 |
#endif /* HAVE_LIBCRYPTO */ |
1167 |
}; |
1168 |
|
1169 |
oper_class: CLASS '=' QSTRING ';' |
1170 |
{ |
1171 |
if (conf_parser_ctx.pass == 2) |
1172 |
{ |
1173 |
MyFree(class_name); |
1174 |
DupString(class_name, yylval.string); |
1175 |
} |
1176 |
}; |
1177 |
|
1178 |
oper_umodes: T_UMODES |
1179 |
{ |
1180 |
if (conf_parser_ctx.pass == 2) |
1181 |
yy_aconf->modes = 0; |
1182 |
} '=' oper_umodes_items ';' ; |
1183 |
|
1184 |
oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item; |
1185 |
oper_umodes_item: T_BOTS |
1186 |
{ |
1187 |
if (conf_parser_ctx.pass == 2) |
1188 |
yy_aconf->modes |= UMODE_BOTS; |
1189 |
} | T_CCONN |
1190 |
{ |
1191 |
if (conf_parser_ctx.pass == 2) |
1192 |
yy_aconf->modes |= UMODE_CCONN; |
1193 |
} | T_CCONN_FULL |
1194 |
{ |
1195 |
if (conf_parser_ctx.pass == 2) |
1196 |
yy_aconf->modes |= UMODE_CCONN_FULL; |
1197 |
} | T_DEAF |
1198 |
{ |
1199 |
if (conf_parser_ctx.pass == 2) |
1200 |
yy_aconf->modes |= UMODE_DEAF; |
1201 |
} | T_DEBUG |
1202 |
{ |
1203 |
if (conf_parser_ctx.pass == 2) |
1204 |
yy_aconf->modes |= UMODE_DEBUG; |
1205 |
} | T_FULL |
1206 |
{ |
1207 |
if (conf_parser_ctx.pass == 2) |
1208 |
yy_aconf->modes |= UMODE_FULL; |
1209 |
} | T_SKILL |
1210 |
{ |
1211 |
if (conf_parser_ctx.pass == 2) |
1212 |
yy_aconf->modes |= UMODE_SKILL; |
1213 |
} | T_NCHANGE |
1214 |
{ |
1215 |
if (conf_parser_ctx.pass == 2) |
1216 |
yy_aconf->modes |= UMODE_NCHANGE; |
1217 |
} | T_REJ |
1218 |
{ |
1219 |
if (conf_parser_ctx.pass == 2) |
1220 |
yy_aconf->modes |= UMODE_REJ; |
1221 |
} | T_UNAUTH |
1222 |
{ |
1223 |
if (conf_parser_ctx.pass == 2) |
1224 |
yy_aconf->modes |= UMODE_UNAUTH; |
1225 |
} | T_SPY |
1226 |
{ |
1227 |
if (conf_parser_ctx.pass == 2) |
1228 |
yy_aconf->modes |= UMODE_SPY; |
1229 |
} | T_EXTERNAL |
1230 |
{ |
1231 |
if (conf_parser_ctx.pass == 2) |
1232 |
yy_aconf->modes |= UMODE_EXTERNAL; |
1233 |
} | T_OPERWALL |
1234 |
{ |
1235 |
if (conf_parser_ctx.pass == 2) |
1236 |
yy_aconf->modes |= UMODE_OPERWALL; |
1237 |
} | T_SERVNOTICE |
1238 |
{ |
1239 |
if (conf_parser_ctx.pass == 2) |
1240 |
yy_aconf->modes |= UMODE_SERVNOTICE; |
1241 |
} | T_INVISIBLE |
1242 |
{ |
1243 |
if (conf_parser_ctx.pass == 2) |
1244 |
yy_aconf->modes |= UMODE_INVISIBLE; |
1245 |
} | T_WALLOP |
1246 |
{ |
1247 |
if (conf_parser_ctx.pass == 2) |
1248 |
yy_aconf->modes |= UMODE_WALLOP; |
1249 |
} | T_SOFTCALLERID |
1250 |
{ |
1251 |
if (conf_parser_ctx.pass == 2) |
1252 |
yy_aconf->modes |= UMODE_SOFTCALLERID; |
1253 |
} | T_CALLERID |
1254 |
{ |
1255 |
if (conf_parser_ctx.pass == 2) |
1256 |
yy_aconf->modes |= UMODE_CALLERID; |
1257 |
} | T_LOCOPS |
1258 |
{ |
1259 |
if (conf_parser_ctx.pass == 2) |
1260 |
yy_aconf->modes |= UMODE_LOCOPS; |
1261 |
}; |
1262 |
|
1263 |
oper_flags: IRCD_FLAGS |
1264 |
{ |
1265 |
} '=' oper_flags_items ';'; |
1266 |
|
1267 |
oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item; |
1268 |
oper_flags_item: NOT { not_atom = 1; } oper_flags_item_atom |
1269 |
| { not_atom = 0; } oper_flags_item_atom; |
1270 |
|
1271 |
oper_flags_item_atom: GLOBAL_KILL |
1272 |
{ |
1273 |
if (conf_parser_ctx.pass == 2) |
1274 |
{ |
1275 |
if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL; |
1276 |
else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL; |
1277 |
} |
1278 |
} | REMOTE |
1279 |
{ |
1280 |
if (conf_parser_ctx.pass == 2) |
1281 |
{ |
1282 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE; |
1283 |
else yy_aconf->port |= OPER_FLAG_REMOTE; |
1284 |
} |
1285 |
} | KLINE |
1286 |
{ |
1287 |
if (conf_parser_ctx.pass == 2) |
1288 |
{ |
1289 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_K; |
1290 |
else yy_aconf->port |= OPER_FLAG_K; |
1291 |
} |
1292 |
} | UNKLINE |
1293 |
{ |
1294 |
if (conf_parser_ctx.pass == 2) |
1295 |
{ |
1296 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE; |
1297 |
else yy_aconf->port |= OPER_FLAG_UNKLINE; |
1298 |
} |
1299 |
} | XLINE |
1300 |
{ |
1301 |
if (conf_parser_ctx.pass == 2) |
1302 |
{ |
1303 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_X; |
1304 |
else yy_aconf->port |= OPER_FLAG_X; |
1305 |
} |
1306 |
} | GLINE |
1307 |
{ |
1308 |
if (conf_parser_ctx.pass == 2) |
1309 |
{ |
1310 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE; |
1311 |
else yy_aconf->port |= OPER_FLAG_GLINE; |
1312 |
} |
1313 |
} | DIE |
1314 |
{ |
1315 |
if (conf_parser_ctx.pass == 2) |
1316 |
{ |
1317 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE; |
1318 |
else yy_aconf->port |= OPER_FLAG_DIE; |
1319 |
} |
1320 |
} | REHASH |
1321 |
{ |
1322 |
if (conf_parser_ctx.pass == 2) |
1323 |
{ |
1324 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH; |
1325 |
else yy_aconf->port |= OPER_FLAG_REHASH; |
1326 |
} |
1327 |
} | ADMIN |
1328 |
{ |
1329 |
if (conf_parser_ctx.pass == 2) |
1330 |
{ |
1331 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN; |
1332 |
else yy_aconf->port |= OPER_FLAG_ADMIN; |
1333 |
} |
1334 |
} | HIDDEN_ADMIN |
1335 |
{ |
1336 |
if (conf_parser_ctx.pass == 2) |
1337 |
{ |
1338 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN; |
1339 |
else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN; |
1340 |
} |
1341 |
} | NICK_CHANGES |
1342 |
{ |
1343 |
if (conf_parser_ctx.pass == 2) |
1344 |
{ |
1345 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_N; |
1346 |
else yy_aconf->port |= OPER_FLAG_N; |
1347 |
} |
1348 |
} | T_OPERWALL |
1349 |
{ |
1350 |
if (conf_parser_ctx.pass == 2) |
1351 |
{ |
1352 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL; |
1353 |
else yy_aconf->port |= OPER_FLAG_OPERWALL; |
1354 |
} |
1355 |
} | OPER_SPY_T |
1356 |
{ |
1357 |
if (conf_parser_ctx.pass == 2) |
1358 |
{ |
1359 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY; |
1360 |
else yy_aconf->port |= OPER_FLAG_OPER_SPY; |
1361 |
} |
1362 |
} | HIDDEN_OPER |
1363 |
{ |
1364 |
if (conf_parser_ctx.pass == 2) |
1365 |
{ |
1366 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER; |
1367 |
else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER; |
1368 |
} |
1369 |
} | REMOTEBAN |
1370 |
{ |
1371 |
if (conf_parser_ctx.pass == 2) |
1372 |
{ |
1373 |
if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN; |
1374 |
else yy_aconf->port |= OPER_FLAG_REMOTEBAN; |
1375 |
} |
1376 |
} | ENCRYPTED |
1377 |
{ |
1378 |
if (conf_parser_ctx.pass == 2) |
1379 |
{ |
1380 |
if (not_atom) ClearConfEncrypted(yy_aconf); |
1381 |
else SetConfEncrypted(yy_aconf); |
1382 |
} |
1383 |
}; |
1384 |
|
1385 |
|
1386 |
/*************************************************************************** |
1387 |
* section class |
1388 |
***************************************************************************/ |
1389 |
class_entry: CLASS |
1390 |
{ |
1391 |
if (conf_parser_ctx.pass == 1) |
1392 |
{ |
1393 |
yy_conf = make_conf_item(CLASS_TYPE); |
1394 |
yy_class = map_to_conf(yy_conf); |
1395 |
} |
1396 |
} class_name_b '{' class_items '}' ';' |
1397 |
{ |
1398 |
if (conf_parser_ctx.pass == 1) |
1399 |
{ |
1400 |
struct ConfItem *cconf = NULL; |
1401 |
struct ClassItem *class = NULL; |
1402 |
|
1403 |
if (yy_class_name == NULL) |
1404 |
delete_conf_item(yy_conf); |
1405 |
else |
1406 |
{ |
1407 |
cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL); |
1408 |
|
1409 |
if (cconf != NULL) /* The class existed already */ |
1410 |
{ |
1411 |
int user_count = 0; |
1412 |
|
1413 |
rebuild_cidr_class(cconf, yy_class); |
1414 |
|
1415 |
class = map_to_conf(cconf); |
1416 |
|
1417 |
user_count = class->curr_user_count; |
1418 |
memcpy(class, yy_class, sizeof(*class)); |
1419 |
class->curr_user_count = user_count; |
1420 |
class->active = 1; |
1421 |
|
1422 |
delete_conf_item(yy_conf); |
1423 |
|
1424 |
MyFree(cconf->name); /* Allows case change of class name */ |
1425 |
cconf->name = yy_class_name; |
1426 |
} |
1427 |
else /* Brand new class */ |
1428 |
{ |
1429 |
MyFree(yy_conf->name); /* just in case it was allocated */ |
1430 |
yy_conf->name = yy_class_name; |
1431 |
yy_class->active = 1; |
1432 |
} |
1433 |
} |
1434 |
|
1435 |
yy_class_name = NULL; |
1436 |
} |
1437 |
}; |
1438 |
|
1439 |
class_name_b: | class_name_t; |
1440 |
|
1441 |
class_items: class_items class_item | class_item; |
1442 |
class_item: class_name | |
1443 |
class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 | |
1444 |
class_ping_time | |
1445 |
class_ping_warning | |
1446 |
class_number_per_cidr | |
1447 |
class_number_per_ip | |
1448 |
class_connectfreq | |
1449 |
class_max_number | |
1450 |
class_max_global | |
1451 |
class_max_local | |
1452 |
class_max_ident | |
1453 |
class_sendq | |
1454 |
error ';' ; |
1455 |
|
1456 |
class_name: NAME '=' QSTRING ';' |
1457 |
{ |
1458 |
if (conf_parser_ctx.pass == 1) |
1459 |
{ |
1460 |
MyFree(yy_class_name); |
1461 |
DupString(yy_class_name, yylval.string); |
1462 |
} |
1463 |
}; |
1464 |
|
1465 |
class_name_t: QSTRING |
1466 |
{ |
1467 |
if (conf_parser_ctx.pass == 1) |
1468 |
{ |
1469 |
MyFree(yy_class_name); |
1470 |
DupString(yy_class_name, yylval.string); |
1471 |
} |
1472 |
}; |
1473 |
|
1474 |
class_ping_time: PING_TIME '=' timespec ';' |
1475 |
{ |
1476 |
if (conf_parser_ctx.pass == 1) |
1477 |
PingFreq(yy_class) = $3; |
1478 |
}; |
1479 |
|
1480 |
class_ping_warning: PING_WARNING '=' timespec ';' |
1481 |
{ |
1482 |
if (conf_parser_ctx.pass == 1) |
1483 |
PingWarning(yy_class) = $3; |
1484 |
}; |
1485 |
|
1486 |
class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';' |
1487 |
{ |
1488 |
if (conf_parser_ctx.pass == 1) |
1489 |
MaxPerIp(yy_class) = $3; |
1490 |
}; |
1491 |
|
1492 |
class_connectfreq: CONNECTFREQ '=' timespec ';' |
1493 |
{ |
1494 |
if (conf_parser_ctx.pass == 1) |
1495 |
ConFreq(yy_class) = $3; |
1496 |
}; |
1497 |
|
1498 |
class_max_number: MAX_NUMBER '=' NUMBER ';' |
1499 |
{ |
1500 |
if (conf_parser_ctx.pass == 1) |
1501 |
MaxTotal(yy_class) = $3; |
1502 |
}; |
1503 |
|
1504 |
class_max_global: MAX_GLOBAL '=' NUMBER ';' |
1505 |
{ |
1506 |
if (conf_parser_ctx.pass == 1) |
1507 |
MaxGlobal(yy_class) = $3; |
1508 |
}; |
1509 |
|
1510 |
class_max_local: MAX_LOCAL '=' NUMBER ';' |
1511 |
{ |
1512 |
if (conf_parser_ctx.pass == 1) |
1513 |
MaxLocal(yy_class) = $3; |
1514 |
}; |
1515 |
|
1516 |
class_max_ident: MAX_IDENT '=' NUMBER ';' |
1517 |
{ |
1518 |
if (conf_parser_ctx.pass == 1) |
1519 |
MaxIdent(yy_class) = $3; |
1520 |
}; |
1521 |
|
1522 |
class_sendq: SENDQ '=' sizespec ';' |
1523 |
{ |
1524 |
if (conf_parser_ctx.pass == 1) |
1525 |
MaxSendq(yy_class) = $3; |
1526 |
}; |
1527 |
|
1528 |
class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';' |
1529 |
{ |
1530 |
if (conf_parser_ctx.pass == 1) |
1531 |
CidrBitlenIPV4(yy_class) = $3; |
1532 |
}; |
1533 |
|
1534 |
class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';' |
1535 |
{ |
1536 |
if (conf_parser_ctx.pass == 1) |
1537 |
CidrBitlenIPV6(yy_class) = $3; |
1538 |
}; |
1539 |
|
1540 |
class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';' |
1541 |
{ |
1542 |
if (conf_parser_ctx.pass == 1) |
1543 |
NumberPerCidr(yy_class) = $3; |
1544 |
}; |
1545 |
|
1546 |
/*************************************************************************** |
1547 |
* section listen |
1548 |
***************************************************************************/ |
1549 |
listen_entry: LISTEN |
1550 |
{ |
1551 |
if (conf_parser_ctx.pass == 2) |
1552 |
{ |
1553 |
listener_address = NULL; |
1554 |
listener_flags = 0; |
1555 |
} |
1556 |
} '{' listen_items '}' ';' |
1557 |
{ |
1558 |
if (conf_parser_ctx.pass == 2) |
1559 |
{ |
1560 |
MyFree(listener_address); |
1561 |
listener_address = NULL; |
1562 |
} |
1563 |
}; |
1564 |
|
1565 |
listen_flags: IRCD_FLAGS |
1566 |
{ |
1567 |
listener_flags = 0; |
1568 |
} '=' listen_flags_items ';'; |
1569 |
|
1570 |
listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item; |
1571 |
listen_flags_item: T_SSL |
1572 |
{ |
1573 |
if (conf_parser_ctx.pass == 2) |
1574 |
listener_flags |= LISTENER_SSL; |
1575 |
} | HIDDEN |
1576 |
{ |
1577 |
if (conf_parser_ctx.pass == 2) |
1578 |
listener_flags |= LISTENER_HIDDEN; |
1579 |
} | T_SERVER |
1580 |
{ |
1581 |
if (conf_parser_ctx.pass == 2) |
1582 |
listener_flags |= LISTENER_SERVER; |
1583 |
}; |
1584 |
|
1585 |
|
1586 |
|
1587 |
listen_items: listen_items listen_item | listen_item; |
1588 |
listen_item: listen_port | listen_flags | listen_address | listen_host | error ';'; |
1589 |
|
1590 |
listen_port: PORT '=' port_items { listener_flags = 0; } ';'; |
1591 |
|
1592 |
port_items: port_items ',' port_item | port_item; |
1593 |
|
1594 |
port_item: NUMBER |
1595 |
{ |
1596 |
if (conf_parser_ctx.pass == 2) |
1597 |
{ |
1598 |
if ((listener_flags & LISTENER_SSL)) |
1599 |
#ifdef HAVE_LIBCRYPTO |
1600 |
if (!ServerInfo.server_ctx) |
1601 |
#endif |
1602 |
{ |
1603 |
yyerror("SSL not available - port closed"); |
1604 |
break; |
1605 |
} |
1606 |
add_listener($1, listener_address, listener_flags); |
1607 |
} |
1608 |
} | NUMBER TWODOTS NUMBER |
1609 |
{ |
1610 |
if (conf_parser_ctx.pass == 2) |
1611 |
{ |
1612 |
int i; |
1613 |
|
1614 |
if ((listener_flags & LISTENER_SSL)) |
1615 |
#ifdef HAVE_LIBCRYPTO |
1616 |
if (!ServerInfo.server_ctx) |
1617 |
#endif |
1618 |
{ |
1619 |
yyerror("SSL not available - port closed"); |
1620 |
break; |
1621 |
} |
1622 |
|
1623 |
for (i = $1; i <= $3; ++i) |
1624 |
add_listener(i, listener_address, listener_flags); |
1625 |
} |
1626 |
}; |
1627 |
|
1628 |
listen_address: IP '=' QSTRING ';' |
1629 |
{ |
1630 |
if (conf_parser_ctx.pass == 2) |
1631 |
{ |
1632 |
MyFree(listener_address); |
1633 |
DupString(listener_address, yylval.string); |
1634 |
} |
1635 |
}; |
1636 |
|
1637 |
listen_host: HOST '=' QSTRING ';' |
1638 |
{ |
1639 |
if (conf_parser_ctx.pass == 2) |
1640 |
{ |
1641 |
MyFree(listener_address); |
1642 |
DupString(listener_address, yylval.string); |
1643 |
} |
1644 |
}; |
1645 |
|
1646 |
/*************************************************************************** |
1647 |
* section auth |
1648 |
***************************************************************************/ |
1649 |
auth_entry: IRCD_AUTH |
1650 |
{ |
1651 |
if (conf_parser_ctx.pass == 2) |
1652 |
{ |
1653 |
yy_conf = make_conf_item(CLIENT_TYPE); |
1654 |
yy_aconf = map_to_conf(yy_conf); |
1655 |
} |
1656 |
else |
1657 |
{ |
1658 |
MyFree(class_name); |
1659 |
class_name = NULL; |
1660 |
} |
1661 |
} '{' auth_items '}' ';' |
1662 |
{ |
1663 |
if (conf_parser_ctx.pass == 2) |
1664 |
{ |
1665 |
struct CollectItem *yy_tmp = NULL; |
1666 |
dlink_node *ptr = NULL, *next_ptr = NULL; |
1667 |
|
1668 |
if (yy_aconf->user && yy_aconf->host) |
1669 |
{ |
1670 |
conf_add_class_to_conf(yy_conf, class_name); |
1671 |
add_conf_by_address(CONF_CLIENT, yy_aconf); |
1672 |
} |
1673 |
else |
1674 |
delete_conf_item(yy_conf); |
1675 |
|
1676 |
/* copy over settings from first struct */ |
1677 |
DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) |
1678 |
{ |
1679 |
struct AccessItem *new_aconf; |
1680 |
struct ConfItem *new_conf; |
1681 |
|
1682 |
new_conf = make_conf_item(CLIENT_TYPE); |
1683 |
new_aconf = map_to_conf(new_conf); |
1684 |
|
1685 |
yy_tmp = ptr->data; |
1686 |
|
1687 |
assert(yy_tmp->user && yy_tmp->host); |
1688 |
|
1689 |
if (yy_aconf->passwd != NULL) |
1690 |
DupString(new_aconf->passwd, yy_aconf->passwd); |
1691 |
if (yy_conf->name != NULL) |
1692 |
DupString(new_conf->name, yy_conf->name); |
1693 |
if (yy_aconf->passwd != NULL) |
1694 |
DupString(new_aconf->passwd, yy_aconf->passwd); |
1695 |
|
1696 |
new_aconf->flags = yy_aconf->flags; |
1697 |
new_aconf->port = yy_aconf->port; |
1698 |
|
1699 |
DupString(new_aconf->user, yy_tmp->user); |
1700 |
collapse(new_aconf->user); |
1701 |
|
1702 |
DupString(new_aconf->host, yy_tmp->host); |
1703 |
collapse(new_aconf->host); |
1704 |
|
1705 |
conf_add_class_to_conf(new_conf, class_name); |
1706 |
add_conf_by_address(CONF_CLIENT, new_aconf); |
1707 |
dlinkDelete(&yy_tmp->node, &col_conf_list); |
1708 |
free_collect_item(yy_tmp); |
1709 |
} |
1710 |
|
1711 |
MyFree(class_name); |
1712 |
class_name = NULL; |
1713 |
yy_conf = NULL; |
1714 |
yy_aconf = NULL; |
1715 |
} |
1716 |
}; |
1717 |
|
1718 |
auth_items: auth_items auth_item | auth_item; |
1719 |
auth_item: auth_user | auth_passwd | auth_class | auth_flags | |
1720 |
auth_spoof | auth_redir_serv | auth_redir_port | |
1721 |
auth_encrypted | error ';' ; |
1722 |
|
1723 |
auth_user: USER '=' QSTRING ';' |
1724 |
{ |
1725 |
if (conf_parser_ctx.pass == 2) |
1726 |
{ |
1727 |
struct CollectItem *yy_tmp = NULL; |
1728 |
struct split_nuh_item nuh; |
1729 |
|
1730 |
nuh.nuhmask = yylval.string; |
1731 |
nuh.nickptr = NULL; |
1732 |
nuh.userptr = userbuf; |
1733 |
nuh.hostptr = hostbuf; |
1734 |
|
1735 |
nuh.nicksize = 0; |
1736 |
nuh.usersize = sizeof(userbuf); |
1737 |
nuh.hostsize = sizeof(hostbuf); |
1738 |
|
1739 |
split_nuh(&nuh); |
1740 |
|
1741 |
if (yy_aconf->user == NULL) |
1742 |
{ |
1743 |
DupString(yy_aconf->user, userbuf); |
1744 |
DupString(yy_aconf->host, hostbuf); |
1745 |
} |
1746 |
else |
1747 |
{ |
1748 |
yy_tmp = MyMalloc(sizeof(struct CollectItem)); |
1749 |
|
1750 |
DupString(yy_tmp->user, userbuf); |
1751 |
DupString(yy_tmp->host, hostbuf); |
1752 |
|
1753 |
dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list); |
1754 |
} |
1755 |
} |
1756 |
}; |
1757 |
|
1758 |
/* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */ |
1759 |
|
1760 |
auth_passwd: PASSWORD '=' QSTRING ';' |
1761 |
{ |
1762 |
if (conf_parser_ctx.pass == 2) |
1763 |
{ |
1764 |
/* be paranoid */ |
1765 |
if (yy_aconf->passwd != NULL) |
1766 |
memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); |
1767 |
|
1768 |
MyFree(yy_aconf->passwd); |
1769 |
DupString(yy_aconf->passwd, yylval.string); |
1770 |
} |
1771 |
}; |
1772 |
|
1773 |
auth_class: CLASS '=' QSTRING ';' |
1774 |
{ |
1775 |
if (conf_parser_ctx.pass == 2) |
1776 |
{ |
1777 |
MyFree(class_name); |
1778 |
DupString(class_name, yylval.string); |
1779 |
} |
1780 |
}; |
1781 |
|
1782 |
auth_encrypted: ENCRYPTED '=' TBOOL ';' |
1783 |
{ |
1784 |
if (conf_parser_ctx.pass == 2) |
1785 |
{ |
1786 |
if (yylval.number) |
1787 |
SetConfEncrypted(yy_aconf); |
1788 |
else |
1789 |
ClearConfEncrypted(yy_aconf); |
1790 |
} |
1791 |
}; |
1792 |
|
1793 |
auth_flags: IRCD_FLAGS |
1794 |
{ |
1795 |
} '=' auth_flags_items ';'; |
1796 |
|
1797 |
auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item; |
1798 |
auth_flags_item: NOT { not_atom = 1; } auth_flags_item_atom |
1799 |
| { not_atom = 0; } auth_flags_item_atom; |
1800 |
|
1801 |
auth_flags_item_atom: SPOOF_NOTICE |
1802 |
{ |
1803 |
if (conf_parser_ctx.pass == 2) |
1804 |
{ |
1805 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE; |
1806 |
else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE; |
1807 |
} |
1808 |
} | EXCEED_LIMIT |
1809 |
{ |
1810 |
if (conf_parser_ctx.pass == 2) |
1811 |
{ |
1812 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT; |
1813 |
else yy_aconf->flags |= CONF_FLAGS_NOLIMIT; |
1814 |
} |
1815 |
} | KLINE_EXEMPT |
1816 |
{ |
1817 |
if (conf_parser_ctx.pass == 2) |
1818 |
{ |
1819 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE; |
1820 |
else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE; |
1821 |
} |
1822 |
} | NEED_IDENT |
1823 |
{ |
1824 |
if (conf_parser_ctx.pass == 2) |
1825 |
{ |
1826 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD; |
1827 |
else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD; |
1828 |
} |
1829 |
} | CAN_FLOOD |
1830 |
{ |
1831 |
if (conf_parser_ctx.pass == 2) |
1832 |
{ |
1833 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD; |
1834 |
else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD; |
1835 |
} |
1836 |
} | CAN_IDLE |
1837 |
{ |
1838 |
if (conf_parser_ctx.pass == 2) |
1839 |
{ |
1840 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED; |
1841 |
else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED; |
1842 |
} |
1843 |
} | NO_TILDE |
1844 |
{ |
1845 |
if (conf_parser_ctx.pass == 2) |
1846 |
{ |
1847 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE; |
1848 |
else yy_aconf->flags |= CONF_FLAGS_NO_TILDE; |
1849 |
} |
1850 |
} | GLINE_EXEMPT |
1851 |
{ |
1852 |
if (conf_parser_ctx.pass == 2) |
1853 |
{ |
1854 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE; |
1855 |
else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE; |
1856 |
} |
1857 |
} | RESV_EXEMPT |
1858 |
{ |
1859 |
if (conf_parser_ctx.pass == 2) |
1860 |
{ |
1861 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV; |
1862 |
else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV; |
1863 |
} |
1864 |
} | NEED_PASSWORD |
1865 |
{ |
1866 |
if (conf_parser_ctx.pass == 2) |
1867 |
{ |
1868 |
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD; |
1869 |
else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD; |
1870 |
} |
1871 |
}; |
1872 |
|
1873 |
/* XXX - need check for illegal hostnames here */ |
1874 |
auth_spoof: SPOOF '=' QSTRING ';' |
1875 |
{ |
1876 |
if (conf_parser_ctx.pass == 2) |
1877 |
{ |
1878 |
MyFree(yy_conf->name); |
1879 |
|
1880 |
if (strlen(yylval.string) < HOSTLEN) |
1881 |
{ |
1882 |
DupString(yy_conf->name, yylval.string); |
1883 |
yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; |
1884 |
} |
1885 |
else |
1886 |
{ |
1887 |
ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN); |
1888 |
yy_conf->name = NULL; |
1889 |
} |
1890 |
} |
1891 |
}; |
1892 |
|
1893 |
auth_redir_serv: REDIRSERV '=' QSTRING ';' |
1894 |
{ |
1895 |
if (conf_parser_ctx.pass == 2) |
1896 |
{ |
1897 |
yy_aconf->flags |= CONF_FLAGS_REDIR; |
1898 |
MyFree(yy_conf->name); |
1899 |
DupString(yy_conf->name, yylval.string); |
1900 |
} |
1901 |
}; |
1902 |
|
1903 |
auth_redir_port: REDIRPORT '=' NUMBER ';' |
1904 |
{ |
1905 |
if (conf_parser_ctx.pass == 2) |
1906 |
{ |
1907 |
yy_aconf->flags |= CONF_FLAGS_REDIR; |
1908 |
yy_aconf->port = $3; |
1909 |
} |
1910 |
}; |
1911 |
|
1912 |
|
1913 |
/*************************************************************************** |
1914 |
* section resv |
1915 |
***************************************************************************/ |
1916 |
resv_entry: RESV |
1917 |
{ |
1918 |
if (conf_parser_ctx.pass == 2) |
1919 |
{ |
1920 |
MyFree(resv_reason); |
1921 |
resv_reason = NULL; |
1922 |
} |
1923 |
} '{' resv_items '}' ';' |
1924 |
{ |
1925 |
if (conf_parser_ctx.pass == 2) |
1926 |
{ |
1927 |
MyFree(resv_reason); |
1928 |
resv_reason = NULL; |
1929 |
} |
1930 |
}; |
1931 |
|
1932 |
resv_items: resv_items resv_item | resv_item; |
1933 |
resv_item: resv_creason | resv_channel | resv_nick | error ';' ; |
1934 |
|
1935 |
resv_creason: REASON '=' QSTRING ';' |
1936 |
{ |
1937 |
if (conf_parser_ctx.pass == 2) |
1938 |
{ |
1939 |
MyFree(resv_reason); |
1940 |
DupString(resv_reason, yylval.string); |
1941 |
} |
1942 |
}; |
1943 |
|
1944 |
resv_channel: CHANNEL '=' QSTRING ';' |
1945 |
{ |
1946 |
if (conf_parser_ctx.pass == 2) |
1947 |
{ |
1948 |
if (IsChanPrefix(*yylval.string)) |
1949 |
{ |
1950 |
char def_reason[] = "No reason"; |
1951 |
|
1952 |
create_channel_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1); |
1953 |
} |
1954 |
} |
1955 |
/* ignore it for now.. but we really should make a warning if |
1956 |
* its an erroneous name --fl_ */ |
1957 |
}; |
1958 |
|
1959 |
resv_nick: NICK '=' QSTRING ';' |
1960 |
{ |
1961 |
if (conf_parser_ctx.pass == 2) |
1962 |
{ |
1963 |
char def_reason[] = "No reason"; |
1964 |
|
1965 |
create_nick_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1); |
1966 |
} |
1967 |
}; |
1968 |
|
1969 |
/*************************************************************************** |
1970 |
* section shared, for sharing remote klines etc. |
1971 |
***************************************************************************/ |
1972 |
shared_entry: T_SHARED |
1973 |
{ |
1974 |
if (conf_parser_ctx.pass == 2) |
1975 |
{ |
1976 |
yy_conf = make_conf_item(ULINE_TYPE); |
1977 |
yy_match_item = map_to_conf(yy_conf); |
1978 |
yy_match_item->action = SHARED_ALL; |
1979 |
} |
1980 |
} '{' shared_items '}' ';' |
1981 |
{ |
1982 |
if (conf_parser_ctx.pass == 2) |
1983 |
{ |
1984 |
yy_conf = NULL; |
1985 |
} |
1986 |
}; |
1987 |
|
1988 |
shared_items: shared_items shared_item | shared_item; |
1989 |
shared_item: shared_name | shared_user | shared_type | error ';' ; |
1990 |
|
1991 |
shared_name: NAME '=' QSTRING ';' |
1992 |
{ |
1993 |
if (conf_parser_ctx.pass == 2) |
1994 |
{ |
1995 |
MyFree(yy_conf->name); |
1996 |
DupString(yy_conf->name, yylval.string); |
1997 |
} |
1998 |
}; |
1999 |
|
2000 |
shared_user: USER '=' QSTRING ';' |
2001 |
{ |
2002 |
if (conf_parser_ctx.pass == 2) |
2003 |
{ |
2004 |
struct split_nuh_item nuh; |
2005 |
|
2006 |
nuh.nuhmask = yylval.string; |
2007 |
nuh.nickptr = NULL; |
2008 |
nuh.userptr = userbuf; |
2009 |
nuh.hostptr = hostbuf; |
2010 |
|
2011 |
nuh.nicksize = 0; |
2012 |
nuh.usersize = sizeof(userbuf); |
2013 |
nuh.hostsize = sizeof(hostbuf); |
2014 |
|
2015 |
split_nuh(&nuh); |
2016 |
|
2017 |
DupString(yy_match_item->user, userbuf); |
2018 |
DupString(yy_match_item->host, hostbuf); |
2019 |
} |
2020 |
}; |
2021 |
|
2022 |
shared_type: TYPE |
2023 |
{ |
2024 |
if (conf_parser_ctx.pass == 2) |
2025 |
yy_match_item->action = 0; |
2026 |
} '=' shared_types ';' ; |
2027 |
|
2028 |
shared_types: shared_types ',' shared_type_item | shared_type_item; |
2029 |
shared_type_item: KLINE |
2030 |
{ |
2031 |
if (conf_parser_ctx.pass == 2) |
2032 |
yy_match_item->action |= SHARED_KLINE; |
2033 |
} | TKLINE |
2034 |
{ |
2035 |
if (conf_parser_ctx.pass == 2) |
2036 |
yy_match_item->action |= SHARED_TKLINE; |
2037 |
} | UNKLINE |
2038 |
{ |
2039 |
if (conf_parser_ctx.pass == 2) |
2040 |
yy_match_item->action |= SHARED_UNKLINE; |
2041 |
} | XLINE |
2042 |
{ |
2043 |
if (conf_parser_ctx.pass == 2) |
2044 |
yy_match_item->action |= SHARED_XLINE; |
2045 |
} | TXLINE |
2046 |
{ |
2047 |
if (conf_parser_ctx.pass == 2) |
2048 |
yy_match_item->action |= SHARED_TXLINE; |
2049 |
} | T_UNXLINE |
2050 |
{ |
2051 |
if (conf_parser_ctx.pass == 2) |
2052 |
yy_match_item->action |= SHARED_UNXLINE; |
2053 |
} | RESV |
2054 |
{ |
2055 |
if (conf_parser_ctx.pass == 2) |
2056 |
yy_match_item->action |= SHARED_RESV; |
2057 |
} | TRESV |
2058 |
{ |
2059 |
if (conf_parser_ctx.pass == 2) |
2060 |
yy_match_item->action |= SHARED_TRESV; |
2061 |
} | T_UNRESV |
2062 |
{ |
2063 |
if (conf_parser_ctx.pass == 2) |
2064 |
yy_match_item->action |= SHARED_UNRESV; |
2065 |
} | T_LOCOPS |
2066 |
{ |
2067 |
if (conf_parser_ctx.pass == 2) |
2068 |
yy_match_item->action |= SHARED_LOCOPS; |
2069 |
} | T_ALL |
2070 |
{ |
2071 |
if (conf_parser_ctx.pass == 2) |
2072 |
yy_match_item->action = SHARED_ALL; |
2073 |
}; |
2074 |
|
2075 |
/*************************************************************************** |
2076 |
* section cluster |
2077 |
***************************************************************************/ |
2078 |
cluster_entry: T_CLUSTER |
2079 |
{ |
2080 |
if (conf_parser_ctx.pass == 2) |
2081 |
{ |
2082 |
yy_conf = make_conf_item(CLUSTER_TYPE); |
2083 |
yy_conf->flags = SHARED_ALL; |
2084 |
} |
2085 |
} '{' cluster_items '}' ';' |
2086 |
{ |
2087 |
if (conf_parser_ctx.pass == 2) |
2088 |
{ |
2089 |
if (yy_conf->name == NULL) |
2090 |
DupString(yy_conf->name, "*"); |
2091 |
yy_conf = NULL; |
2092 |
} |
2093 |
}; |
2094 |
|
2095 |
cluster_items: cluster_items cluster_item | cluster_item; |
2096 |
cluster_item: cluster_name | cluster_type | error ';' ; |
2097 |
|
2098 |
cluster_name: NAME '=' QSTRING ';' |
2099 |
{ |
2100 |
if (conf_parser_ctx.pass == 2) |
2101 |
DupString(yy_conf->name, yylval.string); |
2102 |
}; |
2103 |
|
2104 |
cluster_type: TYPE |
2105 |
{ |
2106 |
if (conf_parser_ctx.pass == 2) |
2107 |
yy_conf->flags = 0; |
2108 |
} '=' cluster_types ';' ; |
2109 |
|
2110 |
cluster_types: cluster_types ',' cluster_type_item | cluster_type_item; |
2111 |
cluster_type_item: KLINE |
2112 |
{ |
2113 |
if (conf_parser_ctx.pass == 2) |
2114 |
yy_conf->flags |= SHARED_KLINE; |
2115 |
} | TKLINE |
2116 |
{ |
2117 |
if (conf_parser_ctx.pass == 2) |
2118 |
yy_conf->flags |= SHARED_TKLINE; |
2119 |
} | UNKLINE |
2120 |
{ |
2121 |
if (conf_parser_ctx.pass == 2) |
2122 |
yy_conf->flags |= SHARED_UNKLINE; |
2123 |
} | XLINE |
2124 |
{ |
2125 |
if (conf_parser_ctx.pass == 2) |
2126 |
yy_conf->flags |= SHARED_XLINE; |
2127 |
} | TXLINE |
2128 |
{ |
2129 |
if (conf_parser_ctx.pass == 2) |
2130 |
yy_conf->flags |= SHARED_TXLINE; |
2131 |
} | T_UNXLINE |
2132 |
{ |
2133 |
if (conf_parser_ctx.pass == 2) |
2134 |
yy_conf->flags |= SHARED_UNXLINE; |
2135 |
} | RESV |
2136 |
{ |
2137 |
if (conf_parser_ctx.pass == 2) |
2138 |
yy_conf->flags |= SHARED_RESV; |
2139 |
} | TRESV |
2140 |
{ |
2141 |
if (conf_parser_ctx.pass == 2) |
2142 |
yy_conf->flags |= SHARED_TRESV; |
2143 |
} | T_UNRESV |
2144 |
{ |
2145 |
if (conf_parser_ctx.pass == 2) |
2146 |
yy_conf->flags |= SHARED_UNRESV; |
2147 |
} | T_LOCOPS |
2148 |
{ |
2149 |
if (conf_parser_ctx.pass == 2) |
2150 |
yy_conf->flags |= SHARED_LOCOPS; |
2151 |
} | T_ALL |
2152 |
{ |
2153 |
if (conf_parser_ctx.pass == 2) |
2154 |
yy_conf->flags = SHARED_ALL; |
2155 |
}; |
2156 |
|
2157 |
/*************************************************************************** |
2158 |
* section connect |
2159 |
***************************************************************************/ |
2160 |
connect_entry: CONNECT |
2161 |
{ |
2162 |
if (conf_parser_ctx.pass == 2) |
2163 |
{ |
2164 |
yy_conf = make_conf_item(SERVER_TYPE); |
2165 |
yy_aconf = (struct AccessItem *)map_to_conf(yy_conf); |
2166 |
yy_aconf->passwd = NULL; |
2167 |
/* defaults */ |
2168 |
yy_aconf->port = PORTNUM; |
2169 |
|
2170 |
if (ConfigFileEntry.burst_away) |
2171 |
yy_aconf->flags = CONF_FLAGS_BURST_AWAY; |
2172 |
} |
2173 |
else |
2174 |
{ |
2175 |
MyFree(class_name); |
2176 |
class_name = NULL; |
2177 |
} |
2178 |
} connect_name_b '{' connect_items '}' ';' |
2179 |
{ |
2180 |
if (conf_parser_ctx.pass == 2) |
2181 |
{ |
2182 |
struct CollectItem *yy_hconf=NULL; |
2183 |
struct CollectItem *yy_lconf=NULL; |
2184 |
dlink_node *ptr; |
2185 |
dlink_node *next_ptr; |
2186 |
#ifdef HAVE_LIBCRYPTO |
2187 |
if (yy_aconf->host && |
2188 |
((yy_aconf->passwd && yy_aconf->spasswd) || |
2189 |
(yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf)))) |
2190 |
#else /* !HAVE_LIBCRYPTO */ |
2191 |
if (yy_aconf->host && !IsConfCryptLink(yy_aconf) && |
2192 |
yy_aconf->passwd && yy_aconf->spasswd) |
2193 |
#endif /* !HAVE_LIBCRYPTO */ |
2194 |
{ |
2195 |
if (conf_add_server(yy_conf, class_name) == -1) |
2196 |
{ |
2197 |
delete_conf_item(yy_conf); |
2198 |
yy_conf = NULL; |
2199 |
yy_aconf = NULL; |
2200 |
} |
2201 |
} |
2202 |
else |
2203 |
{ |
2204 |
/* Even if yy_conf ->name is NULL |
2205 |
* should still unhook any hub/leaf confs still pending |
2206 |
*/ |
2207 |
unhook_hub_leaf_confs(); |
2208 |
|
2209 |
if (yy_conf->name != NULL) |
2210 |
{ |
2211 |
#ifndef HAVE_LIBCRYPTO |
2212 |
if (IsConfCryptLink(yy_aconf)) |
2213 |
yyerror("Ignoring connect block -- no OpenSSL support"); |
2214 |
#else |
2215 |
if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key) |
2216 |
yyerror("Ignoring connect block -- missing key"); |
2217 |
#endif |
2218 |
if (yy_aconf->host == NULL) |
2219 |
yyerror("Ignoring connect block -- missing host"); |
2220 |
else if (!IsConfCryptLink(yy_aconf) && |
2221 |
(!yy_aconf->passwd || !yy_aconf->spasswd)) |
2222 |
yyerror("Ignoring connect block -- missing password"); |
2223 |
} |
2224 |
|
2225 |
|
2226 |
/* XXX |
2227 |
* This fixes a try_connections() core (caused by invalid class_ptr |
2228 |
* pointers) reported by metalrock. That's an ugly fix, but there |
2229 |
* is currently no better way. The entire config subsystem needs an |
2230 |
* rewrite ASAP. make_conf_item() shouldn't really add things onto |
2231 |
* a doubly linked list immediately without any sanity checks! -Michael |
2232 |
*/ |
2233 |
delete_conf_item(yy_conf); |
2234 |
|
2235 |
yy_aconf = NULL; |
2236 |
yy_conf = NULL; |
2237 |
} |
2238 |
|
2239 |
/* |
2240 |
* yy_conf is still pointing at the server that is having |
2241 |
* a connect block built for it. This means, y_aconf->name |
2242 |
* points to the actual irc name this server will be known as. |
2243 |
* Now this new server has a set or even just one hub_mask (or leaf_mask) |
2244 |
* given in the link list at yy_hconf. Fill in the HUB confs |
2245 |
* from this link list now. |
2246 |
*/ |
2247 |
DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head) |
2248 |
{ |
2249 |
struct ConfItem *new_hub_conf; |
2250 |
struct MatchItem *match_item; |
2251 |
|
2252 |
yy_hconf = ptr->data; |
2253 |
|
2254 |
/* yy_conf == NULL is a fatal error for this connect block! */ |
2255 |
if ((yy_conf != NULL) && (yy_conf->name != NULL)) |
2256 |
{ |
2257 |
new_hub_conf = make_conf_item(HUB_TYPE); |
2258 |
match_item = (struct MatchItem *)map_to_conf(new_hub_conf); |
2259 |
DupString(new_hub_conf->name, yy_conf->name); |
2260 |
if (yy_hconf->user != NULL) |
2261 |
DupString(match_item->user, yy_hconf->user); |
2262 |
else |
2263 |
DupString(match_item->user, "*"); |
2264 |
if (yy_hconf->host != NULL) |
2265 |
DupString(match_item->host, yy_hconf->host); |
2266 |
else |
2267 |
DupString(match_item->host, "*"); |
2268 |
} |
2269 |
dlinkDelete(&yy_hconf->node, &hub_conf_list); |
2270 |
free_collect_item(yy_hconf); |
2271 |
} |
2272 |
|
2273 |
/* Ditto for the LEAF confs */ |
2274 |
|
2275 |
DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head) |
2276 |
{ |
2277 |
struct ConfItem *new_leaf_conf; |
2278 |
struct MatchItem *match_item; |
2279 |
|
2280 |
yy_lconf = ptr->data; |
2281 |
|
2282 |
if ((yy_conf != NULL) && (yy_conf->name != NULL)) |
2283 |
{ |
2284 |
new_leaf_conf = make_conf_item(LEAF_TYPE); |
2285 |
match_item = (struct MatchItem *)map_to_conf(new_leaf_conf); |
2286 |
DupString(new_leaf_conf->name, yy_conf->name); |
2287 |
if (yy_lconf->user != NULL) |
2288 |
DupString(match_item->user, yy_lconf->user); |
2289 |
else |
2290 |
DupString(match_item->user, "*"); |
2291 |
if (yy_lconf->host != NULL) |
2292 |
DupString(match_item->host, yy_lconf->host); |
2293 |
else |
2294 |
DupString(match_item->host, "*"); |
2295 |
} |
2296 |
dlinkDelete(&yy_lconf->node, &leaf_conf_list); |
2297 |
free_collect_item(yy_lconf); |
2298 |
} |
2299 |
MyFree(class_name); |
2300 |
class_name = NULL; |
2301 |
yy_conf = NULL; |
2302 |
yy_aconf = NULL; |
2303 |
} |
2304 |
}; |
2305 |
|
2306 |
connect_name_b: | connect_name_t; |
2307 |
connect_items: connect_items connect_item | connect_item; |
2308 |
connect_item: connect_name | connect_host | connect_vhost | |
2309 |
connect_send_password | connect_accept_password | |
2310 |
connect_aftype | connect_port | connect_fakename | |
2311 |
connect_flags | connect_hub_mask | connect_leaf_mask | |
2312 |
connect_class | connect_encrypted | |
2313 |
connect_rsa_public_key_file | connect_cipher_preference | |
2314 |
error ';' ; |
2315 |
|
2316 |
connect_name: NAME '=' QSTRING ';' |
2317 |
{ |
2318 |
if (conf_parser_ctx.pass == 2) |
2319 |
{ |
2320 |
if (yy_conf->name != NULL) |
2321 |
yyerror("Multiple connect name entry"); |
2322 |
|
2323 |
MyFree(yy_conf->name); |
2324 |
DupString(yy_conf->name, yylval.string); |
2325 |
} |
2326 |
}; |
2327 |
|
2328 |
connect_name_t: QSTRING |
2329 |
{ |
2330 |
if (conf_parser_ctx.pass == 2) |
2331 |
{ |
2332 |
if (yy_conf->name != NULL) |
2333 |
yyerror("Multiple connect name entry"); |
2334 |
|
2335 |
MyFree(yy_conf->name); |
2336 |
DupString(yy_conf->name, yylval.string); |
2337 |
} |
2338 |
}; |
2339 |
|
2340 |
connect_host: HOST '=' QSTRING ';' |
2341 |
{ |
2342 |
if (conf_parser_ctx.pass == 2) |
2343 |
{ |
2344 |
MyFree(yy_aconf->host); |
2345 |
DupString(yy_aconf->host, yylval.string); |
2346 |
} |
2347 |
}; |
2348 |
|
2349 |
connect_vhost: VHOST '=' QSTRING ';' |
2350 |
{ |
2351 |
if (conf_parser_ctx.pass == 2) |
2352 |
{ |
2353 |
struct addrinfo hints, *res; |
2354 |
|
2355 |
memset(&hints, 0, sizeof(hints)); |
2356 |
|
2357 |
hints.ai_family = AF_UNSPEC; |
2358 |
hints.ai_socktype = SOCK_STREAM; |
2359 |
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
2360 |
|
2361 |
if (irc_getaddrinfo(yylval.string, NULL, &hints, &res)) |
2362 |
ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string); |
2363 |
else |
2364 |
{ |
2365 |
assert(res != NULL); |
2366 |
|
2367 |
memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen); |
2368 |
yy_aconf->my_ipnum.ss.ss_family = res->ai_family; |
2369 |
yy_aconf->my_ipnum.ss_len = res->ai_addrlen; |
2370 |
irc_freeaddrinfo(res); |
2371 |
} |
2372 |
} |
2373 |
}; |
2374 |
|
2375 |
connect_send_password: SEND_PASSWORD '=' QSTRING ';' |
2376 |
{ |
2377 |
if (conf_parser_ctx.pass == 2) |
2378 |
{ |
2379 |
if ($3[0] == ':') |
2380 |
yyerror("Server passwords cannot begin with a colon"); |
2381 |
else if (strchr($3, ' ') != NULL) |
2382 |
yyerror("Server passwords cannot contain spaces"); |
2383 |
else { |
2384 |
if (yy_aconf->spasswd != NULL) |
2385 |
memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd)); |
2386 |
|
2387 |
MyFree(yy_aconf->spasswd); |
2388 |
DupString(yy_aconf->spasswd, yylval.string); |
2389 |
} |
2390 |
} |
2391 |
}; |
2392 |
|
2393 |
connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';' |
2394 |
{ |
2395 |
if (conf_parser_ctx.pass == 2) |
2396 |
{ |
2397 |
if ($3[0] == ':') |
2398 |
yyerror("Server passwords cannot begin with a colon"); |
2399 |
else if (strchr($3, ' ') != NULL) |
2400 |
yyerror("Server passwords cannot contain spaces"); |
2401 |
else { |
2402 |
if (yy_aconf->passwd != NULL) |
2403 |
memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); |
2404 |
|
2405 |
MyFree(yy_aconf->passwd); |
2406 |
DupString(yy_aconf->passwd, yylval.string); |
2407 |
} |
2408 |
} |
2409 |
}; |
2410 |
|
2411 |
connect_port: PORT '=' NUMBER ';' |
2412 |
{ |
2413 |
if (conf_parser_ctx.pass == 2) |
2414 |
yy_aconf->port = $3; |
2415 |
}; |
2416 |
|
2417 |
connect_aftype: AFTYPE '=' T_IPV4 ';' |
2418 |
{ |
2419 |
if (conf_parser_ctx.pass == 2) |
2420 |
yy_aconf->aftype = AF_INET; |
2421 |
} | AFTYPE '=' T_IPV6 ';' |
2422 |
{ |
2423 |
#ifdef IPV6 |
2424 |
if (conf_parser_ctx.pass == 2) |
2425 |
yy_aconf->aftype = AF_INET6; |
2426 |
#endif |
2427 |
}; |
2428 |
|
2429 |
connect_fakename: FAKENAME '=' QSTRING ';' |
2430 |
{ |
2431 |
if (conf_parser_ctx.pass == 2) |
2432 |
{ |
2433 |
MyFree(yy_aconf->fakename); |
2434 |
DupString(yy_aconf->fakename, yylval.string); |
2435 |
} |
2436 |
}; |
2437 |
|
2438 |
connect_flags: IRCD_FLAGS |
2439 |
{ |
2440 |
} '=' connect_flags_items ';'; |
2441 |
|
2442 |
connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item; |
2443 |
connect_flags_item: NOT { not_atom = 1; } connect_flags_item_atom |
2444 |
| { not_atom = 0; } connect_flags_item_atom; |
2445 |
|
2446 |
connect_flags_item_atom: COMPRESSED |
2447 |
{ |
2448 |
if (conf_parser_ctx.pass == 2) |
2449 |
#ifndef HAVE_LIBZ |
2450 |
yyerror("Ignoring flags = compressed; -- no zlib support"); |
2451 |
#else |
2452 |
{ |
2453 |
if (not_atom)ClearConfCompressed(yy_aconf); |
2454 |
else SetConfCompressed(yy_aconf); |
2455 |
} |
2456 |
#endif |
2457 |
} | CRYPTLINK |
2458 |
{ |
2459 |
if (conf_parser_ctx.pass == 2) |
2460 |
{ |
2461 |
if (not_atom)ClearConfCryptLink(yy_aconf); |
2462 |
else SetConfCryptLink(yy_aconf); |
2463 |
} |
2464 |
} | AUTOCONN |
2465 |
{ |
2466 |
if (conf_parser_ctx.pass == 2) |
2467 |
{ |
2468 |
if (not_atom)ClearConfAllowAutoConn(yy_aconf); |
2469 |
else SetConfAllowAutoConn(yy_aconf); |
2470 |
} |
2471 |
} | BURST_AWAY |
2472 |
{ |
2473 |
if (conf_parser_ctx.pass == 2) |
2474 |
{ |
2475 |
if (not_atom)ClearConfAwayBurst(yy_aconf); |
2476 |
else SetConfAwayBurst(yy_aconf); |
2477 |
} |
2478 |
} | TOPICBURST |
2479 |
{ |
2480 |
if (conf_parser_ctx.pass == 2) |
2481 |
{ |
2482 |
if (not_atom)ClearConfTopicBurst(yy_aconf); |
2483 |
else SetConfTopicBurst(yy_aconf); |
2484 |
} |
2485 |
} |
2486 |
; |
2487 |
|
2488 |
connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';' |
2489 |
{ |
2490 |
#ifdef HAVE_LIBCRYPTO |
2491 |
if (conf_parser_ctx.pass == 2) |
2492 |
{ |
2493 |
BIO *file; |
2494 |
|
2495 |
if (yy_aconf->rsa_public_key != NULL) |
2496 |
{ |
2497 |
RSA_free(yy_aconf->rsa_public_key); |
2498 |
yy_aconf->rsa_public_key = NULL; |
2499 |
} |
2500 |
|
2501 |
if (yy_aconf->rsa_public_key_file != NULL) |
2502 |
{ |
2503 |
MyFree(yy_aconf->rsa_public_key_file); |
2504 |
yy_aconf->rsa_public_key_file = NULL; |
2505 |
} |
2506 |
|
2507 |
DupString(yy_aconf->rsa_public_key_file, yylval.string); |
2508 |
|
2509 |
if ((file = BIO_new_file(yylval.string, "r")) == NULL) |
2510 |
{ |
2511 |
yyerror("Ignoring rsa_public_key_file -- file doesn't exist"); |
2512 |
break; |
2513 |
} |
2514 |
|
2515 |
yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); |
2516 |
|
2517 |
if (yy_aconf->rsa_public_key == NULL) |
2518 |
{ |
2519 |
yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax."); |
2520 |
break; |
2521 |
} |
2522 |
|
2523 |
BIO_set_close(file, BIO_CLOSE); |
2524 |
BIO_free(file); |
2525 |
} |
2526 |
#endif /* HAVE_LIBCRYPTO */ |
2527 |
}; |
2528 |
|
2529 |
connect_encrypted: ENCRYPTED '=' TBOOL ';' |
2530 |
{ |
2531 |
if (conf_parser_ctx.pass == 2) |
2532 |
{ |
2533 |
if (yylval.number) |
2534 |
yy_aconf->flags |= CONF_FLAGS_ENCRYPTED; |
2535 |
else |
2536 |
yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED; |
2537 |
} |
2538 |
}; |
2539 |
|
2540 |
connect_hub_mask: HUB_MASK '=' QSTRING ';' |
2541 |
{ |
2542 |
if (conf_parser_ctx.pass == 2) |
2543 |
{ |
2544 |
struct CollectItem *yy_tmp; |
2545 |
|
2546 |
yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem)); |
2547 |
DupString(yy_tmp->host, yylval.string); |
2548 |
DupString(yy_tmp->user, "*"); |
2549 |
dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list); |
2550 |
} |
2551 |
}; |
2552 |
|
2553 |
connect_leaf_mask: LEAF_MASK '=' QSTRING ';' |
2554 |
{ |
2555 |
if (conf_parser_ctx.pass == 2) |
2556 |
{ |
2557 |
struct CollectItem *yy_tmp; |
2558 |
|
2559 |
yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem)); |
2560 |
DupString(yy_tmp->host, yylval.string); |
2561 |
DupString(yy_tmp->user, "*"); |
2562 |
dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list); |
2563 |
} |
2564 |
}; |
2565 |
|
2566 |
connect_class: CLASS '=' QSTRING ';' |
2567 |
{ |
2568 |
if (conf_parser_ctx.pass == 2) |
2569 |
{ |
2570 |
MyFree(class_name); |
2571 |
DupString(class_name, yylval.string); |
2572 |
} |
2573 |
}; |
2574 |
|
2575 |
connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';' |
2576 |
{ |
2577 |
#ifdef HAVE_LIBCRYPTO |
2578 |
if (conf_parser_ctx.pass == 2) |
2579 |
{ |
2580 |
struct EncCapability *ecap; |
2581 |
const char *cipher_name; |
2582 |
int found = 0; |
2583 |
|
2584 |
yy_aconf->cipher_preference = NULL; |
2585 |
cipher_name = yylval.string; |
2586 |
|
2587 |
for (ecap = CipherTable; ecap->name; ecap++) |
2588 |
{ |
2589 |
if ((irccmp(ecap->name, cipher_name) == 0) && |
2590 |
(ecap->cap & CAP_ENC_MASK)) |
2591 |
{ |
2592 |
yy_aconf->cipher_preference = ecap; |
2593 |
found = 1; |
2594 |
break; |
2595 |
} |
2596 |
} |
2597 |
|
2598 |
if (!found) |
2599 |
yyerror("Invalid cipher"); |
2600 |
} |
2601 |
#else |
2602 |
if (conf_parser_ctx.pass == 2) |
2603 |
yyerror("Ignoring cipher_preference -- no OpenSSL support"); |
2604 |
#endif |
2605 |
}; |
2606 |
|
2607 |
/*************************************************************************** |
2608 |
* section kill |
2609 |
***************************************************************************/ |
2610 |
kill_entry: KILL |
2611 |
{ |
2612 |
if (conf_parser_ctx.pass == 2) |
2613 |
{ |
2614 |
userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0'; |
2615 |
regex_ban = 0; |
2616 |
} |
2617 |
} '{' kill_items '}' ';' |
2618 |
{ |
2619 |
if (conf_parser_ctx.pass == 2) |
2620 |
{ |
2621 |
if (userbuf[0] && hostbuf[0]) |
2622 |
{ |
2623 |
if (regex_ban) |
2624 |
{ |
2625 |
#ifdef HAVE_LIBPCRE |
2626 |
void *exp_user = NULL; |
2627 |
void *exp_host = NULL; |
2628 |
const char *errptr = NULL; |
2629 |
|
2630 |
if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) || |
2631 |
!(exp_host = ircd_pcre_compile(hostbuf, &errptr))) |
2632 |
{ |
2633 |
ilog(L_ERROR, "Failed to add regular expression based K-Line: %s", |
2634 |
errptr); |
2635 |
break; |
2636 |
} |
2637 |
|
2638 |
yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE)); |
2639 |
yy_aconf->regexuser = exp_user; |
2640 |
yy_aconf->regexhost = exp_host; |
2641 |
|
2642 |
DupString(yy_aconf->user, userbuf); |
2643 |
DupString(yy_aconf->host, hostbuf); |
2644 |
|
2645 |
if (reasonbuf[0]) |
2646 |
DupString(yy_aconf->reason, reasonbuf); |
2647 |
else |
2648 |
DupString(yy_aconf->reason, "No reason"); |
2649 |
#else |
2650 |
ilog(L_ERROR, "Failed to add regular expression based K-Line: no PCRE support"); |
2651 |
break; |
2652 |
#endif |
2653 |
} |
2654 |
else |
2655 |
{ |
2656 |
yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE)); |
2657 |
|
2658 |
DupString(yy_aconf->user, userbuf); |
2659 |
DupString(yy_aconf->host, hostbuf); |
2660 |
|
2661 |
if (reasonbuf[0]) |
2662 |
DupString(yy_aconf->reason, reasonbuf); |
2663 |
else |
2664 |
DupString(yy_aconf->reason, "No reason"); |
2665 |
add_conf_by_address(CONF_KILL, yy_aconf); |
2666 |
} |
2667 |
} |
2668 |
|
2669 |
yy_aconf = NULL; |
2670 |
} |
2671 |
}; |
2672 |
|
2673 |
kill_type: TYPE |
2674 |
{ |
2675 |
} '=' kill_type_items ';'; |
2676 |
|
2677 |
kill_type_items: kill_type_items ',' kill_type_item | kill_type_item; |
2678 |
kill_type_item: REGEX_T |
2679 |
{ |
2680 |
if (conf_parser_ctx.pass == 2) |
2681 |
regex_ban = 1; |
2682 |
}; |
2683 |
|
2684 |
kill_items: kill_items kill_item | kill_item; |
2685 |
kill_item: kill_user | kill_reason | kill_type | error; |
2686 |
|
2687 |
kill_user: USER '=' QSTRING ';' |
2688 |
{ |
2689 |
if (conf_parser_ctx.pass == 2) |
2690 |
{ |
2691 |
struct split_nuh_item nuh; |
2692 |
|
2693 |
nuh.nuhmask = yylval.string; |
2694 |
nuh.nickptr = NULL; |
2695 |
nuh.userptr = userbuf; |
2696 |
nuh.hostptr = hostbuf; |
2697 |
|
2698 |
nuh.nicksize = 0; |
2699 |
nuh.usersize = sizeof(userbuf); |
2700 |
nuh.hostsize = sizeof(hostbuf); |
2701 |
|
2702 |
split_nuh(&nuh); |
2703 |
} |
2704 |
}; |
2705 |
|
2706 |
kill_reason: REASON '=' QSTRING ';' |
2707 |
{ |
2708 |
if (conf_parser_ctx.pass == 2) |
2709 |
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); |
2710 |
}; |
2711 |
|
2712 |
/*************************************************************************** |
2713 |
* section deny |
2714 |
***************************************************************************/ |
2715 |
deny_entry: DENY |
2716 |
{ |
2717 |
if (conf_parser_ctx.pass == 2) |
2718 |
hostbuf[0] = reasonbuf[0] = '\0'; |
2719 |
} '{' deny_items '}' ';' |
2720 |
{ |
2721 |
if (conf_parser_ctx.pass == 2) |
2722 |
{ |
2723 |
if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST) |
2724 |
{ |
2725 |
yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE)); |
2726 |
DupString(yy_aconf->host, hostbuf); |
2727 |
|
2728 |
if (reasonbuf[0]) |
2729 |
DupString(yy_aconf->reason, reasonbuf); |
2730 |
else |
2731 |
DupString(yy_aconf->reason, "No reason"); |
2732 |
add_conf_by_address(CONF_DLINE, yy_aconf); |
2733 |
yy_aconf = NULL; |
2734 |
} |
2735 |
} |
2736 |
}; |
2737 |
|
2738 |
deny_items: deny_items deny_item | deny_item; |
2739 |
deny_item: deny_ip | deny_reason | error; |
2740 |
|
2741 |
deny_ip: IP '=' QSTRING ';' |
2742 |
{ |
2743 |
if (conf_parser_ctx.pass == 2) |
2744 |
strlcpy(hostbuf, yylval.string, sizeof(hostbuf)); |
2745 |
}; |
2746 |
|
2747 |
deny_reason: REASON '=' QSTRING ';' |
2748 |
{ |
2749 |
if (conf_parser_ctx.pass == 2) |
2750 |
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); |
2751 |
}; |
2752 |
|
2753 |
/*************************************************************************** |
2754 |
* section exempt |
2755 |
***************************************************************************/ |
2756 |
exempt_entry: EXEMPT '{' exempt_items '}' ';'; |
2757 |
|
2758 |
exempt_items: exempt_items exempt_item | exempt_item; |
2759 |
exempt_item: exempt_ip | error; |
2760 |
|
2761 |
exempt_ip: IP '=' QSTRING ';' |
2762 |
{ |
2763 |
if (conf_parser_ctx.pass == 2) |
2764 |
{ |
2765 |
if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST) |
2766 |
{ |
2767 |
yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE)); |
2768 |
DupString(yy_aconf->host, yylval.string); |
2769 |
|
2770 |
add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf); |
2771 |
yy_aconf = NULL; |
2772 |
} |
2773 |
} |
2774 |
}; |
2775 |
|
2776 |
/*************************************************************************** |
2777 |
* section gecos |
2778 |
***************************************************************************/ |
2779 |
gecos_entry: GECOS |
2780 |
{ |
2781 |
if (conf_parser_ctx.pass == 2) |
2782 |
{ |
2783 |
regex_ban = 0; |
2784 |
reasonbuf[0] = gecos_name[0] = '\0'; |
2785 |
} |
2786 |
} '{' gecos_items '}' ';' |
2787 |
{ |
2788 |
if (conf_parser_ctx.pass == 2) |
2789 |
{ |
2790 |
if (gecos_name[0]) |
2791 |
{ |
2792 |
if (regex_ban) |
2793 |
{ |
2794 |
#ifdef HAVE_LIBPCRE |
2795 |
void *exp_p = NULL; |
2796 |
const char *errptr = NULL; |
2797 |
|
2798 |
if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr))) |
2799 |
{ |
2800 |
ilog(L_ERROR, "Failed to add regular expression based X-Line: %s", |
2801 |
errptr); |
2802 |
break; |
2803 |
} |
2804 |
|
2805 |
yy_conf = make_conf_item(RXLINE_TYPE); |
2806 |
yy_conf->regexpname = exp_p; |
2807 |
#else |
2808 |
ilog(L_ERROR, "Failed to add regular expression based X-Line: no PCRE support"); |
2809 |
break; |
2810 |
#endif |
2811 |
} |
2812 |
else |
2813 |
yy_conf = make_conf_item(XLINE_TYPE); |
2814 |
|
2815 |
yy_match_item = map_to_conf(yy_conf); |
2816 |
DupString(yy_conf->name, gecos_name); |
2817 |
|
2818 |
if (reasonbuf[0]) |
2819 |
DupString(yy_match_item->reason, reasonbuf); |
2820 |
else |
2821 |
DupString(yy_match_item->reason, "No reason"); |
2822 |
} |
2823 |
} |
2824 |
}; |
2825 |
|
2826 |
gecos_flags: TYPE |
2827 |
{ |
2828 |
} '=' gecos_flags_items ';'; |
2829 |
|
2830 |
gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item; |
2831 |
gecos_flags_item: REGEX_T |
2832 |
{ |
2833 |
if (conf_parser_ctx.pass == 2) |
2834 |
regex_ban = 1; |
2835 |
}; |
2836 |
|
2837 |
gecos_items: gecos_items gecos_item | gecos_item; |
2838 |
gecos_item: gecos_name | gecos_reason | gecos_flags | error; |
2839 |
|
2840 |
gecos_name: NAME '=' QSTRING ';' |
2841 |
{ |
2842 |
if (conf_parser_ctx.pass == 2) |
2843 |
strlcpy(gecos_name, yylval.string, sizeof(gecos_name)); |
2844 |
}; |
2845 |
|
2846 |
gecos_reason: REASON '=' QSTRING ';' |
2847 |
{ |
2848 |
if (conf_parser_ctx.pass == 2) |
2849 |
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); |
2850 |
}; |
2851 |
|
2852 |
/*************************************************************************** |
2853 |
* section general |
2854 |
***************************************************************************/ |
2855 |
general_entry: GENERAL |
2856 |
'{' general_items '}' ';'; |
2857 |
|
2858 |
general_items: general_items general_item | general_item; |
2859 |
general_item: general_hide_spoof_ips | general_ignore_bogus_ts | |
2860 |
general_failed_oper_notice | general_anti_nick_flood | |
2861 |
general_max_nick_time | general_max_nick_changes | |
2862 |
general_max_accept | general_anti_spam_exit_message_time | |
2863 |
general_ts_warn_delta | general_ts_max_delta | |
2864 |
general_kill_chase_time_limit | general_kline_with_reason | |
2865 |
general_kline_reason | general_invisible_on_connect | |
2866 |
general_warn_no_nline | general_dots_in_ident | |
2867 |
general_stats_o_oper_only | general_stats_k_oper_only | |
2868 |
general_pace_wait | general_stats_i_oper_only | |
2869 |
general_pace_wait_simple | general_stats_P_oper_only | |
2870 |
general_short_motd | general_no_oper_flood | |
2871 |
general_true_no_oper_flood | general_oper_pass_resv | |
2872 |
general_idletime | general_message_locale | |
2873 |
general_oper_only_umodes | general_max_targets | |
2874 |
general_use_egd | general_egdpool_path | |
2875 |
general_oper_umodes | general_caller_id_wait | |
2876 |
general_opers_bypass_callerid | general_default_floodcount | |
2877 |
general_min_nonwildcard | general_min_nonwildcard_simple | |
2878 |
general_servlink_path | general_disable_remote_commands | |
2879 |
general_default_cipher_preference | |
2880 |
general_compression_level | general_client_flood | |
2881 |
general_throttle_time | general_havent_read_conf | |
2882 |
general_ping_cookie | |
2883 |
general_disable_auth | general_burst_away | |
2884 |
general_tkline_expire_notices | general_gline_min_cidr | |
2885 |
general_gline_min_cidr6 | general_use_whois_actually | |
2886 |
general_reject_hold_time | general_stats_e_disabled | |
2887 |
general_max_watch | |
2888 |
error; |
2889 |
|
2890 |
|
2891 |
general_max_watch: MAX_WATCH '=' NUMBER ';' |
2892 |
{ |
2893 |
ConfigFileEntry.max_watch = $3; |
2894 |
}; |
2895 |
|
2896 |
general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';' |
2897 |
{ |
2898 |
ConfigFileEntry.gline_min_cidr = $3; |
2899 |
}; |
2900 |
|
2901 |
general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';' |
2902 |
{ |
2903 |
ConfigFileEntry.gline_min_cidr6 = $3; |
2904 |
}; |
2905 |
|
2906 |
general_burst_away: BURST_AWAY '=' TBOOL ';' |
2907 |
{ |
2908 |
ConfigFileEntry.burst_away = yylval.number; |
2909 |
}; |
2910 |
|
2911 |
general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';' |
2912 |
{ |
2913 |
ConfigFileEntry.use_whois_actually = yylval.number; |
2914 |
}; |
2915 |
|
2916 |
general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';' |
2917 |
{ |
2918 |
GlobalSetOptions.rejecttime = yylval.number; |
2919 |
}; |
2920 |
|
2921 |
general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';' |
2922 |
{ |
2923 |
ConfigFileEntry.tkline_expire_notices = yylval.number; |
2924 |
}; |
2925 |
|
2926 |
general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';' |
2927 |
{ |
2928 |
ConfigFileEntry.kill_chase_time_limit = $3; |
2929 |
}; |
2930 |
|
2931 |
general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';' |
2932 |
{ |
2933 |
ConfigFileEntry.hide_spoof_ips = yylval.number; |
2934 |
}; |
2935 |
|
2936 |
general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';' |
2937 |
{ |
2938 |
ConfigFileEntry.ignore_bogus_ts = yylval.number; |
2939 |
}; |
2940 |
|
2941 |
general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';' |
2942 |
{ |
2943 |
ConfigFileEntry.disable_remote = yylval.number; |
2944 |
}; |
2945 |
|
2946 |
general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';' |
2947 |
{ |
2948 |
ConfigFileEntry.failed_oper_notice = yylval.number; |
2949 |
}; |
2950 |
|
2951 |
general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';' |
2952 |
{ |
2953 |
ConfigFileEntry.anti_nick_flood = yylval.number; |
2954 |
}; |
2955 |
|
2956 |
general_max_nick_time: MAX_NICK_TIME '=' timespec ';' |
2957 |
{ |
2958 |
ConfigFileEntry.max_nick_time = $3; |
2959 |
}; |
2960 |
|
2961 |
general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';' |
2962 |
{ |
2963 |
ConfigFileEntry.max_nick_changes = $3; |
2964 |
}; |
2965 |
|
2966 |
general_max_accept: MAX_ACCEPT '=' NUMBER ';' |
2967 |
{ |
2968 |
ConfigFileEntry.max_accept = $3; |
2969 |
}; |
2970 |
|
2971 |
general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';' |
2972 |
{ |
2973 |
ConfigFileEntry.anti_spam_exit_message_time = $3; |
2974 |
}; |
2975 |
|
2976 |
general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';' |
2977 |
{ |
2978 |
ConfigFileEntry.ts_warn_delta = $3; |
2979 |
}; |
2980 |
|
2981 |
general_ts_max_delta: TS_MAX_DELTA '=' timespec ';' |
2982 |
{ |
2983 |
if (conf_parser_ctx.pass == 2) |
2984 |
ConfigFileEntry.ts_max_delta = $3; |
2985 |
}; |
2986 |
|
2987 |
general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';' |
2988 |
{ |
2989 |
if (($3 > 0) && conf_parser_ctx.pass == 1) |
2990 |
{ |
2991 |
ilog(L_CRIT, "You haven't read your config file properly."); |
2992 |
ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed."); |
2993 |
ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line."); |
2994 |
exit(0); |
2995 |
} |
2996 |
}; |
2997 |
|
2998 |
general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';' |
2999 |
{ |
3000 |
ConfigFileEntry.kline_with_reason = yylval.number; |
3001 |
}; |
3002 |
|
3003 |
general_kline_reason: KLINE_REASON '=' QSTRING ';' |
3004 |
{ |
3005 |
if (conf_parser_ctx.pass == 2) |
3006 |
{ |
3007 |
MyFree(ConfigFileEntry.kline_reason); |
3008 |
DupString(ConfigFileEntry.kline_reason, yylval.string); |
3009 |
} |
3010 |
}; |
3011 |
|
3012 |
general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';' |
3013 |
{ |
3014 |
ConfigFileEntry.invisible_on_connect = yylval.number; |
3015 |
}; |
3016 |
|
3017 |
general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';' |
3018 |
{ |
3019 |
ConfigFileEntry.warn_no_nline = yylval.number; |
3020 |
}; |
3021 |
|
3022 |
general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';' |
3023 |
{ |
3024 |
ConfigFileEntry.stats_e_disabled = yylval.number; |
3025 |
}; |
3026 |
|
3027 |
general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';' |
3028 |
{ |
3029 |
ConfigFileEntry.stats_o_oper_only = yylval.number; |
3030 |
}; |
3031 |
|
3032 |
general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';' |
3033 |
{ |
3034 |
ConfigFileEntry.stats_P_oper_only = yylval.number; |
3035 |
}; |
3036 |
|
3037 |
general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';' |
3038 |
{ |
3039 |
ConfigFileEntry.stats_k_oper_only = 2 * yylval.number; |
3040 |
} | STATS_K_OPER_ONLY '=' TMASKED ';' |
3041 |
{ |
3042 |
ConfigFileEntry.stats_k_oper_only = 1; |
3043 |
}; |
3044 |
|
3045 |
general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';' |
3046 |
{ |
3047 |
ConfigFileEntry.stats_i_oper_only = 2 * yylval.number; |
3048 |
} | STATS_I_OPER_ONLY '=' TMASKED ';' |
3049 |
{ |
3050 |
ConfigFileEntry.stats_i_oper_only = 1; |
3051 |
}; |
3052 |
|
3053 |
general_pace_wait: PACE_WAIT '=' timespec ';' |
3054 |
{ |
3055 |
ConfigFileEntry.pace_wait = $3; |
3056 |
}; |
3057 |
|
3058 |
general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';' |
3059 |
{ |
3060 |
ConfigFileEntry.caller_id_wait = $3; |
3061 |
}; |
3062 |
|
3063 |
general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';' |
3064 |
{ |
3065 |
ConfigFileEntry.opers_bypass_callerid = yylval.number; |
3066 |
}; |
3067 |
|
3068 |
general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';' |
3069 |
{ |
3070 |
ConfigFileEntry.pace_wait_simple = $3; |
3071 |
}; |
3072 |
|
3073 |
general_short_motd: SHORT_MOTD '=' TBOOL ';' |
3074 |
{ |
3075 |
ConfigFileEntry.short_motd = yylval.number; |
3076 |
}; |
3077 |
|
3078 |
general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';' |
3079 |
{ |
3080 |
ConfigFileEntry.no_oper_flood = yylval.number; |
3081 |
}; |
3082 |
|
3083 |
general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';' |
3084 |
{ |
3085 |
ConfigFileEntry.true_no_oper_flood = yylval.number; |
3086 |
}; |
3087 |
|
3088 |
general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';' |
3089 |
{ |
3090 |
ConfigFileEntry.oper_pass_resv = yylval.number; |
3091 |
}; |
3092 |
|
3093 |
general_message_locale: MESSAGE_LOCALE '=' QSTRING ';' |
3094 |
{ |
3095 |
if (conf_parser_ctx.pass == 2) |
3096 |
{ |
3097 |
if (strlen(yylval.string) > LOCALE_LENGTH-2) |
3098 |
yylval.string[LOCALE_LENGTH-1] = '\0'; |
3099 |
|
3100 |
set_locale(yylval.string); |
3101 |
} |
3102 |
}; |
3103 |
|
3104 |
general_idletime: IDLETIME '=' timespec ';' |
3105 |
{ |
3106 |
ConfigFileEntry.idletime = $3; |
3107 |
}; |
3108 |
|
3109 |
general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';' |
3110 |
{ |
3111 |
ConfigFileEntry.dots_in_ident = $3; |
3112 |
}; |
3113 |
|
3114 |
general_max_targets: MAX_TARGETS '=' NUMBER ';' |
3115 |
{ |
3116 |
ConfigFileEntry.max_targets = $3; |
3117 |
}; |
3118 |
|
3119 |
general_servlink_path: SERVLINK_PATH '=' QSTRING ';' |
3120 |
{ |
3121 |
if (conf_parser_ctx.pass == 2) |
3122 |
{ |
3123 |
MyFree(ConfigFileEntry.servlink_path); |
3124 |
DupString(ConfigFileEntry.servlink_path, yylval.string); |
3125 |
} |
3126 |
}; |
3127 |
|
3128 |
general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';' |
3129 |
{ |
3130 |
#ifdef HAVE_LIBCRYPTO |
3131 |
if (conf_parser_ctx.pass == 2) |
3132 |
{ |
3133 |
struct EncCapability *ecap; |
3134 |
const char *cipher_name; |
3135 |
int found = 0; |
3136 |
|
3137 |
ConfigFileEntry.default_cipher_preference = NULL; |
3138 |
cipher_name = yylval.string; |
3139 |
|
3140 |
for (ecap = CipherTable; ecap->name; ecap++) |
3141 |
{ |
3142 |
if ((irccmp(ecap->name, cipher_name) == 0) && |
3143 |
(ecap->cap & CAP_ENC_MASK)) |
3144 |
{ |
3145 |
ConfigFileEntry.default_cipher_preference = ecap; |
3146 |
found = 1; |
3147 |
break; |
3148 |
} |
3149 |
} |
3150 |
|
3151 |
if (!found) |
3152 |
yyerror("Invalid cipher"); |
3153 |
} |
3154 |
#else |
3155 |
if (conf_parser_ctx.pass == 2) |
3156 |
yyerror("Ignoring default_cipher_preference -- no OpenSSL support"); |
3157 |
#endif |
3158 |
}; |
3159 |
|
3160 |
general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';' |
3161 |
{ |
3162 |
if (conf_parser_ctx.pass == 2) |
3163 |
{ |
3164 |
ConfigFileEntry.compression_level = $3; |
3165 |
#ifndef HAVE_LIBZ |
3166 |
yyerror("Ignoring compression_level -- no zlib support"); |
3167 |
#else |
3168 |
if ((ConfigFileEntry.compression_level < 1) || |
3169 |
(ConfigFileEntry.compression_level > 9)) |
3170 |
{ |
3171 |
yyerror("Ignoring invalid compression_level, using default"); |
3172 |
ConfigFileEntry.compression_level = 0; |
3173 |
} |
3174 |
#endif |
3175 |
} |
3176 |
}; |
3177 |
|
3178 |
general_use_egd: USE_EGD '=' TBOOL ';' |
3179 |
{ |
3180 |
ConfigFileEntry.use_egd = yylval.number; |
3181 |
}; |
3182 |
|
3183 |
general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';' |
3184 |
{ |
3185 |
if (conf_parser_ctx.pass == 2) |
3186 |
{ |
3187 |
MyFree(ConfigFileEntry.egdpool_path); |
3188 |
DupString(ConfigFileEntry.egdpool_path, yylval.string); |
3189 |
} |
3190 |
}; |
3191 |
|
3192 |
general_ping_cookie: PING_COOKIE '=' TBOOL ';' |
3193 |
{ |
3194 |
ConfigFileEntry.ping_cookie = yylval.number; |
3195 |
}; |
3196 |
|
3197 |
general_disable_auth: DISABLE_AUTH '=' TBOOL ';' |
3198 |
{ |
3199 |
ConfigFileEntry.disable_auth = yylval.number; |
3200 |
}; |
3201 |
|
3202 |
general_throttle_time: THROTTLE_TIME '=' timespec ';' |
3203 |
{ |
3204 |
ConfigFileEntry.throttle_time = yylval.number; |
3205 |
}; |
3206 |
|
3207 |
general_oper_umodes: OPER_UMODES |
3208 |
{ |
3209 |
ConfigFileEntry.oper_umodes = 0; |
3210 |
} '=' umode_oitems ';' ; |
3211 |
|
3212 |
umode_oitems: umode_oitems ',' umode_oitem | umode_oitem; |
3213 |
umode_oitem: T_BOTS |
3214 |
{ |
3215 |
ConfigFileEntry.oper_umodes |= UMODE_BOTS; |
3216 |
} | T_CCONN |
3217 |
{ |
3218 |
ConfigFileEntry.oper_umodes |= UMODE_CCONN; |
3219 |
} | T_CCONN_FULL |
3220 |
{ |
3221 |
ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL; |
3222 |
} | T_DEAF |
3223 |
{ |
3224 |
ConfigFileEntry.oper_umodes |= UMODE_DEAF; |
3225 |
} | T_DEBUG |
3226 |
{ |
3227 |
ConfigFileEntry.oper_umodes |= UMODE_DEBUG; |
3228 |
} | T_FULL |
3229 |
{ |
3230 |
ConfigFileEntry.oper_umodes |= UMODE_FULL; |
3231 |
} | T_SKILL |
3232 |
{ |
3233 |
ConfigFileEntry.oper_umodes |= UMODE_SKILL; |
3234 |
} | T_NCHANGE |
3235 |
{ |
3236 |
ConfigFileEntry.oper_umodes |= UMODE_NCHANGE; |
3237 |
} | T_REJ |
3238 |
{ |
3239 |
ConfigFileEntry.oper_umodes |= UMODE_REJ; |
3240 |
} | T_UNAUTH |
3241 |
{ |
3242 |
ConfigFileEntry.oper_umodes |= UMODE_UNAUTH; |
3243 |
} | T_SPY |
3244 |
{ |
3245 |
ConfigFileEntry.oper_umodes |= UMODE_SPY; |
3246 |
} | T_EXTERNAL |
3247 |
{ |
3248 |
ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL; |
3249 |
} | T_OPERWALL |
3250 |
{ |
3251 |
ConfigFileEntry.oper_umodes |= UMODE_OPERWALL; |
3252 |
} | T_SERVNOTICE |
3253 |
{ |
3254 |
ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE; |
3255 |
} | T_INVISIBLE |
3256 |
{ |
3257 |
ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE; |
3258 |
} | T_WALLOP |
3259 |
{ |
3260 |
ConfigFileEntry.oper_umodes |= UMODE_WALLOP; |
3261 |
} | T_SOFTCALLERID |
3262 |
{ |
3263 |
ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID; |
3264 |
} | T_CALLERID |
3265 |
{ |
3266 |
ConfigFileEntry.oper_umodes |= UMODE_CALLERID; |
3267 |
} | T_LOCOPS |
3268 |
{ |
3269 |
ConfigFileEntry.oper_umodes |= UMODE_LOCOPS; |
3270 |
}; |
3271 |
|
3272 |
general_oper_only_umodes: OPER_ONLY_UMODES |
3273 |
{ |
3274 |
ConfigFileEntry.oper_only_umodes = 0; |
3275 |
} '=' umode_items ';' ; |
3276 |
|
3277 |
umode_items: umode_items ',' umode_item | umode_item; |
3278 |
umode_item: T_BOTS |
3279 |
{ |
3280 |
ConfigFileEntry.oper_only_umodes |= UMODE_BOTS; |
3281 |
} | T_CCONN |
3282 |
{ |
3283 |
ConfigFileEntry.oper_only_umodes |= UMODE_CCONN; |
3284 |
} | T_CCONN_FULL |
3285 |
{ |
3286 |
ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL; |
3287 |
} | T_DEAF |
3288 |
{ |
3289 |
ConfigFileEntry.oper_only_umodes |= UMODE_DEAF; |
3290 |
} | T_DEBUG |
3291 |
{ |
3292 |
ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG; |
3293 |
} | T_FULL |
3294 |
{ |
3295 |
ConfigFileEntry.oper_only_umodes |= UMODE_FULL; |
3296 |
} | T_SKILL |
3297 |
{ |
3298 |
ConfigFileEntry.oper_only_umodes |= UMODE_SKILL; |
3299 |
} | T_NCHANGE |
3300 |
{ |
3301 |
ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE; |
3302 |
} | T_REJ |
3303 |
{ |
3304 |
ConfigFileEntry.oper_only_umodes |= UMODE_REJ; |
3305 |
} | T_UNAUTH |
3306 |
{ |
3307 |
ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH; |
3308 |
} | T_SPY |
3309 |
{ |
3310 |
ConfigFileEntry.oper_only_umodes |= UMODE_SPY; |
3311 |
} | T_EXTERNAL |
3312 |
{ |
3313 |
ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL; |
3314 |
} | T_OPERWALL |
3315 |
{ |
3316 |
ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL; |
3317 |
} | T_SERVNOTICE |
3318 |
{ |
3319 |
ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE; |
3320 |
} | T_INVISIBLE |
3321 |
{ |
3322 |
ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE; |
3323 |
} | T_WALLOP |
3324 |
{ |
3325 |
ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP; |
3326 |
} | T_SOFTCALLERID |
3327 |
{ |
3328 |
ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID; |
3329 |
} | T_CALLERID |
3330 |
{ |
3331 |
ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID; |
3332 |
} | T_LOCOPS |
3333 |
{ |
3334 |
ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS; |
3335 |
}; |
3336 |
|
3337 |
general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';' |
3338 |
{ |
3339 |
ConfigFileEntry.min_nonwildcard = $3; |
3340 |
}; |
3341 |
|
3342 |
general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';' |
3343 |
{ |
3344 |
ConfigFileEntry.min_nonwildcard_simple = $3; |
3345 |
}; |
3346 |
|
3347 |
general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';' |
3348 |
{ |
3349 |
ConfigFileEntry.default_floodcount = $3; |
3350 |
}; |
3351 |
|
3352 |
general_client_flood: T_CLIENT_FLOOD '=' sizespec ';' |
3353 |
{ |
3354 |
ConfigFileEntry.client_flood = $3; |
3355 |
}; |
3356 |
|
3357 |
|
3358 |
/*************************************************************************** |
3359 |
* section glines |
3360 |
***************************************************************************/ |
3361 |
gline_entry: GLINES |
3362 |
{ |
3363 |
if (conf_parser_ctx.pass == 2) |
3364 |
{ |
3365 |
yy_conf = make_conf_item(GDENY_TYPE); |
3366 |
yy_aconf = map_to_conf(yy_conf); |
3367 |
} |
3368 |
} '{' gline_items '}' ';' |
3369 |
{ |
3370 |
if (conf_parser_ctx.pass == 2) |
3371 |
{ |
3372 |
/* |
3373 |
* since we re-allocate yy_conf/yy_aconf after the end of action=, at the |
3374 |
* end we will have one extra, so we should free it. |
3375 |
*/ |
3376 |
if (yy_conf->name == NULL || yy_aconf->user == NULL) |
3377 |
{ |
3378 |
delete_conf_item(yy_conf); |
3379 |
yy_conf = NULL; |
3380 |
yy_aconf = NULL; |
3381 |
} |
3382 |
} |
3383 |
}; |
3384 |
|
3385 |
gline_items: gline_items gline_item | gline_item; |
3386 |
gline_item: gline_enable | |
3387 |
gline_duration | |
3388 |
gline_logging | |
3389 |
gline_user | |
3390 |
gline_server | |
3391 |
gline_action | |
3392 |
error; |
3393 |
|
3394 |
gline_enable: ENABLE '=' TBOOL ';' |
3395 |
{ |
3396 |
if (conf_parser_ctx.pass == 2) |
3397 |
ConfigFileEntry.glines = yylval.number; |
3398 |
}; |
3399 |
|
3400 |
gline_duration: DURATION '=' timespec ';' |
3401 |
{ |
3402 |
if (conf_parser_ctx.pass == 2) |
3403 |
ConfigFileEntry.gline_time = $3; |
3404 |
}; |
3405 |
|
3406 |
gline_logging: LOGGING |
3407 |
{ |
3408 |
if (conf_parser_ctx.pass == 2) |
3409 |
ConfigFileEntry.gline_logging = 0; |
3410 |
} '=' gline_logging_types ';'; |
3411 |
gline_logging_types: gline_logging_types ',' gline_logging_type_item | gline_logging_type_item; |
3412 |
gline_logging_type_item: T_REJECT |
3413 |
{ |
3414 |
if (conf_parser_ctx.pass == 2) |
3415 |
ConfigFileEntry.gline_logging |= GDENY_REJECT; |
3416 |
} | T_BLOCK |
3417 |
{ |
3418 |
if (conf_parser_ctx.pass == 2) |
3419 |
ConfigFileEntry.gline_logging |= GDENY_BLOCK; |
3420 |
}; |
3421 |
|
3422 |
gline_user: USER '=' QSTRING ';' |
3423 |
{ |
3424 |
if (conf_parser_ctx.pass == 2) |
3425 |
{ |
3426 |
struct split_nuh_item nuh; |
3427 |
|
3428 |
nuh.nuhmask = yylval.string; |
3429 |
nuh.nickptr = NULL; |
3430 |
nuh.userptr = userbuf; |
3431 |
nuh.hostptr = hostbuf; |
3432 |
|
3433 |
nuh.nicksize = 0; |
3434 |
nuh.usersize = sizeof(userbuf); |
3435 |
nuh.hostsize = sizeof(hostbuf); |
3436 |
|
3437 |
split_nuh(&nuh); |
3438 |
|
3439 |
if (yy_aconf->user == NULL) |
3440 |
{ |
3441 |
DupString(yy_aconf->user, userbuf); |
3442 |
DupString(yy_aconf->host, hostbuf); |
3443 |
} |
3444 |
else |
3445 |
{ |
3446 |
struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem)); |
3447 |
|
3448 |
DupString(yy_tmp->user, userbuf); |
3449 |
DupString(yy_tmp->host, hostbuf); |
3450 |
|
3451 |
dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list); |
3452 |
} |
3453 |
} |
3454 |
}; |
3455 |
|
3456 |
gline_server: NAME '=' QSTRING ';' |
3457 |
{ |
3458 |
if (conf_parser_ctx.pass == 2) |
3459 |
{ |
3460 |
MyFree(yy_conf->name); |
3461 |
DupString(yy_conf->name, yylval.string); |
3462 |
} |
3463 |
}; |
3464 |
|
3465 |
gline_action: ACTION |
3466 |
{ |
3467 |
if (conf_parser_ctx.pass == 2) |
3468 |
yy_aconf->flags = 0; |
3469 |
} '=' gdeny_types ';' |
3470 |
{ |
3471 |
if (conf_parser_ctx.pass == 2) |
3472 |
{ |
3473 |
struct CollectItem *yy_tmp = NULL; |
3474 |
dlink_node *ptr, *next_ptr; |
3475 |
|
3476 |
DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) |
3477 |
{ |
3478 |
struct AccessItem *new_aconf; |
3479 |
struct ConfItem *new_conf; |
3480 |
|
3481 |
yy_tmp = ptr->data; |
3482 |
new_conf = make_conf_item(GDENY_TYPE); |
3483 |
new_aconf = map_to_conf(new_conf); |
3484 |
|
3485 |
new_aconf->flags = yy_aconf->flags; |
3486 |
|
3487 |
if (yy_conf->name != NULL) |
3488 |
DupString(new_conf->name, yy_conf->name); |
3489 |
else |
3490 |
DupString(new_conf->name, "*"); |
3491 |
if (yy_aconf->user != NULL) |
3492 |
DupString(new_aconf->user, yy_tmp->user); |
3493 |
else |
3494 |
DupString(new_aconf->user, "*"); |
3495 |
if (yy_aconf->host != NULL) |
3496 |
DupString(new_aconf->host, yy_tmp->host); |
3497 |
else |
3498 |
DupString(new_aconf->host, "*"); |
3499 |
|
3500 |
dlinkDelete(&yy_tmp->node, &col_conf_list); |
3501 |
} |
3502 |
|
3503 |
/* |
3504 |
* In case someone has fed us with more than one action= after user/name |
3505 |
* which would leak memory -Michael |
3506 |
*/ |
3507 |
if (yy_conf->name == NULL || yy_aconf->user == NULL) |
3508 |
delete_conf_item(yy_conf); |
3509 |
|
3510 |
yy_conf = make_conf_item(GDENY_TYPE); |
3511 |
yy_aconf = map_to_conf(yy_conf); |
3512 |
} |
3513 |
}; |
3514 |
|
3515 |
gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item; |
3516 |
gdeny_type_item: T_REJECT |
3517 |
{ |
3518 |
if (conf_parser_ctx.pass == 2) |
3519 |
yy_aconf->flags |= GDENY_REJECT; |
3520 |
} | T_BLOCK |
3521 |
{ |
3522 |
if (conf_parser_ctx.pass == 2) |
3523 |
yy_aconf->flags |= GDENY_BLOCK; |
3524 |
}; |
3525 |
|
3526 |
/*************************************************************************** |
3527 |
* section channel |
3528 |
***************************************************************************/ |
3529 |
channel_entry: CHANNEL |
3530 |
'{' channel_items '}' ';'; |
3531 |
|
3532 |
channel_items: channel_items channel_item | channel_item; |
3533 |
channel_item: channel_disable_local_channels | channel_use_except | |
3534 |
channel_use_invex | channel_use_knock | |
3535 |
channel_max_bans | channel_knock_delay | |
3536 |
channel_knock_delay_channel | channel_max_chans_per_user | |
3537 |
channel_quiet_on_ban | channel_default_split_user_count | |
3538 |
channel_default_split_server_count | |
3539 |
channel_no_create_on_split | channel_restrict_channels | |
3540 |
channel_no_join_on_split | channel_burst_topicwho | |
3541 |
channel_jflood_count | channel_jflood_time | |
3542 |
channel_disable_fake_channels | error; |
3543 |
|
3544 |
channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';' |
3545 |
{ |
3546 |
ConfigChannel.disable_fake_channels = yylval.number; |
3547 |
}; |
3548 |
|
3549 |
channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';' |
3550 |
{ |
3551 |
ConfigChannel.restrict_channels = yylval.number; |
3552 |
}; |
3553 |
|
3554 |
channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';' |
3555 |
{ |
3556 |
ConfigChannel.disable_local_channels = yylval.number; |
3557 |
}; |
3558 |
|
3559 |
channel_use_except: USE_EXCEPT '=' TBOOL ';' |
3560 |
{ |
3561 |
ConfigChannel.use_except = yylval.number; |
3562 |
}; |
3563 |
|
3564 |
channel_use_invex: USE_INVEX '=' TBOOL ';' |
3565 |
{ |
3566 |
ConfigChannel.use_invex = yylval.number; |
3567 |
}; |
3568 |
|
3569 |
channel_use_knock: USE_KNOCK '=' TBOOL ';' |
3570 |
{ |
3571 |
ConfigChannel.use_knock = yylval.number; |
3572 |
}; |
3573 |
|
3574 |
channel_knock_delay: KNOCK_DELAY '=' timespec ';' |
3575 |
{ |
3576 |
ConfigChannel.knock_delay = $3; |
3577 |
}; |
3578 |
|
3579 |
channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';' |
3580 |
{ |
3581 |
ConfigChannel.knock_delay_channel = $3; |
3582 |
}; |
3583 |
|
3584 |
channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';' |
3585 |
{ |
3586 |
ConfigChannel.max_chans_per_user = $3; |
3587 |
}; |
3588 |
|
3589 |
channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';' |
3590 |
{ |
3591 |
ConfigChannel.quiet_on_ban = yylval.number; |
3592 |
}; |
3593 |
|
3594 |
channel_max_bans: MAX_BANS '=' NUMBER ';' |
3595 |
{ |
3596 |
ConfigChannel.max_bans = $3; |
3597 |
}; |
3598 |
|
3599 |
channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';' |
3600 |
{ |
3601 |
ConfigChannel.default_split_user_count = $3; |
3602 |
}; |
3603 |
|
3604 |
channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';' |
3605 |
{ |
3606 |
ConfigChannel.default_split_server_count = $3; |
3607 |
}; |
3608 |
|
3609 |
channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';' |
3610 |
{ |
3611 |
ConfigChannel.no_create_on_split = yylval.number; |
3612 |
}; |
3613 |
|
3614 |
channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';' |
3615 |
{ |
3616 |
ConfigChannel.no_join_on_split = yylval.number; |
3617 |
}; |
3618 |
|
3619 |
channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';' |
3620 |
{ |
3621 |
ConfigChannel.burst_topicwho = yylval.number; |
3622 |
}; |
3623 |
|
3624 |
channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';' |
3625 |
{ |
3626 |
GlobalSetOptions.joinfloodcount = yylval.number; |
3627 |
}; |
3628 |
|
3629 |
channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';' |
3630 |
{ |
3631 |
GlobalSetOptions.joinfloodtime = yylval.number; |
3632 |
}; |
3633 |
|
3634 |
/*************************************************************************** |
3635 |
* section serverhide |
3636 |
***************************************************************************/ |
3637 |
serverhide_entry: SERVERHIDE |
3638 |
'{' serverhide_items '}' ';'; |
3639 |
|
3640 |
serverhide_items: serverhide_items serverhide_item | serverhide_item; |
3641 |
serverhide_item: serverhide_flatten_links | serverhide_hide_servers | |
3642 |
serverhide_links_delay | |
3643 |
serverhide_disable_hidden | |
3644 |
serverhide_hidden | serverhide_hidden_name | |
3645 |
serverhide_hide_server_ips | |
3646 |
error; |
3647 |
|
3648 |
serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';' |
3649 |
{ |
3650 |
if (conf_parser_ctx.pass == 2) |
3651 |
ConfigServerHide.flatten_links = yylval.number; |
3652 |
}; |
3653 |
|
3654 |
serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';' |
3655 |
{ |
3656 |
if (conf_parser_ctx.pass == 2) |
3657 |
ConfigServerHide.hide_servers = yylval.number; |
3658 |
}; |
3659 |
|
3660 |
serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';' |
3661 |
{ |
3662 |
if (conf_parser_ctx.pass == 2) |
3663 |
{ |
3664 |
MyFree(ConfigServerHide.hidden_name); |
3665 |
DupString(ConfigServerHide.hidden_name, yylval.string); |
3666 |
} |
3667 |
}; |
3668 |
|
3669 |
serverhide_links_delay: LINKS_DELAY '=' timespec ';' |
3670 |
{ |
3671 |
if (conf_parser_ctx.pass == 2) |
3672 |
{ |
3673 |
if (($3 > 0) && ConfigServerHide.links_disabled == 1) |
3674 |
{ |
3675 |
eventAddIsh("write_links_file", write_links_file, NULL, $3); |
3676 |
ConfigServerHide.links_disabled = 0; |
3677 |
} |
3678 |
|
3679 |
ConfigServerHide.links_delay = $3; |
3680 |
} |
3681 |
}; |
3682 |
|
3683 |
serverhide_hidden: HIDDEN '=' TBOOL ';' |
3684 |
{ |
3685 |
if (conf_parser_ctx.pass == 2) |
3686 |
ConfigServerHide.hidden = yylval.number; |
3687 |
}; |
3688 |
|
3689 |
serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';' |
3690 |
{ |
3691 |
if (conf_parser_ctx.pass == 2) |
3692 |
ConfigServerHide.disable_hidden = yylval.number; |
3693 |
}; |
3694 |
|
3695 |
serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';' |
3696 |
{ |
3697 |
if (conf_parser_ctx.pass == 2) |
3698 |
ConfigServerHide.hide_server_ips = yylval.number; |
3699 |
}; |