1 /* This code is in the public domain.
2 * $Id: newconf.c 3550 2007-08-09 06:47:26Z nenolod $
8 #include <openssl/pem.h>
9 #include <openssl/rsa.h>
15 #include "ircd_defs.h"
16 #include "sprintf_irc.h"
21 #include "s_newconf.h"
33 #include "blacklist.h"
35 #define CF_TYPE(x) ((x) & CF_MTYPE)
37 struct TopConf
*conf_cur_block
;
38 static char *conf_cur_block_name
;
40 static 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 dlink_list yy_aconf_list
;
50 static dlink_list yy_oper_list
;
51 static dlink_list yy_shared_list
;
52 static 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
;
61 conf_strtype(int type
)
63 switch (type
& CF_MTYPE
)
66 return "integer value";
68 return "unquoted string";
70 return "yes/no value";
72 return "quoted string";
74 return "time/size value";
76 return "unknown type";
81 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
82 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
86 tc
= MyMalloc(sizeof(struct TopConf
));
91 tc
->tc_entries
= items
;
93 dlinkAddAlloc(tc
, &conf_items
);
98 find_top_conf(const char *name
)
103 DLINK_FOREACH(d
, conf_items
.head
)
106 if(strcasecmp(tc
->tc_name
, name
) == 0)
115 find_conf_item(const struct TopConf
*top
, const char *name
)
117 struct ConfEntry
*cf
;
124 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
126 cf
= &top
->tc_entries
[i
];
128 if(!strcasecmp(cf
->cf_name
, name
))
133 DLINK_FOREACH(d
, top
->tc_items
.head
)
136 if(strcasecmp(cf
->cf_name
, name
) == 0)
144 remove_top_conf(char *name
)
149 if((tc
= find_top_conf(name
)) == NULL
)
152 if((ptr
= dlinkFind(tc
, &conf_items
)) == NULL
)
155 dlinkDestroy(ptr
, &conf_items
);
162 conf_set_serverinfo_name(void *data
)
164 if(ServerInfo
.name
== NULL
)
169 for(s
= data
; *s
!= '\0'; s
++)
173 conf_report_error("Ignoring serverinfo::name "
174 "-- bogus servername.");
183 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
191 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
195 /* the ircd will exit() in main() if we dont set one */
196 if(strlen(s
) <= HOSTLEN
)
197 DupString(ServerInfo
.name
, (char *) data
);
202 conf_set_serverinfo_sid(void *data
)
206 if(ServerInfo
.sid
[0] == '\0')
208 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
209 !IsIdChar(sid
[2]) || sid
[3] != '\0')
211 conf_report_error("Ignoring serverinfo::sid "
216 strcpy(ServerInfo
.sid
, sid
);
221 conf_set_serverinfo_network_name(void *data
)
225 if((p
= strchr((char *) data
, ' ')))
228 MyFree(ServerInfo
.network_name
);
229 DupString(ServerInfo
.network_name
, (char *) data
);
233 conf_set_serverinfo_vhost(void *data
)
235 if(inetpton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
237 conf_report_error("Invalid netmask for server IPv4 vhost (%s)", (char *) data
);
240 ServerInfo
.ip
.sin_family
= AF_INET
;
241 ServerInfo
.specific_ipv4_vhost
= 1;
245 conf_set_serverinfo_vhost6(void *data
)
248 if(inetpton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
250 conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data
);
254 ServerInfo
.specific_ipv6_vhost
= 1;
255 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
257 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
262 conf_set_modules_module(void *data
)
264 #ifndef STATIC_MODULES
267 m_bn
= irc_basename((char *) data
);
269 if(findmodule_byname(m_bn
) != -1)
272 load_one_module((char *) data
, 0);
276 conf_report_error("Ignoring modules::module -- loadable module support not present.");
281 conf_set_modules_path(void *data
)
283 #ifndef STATIC_MODULES
284 mod_add_path((char *) data
);
286 conf_report_error("Ignoring modules::path -- loadable module support not present.");
297 static struct mode_table umode_table
[] = {
298 {"callerid", UMODE_CALLERID
},
299 {"deaf", UMODE_DEAF
},
300 {"invisible", UMODE_INVISIBLE
},
301 {"locops", UMODE_LOCOPS
},
302 {"noforward", UMODE_NOFORWARD
},
303 {"regonlymsg", UMODE_REGONLYMSG
},
304 {"servnotice", UMODE_SERVNOTICE
},
305 {"wallop", UMODE_WALLOP
},
306 {"operwall", UMODE_OPERWALL
},
310 static struct mode_table oper_table
[] = {
311 {"encrypted", OPER_ENCRYPTED
},
312 {"local_kill", OPER_LOCKILL
},
313 {"global_kill", OPER_GLOBKILL
|OPER_LOCKILL
},
314 {"remote", OPER_REMOTE
},
315 {"kline", OPER_KLINE
},
316 {"unkline", OPER_UNKLINE
},
317 {"gline", OPER_GLINE
},
318 {"nick_changes", OPER_NICKS
},
319 {"rehash", OPER_REHASH
},
321 {"admin", OPER_ADMIN
},
322 {"hidden_admin", OPER_HADMIN
},
323 {"xline", OPER_XLINE
},
324 {"resv", OPER_RESV
},
325 {"operwall", OPER_OPERWALL
},
326 {"oper_spy", OPER_SPY
},
327 {"hidden_oper", OPER_INVIS
},
328 {"remoteban", OPER_REMOTEBAN
},
329 {"mass_notice", OPER_MASSNOTICE
},
333 static struct mode_table auth_table
[] = {
334 {"encrypted", CONF_FLAGS_ENCRYPTED
},
335 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
336 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
337 {"dnsbl_exempt", CONF_FLAGS_EXEMPTDNSBL
},
338 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
339 {"gline_exempt", CONF_FLAGS_EXEMPTGLINE
},
340 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
341 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
342 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
343 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
344 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
345 {"no_tilde", CONF_FLAGS_NO_TILDE
},
346 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
347 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
348 {"need_sasl", CONF_FLAGS_NEED_SASL
},
352 static struct mode_table connect_table
[] = {
353 { "autoconn", SERVER_AUTOCONN
},
354 { "compressed", SERVER_COMPRESSED
},
355 { "encrypted", SERVER_ENCRYPTED
},
356 { "topicburst", SERVER_TB
},
360 static struct mode_table cluster_table
[] = {
361 { "kline", SHARED_PKLINE
},
362 { "tkline", SHARED_TKLINE
},
363 { "unkline", SHARED_UNKLINE
},
364 { "locops", SHARED_LOCOPS
},
365 { "xline", SHARED_PXLINE
},
366 { "txline", SHARED_TXLINE
},
367 { "unxline", SHARED_UNXLINE
},
368 { "resv", SHARED_PRESV
},
369 { "tresv", SHARED_TRESV
},
370 { "unresv", SHARED_UNRESV
},
371 { "all", CLUSTER_ALL
},
375 static struct mode_table shared_table
[] =
377 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
378 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
379 { "resv", SHARED_PRESV
|SHARED_TRESV
},
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 { "all", SHARED_ALL
},
395 find_umode(struct mode_table
*tab
, const char *name
)
399 for (i
= 0; tab
[i
].name
; i
++)
401 if(strcmp(tab
[i
].name
, name
) == 0)
409 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
411 for (; args
; args
= args
->next
)
417 if((args
->type
& CF_MTYPE
) != CF_STRING
)
419 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
423 umode
= args
->v
.string
;
431 mode
= find_umode(tab
, umode
);
435 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
452 conf_begin_oper(struct TopConf
*tc
)
455 dlink_node
*next_ptr
;
459 free_oper_conf(yy_oper
);
463 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
465 free_oper_conf(ptr
->data
);
466 dlinkDestroy(ptr
, &yy_oper_list
);
469 yy_oper
= make_oper_conf();
470 yy_oper
->flags
|= OPER_ENCRYPTED
|OPER_RESV
|OPER_OPERWALL
|OPER_REMOTEBAN
|OPER_MASSNOTICE
;
476 conf_end_oper(struct TopConf
*tc
)
478 struct oper_conf
*yy_tmpoper
;
480 dlink_node
*next_ptr
;
482 if(conf_cur_block_name
!= NULL
)
484 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
485 conf_cur_block_name
[OPERNICKLEN
] = '\0';
487 DupString(yy_oper
->name
, conf_cur_block_name
);
490 if(EmptyString(yy_oper
->name
))
492 conf_report_error("Ignoring operator block -- missing name.");
496 #ifdef HAVE_LIBCRYPTO
497 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
499 if(EmptyString(yy_oper
->passwd
))
502 conf_report_error("Ignoring operator block for %s -- missing password",
507 /* now, yy_oper_list contains a stack of oper_conf's with just user
508 * and host in, yy_oper contains the rest of the information which
509 * we need to copy into each element in yy_oper_list
511 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
513 yy_tmpoper
= ptr
->data
;
515 DupString(yy_tmpoper
->name
, yy_oper
->name
);
517 /* could be an rsa key instead.. */
518 if(!EmptyString(yy_oper
->passwd
))
519 DupString(yy_tmpoper
->passwd
, yy_oper
->passwd
);
521 yy_tmpoper
->flags
= yy_oper
->flags
;
522 yy_tmpoper
->umodes
= yy_oper
->umodes
;
523 yy_tmpoper
->snomask
= yy_oper
->snomask
;
525 #ifdef HAVE_LIBCRYPTO
526 if(yy_oper
->rsa_pubkey_file
)
530 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
532 conf_report_error("Ignoring operator block for %s -- "
533 "rsa_public_key_file cant be opened",
538 yy_tmpoper
->rsa_pubkey
=
539 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
541 (void)BIO_set_close(file
, BIO_CLOSE
);
544 if(yy_tmpoper
->rsa_pubkey
== NULL
)
546 conf_report_error("Ignoring operator block for %s -- "
547 "rsa_public_key_file key invalid; check syntax",
554 /* all is ok, put it on oper_conf_list */
555 dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
558 free_oper_conf(yy_oper
);
565 conf_set_oper_flags(void *data
)
567 conf_parm_t
*args
= data
;
569 set_modes_from_table(&yy_oper
->flags
, "flag", oper_table
, args
);
573 conf_set_oper_user(void *data
)
575 struct oper_conf
*yy_tmpoper
;
577 char *host
= (char *) data
;
579 yy_tmpoper
= make_oper_conf();
581 if((p
= strchr(host
, '@')))
585 DupString(yy_tmpoper
->username
, host
);
586 DupString(yy_tmpoper
->host
, p
);
591 DupString(yy_tmpoper
->username
, "*");
592 DupString(yy_tmpoper
->host
, host
);
595 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
597 conf_report_error("Ignoring user -- missing username/host");
598 free_oper_conf(yy_tmpoper
);
602 dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
606 conf_set_oper_password(void *data
)
610 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
611 MyFree(yy_oper
->passwd
);
614 DupString(yy_oper
->passwd
, (char *) data
);
618 conf_set_oper_rsa_public_key_file(void *data
)
620 #ifdef HAVE_LIBCRYPTO
621 MyFree(yy_oper
->rsa_pubkey_file
);
622 DupString(yy_oper
->rsa_pubkey_file
, (char *) data
);
624 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
629 conf_set_oper_umodes(void *data
)
631 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
635 conf_set_oper_snomask(void *data
)
637 yy_oper
->snomask
= parse_snobuf_to_mask(0, (const char *) data
);
641 conf_begin_class(struct TopConf
*tc
)
644 free_class(yy_class
);
646 yy_class
= make_class();
651 conf_end_class(struct TopConf
*tc
)
653 if(conf_cur_block_name
!= NULL
)
654 DupString(yy_class
->class_name
, conf_cur_block_name
);
656 if(EmptyString(yy_class
->class_name
))
658 conf_report_error("Ignoring connect block -- missing name.");
668 conf_set_class_ping_time(void *data
)
670 yy_class
->ping_freq
= *(unsigned int *) data
;
674 conf_set_class_cidr_bitlen(void *data
)
677 unsigned int maxsize
= 128;
679 unsigned int maxsize
= 32;
681 if(*(unsigned int *) data
> maxsize
)
683 ("class::cidr_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
684 *(unsigned int *) data
, maxsize
);
686 yy_class
->cidr_bitlen
= *(unsigned int *) data
;
690 conf_set_class_number_per_cidr(void *data
)
692 yy_class
->cidr_amount
= *(unsigned int *) data
;
696 conf_set_class_number_per_ip(void *data
)
698 yy_class
->max_local
= *(unsigned int *) data
;
703 conf_set_class_number_per_ip_global(void *data
)
705 yy_class
->max_global
= *(unsigned int *) data
;
709 conf_set_class_number_per_ident(void *data
)
711 yy_class
->max_ident
= *(unsigned int *) data
;
715 conf_set_class_connectfreq(void *data
)
717 yy_class
->con_freq
= *(unsigned int *) data
;
721 conf_set_class_max_number(void *data
)
723 yy_class
->max_total
= *(unsigned int *) data
;
727 conf_set_class_sendq(void *data
)
729 yy_class
->max_sendq
= *(unsigned int *) data
;
732 static char *listener_address
;
735 conf_begin_listen(struct TopConf
*tc
)
737 MyFree(listener_address
);
738 listener_address
= NULL
;
743 conf_end_listen(struct TopConf
*tc
)
745 MyFree(listener_address
);
746 listener_address
= NULL
;
751 conf_set_listen_port(void *data
)
753 conf_parm_t
*args
= data
;
754 for (; args
; args
= args
->next
)
756 if((args
->type
& CF_MTYPE
) != CF_INT
)
759 ("listener::port argument is not an integer " "-- ignoring.");
762 if(listener_address
== NULL
)
764 add_listener(args
->v
.number
, listener_address
, AF_INET
);
766 add_listener(args
->v
.number
, listener_address
, AF_INET6
);
773 if(strchr(listener_address
, ':') != NULL
)
779 add_listener(args
->v
.number
, listener_address
, family
);
787 conf_set_listen_address(void *data
)
789 MyFree(listener_address
);
790 DupString(listener_address
, data
);
794 conf_begin_auth(struct TopConf
*tc
)
797 dlink_node
*next_ptr
;
802 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
804 free_conf(ptr
->data
);
805 dlinkDestroy(ptr
, &yy_aconf_list
);
808 yy_aconf
= make_conf();
809 yy_aconf
->status
= CONF_CLIENT
;
815 conf_end_auth(struct TopConf
*tc
)
817 struct ConfItem
*yy_tmp
;
819 dlink_node
*next_ptr
;
821 if(EmptyString(yy_aconf
->name
))
822 DupString(yy_aconf
->name
, "NOMATCH");
824 /* didnt even get one ->host? */
825 if(EmptyString(yy_aconf
->host
))
827 conf_report_error("Ignoring auth block -- missing user@host");
831 /* so the stacking works in order.. */
832 collapse(yy_aconf
->user
);
833 collapse(yy_aconf
->host
);
834 conf_add_class_to_conf(yy_aconf
);
835 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
);
837 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
842 DupString(yy_tmp
->passwd
, yy_aconf
->passwd
);
844 /* this will always exist.. */
845 DupString(yy_tmp
->name
, yy_aconf
->name
);
847 if(yy_aconf
->className
)
848 DupString(yy_tmp
->className
, yy_aconf
->className
);
850 yy_tmp
->flags
= yy_aconf
->flags
;
851 yy_tmp
->port
= yy_aconf
->port
;
853 collapse(yy_tmp
->user
);
854 collapse(yy_tmp
->host
);
856 conf_add_class_to_conf(yy_tmp
);
858 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
);
859 dlinkDestroy(ptr
, &yy_aconf_list
);
867 conf_set_auth_user(void *data
)
869 struct ConfItem
*yy_tmp
;
872 /* The first user= line doesn't allocate a new conf */
873 if(!EmptyString(yy_aconf
->host
))
875 yy_tmp
= make_conf();
876 yy_tmp
->status
= CONF_CLIENT
;
881 if((p
= strchr(data
, '@')))
885 DupString(yy_tmp
->user
, data
);
886 DupString(yy_tmp
->host
, p
);
890 DupString(yy_tmp
->user
, "*");
891 DupString(yy_tmp
->host
, data
);
894 if(yy_aconf
!= yy_tmp
)
895 dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
899 conf_set_auth_passwd(void *data
)
902 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
903 MyFree(yy_aconf
->passwd
);
904 DupString(yy_aconf
->passwd
, data
);
908 conf_set_auth_spoof(void *data
)
916 /* user@host spoof */
917 if((p
= strchr(host
, '@')) != NULL
)
923 if(EmptyString(user
))
925 conf_report_error("Warning -- spoof ident empty.");
929 if(strlen(user
) > USERLEN
)
931 conf_report_error("Warning -- spoof ident length invalid.");
935 if(!valid_username(user
))
937 conf_report_error("Warning -- invalid spoof (ident).");
941 /* this must be restored! */
945 if(EmptyString(host
))
947 conf_report_error("Warning -- spoof host empty.");
951 if(strlen(host
) > HOSTLEN
)
953 conf_report_error("Warning -- spoof host length invalid.");
957 if(!valid_hostname(host
))
959 conf_report_error("Warning -- invalid spoof (host).");
963 MyFree(yy_aconf
->name
);
964 DupString(yy_aconf
->name
, data
);
965 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
969 conf_set_auth_flags(void *data
)
971 conf_parm_t
*args
= data
;
973 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
977 conf_set_auth_redir_serv(void *data
)
979 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
980 MyFree(yy_aconf
->name
);
981 DupString(yy_aconf
->name
, data
);
985 conf_set_auth_redir_port(void *data
)
987 int port
= *(unsigned int *) data
;
989 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
990 yy_aconf
->port
= port
;
994 conf_set_auth_class(void *data
)
996 MyFree(yy_aconf
->className
);
997 DupString(yy_aconf
->className
, data
);
1000 /* ok, shared_oper handles the stacking, shared_flags handles adding
1001 * things.. so all we need to do when we start and end a shared block, is
1002 * clean up anything thats been left over.
1005 conf_cleanup_shared(struct TopConf
*tc
)
1007 dlink_node
*ptr
, *next_ptr
;
1009 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1011 free_remote_conf(ptr
->data
);
1012 dlinkDestroy(ptr
, &yy_shared_list
);
1015 if(yy_shared
!= NULL
)
1017 free_remote_conf(yy_shared
);
1025 conf_set_shared_oper(void *data
)
1027 conf_parm_t
*args
= data
;
1028 const char *username
;
1031 if(yy_shared
!= NULL
)
1032 free_remote_conf(yy_shared
);
1034 yy_shared
= make_remote_conf();
1036 if(args
->next
!= NULL
)
1038 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1040 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1044 DupString(yy_shared
->server
, args
->v
.string
);
1048 DupString(yy_shared
->server
, "*");
1050 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1052 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1056 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1058 conf_report_error("Ignoring shard::oper -- oper is not a user@host");
1062 username
= args
->v
.string
;
1066 DupString(yy_shared
->host
, "*");
1068 DupString(yy_shared
->host
, p
);
1070 if(EmptyString(username
))
1071 DupString(yy_shared
->username
, "*");
1073 DupString(yy_shared
->username
, username
);
1075 dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1080 conf_set_shared_flags(void *data
)
1082 conf_parm_t
*args
= data
;
1084 dlink_node
*ptr
, *next_ptr
;
1086 if(yy_shared
!= NULL
)
1087 free_remote_conf(yy_shared
);
1089 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1091 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1093 yy_shared
= ptr
->data
;
1095 yy_shared
->flags
= flags
;
1096 dlinkDestroy(ptr
, &yy_shared_list
);
1097 dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1104 conf_begin_connect(struct TopConf
*tc
)
1107 free_server_conf(yy_server
);
1109 yy_server
= make_server_conf();
1110 yy_server
->port
= PORTNUM
;
1111 yy_server
->flags
|= SERVER_TB
;
1113 if(conf_cur_block_name
!= NULL
)
1114 DupString(yy_server
->name
, conf_cur_block_name
);
1120 conf_end_connect(struct TopConf
*tc
)
1122 if(EmptyString(yy_server
->name
))
1124 conf_report_error("Ignoring connect block -- missing name.");
1128 if(ServerInfo
.name
!= NULL
&& !irccmp(ServerInfo
.name
, yy_server
->name
))
1130 conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
1135 if(EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
))
1137 conf_report_error("Ignoring connect block for %s -- missing password.",
1142 if(EmptyString(yy_server
->host
))
1144 conf_report_error("Ignoring connect block for %s -- missing host.",
1150 if(ServerConfCompressed(yy_server
))
1152 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1153 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1157 add_server_conf(yy_server
);
1158 dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1165 conf_set_connect_host(void *data
)
1167 MyFree(yy_server
->host
);
1168 DupString(yy_server
->host
, data
);
1169 if (strchr(yy_server
->host
, ':'))
1170 yy_server
->aftype
= AF_INET6
;
1174 conf_set_connect_vhost(void *data
)
1176 if(inetpton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1178 conf_report_error("Invalid netmask for server vhost (%s)",
1183 yy_server
->flags
|= SERVER_VHOSTED
;
1187 conf_set_connect_send_password(void *data
)
1189 if(yy_server
->spasswd
)
1191 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1192 MyFree(yy_server
->spasswd
);
1195 DupString(yy_server
->spasswd
, data
);
1199 conf_set_connect_accept_password(void *data
)
1201 if(yy_server
->passwd
)
1203 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1204 MyFree(yy_server
->passwd
);
1206 DupString(yy_server
->passwd
, data
);
1210 conf_set_connect_port(void *data
)
1212 int port
= *(unsigned int *) data
;
1217 yy_server
->port
= port
;
1221 conf_set_connect_aftype(void *data
)
1225 if(strcasecmp(aft
, "ipv4") == 0)
1226 yy_server
->aftype
= AF_INET
;
1228 else if(strcasecmp(aft
, "ipv6") == 0)
1229 yy_server
->aftype
= AF_INET6
;
1232 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1236 conf_set_connect_flags(void *data
)
1238 conf_parm_t
*args
= data
;
1240 /* note, we allow them to set compressed, then remove it later if
1241 * they do and LIBZ isnt available
1243 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1247 conf_set_connect_hub_mask(void *data
)
1249 struct remote_conf
*yy_hub
;
1251 if(EmptyString(yy_server
->name
))
1254 yy_hub
= make_remote_conf();
1255 yy_hub
->flags
= CONF_HUB
;
1257 DupString(yy_hub
->host
, data
);
1258 DupString(yy_hub
->server
, yy_server
->name
);
1259 dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1263 conf_set_connect_leaf_mask(void *data
)
1265 struct remote_conf
*yy_leaf
;
1267 if(EmptyString(yy_server
->name
))
1270 yy_leaf
= make_remote_conf();
1271 yy_leaf
->flags
= CONF_LEAF
;
1273 DupString(yy_leaf
->host
, data
);
1274 DupString(yy_leaf
->server
, yy_server
->name
);
1275 dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1279 conf_set_connect_class(void *data
)
1281 MyFree(yy_server
->class_name
);
1282 DupString(yy_server
->class_name
, data
);
1286 conf_set_exempt_ip(void *data
)
1288 struct ConfItem
*yy_tmp
;
1290 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1292 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1296 yy_tmp
= make_conf();
1297 DupString(yy_tmp
->passwd
, "*");
1298 DupString(yy_tmp
->host
, data
);
1299 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1300 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, yy_tmp
);
1304 conf_cleanup_cluster(struct TopConf
*tc
)
1306 dlink_node
*ptr
, *next_ptr
;
1308 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1310 free_remote_conf(ptr
->data
);
1311 dlinkDestroy(ptr
, &yy_cluster_list
);
1314 if(yy_shared
!= NULL
)
1316 free_remote_conf(yy_shared
);
1324 conf_set_cluster_name(void *data
)
1326 if(yy_shared
!= NULL
)
1327 free_remote_conf(yy_shared
);
1329 yy_shared
= make_remote_conf();
1330 DupString(yy_shared
->server
, data
);
1331 dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1337 conf_set_cluster_flags(void *data
)
1339 conf_parm_t
*args
= data
;
1341 dlink_node
*ptr
, *next_ptr
;
1343 if(yy_shared
!= NULL
)
1344 free_remote_conf(yy_shared
);
1346 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1348 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1350 yy_shared
= ptr
->data
;
1351 yy_shared
->flags
= flags
;
1352 dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1353 dlinkDestroy(ptr
, &yy_cluster_list
);
1360 conf_set_general_havent_read_conf(void *data
)
1362 if(*(unsigned int *) data
)
1364 conf_report_error("You haven't read your config file properly.");
1366 ("There is a line in the example conf that will kill your server if not removed.");
1368 ("Consider actually reading/editing the conf file, and removing this line.");
1375 conf_set_general_hide_error_messages(void *data
)
1379 if(strcasecmp(val
, "yes") == 0)
1380 ConfigFileEntry
.hide_error_messages
= 2;
1381 else if(strcasecmp(val
, "opers") == 0)
1382 ConfigFileEntry
.hide_error_messages
= 1;
1383 else if(strcasecmp(val
, "no") == 0)
1384 ConfigFileEntry
.hide_error_messages
= 0;
1386 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1390 conf_set_general_kline_delay(void *data
)
1392 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1394 /* THIS MUST BE HERE to stop us being unable to check klines */
1399 conf_set_general_stats_k_oper_only(void *data
)
1403 if(strcasecmp(val
, "yes") == 0)
1404 ConfigFileEntry
.stats_k_oper_only
= 2;
1405 else if(strcasecmp(val
, "masked") == 0)
1406 ConfigFileEntry
.stats_k_oper_only
= 1;
1407 else if(strcasecmp(val
, "no") == 0)
1408 ConfigFileEntry
.stats_k_oper_only
= 0;
1410 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1414 conf_set_general_stats_i_oper_only(void *data
)
1418 if(strcasecmp(val
, "yes") == 0)
1419 ConfigFileEntry
.stats_i_oper_only
= 2;
1420 else if(strcasecmp(val
, "masked") == 0)
1421 ConfigFileEntry
.stats_i_oper_only
= 1;
1422 else if(strcasecmp(val
, "no") == 0)
1423 ConfigFileEntry
.stats_i_oper_only
= 0;
1425 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1429 conf_set_general_compression_level(void *data
)
1432 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1434 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1437 ("Invalid general::compression_level %d -- using default.",
1438 ConfigFileEntry
.compression_level
);
1439 ConfigFileEntry
.compression_level
= 0;
1442 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1447 conf_set_general_default_umodes(void *data
)
1450 int what
= MODE_ADD
, flag
;
1452 ConfigFileEntry
.default_umodes
= 0;
1453 for (pm
= (char *) data
; *pm
; pm
++)
1464 /* don't allow +o */
1471 if ((flag
= user_modes
[(unsigned char) *pm
]))
1473 /* Proper value has probably not yet been set
1474 * so don't check oper_only_umodes -- jilles */
1475 if (what
== MODE_ADD
)
1476 ConfigFileEntry
.default_umodes
|= flag
;
1478 ConfigFileEntry
.default_umodes
&= ~flag
;
1486 conf_set_general_oper_umodes(void *data
)
1488 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1492 conf_set_general_oper_only_umodes(void *data
)
1494 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1498 conf_set_general_oper_snomask(void *data
)
1501 int what
= MODE_ADD
, flag
;
1503 ConfigFileEntry
.oper_snomask
= 0;
1504 for (pm
= (char *) data
; *pm
; pm
++)
1516 if ((flag
= snomask_modes
[(unsigned char) *pm
]))
1518 if (what
== MODE_ADD
)
1519 ConfigFileEntry
.oper_snomask
|= flag
;
1521 ConfigFileEntry
.oper_snomask
&= ~flag
;
1529 conf_set_serverhide_links_delay(void *data
)
1531 int val
= *(unsigned int *) data
;
1533 ConfigServerHide
.links_delay
= val
;
1537 conf_begin_service(struct TopConf
*tc
)
1539 struct Client
*target_p
;
1542 DLINK_FOREACH(ptr
, global_serv_list
.head
)
1544 target_p
= ptr
->data
;
1546 target_p
->flags
&= ~FLAGS_SERVICE
;
1553 conf_set_service_name(void *data
)
1555 struct Client
*target_p
;
1560 for(s
= data
; *s
!= '\0'; s
++)
1564 conf_report_error("Ignoring service::name "
1565 "-- bogus servername.");
1574 conf_report_error("Ignoring service::name -- must contain '.'");
1578 DupString(tmp
, data
);
1579 dlinkAddAlloc(tmp
, &service_list
);
1581 if((target_p
= find_server(NULL
, tmp
)))
1582 target_p
->flags
|= FLAGS_SERVICE
;
1586 conf_begin_alias(struct TopConf
*tc
)
1588 yy_alias
= MyMalloc(sizeof(struct alias_entry
));
1590 if (conf_cur_block_name
!= NULL
)
1591 DupString(yy_alias
->name
, conf_cur_block_name
);
1593 yy_alias
->flags
= 0;
1600 conf_end_alias(struct TopConf
*tc
)
1602 if (yy_alias
== NULL
)
1605 if (yy_alias
->name
== NULL
)
1607 conf_report_error("Ignoring alias -- must have a name.");
1614 if (yy_alias
->target
== NULL
)
1616 conf_report_error("Ignoring alias -- must have a target.");
1624 alias_dict
= irc_dictionary_create(strcasecmp
);
1626 irc_dictionary_add(alias_dict
, yy_alias
->name
, yy_alias
);
1632 conf_set_alias_name(void *data
)
1634 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1637 DupString(yy_alias
->name
, data
);
1641 conf_set_alias_target(void *data
)
1643 if (data
== NULL
|| yy_alias
== NULL
) /* this shouldn't ever happen */
1646 DupString(yy_alias
->target
, data
);
1650 conf_set_blacklist_host(void *data
)
1652 DupString(yy_blacklist_host
, data
);
1656 conf_set_blacklist_reason(void *data
)
1658 DupString(yy_blacklist_reason
, data
);
1660 if (yy_blacklist_host
&& yy_blacklist_reason
)
1662 new_blacklist(yy_blacklist_host
, yy_blacklist_reason
);
1663 MyFree(yy_blacklist_host
);
1664 MyFree(yy_blacklist_reason
);
1665 yy_blacklist_host
= NULL
;
1666 yy_blacklist_reason
= NULL
;
1670 /* public functions */
1674 conf_report_error(const char *fmt
, ...)
1677 char msg
[IRCD_BUFSIZE
+ 1] = { 0 };
1680 ircvsnprintf(msg
, IRCD_BUFSIZE
, fmt
, ap
);
1685 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
1689 ierror("\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1690 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1694 conf_start_block(char *block
, char *name
)
1696 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
1698 conf_report_error("Configuration block '%s' is not defined.", block
);
1703 DupString(conf_cur_block_name
, name
);
1705 conf_cur_block_name
= NULL
;
1707 if(conf_cur_block
->tc_sfunc
)
1708 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
1715 conf_end_block(struct TopConf
*tc
)
1718 return tc
->tc_efunc(tc
);
1720 MyFree(conf_cur_block_name
);
1725 conf_set_generic_int(void *data
, void *location
)
1727 *((int *) location
) = *((unsigned int *) data
);
1731 conf_set_generic_string(void *data
, int len
, void *location
)
1733 char **loc
= location
;
1736 if(len
&& strlen(input
) > len
)
1740 DupString(*loc
, input
);
1744 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
, int type
)
1746 struct ConfEntry
*cf
;
1752 if((cf
= find_conf_item(tc
, item
)) == NULL
)
1755 ("Non-existant configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
1759 /* if it takes one thing, make sure they only passed one thing,
1760 and handle as needed. */
1761 if(value
->type
& CF_FLIST
&& !cf
->cf_type
& CF_FLIST
)
1764 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
1771 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
1773 /* if it expects a string value, but we got a yesno,
1776 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
1777 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
1779 value
->v
.list
->type
= CF_STRING
;
1781 if(cp
->v
.number
== 1)
1782 DupString(cp
->v
.string
, "yes");
1784 DupString(cp
->v
.string
, "no");
1787 /* maybe it's a CF_TIME and they passed CF_INT --
1788 should still be valid */
1789 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
1790 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
1793 ("Wrong type for %s::%s (expected %s, got %s)",
1794 tc
->tc_name
, (char *) item
,
1795 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
1800 if(cf
->cf_type
& CF_FLIST
)
1804 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
1807 /* just pass it the extended argument list */
1808 cf
->cf_func(value
->v
.list
);
1812 /* it's old-style, needs only one arg */
1813 switch (cf
->cf_type
)
1819 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
1821 cf
->cf_func(&cp
->v
.number
);
1825 if(EmptyString(cp
->v
.string
))
1826 conf_report_error("Ignoring %s::%s -- empty field",
1829 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
1831 cf
->cf_func(cp
->v
.string
);
1841 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
1844 struct ConfEntry
*cf
;
1846 if((tc
= find_top_conf(topconf
)) == NULL
)
1849 if((cf
= find_conf_item(tc
, name
)) != NULL
)
1852 cf
= MyMalloc(sizeof(struct ConfEntry
));
1859 dlinkAddAlloc(cf
, &tc
->tc_items
);
1865 remove_conf_item(const char *topconf
, const char *name
)
1868 struct ConfEntry
*cf
;
1871 if((tc
= find_top_conf(topconf
)) == NULL
)
1874 if((cf
= find_conf_item(tc
, name
)) == NULL
)
1877 if((ptr
= dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
1880 dlinkDestroy(ptr
, &tc
->tc_items
);
1887 static struct ConfEntry conf_serverinfo_table
[] =
1889 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
1890 { "network_desc", CF_QSTRING
, NULL
, 0, &ServerInfo
.network_desc
},
1891 { "hub", CF_YESNO
, NULL
, 0, &ServerInfo
.hub
},
1893 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
1894 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
1895 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
1896 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
1897 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
1899 { "max_clients", CF_INT
, NULL
, 0, &ServerInfo
.max_clients
},
1901 { "\0", 0, NULL
, 0, NULL
}
1904 static struct ConfEntry conf_admin_table
[] =
1906 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
1907 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
1908 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
1909 { "\0", 0, NULL
, 0, NULL
}
1912 static struct ConfEntry conf_log_table
[] =
1914 { "fname_userlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_userlog
},
1915 { "fname_fuserlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_fuserlog
},
1916 { "fname_operlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_operlog
},
1917 { "fname_foperlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_foperlog
},
1918 { "fname_serverlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_serverlog
},
1919 { "fname_killlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_killlog
},
1920 { "fname_glinelog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_glinelog
},
1921 { "fname_klinelog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_klinelog
},
1922 { "fname_operspylog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_operspylog
},
1923 { "fname_ioerrorlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_ioerrorlog
},
1924 { "\0", 0, NULL
, 0, NULL
}
1927 static struct ConfEntry conf_operator_table
[] =
1929 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
1930 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
1931 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
1932 { "snomask", CF_QSTRING
, conf_set_oper_snomask
, 0, NULL
},
1933 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
1934 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
1935 { "\0", 0, NULL
, 0, NULL
}
1938 static struct ConfEntry conf_class_table
[] =
1940 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
1941 { "cidr_bitlen", CF_INT
, conf_set_class_cidr_bitlen
, 0, NULL
},
1942 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
1943 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
1944 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
1945 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
1946 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
1947 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
1948 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
1949 { "\0", 0, NULL
, 0, NULL
}
1952 static struct ConfEntry conf_auth_table
[] =
1954 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
1955 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
1956 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
1957 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
1958 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
1959 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
1960 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
1961 { "\0", 0, NULL
, 0, NULL
}
1964 static struct ConfEntry conf_connect_table
[] =
1966 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
1967 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
1968 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
1969 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
1970 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
1971 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
1972 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
1973 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
1974 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
1975 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
1976 { "\0", 0, NULL
, 0, NULL
}
1979 static struct ConfEntry conf_general_table
[] =
1981 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
1982 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
1983 { "oper_snomask", CF_QSTRING
, conf_set_general_oper_snomask
, 0, NULL
},
1984 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
1985 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
1986 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
1987 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
1988 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
1989 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
1990 { "default_umodes", CF_QSTRING
, conf_set_general_default_umodes
, 0, NULL
},
1992 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
1993 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
1994 { "servicestring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.servicestring
},
1995 { "egdpool_path", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.egdpool_path
},
1996 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
1997 { "identify_service", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifyservice
},
1998 { "identify_command", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.identifycommand
},
1999 { "servlink_path", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.servlink_path
},
2001 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
2002 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
2003 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
2004 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
2005 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
2007 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
2008 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
2009 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
2010 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
2011 { "client_flood", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood
},
2012 { "collision_fnc", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.collision_fnc
},
2013 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
2014 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
2015 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
2016 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
2017 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
2018 { "glines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.glines
},
2019 { "gline_min_cidr", CF_INT
, NULL
, 0, &ConfigFileEntry
.gline_min_cidr
},
2020 { "gline_min_cidr6", CF_INT
, NULL
, 0, &ConfigFileEntry
.gline_min_cidr6
},
2021 { "gline_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.gline_time
},
2022 { "global_snotices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.global_snotices
},
2023 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
2024 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
2025 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
2026 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
2027 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
2028 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
2029 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
2030 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
2031 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
2032 { "max_unknown_ip", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_unknown_ip
},
2033 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
2034 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
2035 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
2036 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
2037 { "operspy_dont_care_user_info", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_dont_care_user_info
},
2038 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
2039 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
2040 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
2041 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
2042 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
2043 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
2044 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
2045 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
2046 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
2047 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
2048 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
2049 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
2050 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
2051 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
2052 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
2053 { "use_egd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_egd
},
2054 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
2055 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
2056 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
2057 { "\0", 0, NULL
, 0, NULL
}
2060 static struct ConfEntry conf_channel_table
[] =
2062 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
2063 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
2064 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
2065 { "kick_on_split_riding", CF_YESNO
, NULL
, 0, &ConfigChannel
.kick_on_split_riding
},
2066 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
2067 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
2068 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
2069 { "max_bans_large", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans_large
},
2070 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
2071 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
2072 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
2073 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
2074 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
2075 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
2076 { "use_forward", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_forward
},
2077 { "\0", 0, NULL
, 0, NULL
}
2080 static struct ConfEntry conf_serverhide_table
[] =
2082 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
2083 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
2084 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
2085 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
2086 { "\0", 0, NULL
, 0, NULL
}
2093 add_top_conf("modules", NULL
, NULL
, NULL
);
2094 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
2095 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
2097 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
2098 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
2099 add_top_conf("log", NULL
, NULL
, conf_log_table
);
2100 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
2101 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
2103 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
2104 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
2105 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
2106 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
2108 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
2110 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
2111 add_conf_item("shared", "oper", CF_QSTRING
|CF_FLIST
, conf_set_shared_oper
);
2112 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
2114 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
2116 add_top_conf("exempt", NULL
, NULL
, NULL
);
2117 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
2119 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
2120 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
2121 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
2123 add_top_conf("general", NULL
, NULL
, conf_general_table
);
2124 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
2125 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
2127 add_top_conf("service", conf_begin_service
, NULL
, NULL
);
2128 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);
2130 add_top_conf("alias", conf_begin_alias
, conf_end_alias
, NULL
);
2131 add_conf_item("alias", "name", CF_QSTRING
, conf_set_alias_name
);
2132 add_conf_item("alias", "target", CF_QSTRING
, conf_set_alias_target
);
2134 add_top_conf("blacklist", NULL
, NULL
, NULL
);
2135 add_conf_item("blacklist", "host", CF_QSTRING
, conf_set_blacklist_host
);
2136 add_conf_item("blacklist", "reject_reason", CF_QSTRING
, conf_set_blacklist_reason
);