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
},
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 parse_umodes(const char *pm
, int *values
, int *mask
)
444 int what
= MODE_ADD
, flag
;
470 flag
= user_modes
[(unsigned char) *pm
];
473 /* Proper value has probably not yet been set
474 * so don't check oper_only_umodes -- jilles */
475 if (what
== MODE_ADD
)
489 conf_set_privset_extends(void *data
)
491 yy_privset_extends
= rb_strdup((char *) data
);
495 conf_set_privset_privs(void *data
)
498 conf_parm_t
*args
= data
;
500 for (; args
; args
= args
->next
)
503 privs
= rb_strdup(args
->v
.string
);
506 char *privs_old
= privs
;
508 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
509 strcpy(privs
, privs_old
);
511 strcat(privs
, args
->v
.string
);
519 if (yy_privset_extends
)
521 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
525 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
527 set
= privilegeset_get("default");
530 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
532 rb_free(yy_privset_extends
);
533 yy_privset_extends
= NULL
;
536 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
543 conf_begin_oper(struct TopConf
*tc
)
546 rb_dlink_node
*next_ptr
;
550 free_oper_conf(yy_oper
);
554 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
556 free_oper_conf(ptr
->data
);
557 rb_dlinkDestroy(ptr
, &yy_oper_list
);
560 yy_oper
= make_oper_conf();
561 yy_oper
->flags
|= OPER_ENCRYPTED
;
567 conf_end_oper(struct TopConf
*tc
)
569 struct oper_conf
*yy_tmpoper
;
571 rb_dlink_node
*next_ptr
;
573 if(conf_cur_block_name
!= NULL
)
575 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
576 conf_cur_block_name
[OPERNICKLEN
] = '\0';
578 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
581 if(EmptyString(yy_oper
->name
))
583 conf_report_error("Ignoring operator block -- missing name.");
587 #ifdef HAVE_LIBCRYPTO
588 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
590 if(EmptyString(yy_oper
->passwd
))
593 conf_report_error("Ignoring operator block for %s -- missing password",
599 if (!yy_oper
->privset
)
600 yy_oper
->privset
= privilegeset_get("default");
602 /* now, yy_oper_list contains a stack of oper_conf's with just user
603 * and host in, yy_oper contains the rest of the information which
604 * we need to copy into each element in yy_oper_list
606 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
608 yy_tmpoper
= ptr
->data
;
610 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
612 /* could be an rsa key instead.. */
613 if(!EmptyString(yy_oper
->passwd
))
614 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
616 yy_tmpoper
->flags
= yy_oper
->flags
;
617 yy_tmpoper
->umodes
= yy_oper
->umodes
;
618 yy_tmpoper
->snomask
= yy_oper
->snomask
;
619 yy_tmpoper
->privset
= yy_oper
->privset
;
621 #ifdef HAVE_LIBCRYPTO
622 if(yy_oper
->rsa_pubkey_file
)
626 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
628 conf_report_error("Ignoring operator block for %s -- "
629 "rsa_public_key_file cant be opened",
634 yy_tmpoper
->rsa_pubkey
=
635 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
637 (void)BIO_set_close(file
, BIO_CLOSE
);
640 if(yy_tmpoper
->rsa_pubkey
== NULL
)
642 conf_report_error("Ignoring operator block for %s -- "
643 "rsa_public_key_file key invalid; check syntax",
649 if(!EmptyString(yy_oper
->certfp
))
650 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
653 /* all is ok, put it on oper_conf_list */
654 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
657 free_oper_conf(yy_oper
);
664 conf_set_oper_flags(void *data
)
666 conf_parm_t
*args
= data
;
668 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
672 conf_set_oper_fingerprint(void *data
)
675 rb_free(yy_oper
->certfp
);
676 yy_oper
->certfp
= rb_strdup((char *) data
);
680 conf_set_oper_privset(void *data
)
682 yy_oper
->privset
= privilegeset_get((char *) data
);
686 conf_set_oper_user(void *data
)
688 struct oper_conf
*yy_tmpoper
;
690 char *host
= (char *) data
;
692 yy_tmpoper
= make_oper_conf();
694 if((p
= strchr(host
, '@')))
698 yy_tmpoper
->username
= rb_strdup(host
);
699 yy_tmpoper
->host
= rb_strdup(p
);
704 yy_tmpoper
->username
= rb_strdup("*");
705 yy_tmpoper
->host
= rb_strdup(host
);
708 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
710 conf_report_error("Ignoring user -- missing username/host");
711 free_oper_conf(yy_tmpoper
);
715 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
719 conf_set_oper_password(void *data
)
723 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
724 rb_free(yy_oper
->passwd
);
727 yy_oper
->passwd
= rb_strdup((char *) data
);
731 conf_set_oper_rsa_public_key_file(void *data
)
733 #ifdef HAVE_LIBCRYPTO
734 rb_free(yy_oper
->rsa_pubkey_file
);
735 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
737 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
742 conf_set_oper_umodes(void *data
)
744 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
748 conf_set_oper_snomask(void *data
)
750 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
754 conf_begin_class(struct TopConf
*tc
)
757 free_class(yy_class
);
759 yy_class
= make_class();
764 conf_end_class(struct TopConf
*tc
)
766 if(conf_cur_block_name
!= NULL
)
767 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
769 if(EmptyString(yy_class
->class_name
))
771 conf_report_error("Ignoring class block -- missing name.");
781 conf_set_class_ping_time(void *data
)
783 yy_class
->ping_freq
= *(unsigned int *) data
;
787 conf_set_class_cidr_ipv4_bitlen(void *data
)
789 unsigned int maxsize
= 32;
790 if(*(unsigned int *) data
> maxsize
)
792 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
793 *(unsigned int *) data
, maxsize
);
795 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
800 conf_set_class_cidr_ipv6_bitlen(void *data
)
802 unsigned int maxsize
= 128;
803 if(*(unsigned int *) data
> maxsize
)
805 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
806 *(unsigned int *) data
, maxsize
);
808 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
813 conf_set_class_number_per_cidr(void *data
)
815 yy_class
->cidr_amount
= *(unsigned int *) data
;
819 conf_set_class_number_per_ip(void *data
)
821 yy_class
->max_local
= *(unsigned int *) data
;
826 conf_set_class_number_per_ip_global(void *data
)
828 yy_class
->max_global
= *(unsigned int *) data
;
832 conf_set_class_number_per_ident(void *data
)
834 yy_class
->max_ident
= *(unsigned int *) data
;
838 conf_set_class_connectfreq(void *data
)
840 yy_class
->con_freq
= *(unsigned int *) data
;
844 conf_set_class_max_number(void *data
)
846 yy_class
->max_total
= *(unsigned int *) data
;
850 conf_set_class_max_autoconn(void *data
)
852 yy_class
->max_autoconn
= *(unsigned int *) data
;
856 conf_set_class_sendq(void *data
)
858 yy_class
->max_sendq
= *(unsigned int *) data
;
861 static char *listener_address
[2];
864 conf_begin_listen(struct TopConf
*tc
)
866 for (int i
= 0; i
< ARRAY_SIZE(listener_address
); i
++) {
867 rb_free(listener_address
[i
]);
868 listener_address
[i
] = NULL
;
876 conf_end_listen(struct TopConf
*tc
)
878 for (int i
= 0; i
< ARRAY_SIZE(listener_address
); i
++) {
879 rb_free(listener_address
[i
]);
880 listener_address
[i
] = NULL
;
888 conf_set_listen_defer_accept(void *data
)
890 yy_defer_accept
= *(unsigned int *) data
;
894 conf_set_listen_wsock(void *data
)
896 yy_wsock
= *(unsigned int *) data
;
900 conf_set_listen_port_both(void *data
, int ssl
, int sctp
)
902 conf_parm_t
*args
= data
;
903 for (; args
; args
= args
->next
)
905 if(CF_TYPE(args
->type
) != CF_INT
)
907 conf_report_error("listener::port argument is not an integer -- ignoring.");
910 if(listener_address
[0] == NULL
)
913 conf_report_error("listener::sctp_port has no addresses -- ignoring.");
915 add_tcp_listener(args
->v
.number
, NULL
, AF_INET
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
916 add_tcp_listener(args
->v
.number
, NULL
, AF_INET6
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
922 if(strchr(listener_address
[0], ':') != NULL
)
929 add_sctp_listener(args
->v
.number
, listener_address
[0], listener_address
[1], ssl
, yy_wsock
);
931 conf_report_error("Warning -- ignoring listener::sctp_port -- SCTP support not available.");
934 add_tcp_listener(args
->v
.number
, listener_address
[0], family
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
941 conf_set_listen_port(void *data
)
943 conf_set_listen_port_both(data
, 0, 0);
947 conf_set_listen_sslport(void *data
)
949 conf_set_listen_port_both(data
, 1, 0 );
953 conf_set_listen_sctp_port(void *data
)
955 conf_set_listen_port_both(data
, 0, 1);
959 conf_set_listen_sctp_sslport(void *data
)
961 conf_set_listen_port_both(data
, 1, 1);
965 conf_set_listen_address(void *data
)
967 rb_free(listener_address
[1]);
968 listener_address
[1] = listener_address
[0];
969 listener_address
[0] = rb_strdup(data
);
973 conf_begin_auth(struct TopConf
*tc
)
976 rb_dlink_node
*next_ptr
;
981 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
983 free_conf(ptr
->data
);
984 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
987 yy_aconf
= make_conf();
988 yy_aconf
->status
= CONF_CLIENT
;
994 conf_end_auth(struct TopConf
*tc
)
996 struct ConfItem
*yy_tmp
, *found_conf
;
998 rb_dlink_node
*next_ptr
;
1000 if(EmptyString(yy_aconf
->info
.name
))
1001 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
1003 /* didnt even get one ->host? */
1004 if(EmptyString(yy_aconf
->host
))
1006 conf_report_error("Ignoring auth block -- missing user@host");
1010 /* so the stacking works in order.. */
1011 collapse(yy_aconf
->user
);
1012 collapse(yy_aconf
->host
);
1013 conf_add_class_to_conf(yy_aconf
);
1014 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
1015 conf_report_error("Ignoring redundant auth block (after *@*)");
1016 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
1017 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
1018 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
1019 conf_report_error("Ignoring duplicate auth block for %s@%s",
1020 yy_aconf
->user
, yy_aconf
->host
);
1022 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
1024 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
1028 if(yy_aconf
->passwd
)
1029 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
1031 if(yy_aconf
->spasswd
)
1032 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
1034 /* this will always exist.. */
1035 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
1037 if(yy_aconf
->className
)
1038 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
1040 yy_tmp
->flags
= yy_aconf
->flags
;
1041 yy_tmp
->port
= yy_aconf
->port
;
1043 collapse(yy_tmp
->user
);
1044 collapse(yy_tmp
->host
);
1046 conf_add_class_to_conf(yy_tmp
);
1048 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
1049 conf_report_error("Ignoring redundant auth block (after *@*)");
1050 else if ((found_conf
= find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
)) &&
1051 (!found_conf
->spasswd
|| (yy_tmp
->spasswd
&&
1052 0 == irccmp(found_conf
->spasswd
, yy_tmp
->spasswd
))))
1053 conf_report_error("Ignoring duplicate auth block for %s@%s",
1054 yy_tmp
->user
, yy_tmp
->host
);
1056 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
1057 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1065 conf_set_auth_user(void *data
)
1067 struct ConfItem
*yy_tmp
;
1070 /* The first user= line doesn't allocate a new conf */
1071 if(!EmptyString(yy_aconf
->host
))
1073 yy_tmp
= make_conf();
1074 yy_tmp
->status
= CONF_CLIENT
;
1079 if((p
= strchr(data
, '@')))
1083 yy_tmp
->user
= rb_strdup(data
);
1084 yy_tmp
->host
= rb_strdup(p
);
1088 yy_tmp
->user
= rb_strdup("*");
1089 yy_tmp
->host
= rb_strdup(data
);
1092 if(yy_aconf
!= yy_tmp
)
1093 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1097 conf_set_auth_auth_user(void *data
)
1099 if(yy_aconf
->spasswd
)
1100 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1101 rb_free(yy_aconf
->spasswd
);
1102 yy_aconf
->spasswd
= rb_strdup(data
);
1106 conf_set_auth_passwd(void *data
)
1108 if(yy_aconf
->passwd
)
1109 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1110 rb_free(yy_aconf
->passwd
);
1111 yy_aconf
->passwd
= rb_strdup(data
);
1115 conf_set_auth_spoof(void *data
)
1123 /* user@host spoof */
1124 if((p
= strchr(host
, '@')) != NULL
)
1130 if(EmptyString(user
))
1132 conf_report_error("Warning -- spoof ident empty.");
1136 if(strlen(user
) > USERLEN
)
1138 conf_report_error("Warning -- spoof ident length invalid.");
1142 if(!valid_username(user
))
1144 conf_report_error("Warning -- invalid spoof (ident).");
1148 /* this must be restored! */
1152 if(EmptyString(host
))
1154 conf_report_error("Warning -- spoof host empty.");
1158 if(strlen(host
) > HOSTLEN
)
1160 conf_report_error("Warning -- spoof host length invalid.");
1164 if(!valid_hostname(host
))
1166 conf_report_error("Warning -- invalid spoof (host).");
1170 rb_free(yy_aconf
->info
.name
);
1171 yy_aconf
->info
.name
= rb_strdup(data
);
1172 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1176 conf_set_auth_flags(void *data
)
1178 conf_parm_t
*args
= data
;
1180 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1184 conf_set_auth_redir_serv(void *data
)
1186 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1187 rb_free(yy_aconf
->info
.name
);
1188 yy_aconf
->info
.name
= rb_strdup(data
);
1192 conf_set_auth_redir_port(void *data
)
1194 int port
= *(unsigned int *) data
;
1196 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1197 yy_aconf
->port
= port
;
1201 conf_set_auth_class(void *data
)
1203 rb_free(yy_aconf
->className
);
1204 yy_aconf
->className
= rb_strdup(data
);
1208 conf_set_auth_umodes(void *data
)
1210 char *umodes
= data
;
1212 parse_umodes(umodes
, &yy_aconf
->umodes
, &yy_aconf
->umodes_mask
);
1216 conf_begin_connect(struct TopConf
*tc
)
1219 free_server_conf(yy_server
);
1221 yy_server
= make_server_conf();
1222 yy_server
->port
= PORTNUM
;
1223 yy_server
->flags
|= SERVER_TB
;
1225 if(conf_cur_block_name
!= NULL
)
1226 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1232 conf_end_connect(struct TopConf
*tc
)
1234 if (EmptyString(yy_server
->name
))
1236 conf_report_error("Ignoring connect block -- missing name.");
1240 if (ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1242 conf_report_error("Ignoring connect block for %s -- name is "
1243 "equal to my own name.", yy_server
->name
);
1247 if ((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
))
1248 && EmptyString(yy_server
->certfp
))
1250 conf_report_error("Ignoring connect block for %s -- no "
1251 "fingerprint or password credentials "
1252 "provided.", yy_server
->name
);
1256 if ((yy_server
->flags
& SERVER_SSL
) && EmptyString(yy_server
->certfp
))
1258 conf_report_error("Ignoring connect block for %s -- no "
1259 "fingerprint provided for SSL "
1260 "connection.", yy_server
->name
);
1264 if (! (yy_server
->flags
& SERVER_SSL
) && ! EmptyString(yy_server
->certfp
))
1266 conf_report_error("Ignoring connect block for %s -- "
1267 "fingerprint authentication has "
1268 "been requested; but the ssl flag "
1269 "is not set.", yy_server
->name
);
1273 if (EmptyString(yy_server
->connect_host
)
1274 && GET_SS_FAMILY(&yy_server
->connect4
) != AF_INET
1275 && GET_SS_FAMILY(&yy_server
->connect6
) != AF_INET6
)
1277 conf_report_error("Ignoring connect block for %s -- missing "
1278 "host.", yy_server
->name
);
1282 add_server_conf(yy_server
);
1283 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1290 conf_set_connect_host(void *data
)
1292 struct rb_sockaddr_storage addr
;
1294 if(rb_inet_pton_sock(data
, &addr
) <= 0)
1296 rb_free(yy_server
->connect_host
);
1297 yy_server
->connect_host
= rb_strdup(data
);
1299 else if(GET_SS_FAMILY(&addr
) == AF_INET
)
1301 yy_server
->connect4
= addr
;
1303 else if(GET_SS_FAMILY(&addr
) == AF_INET6
)
1305 yy_server
->connect6
= addr
;
1309 conf_report_error("Unsupported IP address for server connect host (%s)",
1316 conf_set_connect_vhost(void *data
)
1318 struct rb_sockaddr_storage addr
;
1320 if(rb_inet_pton_sock(data
, &addr
) <= 0)
1322 rb_free(yy_server
->bind_host
);
1323 yy_server
->bind_host
= rb_strdup(data
);
1325 else if(GET_SS_FAMILY(&addr
) == AF_INET
)
1327 yy_server
->bind4
= addr
;
1329 else if(GET_SS_FAMILY(&addr
) == AF_INET6
)
1331 yy_server
->bind6
= addr
;
1335 conf_report_error("Unsupported IP address for server connect vhost (%s)",
1342 conf_set_connect_send_password(void *data
)
1344 if(yy_server
->spasswd
)
1346 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1347 rb_free(yy_server
->spasswd
);
1350 if (EmptyString((const char *) data
))
1352 yy_server
->spasswd
= NULL
;
1353 conf_report_warning("Invalid send_password for connect "
1354 "block; must not be empty if provided");
1356 else if (strpbrk(data
, " :"))
1358 yy_server
->spasswd
= NULL
;
1359 conf_report_error("Invalid send_password for connect "
1360 "block; cannot contain spaces or colons");
1363 yy_server
->spasswd
= rb_strdup(data
);
1367 conf_set_connect_accept_password(void *data
)
1369 if(yy_server
->passwd
)
1371 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1372 rb_free(yy_server
->passwd
);
1375 if (EmptyString((const char *) data
))
1377 yy_server
->passwd
= NULL
;
1378 conf_report_warning("Invalid accept_password for connect "
1379 "block; must not be empty if provided");
1381 else if (strpbrk(data
, " :"))
1383 yy_server
->passwd
= NULL
;
1384 conf_report_error("Invalid accept_password for connect "
1385 "block; cannot contain spaces or colons");
1388 yy_server
->passwd
= rb_strdup(data
);
1392 conf_set_connect_fingerprint(void *data
)
1394 if (yy_server
->certfp
)
1395 rb_free(yy_server
->certfp
);
1396 yy_server
->certfp
= rb_strdup((char *) data
);
1398 /* force SSL to be enabled if fingerprint is enabled. */
1399 yy_server
->flags
|= SERVER_SSL
;
1403 conf_set_connect_port(void *data
)
1405 int port
= *(unsigned int *) data
;
1410 yy_server
->port
= port
;
1414 conf_set_connect_aftype(void *data
)
1418 if(rb_strcasecmp(aft
, "ipv4") == 0)
1419 yy_server
->aftype
= AF_INET
;
1420 else if(rb_strcasecmp(aft
, "ipv6") == 0)
1421 yy_server
->aftype
= AF_INET6
;
1423 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1427 conf_set_connect_flags(void *data
)
1429 conf_parm_t
*args
= data
;
1431 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1435 conf_set_connect_class(void *data
)
1437 rb_free(yy_server
->class_name
);
1438 yy_server
->class_name
= rb_strdup(data
);
1442 conf_set_exempt_ip(void *data
)
1444 struct ConfItem
*yy_tmp
;
1445 int masktype
= parse_netmask_strict(data
, NULL
, NULL
);
1447 if(masktype
!= HM_IPV4
&& masktype
!= HM_IPV6
)
1449 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1453 yy_tmp
= make_conf();
1454 yy_tmp
->passwd
= rb_strdup("*");
1455 yy_tmp
->host
= rb_strdup(data
);
1456 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1457 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1461 conf_set_secure_ip(void *data
)
1463 struct ConfItem
*yy_tmp
;
1464 int masktype
= parse_netmask_strict(data
, NULL
, NULL
);
1466 if(masktype
!= HM_IPV4
&& masktype
!= HM_IPV6
)
1468 conf_report_error("Ignoring secure -- invalid secure::ip.");
1472 yy_tmp
= make_conf();
1473 yy_tmp
->passwd
= rb_strdup("*");
1474 yy_tmp
->host
= rb_strdup(data
);
1475 yy_tmp
->status
= CONF_SECURE
;
1476 add_conf_by_address(yy_tmp
->host
, CONF_SECURE
, NULL
, NULL
, yy_tmp
);
1480 conf_cleanup_cluster(struct TopConf
*tc
)
1482 rb_dlink_node
*ptr
, *next_ptr
;
1484 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1486 free_remote_conf(ptr
->data
);
1487 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1490 if(yy_shared
!= NULL
)
1492 free_remote_conf(yy_shared
);
1500 conf_set_cluster_name(void *data
)
1502 if(yy_shared
!= NULL
)
1503 free_remote_conf(yy_shared
);
1505 yy_shared
= make_remote_conf();
1506 yy_shared
->server
= rb_strdup(data
);
1507 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1513 conf_set_cluster_flags(void *data
)
1515 conf_parm_t
*args
= data
;
1517 rb_dlink_node
*ptr
, *next_ptr
;
1519 if(yy_shared
!= NULL
)
1520 free_remote_conf(yy_shared
);
1522 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1524 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1526 yy_shared
= ptr
->data
;
1527 yy_shared
->flags
= flags
;
1528 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1529 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1536 conf_set_general_havent_read_conf(void *data
)
1538 if(*(unsigned int *) data
)
1540 conf_report_error("You haven't read your config file properly.");
1542 ("There is a line in the example conf that will kill your server if not removed.");
1544 ("Consider actually reading/editing the conf file, and removing this line.");
1551 conf_set_general_hide_error_messages(void *data
)
1555 if(rb_strcasecmp(val
, "yes") == 0)
1556 ConfigFileEntry
.hide_error_messages
= 2;
1557 else if(rb_strcasecmp(val
, "opers") == 0)
1558 ConfigFileEntry
.hide_error_messages
= 1;
1559 else if(rb_strcasecmp(val
, "no") == 0)
1560 ConfigFileEntry
.hide_error_messages
= 0;
1562 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1566 conf_set_general_stats_k_oper_only(void *data
)
1570 if(rb_strcasecmp(val
, "yes") == 0)
1571 ConfigFileEntry
.stats_k_oper_only
= 2;
1572 else if(rb_strcasecmp(val
, "masked") == 0)
1573 ConfigFileEntry
.stats_k_oper_only
= 1;
1574 else if(rb_strcasecmp(val
, "no") == 0)
1575 ConfigFileEntry
.stats_k_oper_only
= 0;
1577 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1581 conf_set_general_stats_i_oper_only(void *data
)
1585 if(rb_strcasecmp(val
, "yes") == 0)
1586 ConfigFileEntry
.stats_i_oper_only
= 2;
1587 else if(rb_strcasecmp(val
, "masked") == 0)
1588 ConfigFileEntry
.stats_i_oper_only
= 1;
1589 else if(rb_strcasecmp(val
, "no") == 0)
1590 ConfigFileEntry
.stats_i_oper_only
= 0;
1592 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1596 conf_set_general_stats_l_oper_only(void *data
)
1600 if(rb_strcasecmp(val
, "yes") == 0)
1601 ConfigFileEntry
.stats_l_oper_only
= STATS_L_OPER_ONLY_YES
;
1602 else if(rb_strcasecmp(val
, "self") == 0)
1603 ConfigFileEntry
.stats_l_oper_only
= STATS_L_OPER_ONLY_SELF
;
1604 else if(rb_strcasecmp(val
, "no") == 0)
1605 ConfigFileEntry
.stats_l_oper_only
= STATS_L_OPER_ONLY_NO
;
1607 conf_report_error("Invalid setting '%s' for general::stats_l_oper_only.", val
);
1611 conf_set_general_default_umodes(void *data
)
1613 char *umodes
= data
;
1615 parse_umodes(umodes
, &ConfigFileEntry
.default_umodes
, NULL
);
1619 conf_set_general_oper_umodes(void *data
)
1621 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1625 conf_set_general_certfp_method(void *data
)
1627 char *method
= data
;
1629 if (!rb_strcasecmp(method
, CERTFP_NAME_CERT_SHA1
))
1630 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_CERT_SHA1
;
1631 else if (!rb_strcasecmp(method
, CERTFP_NAME_CERT_SHA256
))
1632 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_CERT_SHA256
;
1633 else if (!rb_strcasecmp(method
, CERTFP_NAME_CERT_SHA512
))
1634 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_CERT_SHA512
;
1635 else if (!rb_strcasecmp(method
, CERTFP_NAME_SPKI_SHA256
))
1636 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SPKI_SHA256
;
1637 else if (!rb_strcasecmp(method
, CERTFP_NAME_SPKI_SHA512
))
1638 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SPKI_SHA512
;
1641 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_CERT_SHA1
;
1642 conf_report_error("Ignoring general::certfp_method -- bogus certfp method %s", method
);
1647 conf_set_general_oper_only_umodes(void *data
)
1649 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1653 conf_set_general_oper_snomask(void *data
)
1656 int what
= MODE_ADD
, flag
;
1658 ConfigFileEntry
.oper_snomask
= 0;
1659 for (pm
= (char *) data
; *pm
; pm
++)
1671 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1673 if (what
== MODE_ADD
)
1674 ConfigFileEntry
.oper_snomask
|= flag
;
1676 ConfigFileEntry
.oper_snomask
&= ~flag
;
1684 conf_set_general_hidden_caps(void *data
)
1688 for (conf_parm_t
*arg
= data
; arg
; arg
= arg
->next
)
1691 if (ConfigFileEntry
.hidden_caps
!= NULL
)
1693 for (n
= 0; ConfigFileEntry
.hidden_caps
[n
] != NULL
; n
++)
1694 rb_free(ConfigFileEntry
.hidden_caps
[n
]);
1695 rb_free(ConfigFileEntry
.hidden_caps
);
1697 ConfigFileEntry
.hidden_caps
= rb_malloc(sizeof *ConfigFileEntry
.hidden_caps
* (n
+ 1));
1700 for (conf_parm_t
*arg
= data
; arg
; arg
= arg
->next
)
1702 ConfigFileEntry
.hidden_caps
[n
++] = rb_strdup(arg
->v
.string
);
1704 ConfigFileEntry
.hidden_caps
[n
] = NULL
;
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;
1758 conf_end_alias(struct TopConf
*tc
)
1760 if (yy_alias
== NULL
)
1763 if (yy_alias
->name
== NULL
)
1765 conf_report_error("Ignoring alias -- must have a name.");
1772 if (yy_alias
->target
== NULL
)
1774 conf_report_error("Ignoring alias -- must have a target.");
1781 rb_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1787 conf_set_alias_name(void *data
)
1789 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1792 yy_alias
->name
= rb_strdup(data
);
1796 conf_set_alias_target(void *data
)
1798 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1801 yy_alias
->target
= rb_strdup(data
);
1805 conf_set_channel_autochanmodes(void *data
)
1808 int what
= MODE_ADD
;
1810 ConfigChannel
.autochanmodes
= 0;
1811 for (pm
= (char *) data
; *pm
; pm
++)
1823 if (chmode_table
[(unsigned char) *pm
].set_func
== chm_simple
)
1825 if (what
== MODE_ADD
)
1826 ConfigChannel
.autochanmodes
|= chmode_table
[(unsigned char) *pm
].mode_type
;
1828 ConfigChannel
.autochanmodes
&= ~chmode_table
[(unsigned char) *pm
].mode_type
;
1832 conf_report_error("channel::autochanmodes -- Invalid channel mode %c", *pm
);
1841 static void conf_set_dnsbl_entry_reason(void *data
);
1843 #define IPTYPE_IPV4 1
1844 #define IPTYPE_IPV6 2
1847 conf_warn_blacklist_deprecation(struct TopConf
*tc
)
1849 conf_report_error("blacklist{} blocks have been deprecated -- use dnsbl{} blocks instead.");
1854 conf_set_dnsbl_entry_host(void *data
)
1856 if (yy_dnsbl_entry_host
)
1858 conf_report_error("dnsbl::host %s overlaps existing host %s",
1859 (char *)data
, yy_dnsbl_entry_host
);
1862 conf_set_dnsbl_entry_reason(NULL
);
1866 yy_dnsbl_entry_iptype
|= IPTYPE_IPV4
;
1867 yy_dnsbl_entry_host
= rb_strdup(data
);
1871 conf_set_dnsbl_entry_type(void *data
)
1873 conf_parm_t
*args
= data
;
1875 /* Don't assume we have either if we got here */
1876 yy_dnsbl_entry_iptype
= 0;
1878 for (; args
; args
= args
->next
)
1880 if (!rb_strcasecmp(args
->v
.string
, "ipv4"))
1881 yy_dnsbl_entry_iptype
|= IPTYPE_IPV4
;
1882 else if (!rb_strcasecmp(args
->v
.string
, "ipv6"))
1883 yy_dnsbl_entry_iptype
|= IPTYPE_IPV6
;
1885 conf_report_error("dnsbl::type has unknown address family %s",
1889 /* If we have neither, just default to IPv4 */
1890 if (!yy_dnsbl_entry_iptype
)
1892 conf_report_warning("dnsbl::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
1893 yy_dnsbl_entry_iptype
= IPTYPE_IPV4
;
1898 conf_set_dnsbl_entry_matches(void *data
)
1900 conf_parm_t
*args
= data
;
1901 enum filter_t
{ FILTER_NONE
, FILTER_ALL
, FILTER_LAST
};
1903 for (; args
; args
= args
->next
)
1905 char *str
= args
->v
.string
;
1907 enum filter_t type
= FILTER_LAST
;
1909 if (CF_TYPE(args
->type
) != CF_QSTRING
)
1911 conf_report_error("dnsbl::matches -- must be quoted string");
1917 conf_report_error("dnsbl::matches -- invalid entry");
1921 if (strlen(str
) > HOSTIPLEN
)
1923 conf_report_error("dnsbl::matches has an entry too long: %s",
1928 for (p
= str
; *p
!= '\0'; p
++)
1930 /* Check for validity */
1933 else if (!isdigit((unsigned char)*p
))
1935 conf_report_error("dnsbl::matches has invalid IP match entry %s",
1942 if (type
== FILTER_ALL
)
1944 /* Basic IP sanity check */
1945 struct rb_sockaddr_storage tmp
;
1946 if (rb_inet_pton(AF_INET
, str
, &tmp
) <= 0)
1948 conf_report_error("dnsbl::matches has invalid IP match entry %s",
1953 else if (type
== FILTER_LAST
)
1955 /* Verify it's the correct length */
1956 if (strlen(str
) > 3)
1958 conf_report_error("dnsbl::matches has invalid octet match entry %s",
1965 continue; /* Invalid entry */
1968 rb_dlinkAddAlloc(rb_strdup(str
), &yy_dnsbl_entry_filters
);
1973 conf_set_dnsbl_entry_reason(void *data
)
1975 rb_dlink_node
*ptr
, *nptr
;
1977 if (yy_dnsbl_entry_host
&& data
)
1979 yy_dnsbl_entry_reason
= rb_strdup(data
);
1980 if (yy_dnsbl_entry_iptype
& IPTYPE_IPV6
)
1982 /* Make sure things fit (magic number 64 = alnum count + dots)
1983 * 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
1985 if ((64 + strlen(yy_dnsbl_entry_host
)) > IRCD_RES_HOSTLEN
)
1987 conf_report_error("dnsbl::host %s results in IPv6 queries that are too long",
1988 yy_dnsbl_entry_host
);
1992 /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
1993 if ((yy_dnsbl_entry_iptype
& IPTYPE_IPV4
) && !(yy_dnsbl_entry_iptype
& IPTYPE_IPV6
))
1995 /* Make sure things fit for worst case (magic number 16 = number of nums + dots)
1996 * Example: 127.127.127.127.in-addr.arpa
1998 if ((16 + strlen(yy_dnsbl_entry_host
)) > IRCD_RES_HOSTLEN
)
2000 conf_report_error("dnsbl::host %s results in IPv4 queries that are too long",
2001 yy_dnsbl_entry_host
);
2006 add_dnsbl_entry(yy_dnsbl_entry_host
, yy_dnsbl_entry_reason
, yy_dnsbl_entry_iptype
, &yy_dnsbl_entry_filters
);
2010 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_dnsbl_entry_filters
.head
)
2013 rb_dlinkDestroy(ptr
, &yy_dnsbl_entry_filters
);
2016 yy_dnsbl_entry_filters
= (rb_dlink_list
){ NULL
, NULL
, 0 };
2018 rb_free(yy_dnsbl_entry_host
);
2019 rb_free(yy_dnsbl_entry_reason
);
2020 yy_dnsbl_entry_host
= NULL
;
2021 yy_dnsbl_entry_reason
= NULL
;
2022 yy_dnsbl_entry_iptype
= 0;
2035 conf_begin_opm(struct TopConf
*tc
)
2037 yy_opm_address_ipv4
= yy_opm_address_ipv6
= NULL
;
2038 yy_opm_port_ipv4
= yy_opm_port_ipv6
= yy_opm_timeout
= 0;
2039 delete_opm_proxy_scanner_all();
2040 delete_opm_listener_all();
2045 conf_end_opm(struct TopConf
*tc
)
2047 rb_dlink_node
*ptr
, *nptr
;
2050 if(rb_dlink_list_length(&yy_opm_scanner_list
) == 0)
2052 conf_report_error("No opm scanners configured -- disabling opm.");
2057 if(yy_opm_port_ipv4
> 0)
2059 if(yy_opm_address_ipv4
!= NULL
)
2060 conf_create_opm_listener(yy_opm_address_ipv4
, yy_opm_port_ipv4
);
2064 if(!rb_inet_ntop_sock((struct sockaddr
*)&ServerInfo
.bind4
, ip
, sizeof(ip
)))
2065 conf_report_error("No opm::listen_ipv4 nor serverinfo::vhost directive; cannot listen on IPv4");
2067 conf_create_opm_listener(ip
, yy_opm_port_ipv4
);
2071 if(yy_opm_port_ipv6
> 0)
2073 if(yy_opm_address_ipv6
!= NULL
)
2074 conf_create_opm_listener(yy_opm_address_ipv6
, yy_opm_port_ipv6
);
2078 if(!rb_inet_ntop_sock((struct sockaddr
*)&ServerInfo
.bind6
, ip
, sizeof(ip
)))
2079 conf_report_error("No opm::listen_ipv6 nor serverinfo::vhost directive; cannot listen on IPv6");
2081 conf_create_opm_listener(ip
, yy_opm_port_ipv6
);
2085 /* If there's no listeners... */
2086 fail
= (yy_opm_port_ipv4
== 0 || yy_opm_port_ipv6
== 0);
2087 if(!fail
&& yy_opm_timeout
> 0 && yy_opm_timeout
< 60)
2089 set_authd_timeout("opm_timeout", yy_opm_timeout
);
2091 conf_report_error("No opm listeners -- disabling");
2092 else if(yy_opm_timeout
<= 0 || yy_opm_timeout
>= 60)
2093 conf_report_error("opm::timeout value is invalid -- ignoring");
2096 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_opm_scanner_list
.head
)
2098 struct opm_scanner
*scanner
= ptr
->data
;
2101 create_opm_proxy_scanner(scanner
->type
, scanner
->port
);
2103 rb_dlinkDelete(&scanner
->node
, &yy_opm_scanner_list
);
2108 opm_check_enable(true);
2110 rb_free(yy_opm_address_ipv4
);
2111 rb_free(yy_opm_address_ipv6
);
2116 conf_set_opm_timeout(void *data
)
2118 int timeout
= *((int *)data
);
2120 if(timeout
<= 0 || timeout
> 60)
2122 conf_report_error("opm::timeout value %d is bogus, ignoring", timeout
);
2126 yy_opm_timeout
= timeout
;
2130 conf_set_opm_listen_address_both(void *data
, bool ipv6
)
2132 struct rb_sockaddr_storage addr
;
2133 const char *confstr
= (ipv6
? "opm::listen_ipv6" : "opm::listen_ipv4");
2136 if(!rb_inet_pton_sock(ip
, &addr
))
2138 conf_report_error("%s is an invalid address: %s", confstr
, ip
);
2144 if(GET_SS_FAMILY(&addr
) != AF_INET6
)
2146 conf_report_error("%s is of the wrong address type: %s", confstr
, ip
);
2150 if(yy_opm_address_ipv6
!= NULL
)
2152 conf_report_error("%s overwrites previous address %s", confstr
, ip
);
2156 yy_opm_address_ipv6
= rb_strdup(ip
);
2160 if(GET_SS_FAMILY(&addr
) != AF_INET
)
2162 conf_report_error("%s is of the wrong address type: %s", confstr
, ip
);
2166 if(yy_opm_address_ipv4
!= NULL
)
2168 conf_report_error("%s overwrites previous address %s", confstr
, ip
);
2172 yy_opm_address_ipv4
= rb_strdup(ip
);
2177 conf_set_opm_listen_address_ipv4(void *data
)
2179 conf_set_opm_listen_address_both(data
, false);
2183 conf_set_opm_listen_address_ipv6(void *data
)
2185 conf_set_opm_listen_address_both(data
, true);
2189 conf_set_opm_listen_port_both(void *data
, bool ipv6
)
2191 int port
= *((int *)data
);
2192 const char *confstr
= (ipv6
? "opm::port_ipv6" : "opm::port_ipv4");
2194 if(port
> 65535 || port
<= 0)
2196 conf_report_error("%s is out of range: %d", confstr
, port
);
2202 if(yy_opm_port_ipv4
)
2204 conf_report_error("%s overwrites existing port %hu",
2205 confstr
, yy_opm_port_ipv4
);
2209 yy_opm_port_ipv4
= port
;
2213 if(yy_opm_port_ipv6
)
2215 conf_report_error("%s overwrites existing port %hu",
2216 confstr
, yy_opm_port_ipv6
);
2220 yy_opm_port_ipv6
= port
;
2225 conf_set_opm_listen_port_ipv4(void *data
)
2227 conf_set_opm_listen_port_both(data
, false);
2231 conf_set_opm_listen_port_ipv6(void *data
)
2233 conf_set_opm_listen_port_both(data
, true);
2237 conf_set_opm_listen_port(void *data
)
2239 conf_set_opm_listen_port_both(data
, true);
2240 conf_set_opm_listen_port_both(data
, false);
2244 conf_set_opm_scan_ports_all(void *data
, const char *node
, const char *type
)
2246 conf_parm_t
*args
= data
;
2247 for (; args
; args
= args
->next
)
2252 if(CF_TYPE(args
->type
) != CF_INT
)
2254 conf_report_error("%s argument is not an integer -- ignoring.", node
);
2258 if(args
->v
.number
> 65535 || args
->v
.number
<= 0)
2260 conf_report_error("%s argument is not an integer between 1 and 65535 -- ignoring.", node
);
2264 /* Check for duplicates */
2265 RB_DLINK_FOREACH(ptr
, yy_opm_scanner_list
.head
)
2267 struct opm_scanner
*scanner
= ptr
->data
;
2269 if(scanner
->port
== args
->v
.number
&& strcmp(type
, scanner
->type
) == 0)
2271 conf_report_error("%s argument is duplicate", node
);
2279 struct opm_scanner
*scanner
= rb_malloc(sizeof(struct opm_scanner
));
2280 scanner
->port
= args
->v
.number
;
2281 scanner
->type
= type
;
2282 rb_dlinkAdd(scanner
, &scanner
->node
, &yy_opm_scanner_list
);
2288 conf_set_opm_scan_ports_socks4(void *data
)
2290 conf_set_opm_scan_ports_all(data
, "opm::socks4_ports", "socks4");
2294 conf_set_opm_scan_ports_socks5(void *data
)
2296 conf_set_opm_scan_ports_all(data
, "opm::socks5_ports", "socks5");
2300 conf_set_opm_scan_ports_httpconnect(void *data
)
2302 conf_set_opm_scan_ports_all(data
, "opm::httpconnect_ports", "httpconnect");
2306 conf_set_opm_scan_ports_httpsconnect(void *data
)
2308 conf_set_opm_scan_ports_all(data
, "opm::httpsconnect_ports", "httpsconnect");
2311 /* public functions */
2315 conf_report_error(const char *fmt
, ...)
2318 char msg
[BUFSIZE
+ 1] = { 0 };
2321 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2326 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2330 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2331 sendto_realops_snomask(SNO_GENERAL
, L_NETWIDE
, "error: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2335 conf_report_warning(const char *fmt
, ...)
2338 char msg
[BUFSIZE
+ 1] = { 0 };
2341 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2346 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2350 iwarn("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2351 sendto_realops_snomask(SNO_GENERAL
, L_NETWIDE
, "warning: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2355 conf_start_block(char *block
, char *name
)
2357 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
2359 conf_report_error("Configuration block '%s' is not defined.", block
);
2364 conf_cur_block_name
= rb_strdup(name
);
2366 conf_cur_block_name
= NULL
;
2368 if(conf_cur_block
->tc_sfunc
)
2369 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
2376 conf_end_block(struct TopConf
*tc
)
2380 ret
= tc
->tc_efunc(tc
);
2382 rb_free(conf_cur_block_name
);
2383 conf_cur_block_name
= NULL
;
2388 conf_set_generic_int(void *data
, void *location
)
2390 *((int *) location
) = *((unsigned int *) data
);
2394 conf_set_generic_string(void *data
, int len
, void *location
)
2396 char **loc
= location
;
2399 if(len
&& strlen(input
) > (unsigned int)len
)
2403 *loc
= rb_strdup(input
);
2407 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
)
2409 struct ConfEntry
*cf
;
2415 if((cf
= find_conf_item(tc
, item
)) == NULL
)
2418 ("Non-existent configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
2422 /* if it takes one thing, make sure they only passed one thing,
2423 and handle as needed. */
2424 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
2427 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
2434 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
2436 /* if it expects a string value, but we got a yesno,
2439 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
2440 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
2442 value
->v
.list
->type
= CF_STRING
;
2444 if(cp
->v
.number
== 1)
2445 cp
->v
.string
= rb_strdup("yes");
2447 cp
->v
.string
= rb_strdup("no");
2450 /* maybe it's a CF_TIME and they passed CF_INT --
2451 should still be valid */
2452 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
2453 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
2456 ("Wrong type for %s::%s (expected %s, got %s)",
2457 tc
->tc_name
, (char *) item
,
2458 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
2463 if(cf
->cf_type
& CF_FLIST
)
2467 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
2470 /* just pass it the extended argument list */
2471 cf
->cf_func(value
->v
.list
);
2475 /* it's old-style, needs only one arg */
2476 switch (cf
->cf_type
)
2482 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2484 cf
->cf_func(&cp
->v
.number
);
2488 if(EmptyString(cp
->v
.string
))
2489 conf_report_error("Ignoring %s::%s -- empty field",
2492 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2494 cf
->cf_func(cp
->v
.string
);
2504 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2507 struct ConfEntry
*cf
;
2509 if((tc
= find_top_conf(topconf
)) == NULL
)
2512 if(find_conf_item(tc
, name
) != NULL
)
2515 cf
= rb_malloc(sizeof(struct ConfEntry
));
2522 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2528 remove_conf_item(const char *topconf
, const char *name
)
2531 struct ConfEntry
*cf
;
2534 if((tc
= find_top_conf(topconf
)) == NULL
)
2537 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2540 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2543 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2550 static struct ConfEntry conf_serverinfo_table
[] =
2552 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2554 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2555 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2556 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2557 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2558 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2560 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2561 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2562 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2563 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2564 { "ssl_cipher_list", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cipher_list
},
2565 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2567 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2569 { "nicklen", CF_INT
, conf_set_serverinfo_nicklen
, 0, NULL
},
2571 { "\0", 0, NULL
, 0, NULL
}
2574 static struct ConfEntry conf_admin_table
[] =
2576 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2577 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2578 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2579 { "\0", 0, NULL
, 0, NULL
}
2582 static struct ConfEntry conf_log_table
[] =
2584 { "fname_userlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_userlog
},
2585 { "fname_fuserlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_fuserlog
},
2586 { "fname_operlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operlog
},
2587 { "fname_foperlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_foperlog
},
2588 { "fname_serverlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_serverlog
},
2589 { "fname_killlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_killlog
},
2590 { "fname_klinelog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_klinelog
},
2591 { "fname_operspylog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operspylog
},
2592 { "fname_ioerrorlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_ioerrorlog
},
2593 { "\0", 0, NULL
, 0, NULL
}
2596 static struct ConfEntry conf_operator_table
[] =
2598 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2599 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2600 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2601 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2602 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2603 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2604 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2605 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2606 { "\0", 0, NULL
, 0, NULL
}
2609 static struct ConfEntry conf_privset_table
[] =
2611 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2612 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2613 { "\0", 0, NULL
, 0, NULL
}
2616 static struct ConfEntry conf_class_table
[] =
2618 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2619 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2620 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2621 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2622 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2623 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2624 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2625 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2626 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2627 { "max_autoconn", CF_INT
, conf_set_class_max_autoconn
, 0, NULL
},
2628 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2629 { "\0", 0, NULL
, 0, NULL
}
2632 static struct ConfEntry conf_auth_table
[] =
2634 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2635 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2636 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2637 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2638 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2639 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2640 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2641 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2642 { "umodes", CF_QSTRING
, conf_set_auth_umodes
, 0, NULL
},
2643 { "\0", 0, NULL
, 0, NULL
}
2646 static struct ConfEntry conf_connect_table
[] =
2648 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2649 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2650 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2651 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2652 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2653 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2654 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2655 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2656 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2657 { "\0", 0, NULL
, 0, NULL
}
2660 static struct ConfEntry conf_general_table
[] =
2662 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2663 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2664 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2665 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2666 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2667 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2668 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2669 { "stats_l_oper_only", CF_STRING
, conf_set_general_stats_l_oper_only
, 0, NULL
},
2670 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2672 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2673 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2674 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2675 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2676 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2677 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2678 { "sasl_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.sasl_service
},
2680 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2681 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2682 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2683 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2684 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2686 { "hidden_caps", CF_QSTRING
| CF_FLIST
, conf_set_general_hidden_caps
, 0, NULL
},
2688 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2689 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2690 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2691 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2692 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2693 { "resv_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.resv_fnc
},
2694 { "post_registration_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.post_registration_delay
},
2695 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2696 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2697 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2698 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2699 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2700 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2701 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2702 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2703 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2704 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2705 { "hide_tkdline_duration", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_tkdline_duration
},
2706 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2707 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2708 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2709 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2710 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2711 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2712 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2713 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2714 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2715 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2716 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2717 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2718 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2719 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2720 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2721 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2722 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2723 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2724 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2725 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2726 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2727 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2728 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2729 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2730 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2731 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2732 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2733 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2734 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2735 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2736 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2737 { "client_flood_max_lines", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_max_lines
},
2738 { "client_flood_burst_rate", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_rate
},
2739 { "client_flood_burst_max", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_max
},
2740 { "client_flood_message_num", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_num
},
2741 { "client_flood_message_time", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_time
},
2742 { "max_ratelimit_tokens", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_ratelimit_tokens
},
2743 { "away_interval", CF_INT
, NULL
, 0, &ConfigFileEntry
.away_interval
},
2744 { "hide_opers_in_whois", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_opers_in_whois
},
2745 { "hide_opers", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_opers
},
2746 { "certfp_method", CF_STRING
, conf_set_general_certfp_method
, 0, NULL
},
2747 { "drain_reason", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.drain_reason
},
2748 { "sasl_only_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.sasl_only_client_message
},
2749 { "identd_only_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.identd_only_client_message
},
2750 { "sctp_forbidden_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.sctp_forbidden_client_message
},
2751 { "ssltls_only_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.ssltls_only_client_message
},
2752 { "not_authorised_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.not_authorised_client_message
},
2753 { "illegal_hostname_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.not_authorised_client_message
},
2754 { "server_full_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.server_full_client_message
},
2755 { "illegal_name_long_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.illegal_name_long_client_message
},
2756 { "illegal_name_short_client_message", CF_QSTRING
, NULL
, BUFSIZE
, &ConfigFileEntry
.illegal_name_short_client_message
},
2757 { "tls_ciphers_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tls_ciphers_oper_only
},
2758 { "oper_secure_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.oper_secure_only
},
2759 { "\0", 0, NULL
, 0, NULL
}
2762 static struct ConfEntry conf_channel_table
[] =
2764 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2765 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2766 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2767 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2768 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2769 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2770 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2771 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2772 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2773 { "max_chans_per_user_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user_large
},
2774 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2775 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2776 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2777 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2778 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2779 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2780 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2781 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2782 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2783 { "disable_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.disable_local_channels
},
2784 { "autochanmodes", CF_QSTRING
, conf_set_channel_autochanmodes
, 0, NULL
},
2785 { "displayed_usercount", CF_INT
, NULL
, 0, &ConfigChannel
.displayed_usercount
},
2786 { "strip_topic_colors", CF_YESNO
, NULL
, 0, &ConfigChannel
.strip_topic_colors
},
2787 { "opmod_send_statusmsg", CF_YESNO
, NULL
, 0, &ConfigChannel
.opmod_send_statusmsg
},
2788 { "ip_bans_through_vhost", CF_YESNO
, NULL
, 0, &ConfigChannel
.ip_bans_through_vhost
},
2789 { "\0", 0, NULL
, 0, NULL
}
2792 static struct ConfEntry conf_serverhide_table
[] =
2794 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2795 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2796 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2797 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2798 { "\0", 0, NULL
, 0, NULL
}
2805 add_top_conf("modules", NULL
, NULL
, NULL
);
2806 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2807 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2809 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2810 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2811 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2812 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2813 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2814 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2816 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2817 add_conf_item("listen", "defer_accept", CF_YESNO
, conf_set_listen_defer_accept
);
2818 add_conf_item("listen", "wsock", CF_YESNO
, conf_set_listen_wsock
);
2819 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2820 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2821 add_conf_item("listen", "sctp_port", CF_INT
| CF_FLIST
, conf_set_listen_sctp_port
);
2822 add_conf_item("listen", "sctp_sslport", CF_INT
| CF_FLIST
, conf_set_listen_sctp_sslport
);
2823 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2824 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2826 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2828 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2830 add_top_conf("exempt", NULL
, NULL
, NULL
);
2831 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2833 add_top_conf("secure", NULL
, NULL
, NULL
);
2834 add_conf_item("secure", "ip", CF_QSTRING
, conf_set_secure_ip
);
2836 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2837 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2838 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2840 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2841 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2842 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2844 add_top_conf("service", NULL
, NULL
, NULL
);
2845 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2847 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2848 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2849 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2851 add_top_conf("dnsbl", NULL
, NULL
, NULL
);
2852 add_conf_item("dnsbl", "host", CF_QSTRING
, conf_set_dnsbl_entry_host
);
2853 add_conf_item("dnsbl", "type", CF_STRING
| CF_FLIST
, conf_set_dnsbl_entry_type
);
2854 add_conf_item("dnsbl", "matches", CF_QSTRING
| CF_FLIST
, conf_set_dnsbl_entry_matches
);
2855 add_conf_item("dnsbl", "reject_reason", CF_QSTRING
, conf_set_dnsbl_entry_reason
);
2857 add_top_conf("blacklist", conf_warn_blacklist_deprecation
, NULL
, NULL
);
2858 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_dnsbl_entry_host
);
2859 add_conf_item("blacklist", "type", CF_STRING
| CF_FLIST
, conf_set_dnsbl_entry_type
);
2860 add_conf_item("blacklist", "matches", CF_QSTRING
| CF_FLIST
, conf_set_dnsbl_entry_matches
);
2861 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_dnsbl_entry_reason
);
2863 add_top_conf("opm", conf_begin_opm
, conf_end_opm
, NULL
);
2864 add_conf_item("opm", "timeout", CF_INT
, conf_set_opm_timeout
);
2865 add_conf_item("opm", "listen_ipv4", CF_QSTRING
, conf_set_opm_listen_address_ipv4
);
2866 add_conf_item("opm", "listen_ipv6", CF_QSTRING
, conf_set_opm_listen_address_ipv6
);
2867 add_conf_item("opm", "port_v4", CF_INT
, conf_set_opm_listen_port_ipv4
);
2868 add_conf_item("opm", "port_v6", CF_INT
, conf_set_opm_listen_port_ipv6
);
2869 add_conf_item("opm", "listen_port", CF_INT
, conf_set_opm_listen_port
);
2870 add_conf_item("opm", "socks4_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_socks4
);
2871 add_conf_item("opm", "socks5_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_socks5
);
2872 add_conf_item("opm", "httpconnect_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_httpconnect
);
2873 add_conf_item("opm", "httpsconnect_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_httpsconnect
);