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"
34 #define CF_TYPE(x) ((x) & CF_MTYPE)
36 static int yy_defer_accept
= 1;
38 struct TopConf
*conf_cur_block
;
39 static char *conf_cur_block_name
= NULL
;
41 static rb_dlink_list conf_items
;
43 static struct ConfItem
*yy_aconf
= NULL
;
45 static struct Class
*yy_class
= NULL
;
47 static struct remote_conf
*yy_shared
= NULL
;
48 static struct server_conf
*yy_server
= NULL
;
50 static rb_dlink_list yy_aconf_list
;
51 static rb_dlink_list yy_oper_list
;
52 static rb_dlink_list yy_shared_list
;
53 static rb_dlink_list yy_cluster_list
;
54 static struct oper_conf
*yy_oper
= NULL
;
56 static struct alias_entry
*yy_alias
= NULL
;
58 static char *yy_blacklist_host
= NULL
;
59 static char *yy_blacklist_reason
= NULL
;
60 static int yy_blacklist_ipv4
= 1;
61 static int yy_blacklist_ipv6
= 0;
62 static rb_dlink_list yy_blacklist_filters
;
64 static char *yy_privset_extends
= NULL
;
67 conf_strtype(int type
)
69 switch (CF_TYPE(type
))
72 return "integer value";
74 return "unquoted string";
76 return "yes/no value";
78 return "quoted string";
80 return "time/size value";
82 return "unknown type";
87 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
88 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
92 tc
= rb_malloc(sizeof(struct TopConf
));
97 tc
->tc_entries
= items
;
99 rb_dlinkAddAlloc(tc
, &conf_items
);
104 find_top_conf(const char *name
)
109 RB_DLINK_FOREACH(d
, conf_items
.head
)
112 if(strcasecmp(tc
->tc_name
, name
) == 0)
121 find_conf_item(const struct TopConf
*top
, const char *name
)
123 struct ConfEntry
*cf
;
130 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
132 cf
= &top
->tc_entries
[i
];
134 if(!strcasecmp(cf
->cf_name
, name
))
139 RB_DLINK_FOREACH(d
, top
->tc_items
.head
)
142 if(strcasecmp(cf
->cf_name
, name
) == 0)
150 remove_top_conf(char *name
)
155 if((tc
= find_top_conf(name
)) == NULL
)
158 if((ptr
= rb_dlinkFind(tc
, &conf_items
)) == NULL
)
161 rb_dlinkDestroy(ptr
, &conf_items
);
168 conf_set_serverinfo_name(void *data
)
170 if(ServerInfo
.name
== NULL
)
175 for(s
= data
; *s
!= '\0'; s
++)
179 conf_report_error("Ignoring serverinfo::name "
180 "-- bogus servername.");
189 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
197 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
201 /* the ircd will exit() in main() if we dont set one */
202 if(strlen(s
) <= HOSTLEN
)
203 ServerInfo
.name
= rb_strdup((char *) data
);
208 conf_set_serverinfo_sid(void *data
)
212 if(ServerInfo
.sid
[0] == '\0')
214 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
215 !IsIdChar(sid
[2]) || sid
[3] != '\0')
217 conf_report_error("Ignoring serverinfo::sid "
222 strcpy(ServerInfo
.sid
, sid
);
227 conf_set_serverinfo_network_name(void *data
)
231 if((p
= strchr((char *) data
, ' ')))
234 rb_free(ServerInfo
.network_name
);
235 ServerInfo
.network_name
= rb_strdup((char *) data
);
239 conf_set_serverinfo_vhost(void *data
)
241 if(rb_inet_pton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
243 conf_report_error("Invalid netmask for server IPv4 vhost (%s)", (char *) data
);
246 ServerInfo
.ip
.sin_family
= AF_INET
;
247 ServerInfo
.specific_ipv4_vhost
= 1;
251 conf_set_serverinfo_vhost6(void *data
)
254 if(rb_inet_pton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
256 conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data
);
260 ServerInfo
.specific_ipv6_vhost
= 1;
261 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
263 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
268 conf_set_serverinfo_nicklen(void *data
)
270 ConfigFileEntry
.nicklen
= (*(unsigned int *) data
) + 1;
272 if (ConfigFileEntry
.nicklen
> NICKLEN
)
274 conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)",
275 ConfigFileEntry
.nicklen
- 1, NICKLEN
- 1);
276 ConfigFileEntry
.nicklen
= NICKLEN
;
278 else if (ConfigFileEntry
.nicklen
< 9 + 1)
280 conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9",
281 ConfigFileEntry
.nicklen
- 1);
282 ConfigFileEntry
.nicklen
= 9 + 1;
287 conf_set_modules_module(void *data
)
291 m_bn
= rb_basename((char *) data
);
293 if(findmodule_byname(m_bn
) == -1)
294 load_one_module((char *) data
, 0);
300 conf_set_modules_path(void *data
)
302 mod_add_path((char *) data
);
312 static struct mode_table umode_table
[] = {
313 {"callerid", UMODE_CALLERID
},
314 {"deaf", UMODE_DEAF
},
315 {"invisible", UMODE_INVISIBLE
},
316 {"locops", UMODE_LOCOPS
},
317 {"noforward", UMODE_NOFORWARD
},
318 {"regonlymsg", UMODE_REGONLYMSG
},
319 {"servnotice", UMODE_SERVNOTICE
},
320 {"wallop", UMODE_WALLOP
},
321 {"operwall", UMODE_OPERWALL
},
325 static struct mode_table oper_table
[] = {
326 {"encrypted", OPER_ENCRYPTED
},
327 {"need_ssl", OPER_NEEDSSL
},
331 static struct mode_table auth_table
[] = {
332 {"encrypted", CONF_FLAGS_ENCRYPTED
},
333 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
334 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
335 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
336 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
337 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
338 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
339 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
340 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
341 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
342 {"no_tilde", CONF_FLAGS_NO_TILDE
},
343 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
344 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
345 {"need_ssl", CONF_FLAGS_NEED_SSL
},
346 {"need_sasl", CONF_FLAGS_NEED_SASL
},
347 {"extend_chans", CONF_FLAGS_EXTEND_CHANS
},
351 static struct mode_table connect_table
[] = {
352 { "autoconn", SERVER_AUTOCONN
},
353 { "compressed", SERVER_COMPRESSED
},
354 { "encrypted", SERVER_ENCRYPTED
},
355 { "topicburst", SERVER_TB
},
356 { "ssl", SERVER_SSL
},
360 static struct mode_table cluster_table
[] = {
361 { "kline", SHARED_PKLINE
},
362 { "tkline", SHARED_TKLINE
},
363 { "unkline", SHARED_UNKLINE
},
364 { "locops", SHARED_LOCOPS
},
365 { "xline", SHARED_PXLINE
},
366 { "txline", SHARED_TXLINE
},
367 { "unxline", SHARED_UNXLINE
},
368 { "resv", SHARED_PRESV
},
369 { "tresv", SHARED_TRESV
},
370 { "unresv", SHARED_UNRESV
},
371 { "all", CLUSTER_ALL
},
375 static struct mode_table shared_table
[] =
377 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
378 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
379 { "resv", SHARED_PRESV
|SHARED_TRESV
},
380 { "dline", SHARED_PDLINE
|SHARED_TDLINE
},
381 { "tdline", SHARED_TDLINE
},
382 { "pdline", SHARED_PDLINE
},
383 { "undline", SHARED_UNDLINE
},
384 { "tkline", SHARED_TKLINE
},
385 { "unkline", SHARED_UNKLINE
},
386 { "txline", SHARED_TXLINE
},
387 { "unxline", SHARED_UNXLINE
},
388 { "tresv", SHARED_TRESV
},
389 { "unresv", SHARED_UNRESV
},
390 { "locops", SHARED_LOCOPS
},
391 { "rehash", SHARED_REHASH
},
392 { "grant", SHARED_GRANT
},
393 { "die", SHARED_DIE
},
394 { "module", SHARED_MODULE
},
395 { "all", SHARED_ALL
},
402 find_umode(struct mode_table
*tab
, const char *name
)
406 for (i
= 0; tab
[i
].name
; i
++)
408 if(strcmp(tab
[i
].name
, name
) == 0)
416 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
418 for (; args
; args
= args
->next
)
424 if(CF_TYPE(args
->type
) != CF_STRING
)
426 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
430 umode
= args
->v
.string
;
438 mode
= find_umode(tab
, umode
);
442 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
459 conf_set_privset_extends(void *data
)
461 yy_privset_extends
= rb_strdup((char *) data
);
465 conf_set_privset_privs(void *data
)
468 conf_parm_t
*args
= data
;
470 for (; args
; args
= args
->next
)
473 privs
= rb_strdup(args
->v
.string
);
476 char *privs_old
= privs
;
478 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
479 strcpy(privs
, privs_old
);
481 strcat(privs
, args
->v
.string
);
489 if (yy_privset_extends
)
491 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
495 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
497 set
= privilegeset_get("default");
500 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
502 rb_free(yy_privset_extends
);
503 yy_privset_extends
= NULL
;
506 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
513 conf_begin_oper(struct TopConf
*tc
)
516 rb_dlink_node
*next_ptr
;
520 free_oper_conf(yy_oper
);
524 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
526 free_oper_conf(ptr
->data
);
527 rb_dlinkDestroy(ptr
, &yy_oper_list
);
530 yy_oper
= make_oper_conf();
531 yy_oper
->flags
|= OPER_ENCRYPTED
;
537 conf_end_oper(struct TopConf
*tc
)
539 struct oper_conf
*yy_tmpoper
;
541 rb_dlink_node
*next_ptr
;
543 if(conf_cur_block_name
!= NULL
)
545 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
546 conf_cur_block_name
[OPERNICKLEN
] = '\0';
548 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
551 if(EmptyString(yy_oper
->name
))
553 conf_report_error("Ignoring operator block -- missing name.");
557 #ifdef HAVE_LIBCRYPTO
558 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
560 if(EmptyString(yy_oper
->passwd
))
563 conf_report_error("Ignoring operator block for %s -- missing password",
569 if (!yy_oper
->privset
)
570 yy_oper
->privset
= privilegeset_get("default");
572 /* now, yy_oper_list contains a stack of oper_conf's with just user
573 * and host in, yy_oper contains the rest of the information which
574 * we need to copy into each element in yy_oper_list
576 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
578 yy_tmpoper
= ptr
->data
;
580 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
582 /* could be an rsa key instead.. */
583 if(!EmptyString(yy_oper
->passwd
))
584 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
586 yy_tmpoper
->flags
= yy_oper
->flags
;
587 yy_tmpoper
->umodes
= yy_oper
->umodes
;
588 yy_tmpoper
->snomask
= yy_oper
->snomask
;
589 yy_tmpoper
->privset
= yy_oper
->privset
;
591 #ifdef HAVE_LIBCRYPTO
592 if(yy_oper
->rsa_pubkey_file
)
596 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
598 conf_report_error("Ignoring operator block for %s -- "
599 "rsa_public_key_file cant be opened",
604 yy_tmpoper
->rsa_pubkey
=
605 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
607 (void)BIO_set_close(file
, BIO_CLOSE
);
610 if(yy_tmpoper
->rsa_pubkey
== NULL
)
612 conf_report_error("Ignoring operator block for %s -- "
613 "rsa_public_key_file key invalid; check syntax",
619 if(!EmptyString(yy_oper
->certfp
))
620 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
623 /* all is ok, put it on oper_conf_list */
624 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
627 free_oper_conf(yy_oper
);
634 conf_set_oper_flags(void *data
)
636 conf_parm_t
*args
= data
;
638 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
642 conf_set_oper_fingerprint(void *data
)
645 rb_free(yy_oper
->certfp
);
646 yy_oper
->certfp
= rb_strdup((char *) data
);
650 conf_set_oper_privset(void *data
)
652 yy_oper
->privset
= privilegeset_get((char *) data
);
656 conf_set_oper_user(void *data
)
658 struct oper_conf
*yy_tmpoper
;
660 char *host
= (char *) data
;
662 yy_tmpoper
= make_oper_conf();
664 if((p
= strchr(host
, '@')))
668 yy_tmpoper
->username
= rb_strdup(host
);
669 yy_tmpoper
->host
= rb_strdup(p
);
674 yy_tmpoper
->username
= rb_strdup("*");
675 yy_tmpoper
->host
= rb_strdup(host
);
678 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
680 conf_report_error("Ignoring user -- missing username/host");
681 free_oper_conf(yy_tmpoper
);
685 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
689 conf_set_oper_password(void *data
)
693 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
694 rb_free(yy_oper
->passwd
);
697 yy_oper
->passwd
= rb_strdup((char *) data
);
701 conf_set_oper_rsa_public_key_file(void *data
)
703 #ifdef HAVE_LIBCRYPTO
704 rb_free(yy_oper
->rsa_pubkey_file
);
705 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
707 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
712 conf_set_oper_umodes(void *data
)
714 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
718 conf_set_oper_snomask(void *data
)
720 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
724 conf_begin_class(struct TopConf
*tc
)
727 free_class(yy_class
);
729 yy_class
= make_class();
734 conf_end_class(struct TopConf
*tc
)
736 if(conf_cur_block_name
!= NULL
)
737 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
739 if(EmptyString(yy_class
->class_name
))
741 conf_report_error("Ignoring connect block -- missing name.");
751 conf_set_class_ping_time(void *data
)
753 yy_class
->ping_freq
= *(unsigned int *) data
;
757 conf_set_class_cidr_ipv4_bitlen(void *data
)
759 unsigned int maxsize
= 32;
760 if(*(unsigned int *) data
> maxsize
)
762 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
763 *(unsigned int *) data
, maxsize
);
765 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
771 conf_set_class_cidr_ipv6_bitlen(void *data
)
773 unsigned int maxsize
= 128;
774 if(*(unsigned int *) data
> maxsize
)
776 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
777 *(unsigned int *) data
, maxsize
);
779 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
785 conf_set_class_number_per_cidr(void *data
)
787 yy_class
->cidr_amount
= *(unsigned int *) data
;
791 conf_set_class_number_per_ip(void *data
)
793 yy_class
->max_local
= *(unsigned int *) data
;
798 conf_set_class_number_per_ip_global(void *data
)
800 yy_class
->max_global
= *(unsigned int *) data
;
804 conf_set_class_number_per_ident(void *data
)
806 yy_class
->max_ident
= *(unsigned int *) data
;
810 conf_set_class_connectfreq(void *data
)
812 yy_class
->con_freq
= *(unsigned int *) data
;
816 conf_set_class_max_number(void *data
)
818 yy_class
->max_total
= *(unsigned int *) data
;
822 conf_set_class_sendq(void *data
)
824 yy_class
->max_sendq
= *(unsigned int *) data
;
827 static char *listener_address
;
830 conf_begin_listen(struct TopConf
*tc
)
832 rb_free(listener_address
);
833 listener_address
= NULL
;
838 conf_end_listen(struct TopConf
*tc
)
840 rb_free(listener_address
);
841 listener_address
= NULL
;
846 conf_set_listen_defer_accept(void *data
)
848 yy_defer_accept
= *(unsigned int *) data
;
852 conf_set_listen_port_both(void *data
, int ssl
)
854 conf_parm_t
*args
= data
;
855 for (; args
; args
= args
->next
)
857 if(CF_TYPE(args
->type
) != CF_INT
)
860 ("listener::port argument is not an integer " "-- ignoring.");
863 if(listener_address
== NULL
)
867 conf_report_error("listener 'ANY/%d': support for plaintext listeners is being deprecated and may be removed in a future release. "
868 "It is suggested that users be migrated to SSL/TLS connections.", args
->v
.number
);
870 add_listener(args
->v
.number
, listener_address
, AF_INET
, ssl
, ssl
|| yy_defer_accept
);
872 add_listener(args
->v
.number
, listener_address
, AF_INET6
, ssl
, ssl
|| yy_defer_accept
);
879 if(strchr(listener_address
, ':') != NULL
)
887 conf_report_error("listener '%s/%d': support for plaintext listeners is being deprecated and may be removed in a future release. "
888 "It is suggested that users be migrated to SSL/TLS connections.", listener_address
, args
->v
.number
);
891 add_listener(args
->v
.number
, listener_address
, family
, ssl
, ssl
|| yy_defer_accept
);
898 conf_set_listen_port(void *data
)
900 conf_set_listen_port_both(data
, 0);
904 conf_set_listen_sslport(void *data
)
906 conf_set_listen_port_both(data
, 1);
910 conf_set_listen_address(void *data
)
912 rb_free(listener_address
);
913 listener_address
= rb_strdup(data
);
917 conf_begin_auth(struct TopConf
*tc
)
920 rb_dlink_node
*next_ptr
;
925 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
927 free_conf(ptr
->data
);
928 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
931 yy_aconf
= make_conf();
932 yy_aconf
->status
= CONF_CLIENT
;
938 conf_end_auth(struct TopConf
*tc
)
940 struct ConfItem
*yy_tmp
, *found_conf
;
942 rb_dlink_node
*next_ptr
;
944 if(EmptyString(yy_aconf
->info
.name
))
945 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
947 /* didnt even get one ->host? */
948 if(EmptyString(yy_aconf
->host
))
950 conf_report_error("Ignoring auth block -- missing user@host");
954 /* so the stacking works in order.. */
955 collapse(yy_aconf
->user
);
956 collapse(yy_aconf
->host
);
957 conf_add_class_to_conf(yy_aconf
);
958 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
959 conf_report_error("Ignoring redundant auth block (after *@*)");
960 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
961 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
962 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
963 conf_report_error("Ignoring duplicate auth block for %s@%s",
964 yy_aconf
->user
, yy_aconf
->host
);
966 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
968 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
973 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
975 if(yy_aconf
->spasswd
)
976 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
978 /* this will always exist.. */
979 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
981 if(yy_aconf
->className
)
982 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
984 yy_tmp
->flags
= yy_aconf
->flags
;
985 yy_tmp
->port
= yy_aconf
->port
;
987 collapse(yy_tmp
->user
);
988 collapse(yy_tmp
->host
);
990 conf_add_class_to_conf(yy_tmp
);
992 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
993 conf_report_error("Ignoring redundant auth block (after *@*)");
994 else if ((found_conf
= find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
)) &&
995 (!found_conf
->spasswd
|| (yy_tmp
->spasswd
&&
996 0 == irccmp(found_conf
->spasswd
, yy_tmp
->spasswd
))))
997 conf_report_error("Ignoring duplicate auth block for %s@%s",
998 yy_tmp
->user
, yy_tmp
->host
);
1000 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
1001 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1009 conf_set_auth_user(void *data
)
1011 struct ConfItem
*yy_tmp
;
1014 /* The first user= line doesn't allocate a new conf */
1015 if(!EmptyString(yy_aconf
->host
))
1017 yy_tmp
= make_conf();
1018 yy_tmp
->status
= CONF_CLIENT
;
1023 if((p
= strchr(data
, '@')))
1027 yy_tmp
->user
= rb_strdup(data
);
1028 yy_tmp
->host
= rb_strdup(p
);
1032 yy_tmp
->user
= rb_strdup("*");
1033 yy_tmp
->host
= rb_strdup(data
);
1036 if(yy_aconf
!= yy_tmp
)
1037 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1041 conf_set_auth_auth_user(void *data
)
1043 if(yy_aconf
->spasswd
)
1044 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1045 rb_free(yy_aconf
->spasswd
);
1046 yy_aconf
->spasswd
= rb_strdup(data
);
1050 conf_set_auth_passwd(void *data
)
1052 if(yy_aconf
->passwd
)
1053 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1054 rb_free(yy_aconf
->passwd
);
1055 yy_aconf
->passwd
= rb_strdup(data
);
1059 conf_set_auth_spoof(void *data
)
1067 /* user@host spoof */
1068 if((p
= strchr(host
, '@')) != NULL
)
1074 if(EmptyString(user
))
1076 conf_report_error("Warning -- spoof ident empty.");
1080 if(strlen(user
) > USERLEN
)
1082 conf_report_error("Warning -- spoof ident length invalid.");
1086 if(!valid_username(user
))
1088 conf_report_error("Warning -- invalid spoof (ident).");
1092 /* this must be restored! */
1096 if(EmptyString(host
))
1098 conf_report_error("Warning -- spoof host empty.");
1102 if(strlen(host
) > HOSTLEN
)
1104 conf_report_error("Warning -- spoof host length invalid.");
1108 if(!valid_hostname(host
))
1110 conf_report_error("Warning -- invalid spoof (host).");
1114 rb_free(yy_aconf
->info
.name
);
1115 yy_aconf
->info
.name
= rb_strdup(data
);
1116 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1120 conf_set_auth_flags(void *data
)
1122 conf_parm_t
*args
= data
;
1124 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1128 conf_set_auth_redir_serv(void *data
)
1130 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1131 rb_free(yy_aconf
->info
.name
);
1132 yy_aconf
->info
.name
= rb_strdup(data
);
1136 conf_set_auth_redir_port(void *data
)
1138 int port
= *(unsigned int *) data
;
1140 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1141 yy_aconf
->port
= port
;
1145 conf_set_auth_class(void *data
)
1147 rb_free(yy_aconf
->className
);
1148 yy_aconf
->className
= rb_strdup(data
);
1151 /* ok, shared_oper handles the stacking, shared_flags handles adding
1152 * things.. so all we need to do when we start and end a shared block, is
1153 * clean up anything thats been left over.
1156 conf_cleanup_shared(struct TopConf
*tc
)
1158 rb_dlink_node
*ptr
, *next_ptr
;
1160 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1162 free_remote_conf(ptr
->data
);
1163 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1166 if(yy_shared
!= NULL
)
1168 free_remote_conf(yy_shared
);
1176 conf_set_shared_oper(void *data
)
1178 conf_parm_t
*args
= data
;
1179 const char *username
;
1182 if(yy_shared
!= NULL
)
1183 free_remote_conf(yy_shared
);
1185 yy_shared
= make_remote_conf();
1187 if(args
->next
!= NULL
)
1189 if(CF_TYPE(args
->type
) != CF_QSTRING
)
1191 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1195 yy_shared
->server
= rb_strdup(args
->v
.string
);
1199 yy_shared
->server
= rb_strdup("*");
1201 if(CF_TYPE(args
->type
) != CF_QSTRING
)
1203 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1207 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1209 conf_report_error("Ignoring shard::oper -- oper is not a user@host");
1213 username
= args
->v
.string
;
1217 yy_shared
->host
= rb_strdup("*");
1219 yy_shared
->host
= rb_strdup(p
);
1221 if(EmptyString(username
))
1222 yy_shared
->username
= rb_strdup("*");
1224 yy_shared
->username
= rb_strdup(username
);
1226 rb_dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1231 conf_set_shared_flags(void *data
)
1233 conf_parm_t
*args
= data
;
1235 rb_dlink_node
*ptr
, *next_ptr
;
1237 if(yy_shared
!= NULL
)
1238 free_remote_conf(yy_shared
);
1240 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1242 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1244 yy_shared
= ptr
->data
;
1246 yy_shared
->flags
= flags
;
1247 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1248 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1255 conf_begin_connect(struct TopConf
*tc
)
1258 free_server_conf(yy_server
);
1260 yy_server
= make_server_conf();
1261 yy_server
->port
= PORTNUM
;
1262 yy_server
->flags
|= SERVER_TB
;
1264 if(conf_cur_block_name
!= NULL
)
1265 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1271 conf_end_connect(struct TopConf
*tc
)
1273 if(EmptyString(yy_server
->name
))
1275 conf_report_error("Ignoring connect block -- missing name.");
1279 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1281 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1286 if((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
)) && EmptyString(yy_server
->certfp
))
1288 conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
1293 if(EmptyString(yy_server
->host
))
1295 conf_report_error("Ignoring connect block for %s -- missing host.",
1301 if(ServerConfCompressed(yy_server
))
1303 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1304 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1308 add_server_conf(yy_server
);
1309 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1316 conf_set_connect_host(void *data
)
1318 rb_free(yy_server
->host
);
1319 yy_server
->host
= rb_strdup(data
);
1320 if (strchr(yy_server
->host
, ':'))
1321 yy_server
->aftype
= AF_INET6
;
1325 conf_set_connect_vhost(void *data
)
1327 if(rb_inet_pton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1329 conf_report_error("Invalid netmask for server vhost (%s)",
1334 yy_server
->flags
|= SERVER_VHOSTED
;
1338 conf_set_connect_send_password(void *data
)
1340 if(yy_server
->spasswd
)
1342 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1343 rb_free(yy_server
->spasswd
);
1346 yy_server
->spasswd
= rb_strdup(data
);
1350 conf_set_connect_accept_password(void *data
)
1352 if(yy_server
->passwd
)
1354 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1355 rb_free(yy_server
->passwd
);
1357 yy_server
->passwd
= rb_strdup(data
);
1361 conf_set_connect_fingerprint(void *data
)
1363 if (yy_server
->certfp
)
1364 rb_free(yy_server
->certfp
);
1365 yy_server
->certfp
= rb_strdup((char *) data
);
1367 /* force SSL to be enabled if fingerprint is enabled. */
1368 yy_server
->flags
|= SERVER_SSL
;
1372 conf_set_connect_port(void *data
)
1374 int port
= *(unsigned int *) data
;
1379 yy_server
->port
= port
;
1383 conf_set_connect_aftype(void *data
)
1387 if(strcasecmp(aft
, "ipv4") == 0)
1388 yy_server
->aftype
= AF_INET
;
1390 else if(strcasecmp(aft
, "ipv6") == 0)
1391 yy_server
->aftype
= AF_INET6
;
1394 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1398 conf_set_connect_flags(void *data
)
1400 conf_parm_t
*args
= data
;
1402 /* note, we allow them to set compressed, then remove it later if
1403 * they do and LIBZ isnt available
1405 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1409 conf_set_connect_hub_mask(void *data
)
1411 struct remote_conf
*yy_hub
;
1413 if(EmptyString(yy_server
->name
))
1416 yy_hub
= make_remote_conf();
1417 yy_hub
->flags
= CONF_HUB
;
1419 yy_hub
->host
= rb_strdup(data
);
1420 yy_hub
->server
= rb_strdup(yy_server
->name
);
1421 rb_dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1425 conf_set_connect_leaf_mask(void *data
)
1427 struct remote_conf
*yy_leaf
;
1429 if(EmptyString(yy_server
->name
))
1432 yy_leaf
= make_remote_conf();
1433 yy_leaf
->flags
= CONF_LEAF
;
1435 yy_leaf
->host
= rb_strdup(data
);
1436 yy_leaf
->server
= rb_strdup(yy_server
->name
);
1437 rb_dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1441 conf_set_connect_class(void *data
)
1443 rb_free(yy_server
->class_name
);
1444 yy_server
->class_name
= rb_strdup(data
);
1448 conf_set_exempt_ip(void *data
)
1450 struct ConfItem
*yy_tmp
;
1452 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1454 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1458 yy_tmp
= make_conf();
1459 yy_tmp
->passwd
= rb_strdup("*");
1460 yy_tmp
->host
= rb_strdup(data
);
1461 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1462 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1466 conf_cleanup_cluster(struct TopConf
*tc
)
1468 rb_dlink_node
*ptr
, *next_ptr
;
1470 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1472 free_remote_conf(ptr
->data
);
1473 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1476 if(yy_shared
!= NULL
)
1478 free_remote_conf(yy_shared
);
1486 conf_set_cluster_name(void *data
)
1488 if(yy_shared
!= NULL
)
1489 free_remote_conf(yy_shared
);
1491 yy_shared
= make_remote_conf();
1492 yy_shared
->server
= rb_strdup(data
);
1493 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1499 conf_set_cluster_flags(void *data
)
1501 conf_parm_t
*args
= data
;
1503 rb_dlink_node
*ptr
, *next_ptr
;
1505 if(yy_shared
!= NULL
)
1506 free_remote_conf(yy_shared
);
1508 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1510 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1512 yy_shared
= ptr
->data
;
1513 yy_shared
->flags
= flags
;
1514 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1515 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1522 conf_set_general_havent_read_conf(void *data
)
1524 if(*(unsigned int *) data
)
1526 conf_report_error("You haven't read your config file properly.");
1528 ("There is a line in the example conf that will kill your server if not removed.");
1530 ("Consider actually reading/editing the conf file, and removing this line.");
1537 conf_set_general_hide_error_messages(void *data
)
1541 if(strcasecmp(val
, "yes") == 0)
1542 ConfigFileEntry
.hide_error_messages
= 2;
1543 else if(strcasecmp(val
, "opers") == 0)
1544 ConfigFileEntry
.hide_error_messages
= 1;
1545 else if(strcasecmp(val
, "no") == 0)
1546 ConfigFileEntry
.hide_error_messages
= 0;
1548 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1552 conf_set_general_kline_delay(void *data
)
1554 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1556 /* THIS MUST BE HERE to stop us being unable to check klines */
1561 conf_set_general_stats_k_oper_only(void *data
)
1565 if(strcasecmp(val
, "yes") == 0)
1566 ConfigFileEntry
.stats_k_oper_only
= 2;
1567 else if(strcasecmp(val
, "masked") == 0)
1568 ConfigFileEntry
.stats_k_oper_only
= 1;
1569 else if(strcasecmp(val
, "no") == 0)
1570 ConfigFileEntry
.stats_k_oper_only
= 0;
1572 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1576 conf_set_general_stats_i_oper_only(void *data
)
1580 if(strcasecmp(val
, "yes") == 0)
1581 ConfigFileEntry
.stats_i_oper_only
= 2;
1582 else if(strcasecmp(val
, "masked") == 0)
1583 ConfigFileEntry
.stats_i_oper_only
= 1;
1584 else if(strcasecmp(val
, "no") == 0)
1585 ConfigFileEntry
.stats_i_oper_only
= 0;
1587 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1591 conf_set_general_compression_level(void *data
)
1594 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1596 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1599 ("Invalid general::compression_level %d -- using default.",
1600 ConfigFileEntry
.compression_level
);
1601 ConfigFileEntry
.compression_level
= 0;
1604 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1609 conf_set_general_default_umodes(void *data
)
1612 int what
= MODE_ADD
, flag
;
1614 ConfigFileEntry
.default_umodes
= 0;
1615 for (pm
= (char *) data
; *pm
; pm
++)
1626 /* don't allow +o */
1634 if ((flag
= user_modes
[(unsigned char) *pm
]))
1636 /* Proper value has probably not yet been set
1637 * so don't check oper_only_umodes -- jilles */
1638 if (what
== MODE_ADD
)
1639 ConfigFileEntry
.default_umodes
|= flag
;
1641 ConfigFileEntry
.default_umodes
&= ~flag
;
1649 conf_set_general_oper_umodes(void *data
)
1651 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1655 conf_set_general_certfp_method(void *data
)
1657 char *method
= data
;
1659 if (!strcasecmp(method
, "sha1"))
1660 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA1
;
1661 else if (!strcasecmp(method
, "sha256"))
1662 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA256
;
1663 else if (!strcasecmp(method
, "sha512"))
1664 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA512
;
1667 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA1
;
1668 conf_report_error("Ignoring general::certfp_method -- bogus certfp method %s", method
);
1673 conf_set_general_oper_only_umodes(void *data
)
1675 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1679 conf_set_general_oper_snomask(void *data
)
1682 int what
= MODE_ADD
, flag
;
1684 ConfigFileEntry
.oper_snomask
= 0;
1685 for (pm
= (char *) data
; *pm
; pm
++)
1697 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1699 if (what
== MODE_ADD
)
1700 ConfigFileEntry
.oper_snomask
|= flag
;
1702 ConfigFileEntry
.oper_snomask
&= ~flag
;
1710 conf_set_serverhide_links_delay(void *data
)
1712 int val
= *(unsigned int *) data
;
1714 ConfigServerHide
.links_delay
= val
;
1718 conf_set_service_name(void *data
)
1724 for(s
= data
; *s
!= '\0'; s
++)
1728 conf_report_error("Ignoring service::name "
1729 "-- bogus servername.");
1738 conf_report_error("Ignoring service::name -- must contain '.'");
1742 tmp
= rb_strdup(data
);
1743 rb_dlinkAddAlloc(tmp
, &service_list
);
1747 conf_begin_alias(struct TopConf
*tc
)
1749 yy_alias
= rb_malloc(sizeof(struct alias_entry
));
1751 if (conf_cur_block_name
!= NULL
)
1752 yy_alias
->name
= rb_strdup(conf_cur_block_name
);
1754 yy_alias
->flags
= 0;
1761 conf_end_alias(struct TopConf
*tc
)
1763 if (yy_alias
== NULL
)
1766 if (yy_alias
->name
== NULL
)
1768 conf_report_error("Ignoring alias -- must have a name.");
1775 if (yy_alias
->target
== NULL
)
1777 conf_report_error("Ignoring alias -- must have a target.");
1784 irc_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1790 conf_set_alias_name(void *data
)
1792 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1795 yy_alias
->name
= rb_strdup(data
);
1799 conf_set_alias_target(void *data
)
1801 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1804 yy_alias
->target
= rb_strdup(data
);
1808 conf_set_channel_autochanmodes(void *data
)
1811 int what
= MODE_ADD
;
1813 ConfigChannel
.autochanmodes
= 0;
1814 for (pm
= (char *) data
; *pm
; pm
++)
1826 if (chmode_table
[(unsigned char) *pm
].set_func
== chm_simple
)
1828 if (what
== MODE_ADD
)
1829 ConfigChannel
.autochanmodes
|= chmode_table
[(unsigned char) *pm
].mode_type
;
1831 ConfigChannel
.autochanmodes
&= ~chmode_table
[(unsigned char) *pm
].mode_type
;
1835 conf_report_error("channel::autochanmodes -- Invalid channel mode %c", *pm
);
1844 static void conf_set_blacklist_reason(void *data
);
1847 conf_set_blacklist_host(void *data
)
1849 if (yy_blacklist_host
)
1851 conf_report_error("blacklist::host %s overlaps existing host %s",
1852 (char *)data
, yy_blacklist_host
);
1855 conf_set_blacklist_reason(NULL
);
1859 yy_blacklist_ipv4
= 1;
1860 yy_blacklist_ipv6
= 0;
1861 yy_blacklist_host
= rb_strdup(data
);
1865 conf_set_blacklist_type(void *data
)
1867 conf_parm_t
*args
= data
;
1869 /* Don't assume we have either if we got here */
1870 yy_blacklist_ipv4
= 0;
1871 yy_blacklist_ipv6
= 0;
1873 for (; args
; args
= args
->next
)
1875 if (!strcasecmp(args
->v
.string
, "ipv4"))
1876 yy_blacklist_ipv4
= 1;
1877 else if (!strcasecmp(args
->v
.string
, "ipv6"))
1878 yy_blacklist_ipv6
= 1;
1880 conf_report_error("blacklist::type has unknown address family %s",
1884 /* If we have neither, just default to IPv4 */
1885 if (!yy_blacklist_ipv4
&& !yy_blacklist_ipv6
)
1887 conf_report_error("blacklist::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
1888 yy_blacklist_ipv4
= 1;
1893 conf_set_blacklist_matches(void *data
)
1895 conf_parm_t
*args
= data
;
1897 for (; args
; args
= args
->next
)
1899 struct BlacklistFilter
*filter
;
1900 char *str
= args
->v
.string
;
1902 int type
= BLACKLIST_FILTER_LAST
;
1904 if (CF_TYPE(args
->type
) != CF_QSTRING
)
1906 conf_report_error("blacklist::matches -- must be quoted string");
1912 conf_report_error("blacklist::matches -- invalid entry");
1916 if (strlen(str
) > HOSTIPLEN
)
1918 conf_report_error("blacklist::matches has an entry too long: %s",
1923 for (p
= str
; *p
!= '\0'; p
++)
1925 /* Check for validity */
1927 type
= BLACKLIST_FILTER_ALL
;
1928 else if (!isalnum((unsigned char)*p
))
1930 conf_report_error("blacklist::matches has invalid IP match entry %s",
1937 if (type
== BLACKLIST_FILTER_ALL
)
1939 /* Basic IP sanity check */
1940 struct rb_sockaddr_storage tmp
;
1941 if (rb_inet_pton(AF_INET
, str
, &tmp
) <= 0)
1943 conf_report_error("blacklist::matches has invalid IP match entry %s",
1948 else if (type
== BLACKLIST_FILTER_LAST
)
1950 /* Verify it's the correct length */
1951 if (strlen(str
) > 3)
1953 conf_report_error("blacklist::matches has invalid octet match entry %s",
1960 continue; /* Invalid entry */
1963 filter
= rb_malloc(sizeof(struct BlacklistFilter
));
1964 filter
->type
= type
;
1965 rb_strlcpy(filter
->filterstr
, str
, sizeof(filter
->filterstr
));
1967 rb_dlinkAdd(filter
, &filter
->node
, &yy_blacklist_filters
);
1972 conf_set_blacklist_reason(void *data
)
1974 rb_dlink_node
*ptr
, *nptr
;
1976 if (yy_blacklist_host
&& data
)
1978 yy_blacklist_reason
= rb_strdup(data
);
1979 if (yy_blacklist_ipv6
)
1981 /* Make sure things fit (64 = alnum count + dots) */
1982 if ((64 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1984 conf_report_error("blacklist::host %s results in IPv6 queries that are too long",
1989 /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
1990 if (yy_blacklist_ipv4
&& !yy_blacklist_ipv6
)
1992 /* Make sure things fit (16 = number of nums + dots) */
1993 if ((16 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1995 conf_report_error("blacklist::host %s results in IPv4 queries that are too long",
2001 new_blacklist(yy_blacklist_host
, yy_blacklist_reason
, yy_blacklist_ipv4
, yy_blacklist_ipv6
,
2002 &yy_blacklist_filters
);
2008 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_blacklist_filters
.head
)
2010 rb_dlinkDelete(ptr
, &yy_blacklist_filters
);
2016 yy_blacklist_filters
= (rb_dlink_list
){ NULL
, NULL
, 0 };
2019 rb_free(yy_blacklist_host
);
2020 rb_free(yy_blacklist_reason
);
2021 yy_blacklist_host
= NULL
;
2022 yy_blacklist_reason
= NULL
;
2023 yy_blacklist_ipv4
= 1;
2024 yy_blacklist_ipv6
= 0;
2027 /* public functions */
2031 conf_report_error(const char *fmt
, ...)
2034 char msg
[IRCD_BUFSIZE
+ 1] = { 0 };
2037 rb_vsnprintf(msg
, IRCD_BUFSIZE
, fmt
, ap
);
2042 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2046 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2047 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2051 conf_start_block(char *block
, char *name
)
2053 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
2055 conf_report_error("Configuration block '%s' is not defined.", block
);
2060 conf_cur_block_name
= rb_strdup(name
);
2062 conf_cur_block_name
= NULL
;
2064 if(conf_cur_block
->tc_sfunc
)
2065 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
2072 conf_end_block(struct TopConf
*tc
)
2076 ret
= tc
->tc_efunc(tc
);
2078 rb_free(conf_cur_block_name
);
2079 conf_cur_block_name
= NULL
;
2084 conf_set_generic_int(void *data
, void *location
)
2086 *((int *) location
) = *((unsigned int *) data
);
2090 conf_set_generic_string(void *data
, int len
, void *location
)
2092 char **loc
= location
;
2095 if(len
&& strlen(input
) > (unsigned int)len
)
2099 *loc
= rb_strdup(input
);
2103 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
)
2105 struct ConfEntry
*cf
;
2111 if((cf
= find_conf_item(tc
, item
)) == NULL
)
2114 ("Non-existant configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
2118 /* if it takes one thing, make sure they only passed one thing,
2119 and handle as needed. */
2120 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
2123 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
2130 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
2132 /* if it expects a string value, but we got a yesno,
2135 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
2136 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
2138 value
->v
.list
->type
= CF_STRING
;
2140 if(cp
->v
.number
== 1)
2141 cp
->v
.string
= rb_strdup("yes");
2143 cp
->v
.string
= rb_strdup("no");
2146 /* maybe it's a CF_TIME and they passed CF_INT --
2147 should still be valid */
2148 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
2149 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
2152 ("Wrong type for %s::%s (expected %s, got %s)",
2153 tc
->tc_name
, (char *) item
,
2154 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
2159 if(cf
->cf_type
& CF_FLIST
)
2163 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
2166 /* just pass it the extended argument list */
2167 cf
->cf_func(value
->v
.list
);
2171 /* it's old-style, needs only one arg */
2172 switch (cf
->cf_type
)
2178 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2180 cf
->cf_func(&cp
->v
.number
);
2184 if(EmptyString(cp
->v
.string
))
2185 conf_report_error("Ignoring %s::%s -- empty field",
2188 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2190 cf
->cf_func(cp
->v
.string
);
2200 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2203 struct ConfEntry
*cf
;
2205 if((tc
= find_top_conf(topconf
)) == NULL
)
2208 if(find_conf_item(tc
, name
) != NULL
)
2211 cf
= rb_malloc(sizeof(struct ConfEntry
));
2218 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2224 remove_conf_item(const char *topconf
, const char *name
)
2227 struct ConfEntry
*cf
;
2230 if((tc
= find_top_conf(topconf
)) == NULL
)
2233 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2236 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2239 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2246 static struct ConfEntry conf_serverinfo_table
[] =
2248 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2249 { "hub", CF_YESNO
, NULL
, 0, &ServerInfo
.hub
},
2251 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2252 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2253 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2254 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2255 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2257 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2258 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2259 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2260 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2261 { "ssl_cipher_list", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cipher_list
},
2262 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2264 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2266 { "nicklen", CF_INT
, conf_set_serverinfo_nicklen
, 0, NULL
},
2268 { "\0", 0, NULL
, 0, NULL
}
2271 static struct ConfEntry conf_admin_table
[] =
2273 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2274 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2275 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2276 { "\0", 0, NULL
, 0, NULL
}
2279 static struct ConfEntry conf_log_table
[] =
2281 { "fname_userlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_userlog
},
2282 { "fname_fuserlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_fuserlog
},
2283 { "fname_operlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operlog
},
2284 { "fname_foperlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_foperlog
},
2285 { "fname_serverlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_serverlog
},
2286 { "fname_killlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_killlog
},
2287 { "fname_klinelog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_klinelog
},
2288 { "fname_operspylog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operspylog
},
2289 { "fname_ioerrorlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_ioerrorlog
},
2290 { "\0", 0, NULL
, 0, NULL
}
2293 static struct ConfEntry conf_operator_table
[] =
2295 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2296 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2297 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2298 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2299 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2300 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2301 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2302 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2303 { "\0", 0, NULL
, 0, NULL
}
2306 static struct ConfEntry conf_privset_table
[] =
2308 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2309 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2310 { "\0", 0, NULL
, 0, NULL
}
2313 static struct ConfEntry conf_class_table
[] =
2315 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2316 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2318 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2320 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2321 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2322 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2323 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2324 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2325 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2326 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2327 { "\0", 0, NULL
, 0, NULL
}
2330 static struct ConfEntry conf_auth_table
[] =
2332 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2333 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2334 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2335 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2336 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2337 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2338 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2339 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2340 { "\0", 0, NULL
, 0, NULL
}
2343 static struct ConfEntry conf_connect_table
[] =
2345 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2346 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2347 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2348 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2349 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2350 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2351 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2352 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2353 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
2354 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
2355 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2356 { "\0", 0, NULL
, 0, NULL
}
2359 static struct ConfEntry conf_general_table
[] =
2361 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2362 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2363 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2364 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
2365 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2366 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2367 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
2368 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2369 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2370 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2372 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2373 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2374 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2375 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2376 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2377 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2378 { "sasl_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.sasl_service
},
2380 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2381 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2382 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2383 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2384 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2386 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2387 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2388 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2389 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2390 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2391 { "resv_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.resv_fnc
},
2392 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2393 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2394 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2395 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2396 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2397 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2398 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2399 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2400 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2401 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2402 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2403 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2404 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2405 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2406 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2407 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2408 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2409 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2410 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2411 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2412 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2413 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2414 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2415 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2416 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2417 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2418 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2419 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2420 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2421 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2422 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2423 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2424 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2425 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2426 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2427 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2428 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2429 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2430 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2431 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2432 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2433 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2434 { "client_flood_max_lines", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_max_lines
},
2435 { "client_flood_burst_rate", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_rate
},
2436 { "client_flood_burst_max", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_max
},
2437 { "client_flood_message_num", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_num
},
2438 { "client_flood_message_time", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_time
},
2439 { "max_ratelimit_tokens", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_ratelimit_tokens
},
2440 { "away_interval", CF_INT
, NULL
, 0, &ConfigFileEntry
.away_interval
},
2441 { "hide_opers_in_whois", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_opers_in_whois
},
2442 { "certfp_method", CF_STRING
, conf_set_general_certfp_method
, 0, NULL
},
2443 { "\0", 0, NULL
, 0, NULL
}
2446 static struct ConfEntry conf_channel_table
[] =
2448 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2449 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2450 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2451 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2452 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2453 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2454 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2455 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2456 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2457 { "max_chans_per_user_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user_large
},
2458 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2459 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2460 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2461 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2462 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2463 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2464 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2465 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2466 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2467 { "disable_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.disable_local_channels
},
2468 { "autochanmodes", CF_QSTRING
, conf_set_channel_autochanmodes
, 0, NULL
},
2469 { "displayed_usercount", CF_INT
, NULL
, 0, &ConfigChannel
.displayed_usercount
},
2470 { "strip_topic_colors", CF_YESNO
, NULL
, 0, &ConfigChannel
.strip_topic_colors
},
2471 { "\0", 0, NULL
, 0, NULL
}
2474 static struct ConfEntry conf_serverhide_table
[] =
2476 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2477 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2478 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2479 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2480 { "\0", 0, NULL
, 0, NULL
}
2487 add_top_conf("modules", NULL
, NULL
, NULL
);
2488 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2489 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2491 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2492 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2493 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2494 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2495 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2496 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2498 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2499 add_conf_item("listen", "defer_accept", CF_YESNO
, conf_set_listen_defer_accept
);
2500 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2501 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2502 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2503 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2505 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2507 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
2508 add_conf_item("shared", "oper", CF_QSTRING
| CF_FLIST
, conf_set_shared_oper
);
2509 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
2511 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2513 add_top_conf("exempt", NULL
, NULL
, NULL
);
2514 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2516 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2517 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2518 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2520 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2521 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2522 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2524 add_top_conf("service", NULL
, NULL
, NULL
);
2525 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2527 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2528 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2529 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2531 add_top_conf("blacklist", NULL
, NULL
, NULL
);
2532 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_blacklist_host
);
2533 add_conf_item("blacklist", "type", CF_STRING
| CF_FLIST
, conf_set_blacklist_type
);
2534 add_conf_item("blacklist", "matches", CF_QSTRING
| CF_FLIST
, conf_set_blacklist_matches
);
2535 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_blacklist_reason
);