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"
29 #include "privilege.h"
33 #define CF_TYPE(x) ((x) & CF_MTYPE)
35 static int yy_defer_accept
= 1;
36 static int yy_wsock
= 0;
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_cluster_list
;
53 static struct oper_conf
*yy_oper
= NULL
;
55 static struct alias_entry
*yy_alias
= NULL
;
57 static char *yy_dnsbl_entry_host
= NULL
;
58 static char *yy_dnsbl_entry_reason
= NULL
;
59 static uint8_t yy_dnsbl_entry_iptype
= 0;
60 static rb_dlink_list yy_dnsbl_entry_filters
= { NULL
, NULL
, 0 };
62 static char *yy_opm_address_ipv4
= NULL
;
63 static char *yy_opm_address_ipv6
= NULL
;
64 static uint16_t yy_opm_port_ipv4
= 0;
65 static uint16_t yy_opm_port_ipv6
= 0;
66 static int yy_opm_timeout
= 0;
67 static rb_dlink_list yy_opm_scanner_list
;
69 static char *yy_privset_extends
= NULL
;
72 conf_strtype(int type
)
74 switch (CF_TYPE(type
))
77 return "integer value";
79 return "unquoted string";
81 return "yes/no value";
83 return "quoted string";
85 return "time/size value";
87 return "unknown type";
92 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
93 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
97 tc
= rb_malloc(sizeof(struct TopConf
));
100 tc
->tc_sfunc
= sfunc
;
101 tc
->tc_efunc
= efunc
;
102 tc
->tc_entries
= items
;
104 rb_dlinkAddAlloc(tc
, &conf_items
);
109 find_top_conf(const char *name
)
114 RB_DLINK_FOREACH(d
, conf_items
.head
)
117 if(rb_strcasecmp(tc
->tc_name
, name
) == 0)
126 find_conf_item(const struct TopConf
*top
, const char *name
)
128 struct ConfEntry
*cf
;
135 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
137 cf
= &top
->tc_entries
[i
];
139 if(!rb_strcasecmp(cf
->cf_name
, name
))
144 RB_DLINK_FOREACH(d
, top
->tc_items
.head
)
147 if(rb_strcasecmp(cf
->cf_name
, name
) == 0)
155 remove_top_conf(char *name
)
160 if((tc
= find_top_conf(name
)) == NULL
)
163 if((ptr
= rb_dlinkFind(tc
, &conf_items
)) == NULL
)
166 rb_dlinkDestroy(ptr
, &conf_items
);
173 conf_set_serverinfo_name(void *data
)
175 if(ServerInfo
.name
== NULL
)
180 for(s
= data
; *s
!= '\0'; s
++)
184 conf_report_error("Ignoring serverinfo::name "
185 "-- bogus servername.");
194 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
202 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
206 /* the ircd will exit() in main() if we dont set one */
207 if(strlen(s
) <= HOSTLEN
)
208 ServerInfo
.name
= rb_strdup((char *) data
);
213 conf_set_serverinfo_sid(void *data
)
217 if(ServerInfo
.sid
[0] == '\0')
219 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
220 !IsIdChar(sid
[2]) || sid
[3] != '\0')
222 conf_report_error("Ignoring serverinfo::sid "
227 rb_strlcpy(ServerInfo
.sid
, sid
, sizeof(ServerInfo
.sid
));
232 conf_set_serverinfo_network_name(void *data
)
236 if((p
= strchr((char *) data
, ' ')))
239 rb_free(ServerInfo
.network_name
);
240 ServerInfo
.network_name
= rb_strdup((char *) data
);
244 conf_set_serverinfo_vhost(void *data
)
246 struct rb_sockaddr_storage addr
;
248 if(rb_inet_pton_sock(data
, &addr
) <= 0 || GET_SS_FAMILY(&addr
) != AF_INET
)
250 conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data
);
254 ServerInfo
.bind4
= addr
;
258 conf_set_serverinfo_vhost6(void *data
)
261 struct rb_sockaddr_storage addr
;
263 if(rb_inet_pton_sock(data
, &addr
) <= 0 || GET_SS_FAMILY(&addr
) != AF_INET6
)
265 conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data
);
269 ServerInfo
.bind6
= addr
;
273 conf_set_serverinfo_nicklen(void *data
)
275 ConfigFileEntry
.nicklen
= (*(unsigned int *) data
) + 1;
277 if (ConfigFileEntry
.nicklen
> NICKLEN
)
279 conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)",
280 ConfigFileEntry
.nicklen
- 1, NICKLEN
- 1);
281 ConfigFileEntry
.nicklen
= NICKLEN
;
283 else if (ConfigFileEntry
.nicklen
< 9 + 1)
285 conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9",
286 ConfigFileEntry
.nicklen
- 1);
287 ConfigFileEntry
.nicklen
= 9 + 1;
292 conf_set_modules_module(void *data
)
296 m_bn
= rb_basename((char *) data
);
298 if(findmodule_byname(m_bn
) == NULL
)
299 load_one_module((char *) data
, MAPI_ORIGIN_EXTENSION
, false);
305 conf_set_modules_path(void *data
)
307 mod_add_path((char *) data
);
317 static struct mode_table umode_table
[] = {
318 {"deaf", UMODE_DEAF
},
319 {"invisible", UMODE_INVISIBLE
},
320 {"locops", UMODE_LOCOPS
},
321 {"noforward", UMODE_NOFORWARD
},
322 {"servnotice", UMODE_SERVNOTICE
},
323 {"wallop", UMODE_WALLOP
},
324 {"operwall", UMODE_OPERWALL
},
328 static struct mode_table oper_table
[] = {
329 {"encrypted", OPER_ENCRYPTED
},
330 {"need_ssl", OPER_NEEDSSL
},
334 static struct mode_table auth_table
[] = {
335 {"encrypted", CONF_FLAGS_ENCRYPTED
},
336 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
337 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
338 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
339 {"proxy_exempt", CONF_FLAGS_EXEMPTPROXY
},
340 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
341 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
342 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
343 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
344 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
345 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
346 {"no_tilde", CONF_FLAGS_NO_TILDE
},
347 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
348 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
349 {"need_ssl", CONF_FLAGS_NEED_SSL
},
350 {"need_sasl", CONF_FLAGS_NEED_SASL
},
351 {"extend_chans", CONF_FLAGS_EXTEND_CHANS
},
352 {"allow_sctp", CONF_FLAGS_ALLOW_SCTP
},
353 {"kline_spoof_ip", CONF_FLAGS_KLINE_SPOOF
},
357 static struct mode_table connect_table
[] = {
358 { "autoconn", SERVER_AUTOCONN
},
359 { "compressed", SERVER_COMPRESSED
},
360 { "encrypted", SERVER_ENCRYPTED
},
361 { "topicburst", SERVER_TB
},
362 { "sctp", SERVER_SCTP
},
363 { "ssl", SERVER_SSL
},
364 { "no-export", SERVER_NO_EXPORT
},
368 static struct mode_table cluster_table
[] = {
369 { "kline", SHARED_PKLINE
},
370 { "tkline", SHARED_TKLINE
},
371 { "unkline", SHARED_UNKLINE
},
372 { "locops", SHARED_LOCOPS
},
373 { "xline", SHARED_PXLINE
},
374 { "txline", SHARED_TXLINE
},
375 { "unxline", SHARED_UNXLINE
},
376 { "resv", SHARED_PRESV
},
377 { "tresv", SHARED_TRESV
},
378 { "unresv", SHARED_UNRESV
},
379 { "all", CLUSTER_ALL
},
385 find_umode(struct mode_table
*tab
, const char *name
)
389 for (i
= 0; tab
[i
].name
; i
++)
391 if(strcmp(tab
[i
].name
, name
) == 0)
399 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
401 for (; args
; args
= args
->next
)
407 if(CF_TYPE(args
->type
) != CF_STRING
)
409 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
413 umode
= args
->v
.string
;
421 mode
= find_umode(tab
, umode
);
425 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
442 conf_set_privset_extends(void *data
)
444 yy_privset_extends
= rb_strdup((char *) data
);
448 conf_set_privset_privs(void *data
)
451 conf_parm_t
*args
= data
;
453 for (; args
; args
= args
->next
)
456 privs
= rb_strdup(args
->v
.string
);
459 char *privs_old
= privs
;
461 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
462 strcpy(privs
, privs_old
);
464 strcat(privs
, args
->v
.string
);
472 if (yy_privset_extends
)
474 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
478 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
480 set
= privilegeset_get("default");
483 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
485 rb_free(yy_privset_extends
);
486 yy_privset_extends
= NULL
;
489 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
496 conf_begin_oper(struct TopConf
*tc
)
499 rb_dlink_node
*next_ptr
;
503 free_oper_conf(yy_oper
);
507 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
509 free_oper_conf(ptr
->data
);
510 rb_dlinkDestroy(ptr
, &yy_oper_list
);
513 yy_oper
= make_oper_conf();
514 yy_oper
->flags
|= OPER_ENCRYPTED
;
520 conf_end_oper(struct TopConf
*tc
)
522 struct oper_conf
*yy_tmpoper
;
524 rb_dlink_node
*next_ptr
;
526 if(conf_cur_block_name
!= NULL
)
528 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
529 conf_cur_block_name
[OPERNICKLEN
] = '\0';
531 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
534 if(EmptyString(yy_oper
->name
))
536 conf_report_error("Ignoring operator block -- missing name.");
540 #ifdef HAVE_LIBCRYPTO
541 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
543 if(EmptyString(yy_oper
->passwd
))
546 conf_report_error("Ignoring operator block for %s -- missing password",
552 if (!yy_oper
->privset
)
553 yy_oper
->privset
= privilegeset_get("default");
555 /* now, yy_oper_list contains a stack of oper_conf's with just user
556 * and host in, yy_oper contains the rest of the information which
557 * we need to copy into each element in yy_oper_list
559 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
561 yy_tmpoper
= ptr
->data
;
563 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
565 /* could be an rsa key instead.. */
566 if(!EmptyString(yy_oper
->passwd
))
567 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
569 yy_tmpoper
->flags
= yy_oper
->flags
;
570 yy_tmpoper
->umodes
= yy_oper
->umodes
;
571 yy_tmpoper
->snomask
= yy_oper
->snomask
;
572 yy_tmpoper
->privset
= yy_oper
->privset
;
574 #ifdef HAVE_LIBCRYPTO
575 if(yy_oper
->rsa_pubkey_file
)
579 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
581 conf_report_error("Ignoring operator block for %s -- "
582 "rsa_public_key_file cant be opened",
587 yy_tmpoper
->rsa_pubkey
=
588 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
590 (void)BIO_set_close(file
, BIO_CLOSE
);
593 if(yy_tmpoper
->rsa_pubkey
== NULL
)
595 conf_report_error("Ignoring operator block for %s -- "
596 "rsa_public_key_file key invalid; check syntax",
602 if(!EmptyString(yy_oper
->certfp
))
603 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
606 /* all is ok, put it on oper_conf_list */
607 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
610 free_oper_conf(yy_oper
);
617 conf_set_oper_flags(void *data
)
619 conf_parm_t
*args
= data
;
621 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
625 conf_set_oper_fingerprint(void *data
)
628 rb_free(yy_oper
->certfp
);
629 yy_oper
->certfp
= rb_strdup((char *) data
);
633 conf_set_oper_privset(void *data
)
635 yy_oper
->privset
= privilegeset_get((char *) data
);
639 conf_set_oper_user(void *data
)
641 struct oper_conf
*yy_tmpoper
;
643 char *host
= (char *) data
;
645 yy_tmpoper
= make_oper_conf();
647 if((p
= strchr(host
, '@')))
651 yy_tmpoper
->username
= rb_strdup(host
);
652 yy_tmpoper
->host
= rb_strdup(p
);
657 yy_tmpoper
->username
= rb_strdup("*");
658 yy_tmpoper
->host
= rb_strdup(host
);
661 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
663 conf_report_error("Ignoring user -- missing username/host");
664 free_oper_conf(yy_tmpoper
);
668 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
672 conf_set_oper_password(void *data
)
676 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
677 rb_free(yy_oper
->passwd
);
680 yy_oper
->passwd
= rb_strdup((char *) data
);
684 conf_set_oper_rsa_public_key_file(void *data
)
686 #ifdef HAVE_LIBCRYPTO
687 rb_free(yy_oper
->rsa_pubkey_file
);
688 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
690 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
695 conf_set_oper_umodes(void *data
)
697 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
701 conf_set_oper_snomask(void *data
)
703 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
707 conf_begin_class(struct TopConf
*tc
)
710 free_class(yy_class
);
712 yy_class
= make_class();
717 conf_end_class(struct TopConf
*tc
)
719 if(conf_cur_block_name
!= NULL
)
720 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
722 if(EmptyString(yy_class
->class_name
))
724 conf_report_error("Ignoring connect block -- missing name.");
734 conf_set_class_ping_time(void *data
)
736 yy_class
->ping_freq
= *(unsigned int *) data
;
740 conf_set_class_cidr_ipv4_bitlen(void *data
)
742 unsigned int maxsize
= 32;
743 if(*(unsigned int *) data
> maxsize
)
745 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
746 *(unsigned int *) data
, maxsize
);
748 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
753 conf_set_class_cidr_ipv6_bitlen(void *data
)
755 unsigned int maxsize
= 128;
756 if(*(unsigned int *) data
> maxsize
)
758 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
759 *(unsigned int *) data
, maxsize
);
761 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
766 conf_set_class_number_per_cidr(void *data
)
768 yy_class
->cidr_amount
= *(unsigned int *) data
;
772 conf_set_class_number_per_ip(void *data
)
774 yy_class
->max_local
= *(unsigned int *) data
;
779 conf_set_class_number_per_ip_global(void *data
)
781 yy_class
->max_global
= *(unsigned int *) data
;
785 conf_set_class_number_per_ident(void *data
)
787 yy_class
->max_ident
= *(unsigned int *) data
;
791 conf_set_class_connectfreq(void *data
)
793 yy_class
->con_freq
= *(unsigned int *) data
;
797 conf_set_class_max_number(void *data
)
799 yy_class
->max_total
= *(unsigned int *) data
;
803 conf_set_class_max_autoconn(void *data
)
805 yy_class
->max_autoconn
= *(unsigned int *) data
;
809 conf_set_class_sendq(void *data
)
811 yy_class
->max_sendq
= *(unsigned int *) data
;
814 static char *listener_address
[2];
817 conf_begin_listen(struct TopConf
*tc
)
819 for (int i
= 0; i
< ARRAY_SIZE(listener_address
); i
++) {
820 rb_free(listener_address
[i
]);
821 listener_address
[i
] = NULL
;
829 conf_end_listen(struct TopConf
*tc
)
831 for (int i
= 0; i
< ARRAY_SIZE(listener_address
); i
++) {
832 rb_free(listener_address
[i
]);
833 listener_address
[i
] = NULL
;
841 conf_set_listen_defer_accept(void *data
)
843 yy_defer_accept
= *(unsigned int *) data
;
847 conf_set_listen_wsock(void *data
)
849 yy_wsock
= *(unsigned int *) data
;
853 conf_set_listen_port_both(void *data
, int ssl
, int sctp
)
855 conf_parm_t
*args
= data
;
856 for (; args
; args
= args
->next
)
858 if(CF_TYPE(args
->type
) != CF_INT
)
860 conf_report_error("listener::port argument is not an integer -- ignoring.");
863 if(listener_address
[0] == NULL
)
866 conf_report_error("listener::sctp_port has no addresses -- ignoring.");
868 add_tcp_listener(args
->v
.number
, NULL
, AF_INET
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
869 add_tcp_listener(args
->v
.number
, NULL
, AF_INET6
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
875 if(strchr(listener_address
[0], ':') != NULL
)
882 add_sctp_listener(args
->v
.number
, listener_address
[0], listener_address
[1], ssl
, yy_wsock
);
884 conf_report_error("Warning -- ignoring listener::sctp_port -- SCTP support not available.");
887 add_tcp_listener(args
->v
.number
, listener_address
[0], family
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
894 conf_set_listen_port(void *data
)
896 conf_set_listen_port_both(data
, 0, 0);
900 conf_set_listen_sslport(void *data
)
902 conf_set_listen_port_both(data
, 1, 0 );
906 conf_set_listen_sctp_port(void *data
)
908 conf_set_listen_port_both(data
, 0, 1);
912 conf_set_listen_sctp_sslport(void *data
)
914 conf_set_listen_port_both(data
, 1, 1);
918 conf_set_listen_address(void *data
)
920 rb_free(listener_address
[1]);
921 listener_address
[1] = listener_address
[0];
922 listener_address
[0] = rb_strdup(data
);
926 conf_begin_auth(struct TopConf
*tc
)
929 rb_dlink_node
*next_ptr
;
934 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
936 free_conf(ptr
->data
);
937 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
940 yy_aconf
= make_conf();
941 yy_aconf
->status
= CONF_CLIENT
;
947 conf_end_auth(struct TopConf
*tc
)
949 struct ConfItem
*yy_tmp
, *found_conf
;
951 rb_dlink_node
*next_ptr
;
953 if(EmptyString(yy_aconf
->info
.name
))
954 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
956 /* didnt even get one ->host? */
957 if(EmptyString(yy_aconf
->host
))
959 conf_report_error("Ignoring auth block -- missing user@host");
963 /* so the stacking works in order.. */
964 collapse(yy_aconf
->user
);
965 collapse(yy_aconf
->host
);
966 conf_add_class_to_conf(yy_aconf
);
967 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
968 conf_report_error("Ignoring redundant auth block (after *@*)");
969 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
970 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
971 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
972 conf_report_error("Ignoring duplicate auth block for %s@%s",
973 yy_aconf
->user
, yy_aconf
->host
);
975 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
977 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
982 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
984 if(yy_aconf
->spasswd
)
985 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
987 /* this will always exist.. */
988 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
990 if(yy_aconf
->className
)
991 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
993 yy_tmp
->flags
= yy_aconf
->flags
;
994 yy_tmp
->port
= yy_aconf
->port
;
996 collapse(yy_tmp
->user
);
997 collapse(yy_tmp
->host
);
999 conf_add_class_to_conf(yy_tmp
);
1001 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
1002 conf_report_error("Ignoring redundant auth block (after *@*)");
1003 else if ((found_conf
= find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
)) &&
1004 (!found_conf
->spasswd
|| (yy_tmp
->spasswd
&&
1005 0 == irccmp(found_conf
->spasswd
, yy_tmp
->spasswd
))))
1006 conf_report_error("Ignoring duplicate auth block for %s@%s",
1007 yy_tmp
->user
, yy_tmp
->host
);
1009 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
1010 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1018 conf_set_auth_user(void *data
)
1020 struct ConfItem
*yy_tmp
;
1023 /* The first user= line doesn't allocate a new conf */
1024 if(!EmptyString(yy_aconf
->host
))
1026 yy_tmp
= make_conf();
1027 yy_tmp
->status
= CONF_CLIENT
;
1032 if((p
= strchr(data
, '@')))
1036 yy_tmp
->user
= rb_strdup(data
);
1037 yy_tmp
->host
= rb_strdup(p
);
1041 yy_tmp
->user
= rb_strdup("*");
1042 yy_tmp
->host
= rb_strdup(data
);
1045 if(yy_aconf
!= yy_tmp
)
1046 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1050 conf_set_auth_auth_user(void *data
)
1052 if(yy_aconf
->spasswd
)
1053 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1054 rb_free(yy_aconf
->spasswd
);
1055 yy_aconf
->spasswd
= rb_strdup(data
);
1059 conf_set_auth_passwd(void *data
)
1061 if(yy_aconf
->passwd
)
1062 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1063 rb_free(yy_aconf
->passwd
);
1064 yy_aconf
->passwd
= rb_strdup(data
);
1068 conf_set_auth_spoof(void *data
)
1076 /* user@host spoof */
1077 if((p
= strchr(host
, '@')) != NULL
)
1083 if(EmptyString(user
))
1085 conf_report_error("Warning -- spoof ident empty.");
1089 if(strlen(user
) > USERLEN
)
1091 conf_report_error("Warning -- spoof ident length invalid.");
1095 if(!valid_username(user
))
1097 conf_report_error("Warning -- invalid spoof (ident).");
1101 /* this must be restored! */
1105 if(EmptyString(host
))
1107 conf_report_error("Warning -- spoof host empty.");
1111 if(strlen(host
) > HOSTLEN
)
1113 conf_report_error("Warning -- spoof host length invalid.");
1117 if(!valid_hostname(host
))
1119 conf_report_error("Warning -- invalid spoof (host).");
1123 rb_free(yy_aconf
->info
.name
);
1124 yy_aconf
->info
.name
= rb_strdup(data
);
1125 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1129 conf_set_auth_flags(void *data
)
1131 conf_parm_t
*args
= data
;
1133 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1137 conf_set_auth_redir_serv(void *data
)
1139 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1140 rb_free(yy_aconf
->info
.name
);
1141 yy_aconf
->info
.name
= rb_strdup(data
);
1145 conf_set_auth_redir_port(void *data
)
1147 int port
= *(unsigned int *) data
;
1149 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1150 yy_aconf
->port
= port
;
1154 conf_set_auth_class(void *data
)
1156 rb_free(yy_aconf
->className
);
1157 yy_aconf
->className
= rb_strdup(data
);
1161 conf_begin_connect(struct TopConf
*tc
)
1164 free_server_conf(yy_server
);
1166 yy_server
= make_server_conf();
1167 yy_server
->port
= PORTNUM
;
1168 yy_server
->flags
|= SERVER_TB
;
1170 if(conf_cur_block_name
!= NULL
)
1171 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1177 conf_end_connect(struct TopConf
*tc
)
1179 if(EmptyString(yy_server
->name
))
1181 conf_report_error("Ignoring connect block -- missing name.");
1185 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1187 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1192 if((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
)) && EmptyString(yy_server
->certfp
))
1194 conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
1199 if((yy_server
->flags
& SERVER_SSL
) && EmptyString(yy_server
->certfp
))
1201 conf_report_error("Ignoring connect block for %s -- no fingerprint provided for SSL connection.",
1206 if(EmptyString(yy_server
->connect_host
)
1207 && GET_SS_FAMILY(&yy_server
->connect4
) != AF_INET
1208 && GET_SS_FAMILY(&yy_server
->connect6
) != AF_INET6
1211 conf_report_error("Ignoring connect block for %s -- missing host.",
1217 if(ServerConfCompressed(yy_server
))
1219 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1220 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1224 add_server_conf(yy_server
);
1225 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1232 conf_set_connect_host(void *data
)
1234 struct rb_sockaddr_storage addr
;
1236 if(rb_inet_pton_sock(data
, &addr
) <= 0)
1238 rb_free(yy_server
->connect_host
);
1239 yy_server
->connect_host
= rb_strdup(data
);
1241 else if(GET_SS_FAMILY(&addr
) == AF_INET
)
1243 yy_server
->connect4
= addr
;
1245 else if(GET_SS_FAMILY(&addr
) == AF_INET6
)
1247 yy_server
->connect6
= addr
;
1251 conf_report_error("Unsupported IP address for server connect host (%s)",
1258 conf_set_connect_vhost(void *data
)
1260 struct rb_sockaddr_storage addr
;
1262 if(rb_inet_pton_sock(data
, &addr
) <= 0)
1264 rb_free(yy_server
->bind_host
);
1265 yy_server
->bind_host
= rb_strdup(data
);
1267 else if(GET_SS_FAMILY(&addr
) == AF_INET
)
1269 yy_server
->bind4
= addr
;
1271 else if(GET_SS_FAMILY(&addr
) == AF_INET6
)
1273 yy_server
->bind6
= addr
;
1277 conf_report_error("Unsupported IP address for server connect vhost (%s)",
1284 conf_set_connect_send_password(void *data
)
1286 if(yy_server
->spasswd
)
1288 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1289 rb_free(yy_server
->spasswd
);
1292 yy_server
->spasswd
= rb_strdup(data
);
1296 conf_set_connect_accept_password(void *data
)
1298 if(yy_server
->passwd
)
1300 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1301 rb_free(yy_server
->passwd
);
1303 yy_server
->passwd
= rb_strdup(data
);
1307 conf_set_connect_fingerprint(void *data
)
1309 if (yy_server
->certfp
)
1310 rb_free(yy_server
->certfp
);
1311 yy_server
->certfp
= rb_strdup((char *) data
);
1313 /* force SSL to be enabled if fingerprint is enabled. */
1314 yy_server
->flags
|= SERVER_SSL
;
1318 conf_set_connect_port(void *data
)
1320 int port
= *(unsigned int *) data
;
1325 yy_server
->port
= port
;
1329 conf_set_connect_aftype(void *data
)
1333 if(rb_strcasecmp(aft
, "ipv4") == 0)
1334 yy_server
->aftype
= AF_INET
;
1335 else if(rb_strcasecmp(aft
, "ipv6") == 0)
1336 yy_server
->aftype
= AF_INET6
;
1338 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1342 conf_set_connect_flags(void *data
)
1344 conf_parm_t
*args
= data
;
1346 /* note, we allow them to set compressed, then remove it later if
1347 * they do and LIBZ isnt available
1349 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1353 conf_set_connect_hub_mask(void *data
)
1355 struct remote_conf
*yy_hub
;
1357 if(EmptyString(yy_server
->name
))
1360 yy_hub
= make_remote_conf();
1361 yy_hub
->flags
= CONF_HUB
;
1363 yy_hub
->host
= rb_strdup(data
);
1364 yy_hub
->server
= rb_strdup(yy_server
->name
);
1365 rb_dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1369 conf_set_connect_leaf_mask(void *data
)
1371 struct remote_conf
*yy_leaf
;
1373 if(EmptyString(yy_server
->name
))
1376 yy_leaf
= make_remote_conf();
1377 yy_leaf
->flags
= CONF_LEAF
;
1379 yy_leaf
->host
= rb_strdup(data
);
1380 yy_leaf
->server
= rb_strdup(yy_server
->name
);
1381 rb_dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1385 conf_set_connect_class(void *data
)
1387 rb_free(yy_server
->class_name
);
1388 yy_server
->class_name
= rb_strdup(data
);
1392 conf_set_exempt_ip(void *data
)
1394 struct ConfItem
*yy_tmp
;
1395 int masktype
= parse_netmask_strict(data
, NULL
, NULL
);
1397 if(masktype
!= HM_IPV4
&& masktype
!= HM_IPV6
)
1399 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1403 yy_tmp
= make_conf();
1404 yy_tmp
->passwd
= rb_strdup("*");
1405 yy_tmp
->host
= rb_strdup(data
);
1406 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1407 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1411 conf_set_secure_ip(void *data
)
1413 struct ConfItem
*yy_tmp
;
1414 int masktype
= parse_netmask_strict(data
, NULL
, NULL
);
1416 if(masktype
!= HM_IPV4
&& masktype
!= HM_IPV6
)
1418 conf_report_error("Ignoring secure -- invalid secure::ip.");
1422 yy_tmp
= make_conf();
1423 yy_tmp
->passwd
= rb_strdup("*");
1424 yy_tmp
->host
= rb_strdup(data
);
1425 yy_tmp
->status
= CONF_SECURE
;
1426 add_conf_by_address(yy_tmp
->host
, CONF_SECURE
, NULL
, NULL
, yy_tmp
);
1430 conf_cleanup_cluster(struct TopConf
*tc
)
1432 rb_dlink_node
*ptr
, *next_ptr
;
1434 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1436 free_remote_conf(ptr
->data
);
1437 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1440 if(yy_shared
!= NULL
)
1442 free_remote_conf(yy_shared
);
1450 conf_set_cluster_name(void *data
)
1452 if(yy_shared
!= NULL
)
1453 free_remote_conf(yy_shared
);
1455 yy_shared
= make_remote_conf();
1456 yy_shared
->server
= rb_strdup(data
);
1457 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1463 conf_set_cluster_flags(void *data
)
1465 conf_parm_t
*args
= data
;
1467 rb_dlink_node
*ptr
, *next_ptr
;
1469 if(yy_shared
!= NULL
)
1470 free_remote_conf(yy_shared
);
1472 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1474 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1476 yy_shared
= ptr
->data
;
1477 yy_shared
->flags
= flags
;
1478 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1479 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1486 conf_set_general_havent_read_conf(void *data
)
1488 if(*(unsigned int *) data
)
1490 conf_report_error("You haven't read your config file properly.");
1492 ("There is a line in the example conf that will kill your server if not removed.");
1494 ("Consider actually reading/editing the conf file, and removing this line.");
1501 conf_set_general_hide_error_messages(void *data
)
1505 if(rb_strcasecmp(val
, "yes") == 0)
1506 ConfigFileEntry
.hide_error_messages
= 2;
1507 else if(rb_strcasecmp(val
, "opers") == 0)
1508 ConfigFileEntry
.hide_error_messages
= 1;
1509 else if(rb_strcasecmp(val
, "no") == 0)
1510 ConfigFileEntry
.hide_error_messages
= 0;
1512 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1516 conf_set_general_stats_k_oper_only(void *data
)
1520 if(rb_strcasecmp(val
, "yes") == 0)
1521 ConfigFileEntry
.stats_k_oper_only
= 2;
1522 else if(rb_strcasecmp(val
, "masked") == 0)
1523 ConfigFileEntry
.stats_k_oper_only
= 1;
1524 else if(rb_strcasecmp(val
, "no") == 0)
1525 ConfigFileEntry
.stats_k_oper_only
= 0;
1527 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1531 conf_set_general_stats_i_oper_only(void *data
)
1535 if(rb_strcasecmp(val
, "yes") == 0)
1536 ConfigFileEntry
.stats_i_oper_only
= 2;
1537 else if(rb_strcasecmp(val
, "masked") == 0)
1538 ConfigFileEntry
.stats_i_oper_only
= 1;
1539 else if(rb_strcasecmp(val
, "no") == 0)
1540 ConfigFileEntry
.stats_i_oper_only
= 0;
1542 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1546 conf_set_general_compression_level(void *data
)
1549 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1551 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1554 ("Invalid general::compression_level %d -- using default.",
1555 ConfigFileEntry
.compression_level
);
1556 ConfigFileEntry
.compression_level
= 0;
1559 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1564 conf_set_general_default_umodes(void *data
)
1567 int what
= MODE_ADD
, flag
;
1569 ConfigFileEntry
.default_umodes
= 0;
1570 for (pm
= (char *) data
; *pm
; pm
++)
1581 /* don't allow +o */
1589 if ((flag
= user_modes
[(unsigned char) *pm
]))
1591 /* Proper value has probably not yet been set
1592 * so don't check oper_only_umodes -- jilles */
1593 if (what
== MODE_ADD
)
1594 ConfigFileEntry
.default_umodes
|= flag
;
1596 ConfigFileEntry
.default_umodes
&= ~flag
;
1604 conf_set_general_oper_umodes(void *data
)
1606 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1610 conf_set_general_certfp_method(void *data
)
1612 char *method
= data
;
1614 if (!rb_strcasecmp(method
, CERTFP_NAME_CERT_SHA1
))
1615 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_CERT_SHA1
;
1616 else if (!rb_strcasecmp(method
, CERTFP_NAME_CERT_SHA256
))
1617 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_CERT_SHA256
;
1618 else if (!rb_strcasecmp(method
, CERTFP_NAME_CERT_SHA512
))
1619 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_CERT_SHA512
;
1620 else if (!rb_strcasecmp(method
, CERTFP_NAME_SPKI_SHA256
))
1621 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SPKI_SHA256
;
1622 else if (!rb_strcasecmp(method
, CERTFP_NAME_SPKI_SHA512
))
1623 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SPKI_SHA512
;
1626 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_CERT_SHA1
;
1627 conf_report_error("Ignoring general::certfp_method -- bogus certfp method %s", method
);
1632 conf_set_general_oper_only_umodes(void *data
)
1634 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1638 conf_set_general_oper_snomask(void *data
)
1641 int what
= MODE_ADD
, flag
;
1643 ConfigFileEntry
.oper_snomask
= 0;
1644 for (pm
= (char *) data
; *pm
; pm
++)
1656 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1658 if (what
== MODE_ADD
)
1659 ConfigFileEntry
.oper_snomask
|= flag
;
1661 ConfigFileEntry
.oper_snomask
&= ~flag
;
1669 conf_set_serverhide_links_delay(void *data
)
1671 int val
= *(unsigned int *) data
;
1673 ConfigServerHide
.links_delay
= val
;
1677 conf_set_service_name(void *data
)
1683 for(s
= data
; *s
!= '\0'; s
++)
1687 conf_report_error("Ignoring service::name "
1688 "-- bogus servername.");
1697 conf_report_error("Ignoring service::name -- must contain '.'");
1701 tmp
= rb_strdup(data
);
1702 rb_dlinkAddAlloc(tmp
, &service_list
);
1706 conf_begin_alias(struct TopConf
*tc
)
1708 yy_alias
= rb_malloc(sizeof(struct alias_entry
));
1710 if (conf_cur_block_name
!= NULL
)
1711 yy_alias
->name
= rb_strdup(conf_cur_block_name
);
1713 yy_alias
->flags
= 0;
1719 conf_end_alias(struct TopConf
*tc
)
1721 if (yy_alias
== NULL
)
1724 if (yy_alias
->name
== NULL
)
1726 conf_report_error("Ignoring alias -- must have a name.");
1733 if (yy_alias
->target
== NULL
)
1735 conf_report_error("Ignoring alias -- must have a target.");
1742 rb_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1748 conf_set_alias_name(void *data
)
1750 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1753 yy_alias
->name
= rb_strdup(data
);
1757 conf_set_alias_target(void *data
)
1759 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1762 yy_alias
->target
= rb_strdup(data
);
1766 conf_set_channel_autochanmodes(void *data
)
1769 int what
= MODE_ADD
;
1771 ConfigChannel
.autochanmodes
= 0;
1772 for (pm
= (char *) data
; *pm
; pm
++)
1784 if (chmode_table
[(unsigned char) *pm
].set_func
== chm_simple
)
1786 if (what
== MODE_ADD
)
1787 ConfigChannel
.autochanmodes
|= chmode_table
[(unsigned char) *pm
].mode_type
;
1789 ConfigChannel
.autochanmodes
&= ~chmode_table
[(unsigned char) *pm
].mode_type
;
1793 conf_report_error("channel::autochanmodes -- Invalid channel mode %c", *pm
);
1802 static void conf_set_dnsbl_entry_reason(void *data
);
1804 #define IPTYPE_IPV4 1
1805 #define IPTYPE_IPV6 2
1808 conf_warn_blacklist_deprecation(struct TopConf
*tc
)
1810 conf_report_error("blacklist{} blocks have been deprecated -- use dnsbl{} blocks instead.");
1815 conf_set_dnsbl_entry_host(void *data
)
1817 if (yy_dnsbl_entry_host
)
1819 conf_report_error("dnsbl::host %s overlaps existing host %s",
1820 (char *)data
, yy_dnsbl_entry_host
);
1823 conf_set_dnsbl_entry_reason(NULL
);
1827 yy_dnsbl_entry_iptype
|= IPTYPE_IPV4
;
1828 yy_dnsbl_entry_host
= rb_strdup(data
);
1832 conf_set_dnsbl_entry_type(void *data
)
1834 conf_parm_t
*args
= data
;
1836 /* Don't assume we have either if we got here */
1837 yy_dnsbl_entry_iptype
= 0;
1839 for (; args
; args
= args
->next
)
1841 if (!rb_strcasecmp(args
->v
.string
, "ipv4"))
1842 yy_dnsbl_entry_iptype
|= IPTYPE_IPV4
;
1843 else if (!rb_strcasecmp(args
->v
.string
, "ipv6"))
1844 yy_dnsbl_entry_iptype
|= IPTYPE_IPV6
;
1846 conf_report_error("dnsbl::type has unknown address family %s",
1850 /* If we have neither, just default to IPv4 */
1851 if (!yy_dnsbl_entry_iptype
)
1853 conf_report_warning("dnsbl::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
1854 yy_dnsbl_entry_iptype
= IPTYPE_IPV4
;
1859 conf_set_dnsbl_entry_matches(void *data
)
1861 conf_parm_t
*args
= data
;
1862 enum filter_t
{ FILTER_NONE
, FILTER_ALL
, FILTER_LAST
};
1864 for (; args
; args
= args
->next
)
1866 char *str
= args
->v
.string
;
1868 enum filter_t type
= FILTER_LAST
;
1870 if (CF_TYPE(args
->type
) != CF_QSTRING
)
1872 conf_report_error("dnsbl::matches -- must be quoted string");
1878 conf_report_error("dnsbl::matches -- invalid entry");
1882 if (strlen(str
) > HOSTIPLEN
)
1884 conf_report_error("dnsbl::matches has an entry too long: %s",
1889 for (p
= str
; *p
!= '\0'; p
++)
1891 /* Check for validity */
1894 else if (!isdigit((unsigned char)*p
))
1896 conf_report_error("dnsbl::matches has invalid IP match entry %s",
1903 if (type
== FILTER_ALL
)
1905 /* Basic IP sanity check */
1906 struct rb_sockaddr_storage tmp
;
1907 if (rb_inet_pton(AF_INET
, str
, &tmp
) <= 0)
1909 conf_report_error("dnsbl::matches has invalid IP match entry %s",
1914 else if (type
== FILTER_LAST
)
1916 /* Verify it's the correct length */
1917 if (strlen(str
) > 3)
1919 conf_report_error("dnsbl::matches has invalid octet match entry %s",
1926 continue; /* Invalid entry */
1929 rb_dlinkAddAlloc(rb_strdup(str
), &yy_dnsbl_entry_filters
);
1934 conf_set_dnsbl_entry_reason(void *data
)
1936 rb_dlink_node
*ptr
, *nptr
;
1938 if (yy_dnsbl_entry_host
&& data
)
1940 yy_dnsbl_entry_reason
= rb_strdup(data
);
1941 if (yy_dnsbl_entry_iptype
& IPTYPE_IPV6
)
1943 /* Make sure things fit (magic number 64 = alnum count + dots)
1944 * Example: 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa
1946 if ((64 + strlen(yy_dnsbl_entry_host
)) > IRCD_RES_HOSTLEN
)
1948 conf_report_error("dnsbl::host %s results in IPv6 queries that are too long",
1949 yy_dnsbl_entry_host
);
1953 /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
1954 if ((yy_dnsbl_entry_iptype
& IPTYPE_IPV4
) && !(yy_dnsbl_entry_iptype
& IPTYPE_IPV6
))
1956 /* Make sure things fit for worst case (magic number 16 = number of nums + dots)
1957 * Example: 127.127.127.127.in-addr.arpa
1959 if ((16 + strlen(yy_dnsbl_entry_host
)) > IRCD_RES_HOSTLEN
)
1961 conf_report_error("dnsbl::host %s results in IPv4 queries that are too long",
1962 yy_dnsbl_entry_host
);
1967 add_dnsbl_entry(yy_dnsbl_entry_host
, yy_dnsbl_entry_reason
, yy_dnsbl_entry_iptype
, &yy_dnsbl_entry_filters
);
1971 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_dnsbl_entry_filters
.head
)
1974 rb_dlinkDestroy(ptr
, &yy_dnsbl_entry_filters
);
1977 yy_dnsbl_entry_filters
= (rb_dlink_list
){ NULL
, NULL
, 0 };
1979 rb_free(yy_dnsbl_entry_host
);
1980 rb_free(yy_dnsbl_entry_reason
);
1981 yy_dnsbl_entry_host
= NULL
;
1982 yy_dnsbl_entry_reason
= NULL
;
1983 yy_dnsbl_entry_iptype
= 0;
1996 conf_begin_opm(struct TopConf
*tc
)
1998 yy_opm_address_ipv4
= yy_opm_address_ipv6
= NULL
;
1999 yy_opm_port_ipv4
= yy_opm_port_ipv6
= yy_opm_timeout
= 0;
2000 delete_opm_proxy_scanner_all();
2001 delete_opm_listener_all();
2006 conf_end_opm(struct TopConf
*tc
)
2008 rb_dlink_node
*ptr
, *nptr
;
2011 if(rb_dlink_list_length(&yy_opm_scanner_list
) == 0)
2013 conf_report_error("No opm scanners configured -- disabling opm.");
2018 if(yy_opm_port_ipv4
> 0)
2020 if(yy_opm_address_ipv4
!= NULL
)
2021 conf_create_opm_listener(yy_opm_address_ipv4
, yy_opm_port_ipv4
);
2025 if(!rb_inet_ntop_sock((struct sockaddr
*)&ServerInfo
.bind4
, ip
, sizeof(ip
)))
2026 conf_report_error("No opm::listen_ipv4 nor serverinfo::vhost directive; cannot listen on IPv4");
2028 conf_create_opm_listener(ip
, yy_opm_port_ipv4
);
2032 if(yy_opm_port_ipv6
> 0)
2034 if(yy_opm_address_ipv6
!= NULL
)
2035 conf_create_opm_listener(yy_opm_address_ipv6
, yy_opm_port_ipv6
);
2039 if(!rb_inet_ntop_sock((struct sockaddr
*)&ServerInfo
.bind6
, ip
, sizeof(ip
)))
2040 conf_report_error("No opm::listen_ipv6 nor serverinfo::vhost directive; cannot listen on IPv6");
2042 conf_create_opm_listener(ip
, yy_opm_port_ipv6
);
2046 /* If there's no listeners... */
2047 fail
= (yy_opm_port_ipv4
== 0 || yy_opm_port_ipv6
== 0);
2048 if(!fail
&& yy_opm_timeout
> 0 && yy_opm_timeout
< 60)
2050 set_authd_timeout("opm_timeout", yy_opm_timeout
);
2052 conf_report_error("No opm listeners -- disabling");
2053 else if(yy_opm_timeout
<= 0 || yy_opm_timeout
>= 60)
2054 conf_report_error("opm::timeout value is invalid -- ignoring");
2057 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_opm_scanner_list
.head
)
2059 struct opm_scanner
*scanner
= ptr
->data
;
2062 create_opm_proxy_scanner(scanner
->type
, scanner
->port
);
2064 rb_dlinkDelete(&scanner
->node
, &yy_opm_scanner_list
);
2069 opm_check_enable(true);
2071 rb_free(yy_opm_address_ipv4
);
2072 rb_free(yy_opm_address_ipv6
);
2077 conf_set_opm_timeout(void *data
)
2079 int timeout
= *((int *)data
);
2081 if(timeout
<= 0 || timeout
> 60)
2083 conf_report_error("opm::timeout value %d is bogus, ignoring", timeout
);
2087 yy_opm_timeout
= timeout
;
2091 conf_set_opm_listen_address_both(void *data
, bool ipv6
)
2093 struct rb_sockaddr_storage addr
;
2094 const char *confstr
= (ipv6
? "opm::listen_ipv6" : "opm::listen_ipv4");
2097 if(!rb_inet_pton_sock(ip
, &addr
))
2099 conf_report_error("%s is an invalid address: %s", confstr
, ip
);
2105 if(GET_SS_FAMILY(&addr
) != AF_INET6
)
2107 conf_report_error("%s is of the wrong address type: %s", confstr
, ip
);
2111 if(yy_opm_address_ipv6
!= NULL
)
2113 conf_report_error("%s overwrites previous address %s", confstr
, ip
);
2117 yy_opm_address_ipv6
= rb_strdup(ip
);
2121 if(GET_SS_FAMILY(&addr
) != AF_INET
)
2123 conf_report_error("%s is of the wrong address type: %s", confstr
, ip
);
2127 if(yy_opm_address_ipv4
!= NULL
)
2129 conf_report_error("%s overwrites previous address %s", confstr
, ip
);
2133 yy_opm_address_ipv4
= rb_strdup(ip
);
2138 conf_set_opm_listen_address_ipv4(void *data
)
2140 conf_set_opm_listen_address_both(data
, false);
2144 conf_set_opm_listen_address_ipv6(void *data
)
2146 conf_set_opm_listen_address_both(data
, true);
2150 conf_set_opm_listen_port_both(void *data
, bool ipv6
)
2152 int port
= *((int *)data
);
2153 const char *confstr
= (ipv6
? "opm::port_ipv6" : "opm::port_ipv4");
2155 if(port
> 65535 || port
<= 0)
2157 conf_report_error("%s is out of range: %d", confstr
, port
);
2163 if(yy_opm_port_ipv4
)
2165 conf_report_error("%s overwrites existing port %hu",
2166 confstr
, yy_opm_port_ipv4
);
2170 yy_opm_port_ipv4
= port
;
2174 if(yy_opm_port_ipv6
)
2176 conf_report_error("%s overwrites existing port %hu",
2177 confstr
, yy_opm_port_ipv6
);
2181 yy_opm_port_ipv6
= port
;
2186 conf_set_opm_listen_port_ipv4(void *data
)
2188 conf_set_opm_listen_port_both(data
, false);
2192 conf_set_opm_listen_port_ipv6(void *data
)
2194 conf_set_opm_listen_port_both(data
, true);
2198 conf_set_opm_listen_port(void *data
)
2200 conf_set_opm_listen_port_both(data
, true);
2201 conf_set_opm_listen_port_both(data
, false);
2205 conf_set_opm_scan_ports_all(void *data
, const char *node
, const char *type
)
2207 conf_parm_t
*args
= data
;
2208 for (; args
; args
= args
->next
)
2213 if(CF_TYPE(args
->type
) != CF_INT
)
2215 conf_report_error("%s argument is not an integer -- ignoring.", node
);
2219 if(args
->v
.number
> 65535 || args
->v
.number
<= 0)
2221 conf_report_error("%s argument is not an integer between 1 and 65535 -- ignoring.", node
);
2225 /* Check for duplicates */
2226 RB_DLINK_FOREACH(ptr
, yy_opm_scanner_list
.head
)
2228 struct opm_scanner
*scanner
= ptr
->data
;
2230 if(scanner
->port
== args
->v
.number
&& strcmp(type
, scanner
->type
) == 0)
2232 conf_report_error("%s argument is duplicate", node
);
2240 struct opm_scanner
*scanner
= rb_malloc(sizeof(struct opm_scanner
));
2241 scanner
->port
= args
->v
.number
;
2242 scanner
->type
= type
;
2243 rb_dlinkAdd(scanner
, &scanner
->node
, &yy_opm_scanner_list
);
2249 conf_set_opm_scan_ports_socks4(void *data
)
2251 conf_set_opm_scan_ports_all(data
, "opm::socks4_ports", "socks4");
2255 conf_set_opm_scan_ports_socks5(void *data
)
2257 conf_set_opm_scan_ports_all(data
, "opm::socks5_ports", "socks5");
2261 conf_set_opm_scan_ports_httpconnect(void *data
)
2263 conf_set_opm_scan_ports_all(data
, "opm::httpconnect_ports", "httpconnect");
2267 conf_set_opm_scan_ports_httpsconnect(void *data
)
2269 conf_set_opm_scan_ports_all(data
, "opm::httpsconnect_ports", "httpsconnect");
2272 /* public functions */
2276 conf_report_error(const char *fmt
, ...)
2279 char msg
[BUFSIZE
+ 1] = { 0 };
2282 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2287 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2291 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2292 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "error: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2296 conf_report_warning(const char *fmt
, ...)
2299 char msg
[BUFSIZE
+ 1] = { 0 };
2302 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2307 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2311 iwarn("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2312 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "warning: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2316 conf_start_block(char *block
, char *name
)
2318 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
2320 conf_report_error("Configuration block '%s' is not defined.", block
);
2325 conf_cur_block_name
= rb_strdup(name
);
2327 conf_cur_block_name
= NULL
;
2329 if(conf_cur_block
->tc_sfunc
)
2330 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
2337 conf_end_block(struct TopConf
*tc
)
2341 ret
= tc
->tc_efunc(tc
);
2343 rb_free(conf_cur_block_name
);
2344 conf_cur_block_name
= NULL
;
2349 conf_set_generic_int(void *data
, void *location
)
2351 *((int *) location
) = *((unsigned int *) data
);
2355 conf_set_generic_string(void *data
, int len
, void *location
)
2357 char **loc
= location
;
2360 if(len
&& strlen(input
) > (unsigned int)len
)
2364 *loc
= rb_strdup(input
);
2368 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
)
2370 struct ConfEntry
*cf
;
2376 if((cf
= find_conf_item(tc
, item
)) == NULL
)
2379 ("Non-existent configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
2383 /* if it takes one thing, make sure they only passed one thing,
2384 and handle as needed. */
2385 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
2388 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
2395 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
2397 /* if it expects a string value, but we got a yesno,
2400 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
2401 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
2403 value
->v
.list
->type
= CF_STRING
;
2405 if(cp
->v
.number
== 1)
2406 cp
->v
.string
= rb_strdup("yes");
2408 cp
->v
.string
= rb_strdup("no");
2411 /* maybe it's a CF_TIME and they passed CF_INT --
2412 should still be valid */
2413 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
2414 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
2417 ("Wrong type for %s::%s (expected %s, got %s)",
2418 tc
->tc_name
, (char *) item
,
2419 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
2424 if(cf
->cf_type
& CF_FLIST
)
2428 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
2431 /* just pass it the extended argument list */
2432 cf
->cf_func(value
->v
.list
);
2436 /* it's old-style, needs only one arg */
2437 switch (cf
->cf_type
)
2443 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2445 cf
->cf_func(&cp
->v
.number
);
2449 if(EmptyString(cp
->v
.string
))
2450 conf_report_error("Ignoring %s::%s -- empty field",
2453 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2455 cf
->cf_func(cp
->v
.string
);
2465 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2468 struct ConfEntry
*cf
;
2470 if((tc
= find_top_conf(topconf
)) == NULL
)
2473 if(find_conf_item(tc
, name
) != NULL
)
2476 cf
= rb_malloc(sizeof(struct ConfEntry
));
2483 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2489 remove_conf_item(const char *topconf
, const char *name
)
2492 struct ConfEntry
*cf
;
2495 if((tc
= find_top_conf(topconf
)) == NULL
)
2498 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2501 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2504 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2511 static struct ConfEntry conf_serverinfo_table
[] =
2513 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2515 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2516 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2517 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2518 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2519 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2521 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2522 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2523 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2524 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2525 { "ssl_cipher_list", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cipher_list
},
2526 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2528 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2530 { "nicklen", CF_INT
, conf_set_serverinfo_nicklen
, 0, NULL
},
2532 { "\0", 0, NULL
, 0, NULL
}
2535 static struct ConfEntry conf_admin_table
[] =
2537 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2538 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2539 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2540 { "\0", 0, NULL
, 0, NULL
}
2543 static struct ConfEntry conf_log_table
[] =
2545 { "fname_userlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_userlog
},
2546 { "fname_fuserlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_fuserlog
},
2547 { "fname_operlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operlog
},
2548 { "fname_foperlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_foperlog
},
2549 { "fname_serverlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_serverlog
},
2550 { "fname_killlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_killlog
},
2551 { "fname_klinelog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_klinelog
},
2552 { "fname_operspylog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operspylog
},
2553 { "fname_ioerrorlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_ioerrorlog
},
2554 { "\0", 0, NULL
, 0, NULL
}
2557 static struct ConfEntry conf_operator_table
[] =
2559 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2560 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2561 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2562 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2563 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2564 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2565 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2566 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2567 { "\0", 0, NULL
, 0, NULL
}
2570 static struct ConfEntry conf_privset_table
[] =
2572 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2573 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2574 { "\0", 0, NULL
, 0, NULL
}
2577 static struct ConfEntry conf_class_table
[] =
2579 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2580 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2581 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2582 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2583 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2584 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2585 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2586 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2587 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2588 { "max_autoconn", CF_INT
, conf_set_class_max_autoconn
, 0, NULL
},
2589 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2590 { "\0", 0, NULL
, 0, NULL
}
2593 static struct ConfEntry conf_auth_table
[] =
2595 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2596 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2597 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2598 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2599 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2600 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2601 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2602 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2603 { "\0", 0, NULL
, 0, NULL
}
2606 static struct ConfEntry conf_connect_table
[] =
2608 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2609 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2610 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2611 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2612 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2613 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2614 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2615 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2616 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
2617 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
2618 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2619 { "\0", 0, NULL
, 0, NULL
}
2622 static struct ConfEntry conf_general_table
[] =
2624 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2625 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2626 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2627 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
2628 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2629 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2630 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2631 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2632 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2634 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2635 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2636 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2637 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2638 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2639 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2640 { "sasl_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.sasl_service
},
2642 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2643 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2644 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2645 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2646 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2648 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2649 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2650 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2651 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2652 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2653 { "resv_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.resv_fnc
},
2654 { "post_registration_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.post_registration_delay
},
2655 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2656 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2657 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2658 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2659 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2660 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2661 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2662 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2663 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2664 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2665 { "hide_tkdline_duration", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_tkdline_duration
},
2666 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2667 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2668 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2669 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2670 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2671 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2672 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2673 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2674 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2675 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2676 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2677 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2678 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2679 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2680 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2681 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2682 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2683 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2684 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2685 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2686 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2687 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2688 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2689 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2690 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2691 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2692 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2693 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2694 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2695 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2696 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2697 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2698 { "client_flood_max_lines", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_max_lines
},
2699 { "client_flood_burst_rate", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_rate
},
2700 { "client_flood_burst_max", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_max
},
2701 { "client_flood_message_num", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_num
},
2702 { "client_flood_message_time", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_time
},
2703 { "max_ratelimit_tokens", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_ratelimit_tokens
},
2704 { "away_interval", CF_INT
, NULL
, 0, &ConfigFileEntry
.away_interval
},
2705 { "hide_opers_in_whois", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_opers_in_whois
},
2706 { "hide_opers", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_opers
},
2707 { "certfp_method", CF_STRING
, conf_set_general_certfp_method
, 0, NULL
},
2708 { "drain_reason", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.drain_reason
},
2709 { "tls_ciphers_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tls_ciphers_oper_only
},
2710 { "\0", 0, NULL
, 0, NULL
}
2713 static struct ConfEntry conf_channel_table
[] =
2715 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2716 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2717 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2718 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2719 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2720 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2721 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2722 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2723 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2724 { "max_chans_per_user_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user_large
},
2725 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2726 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2727 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2728 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2729 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2730 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2731 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2732 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2733 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2734 { "disable_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.disable_local_channels
},
2735 { "autochanmodes", CF_QSTRING
, conf_set_channel_autochanmodes
, 0, NULL
},
2736 { "displayed_usercount", CF_INT
, NULL
, 0, &ConfigChannel
.displayed_usercount
},
2737 { "strip_topic_colors", CF_YESNO
, NULL
, 0, &ConfigChannel
.strip_topic_colors
},
2738 { "opmod_send_statusmsg", CF_YESNO
, NULL
, 0, &ConfigChannel
.opmod_send_statusmsg
},
2739 { "\0", 0, NULL
, 0, NULL
}
2742 static struct ConfEntry conf_serverhide_table
[] =
2744 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2745 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2746 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2747 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2748 { "\0", 0, NULL
, 0, NULL
}
2755 add_top_conf("modules", NULL
, NULL
, NULL
);
2756 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2757 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2759 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2760 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2761 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2762 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2763 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2764 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2766 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2767 add_conf_item("listen", "defer_accept", CF_YESNO
, conf_set_listen_defer_accept
);
2768 add_conf_item("listen", "wsock", CF_YESNO
, conf_set_listen_wsock
);
2769 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2770 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2771 add_conf_item("listen", "sctp_port", CF_INT
| CF_FLIST
, conf_set_listen_sctp_port
);
2772 add_conf_item("listen", "sctp_sslport", CF_INT
| CF_FLIST
, conf_set_listen_sctp_sslport
);
2773 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2774 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2776 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2778 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2780 add_top_conf("exempt", NULL
, NULL
, NULL
);
2781 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2783 add_top_conf("secure", NULL
, NULL
, NULL
);
2784 add_conf_item("secure", "ip", CF_QSTRING
, conf_set_secure_ip
);
2786 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2787 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2788 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2790 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2791 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2792 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2794 add_top_conf("service", NULL
, NULL
, NULL
);
2795 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2797 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2798 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2799 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2801 add_top_conf("dnsbl", NULL
, NULL
, NULL
);
2802 add_conf_item("dnsbl", "host", CF_QSTRING
, conf_set_dnsbl_entry_host
);
2803 add_conf_item("dnsbl", "type", CF_STRING
| CF_FLIST
, conf_set_dnsbl_entry_type
);
2804 add_conf_item("dnsbl", "matches", CF_QSTRING
| CF_FLIST
, conf_set_dnsbl_entry_matches
);
2805 add_conf_item("dnsbl", "reject_reason", CF_QSTRING
, conf_set_dnsbl_entry_reason
);
2807 add_top_conf("blacklist", conf_warn_blacklist_deprecation
, NULL
, NULL
);
2808 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_dnsbl_entry_host
);
2809 add_conf_item("blacklist", "type", CF_STRING
| CF_FLIST
, conf_set_dnsbl_entry_type
);
2810 add_conf_item("blacklist", "matches", CF_QSTRING
| CF_FLIST
, conf_set_dnsbl_entry_matches
);
2811 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_dnsbl_entry_reason
);
2813 add_top_conf("opm", conf_begin_opm
, conf_end_opm
, NULL
);
2814 add_conf_item("opm", "timeout", CF_INT
, conf_set_opm_timeout
);
2815 add_conf_item("opm", "listen_ipv4", CF_QSTRING
, conf_set_opm_listen_address_ipv4
);
2816 add_conf_item("opm", "listen_ipv6", CF_QSTRING
, conf_set_opm_listen_address_ipv6
);
2817 add_conf_item("opm", "port_v4", CF_INT
, conf_set_opm_listen_port_ipv4
);
2818 add_conf_item("opm", "port_v6", CF_INT
, conf_set_opm_listen_port_ipv6
);
2819 add_conf_item("opm", "listen_port", CF_INT
, conf_set_opm_listen_port
);
2820 add_conf_item("opm", "socks4_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_socks4
);
2821 add_conf_item("opm", "socks5_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_socks5
);
2822 add_conf_item("opm", "httpconnect_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_httpconnect
);
2823 add_conf_item("opm", "httpsconnect_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_httpsconnect
);