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