1 /* This code is in the public domain.
7 #include <openssl/pem.h>
8 #include <openssl/rsa.h>
12 #include "ircd_defs.h"
17 #include "s_newconf.h"
28 #include "blacklist.h"
30 #include "privilege.h"
32 #define CF_TYPE(x) ((x) & CF_MTYPE)
34 struct TopConf
*conf_cur_block
;
35 static char *conf_cur_block_name
;
37 static rb_dlink_list conf_items
;
39 static struct ConfItem
*yy_aconf
= NULL
;
41 static struct Class
*yy_class
= NULL
;
43 static struct remote_conf
*yy_shared
= NULL
;
44 static struct server_conf
*yy_server
= NULL
;
46 static rb_dlink_list yy_aconf_list
;
47 static rb_dlink_list yy_oper_list
;
48 static rb_dlink_list yy_shared_list
;
49 static rb_dlink_list yy_cluster_list
;
50 static struct oper_conf
*yy_oper
= NULL
;
52 static struct alias_entry
*yy_alias
= NULL
;
54 static char *yy_blacklist_host
= NULL
;
55 static char *yy_blacklist_reason
= NULL
;
56 static char *yy_privset_extends
= NULL
;
59 conf_strtype(int type
)
61 switch (type
& CF_MTYPE
)
64 return "integer value";
66 return "unquoted string";
68 return "yes/no value";
70 return "quoted string";
72 return "time/size value";
74 return "unknown type";
79 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
80 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
84 tc
= rb_malloc(sizeof(struct TopConf
));
89 tc
->tc_entries
= items
;
91 rb_dlinkAddAlloc(tc
, &conf_items
);
96 find_top_conf(const char *name
)
101 RB_DLINK_FOREACH(d
, conf_items
.head
)
104 if(strcasecmp(tc
->tc_name
, name
) == 0)
113 find_conf_item(const struct TopConf
*top
, const char *name
)
115 struct ConfEntry
*cf
;
122 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
124 cf
= &top
->tc_entries
[i
];
126 if(!strcasecmp(cf
->cf_name
, name
))
131 RB_DLINK_FOREACH(d
, top
->tc_items
.head
)
134 if(strcasecmp(cf
->cf_name
, name
) == 0)
142 remove_top_conf(char *name
)
147 if((tc
= find_top_conf(name
)) == NULL
)
150 if((ptr
= rb_dlinkFind(tc
, &conf_items
)) == NULL
)
153 rb_dlinkDestroy(ptr
, &conf_items
);
160 conf_set_serverinfo_name(void *data
)
162 if(ServerInfo
.name
== NULL
)
167 for(s
= data
; *s
!= '\0'; s
++)
171 conf_report_error("Ignoring serverinfo::name "
172 "-- bogus servername.");
181 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
189 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
193 /* the ircd will exit() in main() if we dont set one */
194 if(strlen(s
) <= HOSTLEN
)
195 ServerInfo
.name
= rb_strdup((char *) data
);
200 conf_set_serverinfo_sid(void *data
)
204 if(ServerInfo
.sid
[0] == '\0')
206 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
207 !IsIdChar(sid
[2]) || sid
[3] != '\0')
209 conf_report_error("Ignoring serverinfo::sid "
214 strcpy(ServerInfo
.sid
, sid
);
219 conf_set_serverinfo_network_name(void *data
)
223 if((p
= strchr((char *) data
, ' ')))
226 rb_free(ServerInfo
.network_name
);
227 ServerInfo
.network_name
= rb_strdup((char *) data
);
231 conf_set_serverinfo_vhost(void *data
)
233 if(rb_inet_pton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
235 conf_report_error("Invalid netmask for server IPv4 vhost (%s)", (char *) data
);
238 ServerInfo
.ip
.sin_family
= AF_INET
;
239 ServerInfo
.specific_ipv4_vhost
= 1;
243 conf_set_serverinfo_vhost6(void *data
)
246 if(rb_inet_pton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
248 conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data
);
252 ServerInfo
.specific_ipv6_vhost
= 1;
253 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
255 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
260 conf_set_modules_module(void *data
)
262 #ifndef STATIC_MODULES
265 m_bn
= rb_basename((char *) data
);
267 if(findmodule_byname(m_bn
) != -1)
270 load_one_module((char *) data
, 0);
274 conf_report_error("Ignoring modules::module -- loadable module support not present.");
279 conf_set_modules_path(void *data
)
281 #ifndef STATIC_MODULES
282 mod_add_path((char *) data
);
284 conf_report_error("Ignoring modules::path -- loadable module support not present.");
295 static struct mode_table umode_table
[] = {
296 {"callerid", UMODE_CALLERID
},
297 {"softcallerid", UMODE_SCALLERID
},
298 {"deaf", UMODE_DEAF
},
299 {"invisible", UMODE_INVISIBLE
},
300 {"locops", UMODE_LOCOPS
},
301 {"noforward", UMODE_NOFORWARD
},
302 {"regonlymsg", UMODE_REGONLYMSG
},
303 {"servnotice", UMODE_SERVNOTICE
},
304 {"wallop", UMODE_WALLOP
},
305 {"operwall", UMODE_OPERWALL
},
306 {"noctcp", UMODE_NOCTCP
},
307 {"noinvite", UMODE_NOINVITE
},
309 {"override", UMODE_OVERRIDE
},
313 static struct mode_table oper_table
[] = {
314 {"encrypted", OPER_ENCRYPTED
},
315 {"need_ssl", OPER_NEEDSSL
},
319 static struct mode_table auth_table
[] = {
320 {"encrypted", CONF_FLAGS_ENCRYPTED
},
321 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
322 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
323 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
324 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
325 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
326 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
327 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
328 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
329 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
330 {"no_tilde", CONF_FLAGS_NO_TILDE
},
331 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
332 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
333 {"need_ssl", CONF_FLAGS_NEED_SSL
},
334 {"need_sasl", CONF_FLAGS_NEED_SASL
},
338 static struct mode_table connect_table
[] = {
339 { "autoconn", SERVER_AUTOCONN
},
340 { "compressed", SERVER_COMPRESSED
},
341 { "encrypted", SERVER_ENCRYPTED
},
342 { "topicburst", SERVER_TB
},
343 { "ssl", SERVER_SSL
},
347 static struct mode_table cluster_table
[] = {
348 { "kline", SHARED_PKLINE
},
349 { "tkline", SHARED_TKLINE
},
350 { "unkline", SHARED_UNKLINE
},
351 { "locops", SHARED_LOCOPS
},
352 { "xline", SHARED_PXLINE
},
353 { "txline", SHARED_TXLINE
},
354 { "unxline", SHARED_UNXLINE
},
355 { "resv", SHARED_PRESV
},
356 { "tresv", SHARED_TRESV
},
357 { "unresv", SHARED_UNRESV
},
358 { "all", CLUSTER_ALL
},
362 static struct mode_table shared_table
[] =
364 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
365 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
366 { "resv", SHARED_PRESV
|SHARED_TRESV
},
367 { "dline", SHARED_PDLINE
|SHARED_TDLINE
},
368 { "tdline", SHARED_TDLINE
},
369 { "pdline", SHARED_PDLINE
},
370 { "undline", SHARED_UNDLINE
},
371 { "tkline", SHARED_TKLINE
},
372 { "unkline", SHARED_UNKLINE
},
373 { "txline", SHARED_TXLINE
},
374 { "unxline", SHARED_UNXLINE
},
375 { "tresv", SHARED_TRESV
},
376 { "unresv", SHARED_UNRESV
},
377 { "locops", SHARED_LOCOPS
},
378 { "rehash", SHARED_REHASH
},
379 { "die", SHARED_DIE
},
380 { "modules", SHARED_MODULE
},
381 { "all", SHARED_ALL
},
388 find_umode(struct mode_table
*tab
, const char *name
)
392 for (i
= 0; tab
[i
].name
; i
++)
394 if(strcmp(tab
[i
].name
, name
) == 0)
402 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
404 for (; args
; args
= args
->next
)
410 if((args
->type
& CF_MTYPE
) != CF_STRING
)
412 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
416 umode
= args
->v
.string
;
424 mode
= find_umode(tab
, umode
);
428 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
445 conf_set_privset_extends(void *data
)
447 yy_privset_extends
= rb_strdup((char *) data
);
451 conf_set_privset_privs(void *data
)
454 conf_parm_t
*args
= data
;
456 for (; args
; args
= args
->next
)
459 privs
= rb_strdup(args
->v
.string
);
462 char *privs_old
= privs
;
464 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
465 strcpy(privs
, privs_old
);
467 strcat(privs
, args
->v
.string
);
475 if (yy_privset_extends
)
477 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
481 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
483 set
= privilegeset_get("default");
486 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
488 rb_free(yy_privset_extends
);
489 yy_privset_extends
= NULL
;
492 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
499 conf_begin_oper(struct TopConf
*tc
)
502 rb_dlink_node
*next_ptr
;
506 free_oper_conf(yy_oper
);
510 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
512 free_oper_conf(ptr
->data
);
513 rb_dlinkDestroy(ptr
, &yy_oper_list
);
516 yy_oper
= make_oper_conf();
517 yy_oper
->flags
|= OPER_ENCRYPTED
;
523 conf_end_oper(struct TopConf
*tc
)
525 struct oper_conf
*yy_tmpoper
;
527 rb_dlink_node
*next_ptr
;
529 if(conf_cur_block_name
!= NULL
)
531 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
532 conf_cur_block_name
[OPERNICKLEN
] = '\0';
534 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
537 if(EmptyString(yy_oper
->name
))
539 conf_report_error("Ignoring operator block -- missing name.");
543 #ifdef HAVE_LIBCRYPTO
544 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
546 if(EmptyString(yy_oper
->passwd
))
549 conf_report_error("Ignoring operator block for %s -- missing password",
555 if (!yy_oper
->privset
)
556 yy_oper
->privset
= privilegeset_get("default");
558 /* now, yy_oper_list contains a stack of oper_conf's with just user
559 * and host in, yy_oper contains the rest of the information which
560 * we need to copy into each element in yy_oper_list
562 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
564 yy_tmpoper
= ptr
->data
;
566 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
568 /* could be an rsa key instead.. */
569 if(!EmptyString(yy_oper
->passwd
))
570 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
572 yy_tmpoper
->flags
= yy_oper
->flags
;
573 yy_tmpoper
->umodes
= yy_oper
->umodes
;
574 yy_tmpoper
->snomask
= yy_oper
->snomask
;
576 if(!EmptyString(yy_oper
->vhost
))
578 if(valid_hostname(yy_oper
->vhost
))
579 yy_tmpoper
->vhost
= rb_strdup(yy_oper
->vhost
);
580 else if(!EmptyString(yy_oper
->vhost
))
581 conf_report_error("Ignoring vhost setting for oper %s -- invalid hostmask.", yy_oper
->name
);
584 if(!EmptyString(yy_oper
->swhois
))
586 if(strlen(yy_oper
->swhois
) < 400)
587 yy_tmpoper
->swhois
= rb_strdup(yy_oper
->swhois
);
589 conf_report_error("Ignoring swhois setting for oper %s -- swhois too long.", yy_oper
->name
);
592 if(!EmptyString(yy_oper
->operstring
))
594 if(strlen(yy_oper
->operstring
) < 400)
595 yy_tmpoper
->operstring
= rb_strdup(yy_oper
->operstring
);
597 conf_report_error("Ignoring operstring setting for oper %s -- operstring too long.", yy_oper
->name
);
600 yy_tmpoper
->privset
= yy_oper
->privset
;
602 #ifdef HAVE_LIBCRYPTO
603 if(yy_oper
->rsa_pubkey_file
)
607 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
609 conf_report_error("Ignoring operator block for %s -- "
610 "rsa_public_key_file cant be opened",
615 yy_tmpoper
->rsa_pubkey
=
616 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
618 (void)BIO_set_close(file
, BIO_CLOSE
);
621 if(yy_tmpoper
->rsa_pubkey
== NULL
)
623 conf_report_error("Ignoring operator block for %s -- "
624 "rsa_public_key_file key invalid; check syntax",
630 if(!EmptyString(yy_oper
->certfp
))
631 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
634 /* all is ok, put it on oper_conf_list */
635 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
638 free_oper_conf(yy_oper
);
645 conf_set_oper_flags(void *data
)
647 conf_parm_t
*args
= data
;
649 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
653 conf_set_oper_fingerprint(void *data
)
656 rb_free(yy_oper
->certfp
);
657 yy_oper
->certfp
= rb_strdup((char *) data
);
661 conf_set_oper_privset(void *data
)
663 yy_oper
->privset
= privilegeset_get((char *) data
);
667 conf_set_oper_user(void *data
)
669 struct oper_conf
*yy_tmpoper
;
671 char *host
= (char *) data
;
673 yy_tmpoper
= make_oper_conf();
675 if((p
= strchr(host
, '@')))
679 yy_tmpoper
->username
= rb_strdup(host
);
680 yy_tmpoper
->host
= rb_strdup(p
);
685 yy_tmpoper
->username
= rb_strdup("*");
686 yy_tmpoper
->host
= rb_strdup(host
);
689 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
691 conf_report_error("Ignoring user -- missing username/host");
692 free_oper_conf(yy_tmpoper
);
696 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
700 conf_set_oper_password(void *data
)
704 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
705 rb_free(yy_oper
->passwd
);
708 yy_oper
->passwd
= rb_strdup((char *) data
);
712 conf_set_oper_rsa_public_key_file(void *data
)
714 #ifdef HAVE_LIBCRYPTO
715 rb_free(yy_oper
->rsa_pubkey_file
);
716 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
718 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
723 conf_set_oper_umodes(void *data
)
725 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
729 conf_set_oper_snomask(void *data
)
731 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
735 conf_set_oper_vhost(void *data
)
737 yy_oper
->vhost
= rb_strdup((char *) data
);
741 conf_set_oper_swhois(void *data
)
743 yy_oper
->swhois
= rb_strdup((char *) data
);
747 conf_set_oper_operstring(void *data
)
749 yy_oper
->operstring
= rb_strdup((char *) data
);
753 conf_begin_class(struct TopConf
*tc
)
756 free_class(yy_class
);
758 yy_class
= make_class();
763 conf_end_class(struct TopConf
*tc
)
765 if(conf_cur_block_name
!= NULL
)
766 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
768 if(EmptyString(yy_class
->class_name
))
770 conf_report_error("Ignoring connect block -- missing name.");
780 conf_set_class_ping_time(void *data
)
782 yy_class
->ping_freq
= *(unsigned int *) data
;
786 conf_set_class_cidr_ipv4_bitlen(void *data
)
788 unsigned int maxsize
= 32;
789 if(*(unsigned int *) data
> maxsize
)
791 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
792 *(unsigned int *) data
, maxsize
);
794 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
800 conf_set_class_cidr_ipv6_bitlen(void *data
)
802 unsigned int maxsize
= 128;
803 if(*(unsigned int *) data
> maxsize
)
805 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
806 *(unsigned int *) data
, maxsize
);
808 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
814 conf_set_class_number_per_cidr(void *data
)
816 yy_class
->cidr_amount
= *(unsigned int *) data
;
820 conf_set_class_number_per_ip(void *data
)
822 yy_class
->max_local
= *(unsigned int *) data
;
827 conf_set_class_number_per_ip_global(void *data
)
829 yy_class
->max_global
= *(unsigned int *) data
;
833 conf_set_class_number_per_ident(void *data
)
835 yy_class
->max_ident
= *(unsigned int *) data
;
839 conf_set_class_connectfreq(void *data
)
841 yy_class
->con_freq
= *(unsigned int *) data
;
845 conf_set_class_max_number(void *data
)
847 yy_class
->max_total
= *(unsigned int *) data
;
851 conf_set_class_sendq(void *data
)
853 yy_class
->max_sendq
= *(unsigned int *) data
;
856 static char *listener_address
;
859 conf_begin_listen(struct TopConf
*tc
)
861 rb_free(listener_address
);
862 listener_address
= NULL
;
867 conf_end_listen(struct TopConf
*tc
)
869 rb_free(listener_address
);
870 listener_address
= NULL
;
877 conf_set_listen_port_both(void *data
, int ssl
)
879 conf_parm_t
*args
= data
;
880 for (; args
; args
= args
->next
)
882 if((args
->type
& CF_MTYPE
) != CF_INT
)
885 ("listener::port argument is not an integer " "-- ignoring.");
888 if(listener_address
== NULL
)
890 add_listener(args
->v
.number
, listener_address
, AF_INET
, ssl
);
892 add_listener(args
->v
.number
, listener_address
, AF_INET6
, ssl
);
899 if(strchr(listener_address
, ':') != NULL
)
905 add_listener(args
->v
.number
, listener_address
, family
, ssl
);
913 conf_set_listen_port(void *data
)
915 conf_set_listen_port_both(data
, 0);
919 conf_set_listen_sslport(void *data
)
921 conf_set_listen_port_both(data
, 1);
925 conf_set_listen_address(void *data
)
927 rb_free(listener_address
);
928 listener_address
= rb_strdup(data
);
932 conf_begin_auth(struct TopConf
*tc
)
935 rb_dlink_node
*next_ptr
;
940 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
942 free_conf(ptr
->data
);
943 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
946 yy_aconf
= make_conf();
947 yy_aconf
->status
= CONF_CLIENT
;
953 conf_end_auth(struct TopConf
*tc
)
955 struct ConfItem
*yy_tmp
, *found_conf
;
957 rb_dlink_node
*next_ptr
;
959 if(EmptyString(yy_aconf
->info
.name
))
960 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
962 /* didnt even get one ->host? */
963 if(EmptyString(yy_aconf
->host
))
965 conf_report_error("Ignoring auth block -- missing user@host");
969 /* so the stacking works in order.. */
970 collapse(yy_aconf
->user
);
971 collapse(yy_aconf
->host
);
972 conf_add_class_to_conf(yy_aconf
);
973 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
974 conf_report_error("Ignoring redundant auth block (after *@*)");
975 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
976 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
977 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
978 conf_report_error("Ignoring duplicate auth block for %s@%s",
979 yy_aconf
->user
, yy_aconf
->host
);
981 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
983 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
988 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
990 if(yy_aconf
->spasswd
)
991 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
993 /* this will always exist.. */
994 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
996 if(yy_aconf
->className
)
997 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
999 yy_tmp
->flags
= yy_aconf
->flags
;
1000 yy_tmp
->port
= yy_aconf
->port
;
1002 collapse(yy_tmp
->user
);
1003 collapse(yy_tmp
->host
);
1005 conf_add_class_to_conf(yy_tmp
);
1007 if (find_exact_conf_by_address("*", CONF_CLIENT
, "*"))
1008 conf_report_error("Ignoring redundant auth block (after *@*)");
1009 else if (find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
))
1010 conf_report_error("Ignoring duplicate auth block for %s@%s",
1011 yy_tmp
->user
, yy_tmp
->host
);
1013 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
1014 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1022 conf_set_auth_user(void *data
)
1024 struct ConfItem
*yy_tmp
;
1027 /* The first user= line doesn't allocate a new conf */
1028 if(!EmptyString(yy_aconf
->host
))
1030 yy_tmp
= make_conf();
1031 yy_tmp
->status
= CONF_CLIENT
;
1036 if((p
= strchr(data
, '@')))
1040 yy_tmp
->user
= rb_strdup(data
);
1041 yy_tmp
->host
= rb_strdup(p
);
1045 yy_tmp
->user
= rb_strdup("*");
1046 yy_tmp
->host
= rb_strdup(data
);
1049 if(yy_aconf
!= yy_tmp
)
1050 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1054 conf_set_auth_auth_user(void *data
)
1056 if(yy_aconf
->spasswd
)
1057 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1058 rb_free(yy_aconf
->spasswd
);
1059 yy_aconf
->spasswd
= rb_strdup(data
);
1063 conf_set_auth_passwd(void *data
)
1065 if(yy_aconf
->passwd
)
1066 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1067 rb_free(yy_aconf
->passwd
);
1068 yy_aconf
->passwd
= rb_strdup(data
);
1072 conf_set_auth_autojoin(void *data
)
1074 if(yy_aconf
->autojoin
)
1075 memset(yy_aconf
->autojoin
, 0, strlen(yy_aconf
->autojoin
));
1076 rb_free(yy_aconf
->autojoin
);
1077 yy_aconf
->autojoin
= rb_strdup(data
);
1081 conf_set_auth_autojoin_opers(void *data
)
1083 if(yy_aconf
->autojoin_opers
)
1084 memset(yy_aconf
->autojoin_opers
, 0, strlen(yy_aconf
->autojoin_opers
));
1085 rb_free(yy_aconf
->autojoin_opers
);
1086 yy_aconf
->autojoin_opers
= rb_strdup(data
);
1090 conf_set_auth_spoof(void *data
)
1098 /* user@host spoof */
1099 if((p
= strchr(host
, '@')) != NULL
)
1105 if(EmptyString(user
))
1107 conf_report_error("Warning -- spoof ident empty.");
1111 if(strlen(user
) > USERLEN
)
1113 conf_report_error("Warning -- spoof ident length invalid.");
1117 if(!valid_username(user
))
1119 conf_report_error("Warning -- invalid spoof (ident).");
1123 /* this must be restored! */
1127 if(EmptyString(host
))
1129 conf_report_error("Warning -- spoof host empty.");
1133 if(strlen(host
) > HOSTLEN
)
1135 conf_report_error("Warning -- spoof host length invalid.");
1139 if(!valid_hostname(host
))
1141 conf_report_error("Warning -- invalid spoof (host).");
1145 rb_free(yy_aconf
->info
.name
);
1146 yy_aconf
->info
.name
= rb_strdup(data
);
1147 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1151 conf_set_auth_flags(void *data
)
1153 conf_parm_t
*args
= data
;
1155 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1159 conf_set_auth_redir_serv(void *data
)
1161 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1162 rb_free(yy_aconf
->info
.name
);
1163 yy_aconf
->info
.name
= rb_strdup(data
);
1167 conf_set_auth_redir_port(void *data
)
1169 int port
= *(unsigned int *) data
;
1171 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1172 yy_aconf
->port
= port
;
1176 conf_set_auth_class(void *data
)
1178 rb_free(yy_aconf
->className
);
1179 yy_aconf
->className
= rb_strdup(data
);
1182 /* ok, shared_oper handles the stacking, shared_flags handles adding
1183 * things.. so all we need to do when we start and end a shared block, is
1184 * clean up anything thats been left over.
1187 conf_cleanup_shared(struct TopConf
*tc
)
1189 rb_dlink_node
*ptr
, *next_ptr
;
1191 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1193 free_remote_conf(ptr
->data
);
1194 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1197 if(yy_shared
!= NULL
)
1199 free_remote_conf(yy_shared
);
1207 conf_set_shared_oper(void *data
)
1209 conf_parm_t
*args
= data
;
1210 const char *username
;
1213 if(yy_shared
!= NULL
)
1214 free_remote_conf(yy_shared
);
1216 yy_shared
= make_remote_conf();
1218 if(args
->next
!= NULL
)
1220 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1222 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1226 yy_shared
->server
= rb_strdup(args
->v
.string
);
1230 yy_shared
->server
= rb_strdup("*");
1232 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1234 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1238 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1240 conf_report_error("Ignoring shared::oper -- oper is not a user@host");
1244 username
= args
->v
.string
;
1248 yy_shared
->host
= rb_strdup("*");
1250 yy_shared
->host
= rb_strdup(p
);
1252 if(EmptyString(username
))
1253 yy_shared
->username
= rb_strdup("*");
1255 yy_shared
->username
= rb_strdup(username
);
1257 rb_dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1262 conf_set_shared_flags(void *data
)
1264 conf_parm_t
*args
= data
;
1266 rb_dlink_node
*ptr
, *next_ptr
;
1268 if(yy_shared
!= NULL
)
1269 free_remote_conf(yy_shared
);
1271 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1273 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1275 yy_shared
= ptr
->data
;
1277 yy_shared
->flags
= flags
;
1278 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1279 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1286 conf_begin_connect(struct TopConf
*tc
)
1289 free_server_conf(yy_server
);
1291 yy_server
= make_server_conf();
1292 yy_server
->port
= PORTNUM
;
1293 yy_server
->flags
|= SERVER_TB
;
1295 if(conf_cur_block_name
!= NULL
)
1296 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1302 conf_end_connect(struct TopConf
*tc
)
1304 if(EmptyString(yy_server
->name
))
1306 conf_report_error("Ignoring connect block -- missing name.");
1310 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1312 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1317 if((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
)) && EmptyString(yy_server
->certfp
))
1319 conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
1324 if(EmptyString(yy_server
->host
))
1326 conf_report_error("Ignoring connect block for %s -- missing host.",
1332 if(ServerConfCompressed(yy_server
))
1334 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1335 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1339 add_server_conf(yy_server
);
1340 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1347 conf_set_connect_host(void *data
)
1349 rb_free(yy_server
->host
);
1350 yy_server
->host
= rb_strdup(data
);
1351 if (strchr(yy_server
->host
, ':'))
1352 yy_server
->aftype
= AF_INET6
;
1356 conf_set_connect_vhost(void *data
)
1358 if(rb_inet_pton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1360 conf_report_error("Invalid netmask for server vhost (%s)",
1365 yy_server
->flags
|= SERVER_VHOSTED
;
1369 conf_set_connect_send_password(void *data
)
1371 if(yy_server
->spasswd
)
1373 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1374 rb_free(yy_server
->spasswd
);
1377 yy_server
->spasswd
= rb_strdup(data
);
1381 conf_set_connect_accept_password(void *data
)
1383 if(yy_server
->passwd
)
1385 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1386 rb_free(yy_server
->passwd
);
1388 yy_server
->passwd
= rb_strdup(data
);
1392 conf_set_connect_fingerprint(void *data
)
1394 if (yy_server
->certfp
)
1395 rb_free(yy_server
->certfp
);
1396 yy_server
->certfp
= rb_strdup((char *) data
);
1398 /* force SSL to be enabled if fingerprint is enabled. */
1399 yy_server
->flags
|= SERVER_SSL
;
1403 conf_set_connect_port(void *data
)
1405 int port
= *(unsigned int *) data
;
1410 yy_server
->port
= port
;
1414 conf_set_connect_aftype(void *data
)
1418 if(strcasecmp(aft
, "ipv4") == 0)
1419 yy_server
->aftype
= AF_INET
;
1421 else if(strcasecmp(aft
, "ipv6") == 0)
1422 yy_server
->aftype
= AF_INET6
;
1425 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1429 conf_set_connect_flags(void *data
)
1431 conf_parm_t
*args
= data
;
1433 /* note, we allow them to set compressed, then remove it later if
1434 * they do and LIBZ isnt available
1436 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1440 conf_set_connect_hub_mask(void *data
)
1442 struct remote_conf
*yy_hub
;
1444 if(EmptyString(yy_server
->name
))
1447 yy_hub
= make_remote_conf();
1448 yy_hub
->flags
= CONF_HUB
;
1450 yy_hub
->host
= rb_strdup(data
);
1451 yy_hub
->server
= rb_strdup(yy_server
->name
);
1452 rb_dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1456 conf_set_connect_leaf_mask(void *data
)
1458 struct remote_conf
*yy_leaf
;
1460 if(EmptyString(yy_server
->name
))
1463 yy_leaf
= make_remote_conf();
1464 yy_leaf
->flags
= CONF_LEAF
;
1466 yy_leaf
->host
= rb_strdup(data
);
1467 yy_leaf
->server
= rb_strdup(yy_server
->name
);
1468 rb_dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1472 conf_set_connect_class(void *data
)
1474 rb_free(yy_server
->class_name
);
1475 yy_server
->class_name
= rb_strdup(data
);
1479 conf_set_exempt_ip(void *data
)
1481 struct ConfItem
*yy_tmp
;
1483 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1485 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1489 yy_tmp
= make_conf();
1490 yy_tmp
->passwd
= rb_strdup("*");
1491 yy_tmp
->host
= rb_strdup(data
);
1492 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1493 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1497 conf_cleanup_cluster(struct TopConf
*tc
)
1499 rb_dlink_node
*ptr
, *next_ptr
;
1501 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1503 free_remote_conf(ptr
->data
);
1504 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1507 if(yy_shared
!= NULL
)
1509 free_remote_conf(yy_shared
);
1517 conf_set_cluster_name(void *data
)
1519 if(yy_shared
!= NULL
)
1520 free_remote_conf(yy_shared
);
1522 yy_shared
= make_remote_conf();
1523 yy_shared
->server
= rb_strdup(data
);
1524 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1530 conf_set_cluster_flags(void *data
)
1532 conf_parm_t
*args
= data
;
1534 rb_dlink_node
*ptr
, *next_ptr
;
1536 if(yy_shared
!= NULL
)
1537 free_remote_conf(yy_shared
);
1539 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1541 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1543 yy_shared
= ptr
->data
;
1544 yy_shared
->flags
= flags
;
1545 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1546 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1553 conf_set_general_havent_read_conf(void *data
)
1555 if(*(unsigned int *) data
)
1557 conf_report_error("You haven't read your config file properly.");
1559 ("There is a line in the example conf that will kill your server if not removed.");
1561 ("Consider actually reading/editing the conf file, and removing this line.");
1568 conf_set_general_hide_error_messages(void *data
)
1572 if(strcasecmp(val
, "yes") == 0)
1573 ConfigFileEntry
.hide_error_messages
= 2;
1574 else if(strcasecmp(val
, "opers") == 0)
1575 ConfigFileEntry
.hide_error_messages
= 1;
1576 else if(strcasecmp(val
, "no") == 0)
1577 ConfigFileEntry
.hide_error_messages
= 0;
1579 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1583 conf_set_general_kline_delay(void *data
)
1585 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1587 /* THIS MUST BE HERE to stop us being unable to check klines */
1592 conf_set_general_stats_k_oper_only(void *data
)
1596 if(strcasecmp(val
, "yes") == 0)
1597 ConfigFileEntry
.stats_k_oper_only
= 2;
1598 else if(strcasecmp(val
, "masked") == 0)
1599 ConfigFileEntry
.stats_k_oper_only
= 1;
1600 else if(strcasecmp(val
, "no") == 0)
1601 ConfigFileEntry
.stats_k_oper_only
= 0;
1603 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1607 conf_set_general_stats_i_oper_only(void *data
)
1611 if(strcasecmp(val
, "yes") == 0)
1612 ConfigFileEntry
.stats_i_oper_only
= 2;
1613 else if(strcasecmp(val
, "masked") == 0)
1614 ConfigFileEntry
.stats_i_oper_only
= 1;
1615 else if(strcasecmp(val
, "no") == 0)
1616 ConfigFileEntry
.stats_i_oper_only
= 0;
1618 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1622 conf_set_general_compression_level(void *data
)
1625 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1627 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1630 ("Invalid general::compression_level %d -- using default.",
1631 ConfigFileEntry
.compression_level
);
1632 ConfigFileEntry
.compression_level
= 0;
1635 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1640 conf_set_general_default_umodes(void *data
)
1643 int what
= MODE_ADD
, flag
;
1645 ConfigFileEntry
.default_umodes
= 0;
1646 for (pm
= (char *) data
; *pm
; pm
++)
1657 /* don't allow +o */
1665 if ((flag
= user_modes
[(unsigned char) *pm
]))
1667 /* Proper value has probably not yet been set
1668 * so don't check oper_only_umodes -- jilles */
1669 if (what
== MODE_ADD
)
1670 ConfigFileEntry
.default_umodes
|= flag
;
1672 ConfigFileEntry
.default_umodes
&= ~flag
;
1680 conf_set_general_oper_umodes(void *data
)
1682 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1686 conf_set_general_oper_only_umodes(void *data
)
1688 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1692 conf_set_general_oper_snomask(void *data
)
1695 int what
= MODE_ADD
, flag
;
1697 ConfigFileEntry
.oper_snomask
= 0;
1698 for (pm
= (char *) data
; *pm
; pm
++)
1710 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1712 if (what
== MODE_ADD
)
1713 ConfigFileEntry
.oper_snomask
|= flag
;
1715 ConfigFileEntry
.oper_snomask
&= ~flag
;
1723 conf_set_serverhide_links_delay(void *data
)
1725 int val
= *(unsigned int *) data
;
1727 ConfigServerHide
.links_delay
= val
;
1731 conf_begin_service(struct TopConf
*tc
)
1733 struct Client
*target_p
;
1736 RB_DLINK_FOREACH(ptr
, global_serv_list
.head
)
1738 target_p
= ptr
->data
;
1740 target_p
->flags
&= ~FLAGS_SERVICE
;
1747 conf_set_service_name(void *data
)
1749 struct Client
*target_p
;
1754 for(s
= data
; *s
!= '\0'; s
++)
1758 conf_report_error("Ignoring service::name "
1759 "-- bogus servername.");
1768 conf_report_error("Ignoring service::name -- must contain '.'");
1772 tmp
= rb_strdup(data
);
1773 rb_dlinkAddAlloc(tmp
, &service_list
);
1775 if((target_p
= find_server(NULL
, tmp
)))
1776 target_p
->flags
|= FLAGS_SERVICE
;
1780 conf_begin_alias(struct TopConf
*tc
)
1782 yy_alias
= rb_malloc(sizeof(struct alias_entry
));
1784 if (conf_cur_block_name
!= NULL
)
1785 yy_alias
->name
= rb_strdup(conf_cur_block_name
);
1787 yy_alias
->flags
= 0;
1794 conf_end_alias(struct TopConf
*tc
)
1796 if (yy_alias
== NULL
)
1799 if (yy_alias
->name
== NULL
)
1801 conf_report_error("Ignoring alias -- must have a name.");
1808 if (yy_alias
->target
== NULL
)
1810 conf_report_error("Ignoring alias -- must have a target.");
1817 irc_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1823 conf_set_alias_name(void *data
)
1825 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1828 yy_alias
->name
= rb_strdup(data
);
1832 conf_set_alias_target(void *data
)
1834 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1837 yy_alias
->target
= rb_strdup(data
);
1841 conf_set_blacklist_host(void *data
)
1843 yy_blacklist_host
= rb_strdup(data
);
1847 conf_set_blacklist_reason(void *data
)
1849 yy_blacklist_reason
= rb_strdup(data
);
1851 if (yy_blacklist_host
&& yy_blacklist_reason
)
1853 new_blacklist(yy_blacklist_host
, yy_blacklist_reason
);
1854 rb_free(yy_blacklist_host
);
1855 rb_free(yy_blacklist_reason
);
1856 yy_blacklist_host
= NULL
;
1857 yy_blacklist_reason
= NULL
;
1861 /* public functions */
1865 conf_report_error(const char *fmt
, ...)
1868 char msg
[IRCD_BUFSIZE
+ 1] = { 0 };
1871 rb_vsnprintf(msg
, IRCD_BUFSIZE
, fmt
, ap
);
1876 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
1880 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1881 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1885 conf_start_block(char *block
, char *name
)
1887 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
1889 conf_report_error("Configuration block '%s' is not defined.", block
);
1894 conf_cur_block_name
= rb_strdup(name
);
1896 conf_cur_block_name
= NULL
;
1898 if(conf_cur_block
->tc_sfunc
)
1899 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
1906 conf_end_block(struct TopConf
*tc
)
1909 return tc
->tc_efunc(tc
);
1911 rb_free(conf_cur_block_name
);
1916 conf_set_generic_int(void *data
, void *location
)
1918 *((int *) location
) = *((unsigned int *) data
);
1922 conf_set_generic_string(void *data
, int len
, void *location
)
1924 char **loc
= location
;
1927 if(len
&& strlen(input
) > (unsigned int)len
)
1931 *loc
= rb_strdup(input
);
1935 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
, int type
)
1937 struct ConfEntry
*cf
;
1943 if((cf
= find_conf_item(tc
, item
)) == NULL
)
1946 ("Non-existant configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
1950 /* if it takes one thing, make sure they only passed one thing,
1951 and handle as needed. */
1952 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
1955 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
1962 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
1964 /* if it expects a string value, but we got a yesno,
1967 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
1968 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
1970 value
->v
.list
->type
= CF_STRING
;
1972 if(cp
->v
.number
== 1)
1973 cp
->v
.string
= rb_strdup("yes");
1975 cp
->v
.string
= rb_strdup("no");
1978 /* maybe it's a CF_TIME and they passed CF_INT --
1979 should still be valid */
1980 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
1981 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
1984 ("Wrong type for %s::%s (expected %s, got %s)",
1985 tc
->tc_name
, (char *) item
,
1986 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
1991 if(cf
->cf_type
& CF_FLIST
)
1995 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
1998 /* just pass it the extended argument list */
1999 cf
->cf_func(value
->v
.list
);
2003 /* it's old-style, needs only one arg */
2004 switch (cf
->cf_type
)
2010 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2012 cf
->cf_func(&cp
->v
.number
);
2016 if(EmptyString(cp
->v
.string
))
2017 conf_report_error("Ignoring %s::%s -- empty field",
2020 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2022 cf
->cf_func(cp
->v
.string
);
2032 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2035 struct ConfEntry
*cf
;
2037 if((tc
= find_top_conf(topconf
)) == NULL
)
2040 if(find_conf_item(tc
, name
))
2043 cf
= rb_malloc(sizeof(struct ConfEntry
));
2050 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2056 remove_conf_item(const char *topconf
, const char *name
)
2059 struct ConfEntry
*cf
;
2062 if((tc
= find_top_conf(topconf
)) == NULL
)
2065 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2068 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2071 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2078 static struct ConfEntry conf_serverinfo_table
[] =
2080 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2081 { "network_desc", CF_QSTRING
, NULL
, 0, &ServerInfo
.network_desc
},
2082 { "helpchan", CF_QSTRING
, NULL
, 0, &ServerInfo
.helpchan
},
2083 { "helpurl", CF_QSTRING
, NULL
, 0, &ServerInfo
.helpurl
},
2084 { "hub", CF_YESNO
, NULL
, 0, &ServerInfo
.hub
},
2086 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2087 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2088 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2089 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2090 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2092 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2093 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2094 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2095 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2096 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2098 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2100 { "\0", 0, NULL
, 0, NULL
}
2103 static struct ConfEntry conf_admin_table
[] =
2105 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2106 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2107 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2108 { "\0", 0, NULL
, 0, NULL
}
2111 static struct ConfEntry conf_log_table
[] =
2113 { "fname_userlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_userlog
},
2114 { "fname_fuserlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_fuserlog
},
2115 { "fname_operlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_operlog
},
2116 { "fname_foperlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_foperlog
},
2117 { "fname_serverlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_serverlog
},
2118 { "fname_killlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_killlog
},
2119 { "fname_klinelog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_klinelog
},
2120 { "fname_operspylog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_operspylog
},
2121 { "fname_ioerrorlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_ioerrorlog
},
2122 { "\0", 0, NULL
, 0, NULL
}
2125 static struct ConfEntry conf_operator_table
[] =
2127 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2128 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2129 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2130 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2131 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2132 { "vhost", CF_QSTRING
, conf_set_oper_vhost
, 0, NULL
},
2133 { "swhois", CF_QSTRING
, conf_set_oper_swhois
, 0, NULL
},
2134 { "operstring", CF_QSTRING
, conf_set_oper_operstring
, 0, NULL
},
2135 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2136 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2137 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2138 { "\0", 0, NULL
, 0, NULL
}
2141 static struct ConfEntry conf_privset_table
[] =
2143 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2144 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2145 { "\0", 0, NULL
, 0, NULL
}
2148 static struct ConfEntry conf_class_table
[] =
2150 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2151 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2153 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2155 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2156 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2157 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2158 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2159 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2160 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2161 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2162 { "\0", 0, NULL
, 0, NULL
}
2165 static struct ConfEntry conf_auth_table
[] =
2167 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2168 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2169 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2170 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2171 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2172 { "autojoin", CF_QSTRING
, conf_set_auth_autojoin
, 0, NULL
},
2173 { "autojoin_opers", CF_QSTRING
, conf_set_auth_autojoin_opers
, 0, NULL
},
2174 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2175 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2176 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2177 { "\0", 0, NULL
, 0, NULL
}
2180 static struct ConfEntry conf_connect_table
[] =
2182 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2183 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2184 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2185 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2186 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2187 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2188 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2189 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2190 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
2191 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
2192 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2193 { "\0", 0, NULL
, 0, NULL
}
2196 static struct ConfEntry conf_general_table
[] =
2198 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2199 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2200 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2201 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
2202 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2203 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2204 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
2205 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2206 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2207 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2209 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2210 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2211 { "default_operhost", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operhost
},
2212 { "static_quit", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.static_quit
},
2213 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2214 { "egdpool_path", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.egdpool_path
},
2215 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2216 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2217 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2219 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2220 { "use_part_messages", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_part_messages
},
2221 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2222 { "hide_channel_below_users", CF_INT
, NULL
, 0, &ConfigFileEntry
.hide_channel_below_users
},
2223 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2224 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2225 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2227 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2228 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2229 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2230 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2231 { "client_flood", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood
},
2232 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2233 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2234 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2235 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2236 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2237 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2238 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2239 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2240 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2241 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2242 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2243 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2244 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2245 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2246 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2247 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2248 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2249 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2250 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2251 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2252 { "true_no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.true_no_oper_flood
},
2253 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2254 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2255 { "secret_channels_in_whois", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.secret_channels_in_whois
},
2256 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2257 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2258 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2259 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2260 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2261 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2262 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2263 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2264 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2265 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2266 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2267 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2268 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2269 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2270 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2271 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2272 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2273 { "use_egd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_egd
},
2274 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2275 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2276 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2277 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2278 { "expire_override_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.expire_override_time
},
2279 { "\0", 0, NULL
, 0, NULL
}
2282 static struct ConfEntry conf_channel_table
[] =
2284 { "autochanmodes", CF_QSTRING
, NULL
, 0, &ConfigChannel
.autochanmodes
},
2285 { "exemptchanops", CF_QSTRING
, NULL
, 0, &ConfigChannel
.exemptchanops
},
2286 { "disabledmodes", CF_QSTRING
, NULL
, 0, &ConfigChannel
.disabledmodes
},
2287 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2288 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2289 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2290 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2291 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2292 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2293 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2294 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2295 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2296 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2297 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2298 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2299 { "cycle_host_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.cycle_host_change
},
2300 { "host_in_topic", CF_YESNO
, NULL
, 0, &ConfigChannel
.host_in_topic
},
2301 { "admin_on_channel_create", CF_YESNO
, NULL
, 0, &ConfigChannel
.admin_on_channel_create
},
2302 { "use_halfop", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_halfop
},
2303 { "use_admin", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_admin
},
2304 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2305 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2306 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2307 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2308 { "use_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_local_channels
},
2309 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2310 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2311 { "exempt_cmode_c", CF_YESNO
, NULL
, 0, &ConfigChannel
.exempt_cmode_c
},
2312 { "exempt_cmode_C", CF_YESNO
, NULL
, 0, &ConfigChannel
.exempt_cmode_C
},
2313 { "exempt_cmode_D", CF_YESNO
, NULL
, 0, &ConfigChannel
.exempt_cmode_D
},
2314 { "exempt_cmode_T", CF_YESNO
, NULL
, 0, &ConfigChannel
.exempt_cmode_T
},
2315 { "exempt_cmode_N", CF_YESNO
, NULL
, 0, &ConfigChannel
.exempt_cmode_N
},
2316 { "exempt_cmode_G", CF_YESNO
, NULL
, 0, &ConfigChannel
.exempt_cmode_G
},
2317 { "exempt_cmode_K", CF_YESNO
, NULL
, 0, &ConfigChannel
.exempt_cmode_K
},
2318 { "\0", 0, NULL
, 0, NULL
}
2321 static struct ConfEntry conf_serverhide_table
[] =
2323 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2324 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2325 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2326 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2327 { "\0", 0, NULL
, 0, NULL
}
2334 add_top_conf("modules", NULL
, NULL
, NULL
);
2335 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2336 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2338 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2339 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2340 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2341 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2342 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2343 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2345 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2346 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2347 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2348 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2349 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2351 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2353 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
2354 add_conf_item("shared", "oper", CF_QSTRING
|CF_FLIST
, conf_set_shared_oper
);
2355 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
2357 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2359 add_top_conf("exempt", NULL
, NULL
, NULL
);
2360 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2362 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2363 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2364 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2366 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2367 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2368 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2370 add_top_conf("service", conf_begin_service
, NULL
, NULL
);
2371 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2373 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2374 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2375 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2377 add_top_conf("blacklist", NULL
, NULL
, NULL
);
2378 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_blacklist_host
);
2379 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_blacklist_reason
);