1 /* This code is in the public domain.
7 #include <openssl/pem.h>
8 #include <openssl/rsa.h>
12 #include "ircd_defs.h"
16 #include "s_newconf.h"
27 #include "blacklist.h"
29 #include "privilege.h"
32 #define CF_TYPE(x) ((x) & CF_MTYPE)
34 static int yy_defer_accept
= 1;
36 struct TopConf
*conf_cur_block
;
37 static char *conf_cur_block_name
= NULL
;
39 static rb_dlink_list conf_items
;
41 static struct ConfItem
*yy_aconf
= NULL
;
43 static struct Class
*yy_class
= NULL
;
45 static struct remote_conf
*yy_shared
= NULL
;
46 static struct server_conf
*yy_server
= NULL
;
48 static rb_dlink_list yy_aconf_list
;
49 static rb_dlink_list yy_oper_list
;
50 static rb_dlink_list yy_shared_list
;
51 static rb_dlink_list yy_cluster_list
;
52 static struct oper_conf
*yy_oper
= NULL
;
54 static struct alias_entry
*yy_alias
= NULL
;
56 static char *yy_blacklist_host
= NULL
;
57 static char *yy_blacklist_reason
= NULL
;
58 static int yy_blacklist_ipv4
= 1;
59 static int yy_blacklist_ipv6
= 0;
60 static rb_dlink_list yy_blacklist_filters
;
62 static char *yy_privset_extends
= NULL
;
65 conf_strtype(int type
)
67 switch (CF_TYPE(type
))
70 return "integer value";
72 return "unquoted string";
74 return "yes/no value";
76 return "quoted string";
78 return "time/size value";
80 return "unknown type";
85 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
86 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
90 tc
= rb_malloc(sizeof(struct TopConf
));
95 tc
->tc_entries
= items
;
97 rb_dlinkAddAlloc(tc
, &conf_items
);
102 find_top_conf(const char *name
)
107 RB_DLINK_FOREACH(d
, conf_items
.head
)
110 if(strcasecmp(tc
->tc_name
, name
) == 0)
119 find_conf_item(const struct TopConf
*top
, const char *name
)
121 struct ConfEntry
*cf
;
128 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
130 cf
= &top
->tc_entries
[i
];
132 if(!strcasecmp(cf
->cf_name
, name
))
137 RB_DLINK_FOREACH(d
, top
->tc_items
.head
)
140 if(strcasecmp(cf
->cf_name
, name
) == 0)
148 remove_top_conf(char *name
)
153 if((tc
= find_top_conf(name
)) == NULL
)
156 if((ptr
= rb_dlinkFind(tc
, &conf_items
)) == NULL
)
159 rb_dlinkDestroy(ptr
, &conf_items
);
166 conf_set_serverinfo_name(void *data
)
168 if(ServerInfo
.name
== NULL
)
173 for(s
= data
; *s
!= '\0'; s
++)
177 conf_report_error("Ignoring serverinfo::name "
178 "-- bogus servername.");
187 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
195 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
199 /* the ircd will exit() in main() if we dont set one */
200 if(strlen(s
) <= HOSTLEN
)
201 ServerInfo
.name
= rb_strdup((char *) data
);
206 conf_set_serverinfo_sid(void *data
)
210 if(ServerInfo
.sid
[0] == '\0')
212 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
213 !IsIdChar(sid
[2]) || sid
[3] != '\0')
215 conf_report_error("Ignoring serverinfo::sid "
220 strcpy(ServerInfo
.sid
, sid
);
225 conf_set_serverinfo_network_name(void *data
)
229 if((p
= strchr((char *) data
, ' ')))
232 rb_free(ServerInfo
.network_name
);
233 ServerInfo
.network_name
= rb_strdup((char *) data
);
237 conf_set_serverinfo_vhost(void *data
)
239 if(rb_inet_pton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
241 conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data
);
244 ServerInfo
.ip
.sin_family
= AF_INET
;
245 ServerInfo
.specific_ipv4_vhost
= 1;
249 conf_set_serverinfo_vhost6(void *data
)
252 if(rb_inet_pton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
254 conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data
);
258 ServerInfo
.specific_ipv6_vhost
= 1;
259 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
261 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
266 conf_set_serverinfo_nicklen(void *data
)
268 ConfigFileEntry
.nicklen
= (*(unsigned int *) data
) + 1;
270 if (ConfigFileEntry
.nicklen
> NICKLEN
)
272 conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)",
273 ConfigFileEntry
.nicklen
- 1, NICKLEN
- 1);
274 ConfigFileEntry
.nicklen
= NICKLEN
;
276 else if (ConfigFileEntry
.nicklen
< 9 + 1)
278 conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9",
279 ConfigFileEntry
.nicklen
- 1);
280 ConfigFileEntry
.nicklen
= 9 + 1;
285 conf_set_modules_module(void *data
)
289 m_bn
= rb_basename((char *) data
);
291 if(findmodule_byname(m_bn
) == -1)
292 load_one_module((char *) data
, MAPI_ORIGIN_EXTENSION
, 0);
298 conf_set_modules_path(void *data
)
300 mod_add_path((char *) data
);
310 static struct mode_table umode_table
[] = {
311 {"callerid", UMODE_CALLERID
},
312 {"deaf", UMODE_DEAF
},
313 {"invisible", UMODE_INVISIBLE
},
314 {"locops", UMODE_LOCOPS
},
315 {"noforward", UMODE_NOFORWARD
},
316 {"regonlymsg", UMODE_REGONLYMSG
},
317 {"servnotice", UMODE_SERVNOTICE
},
318 {"wallop", UMODE_WALLOP
},
319 {"operwall", UMODE_OPERWALL
},
323 static struct mode_table oper_table
[] = {
324 {"encrypted", OPER_ENCRYPTED
},
325 {"need_ssl", OPER_NEEDSSL
},
329 static struct mode_table auth_table
[] = {
330 {"encrypted", CONF_FLAGS_ENCRYPTED
},
331 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
332 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
333 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
334 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
335 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
336 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
337 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
338 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
339 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
340 {"no_tilde", CONF_FLAGS_NO_TILDE
},
341 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
342 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
343 {"need_ssl", CONF_FLAGS_NEED_SSL
},
344 {"need_sasl", CONF_FLAGS_NEED_SASL
},
345 {"extend_chans", CONF_FLAGS_EXTEND_CHANS
},
349 static struct mode_table connect_table
[] = {
350 { "autoconn", SERVER_AUTOCONN
},
351 { "compressed", SERVER_COMPRESSED
},
352 { "encrypted", SERVER_ENCRYPTED
},
353 { "topicburst", SERVER_TB
},
354 { "ssl", SERVER_SSL
},
358 static struct mode_table cluster_table
[] = {
359 { "kline", SHARED_PKLINE
},
360 { "tkline", SHARED_TKLINE
},
361 { "unkline", SHARED_UNKLINE
},
362 { "locops", SHARED_LOCOPS
},
363 { "xline", SHARED_PXLINE
},
364 { "txline", SHARED_TXLINE
},
365 { "unxline", SHARED_UNXLINE
},
366 { "resv", SHARED_PRESV
},
367 { "tresv", SHARED_TRESV
},
368 { "unresv", SHARED_UNRESV
},
369 { "all", CLUSTER_ALL
},
373 static struct mode_table shared_table
[] =
375 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
376 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
377 { "resv", SHARED_PRESV
|SHARED_TRESV
},
378 { "dline", SHARED_PDLINE
|SHARED_TDLINE
},
379 { "tdline", SHARED_TDLINE
},
380 { "pdline", SHARED_PDLINE
},
381 { "undline", SHARED_UNDLINE
},
382 { "tkline", SHARED_TKLINE
},
383 { "unkline", SHARED_UNKLINE
},
384 { "txline", SHARED_TXLINE
},
385 { "unxline", SHARED_UNXLINE
},
386 { "tresv", SHARED_TRESV
},
387 { "unresv", SHARED_UNRESV
},
388 { "locops", SHARED_LOCOPS
},
389 { "rehash", SHARED_REHASH
},
390 { "grant", SHARED_GRANT
},
391 { "die", SHARED_DIE
},
392 { "module", SHARED_MODULE
},
393 { "all", SHARED_ALL
},
400 find_umode(struct mode_table
*tab
, const char *name
)
404 for (i
= 0; tab
[i
].name
; i
++)
406 if(strcmp(tab
[i
].name
, name
) == 0)
414 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
416 for (; args
; args
= args
->next
)
422 if(CF_TYPE(args
->type
) != CF_STRING
)
424 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
428 umode
= args
->v
.string
;
436 mode
= find_umode(tab
, umode
);
440 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
457 conf_set_privset_extends(void *data
)
459 yy_privset_extends
= rb_strdup((char *) data
);
463 conf_set_privset_privs(void *data
)
466 conf_parm_t
*args
= data
;
468 for (; args
; args
= args
->next
)
471 privs
= rb_strdup(args
->v
.string
);
474 char *privs_old
= privs
;
476 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
477 strcpy(privs
, privs_old
);
479 strcat(privs
, args
->v
.string
);
487 if (yy_privset_extends
)
489 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
493 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
495 set
= privilegeset_get("default");
498 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
500 rb_free(yy_privset_extends
);
501 yy_privset_extends
= NULL
;
504 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
511 conf_begin_oper(struct TopConf
*tc
)
514 rb_dlink_node
*next_ptr
;
518 free_oper_conf(yy_oper
);
522 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
524 free_oper_conf(ptr
->data
);
525 rb_dlinkDestroy(ptr
, &yy_oper_list
);
528 yy_oper
= make_oper_conf();
529 yy_oper
->flags
|= OPER_ENCRYPTED
;
535 conf_end_oper(struct TopConf
*tc
)
537 struct oper_conf
*yy_tmpoper
;
539 rb_dlink_node
*next_ptr
;
541 if(conf_cur_block_name
!= NULL
)
543 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
544 conf_cur_block_name
[OPERNICKLEN
] = '\0';
546 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
549 if(EmptyString(yy_oper
->name
))
551 conf_report_error("Ignoring operator block -- missing name.");
555 #ifdef HAVE_LIBCRYPTO
556 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
558 if(EmptyString(yy_oper
->passwd
))
561 conf_report_error("Ignoring operator block for %s -- missing password",
567 if (!yy_oper
->privset
)
568 yy_oper
->privset
= privilegeset_get("default");
570 /* now, yy_oper_list contains a stack of oper_conf's with just user
571 * and host in, yy_oper contains the rest of the information which
572 * we need to copy into each element in yy_oper_list
574 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
576 yy_tmpoper
= ptr
->data
;
578 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
580 /* could be an rsa key instead.. */
581 if(!EmptyString(yy_oper
->passwd
))
582 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
584 yy_tmpoper
->flags
= yy_oper
->flags
;
585 yy_tmpoper
->umodes
= yy_oper
->umodes
;
586 yy_tmpoper
->snomask
= yy_oper
->snomask
;
587 yy_tmpoper
->privset
= yy_oper
->privset
;
589 #ifdef HAVE_LIBCRYPTO
590 if(yy_oper
->rsa_pubkey_file
)
594 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
596 conf_report_error("Ignoring operator block for %s -- "
597 "rsa_public_key_file cant be opened",
602 yy_tmpoper
->rsa_pubkey
=
603 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
605 (void)BIO_set_close(file
, BIO_CLOSE
);
608 if(yy_tmpoper
->rsa_pubkey
== NULL
)
610 conf_report_error("Ignoring operator block for %s -- "
611 "rsa_public_key_file key invalid; check syntax",
617 if(!EmptyString(yy_oper
->certfp
))
618 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
621 /* all is ok, put it on oper_conf_list */
622 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
625 free_oper_conf(yy_oper
);
632 conf_set_oper_flags(void *data
)
634 conf_parm_t
*args
= data
;
636 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
640 conf_set_oper_fingerprint(void *data
)
643 rb_free(yy_oper
->certfp
);
644 yy_oper
->certfp
= rb_strdup((char *) data
);
648 conf_set_oper_privset(void *data
)
650 yy_oper
->privset
= privilegeset_get((char *) data
);
654 conf_set_oper_user(void *data
)
656 struct oper_conf
*yy_tmpoper
;
658 char *host
= (char *) data
;
660 yy_tmpoper
= make_oper_conf();
662 if((p
= strchr(host
, '@')))
666 yy_tmpoper
->username
= rb_strdup(host
);
667 yy_tmpoper
->host
= rb_strdup(p
);
672 yy_tmpoper
->username
= rb_strdup("*");
673 yy_tmpoper
->host
= rb_strdup(host
);
676 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
678 conf_report_error("Ignoring user -- missing username/host");
679 free_oper_conf(yy_tmpoper
);
683 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
687 conf_set_oper_password(void *data
)
691 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
692 rb_free(yy_oper
->passwd
);
695 yy_oper
->passwd
= rb_strdup((char *) data
);
699 conf_set_oper_rsa_public_key_file(void *data
)
701 #ifdef HAVE_LIBCRYPTO
702 rb_free(yy_oper
->rsa_pubkey_file
);
703 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
705 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
710 conf_set_oper_umodes(void *data
)
712 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
716 conf_set_oper_snomask(void *data
)
718 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
722 conf_begin_class(struct TopConf
*tc
)
725 free_class(yy_class
);
727 yy_class
= make_class();
732 conf_end_class(struct TopConf
*tc
)
734 if(conf_cur_block_name
!= NULL
)
735 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
737 if(EmptyString(yy_class
->class_name
))
739 conf_report_error("Ignoring connect block -- missing name.");
749 conf_set_class_ping_time(void *data
)
751 yy_class
->ping_freq
= *(unsigned int *) data
;
755 conf_set_class_cidr_ipv4_bitlen(void *data
)
757 unsigned int maxsize
= 32;
758 if(*(unsigned int *) data
> maxsize
)
760 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
761 *(unsigned int *) data
, maxsize
);
763 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
769 conf_set_class_cidr_ipv6_bitlen(void *data
)
771 unsigned int maxsize
= 128;
772 if(*(unsigned int *) data
> maxsize
)
774 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
775 *(unsigned int *) data
, maxsize
);
777 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
783 conf_set_class_number_per_cidr(void *data
)
785 yy_class
->cidr_amount
= *(unsigned int *) data
;
789 conf_set_class_number_per_ip(void *data
)
791 yy_class
->max_local
= *(unsigned int *) data
;
796 conf_set_class_number_per_ip_global(void *data
)
798 yy_class
->max_global
= *(unsigned int *) data
;
802 conf_set_class_number_per_ident(void *data
)
804 yy_class
->max_ident
= *(unsigned int *) data
;
808 conf_set_class_connectfreq(void *data
)
810 yy_class
->con_freq
= *(unsigned int *) data
;
814 conf_set_class_max_number(void *data
)
816 yy_class
->max_total
= *(unsigned int *) data
;
820 conf_set_class_sendq(void *data
)
822 yy_class
->max_sendq
= *(unsigned int *) data
;
825 static char *listener_address
;
828 conf_begin_listen(struct TopConf
*tc
)
830 rb_free(listener_address
);
831 listener_address
= NULL
;
836 conf_end_listen(struct TopConf
*tc
)
838 rb_free(listener_address
);
839 listener_address
= NULL
;
844 conf_set_listen_defer_accept(void *data
)
846 yy_defer_accept
= *(unsigned int *) data
;
850 conf_set_listen_port_both(void *data
, int ssl
)
852 conf_parm_t
*args
= data
;
853 for (; args
; args
= args
->next
)
855 if(CF_TYPE(args
->type
) != CF_INT
)
858 ("listener::port argument is not an integer " "-- ignoring.");
861 if(listener_address
== NULL
)
865 conf_report_warning("listener 'ANY/%d': support for plaintext listeners may be removed in a future release per RFC 7194. "
866 "It is suggested that users be migrated to SSL/TLS connections.", args
->v
.number
);
868 add_listener(args
->v
.number
, listener_address
, AF_INET
, ssl
, ssl
|| yy_defer_accept
);
870 add_listener(args
->v
.number
, listener_address
, AF_INET6
, ssl
, ssl
|| yy_defer_accept
);
877 if(strchr(listener_address
, ':') != NULL
)
885 conf_report_warning("listener '%s/%d': support for plaintext listeners may be removed in a future release per RFC 7194. "
886 "It is suggested that users be migrated to SSL/TLS connections.", listener_address
, args
->v
.number
);
889 add_listener(args
->v
.number
, listener_address
, family
, ssl
, ssl
|| yy_defer_accept
);
896 conf_set_listen_port(void *data
)
898 conf_set_listen_port_both(data
, 0);
902 conf_set_listen_sslport(void *data
)
904 conf_set_listen_port_both(data
, 1);
908 conf_set_listen_address(void *data
)
910 rb_free(listener_address
);
911 listener_address
= rb_strdup(data
);
915 conf_begin_auth(struct TopConf
*tc
)
918 rb_dlink_node
*next_ptr
;
923 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
925 free_conf(ptr
->data
);
926 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
929 yy_aconf
= make_conf();
930 yy_aconf
->status
= CONF_CLIENT
;
936 conf_end_auth(struct TopConf
*tc
)
938 struct ConfItem
*yy_tmp
, *found_conf
;
940 rb_dlink_node
*next_ptr
;
942 if(EmptyString(yy_aconf
->info
.name
))
943 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
945 /* didnt even get one ->host? */
946 if(EmptyString(yy_aconf
->host
))
948 conf_report_error("Ignoring auth block -- missing user@host");
952 /* so the stacking works in order.. */
953 collapse(yy_aconf
->user
);
954 collapse(yy_aconf
->host
);
955 conf_add_class_to_conf(yy_aconf
);
956 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
957 conf_report_error("Ignoring redundant auth block (after *@*)");
958 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
959 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
960 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
961 conf_report_error("Ignoring duplicate auth block for %s@%s",
962 yy_aconf
->user
, yy_aconf
->host
);
964 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
966 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
971 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
973 if(yy_aconf
->spasswd
)
974 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
976 /* this will always exist.. */
977 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
979 if(yy_aconf
->className
)
980 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
982 yy_tmp
->flags
= yy_aconf
->flags
;
983 yy_tmp
->port
= yy_aconf
->port
;
985 collapse(yy_tmp
->user
);
986 collapse(yy_tmp
->host
);
988 conf_add_class_to_conf(yy_tmp
);
990 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
991 conf_report_error("Ignoring redundant auth block (after *@*)");
992 else if ((found_conf
= find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
)) &&
993 (!found_conf
->spasswd
|| (yy_tmp
->spasswd
&&
994 0 == irccmp(found_conf
->spasswd
, yy_tmp
->spasswd
))))
995 conf_report_error("Ignoring duplicate auth block for %s@%s",
996 yy_tmp
->user
, yy_tmp
->host
);
998 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
999 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1007 conf_set_auth_user(void *data
)
1009 struct ConfItem
*yy_tmp
;
1012 /* The first user= line doesn't allocate a new conf */
1013 if(!EmptyString(yy_aconf
->host
))
1015 yy_tmp
= make_conf();
1016 yy_tmp
->status
= CONF_CLIENT
;
1021 if((p
= strchr(data
, '@')))
1025 yy_tmp
->user
= rb_strdup(data
);
1026 yy_tmp
->host
= rb_strdup(p
);
1030 yy_tmp
->user
= rb_strdup("*");
1031 yy_tmp
->host
= rb_strdup(data
);
1034 if(yy_aconf
!= yy_tmp
)
1035 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1039 conf_set_auth_auth_user(void *data
)
1041 if(yy_aconf
->spasswd
)
1042 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1043 rb_free(yy_aconf
->spasswd
);
1044 yy_aconf
->spasswd
= rb_strdup(data
);
1048 conf_set_auth_passwd(void *data
)
1050 if(yy_aconf
->passwd
)
1051 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1052 rb_free(yy_aconf
->passwd
);
1053 yy_aconf
->passwd
= rb_strdup(data
);
1057 conf_set_auth_spoof(void *data
)
1065 /* user@host spoof */
1066 if((p
= strchr(host
, '@')) != NULL
)
1072 if(EmptyString(user
))
1074 conf_report_error("Warning -- spoof ident empty.");
1078 if(strlen(user
) > USERLEN
)
1080 conf_report_error("Warning -- spoof ident length invalid.");
1084 if(!valid_username(user
))
1086 conf_report_error("Warning -- invalid spoof (ident).");
1090 /* this must be restored! */
1094 if(EmptyString(host
))
1096 conf_report_error("Warning -- spoof host empty.");
1100 if(strlen(host
) > HOSTLEN
)
1102 conf_report_error("Warning -- spoof host length invalid.");
1106 if(!valid_hostname(host
))
1108 conf_report_error("Warning -- invalid spoof (host).");
1112 rb_free(yy_aconf
->info
.name
);
1113 yy_aconf
->info
.name
= rb_strdup(data
);
1114 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1118 conf_set_auth_flags(void *data
)
1120 conf_parm_t
*args
= data
;
1122 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1126 conf_set_auth_redir_serv(void *data
)
1128 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1129 rb_free(yy_aconf
->info
.name
);
1130 yy_aconf
->info
.name
= rb_strdup(data
);
1134 conf_set_auth_redir_port(void *data
)
1136 int port
= *(unsigned int *) data
;
1138 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1139 yy_aconf
->port
= port
;
1143 conf_set_auth_class(void *data
)
1145 rb_free(yy_aconf
->className
);
1146 yy_aconf
->className
= rb_strdup(data
);
1149 /* ok, shared_oper handles the stacking, shared_flags handles adding
1150 * things.. so all we need to do when we start and end a shared block, is
1151 * clean up anything thats been left over.
1154 conf_cleanup_shared(struct TopConf
*tc
)
1156 rb_dlink_node
*ptr
, *next_ptr
;
1158 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1160 free_remote_conf(ptr
->data
);
1161 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1164 if(yy_shared
!= NULL
)
1166 free_remote_conf(yy_shared
);
1174 conf_set_shared_oper(void *data
)
1176 conf_parm_t
*args
= data
;
1177 const char *username
;
1180 if(yy_shared
!= NULL
)
1181 free_remote_conf(yy_shared
);
1183 yy_shared
= make_remote_conf();
1185 if(args
->next
!= NULL
)
1187 if(CF_TYPE(args
->type
) != CF_QSTRING
)
1189 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1193 yy_shared
->server
= rb_strdup(args
->v
.string
);
1197 yy_shared
->server
= rb_strdup("*");
1199 if(CF_TYPE(args
->type
) != CF_QSTRING
)
1201 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1205 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1207 conf_report_error("Ignoring shard::oper -- oper is not a user@host");
1211 username
= args
->v
.string
;
1215 yy_shared
->host
= rb_strdup("*");
1217 yy_shared
->host
= rb_strdup(p
);
1219 if(EmptyString(username
))
1220 yy_shared
->username
= rb_strdup("*");
1222 yy_shared
->username
= rb_strdup(username
);
1224 rb_dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1229 conf_set_shared_flags(void *data
)
1231 conf_parm_t
*args
= data
;
1233 rb_dlink_node
*ptr
, *next_ptr
;
1235 if(yy_shared
!= NULL
)
1236 free_remote_conf(yy_shared
);
1238 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1240 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1242 yy_shared
= ptr
->data
;
1244 yy_shared
->flags
= flags
;
1245 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1246 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1253 conf_begin_connect(struct TopConf
*tc
)
1256 free_server_conf(yy_server
);
1258 yy_server
= make_server_conf();
1259 yy_server
->port
= PORTNUM
;
1260 yy_server
->flags
|= SERVER_TB
;
1262 if(conf_cur_block_name
!= NULL
)
1263 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1269 conf_end_connect(struct TopConf
*tc
)
1271 if(EmptyString(yy_server
->name
))
1273 conf_report_error("Ignoring connect block -- missing name.");
1277 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1279 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1284 if((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
)) && EmptyString(yy_server
->certfp
))
1286 conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
1291 if(EmptyString(yy_server
->host
))
1293 conf_report_error("Ignoring connect block for %s -- missing host.",
1299 if(ServerConfCompressed(yy_server
))
1301 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1302 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1306 add_server_conf(yy_server
);
1307 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1314 conf_set_connect_host(void *data
)
1316 rb_free(yy_server
->host
);
1317 yy_server
->host
= rb_strdup(data
);
1318 if (strchr(yy_server
->host
, ':'))
1319 yy_server
->aftype
= AF_INET6
;
1323 conf_set_connect_vhost(void *data
)
1325 if(rb_inet_pton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1327 conf_report_error("Invalid IP address for server connect vhost (%s)",
1332 yy_server
->flags
|= SERVER_VHOSTED
;
1336 conf_set_connect_send_password(void *data
)
1338 if(yy_server
->spasswd
)
1340 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1341 rb_free(yy_server
->spasswd
);
1344 yy_server
->spasswd
= rb_strdup(data
);
1348 conf_set_connect_accept_password(void *data
)
1350 if(yy_server
->passwd
)
1352 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1353 rb_free(yy_server
->passwd
);
1355 yy_server
->passwd
= rb_strdup(data
);
1359 conf_set_connect_fingerprint(void *data
)
1361 if (yy_server
->certfp
)
1362 rb_free(yy_server
->certfp
);
1363 yy_server
->certfp
= rb_strdup((char *) data
);
1365 /* force SSL to be enabled if fingerprint is enabled. */
1366 yy_server
->flags
|= SERVER_SSL
;
1370 conf_set_connect_port(void *data
)
1372 int port
= *(unsigned int *) data
;
1377 yy_server
->port
= port
;
1381 conf_set_connect_aftype(void *data
)
1385 if(strcasecmp(aft
, "ipv4") == 0)
1386 yy_server
->aftype
= AF_INET
;
1388 else if(strcasecmp(aft
, "ipv6") == 0)
1389 yy_server
->aftype
= AF_INET6
;
1392 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1396 conf_set_connect_flags(void *data
)
1398 conf_parm_t
*args
= data
;
1400 /* note, we allow them to set compressed, then remove it later if
1401 * they do and LIBZ isnt available
1403 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1407 conf_set_connect_hub_mask(void *data
)
1409 struct remote_conf
*yy_hub
;
1411 if(EmptyString(yy_server
->name
))
1414 yy_hub
= make_remote_conf();
1415 yy_hub
->flags
= CONF_HUB
;
1417 yy_hub
->host
= rb_strdup(data
);
1418 yy_hub
->server
= rb_strdup(yy_server
->name
);
1419 rb_dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1423 conf_set_connect_leaf_mask(void *data
)
1425 struct remote_conf
*yy_leaf
;
1427 if(EmptyString(yy_server
->name
))
1430 yy_leaf
= make_remote_conf();
1431 yy_leaf
->flags
= CONF_LEAF
;
1433 yy_leaf
->host
= rb_strdup(data
);
1434 yy_leaf
->server
= rb_strdup(yy_server
->name
);
1435 rb_dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1439 conf_set_connect_class(void *data
)
1441 rb_free(yy_server
->class_name
);
1442 yy_server
->class_name
= rb_strdup(data
);
1446 conf_set_exempt_ip(void *data
)
1448 struct ConfItem
*yy_tmp
;
1450 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1452 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1456 yy_tmp
= make_conf();
1457 yy_tmp
->passwd
= rb_strdup("*");
1458 yy_tmp
->host
= rb_strdup(data
);
1459 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1460 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1464 conf_cleanup_cluster(struct TopConf
*tc
)
1466 rb_dlink_node
*ptr
, *next_ptr
;
1468 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1470 free_remote_conf(ptr
->data
);
1471 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1474 if(yy_shared
!= NULL
)
1476 free_remote_conf(yy_shared
);
1484 conf_set_cluster_name(void *data
)
1486 if(yy_shared
!= NULL
)
1487 free_remote_conf(yy_shared
);
1489 yy_shared
= make_remote_conf();
1490 yy_shared
->server
= rb_strdup(data
);
1491 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1497 conf_set_cluster_flags(void *data
)
1499 conf_parm_t
*args
= data
;
1501 rb_dlink_node
*ptr
, *next_ptr
;
1503 if(yy_shared
!= NULL
)
1504 free_remote_conf(yy_shared
);
1506 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1508 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1510 yy_shared
= ptr
->data
;
1511 yy_shared
->flags
= flags
;
1512 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1513 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1520 conf_set_general_havent_read_conf(void *data
)
1522 if(*(unsigned int *) data
)
1524 conf_report_error("You haven't read your config file properly.");
1526 ("There is a line in the example conf that will kill your server if not removed.");
1528 ("Consider actually reading/editing the conf file, and removing this line.");
1535 conf_set_general_hide_error_messages(void *data
)
1539 if(strcasecmp(val
, "yes") == 0)
1540 ConfigFileEntry
.hide_error_messages
= 2;
1541 else if(strcasecmp(val
, "opers") == 0)
1542 ConfigFileEntry
.hide_error_messages
= 1;
1543 else if(strcasecmp(val
, "no") == 0)
1544 ConfigFileEntry
.hide_error_messages
= 0;
1546 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1550 conf_set_general_kline_delay(void *data
)
1552 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1554 /* THIS MUST BE HERE to stop us being unable to check klines */
1555 kline_queued
= false;
1559 conf_set_general_stats_k_oper_only(void *data
)
1563 if(strcasecmp(val
, "yes") == 0)
1564 ConfigFileEntry
.stats_k_oper_only
= 2;
1565 else if(strcasecmp(val
, "masked") == 0)
1566 ConfigFileEntry
.stats_k_oper_only
= 1;
1567 else if(strcasecmp(val
, "no") == 0)
1568 ConfigFileEntry
.stats_k_oper_only
= 0;
1570 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1574 conf_set_general_stats_i_oper_only(void *data
)
1578 if(strcasecmp(val
, "yes") == 0)
1579 ConfigFileEntry
.stats_i_oper_only
= 2;
1580 else if(strcasecmp(val
, "masked") == 0)
1581 ConfigFileEntry
.stats_i_oper_only
= 1;
1582 else if(strcasecmp(val
, "no") == 0)
1583 ConfigFileEntry
.stats_i_oper_only
= 0;
1585 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1589 conf_set_general_compression_level(void *data
)
1592 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1594 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1597 ("Invalid general::compression_level %d -- using default.",
1598 ConfigFileEntry
.compression_level
);
1599 ConfigFileEntry
.compression_level
= 0;
1602 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1607 conf_set_general_default_umodes(void *data
)
1610 int what
= MODE_ADD
, flag
;
1612 ConfigFileEntry
.default_umodes
= 0;
1613 for (pm
= (char *) data
; *pm
; pm
++)
1624 /* don't allow +o */
1632 if ((flag
= user_modes
[(unsigned char) *pm
]))
1634 /* Proper value has probably not yet been set
1635 * so don't check oper_only_umodes -- jilles */
1636 if (what
== MODE_ADD
)
1637 ConfigFileEntry
.default_umodes
|= flag
;
1639 ConfigFileEntry
.default_umodes
&= ~flag
;
1647 conf_set_general_oper_umodes(void *data
)
1649 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1653 conf_set_general_certfp_method(void *data
)
1655 char *method
= data
;
1657 if (!strcasecmp(method
, "sha1"))
1658 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA1
;
1659 else if (!strcasecmp(method
, "sha256"))
1660 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA256
;
1661 else if (!strcasecmp(method
, "sha512"))
1662 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA512
;
1665 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA1
;
1666 conf_report_error("Ignoring general::certfp_method -- bogus certfp method %s", method
);
1671 conf_set_general_oper_only_umodes(void *data
)
1673 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1677 conf_set_general_oper_snomask(void *data
)
1680 int what
= MODE_ADD
, flag
;
1682 ConfigFileEntry
.oper_snomask
= 0;
1683 for (pm
= (char *) data
; *pm
; pm
++)
1695 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1697 if (what
== MODE_ADD
)
1698 ConfigFileEntry
.oper_snomask
|= flag
;
1700 ConfigFileEntry
.oper_snomask
&= ~flag
;
1708 conf_set_serverhide_links_delay(void *data
)
1710 int val
= *(unsigned int *) data
;
1712 ConfigServerHide
.links_delay
= val
;
1716 conf_set_service_name(void *data
)
1722 for(s
= data
; *s
!= '\0'; s
++)
1726 conf_report_error("Ignoring service::name "
1727 "-- bogus servername.");
1736 conf_report_error("Ignoring service::name -- must contain '.'");
1740 tmp
= rb_strdup(data
);
1741 rb_dlinkAddAlloc(tmp
, &service_list
);
1745 conf_begin_alias(struct TopConf
*tc
)
1747 yy_alias
= rb_malloc(sizeof(struct alias_entry
));
1749 if (conf_cur_block_name
!= NULL
)
1750 yy_alias
->name
= rb_strdup(conf_cur_block_name
);
1752 yy_alias
->flags
= 0;
1759 conf_end_alias(struct TopConf
*tc
)
1761 if (yy_alias
== NULL
)
1764 if (yy_alias
->name
== NULL
)
1766 conf_report_error("Ignoring alias -- must have a name.");
1773 if (yy_alias
->target
== NULL
)
1775 conf_report_error("Ignoring alias -- must have a target.");
1782 rb_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1788 conf_set_alias_name(void *data
)
1790 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1793 yy_alias
->name
= rb_strdup(data
);
1797 conf_set_alias_target(void *data
)
1799 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1802 yy_alias
->target
= rb_strdup(data
);
1806 conf_set_channel_autochanmodes(void *data
)
1809 int what
= MODE_ADD
;
1811 ConfigChannel
.autochanmodes
= 0;
1812 for (pm
= (char *) data
; *pm
; pm
++)
1824 if (chmode_table
[(unsigned char) *pm
].set_func
== chm_simple
)
1826 if (what
== MODE_ADD
)
1827 ConfigChannel
.autochanmodes
|= chmode_table
[(unsigned char) *pm
].mode_type
;
1829 ConfigChannel
.autochanmodes
&= ~chmode_table
[(unsigned char) *pm
].mode_type
;
1833 conf_report_error("channel::autochanmodes -- Invalid channel mode %c", *pm
);
1842 static void conf_set_blacklist_reason(void *data
);
1845 conf_set_blacklist_host(void *data
)
1847 if (yy_blacklist_host
)
1849 conf_report_error("blacklist::host %s overlaps existing host %s",
1850 (char *)data
, yy_blacklist_host
);
1853 conf_set_blacklist_reason(NULL
);
1857 yy_blacklist_ipv4
= 1;
1858 yy_blacklist_ipv6
= 0;
1859 yy_blacklist_host
= rb_strdup(data
);
1863 conf_set_blacklist_type(void *data
)
1865 conf_parm_t
*args
= data
;
1867 /* Don't assume we have either if we got here */
1868 yy_blacklist_ipv4
= 0;
1869 yy_blacklist_ipv6
= 0;
1871 for (; args
; args
= args
->next
)
1873 if (!strcasecmp(args
->v
.string
, "ipv4"))
1874 yy_blacklist_ipv4
= 1;
1875 else if (!strcasecmp(args
->v
.string
, "ipv6"))
1876 yy_blacklist_ipv6
= 1;
1878 conf_report_error("blacklist::type has unknown address family %s",
1882 /* If we have neither, just default to IPv4 */
1883 if (!yy_blacklist_ipv4
&& !yy_blacklist_ipv6
)
1885 conf_report_error("blacklist::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
1886 yy_blacklist_ipv4
= 1;
1891 conf_set_blacklist_matches(void *data
)
1893 conf_parm_t
*args
= data
;
1895 for (; args
; args
= args
->next
)
1897 struct BlacklistFilter
*filter
;
1898 char *str
= args
->v
.string
;
1900 int type
= BLACKLIST_FILTER_LAST
;
1902 if (CF_TYPE(args
->type
) != CF_QSTRING
)
1904 conf_report_error("blacklist::matches -- must be quoted string");
1910 conf_report_error("blacklist::matches -- invalid entry");
1914 if (strlen(str
) > HOSTIPLEN
)
1916 conf_report_error("blacklist::matches has an entry too long: %s",
1921 for (p
= str
; *p
!= '\0'; p
++)
1923 /* Check for validity */
1925 type
= BLACKLIST_FILTER_ALL
;
1926 else if (!isalnum((unsigned char)*p
))
1928 conf_report_error("blacklist::matches has invalid IP match entry %s",
1935 if (type
== BLACKLIST_FILTER_ALL
)
1937 /* Basic IP sanity check */
1938 struct rb_sockaddr_storage tmp
;
1939 if (rb_inet_pton(AF_INET
, str
, &tmp
) <= 0)
1941 conf_report_error("blacklist::matches has invalid IP match entry %s",
1946 else if (type
== BLACKLIST_FILTER_LAST
)
1948 /* Verify it's the correct length */
1949 if (strlen(str
) > 3)
1951 conf_report_error("blacklist::matches has invalid octet match entry %s",
1958 continue; /* Invalid entry */
1961 filter
= rb_malloc(sizeof(struct BlacklistFilter
));
1962 filter
->type
= type
;
1963 rb_strlcpy(filter
->filterstr
, str
, sizeof(filter
->filterstr
));
1965 rb_dlinkAdd(filter
, &filter
->node
, &yy_blacklist_filters
);
1970 conf_set_blacklist_reason(void *data
)
1972 rb_dlink_node
*ptr
, *nptr
;
1974 if (yy_blacklist_host
&& data
)
1976 yy_blacklist_reason
= rb_strdup(data
);
1977 if (yy_blacklist_ipv6
)
1979 /* Make sure things fit (64 = alnum count + dots) */
1980 if ((64 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1982 conf_report_error("blacklist::host %s results in IPv6 queries that are too long",
1987 /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
1988 if (yy_blacklist_ipv4
&& !yy_blacklist_ipv6
)
1990 /* Make sure things fit (16 = number of nums + dots) */
1991 if ((16 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1993 conf_report_error("blacklist::host %s results in IPv4 queries that are too long",
1999 new_blacklist(yy_blacklist_host
, yy_blacklist_reason
, yy_blacklist_ipv4
, yy_blacklist_ipv6
,
2000 &yy_blacklist_filters
);
2006 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_blacklist_filters
.head
)
2008 rb_dlinkDelete(ptr
, &yy_blacklist_filters
);
2014 yy_blacklist_filters
= (rb_dlink_list
){ NULL
, NULL
, 0 };
2017 rb_free(yy_blacklist_host
);
2018 rb_free(yy_blacklist_reason
);
2019 yy_blacklist_host
= NULL
;
2020 yy_blacklist_reason
= NULL
;
2021 yy_blacklist_ipv4
= 1;
2022 yy_blacklist_ipv6
= 0;
2025 /* public functions */
2029 conf_report_error(const char *fmt
, ...)
2032 char msg
[BUFSIZE
+ 1] = { 0 };
2035 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2040 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2044 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2045 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "error: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2049 conf_report_warning(const char *fmt
, ...)
2052 char msg
[BUFSIZE
+ 1] = { 0 };
2055 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2060 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2064 iwarn("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2065 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "warning: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2069 conf_start_block(char *block
, char *name
)
2071 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
2073 conf_report_error("Configuration block '%s' is not defined.", block
);
2078 conf_cur_block_name
= rb_strdup(name
);
2080 conf_cur_block_name
= NULL
;
2082 if(conf_cur_block
->tc_sfunc
)
2083 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
2090 conf_end_block(struct TopConf
*tc
)
2094 ret
= tc
->tc_efunc(tc
);
2096 rb_free(conf_cur_block_name
);
2097 conf_cur_block_name
= NULL
;
2102 conf_set_generic_int(void *data
, void *location
)
2104 *((int *) location
) = *((unsigned int *) data
);
2108 conf_set_generic_string(void *data
, int len
, void *location
)
2110 char **loc
= location
;
2113 if(len
&& strlen(input
) > (unsigned int)len
)
2117 *loc
= rb_strdup(input
);
2121 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
)
2123 struct ConfEntry
*cf
;
2129 if((cf
= find_conf_item(tc
, item
)) == NULL
)
2132 ("Non-existant configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
2136 /* if it takes one thing, make sure they only passed one thing,
2137 and handle as needed. */
2138 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
2141 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
2148 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
2150 /* if it expects a string value, but we got a yesno,
2153 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
2154 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
2156 value
->v
.list
->type
= CF_STRING
;
2158 if(cp
->v
.number
== 1)
2159 cp
->v
.string
= rb_strdup("yes");
2161 cp
->v
.string
= rb_strdup("no");
2164 /* maybe it's a CF_TIME and they passed CF_INT --
2165 should still be valid */
2166 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
2167 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
2170 ("Wrong type for %s::%s (expected %s, got %s)",
2171 tc
->tc_name
, (char *) item
,
2172 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
2177 if(cf
->cf_type
& CF_FLIST
)
2181 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
2184 /* just pass it the extended argument list */
2185 cf
->cf_func(value
->v
.list
);
2189 /* it's old-style, needs only one arg */
2190 switch (cf
->cf_type
)
2196 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2198 cf
->cf_func(&cp
->v
.number
);
2202 if(EmptyString(cp
->v
.string
))
2203 conf_report_error("Ignoring %s::%s -- empty field",
2206 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2208 cf
->cf_func(cp
->v
.string
);
2218 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2221 struct ConfEntry
*cf
;
2223 if((tc
= find_top_conf(topconf
)) == NULL
)
2226 if(find_conf_item(tc
, name
) != NULL
)
2229 cf
= rb_malloc(sizeof(struct ConfEntry
));
2236 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2242 remove_conf_item(const char *topconf
, const char *name
)
2245 struct ConfEntry
*cf
;
2248 if((tc
= find_top_conf(topconf
)) == NULL
)
2251 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2254 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2257 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2264 static struct ConfEntry conf_serverinfo_table
[] =
2266 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2268 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2269 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2270 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2271 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2272 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2274 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2275 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2276 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2277 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2278 { "ssl_cipher_list", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cipher_list
},
2279 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2281 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2283 { "nicklen", CF_INT
, conf_set_serverinfo_nicklen
, 0, NULL
},
2285 { "\0", 0, NULL
, 0, NULL
}
2288 static struct ConfEntry conf_admin_table
[] =
2290 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2291 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2292 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2293 { "\0", 0, NULL
, 0, NULL
}
2296 static struct ConfEntry conf_log_table
[] =
2298 { "fname_userlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_userlog
},
2299 { "fname_fuserlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_fuserlog
},
2300 { "fname_operlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operlog
},
2301 { "fname_foperlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_foperlog
},
2302 { "fname_serverlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_serverlog
},
2303 { "fname_killlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_killlog
},
2304 { "fname_klinelog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_klinelog
},
2305 { "fname_operspylog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operspylog
},
2306 { "fname_ioerrorlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_ioerrorlog
},
2307 { "\0", 0, NULL
, 0, NULL
}
2310 static struct ConfEntry conf_operator_table
[] =
2312 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2313 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2314 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2315 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2316 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2317 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2318 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2319 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2320 { "\0", 0, NULL
, 0, NULL
}
2323 static struct ConfEntry conf_privset_table
[] =
2325 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2326 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2327 { "\0", 0, NULL
, 0, NULL
}
2330 static struct ConfEntry conf_class_table
[] =
2332 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2333 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2335 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2337 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2338 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2339 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2340 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2341 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2342 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2343 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2344 { "\0", 0, NULL
, 0, NULL
}
2347 static struct ConfEntry conf_auth_table
[] =
2349 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2350 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2351 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2352 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2353 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2354 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2355 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2356 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2357 { "\0", 0, NULL
, 0, NULL
}
2360 static struct ConfEntry conf_connect_table
[] =
2362 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2363 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2364 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2365 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2366 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2367 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2368 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2369 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2370 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
2371 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
2372 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2373 { "\0", 0, NULL
, 0, NULL
}
2376 static struct ConfEntry conf_general_table
[] =
2378 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2379 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2380 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2381 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
2382 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2383 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2384 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
2385 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2386 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2387 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2389 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2390 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2391 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2392 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2393 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2394 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2395 { "sasl_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.sasl_service
},
2397 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2398 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2399 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2400 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2401 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2403 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2404 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2405 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2406 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2407 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2408 { "resv_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.resv_fnc
},
2409 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2410 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2411 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2412 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2413 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2414 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2415 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2416 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2417 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2418 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2419 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2420 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2421 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2422 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2423 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2424 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2425 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2426 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2427 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2428 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2429 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2430 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2431 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2432 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2433 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2434 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2435 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2436 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2437 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2438 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2439 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2440 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2441 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2442 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2443 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2444 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2445 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2446 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2447 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2448 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2449 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2450 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2451 { "client_flood_max_lines", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_max_lines
},
2452 { "client_flood_burst_rate", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_rate
},
2453 { "client_flood_burst_max", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_max
},
2454 { "client_flood_message_num", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_num
},
2455 { "client_flood_message_time", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_time
},
2456 { "max_ratelimit_tokens", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_ratelimit_tokens
},
2457 { "away_interval", CF_INT
, NULL
, 0, &ConfigFileEntry
.away_interval
},
2458 { "hide_opers_in_whois", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_opers_in_whois
},
2459 { "certfp_method", CF_STRING
, conf_set_general_certfp_method
, 0, NULL
},
2460 { "\0", 0, NULL
, 0, NULL
}
2463 static struct ConfEntry conf_channel_table
[] =
2465 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2466 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2467 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2468 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2469 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2470 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2471 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2472 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2473 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2474 { "max_chans_per_user_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user_large
},
2475 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2476 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2477 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2478 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2479 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2480 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2481 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2482 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2483 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2484 { "disable_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.disable_local_channels
},
2485 { "autochanmodes", CF_QSTRING
, conf_set_channel_autochanmodes
, 0, NULL
},
2486 { "displayed_usercount", CF_INT
, NULL
, 0, &ConfigChannel
.displayed_usercount
},
2487 { "strip_topic_colors", CF_YESNO
, NULL
, 0, &ConfigChannel
.strip_topic_colors
},
2488 { "\0", 0, NULL
, 0, NULL
}
2491 static struct ConfEntry conf_serverhide_table
[] =
2493 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2494 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2495 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2496 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2497 { "\0", 0, NULL
, 0, NULL
}
2504 add_top_conf("modules", NULL
, NULL
, NULL
);
2505 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2506 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2508 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2509 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2510 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2511 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2512 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2513 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2515 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2516 add_conf_item("listen", "defer_accept", CF_YESNO
, conf_set_listen_defer_accept
);
2517 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2518 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2519 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2520 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2522 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2524 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
2525 add_conf_item("shared", "oper", CF_QSTRING
| CF_FLIST
, conf_set_shared_oper
);
2526 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
2528 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2530 add_top_conf("exempt", NULL
, NULL
, NULL
);
2531 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2533 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2534 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2535 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2537 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2538 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2539 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2541 add_top_conf("service", NULL
, NULL
, NULL
);
2542 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2544 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2545 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2546 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2548 add_top_conf("blacklist", NULL
, NULL
, NULL
);
2549 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_blacklist_host
);
2550 add_conf_item("blacklist", "type", CF_STRING
| CF_FLIST
, conf_set_blacklist_type
);
2551 add_conf_item("blacklist", "matches", CF_QSTRING
| CF_FLIST
, conf_set_blacklist_matches
);
2552 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_blacklist_reason
);