]>
Commit | Line | Data |
---|---|---|
212380e3 | 1 | /* This code is in the public domain. |
212380e3 AC |
2 | */ |
3 | ||
4 | #include "stdinc.h" | |
5 | ||
6 | #ifdef HAVE_LIBCRYPTO | |
7 | #include <openssl/pem.h> | |
8 | #include <openssl/rsa.h> | |
9 | #endif | |
10 | ||
212380e3 | 11 | #include "newconf.h" |
212380e3 | 12 | #include "ircd_defs.h" |
212380e3 | 13 | #include "common.h" |
4016731b | 14 | #include "logger.h" |
212380e3 AC |
15 | #include "s_conf.h" |
16 | #include "s_user.h" | |
17 | #include "s_newconf.h" | |
18 | #include "send.h" | |
19 | #include "setup.h" | |
20 | #include "modules.h" | |
21 | #include "listener.h" | |
22 | #include "hostmask.h" | |
23 | #include "s_serv.h" | |
212380e3 AC |
24 | #include "hash.h" |
25 | #include "cache.h" | |
26 | #include "ircd.h" | |
27 | #include "snomask.h" | |
28 | #include "blacklist.h" | |
c6d72037 | 29 | #include "sslproc.h" |
f8606875 | 30 | #include "privilege.h" |
63eb8567 | 31 | #include "chmode.h" |
212380e3 AC |
32 | |
33 | #define CF_TYPE(x) ((x) & CF_MTYPE) | |
34 | ||
02270e96 AC |
35 | static int yy_defer_accept = 1; |
36 | ||
212380e3 | 37 | struct TopConf *conf_cur_block; |
e12981c0 | 38 | static char *conf_cur_block_name = NULL; |
212380e3 | 39 | |
330fc5c1 | 40 | static rb_dlink_list conf_items; |
212380e3 AC |
41 | |
42 | static struct ConfItem *yy_aconf = NULL; | |
43 | ||
44 | static struct Class *yy_class = NULL; | |
45 | ||
46 | static struct remote_conf *yy_shared = NULL; | |
47 | static struct server_conf *yy_server = NULL; | |
48 | ||
330fc5c1 AC |
49 | static rb_dlink_list yy_aconf_list; |
50 | static rb_dlink_list yy_oper_list; | |
51 | static rb_dlink_list yy_shared_list; | |
52 | static rb_dlink_list yy_cluster_list; | |
212380e3 AC |
53 | static struct oper_conf *yy_oper = NULL; |
54 | ||
55 | static struct alias_entry *yy_alias = NULL; | |
56 | ||
57 | static char *yy_blacklist_host = NULL; | |
58 | static char *yy_blacklist_reason = NULL; | |
0a1e77c2 EM |
59 | static int yy_blacklist_ipv4 = 1; |
60 | static int yy_blacklist_ipv6 = 0; | |
3c93d380 | 61 | static rb_dlink_list yy_blacklist_filters; |
0a1e77c2 | 62 | |
f8606875 | 63 | static char *yy_privset_extends = NULL; |
212380e3 AC |
64 | |
65 | static const char * | |
66 | conf_strtype(int type) | |
67 | { | |
dceac3e4 | 68 | switch (CF_TYPE(type)) |
212380e3 AC |
69 | { |
70 | case CF_INT: | |
71 | return "integer value"; | |
72 | case CF_STRING: | |
73 | return "unquoted string"; | |
74 | case CF_YESNO: | |
75 | return "yes/no value"; | |
76 | case CF_QSTRING: | |
77 | return "quoted string"; | |
78 | case CF_TIME: | |
79 | return "time/size value"; | |
80 | default: | |
81 | return "unknown type"; | |
82 | } | |
83 | } | |
84 | ||
85 | int | |
023c36ae | 86 | add_top_conf(const char *name, int (*sfunc) (struct TopConf *), |
212380e3 AC |
87 | int (*efunc) (struct TopConf *), struct ConfEntry *items) |
88 | { | |
89 | struct TopConf *tc; | |
90 | ||
eddc2ab6 | 91 | tc = rb_malloc(sizeof(struct TopConf)); |
212380e3 | 92 | |
d7f753cd | 93 | tc->tc_name = name; |
212380e3 AC |
94 | tc->tc_sfunc = sfunc; |
95 | tc->tc_efunc = efunc; | |
96 | tc->tc_entries = items; | |
97 | ||
330fc5c1 | 98 | rb_dlinkAddAlloc(tc, &conf_items); |
212380e3 AC |
99 | return 0; |
100 | } | |
101 | ||
102 | struct TopConf * | |
103 | find_top_conf(const char *name) | |
104 | { | |
330fc5c1 | 105 | rb_dlink_node *d; |
212380e3 AC |
106 | struct TopConf *tc; |
107 | ||
5cefa1d6 | 108 | RB_DLINK_FOREACH(d, conf_items.head) |
212380e3 AC |
109 | { |
110 | tc = d->data; | |
111 | if(strcasecmp(tc->tc_name, name) == 0) | |
112 | return tc; | |
113 | } | |
114 | ||
115 | return NULL; | |
116 | } | |
117 | ||
118 | ||
119 | struct ConfEntry * | |
120 | find_conf_item(const struct TopConf *top, const char *name) | |
121 | { | |
122 | struct ConfEntry *cf; | |
330fc5c1 | 123 | rb_dlink_node *d; |
212380e3 AC |
124 | |
125 | if(top->tc_entries) | |
126 | { | |
127 | int i; | |
128 | ||
129 | for(i = 0; top->tc_entries[i].cf_type; i++) | |
130 | { | |
131 | cf = &top->tc_entries[i]; | |
132 | ||
133 | if(!strcasecmp(cf->cf_name, name)) | |
134 | return cf; | |
135 | } | |
136 | } | |
137 | ||
5cefa1d6 | 138 | RB_DLINK_FOREACH(d, top->tc_items.head) |
212380e3 AC |
139 | { |
140 | cf = d->data; | |
141 | if(strcasecmp(cf->cf_name, name) == 0) | |
142 | return cf; | |
143 | } | |
144 | ||
145 | return NULL; | |
146 | } | |
147 | ||
148 | int | |
149 | remove_top_conf(char *name) | |
150 | { | |
151 | struct TopConf *tc; | |
330fc5c1 | 152 | rb_dlink_node *ptr; |
212380e3 AC |
153 | |
154 | if((tc = find_top_conf(name)) == NULL) | |
155 | return -1; | |
156 | ||
330fc5c1 | 157 | if((ptr = rb_dlinkFind(tc, &conf_items)) == NULL) |
212380e3 AC |
158 | return -1; |
159 | ||
330fc5c1 | 160 | rb_dlinkDestroy(ptr, &conf_items); |
637c4932 | 161 | rb_free(tc); |
212380e3 AC |
162 | |
163 | return 0; | |
164 | } | |
165 | ||
166 | static void | |
167 | conf_set_serverinfo_name(void *data) | |
168 | { | |
169 | if(ServerInfo.name == NULL) | |
170 | { | |
171 | const char *s; | |
172 | int dots = 0; | |
173 | ||
174 | for(s = data; *s != '\0'; s++) | |
175 | { | |
176 | if(!IsServChar(*s)) | |
177 | { | |
178 | conf_report_error("Ignoring serverinfo::name " | |
179 | "-- bogus servername."); | |
180 | return; | |
181 | } | |
182 | else if(*s == '.') | |
183 | ++dots; | |
184 | } | |
185 | ||
186 | if(!dots) | |
187 | { | |
188 | conf_report_error("Ignoring serverinfo::name -- must contain '.'"); | |
189 | return; | |
190 | } | |
191 | ||
192 | s = data; | |
193 | ||
194 | if(IsDigit(*s)) | |
195 | { | |
196 | conf_report_error("Ignoring serverinfo::name -- cannot begin with digit."); | |
197 | return; | |
198 | } | |
199 | ||
200 | /* the ircd will exit() in main() if we dont set one */ | |
201 | if(strlen(s) <= HOSTLEN) | |
47a03750 | 202 | ServerInfo.name = rb_strdup((char *) data); |
212380e3 AC |
203 | } |
204 | } | |
205 | ||
206 | static void | |
207 | conf_set_serverinfo_sid(void *data) | |
208 | { | |
209 | char *sid = data; | |
210 | ||
211 | if(ServerInfo.sid[0] == '\0') | |
212 | { | |
213 | if(!IsDigit(sid[0]) || !IsIdChar(sid[1]) || | |
214 | !IsIdChar(sid[2]) || sid[3] != '\0') | |
215 | { | |
216 | conf_report_error("Ignoring serverinfo::sid " | |
217 | "-- bogus sid."); | |
218 | return; | |
219 | } | |
220 | ||
221 | strcpy(ServerInfo.sid, sid); | |
222 | } | |
223 | } | |
224 | ||
225 | static void | |
226 | conf_set_serverinfo_network_name(void *data) | |
227 | { | |
228 | char *p; | |
229 | ||
230 | if((p = strchr((char *) data, ' '))) | |
231 | *p = '\0'; | |
232 | ||
637c4932 | 233 | rb_free(ServerInfo.network_name); |
47a03750 | 234 | ServerInfo.network_name = rb_strdup((char *) data); |
212380e3 AC |
235 | } |
236 | ||
237 | static void | |
238 | conf_set_serverinfo_vhost(void *data) | |
239 | { | |
caa4d9d2 | 240 | if(rb_inet_pton(AF_INET, (char *) data, &ServerInfo.ip.sin_addr) <= 0) |
212380e3 | 241 | { |
532f83a7 | 242 | conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data); |
212380e3 AC |
243 | return; |
244 | } | |
245 | ServerInfo.ip.sin_family = AF_INET; | |
246 | ServerInfo.specific_ipv4_vhost = 1; | |
247 | } | |
248 | ||
249 | static void | |
250 | conf_set_serverinfo_vhost6(void *data) | |
251 | { | |
ccda6e3f | 252 | #ifdef RB_IPV6 |
caa4d9d2 | 253 | if(rb_inet_pton(AF_INET6, (char *) data, &ServerInfo.ip6.sin6_addr) <= 0) |
212380e3 | 254 | { |
532f83a7 | 255 | conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data); |
212380e3 AC |
256 | return; |
257 | } | |
258 | ||
259 | ServerInfo.specific_ipv6_vhost = 1; | |
260 | ServerInfo.ip6.sin6_family = AF_INET6; | |
261 | #else | |
262 | conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available."); | |
263 | #endif | |
264 | } | |
265 | ||
b583faf9 AC |
266 | static void |
267 | conf_set_serverinfo_nicklen(void *data) | |
268 | { | |
7b42eab6 | 269 | ConfigFileEntry.nicklen = (*(unsigned int *) data) + 1; |
b583faf9 AC |
270 | |
271 | if (ConfigFileEntry.nicklen > NICKLEN) | |
272 | { | |
273 | conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)", | |
ca8ff483 | 274 | ConfigFileEntry.nicklen - 1, NICKLEN - 1); |
b583faf9 AC |
275 | ConfigFileEntry.nicklen = NICKLEN; |
276 | } | |
ca8ff483 JT |
277 | else if (ConfigFileEntry.nicklen < 9 + 1) |
278 | { | |
279 | conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9", | |
4f0d2b58 | 280 | ConfigFileEntry.nicklen - 1); |
ca8ff483 JT |
281 | ConfigFileEntry.nicklen = 9 + 1; |
282 | } | |
b583faf9 AC |
283 | } |
284 | ||
212380e3 AC |
285 | static void |
286 | conf_set_modules_module(void *data) | |
287 | { | |
212380e3 AC |
288 | char *m_bn; |
289 | ||
b7a689d1 | 290 | m_bn = rb_basename((char *) data); |
212380e3 | 291 | |
43f45e81 | 292 | if(findmodule_byname(m_bn) == -1) |
216d70e9 | 293 | load_one_module((char *) data, MAPI_ORIGIN_EXTENSION, 0); |
212380e3 | 294 | |
637c4932 | 295 | rb_free(m_bn); |
212380e3 AC |
296 | } |
297 | ||
298 | static void | |
299 | conf_set_modules_path(void *data) | |
300 | { | |
212380e3 | 301 | mod_add_path((char *) data); |
212380e3 AC |
302 | } |
303 | ||
304 | struct mode_table | |
305 | { | |
306 | const char *name; | |
307 | int mode; | |
308 | }; | |
309 | ||
310 | /* *INDENT-OFF* */ | |
311 | static struct mode_table umode_table[] = { | |
312 | {"callerid", UMODE_CALLERID }, | |
313 | {"deaf", UMODE_DEAF }, | |
314 | {"invisible", UMODE_INVISIBLE }, | |
315 | {"locops", UMODE_LOCOPS }, | |
316 | {"noforward", UMODE_NOFORWARD }, | |
317 | {"regonlymsg", UMODE_REGONLYMSG}, | |
318 | {"servnotice", UMODE_SERVNOTICE}, | |
319 | {"wallop", UMODE_WALLOP }, | |
320 | {"operwall", UMODE_OPERWALL }, | |
321 | {NULL, 0} | |
322 | }; | |
323 | ||
19c13ce5 | 324 | static struct mode_table oper_table[] = { |
212380e3 | 325 | {"encrypted", OPER_ENCRYPTED }, |
b1594414 | 326 | {"need_ssl", OPER_NEEDSSL }, |
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 }, | |
b1594414 | 344 | {"need_ssl", CONF_FLAGS_NEED_SSL }, |
212380e3 | 345 | {"need_sasl", CONF_FLAGS_NEED_SASL }, |
a4721f5e | 346 | {"extend_chans", CONF_FLAGS_EXTEND_CHANS }, |
212380e3 AC |
347 | {NULL, 0} |
348 | }; | |
349 | ||
350 | static struct mode_table connect_table[] = { | |
351 | { "autoconn", SERVER_AUTOCONN }, | |
352 | { "compressed", SERVER_COMPRESSED }, | |
353 | { "encrypted", SERVER_ENCRYPTED }, | |
354 | { "topicburst", SERVER_TB }, | |
c6d72037 | 355 | { "ssl", SERVER_SSL }, |
212380e3 AC |
356 | { NULL, 0 }, |
357 | }; | |
358 | ||
359 | static struct mode_table cluster_table[] = { | |
360 | { "kline", SHARED_PKLINE }, | |
361 | { "tkline", SHARED_TKLINE }, | |
362 | { "unkline", SHARED_UNKLINE }, | |
363 | { "locops", SHARED_LOCOPS }, | |
364 | { "xline", SHARED_PXLINE }, | |
365 | { "txline", SHARED_TXLINE }, | |
366 | { "unxline", SHARED_UNXLINE }, | |
367 | { "resv", SHARED_PRESV }, | |
368 | { "tresv", SHARED_TRESV }, | |
369 | { "unresv", SHARED_UNRESV }, | |
370 | { "all", CLUSTER_ALL }, | |
371 | {NULL, 0} | |
372 | }; | |
373 | ||
374 | static struct mode_table shared_table[] = | |
375 | { | |
376 | { "kline", SHARED_PKLINE|SHARED_TKLINE }, | |
377 | { "xline", SHARED_PXLINE|SHARED_TXLINE }, | |
378 | { "resv", SHARED_PRESV|SHARED_TRESV }, | |
f5cb68d5 VY |
379 | { "dline", SHARED_PDLINE|SHARED_TDLINE }, |
380 | { "tdline", SHARED_TDLINE }, | |
381 | { "pdline", SHARED_PDLINE }, | |
382 | { "undline", SHARED_UNDLINE }, | |
212380e3 AC |
383 | { "tkline", SHARED_TKLINE }, |
384 | { "unkline", SHARED_UNKLINE }, | |
385 | { "txline", SHARED_TXLINE }, | |
386 | { "unxline", SHARED_UNXLINE }, | |
387 | { "tresv", SHARED_TRESV }, | |
388 | { "unresv", SHARED_UNRESV }, | |
389 | { "locops", SHARED_LOCOPS }, | |
390 | { "rehash", SHARED_REHASH }, | |
fe749d37 | 391 | { "grant", SHARED_GRANT }, |
cc7ae51c | 392 | { "die", SHARED_DIE }, |
15feac53 | 393 | { "module", SHARED_MODULE }, |
212380e3 AC |
394 | { "all", SHARED_ALL }, |
395 | { "none", 0 }, | |
396 | {NULL, 0} | |
397 | }; | |
398 | /* *INDENT-ON* */ | |
399 | ||
400 | static int | |
401 | find_umode(struct mode_table *tab, const char *name) | |
402 | { | |
403 | int i; | |
404 | ||
405 | for (i = 0; tab[i].name; i++) | |
406 | { | |
407 | if(strcmp(tab[i].name, name) == 0) | |
408 | return tab[i].mode; | |
409 | } | |
410 | ||
411 | return -1; | |
412 | } | |
413 | ||
414 | static void | |
415 | set_modes_from_table(int *modes, const char *whatis, struct mode_table *tab, conf_parm_t * args) | |
416 | { | |
417 | for (; args; args = args->next) | |
418 | { | |
419 | const char *umode; | |
420 | int dir = 1; | |
421 | int mode; | |
422 | ||
dceac3e4 | 423 | if(CF_TYPE(args->type) != CF_STRING) |
212380e3 AC |
424 | { |
425 | conf_report_error("Warning -- %s is not a string; ignoring.", whatis); | |
426 | continue; | |
427 | } | |
428 | ||
429 | umode = args->v.string; | |
430 | ||
431 | if(*umode == '~') | |
432 | { | |
433 | dir = 0; | |
434 | umode++; | |
435 | } | |
436 | ||
437 | mode = find_umode(tab, umode); | |
438 | ||
439 | if(mode == -1) | |
440 | { | |
441 | conf_report_error("Warning -- unknown %s %s.", whatis, args->v.string); | |
442 | continue; | |
443 | } | |
444 | ||
445 | if(mode) | |
446 | { | |
447 | if(dir) | |
448 | *modes |= mode; | |
449 | else | |
450 | *modes &= ~mode; | |
451 | } | |
452 | else | |
453 | *modes = 0; | |
454 | } | |
455 | } | |
456 | ||
f8606875 AC |
457 | static void |
458 | conf_set_privset_extends(void *data) | |
459 | { | |
460 | yy_privset_extends = rb_strdup((char *) data); | |
461 | } | |
462 | ||
463 | static void | |
464 | conf_set_privset_privs(void *data) | |
465 | { | |
466 | char *privs = NULL; | |
467 | conf_parm_t *args = data; | |
468 | ||
469 | for (; args; args = args->next) | |
470 | { | |
471 | if (privs == NULL) | |
472 | privs = rb_strdup(args->v.string); | |
473 | else | |
474 | { | |
475 | char *privs_old = privs; | |
476 | ||
477 | privs = rb_malloc(strlen(privs_old) + 1 + strlen(args->v.string) + 1); | |
065f67db | 478 | strcpy(privs, privs_old); |
f8606875 AC |
479 | strcat(privs, " "); |
480 | strcat(privs, args->v.string); | |
481 | ||
482 | rb_free(privs_old); | |
483 | } | |
484 | } | |
485 | ||
486 | if (privs) | |
487 | { | |
488 | if (yy_privset_extends) | |
489 | { | |
490 | struct PrivilegeSet *set = privilegeset_get(yy_privset_extends); | |
491 | ||
492 | if (!set) | |
493 | { | |
49b0375d | 494 | conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends, conf_cur_block_name); |
f8606875 | 495 | |
49b0375d | 496 | set = privilegeset_get("default"); |
f8606875 AC |
497 | } |
498 | ||
499 | privilegeset_extend(set, conf_cur_block_name != NULL ? conf_cur_block_name : "<unknown>", privs, 0); | |
500 | ||
501 | rb_free(yy_privset_extends); | |
502 | yy_privset_extends = NULL; | |
503 | } | |
504 | else | |
505 | privilegeset_set_new(conf_cur_block_name != NULL ? conf_cur_block_name : "<unknown>", privs, 0); | |
506 | ||
507 | rb_free(privs); | |
508 | } | |
509 | } | |
510 | ||
212380e3 AC |
511 | static int |
512 | conf_begin_oper(struct TopConf *tc) | |
513 | { | |
330fc5c1 | 514 | rb_dlink_node *ptr; |
637c4932 | 515 | rb_dlink_node *next_ptr; |
212380e3 AC |
516 | |
517 | if(yy_oper != NULL) | |
518 | { | |
519 | free_oper_conf(yy_oper); | |
520 | yy_oper = NULL; | |
521 | } | |
522 | ||
637c4932 | 523 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_oper_list.head) |
212380e3 AC |
524 | { |
525 | free_oper_conf(ptr->data); | |
330fc5c1 | 526 | rb_dlinkDestroy(ptr, &yy_oper_list); |
212380e3 AC |
527 | } |
528 | ||
529 | yy_oper = make_oper_conf(); | |
10847f65 | 530 | yy_oper->flags |= OPER_ENCRYPTED; |
212380e3 AC |
531 | |
532 | return 0; | |
533 | } | |
534 | ||
535 | static int | |
536 | conf_end_oper(struct TopConf *tc) | |
537 | { | |
538 | struct oper_conf *yy_tmpoper; | |
330fc5c1 | 539 | rb_dlink_node *ptr; |
637c4932 | 540 | rb_dlink_node *next_ptr; |
212380e3 AC |
541 | |
542 | if(conf_cur_block_name != NULL) | |
543 | { | |
544 | if(strlen(conf_cur_block_name) > OPERNICKLEN) | |
545 | conf_cur_block_name[OPERNICKLEN] = '\0'; | |
546 | ||
47a03750 | 547 | yy_oper->name = rb_strdup(conf_cur_block_name); |
212380e3 AC |
548 | } |
549 | ||
550 | if(EmptyString(yy_oper->name)) | |
551 | { | |
552 | conf_report_error("Ignoring operator block -- missing name."); | |
553 | return 0; | |
554 | } | |
555 | ||
556 | #ifdef HAVE_LIBCRYPTO | |
557 | if(EmptyString(yy_oper->passwd) && EmptyString(yy_oper->rsa_pubkey_file)) | |
558 | #else | |
559 | if(EmptyString(yy_oper->passwd)) | |
560 | #endif | |
561 | { | |
562 | conf_report_error("Ignoring operator block for %s -- missing password", | |
563 | yy_oper->name); | |
564 | return 0; | |
565 | } | |
566 | ||
7d5acab7 JT |
567 | |
568 | if (!yy_oper->privset) | |
569 | yy_oper->privset = privilegeset_get("default"); | |
570 | ||
212380e3 AC |
571 | /* now, yy_oper_list contains a stack of oper_conf's with just user |
572 | * and host in, yy_oper contains the rest of the information which | |
573 | * we need to copy into each element in yy_oper_list | |
574 | */ | |
637c4932 | 575 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_oper_list.head) |
212380e3 AC |
576 | { |
577 | yy_tmpoper = ptr->data; | |
578 | ||
47a03750 | 579 | yy_tmpoper->name = rb_strdup(yy_oper->name); |
212380e3 AC |
580 | |
581 | /* could be an rsa key instead.. */ | |
582 | if(!EmptyString(yy_oper->passwd)) | |
47a03750 | 583 | yy_tmpoper->passwd = rb_strdup(yy_oper->passwd); |
212380e3 AC |
584 | |
585 | yy_tmpoper->flags = yy_oper->flags; | |
586 | yy_tmpoper->umodes = yy_oper->umodes; | |
587 | yy_tmpoper->snomask = yy_oper->snomask; | |
22c3b270 | 588 | yy_tmpoper->privset = yy_oper->privset; |
212380e3 AC |
589 | |
590 | #ifdef HAVE_LIBCRYPTO | |
591 | if(yy_oper->rsa_pubkey_file) | |
592 | { | |
593 | BIO *file; | |
594 | ||
595 | if((file = BIO_new_file(yy_oper->rsa_pubkey_file, "r")) == NULL) | |
596 | { | |
597 | conf_report_error("Ignoring operator block for %s -- " | |
598 | "rsa_public_key_file cant be opened", | |
599 | yy_tmpoper->name); | |
600 | return 0; | |
601 | } | |
023c36ae | 602 | |
212380e3 AC |
603 | yy_tmpoper->rsa_pubkey = |
604 | (RSA *) PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); | |
605 | ||
c422d2a0 | 606 | (void)BIO_set_close(file, BIO_CLOSE); |
212380e3 AC |
607 | BIO_free(file); |
608 | ||
609 | if(yy_tmpoper->rsa_pubkey == NULL) | |
610 | { | |
611 | conf_report_error("Ignoring operator block for %s -- " | |
612 | "rsa_public_key_file key invalid; check syntax", | |
613 | yy_tmpoper->name); | |
614 | return 0; | |
615 | } | |
616 | } | |
63c7a68e EM |
617 | |
618 | if(!EmptyString(yy_oper->certfp)) | |
462ae9d7 | 619 | yy_tmpoper->certfp = rb_strdup(yy_oper->certfp); |
212380e3 AC |
620 | #endif |
621 | ||
622 | /* all is ok, put it on oper_conf_list */ | |
330fc5c1 | 623 | rb_dlinkMoveNode(ptr, &yy_oper_list, &oper_conf_list); |
212380e3 AC |
624 | } |
625 | ||
626 | free_oper_conf(yy_oper); | |
627 | yy_oper = NULL; | |
628 | ||
629 | return 0; | |
630 | } | |
631 | ||
632 | static void | |
633 | conf_set_oper_flags(void *data) | |
634 | { | |
635 | conf_parm_t *args = data; | |
636 | ||
19c13ce5 | 637 | set_modes_from_table(&yy_oper->flags, "flag", oper_table, args); |
212380e3 AC |
638 | } |
639 | ||
ff31db84 AC |
640 | static void |
641 | conf_set_oper_fingerprint(void *data) | |
642 | { | |
462ae9d7 JT |
643 | if (yy_oper->certfp) |
644 | rb_free(yy_oper->certfp); | |
ff31db84 AC |
645 | yy_oper->certfp = rb_strdup((char *) data); |
646 | } | |
647 | ||
22c3b270 AC |
648 | static void |
649 | conf_set_oper_privset(void *data) | |
650 | { | |
651 | yy_oper->privset = privilegeset_get((char *) data); | |
652 | } | |
653 | ||
212380e3 AC |
654 | static void |
655 | conf_set_oper_user(void *data) | |
656 | { | |
657 | struct oper_conf *yy_tmpoper; | |
658 | char *p; | |
659 | char *host = (char *) data; | |
660 | ||
661 | yy_tmpoper = make_oper_conf(); | |
662 | ||
663 | if((p = strchr(host, '@'))) | |
664 | { | |
665 | *p++ = '\0'; | |
666 | ||
47a03750 VY |
667 | yy_tmpoper->username = rb_strdup(host); |
668 | yy_tmpoper->host = rb_strdup(p); | |
212380e3 AC |
669 | } |
670 | else | |
671 | { | |
672 | ||
47a03750 VY |
673 | yy_tmpoper->username = rb_strdup("*"); |
674 | yy_tmpoper->host = rb_strdup(host); | |
212380e3 AC |
675 | } |
676 | ||
677 | if(EmptyString(yy_tmpoper->username) || EmptyString(yy_tmpoper->host)) | |
678 | { | |
679 | conf_report_error("Ignoring user -- missing username/host"); | |
680 | free_oper_conf(yy_tmpoper); | |
681 | return; | |
682 | } | |
683 | ||
330fc5c1 | 684 | rb_dlinkAddAlloc(yy_tmpoper, &yy_oper_list); |
212380e3 AC |
685 | } |
686 | ||
687 | static void | |
688 | conf_set_oper_password(void *data) | |
689 | { | |
690 | if(yy_oper->passwd) | |
691 | { | |
692 | memset(yy_oper->passwd, 0, strlen(yy_oper->passwd)); | |
637c4932 | 693 | rb_free(yy_oper->passwd); |
212380e3 AC |
694 | } |
695 | ||
47a03750 | 696 | yy_oper->passwd = rb_strdup((char *) data); |
212380e3 AC |
697 | } |
698 | ||
699 | static void | |
700 | conf_set_oper_rsa_public_key_file(void *data) | |
701 | { | |
702 | #ifdef HAVE_LIBCRYPTO | |
637c4932 | 703 | rb_free(yy_oper->rsa_pubkey_file); |
47a03750 | 704 | yy_oper->rsa_pubkey_file = rb_strdup((char *) data); |
212380e3 AC |
705 | #else |
706 | conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available"); | |
707 | #endif | |
708 | } | |
709 | ||
710 | static void | |
711 | conf_set_oper_umodes(void *data) | |
712 | { | |
713 | set_modes_from_table(&yy_oper->umodes, "umode", umode_table, data); | |
714 | } | |
715 | ||
716 | static void | |
717 | conf_set_oper_snomask(void *data) | |
718 | { | |
719 | yy_oper->snomask = parse_snobuf_to_mask(0, (const char *) data); | |
720 | } | |
721 | ||
722 | static int | |
723 | conf_begin_class(struct TopConf *tc) | |
724 | { | |
725 | if(yy_class) | |
726 | free_class(yy_class); | |
727 | ||
728 | yy_class = make_class(); | |
729 | return 0; | |
730 | } | |
731 | ||
732 | static int | |
733 | conf_end_class(struct TopConf *tc) | |
734 | { | |
735 | if(conf_cur_block_name != NULL) | |
47a03750 | 736 | yy_class->class_name = rb_strdup(conf_cur_block_name); |
212380e3 AC |
737 | |
738 | if(EmptyString(yy_class->class_name)) | |
739 | { | |
740 | conf_report_error("Ignoring connect block -- missing name."); | |
741 | return 0; | |
742 | } | |
743 | ||
744 | add_class(yy_class); | |
745 | yy_class = NULL; | |
746 | return 0; | |
747 | } | |
748 | ||
749 | static void | |
750 | conf_set_class_ping_time(void *data) | |
751 | { | |
752 | yy_class->ping_freq = *(unsigned int *) data; | |
753 | } | |
754 | ||
755 | static void | |
e33e589c | 756 | conf_set_class_cidr_ipv4_bitlen(void *data) |
212380e3 | 757 | { |
e33e589c JT |
758 | unsigned int maxsize = 32; |
759 | if(*(unsigned int *) data > maxsize) | |
760 | conf_report_error | |
761 | ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.", | |
762 | *(unsigned int *) data, maxsize); | |
763 | else | |
764 | yy_class->cidr_ipv4_bitlen = *(unsigned int *) data; | |
765 | ||
766 | } | |
767 | ||
ccda6e3f | 768 | #ifdef RB_IPV6 |
e33e589c JT |
769 | static void |
770 | conf_set_class_cidr_ipv6_bitlen(void *data) | |
771 | { | |
212380e3 | 772 | unsigned int maxsize = 128; |
212380e3 AC |
773 | if(*(unsigned int *) data > maxsize) |
774 | conf_report_error | |
e33e589c | 775 | ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.", |
212380e3 AC |
776 | *(unsigned int *) data, maxsize); |
777 | else | |
e33e589c | 778 | yy_class->cidr_ipv6_bitlen = *(unsigned int *) data; |
212380e3 AC |
779 | |
780 | } | |
e33e589c JT |
781 | #endif |
782 | ||
212380e3 AC |
783 | static void |
784 | conf_set_class_number_per_cidr(void *data) | |
785 | { | |
786 | yy_class->cidr_amount = *(unsigned int *) data; | |
787 | } | |
788 | ||
789 | static void | |
790 | conf_set_class_number_per_ip(void *data) | |
791 | { | |
792 | yy_class->max_local = *(unsigned int *) data; | |
793 | } | |
794 | ||
795 | ||
796 | static void | |
797 | conf_set_class_number_per_ip_global(void *data) | |
798 | { | |
799 | yy_class->max_global = *(unsigned int *) data; | |
800 | } | |
801 | ||
802 | static void | |
803 | conf_set_class_number_per_ident(void *data) | |
804 | { | |
805 | yy_class->max_ident = *(unsigned int *) data; | |
806 | } | |
807 | ||
808 | static void | |
809 | conf_set_class_connectfreq(void *data) | |
810 | { | |
811 | yy_class->con_freq = *(unsigned int *) data; | |
812 | } | |
813 | ||
814 | static void | |
815 | conf_set_class_max_number(void *data) | |
816 | { | |
817 | yy_class->max_total = *(unsigned int *) data; | |
818 | } | |
819 | ||
820 | static void | |
821 | conf_set_class_sendq(void *data) | |
822 | { | |
823 | yy_class->max_sendq = *(unsigned int *) data; | |
824 | } | |
825 | ||
826 | static char *listener_address; | |
827 | ||
828 | static int | |
829 | conf_begin_listen(struct TopConf *tc) | |
830 | { | |
637c4932 | 831 | rb_free(listener_address); |
212380e3 AC |
832 | listener_address = NULL; |
833 | return 0; | |
834 | } | |
835 | ||
836 | static int | |
837 | conf_end_listen(struct TopConf *tc) | |
838 | { | |
637c4932 | 839 | rb_free(listener_address); |
212380e3 AC |
840 | listener_address = NULL; |
841 | return 0; | |
842 | } | |
843 | ||
02270e96 AC |
844 | static void |
845 | conf_set_listen_defer_accept(void *data) | |
846 | { | |
847 | yy_defer_accept = *(unsigned int *) data; | |
848 | } | |
c6d72037 | 849 | |
212380e3 | 850 | static void |
c6d72037 | 851 | conf_set_listen_port_both(void *data, int ssl) |
212380e3 AC |
852 | { |
853 | conf_parm_t *args = data; | |
854 | for (; args; args = args->next) | |
855 | { | |
dceac3e4 | 856 | if(CF_TYPE(args->type) != CF_INT) |
212380e3 AC |
857 | { |
858 | conf_report_error | |
859 | ("listener::port argument is not an integer " "-- ignoring."); | |
860 | continue; | |
861 | } | |
862 | if(listener_address == NULL) | |
863 | { | |
35f284c2 AC |
864 | if (!ssl) |
865 | { | |
d84acbce AC |
866 | conf_report_warning("listener 'ANY/%d': support for plaintext listeners may be removed in a future release per RFC 7194. " |
867 | "It is suggested that users be migrated to SSL/TLS connections.", args->v.number); | |
35f284c2 | 868 | } |
bbccb09a | 869 | add_listener(args->v.number, listener_address, AF_INET, ssl, ssl || yy_defer_accept); |
ccda6e3f | 870 | #ifdef RB_IPV6 |
bbccb09a | 871 | add_listener(args->v.number, listener_address, AF_INET6, ssl, ssl || yy_defer_accept); |
212380e3 AC |
872 | #endif |
873 | } | |
874 | else | |
875 | { | |
876 | int family; | |
ccda6e3f | 877 | #ifdef RB_IPV6 |
212380e3 AC |
878 | if(strchr(listener_address, ':') != NULL) |
879 | family = AF_INET6; | |
023c36ae | 880 | else |
212380e3 AC |
881 | #endif |
882 | family = AF_INET; | |
023c36ae | 883 | |
35f284c2 AC |
884 | if (!ssl) |
885 | { | |
d84acbce AC |
886 | conf_report_warning("listener '%s/%d': support for plaintext listeners may be removed in a future release per RFC 7194. " |
887 | "It is suggested that users be migrated to SSL/TLS connections.", listener_address, args->v.number); | |
35f284c2 | 888 | } |
023c36ae | 889 | |
35f284c2 | 890 | add_listener(args->v.number, listener_address, family, ssl, ssl || yy_defer_accept); |
212380e3 AC |
891 | } |
892 | ||
893 | } | |
894 | } | |
895 | ||
8bd5767b JT |
896 | static void |
897 | conf_set_listen_port(void *data) | |
898 | { | |
899 | conf_set_listen_port_both(data, 0); | |
900 | } | |
901 | ||
902 | static void | |
903 | conf_set_listen_sslport(void *data) | |
904 | { | |
905 | conf_set_listen_port_both(data, 1); | |
c6d72037 VY |
906 | } |
907 | ||
212380e3 AC |
908 | static void |
909 | conf_set_listen_address(void *data) | |
910 | { | |
637c4932 | 911 | rb_free(listener_address); |
47a03750 | 912 | listener_address = rb_strdup(data); |
212380e3 AC |
913 | } |
914 | ||
915 | static int | |
916 | conf_begin_auth(struct TopConf *tc) | |
917 | { | |
330fc5c1 | 918 | rb_dlink_node *ptr; |
637c4932 | 919 | rb_dlink_node *next_ptr; |
212380e3 AC |
920 | |
921 | if(yy_aconf) | |
922 | free_conf(yy_aconf); | |
923 | ||
637c4932 | 924 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head) |
212380e3 AC |
925 | { |
926 | free_conf(ptr->data); | |
330fc5c1 | 927 | rb_dlinkDestroy(ptr, &yy_aconf_list); |
212380e3 AC |
928 | } |
929 | ||
930 | yy_aconf = make_conf(); | |
931 | yy_aconf->status = CONF_CLIENT; | |
932 | ||
933 | return 0; | |
934 | } | |
935 | ||
936 | static int | |
937 | conf_end_auth(struct TopConf *tc) | |
938 | { | |
3d1f32c0 | 939 | struct ConfItem *yy_tmp, *found_conf; |
330fc5c1 | 940 | rb_dlink_node *ptr; |
637c4932 | 941 | rb_dlink_node *next_ptr; |
212380e3 | 942 | |
27f616dd JT |
943 | if(EmptyString(yy_aconf->info.name)) |
944 | yy_aconf->info.name = rb_strdup("NOMATCH"); | |
212380e3 AC |
945 | |
946 | /* didnt even get one ->host? */ | |
947 | if(EmptyString(yy_aconf->host)) | |
948 | { | |
949 | conf_report_error("Ignoring auth block -- missing user@host"); | |
950 | return 0; | |
951 | } | |
952 | ||
953 | /* so the stacking works in order.. */ | |
954 | collapse(yy_aconf->user); | |
955 | collapse(yy_aconf->host); | |
956 | conf_add_class_to_conf(yy_aconf); | |
3d1f32c0 | 957 | if ((found_conf = find_exact_conf_by_address("*", CONF_CLIENT, "*")) && found_conf->spasswd == NULL) |
6e5e2b00 | 958 | conf_report_error("Ignoring redundant auth block (after *@*)"); |
3d1f32c0 | 959 | else if ((found_conf = find_exact_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user)) && |
5f2df251 | 960 | (!found_conf->spasswd || (yy_aconf->spasswd && |
3d1f32c0 | 961 | 0 == irccmp(found_conf->spasswd, yy_aconf->spasswd)))) |
6e5e2b00 JT |
962 | conf_report_error("Ignoring duplicate auth block for %s@%s", |
963 | yy_aconf->user, yy_aconf->host); | |
964 | else | |
965 | add_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user, yy_aconf->spasswd, yy_aconf); | |
212380e3 | 966 | |
637c4932 | 967 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head) |
212380e3 AC |
968 | { |
969 | yy_tmp = ptr->data; | |
970 | ||
971 | if(yy_aconf->passwd) | |
47a03750 | 972 | yy_tmp->passwd = rb_strdup(yy_aconf->passwd); |
212380e3 | 973 | |
40c1fd47 VY |
974 | if(yy_aconf->spasswd) |
975 | yy_tmp->spasswd = rb_strdup(yy_aconf->spasswd); | |
023c36ae | 976 | |
212380e3 | 977 | /* this will always exist.. */ |
27f616dd | 978 | yy_tmp->info.name = rb_strdup(yy_aconf->info.name); |
212380e3 AC |
979 | |
980 | if(yy_aconf->className) | |
47a03750 | 981 | yy_tmp->className = rb_strdup(yy_aconf->className); |
212380e3 AC |
982 | |
983 | yy_tmp->flags = yy_aconf->flags; | |
984 | yy_tmp->port = yy_aconf->port; | |
985 | ||
986 | collapse(yy_tmp->user); | |
987 | collapse(yy_tmp->host); | |
988 | ||
989 | conf_add_class_to_conf(yy_tmp); | |
990 | ||
0c2ea0c3 | 991 | if ((found_conf = find_exact_conf_by_address("*", CONF_CLIENT, "*")) && found_conf->spasswd == NULL) |
6e5e2b00 | 992 | conf_report_error("Ignoring redundant auth block (after *@*)"); |
0c2ea0c3 JT |
993 | else if ((found_conf = find_exact_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user)) && |
994 | (!found_conf->spasswd || (yy_tmp->spasswd && | |
995 | 0 == irccmp(found_conf->spasswd, yy_tmp->spasswd)))) | |
6e5e2b00 JT |
996 | conf_report_error("Ignoring duplicate auth block for %s@%s", |
997 | yy_tmp->user, yy_tmp->host); | |
998 | else | |
999 | add_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user, yy_tmp->spasswd, yy_tmp); | |
330fc5c1 | 1000 | rb_dlinkDestroy(ptr, &yy_aconf_list); |
212380e3 AC |
1001 | } |
1002 | ||
1003 | yy_aconf = NULL; | |
1004 | return 0; | |
1005 | } | |
1006 | ||
1007 | static void | |
1008 | conf_set_auth_user(void *data) | |
1009 | { | |
1010 | struct ConfItem *yy_tmp; | |
1011 | char *p; | |
1012 | ||
1013 | /* The first user= line doesn't allocate a new conf */ | |
1014 | if(!EmptyString(yy_aconf->host)) | |
1015 | { | |
1016 | yy_tmp = make_conf(); | |
1017 | yy_tmp->status = CONF_CLIENT; | |
1018 | } | |
1019 | else | |
1020 | yy_tmp = yy_aconf; | |
1021 | ||
1022 | if((p = strchr(data, '@'))) | |
1023 | { | |
1024 | *p++ = '\0'; | |
1025 | ||
47a03750 VY |
1026 | yy_tmp->user = rb_strdup(data); |
1027 | yy_tmp->host = rb_strdup(p); | |
212380e3 AC |
1028 | } |
1029 | else | |
1030 | { | |
47a03750 VY |
1031 | yy_tmp->user = rb_strdup("*"); |
1032 | yy_tmp->host = rb_strdup(data); | |
212380e3 AC |
1033 | } |
1034 | ||
1035 | if(yy_aconf != yy_tmp) | |
330fc5c1 | 1036 | rb_dlinkAddAlloc(yy_tmp, &yy_aconf_list); |
212380e3 AC |
1037 | } |
1038 | ||
40c1fd47 VY |
1039 | static void |
1040 | conf_set_auth_auth_user(void *data) | |
1041 | { | |
1042 | if(yy_aconf->spasswd) | |
1043 | memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd)); | |
1044 | rb_free(yy_aconf->spasswd); | |
1045 | yy_aconf->spasswd = rb_strdup(data); | |
1046 | } | |
1047 | ||
212380e3 AC |
1048 | static void |
1049 | conf_set_auth_passwd(void *data) | |
1050 | { | |
1051 | if(yy_aconf->passwd) | |
1052 | memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); | |
637c4932 | 1053 | rb_free(yy_aconf->passwd); |
47a03750 | 1054 | yy_aconf->passwd = rb_strdup(data); |
212380e3 AC |
1055 | } |
1056 | ||
1057 | static void | |
1058 | conf_set_auth_spoof(void *data) | |
1059 | { | |
1060 | char *p; | |
1061 | char *user = NULL; | |
1062 | char *host = NULL; | |
1063 | ||
1064 | host = data; | |
1065 | ||
1066 | /* user@host spoof */ | |
1067 | if((p = strchr(host, '@')) != NULL) | |
1068 | { | |
1069 | *p = '\0'; | |
1070 | user = data; | |
1071 | host = p+1; | |
1072 | ||
1073 | if(EmptyString(user)) | |
1074 | { | |
1075 | conf_report_error("Warning -- spoof ident empty."); | |
1076 | return; | |
1077 | } | |
1078 | ||
1079 | if(strlen(user) > USERLEN) | |
1080 | { | |
1081 | conf_report_error("Warning -- spoof ident length invalid."); | |
1082 | return; | |
1083 | } | |
1084 | ||
1085 | if(!valid_username(user)) | |
1086 | { | |
1087 | conf_report_error("Warning -- invalid spoof (ident)."); | |
1088 | return; | |
1089 | } | |
1090 | ||
1091 | /* this must be restored! */ | |
1092 | *p = '@'; | |
1093 | } | |
1094 | ||
1095 | if(EmptyString(host)) | |
1096 | { | |
1097 | conf_report_error("Warning -- spoof host empty."); | |
1098 | return; | |
1099 | } | |
1100 | ||
1101 | if(strlen(host) > HOSTLEN) | |
1102 | { | |
1103 | conf_report_error("Warning -- spoof host length invalid."); | |
1104 | return; | |
1105 | } | |
1106 | ||
1107 | if(!valid_hostname(host)) | |
1108 | { | |
1109 | conf_report_error("Warning -- invalid spoof (host)."); | |
1110 | return; | |
1111 | } | |
1112 | ||
27f616dd JT |
1113 | rb_free(yy_aconf->info.name); |
1114 | yy_aconf->info.name = rb_strdup(data); | |
212380e3 AC |
1115 | yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; |
1116 | } | |
1117 | ||
1118 | static void | |
1119 | conf_set_auth_flags(void *data) | |
1120 | { | |
1121 | conf_parm_t *args = data; | |
1122 | ||
1123 | set_modes_from_table((int *) &yy_aconf->flags, "flag", auth_table, args); | |
1124 | } | |
1125 | ||
1126 | static void | |
1127 | conf_set_auth_redir_serv(void *data) | |
1128 | { | |
1129 | yy_aconf->flags |= CONF_FLAGS_REDIR; | |
27f616dd JT |
1130 | rb_free(yy_aconf->info.name); |
1131 | yy_aconf->info.name = rb_strdup(data); | |
212380e3 AC |
1132 | } |
1133 | ||
1134 | static void | |
1135 | conf_set_auth_redir_port(void *data) | |
1136 | { | |
1137 | int port = *(unsigned int *) data; | |
1138 | ||
1139 | yy_aconf->flags |= CONF_FLAGS_REDIR; | |
1140 | yy_aconf->port = port; | |
1141 | } | |
1142 | ||
1143 | static void | |
1144 | conf_set_auth_class(void *data) | |
1145 | { | |
637c4932 | 1146 | rb_free(yy_aconf->className); |
47a03750 | 1147 | yy_aconf->className = rb_strdup(data); |
212380e3 AC |
1148 | } |
1149 | ||
1150 | /* ok, shared_oper handles the stacking, shared_flags handles adding | |
1151 | * things.. so all we need to do when we start and end a shared block, is | |
1152 | * clean up anything thats been left over. | |
1153 | */ | |
1154 | static int | |
1155 | conf_cleanup_shared(struct TopConf *tc) | |
1156 | { | |
637c4932 | 1157 | rb_dlink_node *ptr, *next_ptr; |
212380e3 | 1158 | |
637c4932 | 1159 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head) |
212380e3 AC |
1160 | { |
1161 | free_remote_conf(ptr->data); | |
330fc5c1 | 1162 | rb_dlinkDestroy(ptr, &yy_shared_list); |
212380e3 AC |
1163 | } |
1164 | ||
1165 | if(yy_shared != NULL) | |
1166 | { | |
1167 | free_remote_conf(yy_shared); | |
1168 | yy_shared = NULL; | |
1169 | } | |
1170 | ||
1171 | return 0; | |
1172 | } | |
1173 | ||
1174 | static void | |
1175 | conf_set_shared_oper(void *data) | |
1176 | { | |
1177 | conf_parm_t *args = data; | |
1178 | const char *username; | |
1179 | char *p; | |
1180 | ||
1181 | if(yy_shared != NULL) | |
1182 | free_remote_conf(yy_shared); | |
1183 | ||
1184 | yy_shared = make_remote_conf(); | |
1185 | ||
1186 | if(args->next != NULL) | |
1187 | { | |
dceac3e4 | 1188 | if(CF_TYPE(args->type) != CF_QSTRING) |
212380e3 AC |
1189 | { |
1190 | conf_report_error("Ignoring shared::oper -- server is not a qstring"); | |
1191 | return; | |
1192 | } | |
1193 | ||
47a03750 | 1194 | yy_shared->server = rb_strdup(args->v.string); |
212380e3 AC |
1195 | args = args->next; |
1196 | } | |
1197 | else | |
47a03750 | 1198 | yy_shared->server = rb_strdup("*"); |
212380e3 | 1199 | |
dceac3e4 | 1200 | if(CF_TYPE(args->type) != CF_QSTRING) |
212380e3 AC |
1201 | { |
1202 | conf_report_error("Ignoring shared::oper -- oper is not a qstring"); | |
1203 | return; | |
1204 | } | |
1205 | ||
1206 | if((p = strchr(args->v.string, '@')) == NULL) | |
1207 | { | |
1208 | conf_report_error("Ignoring shard::oper -- oper is not a user@host"); | |
1209 | return; | |
1210 | } | |
1211 | ||
1212 | username = args->v.string; | |
1213 | *p++ = '\0'; | |
1214 | ||
1215 | if(EmptyString(p)) | |
47a03750 | 1216 | yy_shared->host = rb_strdup("*"); |
212380e3 | 1217 | else |
47a03750 | 1218 | yy_shared->host = rb_strdup(p); |
212380e3 AC |
1219 | |
1220 | if(EmptyString(username)) | |
47a03750 | 1221 | yy_shared->username = rb_strdup("*"); |
212380e3 | 1222 | else |
47a03750 | 1223 | yy_shared->username = rb_strdup(username); |
212380e3 | 1224 | |
330fc5c1 | 1225 | rb_dlinkAddAlloc(yy_shared, &yy_shared_list); |
212380e3 AC |
1226 | yy_shared = NULL; |
1227 | } | |
1228 | ||
1229 | static void | |
1230 | conf_set_shared_flags(void *data) | |
1231 | { | |
1232 | conf_parm_t *args = data; | |
1233 | int flags = 0; | |
637c4932 | 1234 | rb_dlink_node *ptr, *next_ptr; |
212380e3 AC |
1235 | |
1236 | if(yy_shared != NULL) | |
1237 | free_remote_conf(yy_shared); | |
1238 | ||
1239 | set_modes_from_table(&flags, "flag", shared_table, args); | |
1240 | ||
637c4932 | 1241 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head) |
212380e3 AC |
1242 | { |
1243 | yy_shared = ptr->data; | |
1244 | ||
1245 | yy_shared->flags = flags; | |
330fc5c1 AC |
1246 | rb_dlinkDestroy(ptr, &yy_shared_list); |
1247 | rb_dlinkAddTail(yy_shared, &yy_shared->node, &shared_conf_list); | |
212380e3 AC |
1248 | } |
1249 | ||
1250 | yy_shared = NULL; | |
1251 | } | |
1252 | ||
1253 | static int | |
1254 | conf_begin_connect(struct TopConf *tc) | |
1255 | { | |
1256 | if(yy_server) | |
1257 | free_server_conf(yy_server); | |
1258 | ||
1259 | yy_server = make_server_conf(); | |
1260 | yy_server->port = PORTNUM; | |
5aa453a4 | 1261 | yy_server->flags |= SERVER_TB; |
212380e3 AC |
1262 | |
1263 | if(conf_cur_block_name != NULL) | |
47a03750 | 1264 | yy_server->name = rb_strdup(conf_cur_block_name); |
212380e3 AC |
1265 | |
1266 | return 0; | |
1267 | } | |
1268 | ||
1269 | static int | |
1270 | conf_end_connect(struct TopConf *tc) | |
1271 | { | |
1272 | if(EmptyString(yy_server->name)) | |
1273 | { | |
1274 | conf_report_error("Ignoring connect block -- missing name."); | |
1275 | return 0; | |
1276 | } | |
1277 | ||
1278 | if(ServerInfo.name != NULL && !irccmp(ServerInfo.name, yy_server->name)) | |
1279 | { | |
1280 | conf_report_error("Ignoring connect block for %s -- name is equal to my own name.", | |
1281 | yy_server->name); | |
1282 | return 0; | |
1283 | } | |
1284 | ||
ff0cc1e6 | 1285 | if((EmptyString(yy_server->passwd) || EmptyString(yy_server->spasswd)) && EmptyString(yy_server->certfp)) |
212380e3 | 1286 | { |
c8f26906 | 1287 | conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.", |
212380e3 AC |
1288 | yy_server->name); |
1289 | return 0; | |
1290 | } | |
1291 | ||
1292 | if(EmptyString(yy_server->host)) | |
1293 | { | |
1294 | conf_report_error("Ignoring connect block for %s -- missing host.", | |
1295 | yy_server->name); | |
1296 | return 0; | |
1297 | } | |
1298 | ||
1299 | #ifndef HAVE_LIBZ | |
1300 | if(ServerConfCompressed(yy_server)) | |
1301 | { | |
1302 | conf_report_error("Ignoring connect::flags::compressed -- zlib not available."); | |
1303 | yy_server->flags &= ~SERVER_COMPRESSED; | |
1304 | } | |
1305 | #endif | |
1306 | ||
1307 | add_server_conf(yy_server); | |
330fc5c1 | 1308 | rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list); |
212380e3 AC |
1309 | |
1310 | yy_server = NULL; | |
1311 | return 0; | |
1312 | } | |
1313 | ||
1314 | static void | |
1315 | conf_set_connect_host(void *data) | |
1316 | { | |
637c4932 | 1317 | rb_free(yy_server->host); |
47a03750 | 1318 | yy_server->host = rb_strdup(data); |
212380e3 AC |
1319 | if (strchr(yy_server->host, ':')) |
1320 | yy_server->aftype = AF_INET6; | |
1321 | } | |
1322 | ||
1323 | static void | |
1324 | conf_set_connect_vhost(void *data) | |
1325 | { | |
caa4d9d2 | 1326 | if(rb_inet_pton_sock(data, (struct sockaddr *)&yy_server->my_ipnum) <= 0) |
212380e3 | 1327 | { |
532f83a7 | 1328 | conf_report_error("Invalid IP address for server connect vhost (%s)", |
212380e3 AC |
1329 | (char *) data); |
1330 | return; | |
1331 | } | |
1332 | ||
1333 | yy_server->flags |= SERVER_VHOSTED; | |
1334 | } | |
1335 | ||
1336 | static void | |
1337 | conf_set_connect_send_password(void *data) | |
1338 | { | |
1339 | if(yy_server->spasswd) | |
1340 | { | |
1341 | memset(yy_server->spasswd, 0, strlen(yy_server->spasswd)); | |
637c4932 | 1342 | rb_free(yy_server->spasswd); |
212380e3 AC |
1343 | } |
1344 | ||
47a03750 | 1345 | yy_server->spasswd = rb_strdup(data); |
212380e3 AC |
1346 | } |
1347 | ||
1348 | static void | |
1349 | conf_set_connect_accept_password(void *data) | |
1350 | { | |
1351 | if(yy_server->passwd) | |
1352 | { | |
1353 | memset(yy_server->passwd, 0, strlen(yy_server->passwd)); | |
637c4932 | 1354 | rb_free(yy_server->passwd); |
212380e3 | 1355 | } |
47a03750 | 1356 | yy_server->passwd = rb_strdup(data); |
212380e3 AC |
1357 | } |
1358 | ||
ff0cc1e6 AC |
1359 | static void |
1360 | conf_set_connect_fingerprint(void *data) | |
1361 | { | |
462ae9d7 JT |
1362 | if (yy_server->certfp) |
1363 | rb_free(yy_server->certfp); | |
ff0cc1e6 AC |
1364 | yy_server->certfp = rb_strdup((char *) data); |
1365 | ||
1366 | /* force SSL to be enabled if fingerprint is enabled. */ | |
1367 | yy_server->flags |= SERVER_SSL; | |
1368 | } | |
1369 | ||
212380e3 AC |
1370 | static void |
1371 | conf_set_connect_port(void *data) | |
1372 | { | |
1373 | int port = *(unsigned int *) data; | |
1374 | ||
1375 | if(port < 1) | |
1376 | port = PORTNUM; | |
1377 | ||
1378 | yy_server->port = port; | |
1379 | } | |
1380 | ||
1381 | static void | |
1382 | conf_set_connect_aftype(void *data) | |
1383 | { | |
1384 | char *aft = data; | |
1385 | ||
1386 | if(strcasecmp(aft, "ipv4") == 0) | |
1387 | yy_server->aftype = AF_INET; | |
ccda6e3f | 1388 | #ifdef RB_IPV6 |
212380e3 AC |
1389 | else if(strcasecmp(aft, "ipv6") == 0) |
1390 | yy_server->aftype = AF_INET6; | |
1391 | #endif | |
1392 | else | |
1393 | conf_report_error("connect::aftype '%s' is unknown.", aft); | |
1394 | } | |
1395 | ||
1396 | static void | |
1397 | conf_set_connect_flags(void *data) | |
1398 | { | |
1399 | conf_parm_t *args = data; | |
1400 | ||
1401 | /* note, we allow them to set compressed, then remove it later if | |
1402 | * they do and LIBZ isnt available | |
1403 | */ | |
1404 | set_modes_from_table(&yy_server->flags, "flag", connect_table, args); | |
1405 | } | |
1406 | ||
1407 | static void | |
1408 | conf_set_connect_hub_mask(void *data) | |
1409 | { | |
1410 | struct remote_conf *yy_hub; | |
1411 | ||
1412 | if(EmptyString(yy_server->name)) | |
1413 | return; | |
1414 | ||
1415 | yy_hub = make_remote_conf(); | |
1416 | yy_hub->flags = CONF_HUB; | |
1417 | ||
47a03750 VY |
1418 | yy_hub->host = rb_strdup(data); |
1419 | yy_hub->server = rb_strdup(yy_server->name); | |
330fc5c1 | 1420 | rb_dlinkAdd(yy_hub, &yy_hub->node, &hubleaf_conf_list); |
212380e3 AC |
1421 | } |
1422 | ||
1423 | static void | |
1424 | conf_set_connect_leaf_mask(void *data) | |
1425 | { | |
1426 | struct remote_conf *yy_leaf; | |
1427 | ||
1428 | if(EmptyString(yy_server->name)) | |
1429 | return; | |
1430 | ||
1431 | yy_leaf = make_remote_conf(); | |
1432 | yy_leaf->flags = CONF_LEAF; | |
1433 | ||
47a03750 VY |
1434 | yy_leaf->host = rb_strdup(data); |
1435 | yy_leaf->server = rb_strdup(yy_server->name); | |
330fc5c1 | 1436 | rb_dlinkAdd(yy_leaf, &yy_leaf->node, &hubleaf_conf_list); |
212380e3 AC |
1437 | } |
1438 | ||
1439 | static void | |
1440 | conf_set_connect_class(void *data) | |
1441 | { | |
637c4932 | 1442 | rb_free(yy_server->class_name); |
47a03750 | 1443 | yy_server->class_name = rb_strdup(data); |
212380e3 AC |
1444 | } |
1445 | ||
1446 | static void | |
1447 | conf_set_exempt_ip(void *data) | |
1448 | { | |
1449 | struct ConfItem *yy_tmp; | |
1450 | ||
1451 | if(parse_netmask(data, NULL, NULL) == HM_HOST) | |
1452 | { | |
1453 | conf_report_error("Ignoring exempt -- invalid exempt::ip."); | |
1454 | return; | |
1455 | } | |
1456 | ||
1457 | yy_tmp = make_conf(); | |
47a03750 VY |
1458 | yy_tmp->passwd = rb_strdup("*"); |
1459 | yy_tmp->host = rb_strdup(data); | |
212380e3 | 1460 | yy_tmp->status = CONF_EXEMPTDLINE; |
40c1fd47 | 1461 | add_conf_by_address(yy_tmp->host, CONF_EXEMPTDLINE, NULL, NULL, yy_tmp); |
212380e3 AC |
1462 | } |
1463 | ||
1464 | static int | |
1465 | conf_cleanup_cluster(struct TopConf *tc) | |
1466 | { | |
637c4932 | 1467 | rb_dlink_node *ptr, *next_ptr; |
212380e3 | 1468 | |
637c4932 | 1469 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_cluster_list.head) |
212380e3 AC |
1470 | { |
1471 | free_remote_conf(ptr->data); | |
330fc5c1 | 1472 | rb_dlinkDestroy(ptr, &yy_cluster_list); |
212380e3 AC |
1473 | } |
1474 | ||
1475 | if(yy_shared != NULL) | |
1476 | { | |
1477 | free_remote_conf(yy_shared); | |
1478 | yy_shared = NULL; | |
1479 | } | |
1480 | ||
1481 | return 0; | |
1482 | } | |
1483 | ||
1484 | static void | |
1485 | conf_set_cluster_name(void *data) | |
1486 | { | |
1487 | if(yy_shared != NULL) | |
1488 | free_remote_conf(yy_shared); | |
1489 | ||
1490 | yy_shared = make_remote_conf(); | |
47a03750 | 1491 | yy_shared->server = rb_strdup(data); |
330fc5c1 | 1492 | rb_dlinkAddAlloc(yy_shared, &yy_cluster_list); |
212380e3 AC |
1493 | |
1494 | yy_shared = NULL; | |
1495 | } | |
1496 | ||
1497 | static void | |
1498 | conf_set_cluster_flags(void *data) | |
1499 | { | |
1500 | conf_parm_t *args = data; | |
1501 | int flags = 0; | |
637c4932 | 1502 | rb_dlink_node *ptr, *next_ptr; |
212380e3 AC |
1503 | |
1504 | if(yy_shared != NULL) | |
1505 | free_remote_conf(yy_shared); | |
1506 | ||
1507 | set_modes_from_table(&flags, "flag", cluster_table, args); | |
1508 | ||
637c4932 | 1509 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_cluster_list.head) |
212380e3 AC |
1510 | { |
1511 | yy_shared = ptr->data; | |
1512 | yy_shared->flags = flags; | |
330fc5c1 AC |
1513 | rb_dlinkAddTail(yy_shared, &yy_shared->node, &cluster_conf_list); |
1514 | rb_dlinkDestroy(ptr, &yy_cluster_list); | |
212380e3 AC |
1515 | } |
1516 | ||
1517 | yy_shared = NULL; | |
1518 | } | |
1519 | ||
1520 | static void | |
1521 | conf_set_general_havent_read_conf(void *data) | |
1522 | { | |
1523 | if(*(unsigned int *) data) | |
1524 | { | |
1525 | conf_report_error("You haven't read your config file properly."); | |
1526 | conf_report_error | |
1527 | ("There is a line in the example conf that will kill your server if not removed."); | |
1528 | conf_report_error | |
1529 | ("Consider actually reading/editing the conf file, and removing this line."); | |
1530 | if (!testing_conf) | |
1531 | exit(0); | |
1532 | } | |
1533 | } | |
1534 | ||
1535 | static void | |
1536 | conf_set_general_hide_error_messages(void *data) | |
1537 | { | |
1538 | char *val = data; | |
1539 | ||
1540 | if(strcasecmp(val, "yes") == 0) | |
1541 | ConfigFileEntry.hide_error_messages = 2; | |
1542 | else if(strcasecmp(val, "opers") == 0) | |
1543 | ConfigFileEntry.hide_error_messages = 1; | |
1544 | else if(strcasecmp(val, "no") == 0) | |
1545 | ConfigFileEntry.hide_error_messages = 0; | |
1546 | else | |
1547 | conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val); | |
1548 | } | |
1549 | ||
1550 | static void | |
1551 | conf_set_general_kline_delay(void *data) | |
1552 | { | |
1553 | ConfigFileEntry.kline_delay = *(unsigned int *) data; | |
1554 | ||
1555 | /* THIS MUST BE HERE to stop us being unable to check klines */ | |
f66f0baa | 1556 | kline_queued = false; |
212380e3 AC |
1557 | } |
1558 | ||
1559 | static void | |
1560 | conf_set_general_stats_k_oper_only(void *data) | |
1561 | { | |
1562 | char *val = data; | |
1563 | ||
1564 | if(strcasecmp(val, "yes") == 0) | |
1565 | ConfigFileEntry.stats_k_oper_only = 2; | |
1566 | else if(strcasecmp(val, "masked") == 0) | |
1567 | ConfigFileEntry.stats_k_oper_only = 1; | |
1568 | else if(strcasecmp(val, "no") == 0) | |
1569 | ConfigFileEntry.stats_k_oper_only = 0; | |
1570 | else | |
1571 | conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val); | |
1572 | } | |
1573 | ||
1574 | static void | |
1575 | conf_set_general_stats_i_oper_only(void *data) | |
1576 | { | |
1577 | char *val = data; | |
1578 | ||
1579 | if(strcasecmp(val, "yes") == 0) | |
1580 | ConfigFileEntry.stats_i_oper_only = 2; | |
1581 | else if(strcasecmp(val, "masked") == 0) | |
1582 | ConfigFileEntry.stats_i_oper_only = 1; | |
1583 | else if(strcasecmp(val, "no") == 0) | |
1584 | ConfigFileEntry.stats_i_oper_only = 0; | |
1585 | else | |
1586 | conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val); | |
1587 | } | |
1588 | ||
1589 | static void | |
1590 | conf_set_general_compression_level(void *data) | |
1591 | { | |
1592 | #ifdef HAVE_LIBZ | |
1593 | ConfigFileEntry.compression_level = *(unsigned int *) data; | |
1594 | ||
1595 | if((ConfigFileEntry.compression_level < 1) || (ConfigFileEntry.compression_level > 9)) | |
1596 | { | |
1597 | conf_report_error | |
1598 | ("Invalid general::compression_level %d -- using default.", | |
1599 | ConfigFileEntry.compression_level); | |
1600 | ConfigFileEntry.compression_level = 0; | |
1601 | } | |
1602 | #else | |
1603 | conf_report_error("Ignoring general::compression_level -- zlib not available."); | |
1604 | #endif | |
1605 | } | |
1606 | ||
1607 | static void | |
1608 | conf_set_general_default_umodes(void *data) | |
1609 | { | |
1610 | char *pm; | |
1611 | int what = MODE_ADD, flag; | |
1612 | ||
1613 | ConfigFileEntry.default_umodes = 0; | |
1614 | for (pm = (char *) data; *pm; pm++) | |
1615 | { | |
1616 | switch (*pm) | |
1617 | { | |
1618 | case '+': | |
1619 | what = MODE_ADD; | |
1620 | break; | |
1621 | case '-': | |
1622 | what = MODE_DEL; | |
1623 | break; | |
1624 | ||
1625 | /* don't allow +o */ | |
1626 | case 'o': | |
1627 | case 'S': | |
5fabe513 | 1628 | case 'Z': |
212380e3 AC |
1629 | case ' ': |
1630 | break; | |
1631 | ||
1632 | default: | |
1633 | if ((flag = user_modes[(unsigned char) *pm])) | |
1634 | { | |
1635 | /* Proper value has probably not yet been set | |
1636 | * so don't check oper_only_umodes -- jilles */ | |
1637 | if (what == MODE_ADD) | |
1638 | ConfigFileEntry.default_umodes |= flag; | |
1639 | else | |
1640 | ConfigFileEntry.default_umodes &= ~flag; | |
1641 | } | |
1642 | break; | |
1643 | } | |
023c36ae | 1644 | } |
212380e3 AC |
1645 | } |
1646 | ||
1647 | static void | |
1648 | conf_set_general_oper_umodes(void *data) | |
1649 | { | |
1650 | set_modes_from_table(&ConfigFileEntry.oper_umodes, "umode", umode_table, data); | |
1651 | } | |
1652 | ||
13d8f0ed AC |
1653 | static void |
1654 | conf_set_general_certfp_method(void *data) | |
1655 | { | |
1656 | char *method = data; | |
1657 | ||
1658 | if (!strcasecmp(method, "sha1")) | |
1659 | ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA1; | |
1660 | else if (!strcasecmp(method, "sha256")) | |
1661 | ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA256; | |
1662 | else if (!strcasecmp(method, "sha512")) | |
1663 | ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA512; | |
1664 | else | |
1665 | { | |
1666 | ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA1; | |
1667 | conf_report_error("Ignoring general::certfp_method -- bogus certfp method %s", method); | |
1668 | } | |
1669 | } | |
1670 | ||
212380e3 AC |
1671 | static void |
1672 | conf_set_general_oper_only_umodes(void *data) | |
1673 | { | |
1674 | set_modes_from_table(&ConfigFileEntry.oper_only_umodes, "umode", umode_table, data); | |
1675 | } | |
1676 | ||
1677 | static void | |
1678 | conf_set_general_oper_snomask(void *data) | |
1679 | { | |
1680 | char *pm; | |
1681 | int what = MODE_ADD, flag; | |
1682 | ||
1683 | ConfigFileEntry.oper_snomask = 0; | |
1684 | for (pm = (char *) data; *pm; pm++) | |
1685 | { | |
1686 | switch (*pm) | |
1687 | { | |
1688 | case '+': | |
1689 | what = MODE_ADD; | |
1690 | break; | |
1691 | case '-': | |
1692 | what = MODE_DEL; | |
1693 | break; | |
1694 | ||
1695 | default: | |
1696 | if ((flag = snomask_modes[(unsigned char) *pm])) | |
1697 | { | |
1698 | if (what == MODE_ADD) | |
1699 | ConfigFileEntry.oper_snomask |= flag; | |
1700 | else | |
1701 | ConfigFileEntry.oper_snomask &= ~flag; | |
1702 | } | |
1703 | break; | |
1704 | } | |
1705 | } | |
1706 | } | |
1707 | ||
1708 | static void | |
1709 | conf_set_serverhide_links_delay(void *data) | |
1710 | { | |
1711 | int val = *(unsigned int *) data; | |
1712 | ||
212380e3 AC |
1713 | ConfigServerHide.links_delay = val; |
1714 | } | |
1715 | ||
212380e3 AC |
1716 | static void |
1717 | conf_set_service_name(void *data) | |
1718 | { | |
212380e3 AC |
1719 | const char *s; |
1720 | char *tmp; | |
1721 | int dots = 0; | |
1722 | ||
1723 | for(s = data; *s != '\0'; s++) | |
1724 | { | |
1725 | if(!IsServChar(*s)) | |
1726 | { | |
1727 | conf_report_error("Ignoring service::name " | |
1728 | "-- bogus servername."); | |
1729 | return; | |
1730 | } | |
1731 | else if(*s == '.') | |
1732 | dots++; | |
1733 | } | |
1734 | ||
1735 | if(!dots) | |
1736 | { | |
1737 | conf_report_error("Ignoring service::name -- must contain '.'"); | |
1738 | return; | |
1739 | } | |
1740 | ||
47a03750 | 1741 | tmp = rb_strdup(data); |
330fc5c1 | 1742 | rb_dlinkAddAlloc(tmp, &service_list); |
212380e3 AC |
1743 | } |
1744 | ||
212380e3 AC |
1745 | static int |
1746 | conf_begin_alias(struct TopConf *tc) | |
1747 | { | |
eddc2ab6 | 1748 | yy_alias = rb_malloc(sizeof(struct alias_entry)); |
212380e3 AC |
1749 | |
1750 | if (conf_cur_block_name != NULL) | |
47a03750 | 1751 | yy_alias->name = rb_strdup(conf_cur_block_name); |
212380e3 AC |
1752 | |
1753 | yy_alias->flags = 0; | |
1754 | yy_alias->hits = 0; | |
1755 | ||
1756 | return 0; | |
1757 | } | |
1758 | ||
1759 | static int | |
1760 | conf_end_alias(struct TopConf *tc) | |
1761 | { | |
212380e3 AC |
1762 | if (yy_alias == NULL) |
1763 | return -1; | |
1764 | ||
1765 | if (yy_alias->name == NULL) | |
1766 | { | |
1767 | conf_report_error("Ignoring alias -- must have a name."); | |
1768 | ||
637c4932 | 1769 | rb_free(yy_alias); |
212380e3 AC |
1770 | |
1771 | return -1; | |
1772 | } | |
1773 | ||
1774 | if (yy_alias->target == NULL) | |
1775 | { | |
1776 | conf_report_error("Ignoring alias -- must have a target."); | |
1777 | ||
637c4932 | 1778 | rb_free(yy_alias); |
212380e3 AC |
1779 | |
1780 | return -1; | |
1781 | } | |
1782 | ||
a4bf26dd | 1783 | rb_dictionary_add(alias_dict, yy_alias->name, yy_alias); |
212380e3 AC |
1784 | |
1785 | return 0; | |
1786 | } | |
1787 | ||
1788 | static void | |
1789 | conf_set_alias_name(void *data) | |
1790 | { | |
1791 | if (data == NULL || yy_alias == NULL) /* this shouldn't ever happen */ | |
1792 | return; | |
1793 | ||
47a03750 | 1794 | yy_alias->name = rb_strdup(data); |
212380e3 AC |
1795 | } |
1796 | ||
1797 | static void | |
1798 | conf_set_alias_target(void *data) | |
1799 | { | |
1800 | if (data == NULL || yy_alias == NULL) /* this shouldn't ever happen */ | |
1801 | return; | |
1802 | ||
47a03750 | 1803 | yy_alias->target = rb_strdup(data); |
212380e3 AC |
1804 | } |
1805 | ||
63eb8567 AC |
1806 | static void |
1807 | conf_set_channel_autochanmodes(void *data) | |
1808 | { | |
1809 | char *pm; | |
1810 | int what = MODE_ADD; | |
1811 | ||
1812 | ConfigChannel.autochanmodes = 0; | |
1813 | for (pm = (char *) data; *pm; pm++) | |
1814 | { | |
1815 | switch (*pm) | |
1816 | { | |
1817 | case '+': | |
1818 | what = MODE_ADD; | |
1819 | break; | |
1820 | case '-': | |
1821 | what = MODE_DEL; | |
1822 | break; | |
1823 | ||
1824 | default: | |
1825 | if (chmode_table[(unsigned char) *pm].set_func == chm_simple) | |
1826 | { | |
1827 | if (what == MODE_ADD) | |
1828 | ConfigChannel.autochanmodes |= chmode_table[(unsigned char) *pm].mode_type; | |
1829 | else | |
1830 | ConfigChannel.autochanmodes &= ~chmode_table[(unsigned char) *pm].mode_type; | |
1831 | } | |
1832 | else | |
1833 | { | |
4952e40b | 1834 | conf_report_error("channel::autochanmodes -- Invalid channel mode %c", *pm); |
63eb8567 AC |
1835 | continue; |
1836 | } | |
1837 | break; | |
1838 | } | |
1839 | } | |
1840 | } | |
1841 | ||
3c93d380 EM |
1842 | /* XXX for below */ |
1843 | static void conf_set_blacklist_reason(void *data); | |
1844 | ||
212380e3 AC |
1845 | static void |
1846 | conf_set_blacklist_host(void *data) | |
1847 | { | |
3c93d380 EM |
1848 | if (yy_blacklist_host) |
1849 | { | |
1850 | conf_report_error("blacklist::host %s overlaps existing host %s", | |
1851 | (char *)data, yy_blacklist_host); | |
1852 | ||
1853 | /* Cleanup */ | |
1854 | conf_set_blacklist_reason(NULL); | |
1855 | return; | |
1856 | } | |
1857 | ||
1858 | yy_blacklist_ipv4 = 1; | |
1859 | yy_blacklist_ipv6 = 0; | |
47a03750 | 1860 | yy_blacklist_host = rb_strdup(data); |
212380e3 AC |
1861 | } |
1862 | ||
0a1e77c2 EM |
1863 | static void |
1864 | conf_set_blacklist_type(void *data) | |
1865 | { | |
1866 | conf_parm_t *args = data; | |
1867 | ||
1868 | /* Don't assume we have either if we got here */ | |
1869 | yy_blacklist_ipv4 = 0; | |
1870 | yy_blacklist_ipv6 = 0; | |
1871 | ||
1872 | for (; args; args = args->next) | |
1873 | { | |
1874 | if (!strcasecmp(args->v.string, "ipv4")) | |
1875 | yy_blacklist_ipv4 = 1; | |
1876 | else if (!strcasecmp(args->v.string, "ipv6")) | |
1877 | yy_blacklist_ipv6 = 1; | |
1878 | else | |
1879 | conf_report_error("blacklist::type has unknown address family %s", | |
1880 | args->v.string); | |
1881 | } | |
1882 | ||
1883 | /* If we have neither, just default to IPv4 */ | |
1884 | if (!yy_blacklist_ipv4 && !yy_blacklist_ipv6) | |
1885 | { | |
1886 | conf_report_error("blacklist::type has neither IPv4 nor IPv6 (defaulting to IPv4)"); | |
1887 | yy_blacklist_ipv4 = 1; | |
1888 | } | |
1889 | } | |
1890 | ||
3c93d380 EM |
1891 | static void |
1892 | conf_set_blacklist_matches(void *data) | |
1893 | { | |
1894 | conf_parm_t *args = data; | |
1895 | ||
1896 | for (; args; args = args->next) | |
1897 | { | |
1898 | struct BlacklistFilter *filter; | |
1899 | char *str = args->v.string; | |
1900 | char *p; | |
1901 | int type = BLACKLIST_FILTER_LAST; | |
1902 | ||
1903 | if (CF_TYPE(args->type) != CF_QSTRING) | |
1904 | { | |
1905 | conf_report_error("blacklist::matches -- must be quoted string"); | |
1906 | continue; | |
1907 | } | |
1908 | ||
1909 | if (str == NULL) | |
1910 | { | |
1911 | conf_report_error("blacklist::matches -- invalid entry"); | |
1912 | continue; | |
1913 | } | |
1914 | ||
1915 | if (strlen(str) > HOSTIPLEN) | |
1916 | { | |
1917 | conf_report_error("blacklist::matches has an entry too long: %s", | |
1918 | str); | |
1919 | continue; | |
1920 | } | |
1921 | ||
1922 | for (p = str; *p != '\0'; p++) | |
1923 | { | |
1924 | /* Check for validity */ | |
1925 | if (*p == '.') | |
1926 | type = BLACKLIST_FILTER_ALL; | |
29c92cf9 | 1927 | else if (!isalnum((unsigned char)*p)) |
3c93d380 EM |
1928 | { |
1929 | conf_report_error("blacklist::matches has invalid IP match entry %s", | |
1930 | str); | |
1931 | type = 0; | |
1932 | break; | |
1933 | } | |
1934 | } | |
1935 | ||
1936 | if (type == BLACKLIST_FILTER_ALL) | |
1937 | { | |
1938 | /* Basic IP sanity check */ | |
1939 | struct rb_sockaddr_storage tmp; | |
1940 | if (rb_inet_pton(AF_INET, str, &tmp) <= 0) | |
1941 | { | |
1942 | conf_report_error("blacklist::matches has invalid IP match entry %s", | |
1943 | str); | |
1944 | continue; | |
1945 | } | |
1946 | } | |
1947 | else if (type == BLACKLIST_FILTER_LAST) | |
1948 | { | |
1949 | /* Verify it's the correct length */ | |
1950 | if (strlen(str) > 3) | |
1951 | { | |
1952 | conf_report_error("blacklist::matches has invalid octet match entry %s", | |
1953 | str); | |
1954 | continue; | |
1955 | } | |
1956 | } | |
1957 | else | |
1958 | { | |
1959 | continue; /* Invalid entry */ | |
1960 | } | |
1961 | ||
1962 | filter = rb_malloc(sizeof(struct BlacklistFilter)); | |
1963 | filter->type = type; | |
1964 | rb_strlcpy(filter->filterstr, str, sizeof(filter->filterstr)); | |
1965 | ||
1966 | rb_dlinkAdd(filter, &filter->node, &yy_blacklist_filters); | |
1967 | } | |
1968 | } | |
1969 | ||
212380e3 AC |
1970 | static void |
1971 | conf_set_blacklist_reason(void *data) | |
1972 | { | |
3c93d380 | 1973 | rb_dlink_node *ptr, *nptr; |
212380e3 | 1974 | |
2196b182 | 1975 | if (yy_blacklist_host && data) |
212380e3 | 1976 | { |
2196b182 | 1977 | yy_blacklist_reason = rb_strdup(data); |
0a1e77c2 EM |
1978 | if (yy_blacklist_ipv6) |
1979 | { | |
1980 | /* Make sure things fit (64 = alnum count + dots) */ | |
1981 | if ((64 + strlen(yy_blacklist_host)) > IRCD_RES_HOSTLEN) | |
1982 | { | |
1983 | conf_report_error("blacklist::host %s results in IPv6 queries that are too long", | |
1984 | yy_blacklist_host); | |
1985 | goto cleanup_bl; | |
1986 | } | |
1987 | } | |
1988 | /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */ | |
1989 | if (yy_blacklist_ipv4 && !yy_blacklist_ipv6) | |
1990 | { | |
1991 | /* Make sure things fit (16 = number of nums + dots) */ | |
1992 | if ((16 + strlen(yy_blacklist_host)) > IRCD_RES_HOSTLEN) | |
1993 | { | |
1994 | conf_report_error("blacklist::host %s results in IPv4 queries that are too long", | |
1995 | yy_blacklist_host); | |
1996 | goto cleanup_bl; | |
1997 | } | |
1998 | } | |
1999 | ||
3c93d380 EM |
2000 | new_blacklist(yy_blacklist_host, yy_blacklist_reason, yy_blacklist_ipv4, yy_blacklist_ipv6, |
2001 | &yy_blacklist_filters); | |
2002 | } | |
0a1e77c2 EM |
2003 | |
2004 | cleanup_bl: | |
e232f35c | 2005 | if (data == NULL) |
3c93d380 | 2006 | { |
e232f35c EM |
2007 | RB_DLINK_FOREACH_SAFE(ptr, nptr, yy_blacklist_filters.head) |
2008 | { | |
e232f35c | 2009 | rb_dlinkDelete(ptr, &yy_blacklist_filters); |
b84e58f9 | 2010 | rb_free(ptr); |
e232f35c EM |
2011 | } |
2012 | } | |
2013 | else | |
2014 | { | |
2015 | yy_blacklist_filters = (rb_dlink_list){ NULL, NULL, 0 }; | |
212380e3 | 2016 | } |
3c93d380 EM |
2017 | |
2018 | rb_free(yy_blacklist_host); | |
2019 | rb_free(yy_blacklist_reason); | |
2020 | yy_blacklist_host = NULL; | |
2021 | yy_blacklist_reason = NULL; | |
2022 | yy_blacklist_ipv4 = 1; | |
2023 | yy_blacklist_ipv6 = 0; | |
212380e3 AC |
2024 | } |
2025 | ||
2026 | /* public functions */ | |
2027 | ||
2028 | ||
2029 | void | |
2030 | conf_report_error(const char *fmt, ...) | |
2031 | { | |
2032 | va_list ap; | |
2033 | char msg[IRCD_BUFSIZE + 1] = { 0 }; | |
2034 | ||
2035 | va_start(ap, fmt); | |
5203cba5 | 2036 | vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); |
212380e3 AC |
2037 | va_end(ap); |
2038 | ||
2039 | if (testing_conf) | |
2040 | { | |
2041 | fprintf(stderr, "\"%s\", line %d: %s\n", current_file, lineno + 1, msg); | |
2042 | return; | |
2043 | } | |
2044 | ||
2045 | ierror("\"%s\", line %d: %s", current_file, lineno + 1, msg); | |
d84acbce AC |
2046 | sendto_realops_snomask(SNO_GENERAL, L_ALL, "error: \"%s\", line %d: %s", current_file, lineno + 1, msg); |
2047 | } | |
2048 | ||
2049 | void | |
2050 | conf_report_warning(const char *fmt, ...) | |
2051 | { | |
2052 | va_list ap; | |
2053 | char msg[IRCD_BUFSIZE + 1] = { 0 }; | |
2054 | ||
2055 | va_start(ap, fmt); | |
2056 | vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); | |
2057 | va_end(ap); | |
2058 | ||
2059 | if (testing_conf) | |
2060 | { | |
2061 | fprintf(stderr, "\"%s\", line %d: %s\n", current_file, lineno + 1, msg); | |
2062 | return; | |
2063 | } | |
2064 | ||
2065 | iwarn("\"%s\", line %d: %s", current_file, lineno + 1, msg); | |
2066 | sendto_realops_snomask(SNO_GENERAL, L_ALL, "warning: \"%s\", line %d: %s", current_file, lineno + 1, msg); | |
212380e3 AC |
2067 | } |
2068 | ||
2069 | int | |
2070 | conf_start_block(char *block, char *name) | |
2071 | { | |
2072 | if((conf_cur_block = find_top_conf(block)) == NULL) | |
2073 | { | |
2074 | conf_report_error("Configuration block '%s' is not defined.", block); | |
2075 | return -1; | |
2076 | } | |
2077 | ||
2078 | if(name) | |
47a03750 | 2079 | conf_cur_block_name = rb_strdup(name); |
212380e3 AC |
2080 | else |
2081 | conf_cur_block_name = NULL; | |
2082 | ||
2083 | if(conf_cur_block->tc_sfunc) | |
2084 | if(conf_cur_block->tc_sfunc(conf_cur_block) < 0) | |
2085 | return -1; | |
2086 | ||
2087 | return 0; | |
2088 | } | |
2089 | ||
2090 | int | |
2091 | conf_end_block(struct TopConf *tc) | |
2092 | { | |
e12981c0 | 2093 | int ret = 0; |
212380e3 | 2094 | if(tc->tc_efunc) |
e12981c0 | 2095 | ret = tc->tc_efunc(tc); |
212380e3 | 2096 | |
637c4932 | 2097 | rb_free(conf_cur_block_name); |
e12981c0 KB |
2098 | conf_cur_block_name = NULL; |
2099 | return ret; | |
212380e3 AC |
2100 | } |
2101 | ||
2102 | static void | |
2103 | conf_set_generic_int(void *data, void *location) | |
2104 | { | |
2105 | *((int *) location) = *((unsigned int *) data); | |
2106 | } | |
2107 | ||
2108 | static void | |
2109 | conf_set_generic_string(void *data, int len, void *location) | |
2110 | { | |
2111 | char **loc = location; | |
2112 | char *input = data; | |
2113 | ||
2e819b6b | 2114 | if(len && strlen(input) > (unsigned int)len) |
212380e3 AC |
2115 | input[len] = '\0'; |
2116 | ||
637c4932 | 2117 | rb_free(*loc); |
47a03750 | 2118 | *loc = rb_strdup(input); |
212380e3 AC |
2119 | } |
2120 | ||
2121 | int | |
dceac3e4 | 2122 | conf_call_set(struct TopConf *tc, char *item, conf_parm_t * value) |
212380e3 AC |
2123 | { |
2124 | struct ConfEntry *cf; | |
2125 | conf_parm_t *cp; | |
2126 | ||
2127 | if(!tc) | |
2128 | return -1; | |
2129 | ||
2130 | if((cf = find_conf_item(tc, item)) == NULL) | |
2131 | { | |
2132 | conf_report_error | |
2133 | ("Non-existant configuration setting %s::%s.", tc->tc_name, (char *) item); | |
2134 | return -1; | |
2135 | } | |
2136 | ||
2137 | /* if it takes one thing, make sure they only passed one thing, | |
2138 | and handle as needed. */ | |
ed45dfe6 | 2139 | if((value->v.list->type & CF_FLIST) && !(cf->cf_type & CF_FLIST)) |
212380e3 AC |
2140 | { |
2141 | conf_report_error | |
2142 | ("Option %s::%s does not take a list of values.", tc->tc_name, item); | |
2143 | return -1; | |
2144 | } | |
2145 | ||
2146 | cp = value->v.list; | |
2147 | ||
2148 | ||
2149 | if(CF_TYPE(value->v.list->type) != CF_TYPE(cf->cf_type)) | |
2150 | { | |
023c36ae | 2151 | /* if it expects a string value, but we got a yesno, |
212380e3 AC |
2152 | * convert it back |
2153 | */ | |
2154 | if((CF_TYPE(value->v.list->type) == CF_YESNO) && | |
2155 | (CF_TYPE(cf->cf_type) == CF_STRING)) | |
2156 | { | |
2157 | value->v.list->type = CF_STRING; | |
2158 | ||
2159 | if(cp->v.number == 1) | |
47a03750 | 2160 | cp->v.string = rb_strdup("yes"); |
212380e3 | 2161 | else |
47a03750 | 2162 | cp->v.string = rb_strdup("no"); |
212380e3 AC |
2163 | } |
2164 | ||
2165 | /* maybe it's a CF_TIME and they passed CF_INT -- | |
2166 | should still be valid */ | |
2167 | else if(!((CF_TYPE(value->v.list->type) == CF_INT) && | |
2168 | (CF_TYPE(cf->cf_type) == CF_TIME))) | |
2169 | { | |
2170 | conf_report_error | |
2171 | ("Wrong type for %s::%s (expected %s, got %s)", | |
2172 | tc->tc_name, (char *) item, | |
2173 | conf_strtype(cf->cf_type), conf_strtype(value->v.list->type)); | |
2174 | return -1; | |
2175 | } | |
2176 | } | |
2177 | ||
2178 | if(cf->cf_type & CF_FLIST) | |
2179 | { | |
2180 | #if 0 | |
2181 | if(cf->cf_arg) | |
2182 | conf_set_generic_list(value->v.list, cf->cf_arg); | |
2183 | else | |
2184 | #endif | |
2185 | /* just pass it the extended argument list */ | |
2186 | cf->cf_func(value->v.list); | |
2187 | } | |
2188 | else | |
2189 | { | |
2190 | /* it's old-style, needs only one arg */ | |
2191 | switch (cf->cf_type) | |
2192 | { | |
2193 | case CF_INT: | |
2194 | case CF_TIME: | |
2195 | case CF_YESNO: | |
2196 | if(cf->cf_arg) | |
2197 | conf_set_generic_int(&cp->v.number, cf->cf_arg); | |
2198 | else | |
2199 | cf->cf_func(&cp->v.number); | |
2200 | break; | |
2201 | case CF_STRING: | |
2202 | case CF_QSTRING: | |
2203 | if(EmptyString(cp->v.string)) | |
2204 | conf_report_error("Ignoring %s::%s -- empty field", | |
2205 | tc->tc_name, item); | |
2206 | else if(cf->cf_arg) | |
2207 | conf_set_generic_string(cp->v.string, cf->cf_len, cf->cf_arg); | |
2208 | else | |
2209 | cf->cf_func(cp->v.string); | |
2210 | break; | |
2211 | } | |
2212 | } | |
2213 | ||
2214 | ||
2215 | return 0; | |
2216 | } | |
2217 | ||
2218 | int | |
2219 | add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *)) | |
2220 | { | |
2221 | struct TopConf *tc; | |
2222 | struct ConfEntry *cf; | |
2223 | ||
2224 | if((tc = find_top_conf(topconf)) == NULL) | |
2225 | return -1; | |
2226 | ||
12edf3e3 | 2227 | if(find_conf_item(tc, name) != NULL) |
212380e3 AC |
2228 | return -1; |
2229 | ||
eddc2ab6 | 2230 | cf = rb_malloc(sizeof(struct ConfEntry)); |
212380e3 | 2231 | |
d7f753cd | 2232 | cf->cf_name = name; |
212380e3 AC |
2233 | cf->cf_type = type; |
2234 | cf->cf_func = func; | |
2235 | cf->cf_arg = NULL; | |
2236 | ||
330fc5c1 | 2237 | rb_dlinkAddAlloc(cf, &tc->tc_items); |
212380e3 AC |
2238 | |
2239 | return 0; | |
2240 | } | |
2241 | ||
2242 | int | |
2243 | remove_conf_item(const char *topconf, const char *name) | |
2244 | { | |
2245 | struct TopConf *tc; | |
2246 | struct ConfEntry *cf; | |
330fc5c1 | 2247 | rb_dlink_node *ptr; |
212380e3 AC |
2248 | |
2249 | if((tc = find_top_conf(topconf)) == NULL) | |
2250 | return -1; | |
2251 | ||
2252 | if((cf = find_conf_item(tc, name)) == NULL) | |
2253 | return -1; | |
2254 | ||
330fc5c1 | 2255 | if((ptr = rb_dlinkFind(cf, &tc->tc_items)) == NULL) |
212380e3 AC |
2256 | return -1; |
2257 | ||
330fc5c1 | 2258 | rb_dlinkDestroy(ptr, &tc->tc_items); |
637c4932 | 2259 | rb_free(cf); |
212380e3 AC |
2260 | |
2261 | return 0; | |
2262 | } | |
2263 | ||
2264 | /* *INDENT-OFF* */ | |
2265 | static struct ConfEntry conf_serverinfo_table[] = | |
2266 | { | |
2267 | { "description", CF_QSTRING, NULL, 0, &ServerInfo.description }, | |
212380e3 | 2268 | { "hub", CF_YESNO, NULL, 0, &ServerInfo.hub }, |
212380e3 AC |
2269 | |
2270 | { "network_name", CF_QSTRING, conf_set_serverinfo_network_name, 0, NULL }, | |
2271 | { "name", CF_QSTRING, conf_set_serverinfo_name, 0, NULL }, | |
2272 | { "sid", CF_QSTRING, conf_set_serverinfo_sid, 0, NULL }, | |
2273 | { "vhost", CF_QSTRING, conf_set_serverinfo_vhost, 0, NULL }, | |
2274 | { "vhost6", CF_QSTRING, conf_set_serverinfo_vhost6, 0, NULL }, | |
2275 | ||
8bd5767b JT |
2276 | { "ssl_private_key", CF_QSTRING, NULL, 0, &ServerInfo.ssl_private_key }, |
2277 | { "ssl_ca_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_ca_cert }, | |
023c36ae | 2278 | { "ssl_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_cert }, |
8bd5767b | 2279 | { "ssl_dh_params", CF_QSTRING, NULL, 0, &ServerInfo.ssl_dh_params }, |
c1725bda | 2280 | { "ssl_cipher_list", CF_QSTRING, NULL, 0, &ServerInfo.ssl_cipher_list }, |
c6d72037 VY |
2281 | { "ssld_count", CF_INT, NULL, 0, &ServerInfo.ssld_count }, |
2282 | ||
101db4c4 | 2283 | { "default_max_clients",CF_INT, NULL, 0, &ServerInfo.default_max_clients }, |
c2d96fcb | 2284 | |
b583faf9 AC |
2285 | { "nicklen", CF_INT, conf_set_serverinfo_nicklen, 0, NULL }, |
2286 | ||
212380e3 AC |
2287 | { "\0", 0, NULL, 0, NULL } |
2288 | }; | |
2289 | ||
2290 | static struct ConfEntry conf_admin_table[] = | |
2291 | { | |
2292 | { "name", CF_QSTRING, NULL, 200, &AdminInfo.name }, | |
2293 | { "description",CF_QSTRING, NULL, 200, &AdminInfo.description }, | |
2294 | { "email", CF_QSTRING, NULL, 200, &AdminInfo.email }, | |
2295 | { "\0", 0, NULL, 0, NULL } | |
2296 | }; | |
2297 | ||
2298 | static struct ConfEntry conf_log_table[] = | |
2299 | { | |
d74fa5b5 JT |
2300 | { "fname_userlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_userlog }, |
2301 | { "fname_fuserlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_fuserlog }, | |
2302 | { "fname_operlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_operlog }, | |
2303 | { "fname_foperlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_foperlog }, | |
2304 | { "fname_serverlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_serverlog }, | |
2305 | { "fname_killlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_killlog }, | |
2306 | { "fname_klinelog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_klinelog }, | |
2307 | { "fname_operspylog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_operspylog }, | |
2308 | { "fname_ioerrorlog", CF_QSTRING, NULL, PATH_MAX, &ConfigFileEntry.fname_ioerrorlog }, | |
212380e3 AC |
2309 | { "\0", 0, NULL, 0, NULL } |
2310 | }; | |
2311 | ||
2312 | static struct ConfEntry conf_operator_table[] = | |
2313 | { | |
2314 | { "rsa_public_key_file", CF_QSTRING, conf_set_oper_rsa_public_key_file, 0, NULL }, | |
2315 | { "flags", CF_STRING | CF_FLIST, conf_set_oper_flags, 0, NULL }, | |
2316 | { "umodes", CF_STRING | CF_FLIST, conf_set_oper_umodes, 0, NULL }, | |
22c3b270 | 2317 | { "privset", CF_QSTRING, conf_set_oper_privset, 0, NULL }, |
212380e3 AC |
2318 | { "snomask", CF_QSTRING, conf_set_oper_snomask, 0, NULL }, |
2319 | { "user", CF_QSTRING, conf_set_oper_user, 0, NULL }, | |
2320 | { "password", CF_QSTRING, conf_set_oper_password, 0, NULL }, | |
ff31db84 | 2321 | { "fingerprint", CF_QSTRING, conf_set_oper_fingerprint, 0, NULL }, |
212380e3 AC |
2322 | { "\0", 0, NULL, 0, NULL } |
2323 | }; | |
2324 | ||
f8606875 AC |
2325 | static struct ConfEntry conf_privset_table[] = |
2326 | { | |
2327 | { "extends", CF_QSTRING, conf_set_privset_extends, 0, NULL }, | |
2328 | { "privs", CF_STRING | CF_FLIST, conf_set_privset_privs, 0, NULL }, | |
2329 | { "\0", 0, NULL, 0, NULL } | |
2330 | }; | |
2331 | ||
212380e3 AC |
2332 | static struct ConfEntry conf_class_table[] = |
2333 | { | |
2334 | { "ping_time", CF_TIME, conf_set_class_ping_time, 0, NULL }, | |
e33e589c JT |
2335 | { "cidr_ipv4_bitlen", CF_INT, conf_set_class_cidr_ipv4_bitlen, 0, NULL }, |
2336 | #ifdef RB_IPV6 | |
2337 | { "cidr_ipv6_bitlen", CF_INT, conf_set_class_cidr_ipv6_bitlen, 0, NULL }, | |
2338 | #endif | |
212380e3 AC |
2339 | { "number_per_cidr", CF_INT, conf_set_class_number_per_cidr, 0, NULL }, |
2340 | { "number_per_ip", CF_INT, conf_set_class_number_per_ip, 0, NULL }, | |
2341 | { "number_per_ip_global", CF_INT,conf_set_class_number_per_ip_global, 0, NULL }, | |
2342 | { "number_per_ident", CF_INT, conf_set_class_number_per_ident, 0, NULL }, | |
2343 | { "connectfreq", CF_TIME, conf_set_class_connectfreq, 0, NULL }, | |
2344 | { "max_number", CF_INT, conf_set_class_max_number, 0, NULL }, | |
2345 | { "sendq", CF_TIME, conf_set_class_sendq, 0, NULL }, | |
2346 | { "\0", 0, NULL, 0, NULL } | |
2347 | }; | |
2348 | ||
2349 | static struct ConfEntry conf_auth_table[] = | |
2350 | { | |
2351 | { "user", CF_QSTRING, conf_set_auth_user, 0, NULL }, | |
40c1fd47 | 2352 | { "auth_user", CF_QSTRING, conf_set_auth_auth_user, 0, NULL }, |
212380e3 AC |
2353 | { "password", CF_QSTRING, conf_set_auth_passwd, 0, NULL }, |
2354 | { "class", CF_QSTRING, conf_set_auth_class, 0, NULL }, | |
2355 | { "spoof", CF_QSTRING, conf_set_auth_spoof, 0, NULL }, | |
2356 | { "redirserv", CF_QSTRING, conf_set_auth_redir_serv, 0, NULL }, | |
2357 | { "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL }, | |
2358 | { "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL }, | |
2359 | { "\0", 0, NULL, 0, NULL } | |
2360 | }; | |
2361 | ||
2362 | static struct ConfEntry conf_connect_table[] = | |
2363 | { | |
2364 | { "send_password", CF_QSTRING, conf_set_connect_send_password, 0, NULL }, | |
2365 | { "accept_password", CF_QSTRING, conf_set_connect_accept_password, 0, NULL }, | |
ff0cc1e6 | 2366 | { "fingerprint", CF_QSTRING, conf_set_connect_fingerprint, 0, NULL }, |
212380e3 AC |
2367 | { "flags", CF_STRING | CF_FLIST, conf_set_connect_flags, 0, NULL }, |
2368 | { "host", CF_QSTRING, conf_set_connect_host, 0, NULL }, | |
2369 | { "vhost", CF_QSTRING, conf_set_connect_vhost, 0, NULL }, | |
2370 | { "port", CF_INT, conf_set_connect_port, 0, NULL }, | |
2371 | { "aftype", CF_STRING, conf_set_connect_aftype, 0, NULL }, | |
2372 | { "hub_mask", CF_QSTRING, conf_set_connect_hub_mask, 0, NULL }, | |
2373 | { "leaf_mask", CF_QSTRING, conf_set_connect_leaf_mask, 0, NULL }, | |
2374 | { "class", CF_QSTRING, conf_set_connect_class, 0, NULL }, | |
2375 | { "\0", 0, NULL, 0, NULL } | |
2376 | }; | |
2377 | ||
2378 | static struct ConfEntry conf_general_table[] = | |
2379 | { | |
2380 | { "oper_only_umodes", CF_STRING | CF_FLIST, conf_set_general_oper_only_umodes, 0, NULL }, | |
2381 | { "oper_umodes", CF_STRING | CF_FLIST, conf_set_general_oper_umodes, 0, NULL }, | |
2382 | { "oper_snomask", CF_QSTRING, conf_set_general_oper_snomask, 0, NULL }, | |
2383 | { "compression_level", CF_INT, conf_set_general_compression_level, 0, NULL }, | |
2384 | { "havent_read_conf", CF_YESNO, conf_set_general_havent_read_conf, 0, NULL }, | |
2385 | { "hide_error_messages",CF_STRING, conf_set_general_hide_error_messages,0, NULL }, | |
2386 | { "kline_delay", CF_TIME, conf_set_general_kline_delay, 0, NULL }, | |
2387 | { "stats_k_oper_only", CF_STRING, conf_set_general_stats_k_oper_only, 0, NULL }, | |
2388 | { "stats_i_oper_only", CF_STRING, conf_set_general_stats_i_oper_only, 0, NULL }, | |
2389 | { "default_umodes", CF_QSTRING, conf_set_general_default_umodes, 0, NULL }, | |
2390 | ||
2391 | { "default_operstring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operstring }, | |
2392 | { "default_adminstring",CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_adminstring }, | |
2393 | { "servicestring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.servicestring }, | |
212380e3 AC |
2394 | { "kline_reason", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.kline_reason }, |
2395 | { "identify_service", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.identifyservice }, | |
2396 | { "identify_command", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.identifycommand }, | |
7d33cce8 | 2397 | { "sasl_service", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.sasl_service }, |
212380e3 AC |
2398 | |
2399 | { "anti_spam_exit_message_time", CF_TIME, NULL, 0, &ConfigFileEntry.anti_spam_exit_message_time }, | |
2400 | { "disable_fake_channels", CF_YESNO, NULL, 0, &ConfigFileEntry.disable_fake_channels }, | |
2401 | { "min_nonwildcard_simple", CF_INT, NULL, 0, &ConfigFileEntry.min_nonwildcard_simple }, | |
2402 | { "non_redundant_klines", CF_YESNO, NULL, 0, &ConfigFileEntry.non_redundant_klines }, | |
2403 | { "tkline_expire_notices", CF_YESNO, NULL, 0, &ConfigFileEntry.tkline_expire_notices }, | |
2404 | ||
2405 | { "anti_nick_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.anti_nick_flood }, | |
2406 | { "burst_away", CF_YESNO, NULL, 0, &ConfigFileEntry.burst_away }, | |
2407 | { "caller_id_wait", CF_TIME, NULL, 0, &ConfigFileEntry.caller_id_wait }, | |
2408 | { "client_exit", CF_YESNO, NULL, 0, &ConfigFileEntry.client_exit }, | |
212380e3 | 2409 | { "collision_fnc", CF_YESNO, NULL, 0, &ConfigFileEntry.collision_fnc }, |
330692a1 | 2410 | { "resv_fnc", CF_YESNO, NULL, 0, &ConfigFileEntry.resv_fnc }, |
212380e3 AC |
2411 | { "connect_timeout", CF_TIME, NULL, 0, &ConfigFileEntry.connect_timeout }, |
2412 | { "default_floodcount", CF_INT, NULL, 0, &ConfigFileEntry.default_floodcount }, | |
944b0584 | 2413 | { "default_ident_timeout", CF_INT, NULL, 0, &ConfigFileEntry.default_ident_timeout }, |
212380e3 | 2414 | { "disable_auth", CF_YESNO, NULL, 0, &ConfigFileEntry.disable_auth }, |
212380e3 AC |
2415 | { "dots_in_ident", CF_INT, NULL, 0, &ConfigFileEntry.dots_in_ident }, |
2416 | { "failed_oper_notice", CF_YESNO, NULL, 0, &ConfigFileEntry.failed_oper_notice }, | |
212380e3 | 2417 | { "global_snotices", CF_YESNO, NULL, 0, &ConfigFileEntry.global_snotices }, |
212380e3 AC |
2418 | { "hide_spoof_ips", CF_YESNO, NULL, 0, &ConfigFileEntry.hide_spoof_ips }, |
2419 | { "dline_with_reason", CF_YESNO, NULL, 0, &ConfigFileEntry.dline_with_reason }, | |
2420 | { "kline_with_reason", CF_YESNO, NULL, 0, &ConfigFileEntry.kline_with_reason }, | |
2421 | { "map_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.map_oper_only }, | |
2422 | { "max_accept", CF_INT, NULL, 0, &ConfigFileEntry.max_accept }, | |
2423 | { "max_monitor", CF_INT, NULL, 0, &ConfigFileEntry.max_monitor }, | |
2424 | { "max_nick_time", CF_TIME, NULL, 0, &ConfigFileEntry.max_nick_time }, | |
2425 | { "max_nick_changes", CF_INT, NULL, 0, &ConfigFileEntry.max_nick_changes }, | |
2426 | { "max_targets", CF_INT, NULL, 0, &ConfigFileEntry.max_targets }, | |
2427 | { "min_nonwildcard", CF_INT, NULL, 0, &ConfigFileEntry.min_nonwildcard }, | |
2428 | { "nick_delay", CF_TIME, NULL, 0, &ConfigFileEntry.nick_delay }, | |
2429 | { "no_oper_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.no_oper_flood }, | |
2430 | { "operspy_admin_only", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_admin_only }, | |
2431 | { "operspy_dont_care_user_info", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_dont_care_user_info }, | |
2432 | { "pace_wait", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait }, | |
2433 | { "pace_wait_simple", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait_simple }, | |
2434 | { "ping_cookie", CF_YESNO, NULL, 0, &ConfigFileEntry.ping_cookie }, | |
2435 | { "reject_after_count", CF_INT, NULL, 0, &ConfigFileEntry.reject_after_count }, | |
2436 | { "reject_ban_time", CF_TIME, NULL, 0, &ConfigFileEntry.reject_ban_time }, | |
2437 | { "reject_duration", CF_TIME, NULL, 0, &ConfigFileEntry.reject_duration }, | |
43946961 JT |
2438 | { "throttle_count", CF_INT, NULL, 0, &ConfigFileEntry.throttle_count }, |
2439 | { "throttle_duration", CF_TIME, NULL, 0, &ConfigFileEntry.throttle_duration }, | |
212380e3 AC |
2440 | { "short_motd", CF_YESNO, NULL, 0, &ConfigFileEntry.short_motd }, |
2441 | { "stats_c_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_c_oper_only }, | |
2442 | { "stats_e_disabled", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_e_disabled }, | |
2443 | { "stats_h_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_h_oper_only }, | |
2444 | { "stats_o_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_o_oper_only }, | |
2445 | { "stats_P_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_P_oper_only }, | |
2446 | { "stats_y_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_y_oper_only }, | |
2447 | { "target_change", CF_YESNO, NULL, 0, &ConfigFileEntry.target_change }, | |
2448 | { "ts_max_delta", CF_TIME, NULL, 0, &ConfigFileEntry.ts_max_delta }, | |
212380e3 AC |
2449 | { "ts_warn_delta", CF_TIME, NULL, 0, &ConfigFileEntry.ts_warn_delta }, |
2450 | { "use_whois_actually", CF_YESNO, NULL, 0, &ConfigFileEntry.use_whois_actually }, | |
2451 | { "warn_no_nline", CF_YESNO, NULL, 0, &ConfigFileEntry.warn_no_nline }, | |
1702b694 | 2452 | { "use_propagated_bans",CF_YESNO, NULL, 0, &ConfigFileEntry.use_propagated_bans }, |
e6e54763 SB |
2453 | { "client_flood_max_lines", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_max_lines }, |
2454 | { "client_flood_burst_rate", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_burst_rate }, | |
2455 | { "client_flood_burst_max", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_burst_max }, | |
2456 | { "client_flood_message_num", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_num }, | |
2457 | { "client_flood_message_time", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_time }, | |
e88a1f1b | 2458 | { "max_ratelimit_tokens", CF_INT, NULL, 0, &ConfigFileEntry.max_ratelimit_tokens }, |
d42e6915 | 2459 | { "away_interval", CF_INT, NULL, 0, &ConfigFileEntry.away_interval }, |
71c95533 | 2460 | { "hide_opers_in_whois", CF_YESNO, NULL, 0, &ConfigFileEntry.hide_opers_in_whois }, |
13d8f0ed | 2461 | { "certfp_method", CF_STRING, conf_set_general_certfp_method, 0, NULL }, |
212380e3 AC |
2462 | { "\0", 0, NULL, 0, NULL } |
2463 | }; | |
2464 | ||
2465 | static struct ConfEntry conf_channel_table[] = | |
2466 | { | |
2467 | { "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count }, | |
2468 | { "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count }, | |
2469 | { "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho }, | |
212380e3 AC |
2470 | { "kick_on_split_riding", CF_YESNO, NULL, 0, &ConfigChannel.kick_on_split_riding }, |
2471 | { "knock_delay", CF_TIME, NULL, 0, &ConfigChannel.knock_delay }, | |
2472 | { "knock_delay_channel",CF_TIME, NULL, 0, &ConfigChannel.knock_delay_channel }, | |
2473 | { "max_bans", CF_INT, NULL, 0, &ConfigChannel.max_bans }, | |
2474 | { "max_bans_large", CF_INT, NULL, 0, &ConfigChannel.max_bans_large }, | |
2475 | { "max_chans_per_user", CF_INT, NULL, 0, &ConfigChannel.max_chans_per_user }, | |
a4721f5e | 2476 | { "max_chans_per_user_large", CF_INT, NULL, 0, &ConfigChannel.max_chans_per_user_large }, |
212380e3 AC |
2477 | { "no_create_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_create_on_split }, |
2478 | { "no_join_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_join_on_split }, | |
6865c0b0 | 2479 | { "only_ascii_channels", CF_YESNO, NULL, 0, &ConfigChannel.only_ascii_channels }, |
212380e3 AC |
2480 | { "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except }, |
2481 | { "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex }, | |
2da6f6eb | 2482 | { "use_forward", CF_YESNO, NULL, 0, &ConfigChannel.use_forward }, |
212380e3 | 2483 | { "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock }, |
c2c25552 | 2484 | { "resv_forcepart", CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart }, |
717238d2 | 2485 | { "channel_target_change", CF_YESNO, NULL, 0, &ConfigChannel.channel_target_change }, |
341f971e | 2486 | { "disable_local_channels", CF_YESNO, NULL, 0, &ConfigChannel.disable_local_channels }, |
63eb8567 | 2487 | { "autochanmodes", CF_QSTRING, conf_set_channel_autochanmodes, 0, NULL }, |
d513218a | 2488 | { "displayed_usercount", CF_INT, NULL, 0, &ConfigChannel.displayed_usercount }, |
14482679 | 2489 | { "strip_topic_colors", CF_YESNO, NULL, 0, &ConfigChannel.strip_topic_colors }, |
212380e3 AC |
2490 | { "\0", 0, NULL, 0, NULL } |
2491 | }; | |
2492 | ||
2493 | static struct ConfEntry conf_serverhide_table[] = | |
2494 | { | |
2495 | { "disable_hidden", CF_YESNO, NULL, 0, &ConfigServerHide.disable_hidden }, | |
2496 | { "flatten_links", CF_YESNO, NULL, 0, &ConfigServerHide.flatten_links }, | |
2497 | { "hidden", CF_YESNO, NULL, 0, &ConfigServerHide.hidden }, | |
2498 | { "links_delay", CF_TIME, conf_set_serverhide_links_delay, 0, NULL }, | |
2499 | { "\0", 0, NULL, 0, NULL } | |
2500 | }; | |
2501 | /* *INDENT-ON* */ | |
2502 | ||
2503 | void | |
2504 | newconf_init() | |
2505 | { | |
2506 | add_top_conf("modules", NULL, NULL, NULL); | |
2507 | add_conf_item("modules", "path", CF_QSTRING, conf_set_modules_path); | |
2508 | add_conf_item("modules", "module", CF_QSTRING, conf_set_modules_module); | |
2509 | ||
2510 | add_top_conf("serverinfo", NULL, NULL, conf_serverinfo_table); | |
2511 | add_top_conf("admin", NULL, NULL, conf_admin_table); | |
2512 | add_top_conf("log", NULL, NULL, conf_log_table); | |
2513 | add_top_conf("operator", conf_begin_oper, conf_end_oper, conf_operator_table); | |
2514 | add_top_conf("class", conf_begin_class, conf_end_class, conf_class_table); | |
f8606875 | 2515 | add_top_conf("privset", NULL, NULL, conf_privset_table); |
212380e3 AC |
2516 | |
2517 | add_top_conf("listen", conf_begin_listen, conf_end_listen, NULL); | |
02270e96 | 2518 | add_conf_item("listen", "defer_accept", CF_YESNO, conf_set_listen_defer_accept); |
212380e3 | 2519 | add_conf_item("listen", "port", CF_INT | CF_FLIST, conf_set_listen_port); |
c6d72037 | 2520 | add_conf_item("listen", "sslport", CF_INT | CF_FLIST, conf_set_listen_sslport); |
212380e3 AC |
2521 | add_conf_item("listen", "ip", CF_QSTRING, conf_set_listen_address); |
2522 | add_conf_item("listen", "host", CF_QSTRING, conf_set_listen_address); | |
2523 | ||
2524 | add_top_conf("auth", conf_begin_auth, conf_end_auth, conf_auth_table); | |
2525 | ||
2526 | add_top_conf("shared", conf_cleanup_shared, conf_cleanup_shared, NULL); | |
dceac3e4 | 2527 | add_conf_item("shared", "oper", CF_QSTRING | CF_FLIST, conf_set_shared_oper); |
212380e3 AC |
2528 | add_conf_item("shared", "flags", CF_STRING | CF_FLIST, conf_set_shared_flags); |
2529 | ||
2530 | add_top_conf("connect", conf_begin_connect, conf_end_connect, conf_connect_table); | |
2531 | ||
2532 | add_top_conf("exempt", NULL, NULL, NULL); | |
2533 | add_conf_item("exempt", "ip", CF_QSTRING, conf_set_exempt_ip); | |
2534 | ||
2535 | add_top_conf("cluster", conf_cleanup_cluster, conf_cleanup_cluster, NULL); | |
2536 | add_conf_item("cluster", "name", CF_QSTRING, conf_set_cluster_name); | |
2537 | add_conf_item("cluster", "flags", CF_STRING | CF_FLIST, conf_set_cluster_flags); | |
2538 | ||
2539 | add_top_conf("general", NULL, NULL, conf_general_table); | |
2540 | add_top_conf("channel", NULL, NULL, conf_channel_table); | |
2541 | add_top_conf("serverhide", NULL, NULL, conf_serverhide_table); | |
2542 | ||
c46a4ecd | 2543 | add_top_conf("service", NULL, NULL, NULL); |
212380e3 AC |
2544 | add_conf_item("service", "name", CF_QSTRING, conf_set_service_name); |
2545 | ||
2546 | add_top_conf("alias", conf_begin_alias, conf_end_alias, NULL); | |
2547 | add_conf_item("alias", "name", CF_QSTRING, conf_set_alias_name); | |
2548 | add_conf_item("alias", "target", CF_QSTRING, conf_set_alias_target); | |
2549 | ||
2550 | add_top_conf("blacklist", NULL, NULL, NULL); | |
2551 | add_conf_item("blacklist", "host", CF_QSTRING, conf_set_blacklist_host); | |
0a1e77c2 | 2552 | add_conf_item("blacklist", "type", CF_STRING | CF_FLIST, conf_set_blacklist_type); |
3c93d380 | 2553 | add_conf_item("blacklist", "matches", CF_QSTRING | CF_FLIST, conf_set_blacklist_matches); |
212380e3 AC |
2554 | add_conf_item("blacklist", "reject_reason", CF_QSTRING, conf_set_blacklist_reason); |
2555 | } |