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"
28 #include "privilege.h"
31 #define CF_TYPE(x) ((x) & CF_MTYPE)
33 static int yy_defer_accept
= 1;
35 struct TopConf
*conf_cur_block
;
36 static char *conf_cur_block_name
= NULL
;
38 static rb_dlink_list conf_items
;
40 static struct ConfItem
*yy_aconf
= NULL
;
42 static struct Class
*yy_class
= NULL
;
44 static struct remote_conf
*yy_shared
= NULL
;
45 static struct server_conf
*yy_server
= NULL
;
47 static rb_dlink_list yy_aconf_list
;
48 static rb_dlink_list yy_oper_list
;
49 static rb_dlink_list yy_shared_list
;
50 static rb_dlink_list yy_cluster_list
;
51 static struct oper_conf
*yy_oper
= NULL
;
53 static struct alias_entry
*yy_alias
= NULL
;
55 static char *yy_blacklist_host
= NULL
;
56 static char *yy_blacklist_reason
= NULL
;
57 static uint8_t yy_blacklist_iptype
= 0;
58 static rb_dlink_list yy_blacklist_filters
= { NULL
, NULL
, 0 };
60 static char *yy_privset_extends
= NULL
;
63 conf_strtype(int type
)
65 switch (CF_TYPE(type
))
68 return "integer value";
70 return "unquoted string";
72 return "yes/no value";
74 return "quoted string";
76 return "time/size value";
78 return "unknown type";
83 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
84 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
88 tc
= rb_malloc(sizeof(struct TopConf
));
93 tc
->tc_entries
= items
;
95 rb_dlinkAddAlloc(tc
, &conf_items
);
100 find_top_conf(const char *name
)
105 RB_DLINK_FOREACH(d
, conf_items
.head
)
108 if(strcasecmp(tc
->tc_name
, name
) == 0)
117 find_conf_item(const struct TopConf
*top
, const char *name
)
119 struct ConfEntry
*cf
;
126 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
128 cf
= &top
->tc_entries
[i
];
130 if(!strcasecmp(cf
->cf_name
, name
))
135 RB_DLINK_FOREACH(d
, top
->tc_items
.head
)
138 if(strcasecmp(cf
->cf_name
, name
) == 0)
146 remove_top_conf(char *name
)
151 if((tc
= find_top_conf(name
)) == NULL
)
154 if((ptr
= rb_dlinkFind(tc
, &conf_items
)) == NULL
)
157 rb_dlinkDestroy(ptr
, &conf_items
);
164 conf_set_serverinfo_name(void *data
)
166 if(ServerInfo
.name
== NULL
)
171 for(s
= data
; *s
!= '\0'; s
++)
175 conf_report_error("Ignoring serverinfo::name "
176 "-- bogus servername.");
185 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
193 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
197 /* the ircd will exit() in main() if we dont set one */
198 if(strlen(s
) <= HOSTLEN
)
199 ServerInfo
.name
= rb_strdup((char *) data
);
204 conf_set_serverinfo_sid(void *data
)
208 if(ServerInfo
.sid
[0] == '\0')
210 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
211 !IsIdChar(sid
[2]) || sid
[3] != '\0')
213 conf_report_error("Ignoring serverinfo::sid "
218 strcpy(ServerInfo
.sid
, sid
);
223 conf_set_serverinfo_network_name(void *data
)
227 if((p
= strchr((char *) data
, ' ')))
230 rb_free(ServerInfo
.network_name
);
231 ServerInfo
.network_name
= rb_strdup((char *) data
);
235 conf_set_serverinfo_vhost(void *data
)
237 if(rb_inet_pton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
239 conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data
);
242 ServerInfo
.ip
.sin_family
= AF_INET
;
243 ServerInfo
.specific_ipv4_vhost
= 1;
247 conf_set_serverinfo_vhost6(void *data
)
250 if(rb_inet_pton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
252 conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data
);
256 ServerInfo
.specific_ipv6_vhost
= 1;
257 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
259 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
264 conf_set_serverinfo_nicklen(void *data
)
266 ConfigFileEntry
.nicklen
= (*(unsigned int *) data
) + 1;
268 if (ConfigFileEntry
.nicklen
> NICKLEN
)
270 conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)",
271 ConfigFileEntry
.nicklen
- 1, NICKLEN
- 1);
272 ConfigFileEntry
.nicklen
= NICKLEN
;
274 else if (ConfigFileEntry
.nicklen
< 9 + 1)
276 conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9",
277 ConfigFileEntry
.nicklen
- 1);
278 ConfigFileEntry
.nicklen
= 9 + 1;
283 conf_set_modules_module(void *data
)
287 m_bn
= rb_basename((char *) data
);
289 if(findmodule_byname(m_bn
) == -1)
290 load_one_module((char *) data
, MAPI_ORIGIN_EXTENSION
, 0);
296 conf_set_modules_path(void *data
)
298 mod_add_path((char *) data
);
308 static struct mode_table umode_table
[] = {
309 {"callerid", UMODE_CALLERID
},
310 {"deaf", UMODE_DEAF
},
311 {"invisible", UMODE_INVISIBLE
},
312 {"locops", UMODE_LOCOPS
},
313 {"noforward", UMODE_NOFORWARD
},
314 {"regonlymsg", UMODE_REGONLYMSG
},
315 {"servnotice", UMODE_SERVNOTICE
},
316 {"wallop", UMODE_WALLOP
},
317 {"operwall", UMODE_OPERWALL
},
321 static struct mode_table oper_table
[] = {
322 {"encrypted", OPER_ENCRYPTED
},
323 {"need_ssl", OPER_NEEDSSL
},
327 static struct mode_table auth_table
[] = {
328 {"encrypted", CONF_FLAGS_ENCRYPTED
},
329 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
330 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
331 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
332 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
333 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
334 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
335 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
336 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
337 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
338 {"no_tilde", CONF_FLAGS_NO_TILDE
},
339 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
340 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
341 {"need_ssl", CONF_FLAGS_NEED_SSL
},
342 {"need_sasl", CONF_FLAGS_NEED_SASL
},
343 {"extend_chans", CONF_FLAGS_EXTEND_CHANS
},
347 static struct mode_table connect_table
[] = {
348 { "autoconn", SERVER_AUTOCONN
},
349 { "compressed", SERVER_COMPRESSED
},
350 { "encrypted", SERVER_ENCRYPTED
},
351 { "topicburst", SERVER_TB
},
352 { "ssl", SERVER_SSL
},
356 static struct mode_table cluster_table
[] = {
357 { "kline", SHARED_PKLINE
},
358 { "tkline", SHARED_TKLINE
},
359 { "unkline", SHARED_UNKLINE
},
360 { "locops", SHARED_LOCOPS
},
361 { "xline", SHARED_PXLINE
},
362 { "txline", SHARED_TXLINE
},
363 { "unxline", SHARED_UNXLINE
},
364 { "resv", SHARED_PRESV
},
365 { "tresv", SHARED_TRESV
},
366 { "unresv", SHARED_UNRESV
},
367 { "all", CLUSTER_ALL
},
371 static struct mode_table shared_table
[] =
373 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
374 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
375 { "resv", SHARED_PRESV
|SHARED_TRESV
},
376 { "dline", SHARED_PDLINE
|SHARED_TDLINE
},
377 { "tdline", SHARED_TDLINE
},
378 { "pdline", SHARED_PDLINE
},
379 { "undline", SHARED_UNDLINE
},
380 { "tkline", SHARED_TKLINE
},
381 { "unkline", SHARED_UNKLINE
},
382 { "txline", SHARED_TXLINE
},
383 { "unxline", SHARED_UNXLINE
},
384 { "tresv", SHARED_TRESV
},
385 { "unresv", SHARED_UNRESV
},
386 { "locops", SHARED_LOCOPS
},
387 { "rehash", SHARED_REHASH
},
388 { "grant", SHARED_GRANT
},
389 { "die", SHARED_DIE
},
390 { "module", SHARED_MODULE
},
391 { "all", SHARED_ALL
},
398 find_umode(struct mode_table
*tab
, const char *name
)
402 for (i
= 0; tab
[i
].name
; i
++)
404 if(strcmp(tab
[i
].name
, name
) == 0)
412 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
414 for (; args
; args
= args
->next
)
420 if(CF_TYPE(args
->type
) != CF_STRING
)
422 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
426 umode
= args
->v
.string
;
434 mode
= find_umode(tab
, umode
);
438 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
455 conf_set_privset_extends(void *data
)
457 yy_privset_extends
= rb_strdup((char *) data
);
461 conf_set_privset_privs(void *data
)
464 conf_parm_t
*args
= data
;
466 for (; args
; args
= args
->next
)
469 privs
= rb_strdup(args
->v
.string
);
472 char *privs_old
= privs
;
474 privs
= rb_malloc(strlen(privs_old
) + 1 + strlen(args
->v
.string
) + 1);
475 strcpy(privs
, privs_old
);
477 strcat(privs
, args
->v
.string
);
485 if (yy_privset_extends
)
487 struct PrivilegeSet
*set
= privilegeset_get(yy_privset_extends
);
491 conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends
, conf_cur_block_name
);
493 set
= privilegeset_get("default");
496 privilegeset_extend(set
, conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
498 rb_free(yy_privset_extends
);
499 yy_privset_extends
= NULL
;
502 privilegeset_set_new(conf_cur_block_name
!= NULL
? conf_cur_block_name
: "<unknown>", privs
, 0);
509 conf_begin_oper(struct TopConf
*tc
)
512 rb_dlink_node
*next_ptr
;
516 free_oper_conf(yy_oper
);
520 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
522 free_oper_conf(ptr
->data
);
523 rb_dlinkDestroy(ptr
, &yy_oper_list
);
526 yy_oper
= make_oper_conf();
527 yy_oper
->flags
|= OPER_ENCRYPTED
;
533 conf_end_oper(struct TopConf
*tc
)
535 struct oper_conf
*yy_tmpoper
;
537 rb_dlink_node
*next_ptr
;
539 if(conf_cur_block_name
!= NULL
)
541 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
542 conf_cur_block_name
[OPERNICKLEN
] = '\0';
544 yy_oper
->name
= rb_strdup(conf_cur_block_name
);
547 if(EmptyString(yy_oper
->name
))
549 conf_report_error("Ignoring operator block -- missing name.");
553 #ifdef HAVE_LIBCRYPTO
554 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
556 if(EmptyString(yy_oper
->passwd
))
559 conf_report_error("Ignoring operator block for %s -- missing password",
565 if (!yy_oper
->privset
)
566 yy_oper
->privset
= privilegeset_get("default");
568 /* now, yy_oper_list contains a stack of oper_conf's with just user
569 * and host in, yy_oper contains the rest of the information which
570 * we need to copy into each element in yy_oper_list
572 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
574 yy_tmpoper
= ptr
->data
;
576 yy_tmpoper
->name
= rb_strdup(yy_oper
->name
);
578 /* could be an rsa key instead.. */
579 if(!EmptyString(yy_oper
->passwd
))
580 yy_tmpoper
->passwd
= rb_strdup(yy_oper
->passwd
);
582 yy_tmpoper
->flags
= yy_oper
->flags
;
583 yy_tmpoper
->umodes
= yy_oper
->umodes
;
584 yy_tmpoper
->snomask
= yy_oper
->snomask
;
585 yy_tmpoper
->privset
= yy_oper
->privset
;
587 #ifdef HAVE_LIBCRYPTO
588 if(yy_oper
->rsa_pubkey_file
)
592 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
594 conf_report_error("Ignoring operator block for %s -- "
595 "rsa_public_key_file cant be opened",
600 yy_tmpoper
->rsa_pubkey
=
601 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
603 (void)BIO_set_close(file
, BIO_CLOSE
);
606 if(yy_tmpoper
->rsa_pubkey
== NULL
)
608 conf_report_error("Ignoring operator block for %s -- "
609 "rsa_public_key_file key invalid; check syntax",
615 if(!EmptyString(yy_oper
->certfp
))
616 yy_tmpoper
->certfp
= rb_strdup(yy_oper
->certfp
);
619 /* all is ok, put it on oper_conf_list */
620 rb_dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
623 free_oper_conf(yy_oper
);
630 conf_set_oper_flags(void *data
)
632 conf_parm_t
*args
= data
;
634 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
638 conf_set_oper_fingerprint(void *data
)
641 rb_free(yy_oper
->certfp
);
642 yy_oper
->certfp
= rb_strdup((char *) data
);
646 conf_set_oper_privset(void *data
)
648 yy_oper
->privset
= privilegeset_get((char *) data
);
652 conf_set_oper_user(void *data
)
654 struct oper_conf
*yy_tmpoper
;
656 char *host
= (char *) data
;
658 yy_tmpoper
= make_oper_conf();
660 if((p
= strchr(host
, '@')))
664 yy_tmpoper
->username
= rb_strdup(host
);
665 yy_tmpoper
->host
= rb_strdup(p
);
670 yy_tmpoper
->username
= rb_strdup("*");
671 yy_tmpoper
->host
= rb_strdup(host
);
674 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
676 conf_report_error("Ignoring user -- missing username/host");
677 free_oper_conf(yy_tmpoper
);
681 rb_dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
685 conf_set_oper_password(void *data
)
689 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
690 rb_free(yy_oper
->passwd
);
693 yy_oper
->passwd
= rb_strdup((char *) data
);
697 conf_set_oper_rsa_public_key_file(void *data
)
699 #ifdef HAVE_LIBCRYPTO
700 rb_free(yy_oper
->rsa_pubkey_file
);
701 yy_oper
->rsa_pubkey_file
= rb_strdup((char *) data
);
703 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
708 conf_set_oper_umodes(void *data
)
710 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
714 conf_set_oper_snomask(void *data
)
716 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
720 conf_begin_class(struct TopConf
*tc
)
723 free_class(yy_class
);
725 yy_class
= make_class();
730 conf_end_class(struct TopConf
*tc
)
732 if(conf_cur_block_name
!= NULL
)
733 yy_class
->class_name
= rb_strdup(conf_cur_block_name
);
735 if(EmptyString(yy_class
->class_name
))
737 conf_report_error("Ignoring connect block -- missing name.");
747 conf_set_class_ping_time(void *data
)
749 yy_class
->ping_freq
= *(unsigned int *) data
;
753 conf_set_class_cidr_ipv4_bitlen(void *data
)
755 unsigned int maxsize
= 32;
756 if(*(unsigned int *) data
> maxsize
)
758 ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
759 *(unsigned int *) data
, maxsize
);
761 yy_class
->cidr_ipv4_bitlen
= *(unsigned int *) data
;
767 conf_set_class_cidr_ipv6_bitlen(void *data
)
769 unsigned int maxsize
= 128;
770 if(*(unsigned int *) data
> maxsize
)
772 ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
773 *(unsigned int *) data
, maxsize
);
775 yy_class
->cidr_ipv6_bitlen
= *(unsigned int *) data
;
781 conf_set_class_number_per_cidr(void *data
)
783 yy_class
->cidr_amount
= *(unsigned int *) data
;
787 conf_set_class_number_per_ip(void *data
)
789 yy_class
->max_local
= *(unsigned int *) data
;
794 conf_set_class_number_per_ip_global(void *data
)
796 yy_class
->max_global
= *(unsigned int *) data
;
800 conf_set_class_number_per_ident(void *data
)
802 yy_class
->max_ident
= *(unsigned int *) data
;
806 conf_set_class_connectfreq(void *data
)
808 yy_class
->con_freq
= *(unsigned int *) data
;
812 conf_set_class_max_number(void *data
)
814 yy_class
->max_total
= *(unsigned int *) data
;
818 conf_set_class_sendq(void *data
)
820 yy_class
->max_sendq
= *(unsigned int *) data
;
823 static char *listener_address
;
826 conf_begin_listen(struct TopConf
*tc
)
828 rb_free(listener_address
);
829 listener_address
= NULL
;
834 conf_end_listen(struct TopConf
*tc
)
836 rb_free(listener_address
);
837 listener_address
= NULL
;
842 conf_set_listen_defer_accept(void *data
)
844 yy_defer_accept
= *(unsigned int *) data
;
848 conf_set_listen_port_both(void *data
, int ssl
)
850 conf_parm_t
*args
= data
;
851 for (; args
; args
= args
->next
)
853 if(CF_TYPE(args
->type
) != CF_INT
)
856 ("listener::port argument is not an integer " "-- ignoring.");
859 if(listener_address
== NULL
)
863 conf_report_warning("listener 'ANY/%d': support for plaintext listeners may be removed in a future release per RFC 7194. "
864 "It is suggested that users be migrated to SSL/TLS connections.", args
->v
.number
);
866 add_listener(args
->v
.number
, listener_address
, AF_INET
, ssl
, ssl
|| yy_defer_accept
);
868 add_listener(args
->v
.number
, listener_address
, AF_INET6
, ssl
, ssl
|| yy_defer_accept
);
875 if(strchr(listener_address
, ':') != NULL
)
883 conf_report_warning("listener '%s/%d': support for plaintext listeners may be removed in a future release per RFC 7194. "
884 "It is suggested that users be migrated to SSL/TLS connections.", listener_address
, args
->v
.number
);
887 add_listener(args
->v
.number
, listener_address
, family
, ssl
, ssl
|| yy_defer_accept
);
894 conf_set_listen_port(void *data
)
896 conf_set_listen_port_both(data
, 0);
900 conf_set_listen_sslport(void *data
)
902 conf_set_listen_port_both(data
, 1);
906 conf_set_listen_address(void *data
)
908 rb_free(listener_address
);
909 listener_address
= rb_strdup(data
);
913 conf_begin_auth(struct TopConf
*tc
)
916 rb_dlink_node
*next_ptr
;
921 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
923 free_conf(ptr
->data
);
924 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
927 yy_aconf
= make_conf();
928 yy_aconf
->status
= CONF_CLIENT
;
934 conf_end_auth(struct TopConf
*tc
)
936 struct ConfItem
*yy_tmp
, *found_conf
;
938 rb_dlink_node
*next_ptr
;
940 if(EmptyString(yy_aconf
->info
.name
))
941 yy_aconf
->info
.name
= rb_strdup("NOMATCH");
943 /* didnt even get one ->host? */
944 if(EmptyString(yy_aconf
->host
))
946 conf_report_error("Ignoring auth block -- missing user@host");
950 /* so the stacking works in order.. */
951 collapse(yy_aconf
->user
);
952 collapse(yy_aconf
->host
);
953 conf_add_class_to_conf(yy_aconf
);
954 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
955 conf_report_error("Ignoring redundant auth block (after *@*)");
956 else if ((found_conf
= find_exact_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
)) &&
957 (!found_conf
->spasswd
|| (yy_aconf
->spasswd
&&
958 0 == irccmp(found_conf
->spasswd
, yy_aconf
->spasswd
))))
959 conf_report_error("Ignoring duplicate auth block for %s@%s",
960 yy_aconf
->user
, yy_aconf
->host
);
962 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
->spasswd
, yy_aconf
);
964 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
969 yy_tmp
->passwd
= rb_strdup(yy_aconf
->passwd
);
971 if(yy_aconf
->spasswd
)
972 yy_tmp
->spasswd
= rb_strdup(yy_aconf
->spasswd
);
974 /* this will always exist.. */
975 yy_tmp
->info
.name
= rb_strdup(yy_aconf
->info
.name
);
977 if(yy_aconf
->className
)
978 yy_tmp
->className
= rb_strdup(yy_aconf
->className
);
980 yy_tmp
->flags
= yy_aconf
->flags
;
981 yy_tmp
->port
= yy_aconf
->port
;
983 collapse(yy_tmp
->user
);
984 collapse(yy_tmp
->host
);
986 conf_add_class_to_conf(yy_tmp
);
988 if ((found_conf
= find_exact_conf_by_address("*", CONF_CLIENT
, "*")) && found_conf
->spasswd
== NULL
)
989 conf_report_error("Ignoring redundant auth block (after *@*)");
990 else if ((found_conf
= find_exact_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
)) &&
991 (!found_conf
->spasswd
|| (yy_tmp
->spasswd
&&
992 0 == irccmp(found_conf
->spasswd
, yy_tmp
->spasswd
))))
993 conf_report_error("Ignoring duplicate auth block for %s@%s",
994 yy_tmp
->user
, yy_tmp
->host
);
996 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
->spasswd
, yy_tmp
);
997 rb_dlinkDestroy(ptr
, &yy_aconf_list
);
1005 conf_set_auth_user(void *data
)
1007 struct ConfItem
*yy_tmp
;
1010 /* The first user= line doesn't allocate a new conf */
1011 if(!EmptyString(yy_aconf
->host
))
1013 yy_tmp
= make_conf();
1014 yy_tmp
->status
= CONF_CLIENT
;
1019 if((p
= strchr(data
, '@')))
1023 yy_tmp
->user
= rb_strdup(data
);
1024 yy_tmp
->host
= rb_strdup(p
);
1028 yy_tmp
->user
= rb_strdup("*");
1029 yy_tmp
->host
= rb_strdup(data
);
1032 if(yy_aconf
!= yy_tmp
)
1033 rb_dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
1037 conf_set_auth_auth_user(void *data
)
1039 if(yy_aconf
->spasswd
)
1040 memset(yy_aconf
->spasswd
, 0, strlen(yy_aconf
->spasswd
));
1041 rb_free(yy_aconf
->spasswd
);
1042 yy_aconf
->spasswd
= rb_strdup(data
);
1046 conf_set_auth_passwd(void *data
)
1048 if(yy_aconf
->passwd
)
1049 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
1050 rb_free(yy_aconf
->passwd
);
1051 yy_aconf
->passwd
= rb_strdup(data
);
1055 conf_set_auth_spoof(void *data
)
1063 /* user@host spoof */
1064 if((p
= strchr(host
, '@')) != NULL
)
1070 if(EmptyString(user
))
1072 conf_report_error("Warning -- spoof ident empty.");
1076 if(strlen(user
) > USERLEN
)
1078 conf_report_error("Warning -- spoof ident length invalid.");
1082 if(!valid_username(user
))
1084 conf_report_error("Warning -- invalid spoof (ident).");
1088 /* this must be restored! */
1092 if(EmptyString(host
))
1094 conf_report_error("Warning -- spoof host empty.");
1098 if(strlen(host
) > HOSTLEN
)
1100 conf_report_error("Warning -- spoof host length invalid.");
1104 if(!valid_hostname(host
))
1106 conf_report_error("Warning -- invalid spoof (host).");
1110 rb_free(yy_aconf
->info
.name
);
1111 yy_aconf
->info
.name
= rb_strdup(data
);
1112 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
1116 conf_set_auth_flags(void *data
)
1118 conf_parm_t
*args
= data
;
1120 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
1124 conf_set_auth_redir_serv(void *data
)
1126 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1127 rb_free(yy_aconf
->info
.name
);
1128 yy_aconf
->info
.name
= rb_strdup(data
);
1132 conf_set_auth_redir_port(void *data
)
1134 int port
= *(unsigned int *) data
;
1136 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
1137 yy_aconf
->port
= port
;
1141 conf_set_auth_class(void *data
)
1143 rb_free(yy_aconf
->className
);
1144 yy_aconf
->className
= rb_strdup(data
);
1147 /* ok, shared_oper handles the stacking, shared_flags handles adding
1148 * things.. so all we need to do when we start and end a shared block, is
1149 * clean up anything thats been left over.
1152 conf_cleanup_shared(struct TopConf
*tc
)
1154 rb_dlink_node
*ptr
, *next_ptr
;
1156 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1158 free_remote_conf(ptr
->data
);
1159 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1162 if(yy_shared
!= NULL
)
1164 free_remote_conf(yy_shared
);
1172 conf_set_shared_oper(void *data
)
1174 conf_parm_t
*args
= data
;
1175 const char *username
;
1178 if(yy_shared
!= NULL
)
1179 free_remote_conf(yy_shared
);
1181 yy_shared
= make_remote_conf();
1183 if(args
->next
!= NULL
)
1185 if(CF_TYPE(args
->type
) != CF_QSTRING
)
1187 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1191 yy_shared
->server
= rb_strdup(args
->v
.string
);
1195 yy_shared
->server
= rb_strdup("*");
1197 if(CF_TYPE(args
->type
) != CF_QSTRING
)
1199 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1203 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1205 conf_report_error("Ignoring shard::oper -- oper is not a user@host");
1209 username
= args
->v
.string
;
1213 yy_shared
->host
= rb_strdup("*");
1215 yy_shared
->host
= rb_strdup(p
);
1217 if(EmptyString(username
))
1218 yy_shared
->username
= rb_strdup("*");
1220 yy_shared
->username
= rb_strdup(username
);
1222 rb_dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1227 conf_set_shared_flags(void *data
)
1229 conf_parm_t
*args
= data
;
1231 rb_dlink_node
*ptr
, *next_ptr
;
1233 if(yy_shared
!= NULL
)
1234 free_remote_conf(yy_shared
);
1236 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1238 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1240 yy_shared
= ptr
->data
;
1242 yy_shared
->flags
= flags
;
1243 rb_dlinkDestroy(ptr
, &yy_shared_list
);
1244 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1251 conf_begin_connect(struct TopConf
*tc
)
1254 free_server_conf(yy_server
);
1256 yy_server
= make_server_conf();
1257 yy_server
->port
= PORTNUM
;
1258 yy_server
->flags
|= SERVER_TB
;
1260 if(conf_cur_block_name
!= NULL
)
1261 yy_server
->name
= rb_strdup(conf_cur_block_name
);
1267 conf_end_connect(struct TopConf
*tc
)
1269 if(EmptyString(yy_server
->name
))
1271 conf_report_error("Ignoring connect block -- missing name.");
1275 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1277 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1282 if((EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
)) && EmptyString(yy_server
->certfp
))
1284 conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
1289 if(EmptyString(yy_server
->host
))
1291 conf_report_error("Ignoring connect block for %s -- missing host.",
1297 if(ServerConfCompressed(yy_server
))
1299 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1300 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1304 add_server_conf(yy_server
);
1305 rb_dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1312 conf_set_connect_host(void *data
)
1314 rb_free(yy_server
->host
);
1315 yy_server
->host
= rb_strdup(data
);
1316 if (strchr(yy_server
->host
, ':'))
1317 yy_server
->aftype
= AF_INET6
;
1321 conf_set_connect_vhost(void *data
)
1323 if(rb_inet_pton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1325 conf_report_error("Invalid IP address for server connect vhost (%s)",
1330 yy_server
->flags
|= SERVER_VHOSTED
;
1334 conf_set_connect_send_password(void *data
)
1336 if(yy_server
->spasswd
)
1338 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1339 rb_free(yy_server
->spasswd
);
1342 yy_server
->spasswd
= rb_strdup(data
);
1346 conf_set_connect_accept_password(void *data
)
1348 if(yy_server
->passwd
)
1350 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1351 rb_free(yy_server
->passwd
);
1353 yy_server
->passwd
= rb_strdup(data
);
1357 conf_set_connect_fingerprint(void *data
)
1359 if (yy_server
->certfp
)
1360 rb_free(yy_server
->certfp
);
1361 yy_server
->certfp
= rb_strdup((char *) data
);
1363 /* force SSL to be enabled if fingerprint is enabled. */
1364 yy_server
->flags
|= SERVER_SSL
;
1368 conf_set_connect_port(void *data
)
1370 int port
= *(unsigned int *) data
;
1375 yy_server
->port
= port
;
1379 conf_set_connect_aftype(void *data
)
1383 if(strcasecmp(aft
, "ipv4") == 0)
1384 yy_server
->aftype
= AF_INET
;
1386 else if(strcasecmp(aft
, "ipv6") == 0)
1387 yy_server
->aftype
= AF_INET6
;
1390 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1394 conf_set_connect_flags(void *data
)
1396 conf_parm_t
*args
= data
;
1398 /* note, we allow them to set compressed, then remove it later if
1399 * they do and LIBZ isnt available
1401 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1405 conf_set_connect_hub_mask(void *data
)
1407 struct remote_conf
*yy_hub
;
1409 if(EmptyString(yy_server
->name
))
1412 yy_hub
= make_remote_conf();
1413 yy_hub
->flags
= CONF_HUB
;
1415 yy_hub
->host
= rb_strdup(data
);
1416 yy_hub
->server
= rb_strdup(yy_server
->name
);
1417 rb_dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1421 conf_set_connect_leaf_mask(void *data
)
1423 struct remote_conf
*yy_leaf
;
1425 if(EmptyString(yy_server
->name
))
1428 yy_leaf
= make_remote_conf();
1429 yy_leaf
->flags
= CONF_LEAF
;
1431 yy_leaf
->host
= rb_strdup(data
);
1432 yy_leaf
->server
= rb_strdup(yy_server
->name
);
1433 rb_dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1437 conf_set_connect_class(void *data
)
1439 rb_free(yy_server
->class_name
);
1440 yy_server
->class_name
= rb_strdup(data
);
1444 conf_set_exempt_ip(void *data
)
1446 struct ConfItem
*yy_tmp
;
1448 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1450 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1454 yy_tmp
= make_conf();
1455 yy_tmp
->passwd
= rb_strdup("*");
1456 yy_tmp
->host
= rb_strdup(data
);
1457 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1458 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, NULL
, yy_tmp
);
1462 conf_cleanup_cluster(struct TopConf
*tc
)
1464 rb_dlink_node
*ptr
, *next_ptr
;
1466 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1468 free_remote_conf(ptr
->data
);
1469 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1472 if(yy_shared
!= NULL
)
1474 free_remote_conf(yy_shared
);
1482 conf_set_cluster_name(void *data
)
1484 if(yy_shared
!= NULL
)
1485 free_remote_conf(yy_shared
);
1487 yy_shared
= make_remote_conf();
1488 yy_shared
->server
= rb_strdup(data
);
1489 rb_dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1495 conf_set_cluster_flags(void *data
)
1497 conf_parm_t
*args
= data
;
1499 rb_dlink_node
*ptr
, *next_ptr
;
1501 if(yy_shared
!= NULL
)
1502 free_remote_conf(yy_shared
);
1504 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1506 RB_DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1508 yy_shared
= ptr
->data
;
1509 yy_shared
->flags
= flags
;
1510 rb_dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1511 rb_dlinkDestroy(ptr
, &yy_cluster_list
);
1518 conf_set_general_havent_read_conf(void *data
)
1520 if(*(unsigned int *) data
)
1522 conf_report_error("You haven't read your config file properly.");
1524 ("There is a line in the example conf that will kill your server if not removed.");
1526 ("Consider actually reading/editing the conf file, and removing this line.");
1533 conf_set_general_hide_error_messages(void *data
)
1537 if(strcasecmp(val
, "yes") == 0)
1538 ConfigFileEntry
.hide_error_messages
= 2;
1539 else if(strcasecmp(val
, "opers") == 0)
1540 ConfigFileEntry
.hide_error_messages
= 1;
1541 else if(strcasecmp(val
, "no") == 0)
1542 ConfigFileEntry
.hide_error_messages
= 0;
1544 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1548 conf_set_general_kline_delay(void *data
)
1550 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1552 /* THIS MUST BE HERE to stop us being unable to check klines */
1553 kline_queued
= false;
1557 conf_set_general_stats_k_oper_only(void *data
)
1561 if(strcasecmp(val
, "yes") == 0)
1562 ConfigFileEntry
.stats_k_oper_only
= 2;
1563 else if(strcasecmp(val
, "masked") == 0)
1564 ConfigFileEntry
.stats_k_oper_only
= 1;
1565 else if(strcasecmp(val
, "no") == 0)
1566 ConfigFileEntry
.stats_k_oper_only
= 0;
1568 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1572 conf_set_general_stats_i_oper_only(void *data
)
1576 if(strcasecmp(val
, "yes") == 0)
1577 ConfigFileEntry
.stats_i_oper_only
= 2;
1578 else if(strcasecmp(val
, "masked") == 0)
1579 ConfigFileEntry
.stats_i_oper_only
= 1;
1580 else if(strcasecmp(val
, "no") == 0)
1581 ConfigFileEntry
.stats_i_oper_only
= 0;
1583 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1587 conf_set_general_compression_level(void *data
)
1590 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1592 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1595 ("Invalid general::compression_level %d -- using default.",
1596 ConfigFileEntry
.compression_level
);
1597 ConfigFileEntry
.compression_level
= 0;
1600 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1605 conf_set_general_default_umodes(void *data
)
1608 int what
= MODE_ADD
, flag
;
1610 ConfigFileEntry
.default_umodes
= 0;
1611 for (pm
= (char *) data
; *pm
; pm
++)
1622 /* don't allow +o */
1630 if ((flag
= user_modes
[(unsigned char) *pm
]))
1632 /* Proper value has probably not yet been set
1633 * so don't check oper_only_umodes -- jilles */
1634 if (what
== MODE_ADD
)
1635 ConfigFileEntry
.default_umodes
|= flag
;
1637 ConfigFileEntry
.default_umodes
&= ~flag
;
1645 conf_set_general_oper_umodes(void *data
)
1647 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1651 conf_set_general_certfp_method(void *data
)
1653 char *method
= data
;
1655 if (!strcasecmp(method
, "sha1"))
1656 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA1
;
1657 else if (!strcasecmp(method
, "sha256"))
1658 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA256
;
1659 else if (!strcasecmp(method
, "sha512"))
1660 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA512
;
1663 ConfigFileEntry
.certfp_method
= RB_SSL_CERTFP_METH_SHA1
;
1664 conf_report_error("Ignoring general::certfp_method -- bogus certfp method %s", method
);
1669 conf_set_general_oper_only_umodes(void *data
)
1671 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1675 conf_set_general_oper_snomask(void *data
)
1678 int what
= MODE_ADD
, flag
;
1680 ConfigFileEntry
.oper_snomask
= 0;
1681 for (pm
= (char *) data
; *pm
; pm
++)
1693 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1695 if (what
== MODE_ADD
)
1696 ConfigFileEntry
.oper_snomask
|= flag
;
1698 ConfigFileEntry
.oper_snomask
&= ~flag
;
1706 conf_set_serverhide_links_delay(void *data
)
1708 int val
= *(unsigned int *) data
;
1710 ConfigServerHide
.links_delay
= val
;
1714 conf_set_service_name(void *data
)
1720 for(s
= data
; *s
!= '\0'; s
++)
1724 conf_report_error("Ignoring service::name "
1725 "-- bogus servername.");
1734 conf_report_error("Ignoring service::name -- must contain '.'");
1738 tmp
= rb_strdup(data
);
1739 rb_dlinkAddAlloc(tmp
, &service_list
);
1743 conf_begin_alias(struct TopConf
*tc
)
1745 yy_alias
= rb_malloc(sizeof(struct alias_entry
));
1747 if (conf_cur_block_name
!= NULL
)
1748 yy_alias
->name
= rb_strdup(conf_cur_block_name
);
1750 yy_alias
->flags
= 0;
1757 conf_end_alias(struct TopConf
*tc
)
1759 if (yy_alias
== NULL
)
1762 if (yy_alias
->name
== NULL
)
1764 conf_report_error("Ignoring alias -- must have a name.");
1771 if (yy_alias
->target
== NULL
)
1773 conf_report_error("Ignoring alias -- must have a target.");
1780 rb_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1786 conf_set_alias_name(void *data
)
1788 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1791 yy_alias
->name
= rb_strdup(data
);
1795 conf_set_alias_target(void *data
)
1797 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1800 yy_alias
->target
= rb_strdup(data
);
1804 conf_set_channel_autochanmodes(void *data
)
1807 int what
= MODE_ADD
;
1809 ConfigChannel
.autochanmodes
= 0;
1810 for (pm
= (char *) data
; *pm
; pm
++)
1822 if (chmode_table
[(unsigned char) *pm
].set_func
== chm_simple
)
1824 if (what
== MODE_ADD
)
1825 ConfigChannel
.autochanmodes
|= chmode_table
[(unsigned char) *pm
].mode_type
;
1827 ConfigChannel
.autochanmodes
&= ~chmode_table
[(unsigned char) *pm
].mode_type
;
1831 conf_report_error("channel::autochanmodes -- Invalid channel mode %c", *pm
);
1840 static void conf_set_blacklist_reason(void *data
);
1842 #define IPTYPE_IPV4 1
1843 #define IPTYPE_IPV6 2
1846 conf_set_blacklist_host(void *data
)
1848 if (yy_blacklist_host
)
1850 conf_report_error("blacklist::host %s overlaps existing host %s",
1851 (char *)data
, yy_blacklist_host
);
1854 conf_set_blacklist_reason(NULL
);
1858 yy_blacklist_iptype
|= IPTYPE_IPV4
;
1859 yy_blacklist_host
= rb_strdup(data
);
1863 conf_set_blacklist_type(void *data
)
1865 conf_parm_t
*args
= data
;
1867 /* Don't assume we have either if we got here */
1868 yy_blacklist_iptype
= 0;
1870 for (; args
; args
= args
->next
)
1872 if (!strcasecmp(args
->v
.string
, "ipv4"))
1873 yy_blacklist_iptype
|= IPTYPE_IPV4
;
1874 else if (!strcasecmp(args
->v
.string
, "ipv6"))
1875 yy_blacklist_iptype
|= IPTYPE_IPV6
;
1877 conf_report_error("blacklist::type has unknown address family %s",
1881 /* If we have neither, just default to IPv4 */
1882 if (!yy_blacklist_iptype
)
1884 conf_report_warning("blacklist::type has neither IPv4 nor IPv6 (defaulting to IPv4)");
1885 yy_blacklist_iptype
= IPTYPE_IPV4
;
1890 conf_set_blacklist_matches(void *data
)
1892 conf_parm_t
*args
= data
;
1893 enum filter_t
{ FILTER_NONE
, FILTER_ALL
, FILTER_LAST
};
1895 for (; args
; args
= args
->next
)
1897 char *str
= args
->v
.string
;
1899 enum filter_t type
= FILTER_LAST
;
1901 if (CF_TYPE(args
->type
) != CF_QSTRING
)
1903 conf_report_error("blacklist::matches -- must be quoted string");
1909 conf_report_error("blacklist::matches -- invalid entry");
1913 if (strlen(str
) > HOSTIPLEN
)
1915 conf_report_error("blacklist::matches has an entry too long: %s",
1920 for (p
= str
; *p
!= '\0'; p
++)
1922 /* Check for validity */
1925 else if (!isdigit((unsigned char)*p
))
1927 conf_report_error("blacklist::matches has invalid IP match entry %s",
1934 if (type
== FILTER_ALL
)
1936 /* Basic IP sanity check */
1937 struct rb_sockaddr_storage tmp
;
1938 if (rb_inet_pton(AF_INET
, str
, &tmp
) <= 0)
1940 conf_report_error("blacklist::matches has invalid IP match entry %s",
1945 else if (type
== FILTER_LAST
)
1947 /* Verify it's the correct length */
1948 if (strlen(str
) > 3)
1950 conf_report_error("blacklist::matches has invalid octet match entry %s",
1957 continue; /* Invalid entry */
1960 rb_dlinkAddAlloc(rb_strdup(str
), &yy_blacklist_filters
);
1965 conf_set_blacklist_reason(void *data
)
1967 rb_dlink_node
*ptr
, *nptr
;
1969 if (yy_blacklist_host
&& data
)
1971 yy_blacklist_reason
= rb_strdup(data
);
1972 if (yy_blacklist_iptype
& IPTYPE_IPV6
)
1974 /* Make sure things fit (magic number 64 = alnum count + dots)
1975 * 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
1977 if ((64 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1979 conf_report_error("blacklist::host %s results in IPv6 queries that are too long",
1984 /* Avoid doing redundant check, IPv6 is bigger than IPv4 --Elizabeth */
1985 if ((yy_blacklist_iptype
& IPTYPE_IPV4
) && !(yy_blacklist_iptype
& IPTYPE_IPV6
))
1987 /* Make sure things fit for worst case (magic number 16 = number of nums + dots)
1988 * Example: 127.127.127.127.in-addr.arpa
1990 if ((16 + strlen(yy_blacklist_host
)) > IRCD_RES_HOSTLEN
)
1992 conf_report_error("blacklist::host %s results in IPv4 queries that are too long",
1998 add_blacklist(yy_blacklist_host
, yy_blacklist_reason
, yy_blacklist_iptype
, &yy_blacklist_filters
);
2002 RB_DLINK_FOREACH_SAFE(ptr
, nptr
, yy_blacklist_filters
.head
)
2005 rb_dlinkDestroy(ptr
, &yy_blacklist_filters
);
2008 yy_blacklist_filters
= (rb_dlink_list
){ NULL
, NULL
, 0 };
2010 rb_free(yy_blacklist_host
);
2011 rb_free(yy_blacklist_reason
);
2012 yy_blacklist_host
= NULL
;
2013 yy_blacklist_reason
= NULL
;
2014 yy_blacklist_iptype
= 0;
2017 /* public functions */
2021 conf_report_error(const char *fmt
, ...)
2024 char msg
[BUFSIZE
+ 1] = { 0 };
2027 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2032 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2036 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2037 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "error: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2041 conf_report_warning(const char *fmt
, ...)
2044 char msg
[BUFSIZE
+ 1] = { 0 };
2047 vsnprintf(msg
, BUFSIZE
, fmt
, ap
);
2052 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
2056 iwarn("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2057 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "warning: \"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
2061 conf_start_block(char *block
, char *name
)
2063 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
2065 conf_report_error("Configuration block '%s' is not defined.", block
);
2070 conf_cur_block_name
= rb_strdup(name
);
2072 conf_cur_block_name
= NULL
;
2074 if(conf_cur_block
->tc_sfunc
)
2075 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
2082 conf_end_block(struct TopConf
*tc
)
2086 ret
= tc
->tc_efunc(tc
);
2088 rb_free(conf_cur_block_name
);
2089 conf_cur_block_name
= NULL
;
2094 conf_set_generic_int(void *data
, void *location
)
2096 *((int *) location
) = *((unsigned int *) data
);
2100 conf_set_generic_string(void *data
, int len
, void *location
)
2102 char **loc
= location
;
2105 if(len
&& strlen(input
) > (unsigned int)len
)
2109 *loc
= rb_strdup(input
);
2113 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
)
2115 struct ConfEntry
*cf
;
2121 if((cf
= find_conf_item(tc
, item
)) == NULL
)
2124 ("Non-existant configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
2128 /* if it takes one thing, make sure they only passed one thing,
2129 and handle as needed. */
2130 if((value
->v
.list
->type
& CF_FLIST
) && !(cf
->cf_type
& CF_FLIST
))
2133 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
2140 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
2142 /* if it expects a string value, but we got a yesno,
2145 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
2146 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
2148 value
->v
.list
->type
= CF_STRING
;
2150 if(cp
->v
.number
== 1)
2151 cp
->v
.string
= rb_strdup("yes");
2153 cp
->v
.string
= rb_strdup("no");
2156 /* maybe it's a CF_TIME and they passed CF_INT --
2157 should still be valid */
2158 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
2159 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
2162 ("Wrong type for %s::%s (expected %s, got %s)",
2163 tc
->tc_name
, (char *) item
,
2164 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
2169 if(cf
->cf_type
& CF_FLIST
)
2173 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
2176 /* just pass it the extended argument list */
2177 cf
->cf_func(value
->v
.list
);
2181 /* it's old-style, needs only one arg */
2182 switch (cf
->cf_type
)
2188 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
2190 cf
->cf_func(&cp
->v
.number
);
2194 if(EmptyString(cp
->v
.string
))
2195 conf_report_error("Ignoring %s::%s -- empty field",
2198 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
2200 cf
->cf_func(cp
->v
.string
);
2210 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
2213 struct ConfEntry
*cf
;
2215 if((tc
= find_top_conf(topconf
)) == NULL
)
2218 if(find_conf_item(tc
, name
) != NULL
)
2221 cf
= rb_malloc(sizeof(struct ConfEntry
));
2228 rb_dlinkAddAlloc(cf
, &tc
->tc_items
);
2234 remove_conf_item(const char *topconf
, const char *name
)
2237 struct ConfEntry
*cf
;
2240 if((tc
= find_top_conf(topconf
)) == NULL
)
2243 if((cf
= find_conf_item(tc
, name
)) == NULL
)
2246 if((ptr
= rb_dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
2249 rb_dlinkDestroy(ptr
, &tc
->tc_items
);
2256 static struct ConfEntry conf_serverinfo_table
[] =
2258 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
2260 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
2261 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
2262 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
2263 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
2264 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
2266 { "ssl_private_key", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_private_key
},
2267 { "ssl_ca_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_ca_cert
},
2268 { "ssl_cert", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cert
},
2269 { "ssl_dh_params", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_dh_params
},
2270 { "ssl_cipher_list", CF_QSTRING
, NULL
, 0, &ServerInfo
.ssl_cipher_list
},
2271 { "ssld_count", CF_INT
, NULL
, 0, &ServerInfo
.ssld_count
},
2273 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
2275 { "nicklen", CF_INT
, conf_set_serverinfo_nicklen
, 0, NULL
},
2277 { "\0", 0, NULL
, 0, NULL
}
2280 static struct ConfEntry conf_admin_table
[] =
2282 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
2283 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
2284 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
2285 { "\0", 0, NULL
, 0, NULL
}
2288 static struct ConfEntry conf_log_table
[] =
2290 { "fname_userlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_userlog
},
2291 { "fname_fuserlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_fuserlog
},
2292 { "fname_operlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operlog
},
2293 { "fname_foperlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_foperlog
},
2294 { "fname_serverlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_serverlog
},
2295 { "fname_killlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_killlog
},
2296 { "fname_klinelog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_klinelog
},
2297 { "fname_operspylog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_operspylog
},
2298 { "fname_ioerrorlog", CF_QSTRING
, NULL
, PATH_MAX
, &ConfigFileEntry
.fname_ioerrorlog
},
2299 { "\0", 0, NULL
, 0, NULL
}
2302 static struct ConfEntry conf_operator_table
[] =
2304 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
2305 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
2306 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
2307 { "privset", CF_QSTRING
, conf_set_oper_privset
, 0, NULL
},
2308 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
2309 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
2310 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
2311 { "fingerprint", CF_QSTRING
, conf_set_oper_fingerprint
, 0, NULL
},
2312 { "\0", 0, NULL
, 0, NULL
}
2315 static struct ConfEntry conf_privset_table
[] =
2317 { "extends", CF_QSTRING
, conf_set_privset_extends
, 0, NULL
},
2318 { "privs", CF_STRING
| CF_FLIST
, conf_set_privset_privs
, 0, NULL
},
2319 { "\0", 0, NULL
, 0, NULL
}
2322 static struct ConfEntry conf_class_table
[] =
2324 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
2325 { "cidr_ipv4_bitlen", CF_INT
, conf_set_class_cidr_ipv4_bitlen
, 0, NULL
},
2327 { "cidr_ipv6_bitlen", CF_INT
, conf_set_class_cidr_ipv6_bitlen
, 0, NULL
},
2329 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
2330 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
2331 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
2332 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
2333 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
2334 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
2335 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
2336 { "\0", 0, NULL
, 0, NULL
}
2339 static struct ConfEntry conf_auth_table
[] =
2341 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
2342 { "auth_user", CF_QSTRING
, conf_set_auth_auth_user
, 0, NULL
},
2343 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
2344 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
2345 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
2346 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
2347 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
2348 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
2349 { "\0", 0, NULL
, 0, NULL
}
2352 static struct ConfEntry conf_connect_table
[] =
2354 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
2355 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
2356 { "fingerprint", CF_QSTRING
, conf_set_connect_fingerprint
, 0, NULL
},
2357 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
2358 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
2359 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
2360 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
2361 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
2362 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
2363 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
2364 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
2365 { "\0", 0, NULL
, 0, NULL
}
2368 static struct ConfEntry conf_general_table
[] =
2370 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
2371 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
2372 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
2373 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
2374 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
2375 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
2376 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
2377 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
2378 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
2379 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
2381 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
2382 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
2383 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
2384 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
2385 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
2386 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
2387 { "sasl_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.sasl_service
},
2389 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2390 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2391 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2392 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2393 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2395 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2396 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2397 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2398 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2399 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2400 { "resv_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.resv_fnc
},
2401 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2402 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2403 { "default_ident_timeout", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_ident_timeout
},
2404 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2405 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2406 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2407 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2408 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2409 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2410 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2411 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2412 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2413 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2414 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2415 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2416 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2417 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2418 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2419 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2420 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2421 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2422 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2423 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2424 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2425 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2426 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2427 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2428 { "throttle_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.throttle_count
},
2429 { "throttle_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.throttle_duration
},
2430 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2431 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2432 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2433 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2434 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2435 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2436 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2437 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2438 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2439 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2440 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2441 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2442 { "use_propagated_bans",CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_propagated_bans
},
2443 { "client_flood_max_lines", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_max_lines
},
2444 { "client_flood_burst_rate", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_rate
},
2445 { "client_flood_burst_max", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_burst_max
},
2446 { "client_flood_message_num", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_num
},
2447 { "client_flood_message_time", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood_message_time
},
2448 { "max_ratelimit_tokens", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_ratelimit_tokens
},
2449 { "away_interval", CF_INT
, NULL
, 0, &ConfigFileEntry
.away_interval
},
2450 { "hide_opers_in_whois", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_opers_in_whois
},
2451 { "certfp_method", CF_STRING
, conf_set_general_certfp_method
, 0, NULL
},
2452 { "\0", 0, NULL
, 0, NULL
}
2455 static struct ConfEntry conf_channel_table
[] =
2457 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2458 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2459 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2460 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2461 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2462 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2463 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2464 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2465 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2466 { "max_chans_per_user_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user_large
},
2467 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2468 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2469 { "only_ascii_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.only_ascii_channels
},
2470 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2471 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2472 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2473 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2474 { "resv_forcepart", CF_YESNO
, NULL
, 0, &ConfigChannel
.resv_forcepart
},
2475 { "channel_target_change", CF_YESNO
, NULL
, 0, &ConfigChannel
.channel_target_change
},
2476 { "disable_local_channels", CF_YESNO
, NULL
, 0, &ConfigChannel
.disable_local_channels
},
2477 { "autochanmodes", CF_QSTRING
, conf_set_channel_autochanmodes
, 0, NULL
},
2478 { "displayed_usercount", CF_INT
, NULL
, 0, &ConfigChannel
.displayed_usercount
},
2479 { "strip_topic_colors", CF_YESNO
, NULL
, 0, &ConfigChannel
.strip_topic_colors
},
2480 { "\0", 0, NULL
, 0, NULL
}
2483 static struct ConfEntry conf_serverhide_table
[] =
2485 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2486 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2487 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2488 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2489 { "\0", 0, NULL
, 0, NULL
}
2496 add_top_conf("modules", NULL
, NULL
, NULL
);
2497 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2498 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2500 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2501 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2502 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2503 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2504 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2505 add_top_conf("privset", NULL
, NULL
, conf_privset_table
);
2507 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2508 add_conf_item("listen", "defer_accept", CF_YESNO
, conf_set_listen_defer_accept
);
2509 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2510 add_conf_item("listen", "sslport", CF_INT
| CF_FLIST
, conf_set_listen_sslport
);
2511 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2512 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2514 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2516 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
2517 add_conf_item("shared", "oper", CF_QSTRING
| CF_FLIST
, conf_set_shared_oper
);
2518 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
2520 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2522 add_top_conf("exempt", NULL
, NULL
, NULL
);
2523 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2525 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2526 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2527 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2529 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2530 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2531 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2533 add_top_conf("service", NULL
, NULL
, NULL
);
2534 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2536 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2537 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2538 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2540 add_top_conf("blacklist", NULL
, NULL
, NULL
);
2541 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_blacklist_host
);
2542 add_conf_item("blacklist", "type", CF_STRING
| CF_FLIST
, conf_set_blacklist_type
);
2543 add_conf_item("blacklist", "matches", CF_QSTRING
| CF_FLIST
, conf_set_blacklist_matches
);
2544 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_blacklist_reason
);