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"
32 #define CF_TYPE(x) ((x) & CF_MTYPE)
34 static int yy_defer_accept
= 1;
35 static int yy_wsock
= 0;
37 struct TopConf
*conf_cur_block
;
38 static char *conf_cur_block_name
= NULL
;
40 static rb_dlink_list conf_items
;
42 static struct ConfItem
*yy_aconf
= NULL
;
44 static struct Class
*yy_class
= NULL
;
46 static struct remote_conf
*yy_shared
= NULL
;
47 static struct server_conf
*yy_server
= NULL
;
49 static rb_dlink_list yy_aconf_list
;
50 static rb_dlink_list yy_oper_list
;
51 static rb_dlink_list yy_shared_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_blacklist_host
= NULL
;
58 static char *yy_blacklist_reason
= NULL
;
59 static uint8_t yy_blacklist_iptype
= 0;
60 static rb_dlink_list yy_blacklist_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 strcpy(ServerInfo
.sid
, 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 if(rb_inet_pton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
248 conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data
);
251 ServerInfo
.ip
.sin_family
= AF_INET
;
252 ServerInfo
.specific_ipv4_vhost
= 1;
256 conf_set_serverinfo_vhost6(void *data
)
259 if(rb_inet_pton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
261 conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data
);
265 ServerInfo
.specific_ipv6_vhost
= 1;
266 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
268 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
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
) == -1)
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 {"callerid", UMODE_CALLERID
},
319 {"deaf", UMODE_DEAF
},
320 {"invisible", UMODE_INVISIBLE
},
321 {"locops", UMODE_LOCOPS
},
322 {"noforward", UMODE_NOFORWARD
},
323 {"regonlymsg", UMODE_REGONLYMSG
},
324 {"servnotice", UMODE_SERVNOTICE
},
325 {"wallop", UMODE_WALLOP
},
326 {"operwall", UMODE_OPERWALL
},
330 static struct mode_table oper_table
[] = {
331 {"encrypted", OPER_ENCRYPTED
},
332 {"need_ssl", OPER_NEEDSSL
},
336 static struct mode_table auth_table
[] = {
337 {"encrypted", CONF_FLAGS_ENCRYPTED
},
338 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
339 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
340 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
341 {"proxy_exempt", CONF_FLAGS_EXEMPTPROXY
},
342 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
343 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
344 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
345 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
346 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
347 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
348 {"no_tilde", CONF_FLAGS_NO_TILDE
},
349 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
350 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
351 {"need_ssl", CONF_FLAGS_NEED_SSL
},
352 {"need_sasl", CONF_FLAGS_NEED_SASL
},
353 {"extend_chans", CONF_FLAGS_EXTEND_CHANS
},
357 static struct mode_table connect_table
[] = {
358 { "autoconn", SERVER_AUTOCONN
},
359 { "compressed", SERVER_COMPRESSED
},
360 { "encrypted", SERVER_ENCRYPTED
},
361 { "topicburst", SERVER_TB
},
362 { "ssl", SERVER_SSL
},
366 static struct mode_table cluster_table
[] = {
367 { "kline", SHARED_PKLINE
},
368 { "tkline", SHARED_TKLINE
},
369 { "unkline", SHARED_UNKLINE
},
370 { "locops", SHARED_LOCOPS
},
371 { "xline", SHARED_PXLINE
},
372 { "txline", SHARED_TXLINE
},
373 { "unxline", SHARED_UNXLINE
},
374 { "resv", SHARED_PRESV
},
375 { "tresv", SHARED_TRESV
},
376 { "unresv", SHARED_UNRESV
},
377 { "all", CLUSTER_ALL
},
381 static struct mode_table shared_table
[] =
383 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
384 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
385 { "resv", SHARED_PRESV
|SHARED_TRESV
},
386 { "dline", SHARED_PDLINE
|SHARED_TDLINE
},
387 { "tdline", SHARED_TDLINE
},
388 { "pdline", SHARED_PDLINE
},
389 { "undline", SHARED_UNDLINE
},
390 { "tkline", SHARED_TKLINE
},
391 { "unkline", SHARED_UNKLINE
},
392 { "txline", SHARED_TXLINE
},
393 { "unxline", SHARED_UNXLINE
},
394 { "tresv", SHARED_TRESV
},
395 { "unresv", SHARED_UNRESV
},
396 { "locops", SHARED_LOCOPS
},
397 { "rehash", SHARED_REHASH
},
398 { "grant", SHARED_GRANT
},
399 { "die", SHARED_DIE
},
400 { "module", SHARED_MODULE
},
401 { "all", SHARED_ALL
},
408 find_umode(struct mode_table
*tab
, const char *name
)
412 for (i
= 0; tab
[i
].name
; i
++)
414 if(strcmp(tab
[i
].name
, name
) == 0)
422 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
424 for (; args
; args
= args
->next
)
430 if(CF_TYPE(args
->type
) != CF_STRING
)
432 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
436 umode
= args
->v
.string
;
444 mode
= find_umode(tab
, umode
);
448 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
465 conf_set_privset_extends(void *data
)
467 yy_privset_extends
= rb_strdup((char *) data
);
471 conf_set_privset_privs(void *data
)
474 conf_parm_t
*args
= data
;
476 for (; args
; args
= args
->next
)
479 privs
= rb_strdup(args
->v
.string
);
482 char *privs_old
= privs
;
484 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
485 strcpy(privs
, privs_old
);
487 strcat(privs
, args
->v
.string
);
495 if (yy_privset_extends
)
497 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
501 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
503 set
= privilegeset_get("default");
506 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
508 rb_free(yy_privset_extends
);
509 yy_privset_extends
= NULL
;
512 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
519 conf_begin_oper(struct TopConf
*tc
)
522 rb_dlink_node
*next_ptr
;
526 free_oper_conf(yy_oper
);
530 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
532 free_oper_conf(ptr
->data
);
533 rb_dlinkDestroy(ptr
, &yy_oper_list
);
536 yy_oper
= make_oper_conf();
537 yy_oper
->flags
|= OPER_ENCRYPTED
;
543 conf_end_oper(struct TopConf
*tc
)
545 struct oper_conf
*yy_tmpoper
;
547 rb_dlink_node
*next_ptr
;
549 if(conf_cur_block_name
!= NULL
)
551 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
552 conf_cur_block_name
[OPERNICKLEN
] = '\0';
554 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
557 if(EmptyString(yy_oper
->name
))
559 conf_report_error("Ignoring operator block -- missing name.");
563 #ifdef HAVE_LIBCRYPTO
564 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
566 if(EmptyString(yy_oper
->passwd
))
569 conf_report_error("Ignoring operator block for %s -- missing password",
575 if (!yy_oper
->privset
)
576 yy_oper
->privset
= privilegeset_get("default");
578 /* now, yy_oper_list contains a stack of oper_conf's with just user
579 * and host in, yy_oper contains the rest of the information which
580 * we need to copy into each element in yy_oper_list
582 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
584 yy_tmpoper
= ptr
->data
;
586 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
588 /* could be an rsa key instead.. */
589 if(!EmptyString(yy_oper
->passwd
))
590 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
592 yy_tmpoper
->flags
= yy_oper
->flags
;
593 yy_tmpoper
->umodes
= yy_oper
->umodes
;
594 yy_tmpoper
->snomask
= yy_oper
->snomask
;
595 yy_tmpoper
->privset
= yy_oper
->privset
;
597 #ifdef HAVE_LIBCRYPTO
598 if(yy_oper
->rsa_pubkey_file
)
602 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
604 conf_report_error("Ignoring operator block for %s -- "
605 "rsa_public_key_file cant be opened",
610 yy_tmpoper
->rsa_pubkey
=
611 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
613 (void)BIO_set_close(file
, BIO_CLOSE
);
616 if(yy_tmpoper
->rsa_pubkey
== NULL
)
618 conf_report_error("Ignoring operator block for %s -- "
619 "rsa_public_key_file key invalid; check syntax",
625 if(!EmptyString(yy_oper
->certfp
))
626 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
629 /* all is ok, put it on oper_conf_list */
630 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
633 free_oper_conf(yy_oper
);
640 conf_set_oper_flags(void *data
)
642 conf_parm_t
*args
= data
;
644 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
648 conf_set_oper_fingerprint(void *data
)
651 rb_free(yy_oper
->certfp
);
652 yy_oper
->certfp
= rb_strdup((char *) data
);
656 conf_set_oper_privset(void *data
)
658 yy_oper
->privset
= privilegeset_get((char *) data
);
662 conf_set_oper_user(void *data
)
664 struct oper_conf
*yy_tmpoper
;
666 char *host
= (char *) data
;
668 yy_tmpoper
= make_oper_conf();
670 if((p
= strchr(host
, '@')))
674 yy_tmpoper
->username
= rb_strdup(host
);
675 yy_tmpoper
->host
= rb_strdup(p
);
680 yy_tmpoper
->username
= rb_strdup("*");
681 yy_tmpoper
->host
= rb_strdup(host
);
684 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
686 conf_report_error("Ignoring user -- missing username/host");
687 free_oper_conf(yy_tmpoper
);
691 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
695 conf_set_oper_password(void *data
)
699 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
700 rb_free(yy_oper
->passwd
);
703 yy_oper
->passwd
= rb_strdup((char *) data
);
707 conf_set_oper_rsa_public_key_file(void *data
)
709 #ifdef HAVE_LIBCRYPTO
710 rb_free(yy_oper
->rsa_pubkey_file
);
711 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
713 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
718 conf_set_oper_umodes(void *data
)
720 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
724 conf_set_oper_snomask(void *data
)
726 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
730 conf_begin_class(struct TopConf
*tc
)
733 free_class(yy_class
);
735 yy_class
= make_class();
740 conf_end_class(struct TopConf
*tc
)
742 if(conf_cur_block_name
!= NULL
)
743 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
745 if(EmptyString(yy_class
->class_name
))
747 conf_report_error("Ignoring connect block -- missing name.");
757 conf_set_class_ping_time(void *data
)
759 yy_class
->ping_freq
= *(unsigned int *) data
;
763 conf_set_class_cidr_ipv4_bitlen(void *data
)
765 unsigned int maxsize
= 32;
766 if(*(unsigned int *) data
> maxsize
)
768 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
769 *(unsigned int *) data
, maxsize
);
771 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
777 conf_set_class_cidr_ipv6_bitlen(void *data
)
779 unsigned int maxsize
= 128;
780 if(*(unsigned int *) data
> maxsize
)
782 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
783 *(unsigned int *) data
, maxsize
);
785 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
791 conf_set_class_number_per_cidr(void *data
)
793 yy_class
->cidr_amount
= *(unsigned int *) data
;
797 conf_set_class_number_per_ip(void *data
)
799 yy_class
->max_local
= *(unsigned int *) data
;
804 conf_set_class_number_per_ip_global(void *data
)
806 yy_class
->max_global
= *(unsigned int *) data
;
810 conf_set_class_number_per_ident(void *data
)
812 yy_class
->max_ident
= *(unsigned int *) data
;
816 conf_set_class_connectfreq(void *data
)
818 yy_class
->con_freq
= *(unsigned int *) data
;
822 conf_set_class_max_number(void *data
)
824 yy_class
->max_total
= *(unsigned int *) data
;
828 conf_set_class_sendq(void *data
)
830 yy_class
->max_sendq
= *(unsigned int *) data
;
833 static char *listener_address
;
836 conf_begin_listen(struct TopConf
*tc
)
838 rb_free(listener_address
);
839 listener_address
= NULL
;
844 conf_end_listen(struct TopConf
*tc
)
846 rb_free(listener_address
);
847 listener_address
= NULL
;
852 conf_set_listen_defer_accept(void *data
)
854 yy_defer_accept
= *(unsigned int *) data
;
858 conf_set_listen_wsock(void *data
)
860 yy_wsock
= *(unsigned int *) data
;
864 conf_set_listen_port_both(void *data
, int ssl
)
866 conf_parm_t
*args
= data
;
867 for (; args
; args
= args
->next
)
869 if(CF_TYPE(args
->type
) != CF_INT
)
872 ("listener::port argument is not an integer " "-- ignoring.");
875 if(listener_address
== NULL
)
879 conf_report_warning("listener 'ANY/%d': support for plaintext listeners may be removed in a future release per RFC 7194. "
880 "It is suggested that users be migrated to SSL/TLS connections.", args
->v
.number
);
882 add_listener(args
->v
.number
, listener_address
, AF_INET
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
884 add_listener(args
->v
.number
, listener_address
, AF_INET6
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
891 if(strchr(listener_address
, ':') != NULL
)
899 conf_report_warning("listener '%s/%d': support for plaintext listeners may be removed in a future release per RFC 7194. "
900 "It is suggested that users be migrated to SSL/TLS connections.", listener_address
, args
->v
.number
);
903 add_listener(args
->v
.number
, listener_address
, family
, ssl
, ssl
|| yy_defer_accept
, yy_wsock
);
909 conf_set_listen_port(void *data
)
911 conf_set_listen_port_both(data
, 0);
915 conf_set_listen_sslport(void *data
)
917 conf_set_listen_port_both(data
, 1);
921 conf_set_listen_address(void *data
)
923 rb_free(listener_address
);
924 listener_address
= rb_strdup(data
);
928 conf_begin_auth(struct TopConf
*tc
)
931 rb_dlink_node
*next_ptr
;
936 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
938 free_conf(ptr
->data
);
939 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
942 yy_aconf
= make_conf();
943 yy_aconf
->status
= CONF_CLIENT
;
949 conf_end_auth(struct TopConf
*tc
)
951 struct ConfItem
*yy_tmp
, *found_conf
;
953 rb_dlink_node
*next_ptr
;
955 if(EmptyString(yy_aconf
->info
.name
))
956 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
958 /* didnt even get one ->host? */
959 if(EmptyString(yy_aconf
->host
))
961 conf_report_error("Ignoring auth block -- missing user@host");
965 /* so the stacking works in order.. */
966 collapse(yy_aconf
->user
);
967 collapse(yy_aconf
->host
);
968 conf_add_class_to_conf(yy_aconf
);
969 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
970 conf_report_error("Ignoring redundant auth block (after *@*)");
971 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
972 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
973 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
974 conf_report_error("Ignoring duplicate auth block for %s@%s",
975 yy_aconf
->user
, yy_aconf
->host
);
977 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
979 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
984 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
986 if(yy_aconf
->spasswd
)
987 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
989 /* this will always exist.. */
990 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
992 if(yy_aconf
->className
)
993 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
995 yy_tmp
->flags
= yy_aconf
->flags
;
996 yy_tmp
->port
= yy_aconf
->port
;
998 collapse(yy_tmp
->user
);
999 collapse(yy_tmp
->host
);
1001 conf_add_class_to_conf(yy_tmp
);
1003 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
1004 conf_report_error("Ignoring redundant auth block (after *@*)");
1005 else if ((found_conf
= find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
)) &&
1006 (!found_conf
->spasswd
|| (yy_tmp
->spasswd
&&
1007 0 == irccmp(found_conf
->spasswd
, yy_tmp
->spasswd
))))
1008 conf_report_error("Ignoring duplicate auth block for %s@%s",
1009 yy_tmp
->user
, yy_tmp
->host
);
1011 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
1012 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1020 conf_set_auth_user(void *data
)
1022 struct ConfItem
*yy_tmp
;
1025 /* The first user= line doesn't allocate a new conf */
1026 if(!EmptyString(yy_aconf
->host
))
1028 yy_tmp
= make_conf();
1029 yy_tmp
->status
= CONF_CLIENT
;
1034 if((p
= strchr(data
, '@')))
1038 yy_tmp
->user
= rb_strdup(data
);
1039 yy_tmp
->host
= rb_strdup(p
);
1043 yy_tmp
->user
= rb_strdup("*");
1044 yy_tmp
->host
= rb_strdup(data
);
1047 if(yy_aconf
!= yy_tmp
)
1048 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1052 conf_set_auth_auth_user(void *data
)
1054 if(yy_aconf
->spasswd
)
1055 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1056 rb_free(yy_aconf
->spasswd
);
1057 yy_aconf
->spasswd
= rb_strdup(data
);
1061 conf_set_auth_passwd(void *data
)
1063 if(yy_aconf
->passwd
)
1064 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1065 rb_free(yy_aconf
->passwd
);
1066 yy_aconf
->passwd
= rb_strdup(data
);
1070 conf_set_auth_spoof(void *data
)
1078 /* user@host spoof */
1079 if((p
= strchr(host
, '@')) != NULL
)
1085 if(EmptyString(user
))
1087 conf_report_error("Warning -- spoof ident empty.");
1091 if(strlen(user
) > USERLEN
)
1093 conf_report_error("Warning -- spoof ident length invalid.");
1097 if(!valid_username(user
))
1099 conf_report_error("Warning -- invalid spoof (ident).");
1103 /* this must be restored! */
1107 if(EmptyString(host
))
1109 conf_report_error("Warning -- spoof host empty.");
1113 if(strlen(host
) > HOSTLEN
)
1115 conf_report_error("Warning -- spoof host length invalid.");
1119 if(!valid_hostname(host
))
1121 conf_report_error("Warning -- invalid spoof (host).");
1125 rb_free(yy_aconf
->info
.name
);
1126 yy_aconf
->info
.name
= rb_strdup(data
);
1127 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1131 conf_set_auth_flags(void *data
)
1133 conf_parm_t
*args
= data
;
1135 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1139 conf_set_auth_redir_serv(void *data
)
1141 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1142 rb_free(yy_aconf
->info
.name
);
1143 yy_aconf
->info
.name
= rb_strdup(data
);
1147 conf_set_auth_redir_port(void *data
)
1149 int port
= *(unsigned int *) data
;
1151 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1152 yy_aconf
->port
= port
;
1156 conf_set_auth_class(void *data
)
1158 rb_free(yy_aconf
->className
);
1159 yy_aconf
->className
= rb_strdup(data
);
1162 /* ok, shared_oper handles the stacking, shared_flags handles adding
1163 * things.. so all we need to do when we start and end a shared block, is
1164 * clean up anything thats been left over.
1167 conf_cleanup_shared(struct TopConf
*tc
)
1169 rb_dlink_node
*ptr
, *next_ptr
;
1171 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1173 free_remote_conf(ptr
->data
);
1174 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1177 if(yy_shared
!= NULL
)
1179 free_remote_conf(yy_shared
);
1187 conf_set_shared_oper(void *data
)
1189 conf_parm_t
*args
= data
;
1190 const char *username
;
1193 if(yy_shared
!= NULL
)
1194 free_remote_conf(yy_shared
);
1196 yy_shared
= make_remote_conf();
1198 if(args
->next
!= NULL
)
1200 if(CF_TYPE(args
->type
) != CF_QSTRING
)
1202 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1206 yy_shared
->server
= rb_strdup(args
->v
.string
);
1210 yy_shared
->server
= rb_strdup("*");
1212 if(CF_TYPE(args
->type
) != CF_QSTRING
)
1214 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1218 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1220 conf_report_error("Ignoring shard::oper -- oper is not a user@host");
1224 username
= args
->v
.string
;
1228 yy_shared
->host
= rb_strdup("*");
1230 yy_shared
->host
= rb_strdup(p
);
1232 if(EmptyString(username
))
1233 yy_shared
->username
= rb_strdup("*");
1235 yy_shared
->username
= rb_strdup(username
);
1237 rb_dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1242 conf_set_shared_flags(void *data
)
1244 conf_parm_t
*args
= data
;
1246 rb_dlink_node
*ptr
, *next_ptr
;
1248 if(yy_shared
!= NULL
)
1249 free_remote_conf(yy_shared
);
1251 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1253 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1255 yy_shared
= ptr
->data
;
1257 yy_shared
->flags
= flags
;
1258 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1259 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1266 conf_begin_connect(struct TopConf
*tc
)
1269 free_server_conf(yy_server
);
1271 yy_server
= make_server_conf();
1272 yy_server
->port
= PORTNUM
;
1273 yy_server
->flags
|= SERVER_TB
;
1275 if(conf_cur_block_name
!= NULL
)
1276 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1282 conf_end_connect(struct TopConf
*tc
)
1284 if(EmptyString(yy_server
->name
))
1286 conf_report_error("Ignoring connect block -- missing name.");
1290 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1292 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1297 if((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
)) && EmptyString(yy_server
->certfp
))
1299 conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
1304 if(EmptyString(yy_server
->host
))
1306 conf_report_error("Ignoring connect block for %s -- missing host.",
1312 if(ServerConfCompressed(yy_server
))
1314 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1315 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1319 add_server_conf(yy_server
);
1320 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1327 conf_set_connect_host(void *data
)
1329 rb_free(yy_server
->host
);
1330 yy_server
->host
= rb_strdup(data
);
1331 if (strchr(yy_server
->host
, ':'))
1332 yy_server
->aftype
= AF_INET6
;
1336 conf_set_connect_vhost(void *data
)
1338 if(rb_inet_pton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1340 conf_report_error("Invalid IP address for server connect vhost (%s)",
1345 yy_server
->flags
|= SERVER_VHOSTED
;
1349 conf_set_connect_send_password(void *data
)
1351 if(yy_server
->spasswd
)
1353 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1354 rb_free(yy_server
->spasswd
);
1357 yy_server
->spasswd
= rb_strdup(data
);
1361 conf_set_connect_accept_password(void *data
)
1363 if(yy_server
->passwd
)
1365 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1366 rb_free(yy_server
->passwd
);
1368 yy_server
->passwd
= rb_strdup(data
);
1372 conf_set_connect_fingerprint(void *data
)
1374 if (yy_server
->certfp
)
1375 rb_free(yy_server
->certfp
);
1376 yy_server
->certfp
= rb_strdup((char *) data
);
1378 /* force SSL to be enabled if fingerprint is enabled. */
1379 yy_server
->flags
|= SERVER_SSL
;
1383 conf_set_connect_port(void *data
)
1385 int port
= *(unsigned int *) data
;
1390 yy_server
->port
= port
;
1394 conf_set_connect_aftype(void *data
)
1398 if(rb_strcasecmp(aft
, "ipv4") == 0)
1399 yy_server
->aftype
= AF_INET
;
1401 else if(rb_strcasecmp(aft
, "ipv6") == 0)
1402 yy_server
->aftype
= AF_INET6
;
1405 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1409 conf_set_connect_flags(void *data
)
1411 conf_parm_t
*args
= data
;
1413 /* note, we allow them to set compressed, then remove it later if
1414 * they do and LIBZ isnt available
1416 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1420 conf_set_connect_hub_mask(void *data
)
1422 struct remote_conf
*yy_hub
;
1424 if(EmptyString(yy_server
->name
))
1427 yy_hub
= make_remote_conf();
1428 yy_hub
->flags
= CONF_HUB
;
1430 yy_hub
->host
= rb_strdup(data
);
1431 yy_hub
->server
= rb_strdup(yy_server
->name
);
1432 rb_dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1436 conf_set_connect_leaf_mask(void *data
)
1438 struct remote_conf
*yy_leaf
;
1440 if(EmptyString(yy_server
->name
))
1443 yy_leaf
= make_remote_conf();
1444 yy_leaf
->flags
= CONF_LEAF
;
1446 yy_leaf
->host
= rb_strdup(data
);
1447 yy_leaf
->server
= rb_strdup(yy_server
->name
);
1448 rb_dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1452 conf_set_connect_class(void *data
)
1454 rb_free(yy_server
->class_name
);
1455 yy_server
->class_name
= rb_strdup(data
);
1459 conf_set_exempt_ip(void *data
)
1461 struct ConfItem
*yy_tmp
;
1463 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1465 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1469 yy_tmp
= make_conf();
1470 yy_tmp
->passwd
= rb_strdup("*");
1471 yy_tmp
->host
= rb_strdup(data
);
1472 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1473 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1477 conf_cleanup_cluster(struct TopConf
*tc
)
1479 rb_dlink_node
*ptr
, *next_ptr
;
1481 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1483 free_remote_conf(ptr
->data
);
1484 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1487 if(yy_shared
!= NULL
)
1489 free_remote_conf(yy_shared
);
1497 conf_set_cluster_name(void *data
)
1499 if(yy_shared
!= NULL
)
1500 free_remote_conf(yy_shared
);
1502 yy_shared
= make_remote_conf();
1503 yy_shared
->server
= rb_strdup(data
);
1504 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1510 conf_set_cluster_flags(void *data
)
1512 conf_parm_t
*args
= data
;
1514 rb_dlink_node
*ptr
, *next_ptr
;
1516 if(yy_shared
!= NULL
)
1517 free_remote_conf(yy_shared
);
1519 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1521 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1523 yy_shared
= ptr
->data
;
1524 yy_shared
->flags
= flags
;
1525 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1526 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1533 conf_set_general_havent_read_conf(void *data
)
1535 if(*(unsigned int *) data
)
1537 conf_report_error("You haven't read your config file properly.");
1539 ("There is a line in the example conf that will kill your server if not removed.");
1541 ("Consider actually reading/editing the conf file, and removing this line.");
1548 conf_set_general_hide_error_messages(void *data
)
1552 if(rb_strcasecmp(val
, "yes") == 0)
1553 ConfigFileEntry
.hide_error_messages
= 2;
1554 else if(rb_strcasecmp(val
, "opers") == 0)
1555 ConfigFileEntry
.hide_error_messages
= 1;
1556 else if(rb_strcasecmp(val
, "no") == 0)
1557 ConfigFileEntry
.hide_error_messages
= 0;
1559 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1563 conf_set_general_kline_delay(void *data
)
1565 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1567 /* THIS MUST BE HERE to stop us being unable to check klines */
1568 kline_queued
= false;
1572 conf_set_general_stats_k_oper_only(void *data
)
1576 if(rb_strcasecmp(val
, "yes") == 0)
1577 ConfigFileEntry
.stats_k_oper_only
= 2;
1578 else if(rb_strcasecmp(val
, "masked") == 0)
1579 ConfigFileEntry
.stats_k_oper_only
= 1;
1580 else if(rb_strcasecmp(val
, "no") == 0)
1581 ConfigFileEntry
.stats_k_oper_only
= 0;
1583 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1587 conf_set_general_stats_i_oper_only(void *data
)
1591 if(rb_strcasecmp(val
, "yes") == 0)
1592 ConfigFileEntry
.stats_i_oper_only
= 2;
1593 else if(rb_strcasecmp(val
, "masked") == 0)
1594 ConfigFileEntry
.stats_i_oper_only
= 1;
1595 else if(rb_strcasecmp(val
, "no") == 0)
1596 ConfigFileEntry
.stats_i_oper_only
= 0;
1598 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1602 conf_set_general_compression_level(void *data
)
1605 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1607 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1610 ("Invalid general::compression_level %d -- using default.",
1611 ConfigFileEntry
.compression_level
);
1612 ConfigFileEntry
.compression_level
= 0;
1615 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1620 conf_set_general_default_umodes(void *data
)
1623 int what
= MODE_ADD
, flag
;
1625 ConfigFileEntry
.default_umodes
= 0;
1626 for (pm
= (char *) data
; *pm
; pm
++)
1637 /* don't allow +o */
1645 if ((flag
= user_modes
[(unsigned char) *pm
]))
1647 /* Proper value has probably not yet been set
1648 * so don't check oper_only_umodes -- jilles */
1649 if (what
== MODE_ADD
)
1650 ConfigFileEntry
.default_umodes
|= flag
;
1652 ConfigFileEntry
.default_umodes
&= ~flag
;
1660 conf_set_general_oper_umodes(void *data
)
1662 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1666 conf_set_general_certfp_method(void *data
)
1668 char *method
= data
;
1670 if (!rb_strcasecmp(method
, "sha1"))
1671 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA1
;
1672 else if (!rb_strcasecmp(method
, "sha256"))
1673 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA256
;
1674 else if (!rb_strcasecmp(method
, "sha512"))
1675 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA512
;
1678 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA1
;
1679 conf_report_error("Ignoring general::certfp_method -- bogus certfp method %s", method
);
1684 conf_set_general_oper_only_umodes(void *data
)
1686 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1690 conf_set_general_oper_snomask(void *data
)
1693 int what
= MODE_ADD
, flag
;
1695 ConfigFileEntry
.oper_snomask
= 0;
1696 for (pm
= (char *) data
; *pm
; pm
++)
1708 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1710 if (what
== MODE_ADD
)
1711 ConfigFileEntry
.oper_snomask
|= flag
;
1713 ConfigFileEntry
.oper_snomask
&= ~flag
;
1721 conf_set_serverhide_links_delay(void *data
)
1723 int val
= *(unsigned int *) data
;
1725 ConfigServerHide
.links_delay
= val
;
1729 conf_set_service_name(void *data
)
1735 for(s
= data
; *s
!= '\0'; s
++)
1739 conf_report_error("Ignoring service::name "
1740 "-- bogus servername.");
1749 conf_report_error("Ignoring service::name -- must contain '.'");
1753 tmp
= rb_strdup(data
);
1754 rb_dlinkAddAlloc(tmp
, &service_list
);
1758 conf_begin_alias(struct TopConf
*tc
)
1760 yy_alias
= rb_malloc(sizeof(struct alias_entry
));
1762 if (conf_cur_block_name
!= NULL
)
1763 yy_alias
->name
= rb_strdup(conf_cur_block_name
);
1765 yy_alias
->flags
= 0;
1771 conf_end_alias(struct TopConf
*tc
)
1773 if (yy_alias
== NULL
)
1776 if (yy_alias
->name
== NULL
)
1778 conf_report_error("Ignoring alias -- must have a name.");
1785 if (yy_alias
->target
== NULL
)
1787 conf_report_error("Ignoring alias -- must have a target.");
1794 rb_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1800 conf_set_alias_name(void *data
)
1802 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1805 yy_alias
->name
= rb_strdup(data
);
1809 conf_set_alias_target(void *data
)
1811 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1814 yy_alias
->target
= rb_strdup(data
);
1818 conf_set_channel_autochanmodes(void *data
)
1821 int what
= MODE_ADD
;
1823 ConfigChannel
.autochanmodes
= 0;
1824 for (pm
= (char *) data
; *pm
; pm
++)
1836 if (chmode_table
[(unsigned char) *pm
].set_func
== chm_simple
)
1838 if (what
== MODE_ADD
)
1839 ConfigChannel
.autochanmodes
|= chmode_table
[(unsigned char) *pm
].mode_type
;
1841 ConfigChannel
.autochanmodes
&= ~chmode_table
[(unsigned char) *pm
].mode_type
;
1845 conf_report_error("channel::autochanmodes -- Invalid channel mode %c", *pm
);
1854 static void conf_set_blacklist_reason(void *data
);
1856 #define IPTYPE_IPV4 1
1857 #define IPTYPE_IPV6 2
1860 conf_set_blacklist_host(void *data
)
1862 if (yy_blacklist_host
)
1864 conf_report_error("blacklist::host %s overlaps existing host %s",
1865 (char *)data
, yy_blacklist_host
);
1868 conf_set_blacklist_reason(NULL
);
1872 yy_blacklist_iptype
|= IPTYPE_IPV4
;
1873 yy_blacklist_host
= rb_strdup(data
);
1877 conf_set_blacklist_type(void *data
)
1879 conf_parm_t
*args
= data
;
1881 /* Don't assume we have either if we got here */
1882 yy_blacklist_iptype
= 0;
1884 for (; args
; args
= args
->next
)
1886 if (!rb_strcasecmp(args
->v
.string
, "ipv4"))
1887 yy_blacklist_iptype
|= IPTYPE_IPV4
;
1888 else if (!rb_strcasecmp(args
->v
.string
, "ipv6"))
1889 yy_blacklist_iptype
|= IPTYPE_IPV6
;
1891 conf_report_error("blacklist::type has unknown address family %s",
1895 /* If we have neither, just default to IPv4 */
1896 if (!yy_blacklist_iptype
)
1898 conf_report_warning("blacklist::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
1899 yy_blacklist_iptype
= IPTYPE_IPV4
;
1904 conf_set_blacklist_matches(void *data
)
1906 conf_parm_t
*args
= data
;
1907 enum filter_t
{ FILTER_NONE
, FILTER_ALL
, FILTER_LAST
};
1909 for (; args
; args
= args
->next
)
1911 char *str
= args
->v
.string
;
1913 enum filter_t type
= FILTER_LAST
;
1915 if (CF_TYPE(args
->type
) != CF_QSTRING
)
1917 conf_report_error("blacklist::matches -- must be quoted string");
1923 conf_report_error("blacklist::matches -- invalid entry");
1927 if (strlen(str
) > HOSTIPLEN
)
1929 conf_report_error("blacklist::matches has an entry too long: %s",
1934 for (p
= str
; *p
!= '\0'; p
++)
1936 /* Check for validity */
1939 else if (!isdigit((unsigned char)*p
))
1941 conf_report_error("blacklist::matches has invalid IP match entry %s",
1948 if (type
== FILTER_ALL
)
1950 /* Basic IP sanity check */
1951 struct rb_sockaddr_storage tmp
;
1952 if (rb_inet_pton(AF_INET
, str
, &tmp
) <= 0)
1954 conf_report_error("blacklist::matches has invalid IP match entry %s",
1959 else if (type
== FILTER_LAST
)
1961 /* Verify it's the correct length */
1962 if (strlen(str
) > 3)
1964 conf_report_error("blacklist::matches has invalid octet match entry %s",
1971 continue; /* Invalid entry */
1974 rb_dlinkAddAlloc(rb_strdup(str
), &yy_blacklist_filters
);
1979 conf_set_blacklist_reason(void *data
)
1981 rb_dlink_node
*ptr
, *nptr
;
1983 if (yy_blacklist_host
&& data
)
1985 yy_blacklist_reason
= rb_strdup(data
);
1986 if (yy_blacklist_iptype
& IPTYPE_IPV6
)
1988 /* Make sure things fit (magic number 64 = alnum count + dots)
1989 * 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
1991 if ((64 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1993 conf_report_error("blacklist::host %s results in IPv6 queries that are too long",
1998 /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
1999 if ((yy_blacklist_iptype
& IPTYPE_IPV4
) && !(yy_blacklist_iptype
& IPTYPE_IPV6
))
2001 /* Make sure things fit for worst case (magic number 16 = number of nums + dots)
2002 * Example: 127.127.127.127.in-addr.arpa
2004 if ((16 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
2006 conf_report_error("blacklist::host %s results in IPv4 queries that are too long",
2012 add_blacklist(yy_blacklist_host
, yy_blacklist_reason
, yy_blacklist_iptype
, &yy_blacklist_filters
);
2016 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_blacklist_filters
.head
)
2019 rb_dlinkDestroy(ptr
, &yy_blacklist_filters
);
2022 yy_blacklist_filters
= (rb_dlink_list
){ NULL
, NULL
, 0 };
2024 rb_free(yy_blacklist_host
);
2025 rb_free(yy_blacklist_reason
);
2026 yy_blacklist_host
= NULL
;
2027 yy_blacklist_reason
= NULL
;
2028 yy_blacklist_iptype
= 0;
2041 conf_begin_opm(struct TopConf
*tc
)
2043 yy_opm_address_ipv4
= yy_opm_address_ipv6
= NULL
;
2044 yy_opm_port_ipv4
= yy_opm_port_ipv6
= yy_opm_timeout
= 0;
2045 delete_opm_proxy_scanner_all();
2046 delete_opm_listener_all();
2051 conf_end_opm(struct TopConf
*tc
)
2053 rb_dlink_node
*ptr
, *nptr
;
2056 if(rb_dlink_list_length(&yy_opm_scanner_list
) == 0)
2058 conf_report_error("No opm scanners configured -- disabling opm.");
2063 if(yy_opm_port_ipv4
> 0)
2065 if(yy_opm_address_ipv4
!= NULL
)
2066 conf_create_opm_listener(yy_opm_address_ipv4
, yy_opm_port_ipv4
);
2070 if(!rb_inet_ntop_sock((struct sockaddr
*)&ServerInfo
.ip
, ip
, sizeof(ip
)))
2071 conf_report_error("No opm::listen_ipv4 nor serverinfo::vhost directive; cannot listen on IPv4");
2073 conf_create_opm_listener(ip
, yy_opm_port_ipv4
);
2077 if(yy_opm_port_ipv6
> 0)
2079 if(yy_opm_address_ipv6
!= NULL
)
2080 conf_create_opm_listener(yy_opm_address_ipv6
, yy_opm_port_ipv6
);
2084 if(!rb_inet_ntop_sock((struct sockaddr
*)&ServerInfo
.ip6
, ip
, sizeof(ip
)))
2085 conf_report_error("No opm::listen_ipv6 nor serverinfo::vhost directive; cannot listen on IPv6");
2087 conf_create_opm_listener(ip
, yy_opm_port_ipv6
);
2091 /* If there's no listeners... */
2092 fail
= (yy_opm_port_ipv4
== 0 || yy_opm_port_ipv6
== 0);
2093 if(!fail
&& yy_opm_timeout
> 0 && yy_opm_timeout
< 60)
2095 set_authd_timeout("opm_timeout", yy_opm_timeout
);
2097 conf_report_error("No opm listeners -- disabling");
2098 else if(yy_opm_timeout
<= 0 || yy_opm_timeout
>= 60)
2099 conf_report_error("opm::timeout value is invalid -- ignoring");
2102 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_opm_scanner_list
.head
)
2104 struct opm_scanner
*scanner
= ptr
->data
;
2107 create_opm_proxy_scanner(scanner
->type
, scanner
->port
);
2109 rb_dlinkDelete(&scanner
->node
, &yy_opm_scanner_list
);
2114 opm_check_enable(true);
2116 rb_free(yy_opm_address_ipv4
);
2117 rb_free(yy_opm_address_ipv6
);
2122 conf_set_opm_timeout(void *data
)
2124 int timeout
= *((int *)data
);
2126 if(timeout
<= 0 || timeout
> 60)
2128 conf_report_error("opm::timeout value %d is bogus, ignoring", timeout
);
2132 yy_opm_timeout
= timeout
;
2136 conf_set_opm_listen_address_both(void *data
, bool ipv6
)
2138 struct rb_sockaddr_storage addr
;
2139 const char *confstr
= (ipv6
? "opm::listen_ipv6" : "opm::listen_ipv4");
2142 if(!rb_inet_pton_sock(ip
, (struct sockaddr
*)&addr
))
2144 conf_report_error("%s is an invalid address: %s", confstr
, ip
);
2151 if(GET_SS_FAMILY(&addr
) != AF_INET6
)
2153 conf_report_error("%s is of the wrong address type: %s", confstr
, ip
);
2157 if(yy_opm_address_ipv6
!= NULL
)
2159 conf_report_error("%s overwrites previous address %s", confstr
, ip
);
2163 yy_opm_address_ipv6
= rb_strdup(ip
);
2165 conf_report_error("%s requires IPv6 support in your ircd", confstr
, ip
);
2171 if(GET_SS_FAMILY(&addr
) != AF_INET
)
2173 conf_report_error("%s is of the wrong address type: %s", confstr
, ip
);
2177 if(yy_opm_address_ipv4
!= NULL
)
2179 conf_report_error("%s overwrites previous address %s", confstr
, ip
);
2183 yy_opm_address_ipv4
= rb_strdup(ip
);
2188 conf_set_opm_listen_address_ipv4(void *data
)
2190 conf_set_opm_listen_address_both(data
, false);
2194 conf_set_opm_listen_address_ipv6(void *data
)
2196 conf_set_opm_listen_address_both(data
, true);
2200 conf_set_opm_listen_port_both(void *data
, bool ipv6
)
2202 int port
= *((int *)data
);
2203 const char *confstr
= (ipv6
? "opm::port_ipv6" : "opm::port_ipv4");
2208 conf_report_error("%s requires IPv6 support in your ircd", confstr
);
2213 if(port
> 65535 || port
<= 0)
2215 conf_report_error("%s is out of range: %d", confstr
, port
);
2221 if(yy_opm_port_ipv4
)
2223 conf_report_error("%s overwrites existing port %hu",
2224 confstr
, yy_opm_port_ipv4
);
2228 yy_opm_port_ipv4
= port
;
2232 if(yy_opm_port_ipv6
)
2234 conf_report_error("%s overwrites existing port %hu",
2235 confstr
, yy_opm_port_ipv6
);
2239 yy_opm_port_ipv6
= port
;
2244 conf_set_opm_listen_port_ipv4(void *data
)
2246 conf_set_opm_listen_port_both(data
, false);
2250 conf_set_opm_listen_port_ipv6(void *data
)
2252 conf_set_opm_listen_port_both(data
, true);
2256 conf_set_opm_listen_port(void *data
)
2258 conf_set_opm_listen_port_both(data
, true);
2259 conf_set_opm_listen_port_both(data
, false);
2263 conf_set_opm_scan_ports_all(void *data
, const char *node
, const char *type
)
2265 conf_parm_t
*args
= data
;
2266 for (; args
; args
= args
->next
)
2271 if(CF_TYPE(args
->type
) != CF_INT
)
2273 conf_report_error("%s argument is not an integer -- ignoring.", node
);
2277 if(args
->v
.number
> 65535 || args
->v
.number
<= 0)
2279 conf_report_error("%s argument is not an integer between 1 and 65535 -- ignoring.", node
);
2283 /* Check for duplicates */
2284 RB_DLINK_FOREACH(ptr
, yy_opm_scanner_list
.head
)
2286 struct opm_scanner
*scanner
= ptr
->data
;
2288 if(scanner
->port
== args
->v
.number
&& strcmp(type
, scanner
->type
) == 0)
2290 conf_report_error("%s argument is duplicate", node
);
2298 struct opm_scanner
*scanner
= rb_malloc(sizeof(struct opm_scanner
));
2299 scanner
->port
= args
->v
.number
;
2300 scanner
->type
= type
;
2301 rb_dlinkAdd(scanner
, &scanner
->node
, &yy_opm_scanner_list
);
2307 conf_set_opm_scan_ports_socks4(void *data
)
2309 conf_set_opm_scan_ports_all(data
, "opm::socks4_ports", "socks4");
2313 conf_set_opm_scan_ports_socks5(void *data
)
2315 conf_set_opm_scan_ports_all(data
, "opm::socks5_ports", "socks5");
2319 conf_set_opm_scan_ports_httpconnect(void *data
)
2321 conf_set_opm_scan_ports_all(data
, "opm::httpconnect_ports", "httpconnect");
2325 conf_set_opm_scan_ports_httpsconnect(void *data
)
2327 conf_set_opm_scan_ports_all(data
, "opm::httpsconnect_ports", "httpsconnect");
2330 /* public functions */
2334 conf_report_error(const char *fmt
, ...)
2337 char msg
[BUFSIZE
+ 1] = { 0 };
2340 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2345 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2349 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2350 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "error: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2354 conf_report_warning(const char *fmt
, ...)
2357 char msg
[BUFSIZE
+ 1] = { 0 };
2360 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2365 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2369 iwarn("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2370 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "warning: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2374 conf_start_block(char *block
, char *name
)
2376 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
2378 conf_report_error("Configuration block '%s' is not defined.", block
);
2383 conf_cur_block_name
= rb_strdup(name
);
2385 conf_cur_block_name
= NULL
;
2387 if(conf_cur_block
->tc_sfunc
)
2388 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
2395 conf_end_block(struct TopConf
*tc
)
2399 ret
= tc
->tc_efunc(tc
);
2401 rb_free(conf_cur_block_name
);
2402 conf_cur_block_name
= NULL
;
2407 conf_set_generic_int(void *data
, void *location
)
2409 *((int *) location
) = *((unsigned int *) data
);
2413 conf_set_generic_string(void *data
, int len
, void *location
)
2415 char **loc
= location
;
2418 if(len
&& strlen(input
) > (unsigned int)len
)
2422 *loc
= rb_strdup(input
);
2426 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
)
2428 struct ConfEntry
*cf
;
2434 if((cf
= find_conf_item(tc
, item
)) == NULL
)
2437 ("Non-existent configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
2441 /* if it takes one thing, make sure they only passed one thing,
2442 and handle as needed. */
2443 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
2446 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
2453 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
2455 /* if it expects a string value, but we got a yesno,
2458 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
2459 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
2461 value
->v
.list
->type
= CF_STRING
;
2463 if(cp
->v
.number
== 1)
2464 cp
->v
.string
= rb_strdup("yes");
2466 cp
->v
.string
= rb_strdup("no");
2469 /* maybe it's a CF_TIME and they passed CF_INT --
2470 should still be valid */
2471 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
2472 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
2475 ("Wrong type for %s::%s (expected %s, got %s)",
2476 tc
->tc_name
, (char *) item
,
2477 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
2482 if(cf
->cf_type
& CF_FLIST
)
2486 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
2489 /* just pass it the extended argument list */
2490 cf
->cf_func(value
->v
.list
);
2494 /* it's old-style, needs only one arg */
2495 switch (cf
->cf_type
)
2501 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2503 cf
->cf_func(&cp
->v
.number
);
2507 if(EmptyString(cp
->v
.string
))
2508 conf_report_error("Ignoring %s::%s -- empty field",
2511 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2513 cf
->cf_func(cp
->v
.string
);
2523 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2526 struct ConfEntry
*cf
;
2528 if((tc
= find_top_conf(topconf
)) == NULL
)
2531 if(find_conf_item(tc
, name
) != NULL
)
2534 cf
= rb_malloc(sizeof(struct ConfEntry
));
2541 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2547 remove_conf_item(const char *topconf
, const char *name
)
2550 struct ConfEntry
*cf
;
2553 if((tc
= find_top_conf(topconf
)) == NULL
)
2556 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2559 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2562 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2569 static struct ConfEntry conf_serverinfo_table
[] =
2571 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2573 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2574 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2575 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2576 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2577 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2579 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2580 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2581 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2582 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2583 { "ssl_cipher_list", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cipher_list
},
2584 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2586 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2588 { "nicklen", CF_INT
, conf_set_serverinfo_nicklen
, 0, NULL
},
2590 { "\0", 0, NULL
, 0, NULL
}
2593 static struct ConfEntry conf_admin_table
[] =
2595 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2596 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2597 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2598 { "\0", 0, NULL
, 0, NULL
}
2601 static struct ConfEntry conf_log_table
[] =
2603 { "fname_userlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_userlog
},
2604 { "fname_fuserlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_fuserlog
},
2605 { "fname_operlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operlog
},
2606 { "fname_foperlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_foperlog
},
2607 { "fname_serverlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_serverlog
},
2608 { "fname_killlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_killlog
},
2609 { "fname_klinelog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_klinelog
},
2610 { "fname_operspylog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operspylog
},
2611 { "fname_ioerrorlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_ioerrorlog
},
2612 { "\0", 0, NULL
, 0, NULL
}
2615 static struct ConfEntry conf_operator_table
[] =
2617 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2618 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2619 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2620 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2621 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2622 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2623 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2624 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2625 { "\0", 0, NULL
, 0, NULL
}
2628 static struct ConfEntry conf_privset_table
[] =
2630 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2631 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2632 { "\0", 0, NULL
, 0, NULL
}
2635 static struct ConfEntry conf_class_table
[] =
2637 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2638 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2640 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2642 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2643 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2644 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2645 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2646 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2647 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2648 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2649 { "\0", 0, NULL
, 0, NULL
}
2652 static struct ConfEntry conf_auth_table
[] =
2654 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2655 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2656 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2657 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2658 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2659 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2660 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2661 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2662 { "\0", 0, NULL
, 0, NULL
}
2665 static struct ConfEntry conf_connect_table
[] =
2667 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2668 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2669 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2670 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2671 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2672 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2673 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2674 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2675 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
2676 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
2677 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2678 { "\0", 0, NULL
, 0, NULL
}
2681 static struct ConfEntry conf_general_table
[] =
2683 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2684 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2685 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2686 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
2687 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2688 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2689 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
2690 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2691 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2692 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2694 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2695 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2696 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2697 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2698 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2699 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2700 { "sasl_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.sasl_service
},
2702 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2703 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2704 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2705 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2706 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2708 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2709 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2710 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2711 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2712 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2713 { "resv_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.resv_fnc
},
2714 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2715 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2716 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2717 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2718 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2719 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2720 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2721 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2722 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2723 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2724 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2725 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2726 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2727 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2728 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2729 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2730 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2731 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2732 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2733 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2734 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2735 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2736 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2737 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2738 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2739 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2740 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2741 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2742 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2743 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2744 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2745 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2746 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2747 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2748 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2749 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2750 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2751 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2752 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2753 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2754 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2755 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2756 { "client_flood_max_lines", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_max_lines
},
2757 { "client_flood_burst_rate", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_rate
},
2758 { "client_flood_burst_max", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_max
},
2759 { "client_flood_message_num", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_num
},
2760 { "client_flood_message_time", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_time
},
2761 { "max_ratelimit_tokens", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_ratelimit_tokens
},
2762 { "away_interval", CF_INT
, NULL
, 0, &ConfigFileEntry
.away_interval
},
2763 { "hide_opers_in_whois", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_opers_in_whois
},
2764 { "certfp_method", CF_STRING
, conf_set_general_certfp_method
, 0, NULL
},
2765 { "\0", 0, NULL
, 0, NULL
}
2768 static struct ConfEntry conf_channel_table
[] =
2770 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2771 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2772 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2773 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2774 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2775 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2776 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2777 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2778 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2779 { "max_chans_per_user_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user_large
},
2780 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2781 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2782 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2783 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2784 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2785 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2786 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2787 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2788 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2789 { "disable_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.disable_local_channels
},
2790 { "autochanmodes", CF_QSTRING
, conf_set_channel_autochanmodes
, 0, NULL
},
2791 { "displayed_usercount", CF_INT
, NULL
, 0, &ConfigChannel
.displayed_usercount
},
2792 { "strip_topic_colors", CF_YESNO
, NULL
, 0, &ConfigChannel
.strip_topic_colors
},
2793 { "\0", 0, NULL
, 0, NULL
}
2796 static struct ConfEntry conf_serverhide_table
[] =
2798 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2799 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2800 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2801 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2802 { "\0", 0, NULL
, 0, NULL
}
2809 add_top_conf("modules", NULL
, NULL
, NULL
);
2810 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2811 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2813 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2814 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2815 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2816 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2817 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2818 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2820 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2821 add_conf_item("listen", "defer_accept", CF_YESNO
, conf_set_listen_defer_accept
);
2822 add_conf_item("listen", "wsock", CF_YESNO
, conf_set_listen_wsock
);
2823 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2824 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2825 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2826 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2828 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2830 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
2831 add_conf_item("shared", "oper", CF_QSTRING
| CF_FLIST
, conf_set_shared_oper
);
2832 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
2834 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2836 add_top_conf("exempt", NULL
, NULL
, NULL
);
2837 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2839 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2840 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2841 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2843 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2844 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2845 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2847 add_top_conf("service", NULL
, NULL
, NULL
);
2848 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2850 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2851 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2852 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2854 add_top_conf("blacklist", NULL
, NULL
, NULL
);
2855 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_blacklist_host
);
2856 add_conf_item("blacklist", "type", CF_STRING
| CF_FLIST
, conf_set_blacklist_type
);
2857 add_conf_item("blacklist", "matches", CF_QSTRING
| CF_FLIST
, conf_set_blacklist_matches
);
2858 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_blacklist_reason
);
2860 add_top_conf("opm", conf_begin_opm
, conf_end_opm
, NULL
);
2861 add_conf_item("opm", "timeout", CF_INT
, conf_set_opm_timeout
);
2862 add_conf_item("opm", "listen_ipv4", CF_QSTRING
, conf_set_opm_listen_address_ipv4
);
2863 add_conf_item("opm", "listen_ipv6", CF_QSTRING
, conf_set_opm_listen_address_ipv6
);
2864 add_conf_item("opm", "port_v4", CF_INT
, conf_set_opm_listen_port_ipv4
);
2865 add_conf_item("opm", "port_v6", CF_INT
, conf_set_opm_listen_port_ipv6
);
2866 add_conf_item("opm", "listen_port", CF_INT
, conf_set_opm_listen_port
);
2867 add_conf_item("opm", "socks4_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_socks4
);
2868 add_conf_item("opm", "socks5_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_socks5
);
2869 add_conf_item("opm", "httpconnect_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_httpconnect
);
2870 add_conf_item("opm", "httpsconnect_ports", CF_INT
| CF_FLIST
, conf_set_opm_scan_ports_httpsconnect
);