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;
61 static rb_dlink_list yy_blacklist_filters
;
63 static char *yy_privset_extends
= NULL
;
66 conf_strtype(int type
)
68 switch (type
& CF_MTYPE
)
71 return "integer value";
73 return "unquoted string";
75 return "yes/no value";
77 return "quoted string";
79 return "time/size value";
81 return "unknown type";
86 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
87 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
91 tc
= rb_malloc(sizeof(struct TopConf
));
96 tc
->tc_entries
= items
;
98 rb_dlinkAddAlloc(tc
, &conf_items
);
103 find_top_conf(const char *name
)
108 RB_DLINK_FOREACH(d
, conf_items
.head
)
111 if(strcasecmp(tc
->tc_name
, name
) == 0)
120 find_conf_item(const struct TopConf
*top
, const char *name
)
122 struct ConfEntry
*cf
;
129 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
131 cf
= &top
->tc_entries
[i
];
133 if(!strcasecmp(cf
->cf_name
, name
))
138 RB_DLINK_FOREACH(d
, top
->tc_items
.head
)
141 if(strcasecmp(cf
->cf_name
, name
) == 0)
149 remove_top_conf(char *name
)
154 if((tc
= find_top_conf(name
)) == NULL
)
157 if((ptr
= rb_dlinkFind(tc
, &conf_items
)) == NULL
)
160 rb_dlinkDestroy(ptr
, &conf_items
);
167 conf_set_serverinfo_name(void *data
)
169 if(ServerInfo
.name
== NULL
)
174 for(s
= data
; *s
!= '\0'; s
++)
178 conf_report_error("Ignoring serverinfo::name "
179 "-- bogus servername.");
188 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
196 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
200 /* the ircd will exit() in main() if we dont set one */
201 if(strlen(s
) <= HOSTLEN
)
202 ServerInfo
.name
= rb_strdup((char *) data
);
207 conf_set_serverinfo_sid(void *data
)
211 if(ServerInfo
.sid
[0] == '\0')
213 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
214 !IsIdChar(sid
[2]) || sid
[3] != '\0')
216 conf_report_error("Ignoring serverinfo::sid "
221 strcpy(ServerInfo
.sid
, sid
);
226 conf_set_serverinfo_network_name(void *data
)
230 if((p
= strchr((char *) data
, ' ')))
233 rb_free(ServerInfo
.network_name
);
234 ServerInfo
.network_name
= rb_strdup((char *) data
);
238 conf_set_serverinfo_vhost(void *data
)
240 if(rb_inet_pton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
242 conf_report_error("Invalid netmask for server IPv4 vhost (%s)", (char *) data
);
245 ServerInfo
.ip
.sin_family
= AF_INET
;
246 ServerInfo
.specific_ipv4_vhost
= 1;
250 conf_set_serverinfo_vhost6(void *data
)
253 if(rb_inet_pton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
255 conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data
);
259 ServerInfo
.specific_ipv6_vhost
= 1;
260 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
262 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
267 conf_set_serverinfo_nicklen(void *data
)
269 ConfigFileEntry
.nicklen
= (*(unsigned int *) data
) + 1;
271 if (ConfigFileEntry
.nicklen
> NICKLEN
)
273 conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)",
274 ConfigFileEntry
.nicklen
- 1, NICKLEN
- 1);
275 ConfigFileEntry
.nicklen
= NICKLEN
;
277 else if (ConfigFileEntry
.nicklen
< 9 + 1)
279 conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9",
280 ConfigFileEntry
.nicklen
);
281 ConfigFileEntry
.nicklen
= 9 + 1;
286 conf_set_modules_module(void *data
)
288 #ifndef STATIC_MODULES
291 m_bn
= rb_basename((char *) data
);
293 if(findmodule_byname(m_bn
) != -1)
296 load_one_module((char *) data
, 0);
300 conf_report_error("Ignoring modules::module -- loadable module support not present.");
305 conf_set_modules_path(void *data
)
307 #ifndef STATIC_MODULES
308 mod_add_path((char *) data
);
310 conf_report_error("Ignoring modules::path -- loadable module support not present.");
321 static struct mode_table umode_table
[] = {
322 {"callerid", UMODE_CALLERID
},
323 {"deaf", UMODE_DEAF
},
324 {"invisible", UMODE_INVISIBLE
},
325 {"locops", UMODE_LOCOPS
},
326 {"noforward", UMODE_NOFORWARD
},
327 {"regonlymsg", UMODE_REGONLYMSG
},
328 {"servnotice", UMODE_SERVNOTICE
},
329 {"wallop", UMODE_WALLOP
},
330 {"operwall", UMODE_OPERWALL
},
334 static struct mode_table oper_table
[] = {
335 {"encrypted", OPER_ENCRYPTED
},
336 {"need_ssl", OPER_NEEDSSL
},
340 static struct mode_table auth_table
[] = {
341 {"encrypted", CONF_FLAGS_ENCRYPTED
},
342 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
343 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
344 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
345 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
346 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
347 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
348 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
349 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
350 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
351 {"no_tilde", CONF_FLAGS_NO_TILDE
},
352 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
353 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
354 {"need_ssl", CONF_FLAGS_NEED_SSL
},
355 {"need_sasl", CONF_FLAGS_NEED_SASL
},
359 static struct mode_table connect_table
[] = {
360 { "autoconn", SERVER_AUTOCONN
},
361 { "compressed", SERVER_COMPRESSED
},
362 { "encrypted", SERVER_ENCRYPTED
},
363 { "topicburst", SERVER_TB
},
364 { "ssl", SERVER_SSL
},
368 static struct mode_table cluster_table
[] = {
369 { "kline", SHARED_PKLINE
},
370 { "tkline", SHARED_TKLINE
},
371 { "unkline", SHARED_UNKLINE
},
372 { "locops", SHARED_LOCOPS
},
373 { "xline", SHARED_PXLINE
},
374 { "txline", SHARED_TXLINE
},
375 { "unxline", SHARED_UNXLINE
},
376 { "resv", SHARED_PRESV
},
377 { "tresv", SHARED_TRESV
},
378 { "unresv", SHARED_UNRESV
},
379 { "all", CLUSTER_ALL
},
383 static struct mode_table shared_table
[] =
385 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
386 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
387 { "resv", SHARED_PRESV
|SHARED_TRESV
},
388 { "dline", SHARED_PDLINE
|SHARED_TDLINE
},
389 { "tdline", SHARED_TDLINE
},
390 { "pdline", SHARED_PDLINE
},
391 { "undline", SHARED_UNDLINE
},
392 { "tkline", SHARED_TKLINE
},
393 { "unkline", SHARED_UNKLINE
},
394 { "txline", SHARED_TXLINE
},
395 { "unxline", SHARED_UNXLINE
},
396 { "tresv", SHARED_TRESV
},
397 { "unresv", SHARED_UNRESV
},
398 { "locops", SHARED_LOCOPS
},
399 { "rehash", SHARED_REHASH
},
400 { "all", SHARED_ALL
},
407 find_umode(struct mode_table
*tab
, const char *name
)
411 for (i
= 0; tab
[i
].name
; i
++)
413 if(strcmp(tab
[i
].name
, name
) == 0)
421 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
423 for (; args
; args
= args
->next
)
429 if((args
->type
& CF_MTYPE
) != CF_STRING
)
431 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
435 umode
= args
->v
.string
;
443 mode
= find_umode(tab
, umode
);
447 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
464 conf_set_privset_extends(void *data
)
466 yy_privset_extends
= rb_strdup((char *) data
);
470 conf_set_privset_privs(void *data
)
473 conf_parm_t
*args
= data
;
475 for (; args
; args
= args
->next
)
478 privs
= rb_strdup(args
->v
.string
);
481 char *privs_old
= privs
;
483 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
484 strcpy(privs
, privs_old
);
486 strcat(privs
, args
->v
.string
);
494 if (yy_privset_extends
)
496 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
500 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
502 set
= privilegeset_get("default");
505 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
507 rb_free(yy_privset_extends
);
508 yy_privset_extends
= NULL
;
511 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
518 conf_begin_oper(struct TopConf
*tc
)
521 rb_dlink_node
*next_ptr
;
525 free_oper_conf(yy_oper
);
529 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
531 free_oper_conf(ptr
->data
);
532 rb_dlinkDestroy(ptr
, &yy_oper_list
);
535 yy_oper
= make_oper_conf();
536 yy_oper
->flags
|= OPER_ENCRYPTED
;
542 conf_end_oper(struct TopConf
*tc
)
544 struct oper_conf
*yy_tmpoper
;
546 rb_dlink_node
*next_ptr
;
548 if(conf_cur_block_name
!= NULL
)
550 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
551 conf_cur_block_name
[OPERNICKLEN
] = '\0';
553 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
556 if(EmptyString(yy_oper
->name
))
558 conf_report_error("Ignoring operator block -- missing name.");
562 #ifdef HAVE_LIBCRYPTO
563 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
565 if(EmptyString(yy_oper
->passwd
))
568 conf_report_error("Ignoring operator block for %s -- missing password",
574 if (!yy_oper
->privset
)
575 yy_oper
->privset
= privilegeset_get("default");
577 /* now, yy_oper_list contains a stack of oper_conf's with just user
578 * and host in, yy_oper contains the rest of the information which
579 * we need to copy into each element in yy_oper_list
581 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
583 yy_tmpoper
= ptr
->data
;
585 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
587 /* could be an rsa key instead.. */
588 if(!EmptyString(yy_oper
->passwd
))
589 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
591 yy_tmpoper
->flags
= yy_oper
->flags
;
592 yy_tmpoper
->umodes
= yy_oper
->umodes
;
593 yy_tmpoper
->snomask
= yy_oper
->snomask
;
594 yy_tmpoper
->privset
= yy_oper
->privset
;
596 #ifdef HAVE_LIBCRYPTO
597 if(yy_oper
->rsa_pubkey_file
)
601 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
603 conf_report_error("Ignoring operator block for %s -- "
604 "rsa_public_key_file cant be opened",
609 yy_tmpoper
->rsa_pubkey
=
610 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
612 (void)BIO_set_close(file
, BIO_CLOSE
);
615 if(yy_tmpoper
->rsa_pubkey
== NULL
)
617 conf_report_error("Ignoring operator block for %s -- "
618 "rsa_public_key_file key invalid; check syntax",
624 if(!EmptyString(yy_oper
->certfp
))
625 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
628 /* all is ok, put it on oper_conf_list */
629 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
632 free_oper_conf(yy_oper
);
639 conf_set_oper_flags(void *data
)
641 conf_parm_t
*args
= data
;
643 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
647 conf_set_oper_fingerprint(void *data
)
650 rb_free(yy_oper
->certfp
);
651 yy_oper
->certfp
= rb_strdup((char *) data
);
655 conf_set_oper_privset(void *data
)
657 yy_oper
->privset
= privilegeset_get((char *) data
);
661 conf_set_oper_user(void *data
)
663 struct oper_conf
*yy_tmpoper
;
665 char *host
= (char *) data
;
667 yy_tmpoper
= make_oper_conf();
669 if((p
= strchr(host
, '@')))
673 yy_tmpoper
->username
= rb_strdup(host
);
674 yy_tmpoper
->host
= rb_strdup(p
);
679 yy_tmpoper
->username
= rb_strdup("*");
680 yy_tmpoper
->host
= rb_strdup(host
);
683 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
685 conf_report_error("Ignoring user -- missing username/host");
686 free_oper_conf(yy_tmpoper
);
690 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
694 conf_set_oper_password(void *data
)
698 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
699 rb_free(yy_oper
->passwd
);
702 yy_oper
->passwd
= rb_strdup((char *) data
);
706 conf_set_oper_rsa_public_key_file(void *data
)
708 #ifdef HAVE_LIBCRYPTO
709 rb_free(yy_oper
->rsa_pubkey_file
);
710 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
712 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
717 conf_set_oper_umodes(void *data
)
719 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
723 conf_set_oper_snomask(void *data
)
725 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
729 conf_begin_class(struct TopConf
*tc
)
732 free_class(yy_class
);
734 yy_class
= make_class();
739 conf_end_class(struct TopConf
*tc
)
741 if(conf_cur_block_name
!= NULL
)
742 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
744 if(EmptyString(yy_class
->class_name
))
746 conf_report_error("Ignoring connect block -- missing name.");
756 conf_set_class_ping_time(void *data
)
758 yy_class
->ping_freq
= *(unsigned int *) data
;
762 conf_set_class_cidr_ipv4_bitlen(void *data
)
764 unsigned int maxsize
= 32;
765 if(*(unsigned int *) data
> maxsize
)
767 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
768 *(unsigned int *) data
, maxsize
);
770 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
776 conf_set_class_cidr_ipv6_bitlen(void *data
)
778 unsigned int maxsize
= 128;
779 if(*(unsigned int *) data
> maxsize
)
781 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
782 *(unsigned int *) data
, maxsize
);
784 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
790 conf_set_class_number_per_cidr(void *data
)
792 yy_class
->cidr_amount
= *(unsigned int *) data
;
796 conf_set_class_number_per_ip(void *data
)
798 yy_class
->max_local
= *(unsigned int *) data
;
803 conf_set_class_number_per_ip_global(void *data
)
805 yy_class
->max_global
= *(unsigned int *) data
;
809 conf_set_class_number_per_ident(void *data
)
811 yy_class
->max_ident
= *(unsigned int *) data
;
815 conf_set_class_connectfreq(void *data
)
817 yy_class
->con_freq
= *(unsigned int *) data
;
821 conf_set_class_max_number(void *data
)
823 yy_class
->max_total
= *(unsigned int *) data
;
827 conf_set_class_sendq(void *data
)
829 yy_class
->max_sendq
= *(unsigned int *) data
;
832 static char *listener_address
;
835 conf_begin_listen(struct TopConf
*tc
)
837 rb_free(listener_address
);
838 listener_address
= NULL
;
843 conf_end_listen(struct TopConf
*tc
)
845 rb_free(listener_address
);
846 listener_address
= NULL
;
851 conf_set_listen_defer_accept(void *data
)
853 yy_defer_accept
= *(unsigned int *) data
;
857 conf_set_listen_port_both(void *data
, int ssl
)
859 conf_parm_t
*args
= data
;
860 for (; args
; args
= args
->next
)
862 if((args
->type
& CF_MTYPE
) != CF_INT
)
865 ("listener::port argument is not an integer " "-- ignoring.");
868 if(listener_address
== NULL
)
870 add_listener(args
->v
.number
, listener_address
, AF_INET
, ssl
, yy_defer_accept
);
872 add_listener(args
->v
.number
, listener_address
, AF_INET6
, ssl
, yy_defer_accept
);
879 if(strchr(listener_address
, ':') != NULL
)
885 add_listener(args
->v
.number
, listener_address
, family
, ssl
, yy_defer_accept
);
893 conf_set_listen_port(void *data
)
895 conf_set_listen_port_both(data
, 0);
899 conf_set_listen_sslport(void *data
)
901 conf_set_listen_port_both(data
, 1);
905 conf_set_listen_address(void *data
)
907 rb_free(listener_address
);
908 listener_address
= rb_strdup(data
);
912 conf_begin_auth(struct TopConf
*tc
)
915 rb_dlink_node
*next_ptr
;
920 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
922 free_conf(ptr
->data
);
923 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
926 yy_aconf
= make_conf();
927 yy_aconf
->status
= CONF_CLIENT
;
933 conf_end_auth(struct TopConf
*tc
)
935 struct ConfItem
*yy_tmp
, *found_conf
;
937 rb_dlink_node
*next_ptr
;
939 if(EmptyString(yy_aconf
->info
.name
))
940 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
942 /* didnt even get one ->host? */
943 if(EmptyString(yy_aconf
->host
))
945 conf_report_error("Ignoring auth block -- missing user@host");
949 /* so the stacking works in order.. */
950 collapse(yy_aconf
->user
);
951 collapse(yy_aconf
->host
);
952 conf_add_class_to_conf(yy_aconf
);
953 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
954 conf_report_error("Ignoring redundant auth block (after *@*)");
955 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
956 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
957 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
958 conf_report_error("Ignoring duplicate auth block for %s@%s",
959 yy_aconf
->user
, yy_aconf
->host
);
961 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
963 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
968 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
970 if(yy_aconf
->spasswd
)
971 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
973 /* this will always exist.. */
974 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
976 if(yy_aconf
->className
)
977 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
979 yy_tmp
->flags
= yy_aconf
->flags
;
980 yy_tmp
->port
= yy_aconf
->port
;
982 collapse(yy_tmp
->user
);
983 collapse(yy_tmp
->host
);
985 conf_add_class_to_conf(yy_tmp
);
987 if (find_exact_conf_by_address("*", CONF_CLIENT
, "*"))
988 conf_report_error("Ignoring redundant auth block (after *@*)");
989 else if (find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
))
990 conf_report_error("Ignoring duplicate auth block for %s@%s",
991 yy_tmp
->user
, yy_tmp
->host
);
993 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
994 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1002 conf_set_auth_user(void *data
)
1004 struct ConfItem
*yy_tmp
;
1007 /* The first user= line doesn't allocate a new conf */
1008 if(!EmptyString(yy_aconf
->host
))
1010 yy_tmp
= make_conf();
1011 yy_tmp
->status
= CONF_CLIENT
;
1016 if((p
= strchr(data
, '@')))
1020 yy_tmp
->user
= rb_strdup(data
);
1021 yy_tmp
->host
= rb_strdup(p
);
1025 yy_tmp
->user
= rb_strdup("*");
1026 yy_tmp
->host
= rb_strdup(data
);
1029 if(yy_aconf
!= yy_tmp
)
1030 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1034 conf_set_auth_auth_user(void *data
)
1036 if(yy_aconf
->spasswd
)
1037 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1038 rb_free(yy_aconf
->spasswd
);
1039 yy_aconf
->spasswd
= rb_strdup(data
);
1043 conf_set_auth_passwd(void *data
)
1045 if(yy_aconf
->passwd
)
1046 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1047 rb_free(yy_aconf
->passwd
);
1048 yy_aconf
->passwd
= rb_strdup(data
);
1052 conf_set_auth_spoof(void *data
)
1060 /* user@host spoof */
1061 if((p
= strchr(host
, '@')) != NULL
)
1067 if(EmptyString(user
))
1069 conf_report_error("Warning -- spoof ident empty.");
1073 if(strlen(user
) > USERLEN
)
1075 conf_report_error("Warning -- spoof ident length invalid.");
1079 if(!valid_username(user
))
1081 conf_report_error("Warning -- invalid spoof (ident).");
1085 /* this must be restored! */
1089 if(EmptyString(host
))
1091 conf_report_error("Warning -- spoof host empty.");
1095 if(strlen(host
) > HOSTLEN
)
1097 conf_report_error("Warning -- spoof host length invalid.");
1101 if(!valid_hostname(host
))
1103 conf_report_error("Warning -- invalid spoof (host).");
1107 rb_free(yy_aconf
->info
.name
);
1108 yy_aconf
->info
.name
= rb_strdup(data
);
1109 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1113 conf_set_auth_flags(void *data
)
1115 conf_parm_t
*args
= data
;
1117 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1121 conf_set_auth_redir_serv(void *data
)
1123 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1124 rb_free(yy_aconf
->info
.name
);
1125 yy_aconf
->info
.name
= rb_strdup(data
);
1129 conf_set_auth_redir_port(void *data
)
1131 int port
= *(unsigned int *) data
;
1133 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1134 yy_aconf
->port
= port
;
1138 conf_set_auth_class(void *data
)
1140 rb_free(yy_aconf
->className
);
1141 yy_aconf
->className
= rb_strdup(data
);
1144 /* ok, shared_oper handles the stacking, shared_flags handles adding
1145 * things.. so all we need to do when we start and end a shared block, is
1146 * clean up anything thats been left over.
1149 conf_cleanup_shared(struct TopConf
*tc
)
1151 rb_dlink_node
*ptr
, *next_ptr
;
1153 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1155 free_remote_conf(ptr
->data
);
1156 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1159 if(yy_shared
!= NULL
)
1161 free_remote_conf(yy_shared
);
1169 conf_set_shared_oper(void *data
)
1171 conf_parm_t
*args
= data
;
1172 const char *username
;
1175 if(yy_shared
!= NULL
)
1176 free_remote_conf(yy_shared
);
1178 yy_shared
= make_remote_conf();
1180 if(args
->next
!= NULL
)
1182 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1184 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1188 yy_shared
->server
= rb_strdup(args
->v
.string
);
1192 yy_shared
->server
= rb_strdup("*");
1194 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1196 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1200 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1202 conf_report_error("Ignoring shard::oper -- oper is not a user@host");
1206 username
= args
->v
.string
;
1210 yy_shared
->host
= rb_strdup("*");
1212 yy_shared
->host
= rb_strdup(p
);
1214 if(EmptyString(username
))
1215 yy_shared
->username
= rb_strdup("*");
1217 yy_shared
->username
= rb_strdup(username
);
1219 rb_dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1224 conf_set_shared_flags(void *data
)
1226 conf_parm_t
*args
= data
;
1228 rb_dlink_node
*ptr
, *next_ptr
;
1230 if(yy_shared
!= NULL
)
1231 free_remote_conf(yy_shared
);
1233 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1235 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1237 yy_shared
= ptr
->data
;
1239 yy_shared
->flags
= flags
;
1240 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1241 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1248 conf_begin_connect(struct TopConf
*tc
)
1251 free_server_conf(yy_server
);
1253 yy_server
= make_server_conf();
1254 yy_server
->port
= PORTNUM
;
1255 yy_server
->flags
|= SERVER_TB
;
1257 if(conf_cur_block_name
!= NULL
)
1258 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1264 conf_end_connect(struct TopConf
*tc
)
1266 if(EmptyString(yy_server
->name
))
1268 conf_report_error("Ignoring connect block -- missing name.");
1272 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1274 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1279 if((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
)) && EmptyString(yy_server
->certfp
))
1281 conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
1286 if(EmptyString(yy_server
->host
))
1288 conf_report_error("Ignoring connect block for %s -- missing host.",
1294 if(ServerConfCompressed(yy_server
))
1296 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1297 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1301 add_server_conf(yy_server
);
1302 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1309 conf_set_connect_host(void *data
)
1311 rb_free(yy_server
->host
);
1312 yy_server
->host
= rb_strdup(data
);
1313 if (strchr(yy_server
->host
, ':'))
1314 yy_server
->aftype
= AF_INET6
;
1318 conf_set_connect_vhost(void *data
)
1320 if(rb_inet_pton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1322 conf_report_error("Invalid netmask for server vhost (%s)",
1327 yy_server
->flags
|= SERVER_VHOSTED
;
1331 conf_set_connect_send_password(void *data
)
1333 if(yy_server
->spasswd
)
1335 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1336 rb_free(yy_server
->spasswd
);
1339 yy_server
->spasswd
= rb_strdup(data
);
1343 conf_set_connect_accept_password(void *data
)
1345 if(yy_server
->passwd
)
1347 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1348 rb_free(yy_server
->passwd
);
1350 yy_server
->passwd
= rb_strdup(data
);
1354 conf_set_connect_fingerprint(void *data
)
1356 if (yy_server
->certfp
)
1357 rb_free(yy_server
->certfp
);
1358 yy_server
->certfp
= rb_strdup((char *) data
);
1360 /* force SSL to be enabled if fingerprint is enabled. */
1361 yy_server
->flags
|= SERVER_SSL
;
1365 conf_set_connect_port(void *data
)
1367 int port
= *(unsigned int *) data
;
1372 yy_server
->port
= port
;
1376 conf_set_connect_aftype(void *data
)
1380 if(strcasecmp(aft
, "ipv4") == 0)
1381 yy_server
->aftype
= AF_INET
;
1383 else if(strcasecmp(aft
, "ipv6") == 0)
1384 yy_server
->aftype
= AF_INET6
;
1387 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1391 conf_set_connect_flags(void *data
)
1393 conf_parm_t
*args
= data
;
1395 /* note, we allow them to set compressed, then remove it later if
1396 * they do and LIBZ isnt available
1398 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1402 conf_set_connect_hub_mask(void *data
)
1404 struct remote_conf
*yy_hub
;
1406 if(EmptyString(yy_server
->name
))
1409 yy_hub
= make_remote_conf();
1410 yy_hub
->flags
= CONF_HUB
;
1412 yy_hub
->host
= rb_strdup(data
);
1413 yy_hub
->server
= rb_strdup(yy_server
->name
);
1414 rb_dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1418 conf_set_connect_leaf_mask(void *data
)
1420 struct remote_conf
*yy_leaf
;
1422 if(EmptyString(yy_server
->name
))
1425 yy_leaf
= make_remote_conf();
1426 yy_leaf
->flags
= CONF_LEAF
;
1428 yy_leaf
->host
= rb_strdup(data
);
1429 yy_leaf
->server
= rb_strdup(yy_server
->name
);
1430 rb_dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1434 conf_set_connect_class(void *data
)
1436 rb_free(yy_server
->class_name
);
1437 yy_server
->class_name
= rb_strdup(data
);
1441 conf_set_exempt_ip(void *data
)
1443 struct ConfItem
*yy_tmp
;
1445 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1447 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1451 yy_tmp
= make_conf();
1452 yy_tmp
->passwd
= rb_strdup("*");
1453 yy_tmp
->host
= rb_strdup(data
);
1454 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1455 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1459 conf_cleanup_cluster(struct TopConf
*tc
)
1461 rb_dlink_node
*ptr
, *next_ptr
;
1463 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1465 free_remote_conf(ptr
->data
);
1466 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1469 if(yy_shared
!= NULL
)
1471 free_remote_conf(yy_shared
);
1479 conf_set_cluster_name(void *data
)
1481 if(yy_shared
!= NULL
)
1482 free_remote_conf(yy_shared
);
1484 yy_shared
= make_remote_conf();
1485 yy_shared
->server
= rb_strdup(data
);
1486 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1492 conf_set_cluster_flags(void *data
)
1494 conf_parm_t
*args
= data
;
1496 rb_dlink_node
*ptr
, *next_ptr
;
1498 if(yy_shared
!= NULL
)
1499 free_remote_conf(yy_shared
);
1501 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1503 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1505 yy_shared
= ptr
->data
;
1506 yy_shared
->flags
= flags
;
1507 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1508 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1515 conf_set_general_havent_read_conf(void *data
)
1517 if(*(unsigned int *) data
)
1519 conf_report_error("You haven't read your config file properly.");
1521 ("There is a line in the example conf that will kill your server if not removed.");
1523 ("Consider actually reading/editing the conf file, and removing this line.");
1530 conf_set_general_hide_error_messages(void *data
)
1534 if(strcasecmp(val
, "yes") == 0)
1535 ConfigFileEntry
.hide_error_messages
= 2;
1536 else if(strcasecmp(val
, "opers") == 0)
1537 ConfigFileEntry
.hide_error_messages
= 1;
1538 else if(strcasecmp(val
, "no") == 0)
1539 ConfigFileEntry
.hide_error_messages
= 0;
1541 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1545 conf_set_general_kline_delay(void *data
)
1547 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1549 /* THIS MUST BE HERE to stop us being unable to check klines */
1554 conf_set_general_stats_k_oper_only(void *data
)
1558 if(strcasecmp(val
, "yes") == 0)
1559 ConfigFileEntry
.stats_k_oper_only
= 2;
1560 else if(strcasecmp(val
, "masked") == 0)
1561 ConfigFileEntry
.stats_k_oper_only
= 1;
1562 else if(strcasecmp(val
, "no") == 0)
1563 ConfigFileEntry
.stats_k_oper_only
= 0;
1565 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1569 conf_set_general_stats_i_oper_only(void *data
)
1573 if(strcasecmp(val
, "yes") == 0)
1574 ConfigFileEntry
.stats_i_oper_only
= 2;
1575 else if(strcasecmp(val
, "masked") == 0)
1576 ConfigFileEntry
.stats_i_oper_only
= 1;
1577 else if(strcasecmp(val
, "no") == 0)
1578 ConfigFileEntry
.stats_i_oper_only
= 0;
1580 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1584 conf_set_general_compression_level(void *data
)
1587 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1589 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1592 ("Invalid general::compression_level %d -- using default.",
1593 ConfigFileEntry
.compression_level
);
1594 ConfigFileEntry
.compression_level
= 0;
1597 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1602 conf_set_general_default_umodes(void *data
)
1605 int what
= MODE_ADD
, flag
;
1607 ConfigFileEntry
.default_umodes
= 0;
1608 for (pm
= (char *) data
; *pm
; pm
++)
1619 /* don't allow +o */
1627 if ((flag
= user_modes
[(unsigned char) *pm
]))
1629 /* Proper value has probably not yet been set
1630 * so don't check oper_only_umodes -- jilles */
1631 if (what
== MODE_ADD
)
1632 ConfigFileEntry
.default_umodes
|= flag
;
1634 ConfigFileEntry
.default_umodes
&= ~flag
;
1642 conf_set_general_oper_umodes(void *data
)
1644 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1648 conf_set_general_oper_only_umodes(void *data
)
1650 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1654 conf_set_general_oper_snomask(void *data
)
1657 int what
= MODE_ADD
, flag
;
1659 ConfigFileEntry
.oper_snomask
= 0;
1660 for (pm
= (char *) data
; *pm
; pm
++)
1672 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1674 if (what
== MODE_ADD
)
1675 ConfigFileEntry
.oper_snomask
|= flag
;
1677 ConfigFileEntry
.oper_snomask
&= ~flag
;
1685 conf_set_serverhide_links_delay(void *data
)
1687 int val
= *(unsigned int *) data
;
1689 ConfigServerHide
.links_delay
= val
;
1693 conf_set_service_name(void *data
)
1695 struct Client
*target_p
;
1700 for(s
= data
; *s
!= '\0'; s
++)
1704 conf_report_error("Ignoring service::name "
1705 "-- bogus servername.");
1714 conf_report_error("Ignoring service::name -- must contain '.'");
1718 tmp
= rb_strdup(data
);
1719 rb_dlinkAddAlloc(tmp
, &service_list
);
1723 conf_begin_alias(struct TopConf
*tc
)
1725 yy_alias
= rb_malloc(sizeof(struct alias_entry
));
1727 if (conf_cur_block_name
!= NULL
)
1728 yy_alias
->name
= rb_strdup(conf_cur_block_name
);
1730 yy_alias
->flags
= 0;
1737 conf_end_alias(struct TopConf
*tc
)
1739 if (yy_alias
== NULL
)
1742 if (yy_alias
->name
== NULL
)
1744 conf_report_error("Ignoring alias -- must have a name.");
1751 if (yy_alias
->target
== NULL
)
1753 conf_report_error("Ignoring alias -- must have a target.");
1760 irc_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1766 conf_set_alias_name(void *data
)
1768 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1771 yy_alias
->name
= rb_strdup(data
);
1775 conf_set_alias_target(void *data
)
1777 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1780 yy_alias
->target
= rb_strdup(data
);
1784 static void conf_set_blacklist_reason(void *data
);
1787 conf_set_blacklist_host(void *data
)
1789 if (yy_blacklist_host
)
1791 conf_report_error("blacklist::host %s overlaps existing host %s",
1792 (char *)data
, yy_blacklist_host
);
1795 conf_set_blacklist_reason(NULL
);
1799 yy_blacklist_ipv4
= 1;
1800 yy_blacklist_ipv6
= 0;
1801 yy_blacklist_host
= rb_strdup(data
);
1805 conf_set_blacklist_type(void *data
)
1807 conf_parm_t
*args
= data
;
1809 /* Don't assume we have either if we got here */
1810 yy_blacklist_ipv4
= 0;
1811 yy_blacklist_ipv6
= 0;
1813 for (; args
; args
= args
->next
)
1815 if (!strcasecmp(args
->v
.string
, "ipv4"))
1816 yy_blacklist_ipv4
= 1;
1817 else if (!strcasecmp(args
->v
.string
, "ipv6"))
1818 yy_blacklist_ipv6
= 1;
1820 conf_report_error("blacklist::type has unknown address family %s",
1824 /* If we have neither, just default to IPv4 */
1825 if (!yy_blacklist_ipv4
&& !yy_blacklist_ipv6
)
1827 conf_report_error("blacklist::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
1828 yy_blacklist_ipv4
= 1;
1833 conf_set_blacklist_matches(void *data
)
1835 conf_parm_t
*args
= data
;
1837 for (; args
; args
= args
->next
)
1839 struct BlacklistFilter
*filter
;
1840 char *str
= args
->v
.string
;
1842 int type
= BLACKLIST_FILTER_LAST
;
1844 if (CF_TYPE(args
->type
) != CF_QSTRING
)
1846 conf_report_error("blacklist::matches -- must be quoted string");
1852 conf_report_error("blacklist::matches -- invalid entry");
1856 if (strlen(str
) > HOSTIPLEN
)
1858 conf_report_error("blacklist::matches has an entry too long: %s",
1863 for (p
= str
; *p
!= '\0'; p
++)
1865 /* Check for validity */
1867 type
= BLACKLIST_FILTER_ALL
;
1868 else if (!isalnum(*p
))
1870 conf_report_error("blacklist::matches has invalid IP match entry %s",
1877 if (type
== BLACKLIST_FILTER_ALL
)
1879 /* Basic IP sanity check */
1880 struct rb_sockaddr_storage tmp
;
1881 if (rb_inet_pton(AF_INET
, str
, &tmp
) <= 0)
1883 conf_report_error("blacklist::matches has invalid IP match entry %s",
1888 else if (type
== BLACKLIST_FILTER_LAST
)
1890 /* Verify it's the correct length */
1891 if (strlen(str
) > 3)
1893 conf_report_error("blacklist::matches has invalid octet match entry %s",
1900 continue; /* Invalid entry */
1903 filter
= rb_malloc(sizeof(struct BlacklistFilter
));
1904 filter
->type
= type
;
1905 rb_strlcpy(filter
->filterstr
, str
, sizeof(filter
->filterstr
));
1907 rb_dlinkAdd(filter
, &filter
->node
, &yy_blacklist_filters
);
1912 conf_set_blacklist_reason(void *data
)
1914 yy_blacklist_reason
= rb_strdup(data
);
1915 rb_dlink_node
*ptr
, *nptr
;
1917 if (yy_blacklist_host
&& yy_blacklist_reason
)
1919 if (yy_blacklist_ipv6
)
1921 /* Make sure things fit (64 = alnum count + dots) */
1922 if ((64 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1924 conf_report_error("blacklist::host %s results in IPv6 queries that are too long",
1929 /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
1930 if (yy_blacklist_ipv4
&& !yy_blacklist_ipv6
)
1932 /* Make sure things fit (16 = number of nums + dots) */
1933 if ((16 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1935 conf_report_error("blacklist::host %s results in IPv4 queries that are too long",
1941 new_blacklist(yy_blacklist_host
, yy_blacklist_reason
, yy_blacklist_ipv4
, yy_blacklist_ipv6
,
1942 &yy_blacklist_filters
);
1948 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_blacklist_filters
.head
)
1951 rb_dlinkDelete(ptr
, &yy_blacklist_filters
);
1956 yy_blacklist_filters
= (rb_dlink_list
){ NULL
, NULL
, 0 };
1959 rb_free(yy_blacklist_host
);
1960 rb_free(yy_blacklist_reason
);
1961 yy_blacklist_host
= NULL
;
1962 yy_blacklist_reason
= NULL
;
1963 yy_blacklist_ipv4
= 1;
1964 yy_blacklist_ipv6
= 0;
1967 /* public functions */
1971 conf_report_error(const char *fmt
, ...)
1974 char msg
[IRCD_BUFSIZE
+ 1] = { 0 };
1977 rb_vsnprintf(msg
, IRCD_BUFSIZE
, fmt
, ap
);
1982 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
1986 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1987 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1991 conf_start_block(char *block
, char *name
)
1993 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
1995 conf_report_error("Configuration block '%s' is not defined.", block
);
2000 conf_cur_block_name
= rb_strdup(name
);
2002 conf_cur_block_name
= NULL
;
2004 if(conf_cur_block
->tc_sfunc
)
2005 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
2012 conf_end_block(struct TopConf
*tc
)
2015 return tc
->tc_efunc(tc
);
2017 rb_free(conf_cur_block_name
);
2022 conf_set_generic_int(void *data
, void *location
)
2024 *((int *) location
) = *((unsigned int *) data
);
2028 conf_set_generic_string(void *data
, int len
, void *location
)
2030 char **loc
= location
;
2033 if(len
&& strlen(input
) > (unsigned int)len
)
2037 *loc
= rb_strdup(input
);
2041 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
, int type
)
2043 struct ConfEntry
*cf
;
2049 if((cf
= find_conf_item(tc
, item
)) == NULL
)
2052 ("Non-existant configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
2056 /* if it takes one thing, make sure they only passed one thing,
2057 and handle as needed. */
2058 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
2061 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
2068 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
2070 /* if it expects a string value, but we got a yesno,
2073 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
2074 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
2076 value
->v
.list
->type
= CF_STRING
;
2078 if(cp
->v
.number
== 1)
2079 cp
->v
.string
= rb_strdup("yes");
2081 cp
->v
.string
= rb_strdup("no");
2084 /* maybe it's a CF_TIME and they passed CF_INT --
2085 should still be valid */
2086 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
2087 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
2090 ("Wrong type for %s::%s (expected %s, got %s)",
2091 tc
->tc_name
, (char *) item
,
2092 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
2097 if(cf
->cf_type
& CF_FLIST
)
2101 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
2104 /* just pass it the extended argument list */
2105 cf
->cf_func(value
->v
.list
);
2109 /* it's old-style, needs only one arg */
2110 switch (cf
->cf_type
)
2116 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2118 cf
->cf_func(&cp
->v
.number
);
2122 if(EmptyString(cp
->v
.string
))
2123 conf_report_error("Ignoring %s::%s -- empty field",
2126 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2128 cf
->cf_func(cp
->v
.string
);
2138 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2141 struct ConfEntry
*cf
;
2143 if((tc
= find_top_conf(topconf
)) == NULL
)
2146 if((cf
= find_conf_item(tc
, name
)) != NULL
)
2149 cf
= rb_malloc(sizeof(struct ConfEntry
));
2156 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2162 remove_conf_item(const char *topconf
, const char *name
)
2165 struct ConfEntry
*cf
;
2168 if((tc
= find_top_conf(topconf
)) == NULL
)
2171 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2174 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2177 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2184 static struct ConfEntry conf_serverinfo_table
[] =
2186 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2187 { "network_desc", CF_QSTRING
, NULL
, 0, &ServerInfo
.network_desc
},
2188 { "hub", CF_YESNO
, NULL
, 0, &ServerInfo
.hub
},
2190 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2191 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2192 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2193 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2194 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2196 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2197 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2198 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2199 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2200 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2202 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2204 { "nicklen", CF_INT
, conf_set_serverinfo_nicklen
, 0, NULL
},
2206 { "\0", 0, NULL
, 0, NULL
}
2209 static struct ConfEntry conf_admin_table
[] =
2211 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2212 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2213 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2214 { "\0", 0, NULL
, 0, NULL
}
2217 static struct ConfEntry conf_log_table
[] =
2219 { "fname_userlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_userlog
},
2220 { "fname_fuserlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_fuserlog
},
2221 { "fname_operlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operlog
},
2222 { "fname_foperlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_foperlog
},
2223 { "fname_serverlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_serverlog
},
2224 { "fname_killlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_killlog
},
2225 { "fname_klinelog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_klinelog
},
2226 { "fname_operspylog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operspylog
},
2227 { "fname_ioerrorlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_ioerrorlog
},
2228 { "\0", 0, NULL
, 0, NULL
}
2231 static struct ConfEntry conf_operator_table
[] =
2233 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2234 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2235 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2236 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2237 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2238 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2239 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2240 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2241 { "\0", 0, NULL
, 0, NULL
}
2244 static struct ConfEntry conf_privset_table
[] =
2246 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2247 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2248 { "\0", 0, NULL
, 0, NULL
}
2251 static struct ConfEntry conf_class_table
[] =
2253 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2254 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2256 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2258 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2259 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2260 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2261 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2262 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2263 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2264 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2265 { "\0", 0, NULL
, 0, NULL
}
2268 static struct ConfEntry conf_auth_table
[] =
2270 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2271 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2272 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2273 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2274 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2275 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2276 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2277 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2278 { "\0", 0, NULL
, 0, NULL
}
2281 static struct ConfEntry conf_connect_table
[] =
2283 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2284 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2285 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2286 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2287 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2288 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2289 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2290 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2291 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
2292 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
2293 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2294 { "\0", 0, NULL
, 0, NULL
}
2297 static struct ConfEntry conf_general_table
[] =
2299 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2300 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2301 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2302 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
2303 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2304 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2305 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
2306 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2307 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2308 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2310 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2311 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2312 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2313 { "egdpool_path", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.egdpool_path
},
2314 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2315 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2316 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2318 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2319 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2320 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2321 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2322 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2324 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2325 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2326 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2327 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2328 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2329 { "resv_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.resv_fnc
},
2330 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2331 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2332 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2333 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2334 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2335 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2336 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2337 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2338 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2339 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2340 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2341 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2342 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2343 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2344 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2345 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2346 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2347 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2348 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2349 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2350 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2351 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2352 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2353 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2354 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2355 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2356 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2357 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2358 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2359 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2360 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2361 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2362 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2363 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2364 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2365 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2366 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2367 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2368 { "use_egd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_egd
},
2369 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2370 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2371 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2372 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2373 { "client_flood_max_lines", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_max_lines
},
2374 { "client_flood_burst_rate", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_rate
},
2375 { "client_flood_burst_max", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_max
},
2376 { "client_flood_message_num", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_num
},
2377 { "client_flood_message_time", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_time
},
2378 { "max_ratelimit_tokens", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_ratelimit_tokens
},
2379 { "away_interval", CF_INT
, NULL
, 0, &ConfigFileEntry
.away_interval
},
2380 { "\0", 0, NULL
, 0, NULL
}
2383 static struct ConfEntry conf_channel_table
[] =
2385 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2386 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2387 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2388 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2389 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2390 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2391 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2392 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2393 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2394 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2395 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2396 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2397 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2398 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2399 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2400 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2401 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2402 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2403 { "disable_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.disable_local_channels
},
2404 { "\0", 0, NULL
, 0, NULL
}
2407 static struct ConfEntry conf_serverhide_table
[] =
2409 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2410 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2411 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2412 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2413 { "\0", 0, NULL
, 0, NULL
}
2420 add_top_conf("modules", NULL
, NULL
, NULL
);
2421 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2422 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2424 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2425 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2426 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2427 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2428 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2429 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2431 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2432 add_conf_item("listen", "defer_accept", CF_YESNO
, conf_set_listen_defer_accept
);
2433 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2434 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2435 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2436 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2438 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2440 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
2441 add_conf_item("shared", "oper", CF_QSTRING
|CF_FLIST
, conf_set_shared_oper
);
2442 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
2444 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2446 add_top_conf("exempt", NULL
, NULL
, NULL
);
2447 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2449 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2450 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2451 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2453 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2454 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2455 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2457 add_top_conf("service", NULL
, NULL
, NULL
);
2458 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2460 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2461 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2462 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2464 add_top_conf("blacklist", NULL
, NULL
, NULL
);
2465 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_blacklist_host
);
2466 add_conf_item("blacklist", "type", CF_STRING
| CF_FLIST
, conf_set_blacklist_type
);
2467 add_conf_item("blacklist", "matches", CF_QSTRING
| CF_FLIST
, conf_set_blacklist_matches
);
2468 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_blacklist_reason
);