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