]>
Commit | Line | Data |
---|---|---|
212380e3 | 1 | /* This code is in the public domain. |
cda8e9b8 | 2 | * $Id: newconf.c 3550 2007-08-09 06:47:26Z nenolod $ |
212380e3 AC |
3 | */ |
4 | ||
5 | #include "stdinc.h" | |
6 | ||
7 | #ifdef HAVE_LIBCRYPTO | |
8 | #include <openssl/pem.h> | |
9 | #include <openssl/rsa.h> | |
10 | #endif | |
11 | ||
212380e3 | 12 | #include "newconf.h" |
212380e3 AC |
13 | #include "ircd_defs.h" |
14 | #include "sprintf_irc.h" | |
15 | #include "common.h" | |
4016731b | 16 | #include "logger.h" |
212380e3 AC |
17 | #include "s_conf.h" |
18 | #include "s_user.h" | |
19 | #include "s_newconf.h" | |
20 | #include "send.h" | |
21 | #include "setup.h" | |
22 | #include "modules.h" | |
23 | #include "listener.h" | |
24 | #include "hostmask.h" | |
25 | #include "s_serv.h" | |
212380e3 AC |
26 | #include "hash.h" |
27 | #include "cache.h" | |
28 | #include "ircd.h" | |
29 | #include "snomask.h" | |
30 | #include "blacklist.h" | |
c6d72037 | 31 | #include "sslproc.h" |
212380e3 AC |
32 | |
33 | #define CF_TYPE(x) ((x) & CF_MTYPE) | |
34 | ||
35 | struct TopConf *conf_cur_block; | |
36 | static char *conf_cur_block_name; | |
37 | ||
330fc5c1 | 38 | static rb_dlink_list conf_items; |
212380e3 AC |
39 | |
40 | static struct ConfItem *yy_aconf = NULL; | |
41 | ||
42 | static struct Class *yy_class = NULL; | |
43 | ||
44 | static struct remote_conf *yy_shared = NULL; | |
45 | static struct server_conf *yy_server = NULL; | |
46 | ||
330fc5c1 AC |
47 | static rb_dlink_list yy_aconf_list; |
48 | static rb_dlink_list yy_oper_list; | |
49 | static rb_dlink_list yy_shared_list; | |
50 | static rb_dlink_list yy_cluster_list; | |
212380e3 AC |
51 | static struct oper_conf *yy_oper = NULL; |
52 | ||
53 | static struct alias_entry *yy_alias = NULL; | |
54 | ||
55 | static char *yy_blacklist_host = NULL; | |
56 | static char *yy_blacklist_reason = NULL; | |
57 | ||
58 | static const char * | |
59 | conf_strtype(int type) | |
60 | { | |
61 | switch (type & CF_MTYPE) | |
62 | { | |
63 | case CF_INT: | |
64 | return "integer value"; | |
65 | case CF_STRING: | |
66 | return "unquoted string"; | |
67 | case CF_YESNO: | |
68 | return "yes/no value"; | |
69 | case CF_QSTRING: | |
70 | return "quoted string"; | |
71 | case CF_TIME: | |
72 | return "time/size value"; | |
73 | default: | |
74 | return "unknown type"; | |
75 | } | |
76 | } | |
77 | ||
78 | int | |
79 | add_top_conf(const char *name, int (*sfunc) (struct TopConf *), | |
80 | int (*efunc) (struct TopConf *), struct ConfEntry *items) | |
81 | { | |
82 | struct TopConf *tc; | |
83 | ||
eddc2ab6 | 84 | tc = rb_malloc(sizeof(struct TopConf)); |
212380e3 | 85 | |
d7f753cd | 86 | tc->tc_name = name; |
212380e3 AC |
87 | tc->tc_sfunc = sfunc; |
88 | tc->tc_efunc = efunc; | |
89 | tc->tc_entries = items; | |
90 | ||
330fc5c1 | 91 | rb_dlinkAddAlloc(tc, &conf_items); |
212380e3 AC |
92 | return 0; |
93 | } | |
94 | ||
95 | struct TopConf * | |
96 | find_top_conf(const char *name) | |
97 | { | |
330fc5c1 | 98 | rb_dlink_node *d; |
212380e3 AC |
99 | struct TopConf *tc; |
100 | ||
5cefa1d6 | 101 | RB_DLINK_FOREACH(d, conf_items.head) |
212380e3 AC |
102 | { |
103 | tc = d->data; | |
104 | if(strcasecmp(tc->tc_name, name) == 0) | |
105 | return tc; | |
106 | } | |
107 | ||
108 | return NULL; | |
109 | } | |
110 | ||
111 | ||
112 | struct ConfEntry * | |
113 | find_conf_item(const struct TopConf *top, const char *name) | |
114 | { | |
115 | struct ConfEntry *cf; | |
330fc5c1 | 116 | rb_dlink_node *d; |
212380e3 AC |
117 | |
118 | if(top->tc_entries) | |
119 | { | |
120 | int i; | |
121 | ||
122 | for(i = 0; top->tc_entries[i].cf_type; i++) | |
123 | { | |
124 | cf = &top->tc_entries[i]; | |
125 | ||
126 | if(!strcasecmp(cf->cf_name, name)) | |
127 | return cf; | |
128 | } | |
129 | } | |
130 | ||
5cefa1d6 | 131 | RB_DLINK_FOREACH(d, top->tc_items.head) |
212380e3 AC |
132 | { |
133 | cf = d->data; | |
134 | if(strcasecmp(cf->cf_name, name) == 0) | |
135 | return cf; | |
136 | } | |
137 | ||
138 | return NULL; | |
139 | } | |
140 | ||
141 | int | |
142 | remove_top_conf(char *name) | |
143 | { | |
144 | struct TopConf *tc; | |
330fc5c1 | 145 | rb_dlink_node *ptr; |
212380e3 AC |
146 | |
147 | if((tc = find_top_conf(name)) == NULL) | |
148 | return -1; | |
149 | ||
330fc5c1 | 150 | if((ptr = rb_dlinkFind(tc, &conf_items)) == NULL) |
212380e3 AC |
151 | return -1; |
152 | ||
330fc5c1 | 153 | rb_dlinkDestroy(ptr, &conf_items); |
637c4932 | 154 | rb_free(tc); |
212380e3 AC |
155 | |
156 | return 0; | |
157 | } | |
158 | ||
159 | static void | |
160 | conf_set_serverinfo_name(void *data) | |
161 | { | |
162 | if(ServerInfo.name == NULL) | |
163 | { | |
164 | const char *s; | |
165 | int dots = 0; | |
166 | ||
167 | for(s = data; *s != '\0'; s++) | |
168 | { | |
169 | if(!IsServChar(*s)) | |
170 | { | |
171 | conf_report_error("Ignoring serverinfo::name " | |
172 | "-- bogus servername."); | |
173 | return; | |
174 | } | |
175 | else if(*s == '.') | |
176 | ++dots; | |
177 | } | |
178 | ||
179 | if(!dots) | |
180 | { | |
181 | conf_report_error("Ignoring serverinfo::name -- must contain '.'"); | |
182 | return; | |
183 | } | |
184 | ||
185 | s = data; | |
186 | ||
187 | if(IsDigit(*s)) | |
188 | { | |
189 | conf_report_error("Ignoring serverinfo::name -- cannot begin with digit."); | |
190 | return; | |
191 | } | |
192 | ||
193 | /* the ircd will exit() in main() if we dont set one */ | |
194 | if(strlen(s) <= HOSTLEN) | |
47a03750 | 195 | ServerInfo.name = rb_strdup((char *) data); |
212380e3 AC |
196 | } |
197 | } | |
198 | ||
199 | static void | |
200 | conf_set_serverinfo_sid(void *data) | |
201 | { | |
202 | char *sid = data; | |
203 | ||
204 | if(ServerInfo.sid[0] == '\0') | |
205 | { | |
206 | if(!IsDigit(sid[0]) || !IsIdChar(sid[1]) || | |
207 | !IsIdChar(sid[2]) || sid[3] != '\0') | |
208 | { | |
209 | conf_report_error("Ignoring serverinfo::sid " | |
210 | "-- bogus sid."); | |
211 | return; | |
212 | } | |
213 | ||
214 | strcpy(ServerInfo.sid, sid); | |
215 | } | |
216 | } | |
217 | ||
218 | static void | |
219 | conf_set_serverinfo_network_name(void *data) | |
220 | { | |
221 | char *p; | |
222 | ||
223 | if((p = strchr((char *) data, ' '))) | |
224 | *p = '\0'; | |
225 | ||
637c4932 | 226 | rb_free(ServerInfo.network_name); |
47a03750 | 227 | ServerInfo.network_name = rb_strdup((char *) data); |
212380e3 AC |
228 | } |
229 | ||
230 | static void | |
231 | conf_set_serverinfo_vhost(void *data) | |
232 | { | |
233 | if(inetpton(AF_INET, (char *) data, &ServerInfo.ip.sin_addr) <= 0) | |
234 | { | |
235 | conf_report_error("Invalid netmask for server IPv4 vhost (%s)", (char *) data); | |
236 | return; | |
237 | } | |
238 | ServerInfo.ip.sin_family = AF_INET; | |
239 | ServerInfo.specific_ipv4_vhost = 1; | |
240 | } | |
241 | ||
242 | static void | |
243 | conf_set_serverinfo_vhost6(void *data) | |
244 | { | |
ccda6e3f | 245 | #ifdef RB_IPV6 |
212380e3 AC |
246 | if(inetpton(AF_INET6, (char *) data, &ServerInfo.ip6.sin6_addr) <= 0) |
247 | { | |
248 | conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data); | |
249 | return; | |
250 | } | |
251 | ||
252 | ServerInfo.specific_ipv6_vhost = 1; | |
253 | ServerInfo.ip6.sin6_family = AF_INET6; | |
254 | #else | |
255 | conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available."); | |
256 | #endif | |
257 | } | |
258 | ||
259 | static void | |
260 | conf_set_modules_module(void *data) | |
261 | { | |
262 | #ifndef STATIC_MODULES | |
263 | char *m_bn; | |
264 | ||
265 | m_bn = irc_basename((char *) data); | |
266 | ||
267 | if(findmodule_byname(m_bn) != -1) | |
268 | return; | |
269 | ||
270 | load_one_module((char *) data, 0); | |
271 | ||
637c4932 | 272 | rb_free(m_bn); |
212380e3 AC |
273 | #else |
274 | conf_report_error("Ignoring modules::module -- loadable module support not present."); | |
275 | #endif | |
276 | } | |
277 | ||
278 | static void | |
279 | conf_set_modules_path(void *data) | |
280 | { | |
281 | #ifndef STATIC_MODULES | |
282 | mod_add_path((char *) data); | |
283 | #else | |
284 | conf_report_error("Ignoring modules::path -- loadable module support not present."); | |
285 | #endif | |
286 | } | |
287 | ||
288 | struct mode_table | |
289 | { | |
290 | const char *name; | |
291 | int mode; | |
292 | }; | |
293 | ||
294 | /* *INDENT-OFF* */ | |
295 | static struct mode_table umode_table[] = { | |
296 | {"callerid", UMODE_CALLERID }, | |
297 | {"deaf", UMODE_DEAF }, | |
298 | {"invisible", UMODE_INVISIBLE }, | |
299 | {"locops", UMODE_LOCOPS }, | |
300 | {"noforward", UMODE_NOFORWARD }, | |
301 | {"regonlymsg", UMODE_REGONLYMSG}, | |
302 | {"servnotice", UMODE_SERVNOTICE}, | |
303 | {"wallop", UMODE_WALLOP }, | |
304 | {"operwall", UMODE_OPERWALL }, | |
305 | {NULL, 0} | |
306 | }; | |
307 | ||
19c13ce5 | 308 | static struct mode_table oper_table[] = { |
212380e3 AC |
309 | {"encrypted", OPER_ENCRYPTED }, |
310 | {"local_kill", OPER_LOCKILL }, | |
311 | {"global_kill", OPER_GLOBKILL|OPER_LOCKILL }, | |
312 | {"remote", OPER_REMOTE }, | |
313 | {"kline", OPER_KLINE }, | |
314 | {"unkline", OPER_UNKLINE }, | |
212380e3 AC |
315 | {"nick_changes", OPER_NICKS }, |
316 | {"rehash", OPER_REHASH }, | |
317 | {"die", OPER_DIE }, | |
318 | {"admin", OPER_ADMIN }, | |
319 | {"hidden_admin", OPER_HADMIN }, | |
320 | {"xline", OPER_XLINE }, | |
1ebe6ffc | 321 | {"resv", OPER_RESV }, |
212380e3 AC |
322 | {"operwall", OPER_OPERWALL }, |
323 | {"oper_spy", OPER_SPY }, | |
324 | {"hidden_oper", OPER_INVIS }, | |
325 | {"remoteban", OPER_REMOTEBAN }, | |
a6f4368b | 326 | {"mass_notice", OPER_MASSNOTICE }, |
212380e3 AC |
327 | {NULL, 0} |
328 | }; | |
329 | ||
330 | static struct mode_table auth_table[] = { | |
331 | {"encrypted", CONF_FLAGS_ENCRYPTED }, | |
332 | {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE }, | |
333 | {"exceed_limit", CONF_FLAGS_NOLIMIT }, | |
334 | {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL }, | |
335 | {"kline_exempt", CONF_FLAGS_EXEMPTKLINE }, | |
212380e3 AC |
336 | {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD }, |
337 | {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT }, | |
338 | {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE }, | |
339 | {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE }, | |
340 | {"resv_exempt", CONF_FLAGS_EXEMPTRESV }, | |
341 | {"no_tilde", CONF_FLAGS_NO_TILDE }, | |
342 | {"need_ident", CONF_FLAGS_NEED_IDENTD }, | |
343 | {"have_ident", CONF_FLAGS_NEED_IDENTD }, | |
344 | {"need_sasl", CONF_FLAGS_NEED_SASL }, | |
345 | {NULL, 0} | |
346 | }; | |
347 | ||
348 | static struct mode_table connect_table[] = { | |
349 | { "autoconn", SERVER_AUTOCONN }, | |
350 | { "compressed", SERVER_COMPRESSED }, | |
351 | { "encrypted", SERVER_ENCRYPTED }, | |
352 | { "topicburst", SERVER_TB }, | |
c6d72037 | 353 | { "ssl", SERVER_SSL }, |
212380e3 AC |
354 | { NULL, 0 }, |
355 | }; | |
356 | ||
357 | static struct mode_table cluster_table[] = { | |
358 | { "kline", SHARED_PKLINE }, | |
359 | { "tkline", SHARED_TKLINE }, | |
360 | { "unkline", SHARED_UNKLINE }, | |
361 | { "locops", SHARED_LOCOPS }, | |
362 | { "xline", SHARED_PXLINE }, | |
363 | { "txline", SHARED_TXLINE }, | |
364 | { "unxline", SHARED_UNXLINE }, | |
365 | { "resv", SHARED_PRESV }, | |
366 | { "tresv", SHARED_TRESV }, | |
367 | { "unresv", SHARED_UNRESV }, | |
368 | { "all", CLUSTER_ALL }, | |
369 | {NULL, 0} | |
370 | }; | |
371 | ||
372 | static struct mode_table shared_table[] = | |
373 | { | |
374 | { "kline", SHARED_PKLINE|SHARED_TKLINE }, | |
375 | { "xline", SHARED_PXLINE|SHARED_TXLINE }, | |
376 | { "resv", SHARED_PRESV|SHARED_TRESV }, | |
377 | { "tkline", SHARED_TKLINE }, | |
378 | { "unkline", SHARED_UNKLINE }, | |
379 | { "txline", SHARED_TXLINE }, | |
380 | { "unxline", SHARED_UNXLINE }, | |
381 | { "tresv", SHARED_TRESV }, | |
382 | { "unresv", SHARED_UNRESV }, | |
383 | { "locops", SHARED_LOCOPS }, | |
384 | { "rehash", SHARED_REHASH }, | |
385 | { "all", SHARED_ALL }, | |
386 | { "none", 0 }, | |
387 | {NULL, 0} | |
388 | }; | |
389 | /* *INDENT-ON* */ | |
390 | ||
391 | static int | |
392 | find_umode(struct mode_table *tab, const char *name) | |
393 | { | |
394 | int i; | |
395 | ||
396 | for (i = 0; tab[i].name; i++) | |
397 | { | |
398 | if(strcmp(tab[i].name, name) == 0) | |
399 | return tab[i].mode; | |
400 | } | |
401 | ||
402 | return -1; | |
403 | } | |
404 | ||
405 | static void | |
406 | set_modes_from_table(int *modes, const char *whatis, struct mode_table *tab, conf_parm_t * args) | |
407 | { | |
408 | for (; args; args = args->next) | |
409 | { | |
410 | const char *umode; | |
411 | int dir = 1; | |
412 | int mode; | |
413 | ||
414 | if((args->type & CF_MTYPE) != CF_STRING) | |
415 | { | |
416 | conf_report_error("Warning -- %s is not a string; ignoring.", whatis); | |
417 | continue; | |
418 | } | |
419 | ||
420 | umode = args->v.string; | |
421 | ||
422 | if(*umode == '~') | |
423 | { | |
424 | dir = 0; | |
425 | umode++; | |
426 | } | |
427 | ||
428 | mode = find_umode(tab, umode); | |
429 | ||
430 | if(mode == -1) | |
431 | { | |
432 | conf_report_error("Warning -- unknown %s %s.", whatis, args->v.string); | |
433 | continue; | |
434 | } | |
435 | ||
436 | if(mode) | |
437 | { | |
438 | if(dir) | |
439 | *modes |= mode; | |
440 | else | |
441 | *modes &= ~mode; | |
442 | } | |
443 | else | |
444 | *modes = 0; | |
445 | } | |
446 | } | |
447 | ||
448 | static int | |
449 | conf_begin_oper(struct TopConf *tc) | |
450 | { | |
330fc5c1 | 451 | rb_dlink_node *ptr; |
637c4932 | 452 | rb_dlink_node *next_ptr; |
212380e3 AC |
453 | |
454 | if(yy_oper != NULL) | |
455 | { | |
456 | free_oper_conf(yy_oper); | |
457 | yy_oper = NULL; | |
458 | } | |
459 | ||
637c4932 | 460 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_oper_list.head) |
212380e3 AC |
461 | { |
462 | free_oper_conf(ptr->data); | |
330fc5c1 | 463 | rb_dlinkDestroy(ptr, &yy_oper_list); |
212380e3 AC |
464 | } |
465 | ||
466 | yy_oper = make_oper_conf(); | |
a6f4368b | 467 | yy_oper->flags |= OPER_ENCRYPTED|OPER_RESV|OPER_OPERWALL|OPER_REMOTEBAN|OPER_MASSNOTICE; |
212380e3 AC |
468 | |
469 | return 0; | |
470 | } | |
471 | ||
472 | static int | |
473 | conf_end_oper(struct TopConf *tc) | |
474 | { | |
475 | struct oper_conf *yy_tmpoper; | |
330fc5c1 | 476 | rb_dlink_node *ptr; |
637c4932 | 477 | rb_dlink_node *next_ptr; |
212380e3 AC |
478 | |
479 | if(conf_cur_block_name != NULL) | |
480 | { | |
481 | if(strlen(conf_cur_block_name) > OPERNICKLEN) | |
482 | conf_cur_block_name[OPERNICKLEN] = '\0'; | |
483 | ||
47a03750 | 484 | yy_oper->name = rb_strdup(conf_cur_block_name); |
212380e3 AC |
485 | } |
486 | ||
487 | if(EmptyString(yy_oper->name)) | |
488 | { | |
489 | conf_report_error("Ignoring operator block -- missing name."); | |
490 | return 0; | |
491 | } | |
492 | ||
493 | #ifdef HAVE_LIBCRYPTO | |
494 | if(EmptyString(yy_oper->passwd) && EmptyString(yy_oper->rsa_pubkey_file)) | |
495 | #else | |
496 | if(EmptyString(yy_oper->passwd)) | |
497 | #endif | |
498 | { | |
499 | conf_report_error("Ignoring operator block for %s -- missing password", | |
500 | yy_oper->name); | |
501 | return 0; | |
502 | } | |
503 | ||
504 | /* now, yy_oper_list contains a stack of oper_conf's with just user | |
505 | * and host in, yy_oper contains the rest of the information which | |
506 | * we need to copy into each element in yy_oper_list | |
507 | */ | |
637c4932 | 508 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_oper_list.head) |
212380e3 AC |
509 | { |
510 | yy_tmpoper = ptr->data; | |
511 | ||
47a03750 | 512 | yy_tmpoper->name = rb_strdup(yy_oper->name); |
212380e3 AC |
513 | |
514 | /* could be an rsa key instead.. */ | |
515 | if(!EmptyString(yy_oper->passwd)) | |
47a03750 | 516 | yy_tmpoper->passwd = rb_strdup(yy_oper->passwd); |
212380e3 AC |
517 | |
518 | yy_tmpoper->flags = yy_oper->flags; | |
519 | yy_tmpoper->umodes = yy_oper->umodes; | |
520 | yy_tmpoper->snomask = yy_oper->snomask; | |
521 | ||
522 | #ifdef HAVE_LIBCRYPTO | |
523 | if(yy_oper->rsa_pubkey_file) | |
524 | { | |
525 | BIO *file; | |
526 | ||
527 | if((file = BIO_new_file(yy_oper->rsa_pubkey_file, "r")) == NULL) | |
528 | { | |
529 | conf_report_error("Ignoring operator block for %s -- " | |
530 | "rsa_public_key_file cant be opened", | |
531 | yy_tmpoper->name); | |
532 | return 0; | |
533 | } | |
534 | ||
535 | yy_tmpoper->rsa_pubkey = | |
536 | (RSA *) PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); | |
537 | ||
c422d2a0 | 538 | (void)BIO_set_close(file, BIO_CLOSE); |
212380e3 AC |
539 | BIO_free(file); |
540 | ||
541 | if(yy_tmpoper->rsa_pubkey == NULL) | |
542 | { | |
543 | conf_report_error("Ignoring operator block for %s -- " | |
544 | "rsa_public_key_file key invalid; check syntax", | |
545 | yy_tmpoper->name); | |
546 | return 0; | |
547 | } | |
548 | } | |
549 | #endif | |
550 | ||
551 | /* all is ok, put it on oper_conf_list */ | |
330fc5c1 | 552 | rb_dlinkMoveNode(ptr, &yy_oper_list, &oper_conf_list); |
212380e3 AC |
553 | } |
554 | ||
555 | free_oper_conf(yy_oper); | |
556 | yy_oper = NULL; | |
557 | ||
558 | return 0; | |
559 | } | |
560 | ||
561 | static void | |
562 | conf_set_oper_flags(void *data) | |
563 | { | |
564 | conf_parm_t *args = data; | |
565 | ||
19c13ce5 | 566 | set_modes_from_table(&yy_oper->flags, "flag", oper_table, args); |
212380e3 AC |
567 | } |
568 | ||
569 | static void | |
570 | conf_set_oper_user(void *data) | |
571 | { | |
572 | struct oper_conf *yy_tmpoper; | |
573 | char *p; | |
574 | char *host = (char *) data; | |
575 | ||
576 | yy_tmpoper = make_oper_conf(); | |
577 | ||
578 | if((p = strchr(host, '@'))) | |
579 | { | |
580 | *p++ = '\0'; | |
581 | ||
47a03750 VY |
582 | yy_tmpoper->username = rb_strdup(host); |
583 | yy_tmpoper->host = rb_strdup(p); | |
212380e3 AC |
584 | } |
585 | else | |
586 | { | |
587 | ||
47a03750 VY |
588 | yy_tmpoper->username = rb_strdup("*"); |
589 | yy_tmpoper->host = rb_strdup(host); | |
212380e3 AC |
590 | } |
591 | ||
592 | if(EmptyString(yy_tmpoper->username) || EmptyString(yy_tmpoper->host)) | |
593 | { | |
594 | conf_report_error("Ignoring user -- missing username/host"); | |
595 | free_oper_conf(yy_tmpoper); | |
596 | return; | |
597 | } | |
598 | ||
330fc5c1 | 599 | rb_dlinkAddAlloc(yy_tmpoper, &yy_oper_list); |
212380e3 AC |
600 | } |
601 | ||
602 | static void | |
603 | conf_set_oper_password(void *data) | |
604 | { | |
605 | if(yy_oper->passwd) | |
606 | { | |
607 | memset(yy_oper->passwd, 0, strlen(yy_oper->passwd)); | |
637c4932 | 608 | rb_free(yy_oper->passwd); |
212380e3 AC |
609 | } |
610 | ||
47a03750 | 611 | yy_oper->passwd = rb_strdup((char *) data); |
212380e3 AC |
612 | } |
613 | ||
614 | static void | |
615 | conf_set_oper_rsa_public_key_file(void *data) | |
616 | { | |
617 | #ifdef HAVE_LIBCRYPTO | |
637c4932 | 618 | rb_free(yy_oper->rsa_pubkey_file); |
47a03750 | 619 | yy_oper->rsa_pubkey_file = rb_strdup((char *) data); |
212380e3 AC |
620 | #else |
621 | conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available"); | |
622 | #endif | |
623 | } | |
624 | ||
625 | static void | |
626 | conf_set_oper_umodes(void *data) | |
627 | { | |
628 | set_modes_from_table(&yy_oper->umodes, "umode", umode_table, data); | |
629 | } | |
630 | ||
631 | static void | |
632 | conf_set_oper_snomask(void *data) | |
633 | { | |
634 | yy_oper->snomask = parse_snobuf_to_mask(0, (const char *) data); | |
635 | } | |
636 | ||
637 | static int | |
638 | conf_begin_class(struct TopConf *tc) | |
639 | { | |
640 | if(yy_class) | |
641 | free_class(yy_class); | |
642 | ||
643 | yy_class = make_class(); | |
644 | return 0; | |
645 | } | |
646 | ||
647 | static int | |
648 | conf_end_class(struct TopConf *tc) | |
649 | { | |
650 | if(conf_cur_block_name != NULL) | |
47a03750 | 651 | yy_class->class_name = rb_strdup(conf_cur_block_name); |
212380e3 AC |
652 | |
653 | if(EmptyString(yy_class->class_name)) | |
654 | { | |
655 | conf_report_error("Ignoring connect block -- missing name."); | |
656 | return 0; | |
657 | } | |
658 | ||
659 | add_class(yy_class); | |
660 | yy_class = NULL; | |
661 | return 0; | |
662 | } | |
663 | ||
664 | static void | |
665 | conf_set_class_ping_time(void *data) | |
666 | { | |
667 | yy_class->ping_freq = *(unsigned int *) data; | |
668 | } | |
669 | ||
670 | static void | |
671 | conf_set_class_cidr_bitlen(void *data) | |
672 | { | |
ccda6e3f | 673 | #ifdef RB_IPV6 |
212380e3 AC |
674 | unsigned int maxsize = 128; |
675 | #else | |
676 | unsigned int maxsize = 32; | |
677 | #endif | |
678 | if(*(unsigned int *) data > maxsize) | |
679 | conf_report_error | |
680 | ("class::cidr_bitlen argument exceeds maxsize (%d > %d) - ignoring.", | |
681 | *(unsigned int *) data, maxsize); | |
682 | else | |
683 | yy_class->cidr_bitlen = *(unsigned int *) data; | |
684 | ||
685 | } | |
686 | static void | |
687 | conf_set_class_number_per_cidr(void *data) | |
688 | { | |
689 | yy_class->cidr_amount = *(unsigned int *) data; | |
690 | } | |
691 | ||
692 | static void | |
693 | conf_set_class_number_per_ip(void *data) | |
694 | { | |
695 | yy_class->max_local = *(unsigned int *) data; | |
696 | } | |
697 | ||
698 | ||
699 | static void | |
700 | conf_set_class_number_per_ip_global(void *data) | |
701 | { | |
702 | yy_class->max_global = *(unsigned int *) data; | |
703 | } | |
704 | ||
705 | static void | |
706 | conf_set_class_number_per_ident(void *data) | |
707 | { | |
708 | yy_class->max_ident = *(unsigned int *) data; | |
709 | } | |
710 | ||
711 | static void | |
712 | conf_set_class_connectfreq(void *data) | |
713 | { | |
714 | yy_class->con_freq = *(unsigned int *) data; | |
715 | } | |
716 | ||
717 | static void | |
718 | conf_set_class_max_number(void *data) | |
719 | { | |
720 | yy_class->max_total = *(unsigned int *) data; | |
721 | } | |
722 | ||
723 | static void | |
724 | conf_set_class_sendq(void *data) | |
725 | { | |
726 | yy_class->max_sendq = *(unsigned int *) data; | |
727 | } | |
728 | ||
729 | static char *listener_address; | |
730 | ||
731 | static int | |
732 | conf_begin_listen(struct TopConf *tc) | |
733 | { | |
637c4932 | 734 | rb_free(listener_address); |
212380e3 AC |
735 | listener_address = NULL; |
736 | return 0; | |
737 | } | |
738 | ||
739 | static int | |
740 | conf_end_listen(struct TopConf *tc) | |
741 | { | |
637c4932 | 742 | rb_free(listener_address); |
212380e3 AC |
743 | listener_address = NULL; |
744 | return 0; | |
745 | } | |
746 | ||
c6d72037 VY |
747 | |
748 | ||
212380e3 | 749 | static void |
c6d72037 | 750 | conf_set_listen_port_both(void *data, int ssl) |
212380e3 AC |
751 | { |
752 | conf_parm_t *args = data; | |
753 | for (; args; args = args->next) | |
754 | { | |
755 | if((args->type & CF_MTYPE) != CF_INT) | |
756 | { | |
757 | conf_report_error | |
758 | ("listener::port argument is not an integer " "-- ignoring."); | |
759 | continue; | |
760 | } | |
761 | if(listener_address == NULL) | |
762 | { | |
c6d72037 | 763 | add_listener(args->v.number, listener_address, AF_INET, ssl); |
ccda6e3f | 764 | #ifdef RB_IPV6 |
c6d72037 | 765 | add_listener(args->v.number, listener_address, AF_INET6, ssl); |
212380e3 AC |
766 | #endif |
767 | } | |
768 | else | |
769 | { | |
770 | int family; | |
ccda6e3f | 771 | #ifdef RB_IPV6 |
212380e3 AC |
772 | if(strchr(listener_address, ':') != NULL) |
773 | family = AF_INET6; | |
774 | else | |
775 | #endif | |
776 | family = AF_INET; | |
777 | ||
c6d72037 | 778 | add_listener(args->v.number, listener_address, family, ssl); |
212380e3 AC |
779 | |
780 | } | |
781 | ||
782 | } | |
783 | } | |
784 | ||
8bd5767b JT |
785 | static void |
786 | conf_set_listen_port(void *data) | |
787 | { | |
788 | conf_set_listen_port_both(data, 0); | |
789 | } | |
790 | ||
791 | static void | |
792 | conf_set_listen_sslport(void *data) | |
793 | { | |
794 | conf_set_listen_port_both(data, 1); | |
c6d72037 VY |
795 | } |
796 | ||
212380e3 AC |
797 | static void |
798 | conf_set_listen_address(void *data) | |
799 | { | |
637c4932 | 800 | rb_free(listener_address); |
47a03750 | 801 | listener_address = rb_strdup(data); |
212380e3 AC |
802 | } |
803 | ||
804 | static int | |
805 | conf_begin_auth(struct TopConf *tc) | |
806 | { | |
330fc5c1 | 807 | rb_dlink_node *ptr; |
637c4932 | 808 | rb_dlink_node *next_ptr; |
212380e3 AC |
809 | |
810 | if(yy_aconf) | |
811 | free_conf(yy_aconf); | |
812 | ||
637c4932 | 813 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head) |
212380e3 AC |
814 | { |
815 | free_conf(ptr->data); | |
330fc5c1 | 816 | rb_dlinkDestroy(ptr, &yy_aconf_list); |
212380e3 AC |
817 | } |
818 | ||
819 | yy_aconf = make_conf(); | |
820 | yy_aconf->status = CONF_CLIENT; | |
821 | ||
822 | return 0; | |
823 | } | |
824 | ||
825 | static int | |
826 | conf_end_auth(struct TopConf *tc) | |
827 | { | |
828 | struct ConfItem *yy_tmp; | |
330fc5c1 | 829 | rb_dlink_node *ptr; |
637c4932 | 830 | rb_dlink_node *next_ptr; |
212380e3 AC |
831 | |
832 | if(EmptyString(yy_aconf->name)) | |
47a03750 | 833 | yy_aconf->name = rb_strdup("NOMATCH"); |
212380e3 AC |
834 | |
835 | /* didnt even get one ->host? */ | |
836 | if(EmptyString(yy_aconf->host)) | |
837 | { | |
838 | conf_report_error("Ignoring auth block -- missing user@host"); | |
839 | return 0; | |
840 | } | |
841 | ||
842 | /* so the stacking works in order.. */ | |
843 | collapse(yy_aconf->user); | |
844 | collapse(yy_aconf->host); | |
845 | conf_add_class_to_conf(yy_aconf); | |
846 | add_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user, yy_aconf); | |
847 | ||
637c4932 | 848 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head) |
212380e3 AC |
849 | { |
850 | yy_tmp = ptr->data; | |
851 | ||
852 | if(yy_aconf->passwd) | |
47a03750 | 853 | yy_tmp->passwd = rb_strdup(yy_aconf->passwd); |
212380e3 AC |
854 | |
855 | /* this will always exist.. */ | |
47a03750 | 856 | yy_tmp->name = rb_strdup(yy_aconf->name); |
212380e3 AC |
857 | |
858 | if(yy_aconf->className) | |
47a03750 | 859 | yy_tmp->className = rb_strdup(yy_aconf->className); |
212380e3 AC |
860 | |
861 | yy_tmp->flags = yy_aconf->flags; | |
862 | yy_tmp->port = yy_aconf->port; | |
863 | ||
864 | collapse(yy_tmp->user); | |
865 | collapse(yy_tmp->host); | |
866 | ||
867 | conf_add_class_to_conf(yy_tmp); | |
868 | ||
869 | add_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user, yy_tmp); | |
330fc5c1 | 870 | rb_dlinkDestroy(ptr, &yy_aconf_list); |
212380e3 AC |
871 | } |
872 | ||
873 | yy_aconf = NULL; | |
874 | return 0; | |
875 | } | |
876 | ||
877 | static void | |
878 | conf_set_auth_user(void *data) | |
879 | { | |
880 | struct ConfItem *yy_tmp; | |
881 | char *p; | |
882 | ||
883 | /* The first user= line doesn't allocate a new conf */ | |
884 | if(!EmptyString(yy_aconf->host)) | |
885 | { | |
886 | yy_tmp = make_conf(); | |
887 | yy_tmp->status = CONF_CLIENT; | |
888 | } | |
889 | else | |
890 | yy_tmp = yy_aconf; | |
891 | ||
892 | if((p = strchr(data, '@'))) | |
893 | { | |
894 | *p++ = '\0'; | |
895 | ||
47a03750 VY |
896 | yy_tmp->user = rb_strdup(data); |
897 | yy_tmp->host = rb_strdup(p); | |
212380e3 AC |
898 | } |
899 | else | |
900 | { | |
47a03750 VY |
901 | yy_tmp->user = rb_strdup("*"); |
902 | yy_tmp->host = rb_strdup(data); | |
212380e3 AC |
903 | } |
904 | ||
905 | if(yy_aconf != yy_tmp) | |
330fc5c1 | 906 | rb_dlinkAddAlloc(yy_tmp, &yy_aconf_list); |
212380e3 AC |
907 | } |
908 | ||
909 | static void | |
910 | conf_set_auth_passwd(void *data) | |
911 | { | |
912 | if(yy_aconf->passwd) | |
913 | memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); | |
637c4932 | 914 | rb_free(yy_aconf->passwd); |
47a03750 | 915 | yy_aconf->passwd = rb_strdup(data); |
212380e3 AC |
916 | } |
917 | ||
918 | static void | |
919 | conf_set_auth_spoof(void *data) | |
920 | { | |
921 | char *p; | |
922 | char *user = NULL; | |
923 | char *host = NULL; | |
924 | ||
925 | host = data; | |
926 | ||
927 | /* user@host spoof */ | |
928 | if((p = strchr(host, '@')) != NULL) | |
929 | { | |
930 | *p = '\0'; | |
931 | user = data; | |
932 | host = p+1; | |
933 | ||
934 | if(EmptyString(user)) | |
935 | { | |
936 | conf_report_error("Warning -- spoof ident empty."); | |
937 | return; | |
938 | } | |
939 | ||
940 | if(strlen(user) > USERLEN) | |
941 | { | |
942 | conf_report_error("Warning -- spoof ident length invalid."); | |
943 | return; | |
944 | } | |
945 | ||
946 | if(!valid_username(user)) | |
947 | { | |
948 | conf_report_error("Warning -- invalid spoof (ident)."); | |
949 | return; | |
950 | } | |
951 | ||
952 | /* this must be restored! */ | |
953 | *p = '@'; | |
954 | } | |
955 | ||
956 | if(EmptyString(host)) | |
957 | { | |
958 | conf_report_error("Warning -- spoof host empty."); | |
959 | return; | |
960 | } | |
961 | ||
962 | if(strlen(host) > HOSTLEN) | |
963 | { | |
964 | conf_report_error("Warning -- spoof host length invalid."); | |
965 | return; | |
966 | } | |
967 | ||
968 | if(!valid_hostname(host)) | |
969 | { | |
970 | conf_report_error("Warning -- invalid spoof (host)."); | |
971 | return; | |
972 | } | |
973 | ||
637c4932 | 974 | rb_free(yy_aconf->name); |
47a03750 | 975 | yy_aconf->name = rb_strdup(data); |
212380e3 AC |
976 | yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; |
977 | } | |
978 | ||
979 | static void | |
980 | conf_set_auth_flags(void *data) | |
981 | { | |
982 | conf_parm_t *args = data; | |
983 | ||
984 | set_modes_from_table((int *) &yy_aconf->flags, "flag", auth_table, args); | |
985 | } | |
986 | ||
987 | static void | |
988 | conf_set_auth_redir_serv(void *data) | |
989 | { | |
990 | yy_aconf->flags |= CONF_FLAGS_REDIR; | |
637c4932 | 991 | rb_free(yy_aconf->name); |
47a03750 | 992 | yy_aconf->name = rb_strdup(data); |
212380e3 AC |
993 | } |
994 | ||
995 | static void | |
996 | conf_set_auth_redir_port(void *data) | |
997 | { | |
998 | int port = *(unsigned int *) data; | |
999 | ||
1000 | yy_aconf->flags |= CONF_FLAGS_REDIR; | |
1001 | yy_aconf->port = port; | |
1002 | } | |
1003 | ||
1004 | static void | |
1005 | conf_set_auth_class(void *data) | |
1006 | { | |
637c4932 | 1007 | rb_free(yy_aconf->className); |
47a03750 | 1008 | yy_aconf->className = rb_strdup(data); |
212380e3 AC |
1009 | } |
1010 | ||
1011 | /* ok, shared_oper handles the stacking, shared_flags handles adding | |
1012 | * things.. so all we need to do when we start and end a shared block, is | |
1013 | * clean up anything thats been left over. | |
1014 | */ | |
1015 | static int | |
1016 | conf_cleanup_shared(struct TopConf *tc) | |
1017 | { | |
637c4932 | 1018 | rb_dlink_node *ptr, *next_ptr; |
212380e3 | 1019 | |
637c4932 | 1020 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head) |
212380e3 AC |
1021 | { |
1022 | free_remote_conf(ptr->data); | |
330fc5c1 | 1023 | rb_dlinkDestroy(ptr, &yy_shared_list); |
212380e3 AC |
1024 | } |
1025 | ||
1026 | if(yy_shared != NULL) | |
1027 | { | |
1028 | free_remote_conf(yy_shared); | |
1029 | yy_shared = NULL; | |
1030 | } | |
1031 | ||
1032 | return 0; | |
1033 | } | |
1034 | ||
1035 | static void | |
1036 | conf_set_shared_oper(void *data) | |
1037 | { | |
1038 | conf_parm_t *args = data; | |
1039 | const char *username; | |
1040 | char *p; | |
1041 | ||
1042 | if(yy_shared != NULL) | |
1043 | free_remote_conf(yy_shared); | |
1044 | ||
1045 | yy_shared = make_remote_conf(); | |
1046 | ||
1047 | if(args->next != NULL) | |
1048 | { | |
1049 | if((args->type & CF_MTYPE) != CF_QSTRING) | |
1050 | { | |
1051 | conf_report_error("Ignoring shared::oper -- server is not a qstring"); | |
1052 | return; | |
1053 | } | |
1054 | ||
47a03750 | 1055 | yy_shared->server = rb_strdup(args->v.string); |
212380e3 AC |
1056 | args = args->next; |
1057 | } | |
1058 | else | |
47a03750 | 1059 | yy_shared->server = rb_strdup("*"); |
212380e3 AC |
1060 | |
1061 | if((args->type & CF_MTYPE) != CF_QSTRING) | |
1062 | { | |
1063 | conf_report_error("Ignoring shared::oper -- oper is not a qstring"); | |
1064 | return; | |
1065 | } | |
1066 | ||
1067 | if((p = strchr(args->v.string, '@')) == NULL) | |
1068 | { | |
1069 | conf_report_error("Ignoring shard::oper -- oper is not a user@host"); | |
1070 | return; | |
1071 | } | |
1072 | ||
1073 | username = args->v.string; | |
1074 | *p++ = '\0'; | |
1075 | ||
1076 | if(EmptyString(p)) | |
47a03750 | 1077 | yy_shared->host = rb_strdup("*"); |
212380e3 | 1078 | else |
47a03750 | 1079 | yy_shared->host = rb_strdup(p); |
212380e3 AC |
1080 | |
1081 | if(EmptyString(username)) | |
47a03750 | 1082 | yy_shared->username = rb_strdup("*"); |
212380e3 | 1083 | else |
47a03750 | 1084 | yy_shared->username = rb_strdup(username); |
212380e3 | 1085 | |
330fc5c1 | 1086 | rb_dlinkAddAlloc(yy_shared, &yy_shared_list); |
212380e3 AC |
1087 | yy_shared = NULL; |
1088 | } | |
1089 | ||
1090 | static void | |
1091 | conf_set_shared_flags(void *data) | |
1092 | { | |
1093 | conf_parm_t *args = data; | |
1094 | int flags = 0; | |
637c4932 | 1095 | rb_dlink_node *ptr, *next_ptr; |
212380e3 AC |
1096 | |
1097 | if(yy_shared != NULL) | |
1098 | free_remote_conf(yy_shared); | |
1099 | ||
1100 | set_modes_from_table(&flags, "flag", shared_table, args); | |
1101 | ||
637c4932 | 1102 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head) |
212380e3 AC |
1103 | { |
1104 | yy_shared = ptr->data; | |
1105 | ||
1106 | yy_shared->flags = flags; | |
330fc5c1 AC |
1107 | rb_dlinkDestroy(ptr, &yy_shared_list); |
1108 | rb_dlinkAddTail(yy_shared, &yy_shared->node, &shared_conf_list); | |
212380e3 AC |
1109 | } |
1110 | ||
1111 | yy_shared = NULL; | |
1112 | } | |
1113 | ||
1114 | static int | |
1115 | conf_begin_connect(struct TopConf *tc) | |
1116 | { | |
1117 | if(yy_server) | |
1118 | free_server_conf(yy_server); | |
1119 | ||
1120 | yy_server = make_server_conf(); | |
1121 | yy_server->port = PORTNUM; | |
5aa453a4 | 1122 | yy_server->flags |= SERVER_TB; |
212380e3 AC |
1123 | |
1124 | if(conf_cur_block_name != NULL) | |
47a03750 | 1125 | yy_server->name = rb_strdup(conf_cur_block_name); |
212380e3 AC |
1126 | |
1127 | return 0; | |
1128 | } | |
1129 | ||
1130 | static int | |
1131 | conf_end_connect(struct TopConf *tc) | |
1132 | { | |
1133 | if(EmptyString(yy_server->name)) | |
1134 | { | |
1135 | conf_report_error("Ignoring connect block -- missing name."); | |
1136 | return 0; | |
1137 | } | |
1138 | ||
1139 | if(ServerInfo.name != NULL && !irccmp(ServerInfo.name, yy_server->name)) | |
1140 | { | |
1141 | conf_report_error("Ignoring connect block for %s -- name is equal to my own name.", | |
1142 | yy_server->name); | |
1143 | return 0; | |
1144 | } | |
1145 | ||
1146 | if(EmptyString(yy_server->passwd) || EmptyString(yy_server->spasswd)) | |
1147 | { | |
1148 | conf_report_error("Ignoring connect block for %s -- missing password.", | |
1149 | yy_server->name); | |
1150 | return 0; | |
1151 | } | |
1152 | ||
1153 | if(EmptyString(yy_server->host)) | |
1154 | { | |
1155 | conf_report_error("Ignoring connect block for %s -- missing host.", | |
1156 | yy_server->name); | |
1157 | return 0; | |
1158 | } | |
1159 | ||
1160 | #ifndef HAVE_LIBZ | |
1161 | if(ServerConfCompressed(yy_server)) | |
1162 | { | |
1163 | conf_report_error("Ignoring connect::flags::compressed -- zlib not available."); | |
1164 | yy_server->flags &= ~SERVER_COMPRESSED; | |
1165 | } | |
1166 | #endif | |
8bd5767b JT |
1167 | if(ServerConfCompressed(yy_server) && ServerConfSSL(yy_server)) |
1168 | { | |
1169 | conf_report_error("Ignoring compressed for connect block %s -- " | |
1170 | "ssl and compressed are mutually exclusive (OpenSSL does its own compression)", | |
1171 | yy_server->name); | |
1172 | yy_server->flags &= ~SERVER_COMPRESSED; | |
c6d72037 | 1173 | } |
212380e3 AC |
1174 | |
1175 | add_server_conf(yy_server); | |
330fc5c1 | 1176 | rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list); |
212380e3 AC |
1177 | |
1178 | yy_server = NULL; | |
1179 | return 0; | |
1180 | } | |
1181 | ||
1182 | static void | |
1183 | conf_set_connect_host(void *data) | |
1184 | { | |
637c4932 | 1185 | rb_free(yy_server->host); |
47a03750 | 1186 | yy_server->host = rb_strdup(data); |
212380e3 AC |
1187 | if (strchr(yy_server->host, ':')) |
1188 | yy_server->aftype = AF_INET6; | |
1189 | } | |
1190 | ||
1191 | static void | |
1192 | conf_set_connect_vhost(void *data) | |
1193 | { | |
1194 | if(inetpton_sock(data, (struct sockaddr *)&yy_server->my_ipnum) <= 0) | |
1195 | { | |
1196 | conf_report_error("Invalid netmask for server vhost (%s)", | |
1197 | (char *) data); | |
1198 | return; | |
1199 | } | |
1200 | ||
1201 | yy_server->flags |= SERVER_VHOSTED; | |
1202 | } | |
1203 | ||
1204 | static void | |
1205 | conf_set_connect_send_password(void *data) | |
1206 | { | |
1207 | if(yy_server->spasswd) | |
1208 | { | |
1209 | memset(yy_server->spasswd, 0, strlen(yy_server->spasswd)); | |
637c4932 | 1210 | rb_free(yy_server->spasswd); |
212380e3 AC |
1211 | } |
1212 | ||
47a03750 | 1213 | yy_server->spasswd = rb_strdup(data); |
212380e3 AC |
1214 | } |
1215 | ||
1216 | static void | |
1217 | conf_set_connect_accept_password(void *data) | |
1218 | { | |
1219 | if(yy_server->passwd) | |
1220 | { | |
1221 | memset(yy_server->passwd, 0, strlen(yy_server->passwd)); | |
637c4932 | 1222 | rb_free(yy_server->passwd); |
212380e3 | 1223 | } |
47a03750 | 1224 | yy_server->passwd = rb_strdup(data); |
212380e3 AC |
1225 | } |
1226 | ||
1227 | static void | |
1228 | conf_set_connect_port(void *data) | |
1229 | { | |
1230 | int port = *(unsigned int *) data; | |
1231 | ||
1232 | if(port < 1) | |
1233 | port = PORTNUM; | |
1234 | ||
1235 | yy_server->port = port; | |
1236 | } | |
1237 | ||
1238 | static void | |
1239 | conf_set_connect_aftype(void *data) | |
1240 | { | |
1241 | char *aft = data; | |
1242 | ||
1243 | if(strcasecmp(aft, "ipv4") == 0) | |
1244 | yy_server->aftype = AF_INET; | |
ccda6e3f | 1245 | #ifdef RB_IPV6 |
212380e3 AC |
1246 | else if(strcasecmp(aft, "ipv6") == 0) |
1247 | yy_server->aftype = AF_INET6; | |
1248 | #endif | |
1249 | else | |
1250 | conf_report_error("connect::aftype '%s' is unknown.", aft); | |
1251 | } | |
1252 | ||
1253 | static void | |
1254 | conf_set_connect_flags(void *data) | |
1255 | { | |
1256 | conf_parm_t *args = data; | |
1257 | ||
1258 | /* note, we allow them to set compressed, then remove it later if | |
1259 | * they do and LIBZ isnt available | |
1260 | */ | |
1261 | set_modes_from_table(&yy_server->flags, "flag", connect_table, args); | |
1262 | } | |
1263 | ||
1264 | static void | |
1265 | conf_set_connect_hub_mask(void *data) | |
1266 | { | |
1267 | struct remote_conf *yy_hub; | |
1268 | ||
1269 | if(EmptyString(yy_server->name)) | |
1270 | return; | |
1271 | ||
1272 | yy_hub = make_remote_conf(); | |
1273 | yy_hub->flags = CONF_HUB; | |
1274 | ||
47a03750 VY |
1275 | yy_hub->host = rb_strdup(data); |
1276 | yy_hub->server = rb_strdup(yy_server->name); | |
330fc5c1 | 1277 | rb_dlinkAdd(yy_hub, &yy_hub->node, &hubleaf_conf_list); |
212380e3 AC |
1278 | } |
1279 | ||
1280 | static void | |
1281 | conf_set_connect_leaf_mask(void *data) | |
1282 | { | |
1283 | struct remote_conf *yy_leaf; | |
1284 | ||
1285 | if(EmptyString(yy_server->name)) | |
1286 | return; | |
1287 | ||
1288 | yy_leaf = make_remote_conf(); | |
1289 | yy_leaf->flags = CONF_LEAF; | |
1290 | ||
47a03750 VY |
1291 | yy_leaf->host = rb_strdup(data); |
1292 | yy_leaf->server = rb_strdup(yy_server->name); | |
330fc5c1 | 1293 | rb_dlinkAdd(yy_leaf, &yy_leaf->node, &hubleaf_conf_list); |
212380e3 AC |
1294 | } |
1295 | ||
1296 | static void | |
1297 | conf_set_connect_class(void *data) | |
1298 | { | |
637c4932 | 1299 | rb_free(yy_server->class_name); |
47a03750 | 1300 | yy_server->class_name = rb_strdup(data); |
212380e3 AC |
1301 | } |
1302 | ||
1303 | static void | |
1304 | conf_set_exempt_ip(void *data) | |
1305 | { | |
1306 | struct ConfItem *yy_tmp; | |
1307 | ||
1308 | if(parse_netmask(data, NULL, NULL) == HM_HOST) | |
1309 | { | |
1310 | conf_report_error("Ignoring exempt -- invalid exempt::ip."); | |
1311 | return; | |
1312 | } | |
1313 | ||
1314 | yy_tmp = make_conf(); | |
47a03750 VY |
1315 | yy_tmp->passwd = rb_strdup("*"); |
1316 | yy_tmp->host = rb_strdup(data); | |
212380e3 AC |
1317 | yy_tmp->status = CONF_EXEMPTDLINE; |
1318 | add_conf_by_address(yy_tmp->host, CONF_EXEMPTDLINE, NULL, yy_tmp); | |
1319 | } | |
1320 | ||
1321 | static int | |
1322 | conf_cleanup_cluster(struct TopConf *tc) | |
1323 | { | |
637c4932 | 1324 | rb_dlink_node *ptr, *next_ptr; |
212380e3 | 1325 | |
637c4932 | 1326 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_cluster_list.head) |
212380e3 AC |
1327 | { |
1328 | free_remote_conf(ptr->data); | |
330fc5c1 | 1329 | rb_dlinkDestroy(ptr, &yy_cluster_list); |
212380e3 AC |
1330 | } |
1331 | ||
1332 | if(yy_shared != NULL) | |
1333 | { | |
1334 | free_remote_conf(yy_shared); | |
1335 | yy_shared = NULL; | |
1336 | } | |
1337 | ||
1338 | return 0; | |
1339 | } | |
1340 | ||
1341 | static void | |
1342 | conf_set_cluster_name(void *data) | |
1343 | { | |
1344 | if(yy_shared != NULL) | |
1345 | free_remote_conf(yy_shared); | |
1346 | ||
1347 | yy_shared = make_remote_conf(); | |
47a03750 | 1348 | yy_shared->server = rb_strdup(data); |
330fc5c1 | 1349 | rb_dlinkAddAlloc(yy_shared, &yy_cluster_list); |
212380e3 AC |
1350 | |
1351 | yy_shared = NULL; | |
1352 | } | |
1353 | ||
1354 | static void | |
1355 | conf_set_cluster_flags(void *data) | |
1356 | { | |
1357 | conf_parm_t *args = data; | |
1358 | int flags = 0; | |
637c4932 | 1359 | rb_dlink_node *ptr, *next_ptr; |
212380e3 AC |
1360 | |
1361 | if(yy_shared != NULL) | |
1362 | free_remote_conf(yy_shared); | |
1363 | ||
1364 | set_modes_from_table(&flags, "flag", cluster_table, args); | |
1365 | ||
637c4932 | 1366 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_cluster_list.head) |
212380e3 AC |
1367 | { |
1368 | yy_shared = ptr->data; | |
1369 | yy_shared->flags = flags; | |
330fc5c1 AC |
1370 | rb_dlinkAddTail(yy_shared, &yy_shared->node, &cluster_conf_list); |
1371 | rb_dlinkDestroy(ptr, &yy_cluster_list); | |
212380e3 AC |
1372 | } |
1373 | ||
1374 | yy_shared = NULL; | |
1375 | } | |
1376 | ||
1377 | static void | |
1378 | conf_set_general_havent_read_conf(void *data) | |
1379 | { | |
1380 | if(*(unsigned int *) data) | |
1381 | { | |
1382 | conf_report_error("You haven't read your config file properly."); | |
1383 | conf_report_error | |
1384 | ("There is a line in the example conf that will kill your server if not removed."); | |
1385 | conf_report_error | |
1386 | ("Consider actually reading/editing the conf file, and removing this line."); | |
1387 | if (!testing_conf) | |
1388 | exit(0); | |
1389 | } | |
1390 | } | |
1391 | ||
1392 | static void | |
1393 | conf_set_general_hide_error_messages(void *data) | |
1394 | { | |
1395 | char *val = data; | |
1396 | ||
1397 | if(strcasecmp(val, "yes") == 0) | |
1398 | ConfigFileEntry.hide_error_messages = 2; | |
1399 | else if(strcasecmp(val, "opers") == 0) | |
1400 | ConfigFileEntry.hide_error_messages = 1; | |
1401 | else if(strcasecmp(val, "no") == 0) | |
1402 | ConfigFileEntry.hide_error_messages = 0; | |
1403 | else | |
1404 | conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val); | |
1405 | } | |
1406 | ||
1407 | static void | |
1408 | conf_set_general_kline_delay(void *data) | |
1409 | { | |
1410 | ConfigFileEntry.kline_delay = *(unsigned int *) data; | |
1411 | ||
1412 | /* THIS MUST BE HERE to stop us being unable to check klines */ | |
1413 | kline_queued = 0; | |
1414 | } | |
1415 | ||
1416 | static void | |
1417 | conf_set_general_stats_k_oper_only(void *data) | |
1418 | { | |
1419 | char *val = data; | |
1420 | ||
1421 | if(strcasecmp(val, "yes") == 0) | |
1422 | ConfigFileEntry.stats_k_oper_only = 2; | |
1423 | else if(strcasecmp(val, "masked") == 0) | |
1424 | ConfigFileEntry.stats_k_oper_only = 1; | |
1425 | else if(strcasecmp(val, "no") == 0) | |
1426 | ConfigFileEntry.stats_k_oper_only = 0; | |
1427 | else | |
1428 | conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val); | |
1429 | } | |
1430 | ||
1431 | static void | |
1432 | conf_set_general_stats_i_oper_only(void *data) | |
1433 | { | |
1434 | char *val = data; | |
1435 | ||
1436 | if(strcasecmp(val, "yes") == 0) | |
1437 | ConfigFileEntry.stats_i_oper_only = 2; | |
1438 | else if(strcasecmp(val, "masked") == 0) | |
1439 | ConfigFileEntry.stats_i_oper_only = 1; | |
1440 | else if(strcasecmp(val, "no") == 0) | |
1441 | ConfigFileEntry.stats_i_oper_only = 0; | |
1442 | else | |
1443 | conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val); | |
1444 | } | |
1445 | ||
1446 | static void | |
1447 | conf_set_general_compression_level(void *data) | |
1448 | { | |
1449 | #ifdef HAVE_LIBZ | |
1450 | ConfigFileEntry.compression_level = *(unsigned int *) data; | |
1451 | ||
1452 | if((ConfigFileEntry.compression_level < 1) || (ConfigFileEntry.compression_level > 9)) | |
1453 | { | |
1454 | conf_report_error | |
1455 | ("Invalid general::compression_level %d -- using default.", | |
1456 | ConfigFileEntry.compression_level); | |
1457 | ConfigFileEntry.compression_level = 0; | |
1458 | } | |
1459 | #else | |
1460 | conf_report_error("Ignoring general::compression_level -- zlib not available."); | |
1461 | #endif | |
1462 | } | |
1463 | ||
1464 | static void | |
1465 | conf_set_general_default_umodes(void *data) | |
1466 | { | |
1467 | char *pm; | |
1468 | int what = MODE_ADD, flag; | |
1469 | ||
1470 | ConfigFileEntry.default_umodes = 0; | |
1471 | for (pm = (char *) data; *pm; pm++) | |
1472 | { | |
1473 | switch (*pm) | |
1474 | { | |
1475 | case '+': | |
1476 | what = MODE_ADD; | |
1477 | break; | |
1478 | case '-': | |
1479 | what = MODE_DEL; | |
1480 | break; | |
1481 | ||
1482 | /* don't allow +o */ | |
1483 | case 'o': | |
1484 | case 'S': | |
1485 | case ' ': | |
1486 | break; | |
1487 | ||
1488 | default: | |
1489 | if ((flag = user_modes[(unsigned char) *pm])) | |
1490 | { | |
1491 | /* Proper value has probably not yet been set | |
1492 | * so don't check oper_only_umodes -- jilles */ | |
1493 | if (what == MODE_ADD) | |
1494 | ConfigFileEntry.default_umodes |= flag; | |
1495 | else | |
1496 | ConfigFileEntry.default_umodes &= ~flag; | |
1497 | } | |
1498 | break; | |
1499 | } | |
1500 | } | |
1501 | } | |
1502 | ||
1503 | static void | |
1504 | conf_set_general_oper_umodes(void *data) | |
1505 | { | |
1506 | set_modes_from_table(&ConfigFileEntry.oper_umodes, "umode", umode_table, data); | |
1507 | } | |
1508 | ||
1509 | static void | |
1510 | conf_set_general_oper_only_umodes(void *data) | |
1511 | { | |
1512 | set_modes_from_table(&ConfigFileEntry.oper_only_umodes, "umode", umode_table, data); | |
1513 | } | |
1514 | ||
1515 | static void | |
1516 | conf_set_general_oper_snomask(void *data) | |
1517 | { | |
1518 | char *pm; | |
1519 | int what = MODE_ADD, flag; | |
1520 | ||
1521 | ConfigFileEntry.oper_snomask = 0; | |
1522 | for (pm = (char *) data; *pm; pm++) | |
1523 | { | |
1524 | switch (*pm) | |
1525 | { | |
1526 | case '+': | |
1527 | what = MODE_ADD; | |
1528 | break; | |
1529 | case '-': | |
1530 | what = MODE_DEL; | |
1531 | break; | |
1532 | ||
1533 | default: | |
1534 | if ((flag = snomask_modes[(unsigned char) *pm])) | |
1535 | { | |
1536 | if (what == MODE_ADD) | |
1537 | ConfigFileEntry.oper_snomask |= flag; | |
1538 | else | |
1539 | ConfigFileEntry.oper_snomask &= ~flag; | |
1540 | } | |
1541 | break; | |
1542 | } | |
1543 | } | |
1544 | } | |
1545 | ||
1546 | static void | |
1547 | conf_set_serverhide_links_delay(void *data) | |
1548 | { | |
1549 | int val = *(unsigned int *) data; | |
1550 | ||
212380e3 AC |
1551 | ConfigServerHide.links_delay = val; |
1552 | } | |
1553 | ||
1554 | static int | |
1555 | conf_begin_service(struct TopConf *tc) | |
1556 | { | |
1557 | struct Client *target_p; | |
330fc5c1 | 1558 | rb_dlink_node *ptr; |
212380e3 | 1559 | |
5cefa1d6 | 1560 | RB_DLINK_FOREACH(ptr, global_serv_list.head) |
212380e3 AC |
1561 | { |
1562 | target_p = ptr->data; | |
1563 | ||
1564 | target_p->flags &= ~FLAGS_SERVICE; | |
1565 | } | |
1566 | ||
1567 | return 0; | |
1568 | } | |
1569 | ||
1570 | static void | |
1571 | conf_set_service_name(void *data) | |
1572 | { | |
1573 | struct Client *target_p; | |
1574 | const char *s; | |
1575 | char *tmp; | |
1576 | int dots = 0; | |
1577 | ||
1578 | for(s = data; *s != '\0'; s++) | |
1579 | { | |
1580 | if(!IsServChar(*s)) | |
1581 | { | |
1582 | conf_report_error("Ignoring service::name " | |
1583 | "-- bogus servername."); | |
1584 | return; | |
1585 | } | |
1586 | else if(*s == '.') | |
1587 | dots++; | |
1588 | } | |
1589 | ||
1590 | if(!dots) | |
1591 | { | |
1592 | conf_report_error("Ignoring service::name -- must contain '.'"); | |
1593 | return; | |
1594 | } | |
1595 | ||
47a03750 | 1596 | tmp = rb_strdup(data); |
330fc5c1 | 1597 | rb_dlinkAddAlloc(tmp, &service_list); |
212380e3 AC |
1598 | |
1599 | if((target_p = find_server(NULL, tmp))) | |
1600 | target_p->flags |= FLAGS_SERVICE; | |
1601 | } | |
1602 | ||
212380e3 AC |
1603 | static int |
1604 | conf_begin_alias(struct TopConf *tc) | |
1605 | { | |
eddc2ab6 | 1606 | yy_alias = rb_malloc(sizeof(struct alias_entry)); |
212380e3 AC |
1607 | |
1608 | if (conf_cur_block_name != NULL) | |
47a03750 | 1609 | yy_alias->name = rb_strdup(conf_cur_block_name); |
212380e3 AC |
1610 | |
1611 | yy_alias->flags = 0; | |
1612 | yy_alias->hits = 0; | |
1613 | ||
1614 | return 0; | |
1615 | } | |
1616 | ||
1617 | static int | |
1618 | conf_end_alias(struct TopConf *tc) | |
1619 | { | |
212380e3 AC |
1620 | if (yy_alias == NULL) |
1621 | return -1; | |
1622 | ||
1623 | if (yy_alias->name == NULL) | |
1624 | { | |
1625 | conf_report_error("Ignoring alias -- must have a name."); | |
1626 | ||
637c4932 | 1627 | rb_free(yy_alias); |
212380e3 AC |
1628 | |
1629 | return -1; | |
1630 | } | |
1631 | ||
1632 | if (yy_alias->target == NULL) | |
1633 | { | |
1634 | conf_report_error("Ignoring alias -- must have a target."); | |
1635 | ||
637c4932 | 1636 | rb_free(yy_alias); |
212380e3 AC |
1637 | |
1638 | return -1; | |
1639 | } | |
1640 | ||
8ac75529 | 1641 | if (!alias_dict) |
90187f21 | 1642 | alias_dict = irc_dictionary_create(strcasecmp); |
212380e3 | 1643 | |
8ac75529 | 1644 | irc_dictionary_add(alias_dict, yy_alias->name, yy_alias); |
212380e3 AC |
1645 | |
1646 | return 0; | |
1647 | } | |
1648 | ||
1649 | static void | |
1650 | conf_set_alias_name(void *data) | |
1651 | { | |
1652 | if (data == NULL || yy_alias == NULL) /* this shouldn't ever happen */ | |
1653 | return; | |
1654 | ||
47a03750 | 1655 | yy_alias->name = rb_strdup(data); |
212380e3 AC |
1656 | } |
1657 | ||
1658 | static void | |
1659 | conf_set_alias_target(void *data) | |
1660 | { | |
1661 | if (data == NULL || yy_alias == NULL) /* this shouldn't ever happen */ | |
1662 | return; | |
1663 | ||
47a03750 | 1664 | yy_alias->target = rb_strdup(data); |
212380e3 AC |
1665 | } |
1666 | ||
1667 | static void | |
1668 | conf_set_blacklist_host(void *data) | |
1669 | { | |
47a03750 | 1670 | yy_blacklist_host = rb_strdup(data); |
212380e3 AC |
1671 | } |
1672 | ||
1673 | static void | |
1674 | conf_set_blacklist_reason(void *data) | |
1675 | { | |
47a03750 | 1676 | yy_blacklist_reason = rb_strdup(data); |
212380e3 AC |
1677 | |
1678 | if (yy_blacklist_host && yy_blacklist_reason) | |
1679 | { | |
1680 | new_blacklist(yy_blacklist_host, yy_blacklist_reason); | |
637c4932 VY |
1681 | rb_free(yy_blacklist_host); |
1682 | rb_free(yy_blacklist_reason); | |
212380e3 AC |
1683 | yy_blacklist_host = NULL; |
1684 | yy_blacklist_reason = NULL; | |
1685 | } | |
1686 | } | |
1687 | ||
1688 | /* public functions */ | |
1689 | ||
1690 | ||
1691 | void | |
1692 | conf_report_error(const char *fmt, ...) | |
1693 | { | |
1694 | va_list ap; | |
1695 | char msg[IRCD_BUFSIZE + 1] = { 0 }; | |
1696 | ||
1697 | va_start(ap, fmt); | |
afdc068c | 1698 | rb_vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); |
212380e3 AC |
1699 | va_end(ap); |
1700 | ||
1701 | if (testing_conf) | |
1702 | { | |
1703 | fprintf(stderr, "\"%s\", line %d: %s\n", current_file, lineno + 1, msg); | |
1704 | return; | |
1705 | } | |
1706 | ||
1707 | ierror("\"%s\", line %d: %s", current_file, lineno + 1, msg); | |
1708 | sendto_realops_snomask(SNO_GENERAL, L_ALL, "\"%s\", line %d: %s", current_file, lineno + 1, msg); | |
1709 | } | |
1710 | ||
1711 | int | |
1712 | conf_start_block(char *block, char *name) | |
1713 | { | |
1714 | if((conf_cur_block = find_top_conf(block)) == NULL) | |
1715 | { | |
1716 | conf_report_error("Configuration block '%s' is not defined.", block); | |
1717 | return -1; | |
1718 | } | |
1719 | ||
1720 | if(name) | |
47a03750 | 1721 | conf_cur_block_name = rb_strdup(name); |
212380e3 AC |
1722 | else |
1723 | conf_cur_block_name = NULL; | |
1724 | ||
1725 | if(conf_cur_block->tc_sfunc) | |
1726 | if(conf_cur_block->tc_sfunc(conf_cur_block) < 0) | |
1727 | return -1; | |
1728 | ||
1729 | return 0; | |
1730 | } | |
1731 | ||
1732 | int | |
1733 | conf_end_block(struct TopConf *tc) | |
1734 | { | |
1735 | if(tc->tc_efunc) | |
1736 | return tc->tc_efunc(tc); | |
1737 | ||
637c4932 | 1738 | rb_free(conf_cur_block_name); |
212380e3 AC |
1739 | return 0; |
1740 | } | |
1741 | ||
1742 | static void | |
1743 | conf_set_generic_int(void *data, void *location) | |
1744 | { | |
1745 | *((int *) location) = *((unsigned int *) data); | |
1746 | } | |
1747 | ||
1748 | static void | |
1749 | conf_set_generic_string(void *data, int len, void *location) | |
1750 | { | |
1751 | char **loc = location; | |
1752 | char *input = data; | |
1753 | ||
1754 | if(len && strlen(input) > len) | |
1755 | input[len] = '\0'; | |
1756 | ||
637c4932 | 1757 | rb_free(*loc); |
47a03750 | 1758 | *loc = rb_strdup(input); |
212380e3 AC |
1759 | } |
1760 | ||
1761 | int | |
1762 | conf_call_set(struct TopConf *tc, char *item, conf_parm_t * value, int type) | |
1763 | { | |
1764 | struct ConfEntry *cf; | |
1765 | conf_parm_t *cp; | |
1766 | ||
1767 | if(!tc) | |
1768 | return -1; | |
1769 | ||
1770 | if((cf = find_conf_item(tc, item)) == NULL) | |
1771 | { | |
1772 | conf_report_error | |
1773 | ("Non-existant configuration setting %s::%s.", tc->tc_name, (char *) item); | |
1774 | return -1; | |
1775 | } | |
1776 | ||
1777 | /* if it takes one thing, make sure they only passed one thing, | |
1778 | and handle as needed. */ | |
1779 | if(value->type & CF_FLIST && !cf->cf_type & CF_FLIST) | |
1780 | { | |
1781 | conf_report_error | |
1782 | ("Option %s::%s does not take a list of values.", tc->tc_name, item); | |
1783 | return -1; | |
1784 | } | |
1785 | ||
1786 | cp = value->v.list; | |
1787 | ||
1788 | ||
1789 | if(CF_TYPE(value->v.list->type) != CF_TYPE(cf->cf_type)) | |
1790 | { | |
1791 | /* if it expects a string value, but we got a yesno, | |
1792 | * convert it back | |
1793 | */ | |
1794 | if((CF_TYPE(value->v.list->type) == CF_YESNO) && | |
1795 | (CF_TYPE(cf->cf_type) == CF_STRING)) | |
1796 | { | |
1797 | value->v.list->type = CF_STRING; | |
1798 | ||
1799 | if(cp->v.number == 1) | |
47a03750 | 1800 | cp->v.string = rb_strdup("yes"); |
212380e3 | 1801 | else |
47a03750 | 1802 | cp->v.string = rb_strdup("no"); |
212380e3 AC |
1803 | } |
1804 | ||
1805 | /* maybe it's a CF_TIME and they passed CF_INT -- | |
1806 | should still be valid */ | |
1807 | else if(!((CF_TYPE(value->v.list->type) == CF_INT) && | |
1808 | (CF_TYPE(cf->cf_type) == CF_TIME))) | |
1809 | { | |
1810 | conf_report_error | |
1811 | ("Wrong type for %s::%s (expected %s, got %s)", | |
1812 | tc->tc_name, (char *) item, | |
1813 | conf_strtype(cf->cf_type), conf_strtype(value->v.list->type)); | |
1814 | return -1; | |
1815 | } | |
1816 | } | |
1817 | ||
1818 | if(cf->cf_type & CF_FLIST) | |
1819 | { | |
1820 | #if 0 | |
1821 | if(cf->cf_arg) | |
1822 | conf_set_generic_list(value->v.list, cf->cf_arg); | |
1823 | else | |
1824 | #endif | |
1825 | /* just pass it the extended argument list */ | |
1826 | cf->cf_func(value->v.list); | |
1827 | } | |
1828 | else | |
1829 | { | |
1830 | /* it's old-style, needs only one arg */ | |
1831 | switch (cf->cf_type) | |
1832 | { | |
1833 | case CF_INT: | |
1834 | case CF_TIME: | |
1835 | case CF_YESNO: | |
1836 | if(cf->cf_arg) | |
1837 | conf_set_generic_int(&cp->v.number, cf->cf_arg); | |
1838 | else | |
1839 | cf->cf_func(&cp->v.number); | |
1840 | break; | |
1841 | case CF_STRING: | |
1842 | case CF_QSTRING: | |
1843 | if(EmptyString(cp->v.string)) | |
1844 | conf_report_error("Ignoring %s::%s -- empty field", | |
1845 | tc->tc_name, item); | |
1846 | else if(cf->cf_arg) | |
1847 | conf_set_generic_string(cp->v.string, cf->cf_len, cf->cf_arg); | |
1848 | else | |
1849 | cf->cf_func(cp->v.string); | |
1850 | break; | |
1851 | } | |
1852 | } | |
1853 | ||
1854 | ||
1855 | return 0; | |
1856 | } | |
1857 | ||
1858 | int | |
1859 | add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *)) | |
1860 | { | |
1861 | struct TopConf *tc; | |
1862 | struct ConfEntry *cf; | |
1863 | ||
1864 | if((tc = find_top_conf(topconf)) == NULL) | |
1865 | return -1; | |
1866 | ||
1867 | if((cf = find_conf_item(tc, name)) != NULL) | |
1868 | return -1; | |
1869 | ||
eddc2ab6 | 1870 | cf = rb_malloc(sizeof(struct ConfEntry)); |
212380e3 | 1871 | |
d7f753cd | 1872 | cf->cf_name = name; |
212380e3 AC |
1873 | cf->cf_type = type; |
1874 | cf->cf_func = func; | |
1875 | cf->cf_arg = NULL; | |
1876 | ||
330fc5c1 | 1877 | rb_dlinkAddAlloc(cf, &tc->tc_items); |
212380e3 AC |
1878 | |
1879 | return 0; | |
1880 | } | |
1881 | ||
1882 | int | |
1883 | remove_conf_item(const char *topconf, const char *name) | |
1884 | { | |
1885 | struct TopConf *tc; | |
1886 | struct ConfEntry *cf; | |
330fc5c1 | 1887 | rb_dlink_node *ptr; |
212380e3 AC |
1888 | |
1889 | if((tc = find_top_conf(topconf)) == NULL) | |
1890 | return -1; | |
1891 | ||
1892 | if((cf = find_conf_item(tc, name)) == NULL) | |
1893 | return -1; | |
1894 | ||
330fc5c1 | 1895 | if((ptr = rb_dlinkFind(cf, &tc->tc_items)) == NULL) |
212380e3 AC |
1896 | return -1; |
1897 | ||
330fc5c1 | 1898 | rb_dlinkDestroy(ptr, &tc->tc_items); |
637c4932 | 1899 | rb_free(cf); |
212380e3 AC |
1900 | |
1901 | return 0; | |
1902 | } | |
1903 | ||
1904 | /* *INDENT-OFF* */ | |
1905 | static struct ConfEntry conf_serverinfo_table[] = | |
1906 | { | |
1907 | { "description", CF_QSTRING, NULL, 0, &ServerInfo.description }, | |
1908 | { "network_desc", CF_QSTRING, NULL, 0, &ServerInfo.network_desc }, | |
1909 | { "hub", CF_YESNO, NULL, 0, &ServerInfo.hub }, | |
212380e3 AC |
1910 | |
1911 | { "network_name", CF_QSTRING, conf_set_serverinfo_network_name, 0, NULL }, | |
1912 | { "name", CF_QSTRING, conf_set_serverinfo_name, 0, NULL }, | |
1913 | { "sid", CF_QSTRING, conf_set_serverinfo_sid, 0, NULL }, | |
1914 | { "vhost", CF_QSTRING, conf_set_serverinfo_vhost, 0, NULL }, | |
1915 | { "vhost6", CF_QSTRING, conf_set_serverinfo_vhost6, 0, NULL }, | |
1916 | ||
8bd5767b JT |
1917 | { "ssl_private_key", CF_QSTRING, NULL, 0, &ServerInfo.ssl_private_key }, |
1918 | { "ssl_ca_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_ca_cert }, | |
1919 | { "ssl_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_cert }, | |
1920 | { "ssl_dh_params", CF_QSTRING, NULL, 0, &ServerInfo.ssl_dh_params }, | |
c6d72037 VY |
1921 | { "ssld_count", CF_INT, NULL, 0, &ServerInfo.ssld_count }, |
1922 | ||
101db4c4 | 1923 | { "default_max_clients",CF_INT, NULL, 0, &ServerInfo.default_max_clients }, |
c2d96fcb | 1924 | |
212380e3 AC |
1925 | { "\0", 0, NULL, 0, NULL } |
1926 | }; | |
1927 | ||
1928 | static struct ConfEntry conf_admin_table[] = | |
1929 | { | |
1930 | { "name", CF_QSTRING, NULL, 200, &AdminInfo.name }, | |
1931 | { "description",CF_QSTRING, NULL, 200, &AdminInfo.description }, | |
1932 | { "email", CF_QSTRING, NULL, 200, &AdminInfo.email }, | |
1933 | { "\0", 0, NULL, 0, NULL } | |
1934 | }; | |
1935 | ||
1936 | static struct ConfEntry conf_log_table[] = | |
1937 | { | |
1938 | { "fname_userlog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_userlog }, | |
1939 | { "fname_fuserlog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_fuserlog }, | |
1940 | { "fname_operlog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_operlog }, | |
1941 | { "fname_foperlog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_foperlog }, | |
1942 | { "fname_serverlog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_serverlog }, | |
1943 | { "fname_killlog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_killlog }, | |
212380e3 AC |
1944 | { "fname_klinelog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_klinelog }, |
1945 | { "fname_operspylog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_operspylog }, | |
1946 | { "fname_ioerrorlog", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.fname_ioerrorlog }, | |
1947 | { "\0", 0, NULL, 0, NULL } | |
1948 | }; | |
1949 | ||
1950 | static struct ConfEntry conf_operator_table[] = | |
1951 | { | |
1952 | { "rsa_public_key_file", CF_QSTRING, conf_set_oper_rsa_public_key_file, 0, NULL }, | |
1953 | { "flags", CF_STRING | CF_FLIST, conf_set_oper_flags, 0, NULL }, | |
1954 | { "umodes", CF_STRING | CF_FLIST, conf_set_oper_umodes, 0, NULL }, | |
1955 | { "snomask", CF_QSTRING, conf_set_oper_snomask, 0, NULL }, | |
1956 | { "user", CF_QSTRING, conf_set_oper_user, 0, NULL }, | |
1957 | { "password", CF_QSTRING, conf_set_oper_password, 0, NULL }, | |
1958 | { "\0", 0, NULL, 0, NULL } | |
1959 | }; | |
1960 | ||
1961 | static struct ConfEntry conf_class_table[] = | |
1962 | { | |
1963 | { "ping_time", CF_TIME, conf_set_class_ping_time, 0, NULL }, | |
1964 | { "cidr_bitlen", CF_INT, conf_set_class_cidr_bitlen, 0, NULL }, | |
1965 | { "number_per_cidr", CF_INT, conf_set_class_number_per_cidr, 0, NULL }, | |
1966 | { "number_per_ip", CF_INT, conf_set_class_number_per_ip, 0, NULL }, | |
1967 | { "number_per_ip_global", CF_INT,conf_set_class_number_per_ip_global, 0, NULL }, | |
1968 | { "number_per_ident", CF_INT, conf_set_class_number_per_ident, 0, NULL }, | |
1969 | { "connectfreq", CF_TIME, conf_set_class_connectfreq, 0, NULL }, | |
1970 | { "max_number", CF_INT, conf_set_class_max_number, 0, NULL }, | |
1971 | { "sendq", CF_TIME, conf_set_class_sendq, 0, NULL }, | |
1972 | { "\0", 0, NULL, 0, NULL } | |
1973 | }; | |
1974 | ||
1975 | static struct ConfEntry conf_auth_table[] = | |
1976 | { | |
1977 | { "user", CF_QSTRING, conf_set_auth_user, 0, NULL }, | |
1978 | { "password", CF_QSTRING, conf_set_auth_passwd, 0, NULL }, | |
1979 | { "class", CF_QSTRING, conf_set_auth_class, 0, NULL }, | |
1980 | { "spoof", CF_QSTRING, conf_set_auth_spoof, 0, NULL }, | |
1981 | { "redirserv", CF_QSTRING, conf_set_auth_redir_serv, 0, NULL }, | |
1982 | { "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL }, | |
1983 | { "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL }, | |
1984 | { "\0", 0, NULL, 0, NULL } | |
1985 | }; | |
1986 | ||
1987 | static struct ConfEntry conf_connect_table[] = | |
1988 | { | |
1989 | { "send_password", CF_QSTRING, conf_set_connect_send_password, 0, NULL }, | |
1990 | { "accept_password", CF_QSTRING, conf_set_connect_accept_password, 0, NULL }, | |
1991 | { "flags", CF_STRING | CF_FLIST, conf_set_connect_flags, 0, NULL }, | |
1992 | { "host", CF_QSTRING, conf_set_connect_host, 0, NULL }, | |
1993 | { "vhost", CF_QSTRING, conf_set_connect_vhost, 0, NULL }, | |
1994 | { "port", CF_INT, conf_set_connect_port, 0, NULL }, | |
1995 | { "aftype", CF_STRING, conf_set_connect_aftype, 0, NULL }, | |
1996 | { "hub_mask", CF_QSTRING, conf_set_connect_hub_mask, 0, NULL }, | |
1997 | { "leaf_mask", CF_QSTRING, conf_set_connect_leaf_mask, 0, NULL }, | |
1998 | { "class", CF_QSTRING, conf_set_connect_class, 0, NULL }, | |
1999 | { "\0", 0, NULL, 0, NULL } | |
2000 | }; | |
2001 | ||
2002 | static struct ConfEntry conf_general_table[] = | |
2003 | { | |
2004 | { "oper_only_umodes", CF_STRING | CF_FLIST, conf_set_general_oper_only_umodes, 0, NULL }, | |
2005 | { "oper_umodes", CF_STRING | CF_FLIST, conf_set_general_oper_umodes, 0, NULL }, | |
2006 | { "oper_snomask", CF_QSTRING, conf_set_general_oper_snomask, 0, NULL }, | |
2007 | { "compression_level", CF_INT, conf_set_general_compression_level, 0, NULL }, | |
2008 | { "havent_read_conf", CF_YESNO, conf_set_general_havent_read_conf, 0, NULL }, | |
2009 | { "hide_error_messages",CF_STRING, conf_set_general_hide_error_messages,0, NULL }, | |
2010 | { "kline_delay", CF_TIME, conf_set_general_kline_delay, 0, NULL }, | |
2011 | { "stats_k_oper_only", CF_STRING, conf_set_general_stats_k_oper_only, 0, NULL }, | |
2012 | { "stats_i_oper_only", CF_STRING, conf_set_general_stats_i_oper_only, 0, NULL }, | |
2013 | { "default_umodes", CF_QSTRING, conf_set_general_default_umodes, 0, NULL }, | |
2014 | ||
2015 | { "default_operstring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operstring }, | |
2016 | { "default_adminstring",CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_adminstring }, | |
2017 | { "servicestring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.servicestring }, | |
2018 | { "egdpool_path", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.egdpool_path }, | |
2019 | { "kline_reason", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.kline_reason }, | |
2020 | { "identify_service", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.identifyservice }, | |
2021 | { "identify_command", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.identifycommand }, | |
2022 | { "servlink_path", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.servlink_path }, | |
2023 | ||
2024 | { "anti_spam_exit_message_time", CF_TIME, NULL, 0, &ConfigFileEntry.anti_spam_exit_message_time }, | |
2025 | { "disable_fake_channels", CF_YESNO, NULL, 0, &ConfigFileEntry.disable_fake_channels }, | |
2026 | { "min_nonwildcard_simple", CF_INT, NULL, 0, &ConfigFileEntry.min_nonwildcard_simple }, | |
2027 | { "non_redundant_klines", CF_YESNO, NULL, 0, &ConfigFileEntry.non_redundant_klines }, | |
2028 | { "tkline_expire_notices", CF_YESNO, NULL, 0, &ConfigFileEntry.tkline_expire_notices }, | |
2029 | ||
2030 | { "anti_nick_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.anti_nick_flood }, | |
2031 | { "burst_away", CF_YESNO, NULL, 0, &ConfigFileEntry.burst_away }, | |
2032 | { "caller_id_wait", CF_TIME, NULL, 0, &ConfigFileEntry.caller_id_wait }, | |
2033 | { "client_exit", CF_YESNO, NULL, 0, &ConfigFileEntry.client_exit }, | |
2034 | { "client_flood", CF_INT, NULL, 0, &ConfigFileEntry.client_flood }, | |
2035 | { "collision_fnc", CF_YESNO, NULL, 0, &ConfigFileEntry.collision_fnc }, | |
2036 | { "connect_timeout", CF_TIME, NULL, 0, &ConfigFileEntry.connect_timeout }, | |
2037 | { "default_floodcount", CF_INT, NULL, 0, &ConfigFileEntry.default_floodcount }, | |
2038 | { "disable_auth", CF_YESNO, NULL, 0, &ConfigFileEntry.disable_auth }, | |
212380e3 AC |
2039 | { "dots_in_ident", CF_INT, NULL, 0, &ConfigFileEntry.dots_in_ident }, |
2040 | { "failed_oper_notice", CF_YESNO, NULL, 0, &ConfigFileEntry.failed_oper_notice }, | |
212380e3 | 2041 | { "global_snotices", CF_YESNO, NULL, 0, &ConfigFileEntry.global_snotices }, |
212380e3 AC |
2042 | { "hide_spoof_ips", CF_YESNO, NULL, 0, &ConfigFileEntry.hide_spoof_ips }, |
2043 | { "dline_with_reason", CF_YESNO, NULL, 0, &ConfigFileEntry.dline_with_reason }, | |
2044 | { "kline_with_reason", CF_YESNO, NULL, 0, &ConfigFileEntry.kline_with_reason }, | |
2045 | { "map_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.map_oper_only }, | |
2046 | { "max_accept", CF_INT, NULL, 0, &ConfigFileEntry.max_accept }, | |
2047 | { "max_monitor", CF_INT, NULL, 0, &ConfigFileEntry.max_monitor }, | |
2048 | { "max_nick_time", CF_TIME, NULL, 0, &ConfigFileEntry.max_nick_time }, | |
2049 | { "max_nick_changes", CF_INT, NULL, 0, &ConfigFileEntry.max_nick_changes }, | |
2050 | { "max_targets", CF_INT, NULL, 0, &ConfigFileEntry.max_targets }, | |
54015b5f | 2051 | { "max_unknown_ip", CF_INT, NULL, 0, &ConfigFileEntry.max_unknown_ip }, |
212380e3 AC |
2052 | { "min_nonwildcard", CF_INT, NULL, 0, &ConfigFileEntry.min_nonwildcard }, |
2053 | { "nick_delay", CF_TIME, NULL, 0, &ConfigFileEntry.nick_delay }, | |
2054 | { "no_oper_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.no_oper_flood }, | |
2055 | { "operspy_admin_only", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_admin_only }, | |
2056 | { "operspy_dont_care_user_info", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_dont_care_user_info }, | |
2057 | { "pace_wait", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait }, | |
2058 | { "pace_wait_simple", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait_simple }, | |
2059 | { "ping_cookie", CF_YESNO, NULL, 0, &ConfigFileEntry.ping_cookie }, | |
2060 | { "reject_after_count", CF_INT, NULL, 0, &ConfigFileEntry.reject_after_count }, | |
2061 | { "reject_ban_time", CF_TIME, NULL, 0, &ConfigFileEntry.reject_ban_time }, | |
2062 | { "reject_duration", CF_TIME, NULL, 0, &ConfigFileEntry.reject_duration }, | |
2063 | { "short_motd", CF_YESNO, NULL, 0, &ConfigFileEntry.short_motd }, | |
2064 | { "stats_c_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_c_oper_only }, | |
2065 | { "stats_e_disabled", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_e_disabled }, | |
2066 | { "stats_h_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_h_oper_only }, | |
2067 | { "stats_o_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_o_oper_only }, | |
2068 | { "stats_P_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_P_oper_only }, | |
2069 | { "stats_y_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_y_oper_only }, | |
2070 | { "target_change", CF_YESNO, NULL, 0, &ConfigFileEntry.target_change }, | |
2071 | { "ts_max_delta", CF_TIME, NULL, 0, &ConfigFileEntry.ts_max_delta }, | |
2072 | { "use_egd", CF_YESNO, NULL, 0, &ConfigFileEntry.use_egd }, | |
2073 | { "ts_warn_delta", CF_TIME, NULL, 0, &ConfigFileEntry.ts_warn_delta }, | |
2074 | { "use_whois_actually", CF_YESNO, NULL, 0, &ConfigFileEntry.use_whois_actually }, | |
2075 | { "warn_no_nline", CF_YESNO, NULL, 0, &ConfigFileEntry.warn_no_nline }, | |
2076 | { "\0", 0, NULL, 0, NULL } | |
2077 | }; | |
2078 | ||
2079 | static struct ConfEntry conf_channel_table[] = | |
2080 | { | |
2081 | { "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count }, | |
2082 | { "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count }, | |
2083 | { "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho }, | |
212380e3 AC |
2084 | { "kick_on_split_riding", CF_YESNO, NULL, 0, &ConfigChannel.kick_on_split_riding }, |
2085 | { "knock_delay", CF_TIME, NULL, 0, &ConfigChannel.knock_delay }, | |
2086 | { "knock_delay_channel",CF_TIME, NULL, 0, &ConfigChannel.knock_delay_channel }, | |
2087 | { "max_bans", CF_INT, NULL, 0, &ConfigChannel.max_bans }, | |
2088 | { "max_bans_large", CF_INT, NULL, 0, &ConfigChannel.max_bans_large }, | |
2089 | { "max_chans_per_user", CF_INT, NULL, 0, &ConfigChannel.max_chans_per_user }, | |
2090 | { "no_create_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_create_on_split }, | |
2091 | { "no_join_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_join_on_split }, | |
2092 | { "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except }, | |
2093 | { "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex }, | |
2094 | { "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock }, | |
2095 | { "use_forward", CF_YESNO, NULL, 0, &ConfigChannel.use_forward }, | |
2096 | { "\0", 0, NULL, 0, NULL } | |
2097 | }; | |
2098 | ||
2099 | static struct ConfEntry conf_serverhide_table[] = | |
2100 | { | |
2101 | { "disable_hidden", CF_YESNO, NULL, 0, &ConfigServerHide.disable_hidden }, | |
2102 | { "flatten_links", CF_YESNO, NULL, 0, &ConfigServerHide.flatten_links }, | |
2103 | { "hidden", CF_YESNO, NULL, 0, &ConfigServerHide.hidden }, | |
2104 | { "links_delay", CF_TIME, conf_set_serverhide_links_delay, 0, NULL }, | |
2105 | { "\0", 0, NULL, 0, NULL } | |
2106 | }; | |
2107 | /* *INDENT-ON* */ | |
2108 | ||
2109 | void | |
2110 | newconf_init() | |
2111 | { | |
2112 | add_top_conf("modules", NULL, NULL, NULL); | |
2113 | add_conf_item("modules", "path", CF_QSTRING, conf_set_modules_path); | |
2114 | add_conf_item("modules", "module", CF_QSTRING, conf_set_modules_module); | |
2115 | ||
2116 | add_top_conf("serverinfo", NULL, NULL, conf_serverinfo_table); | |
2117 | add_top_conf("admin", NULL, NULL, conf_admin_table); | |
2118 | add_top_conf("log", NULL, NULL, conf_log_table); | |
2119 | add_top_conf("operator", conf_begin_oper, conf_end_oper, conf_operator_table); | |
2120 | add_top_conf("class", conf_begin_class, conf_end_class, conf_class_table); | |
2121 | ||
2122 | add_top_conf("listen", conf_begin_listen, conf_end_listen, NULL); | |
2123 | add_conf_item("listen", "port", CF_INT | CF_FLIST, conf_set_listen_port); | |
c6d72037 | 2124 | add_conf_item("listen", "sslport", CF_INT | CF_FLIST, conf_set_listen_sslport); |
212380e3 AC |
2125 | add_conf_item("listen", "ip", CF_QSTRING, conf_set_listen_address); |
2126 | add_conf_item("listen", "host", CF_QSTRING, conf_set_listen_address); | |
2127 | ||
2128 | add_top_conf("auth", conf_begin_auth, conf_end_auth, conf_auth_table); | |
2129 | ||
2130 | add_top_conf("shared", conf_cleanup_shared, conf_cleanup_shared, NULL); | |
2131 | add_conf_item("shared", "oper", CF_QSTRING|CF_FLIST, conf_set_shared_oper); | |
2132 | add_conf_item("shared", "flags", CF_STRING | CF_FLIST, conf_set_shared_flags); | |
2133 | ||
2134 | add_top_conf("connect", conf_begin_connect, conf_end_connect, conf_connect_table); | |
2135 | ||
2136 | add_top_conf("exempt", NULL, NULL, NULL); | |
2137 | add_conf_item("exempt", "ip", CF_QSTRING, conf_set_exempt_ip); | |
2138 | ||
2139 | add_top_conf("cluster", conf_cleanup_cluster, conf_cleanup_cluster, NULL); | |
2140 | add_conf_item("cluster", "name", CF_QSTRING, conf_set_cluster_name); | |
2141 | add_conf_item("cluster", "flags", CF_STRING | CF_FLIST, conf_set_cluster_flags); | |
2142 | ||
2143 | add_top_conf("general", NULL, NULL, conf_general_table); | |
2144 | add_top_conf("channel", NULL, NULL, conf_channel_table); | |
2145 | add_top_conf("serverhide", NULL, NULL, conf_serverhide_table); | |
2146 | ||
2147 | add_top_conf("service", conf_begin_service, NULL, NULL); | |
2148 | add_conf_item("service", "name", CF_QSTRING, conf_set_service_name); | |
2149 | ||
2150 | add_top_conf("alias", conf_begin_alias, conf_end_alias, NULL); | |
2151 | add_conf_item("alias", "name", CF_QSTRING, conf_set_alias_name); | |
2152 | add_conf_item("alias", "target", CF_QSTRING, conf_set_alias_target); | |
2153 | ||
2154 | add_top_conf("blacklist", NULL, NULL, NULL); | |
2155 | add_conf_item("blacklist", "host", CF_QSTRING, conf_set_blacklist_host); | |
2156 | add_conf_item("blacklist", "reject_reason", CF_QSTRING, conf_set_blacklist_reason); | |
2157 | } |