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