1 /* This code is in the public domain.
2 * $Id: newconf.c 3550 2007-08-09 06:47:26Z nenolod $
8 #include <openssl/pem.h>
9 #include <openssl/rsa.h>
13 #include "ircd_defs.h"
18 #include "s_newconf.h"
29 #include "blacklist.h"
31 #include "privilege.h"
33 #define CF_TYPE(x) ((x) & CF_MTYPE)
35 static int yy_defer_accept
= 1;
37 struct TopConf
*conf_cur_block
;
38 static char *conf_cur_block_name
;
40 static rb_dlink_list conf_items
;
42 static struct ConfItem
*yy_aconf
= NULL
;
44 static struct Class
*yy_class
= NULL
;
46 static struct remote_conf
*yy_shared
= NULL
;
47 static struct server_conf
*yy_server
= NULL
;
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
;
53 static struct oper_conf
*yy_oper
= NULL
;
55 static struct alias_entry
*yy_alias
= NULL
;
57 static char *yy_blacklist_host
= NULL
;
58 static char *yy_blacklist_reason
= NULL
;
59 static int yy_blacklist_ipv4
= 1;
60 static int yy_blacklist_ipv6
= 0;
62 static char *yy_privset_extends
= NULL
;
65 conf_strtype(int type
)
67 switch (type
& CF_MTYPE
)
70 return "integer value";
72 return "unquoted string";
74 return "yes/no value";
76 return "quoted string";
78 return "time/size value";
80 return "unknown type";
85 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
86 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
90 tc
= rb_malloc(sizeof(struct TopConf
));
95 tc
->tc_entries
= items
;
97 rb_dlinkAddAlloc(tc
, &conf_items
);
102 find_top_conf(const char *name
)
107 RB_DLINK_FOREACH(d
, conf_items
.head
)
110 if(strcasecmp(tc
->tc_name
, name
) == 0)
119 find_conf_item(const struct TopConf
*top
, const char *name
)
121 struct ConfEntry
*cf
;
128 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
130 cf
= &top
->tc_entries
[i
];
132 if(!strcasecmp(cf
->cf_name
, name
))
137 RB_DLINK_FOREACH(d
, top
->tc_items
.head
)
140 if(strcasecmp(cf
->cf_name
, name
) == 0)
148 remove_top_conf(char *name
)
153 if((tc
= find_top_conf(name
)) == NULL
)
156 if((ptr
= rb_dlinkFind(tc
, &conf_items
)) == NULL
)
159 rb_dlinkDestroy(ptr
, &conf_items
);
166 conf_set_serverinfo_name(void *data
)
168 if(ServerInfo
.name
== NULL
)
173 for(s
= data
; *s
!= '\0'; s
++)
177 conf_report_error("Ignoring serverinfo::name "
178 "-- bogus servername.");
187 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
195 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
199 /* the ircd will exit() in main() if we dont set one */
200 if(strlen(s
) <= HOSTLEN
)
201 ServerInfo
.name
= rb_strdup((char *) data
);
206 conf_set_serverinfo_sid(void *data
)
210 if(ServerInfo
.sid
[0] == '\0')
212 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
213 !IsIdChar(sid
[2]) || sid
[3] != '\0')
215 conf_report_error("Ignoring serverinfo::sid "
220 strcpy(ServerInfo
.sid
, sid
);
225 conf_set_serverinfo_network_name(void *data
)
229 if((p
= strchr((char *) data
, ' ')))
232 rb_free(ServerInfo
.network_name
);
233 ServerInfo
.network_name
= rb_strdup((char *) data
);
237 conf_set_serverinfo_vhost(void *data
)
239 if(rb_inet_pton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
241 conf_report_error("Invalid netmask for server IPv4 vhost (%s)", (char *) data
);
244 ServerInfo
.ip
.sin_family
= AF_INET
;
245 ServerInfo
.specific_ipv4_vhost
= 1;
249 conf_set_serverinfo_vhost6(void *data
)
252 if(rb_inet_pton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
254 conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data
);
258 ServerInfo
.specific_ipv6_vhost
= 1;
259 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
261 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
266 conf_set_serverinfo_nicklen(void *data
)
268 ConfigFileEntry
.nicklen
= (*(unsigned int *) data
) + 1;
270 if (ConfigFileEntry
.nicklen
> NICKLEN
)
272 conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)",
273 ConfigFileEntry
.nicklen
- 1, NICKLEN
- 1);
274 ConfigFileEntry
.nicklen
= NICKLEN
;
276 else if (ConfigFileEntry
.nicklen
< 9 + 1)
278 conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9",
279 ConfigFileEntry
.nicklen
);
280 ConfigFileEntry
.nicklen
= 9 + 1;
285 conf_set_modules_module(void *data
)
287 #ifndef STATIC_MODULES
290 m_bn
= rb_basename((char *) data
);
292 if(findmodule_byname(m_bn
) != -1)
295 load_one_module((char *) data
, 0);
299 conf_report_error("Ignoring modules::module -- loadable module support not present.");
304 conf_set_modules_path(void *data
)
306 #ifndef STATIC_MODULES
307 mod_add_path((char *) data
);
309 conf_report_error("Ignoring modules::path -- loadable module support not present.");
320 static struct mode_table umode_table
[] = {
321 {"callerid", UMODE_CALLERID
},
322 {"deaf", UMODE_DEAF
},
323 {"invisible", UMODE_INVISIBLE
},
324 {"locops", UMODE_LOCOPS
},
325 {"noforward", UMODE_NOFORWARD
},
326 {"regonlymsg", UMODE_REGONLYMSG
},
327 {"servnotice", UMODE_SERVNOTICE
},
328 {"wallop", UMODE_WALLOP
},
329 {"operwall", UMODE_OPERWALL
},
333 static struct mode_table oper_table
[] = {
334 {"encrypted", OPER_ENCRYPTED
},
335 {"need_ssl", OPER_NEEDSSL
},
339 static struct mode_table auth_table
[] = {
340 {"encrypted", CONF_FLAGS_ENCRYPTED
},
341 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
342 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
343 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
344 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
345 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
346 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
347 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
348 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
349 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
350 {"no_tilde", CONF_FLAGS_NO_TILDE
},
351 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
352 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
353 {"need_ssl", CONF_FLAGS_NEED_SSL
},
354 {"need_sasl", CONF_FLAGS_NEED_SASL
},
358 static struct mode_table connect_table
[] = {
359 { "autoconn", SERVER_AUTOCONN
},
360 { "compressed", SERVER_COMPRESSED
},
361 { "encrypted", SERVER_ENCRYPTED
},
362 { "topicburst", SERVER_TB
},
363 { "ssl", SERVER_SSL
},
367 static struct mode_table cluster_table
[] = {
368 { "kline", SHARED_PKLINE
},
369 { "tkline", SHARED_TKLINE
},
370 { "unkline", SHARED_UNKLINE
},
371 { "locops", SHARED_LOCOPS
},
372 { "xline", SHARED_PXLINE
},
373 { "txline", SHARED_TXLINE
},
374 { "unxline", SHARED_UNXLINE
},
375 { "resv", SHARED_PRESV
},
376 { "tresv", SHARED_TRESV
},
377 { "unresv", SHARED_UNRESV
},
378 { "all", CLUSTER_ALL
},
382 static struct mode_table shared_table
[] =
384 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
385 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
386 { "resv", SHARED_PRESV
|SHARED_TRESV
},
387 { "dline", SHARED_PDLINE
|SHARED_TDLINE
},
388 { "tdline", SHARED_TDLINE
},
389 { "pdline", SHARED_PDLINE
},
390 { "undline", SHARED_UNDLINE
},
391 { "tkline", SHARED_TKLINE
},
392 { "unkline", SHARED_UNKLINE
},
393 { "txline", SHARED_TXLINE
},
394 { "unxline", SHARED_UNXLINE
},
395 { "tresv", SHARED_TRESV
},
396 { "unresv", SHARED_UNRESV
},
397 { "locops", SHARED_LOCOPS
},
398 { "rehash", SHARED_REHASH
},
399 { "all", SHARED_ALL
},
406 find_umode(struct mode_table
*tab
, const char *name
)
410 for (i
= 0; tab
[i
].name
; i
++)
412 if(strcmp(tab
[i
].name
, name
) == 0)
420 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
422 for (; args
; args
= args
->next
)
428 if((args
->type
& CF_MTYPE
) != CF_STRING
)
430 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
434 umode
= args
->v
.string
;
442 mode
= find_umode(tab
, umode
);
446 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
463 conf_set_privset_extends(void *data
)
465 yy_privset_extends
= rb_strdup((char *) data
);
469 conf_set_privset_privs(void *data
)
472 conf_parm_t
*args
= data
;
474 for (; args
; args
= args
->next
)
477 privs
= rb_strdup(args
->v
.string
);
480 char *privs_old
= privs
;
482 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
483 strcpy(privs
, privs_old
);
485 strcat(privs
, args
->v
.string
);
493 if (yy_privset_extends
)
495 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
499 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
501 set
= privilegeset_get("default");
504 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
506 rb_free(yy_privset_extends
);
507 yy_privset_extends
= NULL
;
510 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
517 conf_begin_oper(struct TopConf
*tc
)
520 rb_dlink_node
*next_ptr
;
524 free_oper_conf(yy_oper
);
528 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
530 free_oper_conf(ptr
->data
);
531 rb_dlinkDestroy(ptr
, &yy_oper_list
);
534 yy_oper
= make_oper_conf();
535 yy_oper
->flags
|= OPER_ENCRYPTED
;
541 conf_end_oper(struct TopConf
*tc
)
543 struct oper_conf
*yy_tmpoper
;
545 rb_dlink_node
*next_ptr
;
547 if(conf_cur_block_name
!= NULL
)
549 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
550 conf_cur_block_name
[OPERNICKLEN
] = '\0';
552 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
555 if(EmptyString(yy_oper
->name
))
557 conf_report_error("Ignoring operator block -- missing name.");
561 #ifdef HAVE_LIBCRYPTO
562 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
564 if(EmptyString(yy_oper
->passwd
))
567 conf_report_error("Ignoring operator block for %s -- missing password",
573 if (!yy_oper
->privset
)
574 yy_oper
->privset
= privilegeset_get("default");
576 /* now, yy_oper_list contains a stack of oper_conf's with just user
577 * and host in, yy_oper contains the rest of the information which
578 * we need to copy into each element in yy_oper_list
580 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
582 yy_tmpoper
= ptr
->data
;
584 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
586 /* could be an rsa key instead.. */
587 if(!EmptyString(yy_oper
->passwd
))
588 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
590 yy_tmpoper
->flags
= yy_oper
->flags
;
591 yy_tmpoper
->umodes
= yy_oper
->umodes
;
592 yy_tmpoper
->snomask
= yy_oper
->snomask
;
593 yy_tmpoper
->privset
= yy_oper
->privset
;
595 #ifdef HAVE_LIBCRYPTO
596 if(yy_oper
->rsa_pubkey_file
)
600 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
602 conf_report_error("Ignoring operator block for %s -- "
603 "rsa_public_key_file cant be opened",
608 yy_tmpoper
->rsa_pubkey
=
609 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
611 (void)BIO_set_close(file
, BIO_CLOSE
);
614 if(yy_tmpoper
->rsa_pubkey
== NULL
)
616 conf_report_error("Ignoring operator block for %s -- "
617 "rsa_public_key_file key invalid; check syntax",
623 if(!EmptyString(yy_oper
->certfp
))
624 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
627 /* all is ok, put it on oper_conf_list */
628 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
631 free_oper_conf(yy_oper
);
638 conf_set_oper_flags(void *data
)
640 conf_parm_t
*args
= data
;
642 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
646 conf_set_oper_fingerprint(void *data
)
649 rb_free(yy_oper
->certfp
);
650 yy_oper
->certfp
= rb_strdup((char *) data
);
654 conf_set_oper_privset(void *data
)
656 yy_oper
->privset
= privilegeset_get((char *) data
);
660 conf_set_oper_user(void *data
)
662 struct oper_conf
*yy_tmpoper
;
664 char *host
= (char *) data
;
666 yy_tmpoper
= make_oper_conf();
668 if((p
= strchr(host
, '@')))
672 yy_tmpoper
->username
= rb_strdup(host
);
673 yy_tmpoper
->host
= rb_strdup(p
);
678 yy_tmpoper
->username
= rb_strdup("*");
679 yy_tmpoper
->host
= rb_strdup(host
);
682 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
684 conf_report_error("Ignoring user -- missing username/host");
685 free_oper_conf(yy_tmpoper
);
689 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
693 conf_set_oper_password(void *data
)
697 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
698 rb_free(yy_oper
->passwd
);
701 yy_oper
->passwd
= rb_strdup((char *) data
);
705 conf_set_oper_rsa_public_key_file(void *data
)
707 #ifdef HAVE_LIBCRYPTO
708 rb_free(yy_oper
->rsa_pubkey_file
);
709 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
711 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
716 conf_set_oper_umodes(void *data
)
718 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
722 conf_set_oper_snomask(void *data
)
724 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
728 conf_begin_class(struct TopConf
*tc
)
731 free_class(yy_class
);
733 yy_class
= make_class();
738 conf_end_class(struct TopConf
*tc
)
740 if(conf_cur_block_name
!= NULL
)
741 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
743 if(EmptyString(yy_class
->class_name
))
745 conf_report_error("Ignoring connect block -- missing name.");
755 conf_set_class_ping_time(void *data
)
757 yy_class
->ping_freq
= *(unsigned int *) data
;
761 conf_set_class_cidr_ipv4_bitlen(void *data
)
763 unsigned int maxsize
= 32;
764 if(*(unsigned int *) data
> maxsize
)
766 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
767 *(unsigned int *) data
, maxsize
);
769 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
775 conf_set_class_cidr_ipv6_bitlen(void *data
)
777 unsigned int maxsize
= 128;
778 if(*(unsigned int *) data
> maxsize
)
780 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
781 *(unsigned int *) data
, maxsize
);
783 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
789 conf_set_class_number_per_cidr(void *data
)
791 yy_class
->cidr_amount
= *(unsigned int *) data
;
795 conf_set_class_number_per_ip(void *data
)
797 yy_class
->max_local
= *(unsigned int *) data
;
802 conf_set_class_number_per_ip_global(void *data
)
804 yy_class
->max_global
= *(unsigned int *) data
;
808 conf_set_class_number_per_ident(void *data
)
810 yy_class
->max_ident
= *(unsigned int *) data
;
814 conf_set_class_connectfreq(void *data
)
816 yy_class
->con_freq
= *(unsigned int *) data
;
820 conf_set_class_max_number(void *data
)
822 yy_class
->max_total
= *(unsigned int *) data
;
826 conf_set_class_sendq(void *data
)
828 yy_class
->max_sendq
= *(unsigned int *) data
;
831 static char *listener_address
;
834 conf_begin_listen(struct TopConf
*tc
)
836 rb_free(listener_address
);
837 listener_address
= NULL
;
842 conf_end_listen(struct TopConf
*tc
)
844 rb_free(listener_address
);
845 listener_address
= NULL
;
850 conf_set_listen_defer_accept(void *data
)
852 yy_defer_accept
= *(unsigned int *) data
;
856 conf_set_listen_port_both(void *data
, int ssl
)
858 conf_parm_t
*args
= data
;
859 for (; args
; args
= args
->next
)
861 if((args
->type
& CF_MTYPE
) != CF_INT
)
864 ("listener::port argument is not an integer " "-- ignoring.");
867 if(listener_address
== NULL
)
869 add_listener(args
->v
.number
, listener_address
, AF_INET
, ssl
, yy_defer_accept
);
871 add_listener(args
->v
.number
, listener_address
, AF_INET6
, ssl
, yy_defer_accept
);
878 if(strchr(listener_address
, ':') != NULL
)
884 add_listener(args
->v
.number
, listener_address
, family
, ssl
, yy_defer_accept
);
892 conf_set_listen_port(void *data
)
894 conf_set_listen_port_both(data
, 0);
898 conf_set_listen_sslport(void *data
)
900 conf_set_listen_port_both(data
, 1);
904 conf_set_listen_address(void *data
)
906 rb_free(listener_address
);
907 listener_address
= rb_strdup(data
);
911 conf_begin_auth(struct TopConf
*tc
)
914 rb_dlink_node
*next_ptr
;
919 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
921 free_conf(ptr
->data
);
922 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
925 yy_aconf
= make_conf();
926 yy_aconf
->status
= CONF_CLIENT
;
932 conf_end_auth(struct TopConf
*tc
)
934 struct ConfItem
*yy_tmp
, *found_conf
;
936 rb_dlink_node
*next_ptr
;
938 if(EmptyString(yy_aconf
->info
.name
))
939 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
941 /* didnt even get one ->host? */
942 if(EmptyString(yy_aconf
->host
))
944 conf_report_error("Ignoring auth block -- missing user@host");
948 /* so the stacking works in order.. */
949 collapse(yy_aconf
->user
);
950 collapse(yy_aconf
->host
);
951 conf_add_class_to_conf(yy_aconf
);
952 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
953 conf_report_error("Ignoring redundant auth block (after *@*)");
954 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
955 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
956 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
957 conf_report_error("Ignoring duplicate auth block for %s@%s",
958 yy_aconf
->user
, yy_aconf
->host
);
960 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
962 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
967 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
969 if(yy_aconf
->spasswd
)
970 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
972 /* this will always exist.. */
973 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
975 if(yy_aconf
->className
)
976 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
978 yy_tmp
->flags
= yy_aconf
->flags
;
979 yy_tmp
->port
= yy_aconf
->port
;
981 collapse(yy_tmp
->user
);
982 collapse(yy_tmp
->host
);
984 conf_add_class_to_conf(yy_tmp
);
986 if (find_exact_conf_by_address("*", CONF_CLIENT
, "*"))
987 conf_report_error("Ignoring redundant auth block (after *@*)");
988 else if (find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
))
989 conf_report_error("Ignoring duplicate auth block for %s@%s",
990 yy_tmp
->user
, yy_tmp
->host
);
992 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
993 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1001 conf_set_auth_user(void *data
)
1003 struct ConfItem
*yy_tmp
;
1006 /* The first user= line doesn't allocate a new conf */
1007 if(!EmptyString(yy_aconf
->host
))
1009 yy_tmp
= make_conf();
1010 yy_tmp
->status
= CONF_CLIENT
;
1015 if((p
= strchr(data
, '@')))
1019 yy_tmp
->user
= rb_strdup(data
);
1020 yy_tmp
->host
= rb_strdup(p
);
1024 yy_tmp
->user
= rb_strdup("*");
1025 yy_tmp
->host
= rb_strdup(data
);
1028 if(yy_aconf
!= yy_tmp
)
1029 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1033 conf_set_auth_auth_user(void *data
)
1035 if(yy_aconf
->spasswd
)
1036 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1037 rb_free(yy_aconf
->spasswd
);
1038 yy_aconf
->spasswd
= rb_strdup(data
);
1042 conf_set_auth_passwd(void *data
)
1044 if(yy_aconf
->passwd
)
1045 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1046 rb_free(yy_aconf
->passwd
);
1047 yy_aconf
->passwd
= rb_strdup(data
);
1051 conf_set_auth_spoof(void *data
)
1059 /* user@host spoof */
1060 if((p
= strchr(host
, '@')) != NULL
)
1066 if(EmptyString(user
))
1068 conf_report_error("Warning -- spoof ident empty.");
1072 if(strlen(user
) > USERLEN
)
1074 conf_report_error("Warning -- spoof ident length invalid.");
1078 if(!valid_username(user
))
1080 conf_report_error("Warning -- invalid spoof (ident).");
1084 /* this must be restored! */
1088 if(EmptyString(host
))
1090 conf_report_error("Warning -- spoof host empty.");
1094 if(strlen(host
) > HOSTLEN
)
1096 conf_report_error("Warning -- spoof host length invalid.");
1100 if(!valid_hostname(host
))
1102 conf_report_error("Warning -- invalid spoof (host).");
1106 rb_free(yy_aconf
->info
.name
);
1107 yy_aconf
->info
.name
= rb_strdup(data
);
1108 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1112 conf_set_auth_flags(void *data
)
1114 conf_parm_t
*args
= data
;
1116 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1120 conf_set_auth_redir_serv(void *data
)
1122 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1123 rb_free(yy_aconf
->info
.name
);
1124 yy_aconf
->info
.name
= rb_strdup(data
);
1128 conf_set_auth_redir_port(void *data
)
1130 int port
= *(unsigned int *) data
;
1132 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1133 yy_aconf
->port
= port
;
1137 conf_set_auth_class(void *data
)
1139 rb_free(yy_aconf
->className
);
1140 yy_aconf
->className
= rb_strdup(data
);
1143 /* ok, shared_oper handles the stacking, shared_flags handles adding
1144 * things.. so all we need to do when we start and end a shared block, is
1145 * clean up anything thats been left over.
1148 conf_cleanup_shared(struct TopConf
*tc
)
1150 rb_dlink_node
*ptr
, *next_ptr
;
1152 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1154 free_remote_conf(ptr
->data
);
1155 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1158 if(yy_shared
!= NULL
)
1160 free_remote_conf(yy_shared
);
1168 conf_set_shared_oper(void *data
)
1170 conf_parm_t
*args
= data
;
1171 const char *username
;
1174 if(yy_shared
!= NULL
)
1175 free_remote_conf(yy_shared
);
1177 yy_shared
= make_remote_conf();
1179 if(args
->next
!= NULL
)
1181 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1183 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1187 yy_shared
->server
= rb_strdup(args
->v
.string
);
1191 yy_shared
->server
= rb_strdup("*");
1193 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1195 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1199 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1201 conf_report_error("Ignoring shard::oper -- oper is not a user@host");
1205 username
= args
->v
.string
;
1209 yy_shared
->host
= rb_strdup("*");
1211 yy_shared
->host
= rb_strdup(p
);
1213 if(EmptyString(username
))
1214 yy_shared
->username
= rb_strdup("*");
1216 yy_shared
->username
= rb_strdup(username
);
1218 rb_dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1223 conf_set_shared_flags(void *data
)
1225 conf_parm_t
*args
= data
;
1227 rb_dlink_node
*ptr
, *next_ptr
;
1229 if(yy_shared
!= NULL
)
1230 free_remote_conf(yy_shared
);
1232 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1234 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1236 yy_shared
= ptr
->data
;
1238 yy_shared
->flags
= flags
;
1239 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1240 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1247 conf_begin_connect(struct TopConf
*tc
)
1250 free_server_conf(yy_server
);
1252 yy_server
= make_server_conf();
1253 yy_server
->port
= PORTNUM
;
1254 yy_server
->flags
|= SERVER_TB
;
1256 if(conf_cur_block_name
!= NULL
)
1257 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1263 conf_end_connect(struct TopConf
*tc
)
1265 if(EmptyString(yy_server
->name
))
1267 conf_report_error("Ignoring connect block -- missing name.");
1271 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1273 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1278 if((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
)) && EmptyString(yy_server
->certfp
))
1280 conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
1285 if(EmptyString(yy_server
->host
))
1287 conf_report_error("Ignoring connect block for %s -- missing host.",
1293 if(ServerConfCompressed(yy_server
))
1295 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1296 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1300 add_server_conf(yy_server
);
1301 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1308 conf_set_connect_host(void *data
)
1310 rb_free(yy_server
->host
);
1311 yy_server
->host
= rb_strdup(data
);
1312 if (strchr(yy_server
->host
, ':'))
1313 yy_server
->aftype
= AF_INET6
;
1317 conf_set_connect_vhost(void *data
)
1319 if(rb_inet_pton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1321 conf_report_error("Invalid netmask for server vhost (%s)",
1326 yy_server
->flags
|= SERVER_VHOSTED
;
1330 conf_set_connect_send_password(void *data
)
1332 if(yy_server
->spasswd
)
1334 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1335 rb_free(yy_server
->spasswd
);
1338 yy_server
->spasswd
= rb_strdup(data
);
1342 conf_set_connect_accept_password(void *data
)
1344 if(yy_server
->passwd
)
1346 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1347 rb_free(yy_server
->passwd
);
1349 yy_server
->passwd
= rb_strdup(data
);
1353 conf_set_connect_fingerprint(void *data
)
1355 if (yy_server
->certfp
)
1356 rb_free(yy_server
->certfp
);
1357 yy_server
->certfp
= rb_strdup((char *) data
);
1359 /* force SSL to be enabled if fingerprint is enabled. */
1360 yy_server
->flags
|= SERVER_SSL
;
1364 conf_set_connect_port(void *data
)
1366 int port
= *(unsigned int *) data
;
1371 yy_server
->port
= port
;
1375 conf_set_connect_aftype(void *data
)
1379 if(strcasecmp(aft
, "ipv4") == 0)
1380 yy_server
->aftype
= AF_INET
;
1382 else if(strcasecmp(aft
, "ipv6") == 0)
1383 yy_server
->aftype
= AF_INET6
;
1386 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1390 conf_set_connect_flags(void *data
)
1392 conf_parm_t
*args
= data
;
1394 /* note, we allow them to set compressed, then remove it later if
1395 * they do and LIBZ isnt available
1397 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1401 conf_set_connect_hub_mask(void *data
)
1403 struct remote_conf
*yy_hub
;
1405 if(EmptyString(yy_server
->name
))
1408 yy_hub
= make_remote_conf();
1409 yy_hub
->flags
= CONF_HUB
;
1411 yy_hub
->host
= rb_strdup(data
);
1412 yy_hub
->server
= rb_strdup(yy_server
->name
);
1413 rb_dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1417 conf_set_connect_leaf_mask(void *data
)
1419 struct remote_conf
*yy_leaf
;
1421 if(EmptyString(yy_server
->name
))
1424 yy_leaf
= make_remote_conf();
1425 yy_leaf
->flags
= CONF_LEAF
;
1427 yy_leaf
->host
= rb_strdup(data
);
1428 yy_leaf
->server
= rb_strdup(yy_server
->name
);
1429 rb_dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1433 conf_set_connect_class(void *data
)
1435 rb_free(yy_server
->class_name
);
1436 yy_server
->class_name
= rb_strdup(data
);
1440 conf_set_exempt_ip(void *data
)
1442 struct ConfItem
*yy_tmp
;
1444 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1446 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1450 yy_tmp
= make_conf();
1451 yy_tmp
->passwd
= rb_strdup("*");
1452 yy_tmp
->host
= rb_strdup(data
);
1453 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1454 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1458 conf_cleanup_cluster(struct TopConf
*tc
)
1460 rb_dlink_node
*ptr
, *next_ptr
;
1462 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1464 free_remote_conf(ptr
->data
);
1465 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1468 if(yy_shared
!= NULL
)
1470 free_remote_conf(yy_shared
);
1478 conf_set_cluster_name(void *data
)
1480 if(yy_shared
!= NULL
)
1481 free_remote_conf(yy_shared
);
1483 yy_shared
= make_remote_conf();
1484 yy_shared
->server
= rb_strdup(data
);
1485 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1491 conf_set_cluster_flags(void *data
)
1493 conf_parm_t
*args
= data
;
1495 rb_dlink_node
*ptr
, *next_ptr
;
1497 if(yy_shared
!= NULL
)
1498 free_remote_conf(yy_shared
);
1500 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1502 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1504 yy_shared
= ptr
->data
;
1505 yy_shared
->flags
= flags
;
1506 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1507 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1514 conf_set_general_havent_read_conf(void *data
)
1516 if(*(unsigned int *) data
)
1518 conf_report_error("You haven't read your config file properly.");
1520 ("There is a line in the example conf that will kill your server if not removed.");
1522 ("Consider actually reading/editing the conf file, and removing this line.");
1529 conf_set_general_hide_error_messages(void *data
)
1533 if(strcasecmp(val
, "yes") == 0)
1534 ConfigFileEntry
.hide_error_messages
= 2;
1535 else if(strcasecmp(val
, "opers") == 0)
1536 ConfigFileEntry
.hide_error_messages
= 1;
1537 else if(strcasecmp(val
, "no") == 0)
1538 ConfigFileEntry
.hide_error_messages
= 0;
1540 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1544 conf_set_general_kline_delay(void *data
)
1546 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1548 /* THIS MUST BE HERE to stop us being unable to check klines */
1553 conf_set_general_stats_k_oper_only(void *data
)
1557 if(strcasecmp(val
, "yes") == 0)
1558 ConfigFileEntry
.stats_k_oper_only
= 2;
1559 else if(strcasecmp(val
, "masked") == 0)
1560 ConfigFileEntry
.stats_k_oper_only
= 1;
1561 else if(strcasecmp(val
, "no") == 0)
1562 ConfigFileEntry
.stats_k_oper_only
= 0;
1564 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1568 conf_set_general_stats_i_oper_only(void *data
)
1572 if(strcasecmp(val
, "yes") == 0)
1573 ConfigFileEntry
.stats_i_oper_only
= 2;
1574 else if(strcasecmp(val
, "masked") == 0)
1575 ConfigFileEntry
.stats_i_oper_only
= 1;
1576 else if(strcasecmp(val
, "no") == 0)
1577 ConfigFileEntry
.stats_i_oper_only
= 0;
1579 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1583 conf_set_general_compression_level(void *data
)
1586 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1588 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1591 ("Invalid general::compression_level %d -- using default.",
1592 ConfigFileEntry
.compression_level
);
1593 ConfigFileEntry
.compression_level
= 0;
1596 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1601 conf_set_general_default_umodes(void *data
)
1604 int what
= MODE_ADD
, flag
;
1606 ConfigFileEntry
.default_umodes
= 0;
1607 for (pm
= (char *) data
; *pm
; pm
++)
1618 /* don't allow +o */
1626 if ((flag
= user_modes
[(unsigned char) *pm
]))
1628 /* Proper value has probably not yet been set
1629 * so don't check oper_only_umodes -- jilles */
1630 if (what
== MODE_ADD
)
1631 ConfigFileEntry
.default_umodes
|= flag
;
1633 ConfigFileEntry
.default_umodes
&= ~flag
;
1641 conf_set_general_oper_umodes(void *data
)
1643 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1647 conf_set_general_oper_only_umodes(void *data
)
1649 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1653 conf_set_general_oper_snomask(void *data
)
1656 int what
= MODE_ADD
, flag
;
1658 ConfigFileEntry
.oper_snomask
= 0;
1659 for (pm
= (char *) data
; *pm
; pm
++)
1671 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1673 if (what
== MODE_ADD
)
1674 ConfigFileEntry
.oper_snomask
|= flag
;
1676 ConfigFileEntry
.oper_snomask
&= ~flag
;
1684 conf_set_serverhide_links_delay(void *data
)
1686 int val
= *(unsigned int *) data
;
1688 ConfigServerHide
.links_delay
= val
;
1692 conf_begin_service(struct TopConf
*tc
)
1694 struct Client
*target_p
;
1697 RB_DLINK_FOREACH(ptr
, global_serv_list
.head
)
1699 target_p
= ptr
->data
;
1701 target_p
->flags
&= ~FLAGS_SERVICE
;
1708 conf_set_service_name(void *data
)
1710 struct Client
*target_p
;
1715 for(s
= data
; *s
!= '\0'; s
++)
1719 conf_report_error("Ignoring service::name "
1720 "-- bogus servername.");
1729 conf_report_error("Ignoring service::name -- must contain '.'");
1733 tmp
= rb_strdup(data
);
1734 rb_dlinkAddAlloc(tmp
, &service_list
);
1736 if((target_p
= find_server(NULL
, tmp
)))
1737 target_p
->flags
|= FLAGS_SERVICE
;
1741 conf_begin_alias(struct TopConf
*tc
)
1743 yy_alias
= rb_malloc(sizeof(struct alias_entry
));
1745 if (conf_cur_block_name
!= NULL
)
1746 yy_alias
->name
= rb_strdup(conf_cur_block_name
);
1748 yy_alias
->flags
= 0;
1755 conf_end_alias(struct TopConf
*tc
)
1757 if (yy_alias
== NULL
)
1760 if (yy_alias
->name
== NULL
)
1762 conf_report_error("Ignoring alias -- must have a name.");
1769 if (yy_alias
->target
== NULL
)
1771 conf_report_error("Ignoring alias -- must have a target.");
1778 irc_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1784 conf_set_alias_name(void *data
)
1786 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1789 yy_alias
->name
= rb_strdup(data
);
1793 conf_set_alias_target(void *data
)
1795 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1798 yy_alias
->target
= rb_strdup(data
);
1802 conf_set_blacklist_host(void *data
)
1804 yy_blacklist_host
= rb_strdup(data
);
1808 conf_set_blacklist_type(void *data
)
1810 conf_parm_t
*args
= data
;
1812 /* Don't assume we have either if we got here */
1813 yy_blacklist_ipv4
= 0;
1814 yy_blacklist_ipv6
= 0;
1816 for (; args
; args
= args
->next
)
1818 if (!strcasecmp(args
->v
.string
, "ipv4"))
1819 yy_blacklist_ipv4
= 1;
1820 else if (!strcasecmp(args
->v
.string
, "ipv6"))
1821 yy_blacklist_ipv6
= 1;
1823 conf_report_error("blacklist::type has unknown address family %s",
1827 /* If we have neither, just default to IPv4 */
1828 if (!yy_blacklist_ipv4
&& !yy_blacklist_ipv6
)
1830 conf_report_error("blacklist::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
1831 yy_blacklist_ipv4
= 1;
1836 conf_set_blacklist_reason(void *data
)
1838 yy_blacklist_reason
= rb_strdup(data
);
1840 if (yy_blacklist_host
&& yy_blacklist_reason
)
1842 if (yy_blacklist_ipv6
)
1844 /* Make sure things fit (64 = alnum count + dots) */
1845 if ((64 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1847 conf_report_error("blacklist::host %s results in IPv6 queries that are too long",
1852 /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
1853 if (yy_blacklist_ipv4
&& !yy_blacklist_ipv6
)
1855 /* Make sure things fit (16 = number of nums + dots) */
1856 if ((16 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1858 conf_report_error("blacklist::host %s results in IPv4 queries that are too long",
1864 new_blacklist(yy_blacklist_host
, yy_blacklist_reason
, yy_blacklist_ipv4
, yy_blacklist_ipv6
);
1867 rb_free(yy_blacklist_host
);
1868 rb_free(yy_blacklist_reason
);
1869 yy_blacklist_host
= NULL
;
1870 yy_blacklist_reason
= NULL
;
1871 yy_blacklist_ipv4
= 1;
1872 yy_blacklist_ipv6
= 0;
1876 /* public functions */
1880 conf_report_error(const char *fmt
, ...)
1883 char msg
[IRCD_BUFSIZE
+ 1] = { 0 };
1886 rb_vsnprintf(msg
, IRCD_BUFSIZE
, fmt
, ap
);
1891 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
1895 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1896 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1900 conf_start_block(char *block
, char *name
)
1902 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
1904 conf_report_error("Configuration block '%s' is not defined.", block
);
1909 conf_cur_block_name
= rb_strdup(name
);
1911 conf_cur_block_name
= NULL
;
1913 if(conf_cur_block
->tc_sfunc
)
1914 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
1921 conf_end_block(struct TopConf
*tc
)
1924 return tc
->tc_efunc(tc
);
1926 rb_free(conf_cur_block_name
);
1931 conf_set_generic_int(void *data
, void *location
)
1933 *((int *) location
) = *((unsigned int *) data
);
1937 conf_set_generic_string(void *data
, int len
, void *location
)
1939 char **loc
= location
;
1942 if(len
&& strlen(input
) > (unsigned int)len
)
1946 *loc
= rb_strdup(input
);
1950 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
, int type
)
1952 struct ConfEntry
*cf
;
1958 if((cf
= find_conf_item(tc
, item
)) == NULL
)
1961 ("Non-existant configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
1965 /* if it takes one thing, make sure they only passed one thing,
1966 and handle as needed. */
1967 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
1970 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
1977 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
1979 /* if it expects a string value, but we got a yesno,
1982 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
1983 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
1985 value
->v
.list
->type
= CF_STRING
;
1987 if(cp
->v
.number
== 1)
1988 cp
->v
.string
= rb_strdup("yes");
1990 cp
->v
.string
= rb_strdup("no");
1993 /* maybe it's a CF_TIME and they passed CF_INT --
1994 should still be valid */
1995 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
1996 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
1999 ("Wrong type for %s::%s (expected %s, got %s)",
2000 tc
->tc_name
, (char *) item
,
2001 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
2006 if(cf
->cf_type
& CF_FLIST
)
2010 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
2013 /* just pass it the extended argument list */
2014 cf
->cf_func(value
->v
.list
);
2018 /* it's old-style, needs only one arg */
2019 switch (cf
->cf_type
)
2025 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2027 cf
->cf_func(&cp
->v
.number
);
2031 if(EmptyString(cp
->v
.string
))
2032 conf_report_error("Ignoring %s::%s -- empty field",
2035 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2037 cf
->cf_func(cp
->v
.string
);
2047 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2050 struct ConfEntry
*cf
;
2052 if((tc
= find_top_conf(topconf
)) == NULL
)
2055 if((cf
= find_conf_item(tc
, name
)) != NULL
)
2058 cf
= rb_malloc(sizeof(struct ConfEntry
));
2065 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2071 remove_conf_item(const char *topconf
, const char *name
)
2074 struct ConfEntry
*cf
;
2077 if((tc
= find_top_conf(topconf
)) == NULL
)
2080 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2083 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2086 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2093 static struct ConfEntry conf_serverinfo_table
[] =
2095 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2096 { "network_desc", CF_QSTRING
, NULL
, 0, &ServerInfo
.network_desc
},
2097 { "hub", CF_YESNO
, NULL
, 0, &ServerInfo
.hub
},
2099 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2100 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2101 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2102 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2103 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2105 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2106 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2107 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2108 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2109 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2111 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2113 { "nicklen", CF_INT
, conf_set_serverinfo_nicklen
, 0, NULL
},
2115 { "\0", 0, NULL
, 0, NULL
}
2118 static struct ConfEntry conf_admin_table
[] =
2120 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2121 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2122 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2123 { "\0", 0, NULL
, 0, NULL
}
2126 static struct ConfEntry conf_log_table
[] =
2128 { "fname_userlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_userlog
},
2129 { "fname_fuserlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_fuserlog
},
2130 { "fname_operlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operlog
},
2131 { "fname_foperlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_foperlog
},
2132 { "fname_serverlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_serverlog
},
2133 { "fname_killlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_killlog
},
2134 { "fname_klinelog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_klinelog
},
2135 { "fname_operspylog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operspylog
},
2136 { "fname_ioerrorlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_ioerrorlog
},
2137 { "\0", 0, NULL
, 0, NULL
}
2140 static struct ConfEntry conf_operator_table
[] =
2142 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2143 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2144 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2145 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2146 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2147 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2148 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2149 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2150 { "\0", 0, NULL
, 0, NULL
}
2153 static struct ConfEntry conf_privset_table
[] =
2155 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2156 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2157 { "\0", 0, NULL
, 0, NULL
}
2160 static struct ConfEntry conf_class_table
[] =
2162 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2163 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2165 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2167 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2168 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2169 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2170 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2171 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2172 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2173 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2174 { "\0", 0, NULL
, 0, NULL
}
2177 static struct ConfEntry conf_auth_table
[] =
2179 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2180 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2181 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2182 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2183 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2184 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2185 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2186 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2187 { "\0", 0, NULL
, 0, NULL
}
2190 static struct ConfEntry conf_connect_table
[] =
2192 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2193 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2194 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2195 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2196 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2197 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2198 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2199 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2200 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
2201 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
2202 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2203 { "\0", 0, NULL
, 0, NULL
}
2206 static struct ConfEntry conf_general_table
[] =
2208 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2209 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2210 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2211 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
2212 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2213 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2214 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
2215 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2216 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2217 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2219 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2220 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2221 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2222 { "egdpool_path", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.egdpool_path
},
2223 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2224 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2225 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2227 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2228 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2229 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2230 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2231 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2233 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2234 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2235 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2236 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2237 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2238 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2239 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2240 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2241 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2242 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2243 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2244 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2245 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2246 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2247 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2248 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2249 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2250 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2251 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2252 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2253 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2254 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2255 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2256 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2257 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2258 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2259 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2260 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2261 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2262 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2263 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2264 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2265 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2266 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2267 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2268 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2269 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2270 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2271 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2272 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2273 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2274 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2275 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2276 { "use_egd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_egd
},
2277 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2278 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2279 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2280 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2281 { "client_flood_max_lines", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_max_lines
},
2282 { "client_flood_burst_rate", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_rate
},
2283 { "client_flood_burst_max", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_max
},
2284 { "client_flood_message_num", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_num
},
2285 { "client_flood_message_time", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_time
},
2286 { "max_ratelimit_tokens", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_ratelimit_tokens
},
2287 { "away_interval", CF_INT
, NULL
, 0, &ConfigFileEntry
.away_interval
},
2288 { "\0", 0, NULL
, 0, NULL
}
2291 static struct ConfEntry conf_channel_table
[] =
2293 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2294 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2295 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2296 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2297 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2298 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2299 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2300 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2301 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2302 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2303 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2304 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2305 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2306 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2307 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2308 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2309 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2310 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2311 { "disable_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.disable_local_channels
},
2312 { "\0", 0, NULL
, 0, NULL
}
2315 static struct ConfEntry conf_serverhide_table
[] =
2317 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2318 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2319 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2320 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2321 { "\0", 0, NULL
, 0, NULL
}
2328 add_top_conf("modules", NULL
, NULL
, NULL
);
2329 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2330 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2332 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2333 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2334 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2335 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2336 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2337 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2339 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2340 add_conf_item("listen", "defer_accept", CF_YESNO
, conf_set_listen_defer_accept
);
2341 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2342 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2343 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2344 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2346 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2348 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
2349 add_conf_item("shared", "oper", CF_QSTRING
|CF_FLIST
, conf_set_shared_oper
);
2350 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
2352 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2354 add_top_conf("exempt", NULL
, NULL
, NULL
);
2355 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2357 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2358 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2359 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2361 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2362 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2363 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2365 add_top_conf("service", conf_begin_service
, NULL
, NULL
);
2366 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2368 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2369 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2370 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2372 add_top_conf("blacklist", NULL
, NULL
, NULL
);
2373 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_blacklist_host
);
2374 add_conf_item("blacklist", "type", CF_STRING
| CF_FLIST
, conf_set_blacklist_type
);
2375 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_blacklist_reason
);