1 /* This code is in the public domain.
2 * $Id: newconf.c 23955 2007-05-14 17:22:36Z leeh $
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 #define CF_TYPE(x) ((x) & CF_MTYPE)
35 struct TopConf
*conf_cur_block
;
36 static char *conf_cur_block_name
;
38 static dlink_list conf_items
;
40 static struct ConfItem
*yy_aconf
= NULL
;
41 static char *yy_aconf_class
;
43 static struct Class
*yy_class
= NULL
;
45 static struct remote_conf
*yy_shared
= NULL
;
46 static struct server_conf
*yy_server
= NULL
;
48 static dlink_list yy_aconf_list
;
49 static dlink_list yy_oper_list
;
50 static dlink_list yy_shared_list
;
51 static dlink_list yy_cluster_list
;
52 static struct oper_conf
*yy_oper
= NULL
;
55 conf_strtype(int type
)
57 switch (type
& CF_MTYPE
)
60 return "integer value";
62 return "unquoted string";
64 return "yes/no value";
66 return "quoted string";
68 return "time/size value";
70 return "unknown type";
75 add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*),
76 int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
)
80 tc
= MyMalloc(sizeof(struct TopConf
));
82 DupString(tc
->tc_name
, name
);
85 tc
->tc_entries
= items
;
87 dlinkAddAlloc(tc
, &conf_items
);
91 static struct TopConf
*
92 find_top_conf(const char *name
)
97 DLINK_FOREACH(d
, conf_items
.head
)
100 if(strcasecmp(tc
->tc_name
, name
) == 0)
108 static struct ConfEntry
*
109 find_conf_item(const struct TopConf
*top
, const char *name
)
111 struct ConfEntry
*cf
;
118 for(i
= 0; top
->tc_entries
[i
].cf_type
; i
++)
120 cf
= &top
->tc_entries
[i
];
122 if(!strcasecmp(cf
->cf_name
, name
))
127 DLINK_FOREACH(d
, top
->tc_items
.head
)
130 if(strcasecmp(cf
->cf_name
, name
) == 0)
137 #if 0 /* XXX unused */
139 remove_top_conf(char *name
)
144 if((tc
= find_top_conf(name
)) == NULL
)
147 if((ptr
= dlinkFind(tc
, &conf_items
)) == NULL
)
150 dlinkDestroy(ptr
, &conf_items
);
159 conf_set_serverinfo_name(void *data
)
161 if(ServerInfo
.name
== NULL
)
166 for(s
= data
; *s
!= '\0'; s
++)
170 conf_report_error("Ignoring serverinfo::name "
171 "-- bogus servername.");
180 conf_report_error("Ignoring serverinfo::name -- must contain '.'");
188 conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
192 /* the ircd will exit() in main() if we dont set one */
193 if(strlen(s
) <= HOSTLEN
)
194 DupString(ServerInfo
.name
, (char *) data
);
199 conf_set_serverinfo_sid(void *data
)
203 if(ServerInfo
.sid
[0] == '\0')
205 if(!IsDigit(sid
[0]) || !IsIdChar(sid
[1]) ||
206 !IsIdChar(sid
[2]) || sid
[3] != '\0')
208 conf_report_error("Ignoring serverinfo::sid "
213 strcpy(ServerInfo
.sid
, sid
);
218 conf_set_serverinfo_network_name(void *data
)
222 if((p
= strchr((char *) data
, ' ')))
225 MyFree(ServerInfo
.network_name
);
226 DupString(ServerInfo
.network_name
, (char *) data
);
230 conf_set_serverinfo_vhost(void *data
)
232 if(inetpton(AF_INET
, (char *) data
, &ServerInfo
.ip
.sin_addr
) <= 0)
234 conf_report_error("Invalid netmask for server IPv4 vhost (%s)", (char *) data
);
237 ServerInfo
.ip
.sin_family
= AF_INET
;
238 ServerInfo
.specific_ipv4_vhost
= 1;
242 conf_set_serverinfo_vhost6(void *data
)
245 if(inetpton(AF_INET6
, (char *) data
, &ServerInfo
.ip6
.sin6_addr
) <= 0)
247 conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data
);
251 ServerInfo
.specific_ipv6_vhost
= 1;
252 ServerInfo
.ip6
.sin6_family
= AF_INET6
;
254 conf_report_error("Warning -- ignoring serverinfo::vhost6 -- IPv6 support not available.");
259 conf_set_modules_module(void *data
)
261 #ifndef STATIC_MODULES
264 m_bn
= irc_basename((char *) data
);
266 if(findmodule_byname(m_bn
) != -1)
269 load_one_module((char *) data
, 0);
273 conf_report_error("Ignoring modules::module -- loadable module support not present.");
278 conf_set_modules_path(void *data
)
280 #ifndef STATIC_MODULES
281 mod_add_path((char *) data
);
283 conf_report_error("Ignoring modules::path -- loadable module support not present.");
294 static struct mode_table umode_table
[] = {
295 {"bots", UMODE_BOTS
},
296 {"cconn", UMODE_CCONN
},
297 {"cconnext", UMODE_CCONNEXT
},
298 {"debug", UMODE_DEBUG
},
299 {"full", UMODE_FULL
},
300 {"callerid", UMODE_CALLERID
},
301 {"invisible", UMODE_INVISIBLE
},
302 {"idlehide", UMODE_IDLEHIDE
},
303 {"skill", UMODE_SKILL
},
304 {"locops", UMODE_LOCOPS
},
305 {"nchange", UMODE_NCHANGE
},
307 {"servnotice", UMODE_SERVNOTICE
},
308 {"unauth", UMODE_UNAUTH
},
309 {"wallop", UMODE_WALLOP
},
310 {"external", UMODE_EXTERNAL
},
312 {"operwall", UMODE_OPERWALL
},
313 {"operspy", UMODE_OPERSPY
},
317 static struct mode_table flag_table
[] = {
318 {"encrypted", OPER_ENCRYPTED
},
319 {"local_kill", OPER_LOCKILL
},
320 {"global_kill", OPER_GLOBKILL
|OPER_LOCKILL
},
321 {"remote", OPER_REMOTE
},
322 {"kline", OPER_KLINE
},
323 {"unkline", OPER_UNKLINE
},
324 {"gline", OPER_GLINE
},
325 {"nick_changes", OPER_NICKS
},
326 {"rehash", OPER_REHASH
},
328 {"admin", OPER_ADMIN
},
329 {"hidden_admin", OPER_HADMIN
},
330 {"xline", OPER_XLINE
},
331 {"operwall", OPER_OPERWALL
},
332 {"oper_spy", OPER_SPY
},
333 {"hidden_oper", OPER_INVIS
},
334 {"remoteban", OPER_REMOTEBAN
},
338 static struct mode_table auth_table
[] = {
339 {"encrypted", CONF_FLAGS_ENCRYPTED
},
340 {"spoof_notice", CONF_FLAGS_SPOOF_NOTICE
},
341 {"exceed_limit", CONF_FLAGS_NOLIMIT
},
342 {"kline_exempt", CONF_FLAGS_EXEMPTKLINE
},
343 {"gline_exempt", CONF_FLAGS_EXEMPTGLINE
},
344 {"flood_exempt", CONF_FLAGS_EXEMPTFLOOD
},
345 {"spambot_exempt", CONF_FLAGS_EXEMPTSPAMBOT
},
346 {"shide_exempt", CONF_FLAGS_EXEMPTSHIDE
},
347 {"jupe_exempt", CONF_FLAGS_EXEMPTJUPE
},
348 {"resv_exempt", CONF_FLAGS_EXEMPTRESV
},
349 {"no_tilde", CONF_FLAGS_NO_TILDE
},
350 {"need_ident", CONF_FLAGS_NEED_IDENTD
},
351 {"have_ident", CONF_FLAGS_NEED_IDENTD
},
355 static struct mode_table connect_table
[] = {
356 { "autoconn", SERVER_AUTOCONN
},
357 { "compressed", SERVER_COMPRESSED
},
358 { "encrypted", SERVER_ENCRYPTED
},
359 { "topicburst", SERVER_TB
},
363 static struct mode_table cluster_table
[] = {
364 { "kline", SHARED_PKLINE
},
365 { "tkline", SHARED_TKLINE
},
366 { "unkline", SHARED_UNKLINE
},
367 { "locops", SHARED_LOCOPS
},
368 { "xline", SHARED_PXLINE
},
369 { "txline", SHARED_TXLINE
},
370 { "unxline", SHARED_UNXLINE
},
371 { "resv", SHARED_PRESV
},
372 { "tresv", SHARED_TRESV
},
373 { "unresv", SHARED_UNRESV
},
374 { "all", CLUSTER_ALL
},
378 static struct mode_table shared_table
[] =
380 { "kline", SHARED_PKLINE
|SHARED_TKLINE
},
381 { "xline", SHARED_PXLINE
|SHARED_TXLINE
},
382 { "resv", SHARED_PRESV
|SHARED_TRESV
},
383 { "tkline", SHARED_TKLINE
},
384 { "unkline", SHARED_UNKLINE
},
385 { "txline", SHARED_TXLINE
},
386 { "unxline", SHARED_UNXLINE
},
387 { "tresv", SHARED_TRESV
},
388 { "unresv", SHARED_UNRESV
},
389 { "locops", SHARED_LOCOPS
},
390 { "all", SHARED_ALL
},
397 find_umode(struct mode_table
*tab
, const char *name
)
401 for (i
= 0; tab
[i
].name
; i
++)
403 if(strcmp(tab
[i
].name
, name
) == 0)
411 set_modes_from_table(int *modes
, const char *whatis
, struct mode_table
*tab
, conf_parm_t
* args
)
413 for (; args
; args
= args
->next
)
419 if((args
->type
& CF_MTYPE
) != CF_STRING
)
421 conf_report_error("Warning -- %s is not a string; ignoring.", whatis
);
425 umode
= args
->v
.string
;
433 mode
= find_umode(tab
, umode
);
437 conf_report_error("Warning -- unknown %s %s.", whatis
, args
->v
.string
);
454 conf_begin_oper(struct TopConf
*tc
)
457 dlink_node
*next_ptr
;
461 free_oper_conf(yy_oper
);
465 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
467 free_oper_conf(ptr
->data
);
468 dlinkDestroy(ptr
, &yy_oper_list
);
471 yy_oper
= make_oper_conf();
472 yy_oper
->flags
|= OPER_ENCRYPTED
|OPER_OPERWALL
|OPER_REMOTEBAN
;
478 conf_end_oper(struct TopConf
*tc
)
480 struct oper_conf
*yy_tmpoper
;
482 dlink_node
*next_ptr
;
484 if(conf_cur_block_name
!= NULL
)
486 if(strlen(conf_cur_block_name
) > OPERNICKLEN
)
487 conf_cur_block_name
[OPERNICKLEN
] = '\0';
489 DupString(yy_oper
->name
, conf_cur_block_name
);
492 if(EmptyString(yy_oper
->name
))
494 conf_report_error("Ignoring operator block -- missing name.");
498 #ifdef HAVE_LIBCRYPTO
499 if(EmptyString(yy_oper
->passwd
) && EmptyString(yy_oper
->rsa_pubkey_file
))
501 if(EmptyString(yy_oper
->passwd
))
504 conf_report_error("Ignoring operator block for %s -- missing password",
509 /* now, yy_oper_list contains a stack of oper_conf's with just user
510 * and host in, yy_oper contains the rest of the information which
511 * we need to copy into each element in yy_oper_list
513 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_oper_list
.head
)
515 yy_tmpoper
= ptr
->data
;
517 DupString(yy_tmpoper
->name
, yy_oper
->name
);
519 /* could be an rsa key instead.. */
520 if(!EmptyString(yy_oper
->passwd
))
521 DupString(yy_tmpoper
->passwd
, yy_oper
->passwd
);
523 yy_tmpoper
->flags
= yy_oper
->flags
;
524 yy_tmpoper
->umodes
= yy_oper
->umodes
;
526 #ifdef HAVE_LIBCRYPTO
527 if(yy_oper
->rsa_pubkey_file
)
531 if((file
= BIO_new_file(yy_oper
->rsa_pubkey_file
, "r")) == NULL
)
533 conf_report_error("Ignoring operator block for %s -- "
534 "rsa_public_key_file cant be opened",
539 yy_tmpoper
->rsa_pubkey
=
540 (RSA
*) PEM_read_bio_RSA_PUBKEY(file
, NULL
, 0, NULL
);
542 BIO_set_close(file
, BIO_CLOSE
);
545 if(yy_tmpoper
->rsa_pubkey
== NULL
)
547 conf_report_error("Ignoring operator block for %s -- "
548 "rsa_public_key_file key invalid; check syntax",
555 /* all is ok, put it on oper_conf_list */
556 dlinkMoveNode(ptr
, &yy_oper_list
, &oper_conf_list
);
559 free_oper_conf(yy_oper
);
566 conf_set_oper_flags(void *data
)
568 conf_parm_t
*args
= data
;
570 set_modes_from_table(&yy_oper
->flags
, "flag", flag_table
, args
);
574 conf_set_oper_user(void *data
)
576 struct oper_conf
*yy_tmpoper
;
578 char *host
= (char *) data
;
580 yy_tmpoper
= make_oper_conf();
582 if((p
= strchr(host
, '@')))
586 DupString(yy_tmpoper
->username
, host
);
587 DupString(yy_tmpoper
->host
, p
);
592 DupString(yy_tmpoper
->username
, "*");
593 DupString(yy_tmpoper
->host
, host
);
596 if(EmptyString(yy_tmpoper
->username
) || EmptyString(yy_tmpoper
->host
))
598 conf_report_error("Ignoring user -- missing username/host");
599 free_oper_conf(yy_tmpoper
);
603 dlinkAddAlloc(yy_tmpoper
, &yy_oper_list
);
607 conf_set_oper_password(void *data
)
611 memset(yy_oper
->passwd
, 0, strlen(yy_oper
->passwd
));
612 MyFree(yy_oper
->passwd
);
615 DupString(yy_oper
->passwd
, (char *) data
);
619 conf_set_oper_rsa_public_key_file(void *data
)
621 #ifdef HAVE_LIBCRYPTO
622 MyFree(yy_oper
->rsa_pubkey_file
);
623 DupString(yy_oper
->rsa_pubkey_file
, (char *) data
);
625 conf_report_error("Warning -- ignoring rsa_public_key_file (OpenSSL support not available");
630 conf_set_oper_umodes(void *data
)
632 set_modes_from_table(&yy_oper
->umodes
, "umode", umode_table
, data
);
636 conf_begin_class(struct TopConf
*tc
)
639 free_class(yy_class
);
641 yy_class
= make_class();
646 conf_end_class(struct TopConf
*tc
)
648 if(conf_cur_block_name
!= NULL
)
649 DupString(yy_class
->class_name
, conf_cur_block_name
);
651 if(EmptyString(yy_class
->class_name
))
653 conf_report_error("Ignoring connect block -- missing name.");
663 conf_set_class_ping_time(void *data
)
665 yy_class
->ping_freq
= *(unsigned int *) data
;
669 conf_set_class_cidr_bitlen(void *data
)
672 unsigned int maxsize
= 128;
674 unsigned int maxsize
= 32;
676 if(*(unsigned int *) data
> maxsize
)
678 ("class::cidr_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
679 *(unsigned int *) data
, maxsize
);
681 yy_class
->cidr_bitlen
= *(unsigned int *) data
;
685 conf_set_class_number_per_cidr(void *data
)
687 yy_class
->cidr_amount
= *(unsigned int *) data
;
691 conf_set_class_number_per_ip(void *data
)
693 yy_class
->max_local
= *(unsigned int *) data
;
698 conf_set_class_number_per_ip_global(void *data
)
700 yy_class
->max_global
= *(unsigned int *) data
;
704 conf_set_class_number_per_ident(void *data
)
706 yy_class
->max_ident
= *(unsigned int *) data
;
710 conf_set_class_connectfreq(void *data
)
712 yy_class
->con_freq
= *(unsigned int *) data
;
716 conf_set_class_max_number(void *data
)
718 yy_class
->max_total
= *(unsigned int *) data
;
722 conf_set_class_sendq(void *data
)
724 yy_class
->max_sendq
= *(unsigned int *) data
;
727 static char *listener_address
;
730 conf_begin_listen(struct TopConf
*tc
)
732 MyFree(listener_address
);
733 listener_address
= NULL
;
738 conf_end_listen(struct TopConf
*tc
)
740 MyFree(listener_address
);
741 listener_address
= NULL
;
746 conf_set_listen_port(void *data
)
748 conf_parm_t
*args
= data
;
749 for (; args
; args
= args
->next
)
751 if((args
->type
& CF_MTYPE
) != CF_INT
)
754 ("listener::port argument is not an integer " "-- ignoring.");
757 if(listener_address
== NULL
)
759 add_listener(args
->v
.number
, listener_address
, AF_INET
);
761 add_listener(args
->v
.number
, listener_address
, AF_INET6
);
768 if(strchr(listener_address
, ':') != NULL
)
774 add_listener(args
->v
.number
, listener_address
, family
);
782 conf_set_listen_address(void *data
)
784 MyFree(listener_address
);
785 DupString(listener_address
, data
);
789 conf_begin_auth(struct TopConf
*tc
)
792 dlink_node
*next_ptr
;
797 MyFree(yy_aconf_class
);
798 yy_aconf_class
= NULL
;
800 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
802 free_conf(ptr
->data
);
803 dlinkDestroy(ptr
, &yy_aconf_list
);
806 yy_aconf
= make_conf();
807 yy_aconf
->status
= CONF_CLIENT
;
813 conf_end_auth(struct TopConf
*tc
)
815 struct ConfItem
*yy_tmp
;
817 dlink_node
*next_ptr
;
819 if(EmptyString(yy_aconf
->name
))
820 DupString(yy_aconf
->name
, "NOMATCH");
822 /* didnt even get one ->host? */
823 if(EmptyString(yy_aconf
->host
))
825 conf_report_error("Ignoring auth block -- missing user@host");
829 /* so the stacking works in order.. */
830 collapse(yy_aconf
->user
);
831 collapse(yy_aconf
->host
);
832 conf_add_class_to_conf(yy_aconf
, yy_aconf_class
);
833 add_conf_by_address(yy_aconf
->host
, CONF_CLIENT
, yy_aconf
->user
, yy_aconf
);
835 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_aconf_list
.head
)
840 DupString(yy_tmp
->passwd
, yy_aconf
->passwd
);
842 /* this will always exist.. */
843 DupString(yy_tmp
->name
, yy_aconf
->name
);
845 yy_tmp
->flags
= yy_aconf
->flags
;
846 yy_tmp
->port
= yy_aconf
->port
;
848 collapse(yy_tmp
->user
);
849 collapse(yy_tmp
->host
);
851 conf_add_class_to_conf(yy_tmp
, yy_aconf_class
);
853 add_conf_by_address(yy_tmp
->host
, CONF_CLIENT
, yy_tmp
->user
, yy_tmp
);
854 dlinkDestroy(ptr
, &yy_aconf_list
);
857 MyFree(yy_aconf_class
);
859 yy_aconf_class
= NULL
;
865 conf_set_auth_user(void *data
)
867 struct ConfItem
*yy_tmp
;
870 /* The first user= line doesn't allocate a new conf */
871 if(!EmptyString(yy_aconf
->host
))
873 yy_tmp
= make_conf();
874 yy_tmp
->status
= CONF_CLIENT
;
879 if((p
= strchr(data
, '@')))
883 DupString(yy_tmp
->user
, data
);
884 DupString(yy_tmp
->host
, p
);
888 DupString(yy_tmp
->user
, "*");
889 DupString(yy_tmp
->host
, data
);
892 if(yy_aconf
!= yy_tmp
)
893 dlinkAddAlloc(yy_tmp
, &yy_aconf_list
);
897 conf_set_auth_passwd(void *data
)
900 memset(yy_aconf
->passwd
, 0, strlen(yy_aconf
->passwd
));
901 MyFree(yy_aconf
->passwd
);
902 DupString(yy_aconf
->passwd
, data
);
906 conf_set_auth_spoof(void *data
)
914 /* user@host spoof */
915 if((p
= strchr(host
, '@')) != NULL
)
921 if(EmptyString(user
))
923 conf_report_error("Warning -- spoof ident empty.");
927 if(strlen(user
) > USERLEN
)
929 conf_report_error("Warning -- spoof ident length invalid.");
933 if(!valid_username(user
))
935 conf_report_error("Warning -- invalid spoof (ident).");
939 /* this must be restored! */
943 if(EmptyString(host
))
945 conf_report_error("Warning -- spoof host empty.");
949 if(strlen(host
) > HOSTLEN
)
951 conf_report_error("Warning -- spoof host length invalid.");
955 if(!valid_hostname(host
))
957 conf_report_error("Warning -- invalid spoof (host).");
961 MyFree(yy_aconf
->name
);
962 DupString(yy_aconf
->name
, data
);
963 yy_aconf
->flags
|= CONF_FLAGS_SPOOF_IP
;
967 conf_set_auth_flags(void *data
)
969 conf_parm_t
*args
= data
;
971 set_modes_from_table((int *) &yy_aconf
->flags
, "flag", auth_table
, args
);
975 conf_set_auth_redir_serv(void *data
)
977 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
978 MyFree(yy_aconf
->name
);
979 DupString(yy_aconf
->name
, data
);
983 conf_set_auth_redir_port(void *data
)
985 int port
= *(unsigned int *) data
;
987 yy_aconf
->flags
|= CONF_FLAGS_REDIR
;
988 yy_aconf
->port
= port
;
992 conf_set_auth_class(void *data
)
994 MyFree(yy_aconf_class
);
995 DupString(yy_aconf_class
, data
);
998 /* ok, shared_oper handles the stacking, shared_flags handles adding
999 * things.. so all we need to do when we start and end a shared block, is
1000 * clean up anything thats been left over.
1003 conf_cleanup_shared(struct TopConf
*tc
)
1005 dlink_node
*ptr
, *next_ptr
;
1007 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1009 free_remote_conf(ptr
->data
);
1010 dlinkDestroy(ptr
, &yy_shared_list
);
1013 if(yy_shared
!= NULL
)
1015 free_remote_conf(yy_shared
);
1023 conf_set_shared_oper(void *data
)
1025 conf_parm_t
*args
= data
;
1026 const char *username
;
1029 if(yy_shared
!= NULL
)
1030 free_remote_conf(yy_shared
);
1032 yy_shared
= make_remote_conf();
1034 if(args
->next
!= NULL
)
1036 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1038 conf_report_error("Ignoring shared::oper -- server is not a qstring");
1042 DupString(yy_shared
->server
, args
->v
.string
);
1046 DupString(yy_shared
->server
, "*");
1048 if((args
->type
& CF_MTYPE
) != CF_QSTRING
)
1050 conf_report_error("Ignoring shared::oper -- oper is not a qstring");
1054 if((p
= strchr(args
->v
.string
, '@')) == NULL
)
1056 conf_report_error("Ignoring shard::oper -- oper is not a user@host");
1060 username
= args
->v
.string
;
1064 DupString(yy_shared
->host
, "*");
1066 DupString(yy_shared
->host
, p
);
1068 if(EmptyString(username
))
1069 DupString(yy_shared
->username
, "*");
1071 DupString(yy_shared
->username
, username
);
1073 dlinkAddAlloc(yy_shared
, &yy_shared_list
);
1078 conf_set_shared_flags(void *data
)
1080 conf_parm_t
*args
= data
;
1082 dlink_node
*ptr
, *next_ptr
;
1084 if(yy_shared
!= NULL
)
1085 free_remote_conf(yy_shared
);
1087 set_modes_from_table(&flags
, "flag", shared_table
, args
);
1089 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_shared_list
.head
)
1091 yy_shared
= ptr
->data
;
1093 yy_shared
->flags
= flags
;
1094 dlinkDestroy(ptr
, &yy_shared_list
);
1095 dlinkAddTail(yy_shared
, &yy_shared
->node
, &shared_conf_list
);
1102 conf_begin_connect(struct TopConf
*tc
)
1105 free_server_conf(yy_server
);
1107 yy_server
= make_server_conf();
1108 yy_server
->port
= PORTNUM
;
1110 if(conf_cur_block_name
!= NULL
)
1111 DupString(yy_server
->name
, conf_cur_block_name
);
1117 conf_end_connect(struct TopConf
*tc
)
1119 if(EmptyString(yy_server
->name
))
1121 conf_report_error("Ignoring connect block -- missing name.");
1125 if(EmptyString(yy_server
->passwd
) || EmptyString(yy_server
->spasswd
))
1127 conf_report_error("Ignoring connect block for %s -- missing password.",
1132 if(EmptyString(yy_server
->host
))
1134 conf_report_error("Ignoring connect block for %s -- missing host.",
1140 if(ServerConfCompressed(yy_server
))
1142 conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
1143 yy_server
->flags
&= ~SERVER_COMPRESSED
;
1147 add_server_conf(yy_server
);
1148 dlinkAdd(yy_server
, &yy_server
->node
, &server_conf_list
);
1155 conf_set_connect_host(void *data
)
1157 MyFree(yy_server
->host
);
1158 DupString(yy_server
->host
, data
);
1162 conf_set_connect_vhost(void *data
)
1164 if(inetpton_sock(data
, (struct sockaddr
*)&yy_server
->my_ipnum
) <= 0)
1166 conf_report_error("Invalid netmask for server vhost (%s)",
1171 yy_server
->flags
|= SERVER_VHOSTED
;
1175 conf_set_connect_send_password(void *data
)
1177 if(yy_server
->spasswd
)
1179 memset(yy_server
->spasswd
, 0, strlen(yy_server
->spasswd
));
1180 MyFree(yy_server
->spasswd
);
1183 DupString(yy_server
->spasswd
, data
);
1187 conf_set_connect_accept_password(void *data
)
1189 if(yy_server
->passwd
)
1191 memset(yy_server
->passwd
, 0, strlen(yy_server
->passwd
));
1192 MyFree(yy_server
->passwd
);
1194 DupString(yy_server
->passwd
, data
);
1198 conf_set_connect_port(void *data
)
1200 int port
= *(unsigned int *) data
;
1205 yy_server
->port
= port
;
1209 conf_set_connect_aftype(void *data
)
1213 if(strcasecmp(aft
, "ipv4") == 0)
1214 yy_server
->ipnum
.ss_family
= AF_INET
;
1216 else if(strcasecmp(aft
, "ipv6") == 0)
1217 yy_server
->ipnum
.ss_family
= AF_INET6
;
1220 conf_report_error("connect::aftype '%s' is unknown.", aft
);
1224 conf_set_connect_flags(void *data
)
1226 conf_parm_t
*args
= data
;
1228 /* note, we allow them to set compressed, then remove it later if
1229 * they do and LIBZ isnt available
1231 set_modes_from_table(&yy_server
->flags
, "flag", connect_table
, args
);
1235 conf_set_connect_hub_mask(void *data
)
1237 struct remote_conf
*yy_hub
;
1239 if(EmptyString(yy_server
->name
))
1242 yy_hub
= make_remote_conf();
1243 yy_hub
->flags
= CONF_HUB
;
1245 DupString(yy_hub
->host
, data
);
1246 DupString(yy_hub
->server
, yy_server
->name
);
1247 dlinkAdd(yy_hub
, &yy_hub
->node
, &hubleaf_conf_list
);
1251 conf_set_connect_leaf_mask(void *data
)
1253 struct remote_conf
*yy_leaf
;
1255 if(EmptyString(yy_server
->name
))
1258 yy_leaf
= make_remote_conf();
1259 yy_leaf
->flags
= CONF_LEAF
;
1261 DupString(yy_leaf
->host
, data
);
1262 DupString(yy_leaf
->server
, yy_server
->name
);
1263 dlinkAdd(yy_leaf
, &yy_leaf
->node
, &hubleaf_conf_list
);
1267 conf_set_connect_class(void *data
)
1269 MyFree(yy_server
->class_name
);
1270 DupString(yy_server
->class_name
, data
);
1274 conf_set_exempt_ip(void *data
)
1276 struct ConfItem
*yy_tmp
;
1278 if(parse_netmask(data
, NULL
, NULL
) == HM_HOST
)
1280 conf_report_error("Ignoring exempt -- invalid exempt::ip.");
1284 yy_tmp
= make_conf();
1285 DupString(yy_tmp
->passwd
, "*");
1286 DupString(yy_tmp
->host
, data
);
1287 yy_tmp
->status
= CONF_EXEMPTDLINE
;
1288 add_conf_by_address(yy_tmp
->host
, CONF_EXEMPTDLINE
, NULL
, yy_tmp
);
1292 conf_cleanup_cluster(struct TopConf
*tc
)
1294 dlink_node
*ptr
, *next_ptr
;
1296 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1298 free_remote_conf(ptr
->data
);
1299 dlinkDestroy(ptr
, &yy_cluster_list
);
1302 if(yy_shared
!= NULL
)
1304 free_remote_conf(yy_shared
);
1312 conf_set_cluster_name(void *data
)
1314 if(yy_shared
!= NULL
)
1315 free_remote_conf(yy_shared
);
1317 yy_shared
= make_remote_conf();
1318 DupString(yy_shared
->server
, data
);
1319 dlinkAddAlloc(yy_shared
, &yy_cluster_list
);
1325 conf_set_cluster_flags(void *data
)
1327 conf_parm_t
*args
= data
;
1329 dlink_node
*ptr
, *next_ptr
;
1331 if(yy_shared
!= NULL
)
1332 free_remote_conf(yy_shared
);
1334 set_modes_from_table(&flags
, "flag", cluster_table
, args
);
1336 DLINK_FOREACH_SAFE(ptr
, next_ptr
, yy_cluster_list
.head
)
1338 yy_shared
= ptr
->data
;
1339 yy_shared
->flags
= flags
;
1340 dlinkAddTail(yy_shared
, &yy_shared
->node
, &cluster_conf_list
);
1341 dlinkDestroy(ptr
, &yy_cluster_list
);
1348 conf_set_general_havent_read_conf(void *data
)
1350 if(*(unsigned int *) data
)
1352 conf_report_error("You haven't read your config file properly.");
1354 ("There is a line in the example conf that will kill your server if not removed.");
1356 ("Consider actually reading/editing the conf file, and removing this line.");
1363 conf_set_general_hide_error_messages(void *data
)
1367 if(strcasecmp(val
, "yes") == 0)
1368 ConfigFileEntry
.hide_error_messages
= 2;
1369 else if(strcasecmp(val
, "opers") == 0)
1370 ConfigFileEntry
.hide_error_messages
= 1;
1371 else if(strcasecmp(val
, "no") == 0)
1372 ConfigFileEntry
.hide_error_messages
= 0;
1374 conf_report_error("Invalid setting '%s' for general::hide_error_messages.", val
);
1378 conf_set_general_kline_delay(void *data
)
1380 ConfigFileEntry
.kline_delay
= *(unsigned int *) data
;
1382 /* THIS MUST BE HERE to stop us being unable to check klines */
1387 conf_set_general_stats_k_oper_only(void *data
)
1391 if(strcasecmp(val
, "yes") == 0)
1392 ConfigFileEntry
.stats_k_oper_only
= 2;
1393 else if(strcasecmp(val
, "masked") == 0)
1394 ConfigFileEntry
.stats_k_oper_only
= 1;
1395 else if(strcasecmp(val
, "no") == 0)
1396 ConfigFileEntry
.stats_k_oper_only
= 0;
1398 conf_report_error("Invalid setting '%s' for general::stats_k_oper_only.", val
);
1402 conf_set_general_stats_i_oper_only(void *data
)
1406 if(strcasecmp(val
, "yes") == 0)
1407 ConfigFileEntry
.stats_i_oper_only
= 2;
1408 else if(strcasecmp(val
, "masked") == 0)
1409 ConfigFileEntry
.stats_i_oper_only
= 1;
1410 else if(strcasecmp(val
, "no") == 0)
1411 ConfigFileEntry
.stats_i_oper_only
= 0;
1413 conf_report_error("Invalid setting '%s' for general::stats_i_oper_only.", val
);
1417 conf_set_general_compression_level(void *data
)
1420 ConfigFileEntry
.compression_level
= *(unsigned int *) data
;
1422 if((ConfigFileEntry
.compression_level
< 1) || (ConfigFileEntry
.compression_level
> 9))
1425 ("Invalid general::compression_level %d -- using default.",
1426 ConfigFileEntry
.compression_level
);
1427 ConfigFileEntry
.compression_level
= 0;
1430 conf_report_error("Ignoring general::compression_level -- zlib not available.");
1435 conf_set_general_oper_umodes(void *data
)
1437 set_modes_from_table(&ConfigFileEntry
.oper_umodes
, "umode", umode_table
, data
);
1441 conf_set_general_oper_only_umodes(void *data
)
1443 set_modes_from_table(&ConfigFileEntry
.oper_only_umodes
, "umode", umode_table
, data
);
1447 conf_set_serverhide_links_delay(void *data
)
1449 int val
= *(unsigned int *) data
;
1451 if((val
> 0) && ConfigServerHide
.links_disabled
== 1)
1453 eventAddIsh("cache_links", cache_links
, NULL
, val
);
1454 ConfigServerHide
.links_disabled
= 0;
1456 else if(val
!= ConfigServerHide
.links_delay
)
1457 eventUpdate("cache_links", val
);
1459 ConfigServerHide
.links_delay
= val
;
1462 #ifdef ENABLE_SERVICES
1464 conf_begin_service(struct TopConf
*tc
)
1466 struct Client
*target_p
;
1469 DLINK_FOREACH(ptr
, global_serv_list
.head
)
1471 target_p
= ptr
->data
;
1473 target_p
->flags
&= ~FLAGS_SERVICE
;
1480 conf_set_service_name(void *data
)
1482 struct Client
*target_p
;
1487 for(s
= data
; *s
!= '\0'; s
++)
1491 conf_report_error("Ignoring service::name "
1492 "-- bogus servername.");
1501 conf_report_error("Ignoring service::name -- must contain '.'");
1505 DupString(tmp
, data
);
1506 dlinkAddAlloc(tmp
, &service_list
);
1508 if((target_p
= find_server(NULL
, tmp
)))
1509 target_p
->flags
|= FLAGS_SERVICE
;
1513 /* public functions */
1517 conf_report_error(const char *fmt
, ...)
1520 char msg
[IRCD_BUFSIZE
+ 1] = { 0 };
1523 ircvsnprintf(msg
, IRCD_BUFSIZE
, fmt
, ap
);
1528 conf_parse_failure
++;
1529 fprintf(stderr
, "\"%s\", line %d: %s\n", current_file
, lineno
+ 1, msg
);
1533 ilog(L_MAIN
, "\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1534 sendto_realops_flags(UMODE_ALL
, L_ALL
, "\"%s\", line %d: %s", current_file
, lineno
+ 1, msg
);
1538 conf_start_block(char *block
, char *name
)
1540 if((conf_cur_block
= find_top_conf(block
)) == NULL
)
1542 conf_report_error("Configuration block '%s' is not defined.", block
);
1547 DupString(conf_cur_block_name
, name
);
1549 conf_cur_block_name
= NULL
;
1551 if(conf_cur_block
->tc_sfunc
)
1552 if(conf_cur_block
->tc_sfunc(conf_cur_block
) < 0)
1559 conf_end_block(struct TopConf
*tc
)
1562 return tc
->tc_efunc(tc
);
1564 MyFree(conf_cur_block_name
);
1569 conf_set_generic_int(void *data
, void *location
)
1571 *((int *) location
) = *((unsigned int *) data
);
1575 conf_set_generic_string(void *data
, int len
, void *location
)
1577 char **loc
= location
;
1580 if(len
&& strlen(input
) > len
)
1584 DupString(*loc
, input
);
1588 conf_call_set(struct TopConf
*tc
, char *item
, conf_parm_t
* value
, int type
)
1590 struct ConfEntry
*cf
;
1596 if((cf
= find_conf_item(tc
, item
)) == NULL
)
1599 ("Non-existant configuration setting %s::%s.", tc
->tc_name
, (char *) item
);
1603 /* if it takes one thing, make sure they only passed one thing,
1604 and handle as needed. */
1605 if(value
->type
& CF_FLIST
&& !cf
->cf_type
& CF_FLIST
)
1608 ("Option %s::%s does not take a list of values.", tc
->tc_name
, item
);
1615 if(CF_TYPE(value
->v
.list
->type
) != CF_TYPE(cf
->cf_type
))
1617 /* if it expects a string value, but we got a yesno,
1620 if((CF_TYPE(value
->v
.list
->type
) == CF_YESNO
) &&
1621 (CF_TYPE(cf
->cf_type
) == CF_STRING
))
1623 value
->v
.list
->type
= CF_STRING
;
1625 if(cp
->v
.number
== 1)
1626 DupString(cp
->v
.string
, "yes");
1628 DupString(cp
->v
.string
, "no");
1631 /* maybe it's a CF_TIME and they passed CF_INT --
1632 should still be valid */
1633 else if(!((CF_TYPE(value
->v
.list
->type
) == CF_INT
) &&
1634 (CF_TYPE(cf
->cf_type
) == CF_TIME
)))
1637 ("Wrong type for %s::%s (expected %s, got %s)",
1638 tc
->tc_name
, (char *) item
,
1639 conf_strtype(cf
->cf_type
), conf_strtype(value
->v
.list
->type
));
1644 if(cf
->cf_type
& CF_FLIST
)
1648 conf_set_generic_list(value
->v
.list
, cf
->cf_arg
);
1651 /* just pass it the extended argument list */
1652 cf
->cf_func(value
->v
.list
);
1656 /* it's old-style, needs only one arg */
1657 switch (cf
->cf_type
)
1663 conf_set_generic_int(&cp
->v
.number
, cf
->cf_arg
);
1665 cf
->cf_func(&cp
->v
.number
);
1669 if(EmptyString(cp
->v
.string
))
1670 conf_report_error("Ignoring %s::%s -- empty field",
1673 conf_set_generic_string(cp
->v
.string
, cf
->cf_len
, cf
->cf_arg
);
1675 cf
->cf_func(cp
->v
.string
);
1685 add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *))
1688 struct ConfEntry
*cf
;
1690 if((tc
= find_top_conf(topconf
)) == NULL
)
1693 if((cf
= find_conf_item(tc
, name
)) != NULL
)
1696 cf
= MyMalloc(sizeof(struct ConfEntry
));
1698 DupString(cf
->cf_name
, name
);
1703 dlinkAddAlloc(cf
, &tc
->tc_items
);
1710 remove_conf_item(const char *topconf
, const char *name
)
1713 struct ConfEntry
*cf
;
1716 if((tc
= find_top_conf(topconf
)) == NULL
)
1719 if((cf
= find_conf_item(tc
, name
)) == NULL
)
1722 if((ptr
= dlinkFind(cf
, &tc
->tc_items
)) == NULL
)
1725 dlinkDestroy(ptr
, &tc
->tc_items
);
1726 MyFree(cf
->cf_name
);
1734 static struct ConfEntry conf_serverinfo_table
[] =
1736 { "description", CF_QSTRING
, NULL
, 0, &ServerInfo
.description
},
1737 { "network_desc", CF_QSTRING
, NULL
, 0, &ServerInfo
.network_desc
},
1738 { "hub", CF_YESNO
, NULL
, 0, &ServerInfo
.hub
},
1739 { "use_ts6", CF_YESNO
, NULL
, 0, &ServerInfo
.use_ts6
},
1740 { "default_max_clients",CF_INT
, NULL
, 0, &ServerInfo
.default_max_clients
},
1742 { "network_name", CF_QSTRING
, conf_set_serverinfo_network_name
, 0, NULL
},
1743 { "name", CF_QSTRING
, conf_set_serverinfo_name
, 0, NULL
},
1744 { "sid", CF_QSTRING
, conf_set_serverinfo_sid
, 0, NULL
},
1745 { "vhost", CF_QSTRING
, conf_set_serverinfo_vhost
, 0, NULL
},
1746 { "vhost6", CF_QSTRING
, conf_set_serverinfo_vhost6
, 0, NULL
},
1748 { "\0", 0, NULL
, 0, NULL
}
1751 static struct ConfEntry conf_admin_table
[] =
1753 { "name", CF_QSTRING
, NULL
, 200, &AdminInfo
.name
},
1754 { "description",CF_QSTRING
, NULL
, 200, &AdminInfo
.description
},
1755 { "email", CF_QSTRING
, NULL
, 200, &AdminInfo
.email
},
1756 { "\0", 0, NULL
, 0, NULL
}
1759 static struct ConfEntry conf_log_table
[] =
1761 { "fname_userlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_userlog
},
1762 { "fname_fuserlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_fuserlog
},
1763 { "fname_operlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_operlog
},
1764 { "fname_foperlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_foperlog
},
1765 { "fname_serverlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_serverlog
},
1766 { "fname_killlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_killlog
},
1767 { "fname_glinelog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_glinelog
},
1768 { "fname_klinelog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_klinelog
},
1769 { "fname_operspylog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_operspylog
},
1770 { "fname_ioerrorlog", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.fname_ioerrorlog
},
1771 { "\0", 0, NULL
, 0, NULL
}
1774 static struct ConfEntry conf_operator_table
[] =
1776 { "rsa_public_key_file", CF_QSTRING
, conf_set_oper_rsa_public_key_file
, 0, NULL
},
1777 { "flags", CF_STRING
| CF_FLIST
, conf_set_oper_flags
, 0, NULL
},
1778 { "umodes", CF_STRING
| CF_FLIST
, conf_set_oper_umodes
, 0, NULL
},
1779 { "user", CF_QSTRING
, conf_set_oper_user
, 0, NULL
},
1780 { "password", CF_QSTRING
, conf_set_oper_password
, 0, NULL
},
1781 { "\0", 0, NULL
, 0, NULL
}
1784 static struct ConfEntry conf_class_table
[] =
1786 { "ping_time", CF_TIME
, conf_set_class_ping_time
, 0, NULL
},
1787 { "cidr_bitlen", CF_INT
, conf_set_class_cidr_bitlen
, 0, NULL
},
1788 { "number_per_cidr", CF_INT
, conf_set_class_number_per_cidr
, 0, NULL
},
1789 { "number_per_ip", CF_INT
, conf_set_class_number_per_ip
, 0, NULL
},
1790 { "number_per_ip_global", CF_INT
,conf_set_class_number_per_ip_global
, 0, NULL
},
1791 { "number_per_ident", CF_INT
, conf_set_class_number_per_ident
, 0, NULL
},
1792 { "connectfreq", CF_TIME
, conf_set_class_connectfreq
, 0, NULL
},
1793 { "max_number", CF_INT
, conf_set_class_max_number
, 0, NULL
},
1794 { "sendq", CF_TIME
, conf_set_class_sendq
, 0, NULL
},
1795 { "\0", 0, NULL
, 0, NULL
}
1798 static struct ConfEntry conf_auth_table
[] =
1800 { "user", CF_QSTRING
, conf_set_auth_user
, 0, NULL
},
1801 { "password", CF_QSTRING
, conf_set_auth_passwd
, 0, NULL
},
1802 { "class", CF_QSTRING
, conf_set_auth_class
, 0, NULL
},
1803 { "spoof", CF_QSTRING
, conf_set_auth_spoof
, 0, NULL
},
1804 { "redirserv", CF_QSTRING
, conf_set_auth_redir_serv
, 0, NULL
},
1805 { "redirport", CF_INT
, conf_set_auth_redir_port
, 0, NULL
},
1806 { "flags", CF_STRING
| CF_FLIST
, conf_set_auth_flags
, 0, NULL
},
1807 { "\0", 0, NULL
, 0, NULL
}
1810 static struct ConfEntry conf_connect_table
[] =
1812 { "send_password", CF_QSTRING
, conf_set_connect_send_password
, 0, NULL
},
1813 { "accept_password", CF_QSTRING
, conf_set_connect_accept_password
, 0, NULL
},
1814 { "flags", CF_STRING
| CF_FLIST
, conf_set_connect_flags
, 0, NULL
},
1815 { "host", CF_QSTRING
, conf_set_connect_host
, 0, NULL
},
1816 { "vhost", CF_QSTRING
, conf_set_connect_vhost
, 0, NULL
},
1817 { "port", CF_INT
, conf_set_connect_port
, 0, NULL
},
1818 { "aftype", CF_STRING
, conf_set_connect_aftype
, 0, NULL
},
1819 { "hub_mask", CF_QSTRING
, conf_set_connect_hub_mask
, 0, NULL
},
1820 { "leaf_mask", CF_QSTRING
, conf_set_connect_leaf_mask
, 0, NULL
},
1821 { "class", CF_QSTRING
, conf_set_connect_class
, 0, NULL
},
1822 { "\0", 0, NULL
, 0, NULL
}
1825 static struct ConfEntry conf_general_table
[] =
1827 { "oper_only_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_only_umodes
, 0, NULL
},
1828 { "oper_umodes", CF_STRING
| CF_FLIST
, conf_set_general_oper_umodes
, 0, NULL
},
1829 { "compression_level", CF_INT
, conf_set_general_compression_level
, 0, NULL
},
1830 { "havent_read_conf", CF_YESNO
, conf_set_general_havent_read_conf
, 0, NULL
},
1831 { "hide_error_messages",CF_STRING
, conf_set_general_hide_error_messages
,0, NULL
},
1832 { "kline_delay", CF_TIME
, conf_set_general_kline_delay
, 0, NULL
},
1833 { "stats_k_oper_only", CF_STRING
, conf_set_general_stats_k_oper_only
, 0, NULL
},
1834 { "stats_i_oper_only", CF_STRING
, conf_set_general_stats_i_oper_only
, 0, NULL
},
1836 { "default_operstring", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_operstring
},
1837 { "default_adminstring",CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.default_adminstring
},
1838 { "egdpool_path", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.egdpool_path
},
1839 { "kline_reason", CF_QSTRING
, NULL
, REALLEN
, &ConfigFileEntry
.kline_reason
},
1840 { "servlink_path", CF_QSTRING
, NULL
, MAXPATHLEN
, &ConfigFileEntry
.servlink_path
},
1842 { "anti_spam_exit_message_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.anti_spam_exit_message_time
},
1843 { "disable_fake_channels", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_fake_channels
},
1844 { "min_nonwildcard_simple", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard_simple
},
1845 { "non_redundant_klines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.non_redundant_klines
},
1846 { "tkline_expire_notices", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.tkline_expire_notices
},
1848 { "anti_nick_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.anti_nick_flood
},
1849 { "burst_away", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.burst_away
},
1850 { "caller_id_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.caller_id_wait
},
1851 { "client_exit", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.client_exit
},
1852 { "client_flood", CF_INT
, NULL
, 0, &ConfigFileEntry
.client_flood
},
1853 { "connect_timeout", CF_TIME
, NULL
, 0, &ConfigFileEntry
.connect_timeout
},
1854 { "default_invisible", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.default_invisible
},
1855 { "default_floodcount", CF_INT
, NULL
, 0, &ConfigFileEntry
.default_floodcount
},
1856 { "disable_auth", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.disable_auth
},
1857 { "dot_in_ip6_addr", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dot_in_ip6_addr
},
1858 { "dots_in_ident", CF_INT
, NULL
, 0, &ConfigFileEntry
.dots_in_ident
},
1859 { "failed_oper_notice", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.failed_oper_notice
},
1860 { "glines", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.glines
},
1861 { "gline_min_cidr", CF_INT
, NULL
, 0, &ConfigFileEntry
.gline_min_cidr
},
1862 { "gline_min_cidr6", CF_INT
, NULL
, 0, &ConfigFileEntry
.gline_min_cidr6
},
1863 { "gline_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.gline_time
},
1864 { "idletime", CF_TIME
, NULL
, 0, &ConfigFileEntry
.idletime
},
1865 { "hide_spoof_ips", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.hide_spoof_ips
},
1866 { "dline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.dline_with_reason
},
1867 { "kline_with_reason", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.kline_with_reason
},
1868 { "map_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.map_oper_only
},
1869 { "max_accept", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_accept
},
1870 { "max_monitor", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_monitor
},
1871 { "max_nick_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.max_nick_time
},
1872 { "max_nick_changes", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_nick_changes
},
1873 { "max_targets", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_targets
},
1874 { "max_unknown_ip", CF_INT
, NULL
, 0, &ConfigFileEntry
.max_unknown_ip
},
1875 { "min_nonwildcard", CF_INT
, NULL
, 0, &ConfigFileEntry
.min_nonwildcard
},
1876 { "nick_delay", CF_TIME
, NULL
, 0, &ConfigFileEntry
.nick_delay
},
1877 { "no_oper_flood", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.no_oper_flood
},
1878 { "operspy_admin_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.operspy_admin_only
},
1879 { "pace_wait", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait
},
1880 { "pace_wait_simple", CF_TIME
, NULL
, 0, &ConfigFileEntry
.pace_wait_simple
},
1881 { "ping_cookie", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.ping_cookie
},
1882 { "reject_after_count", CF_INT
, NULL
, 0, &ConfigFileEntry
.reject_after_count
},
1883 { "reject_ban_time", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_ban_time
},
1884 { "reject_duration", CF_TIME
, NULL
, 0, &ConfigFileEntry
.reject_duration
},
1885 { "short_motd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.short_motd
},
1886 { "stats_c_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_c_oper_only
},
1887 { "stats_e_disabled", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_e_disabled
},
1888 { "stats_h_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_h_oper_only
},
1889 { "stats_o_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_o_oper_only
},
1890 { "stats_P_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_P_oper_only
},
1891 { "stats_y_oper_only", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.stats_y_oper_only
},
1892 { "target_change", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.target_change
},
1893 { "ts_max_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_max_delta
},
1894 { "use_egd", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_egd
},
1895 { "ts_warn_delta", CF_TIME
, NULL
, 0, &ConfigFileEntry
.ts_warn_delta
},
1896 { "use_whois_actually", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.use_whois_actually
},
1897 { "warn_no_nline", CF_YESNO
, NULL
, 0, &ConfigFileEntry
.warn_no_nline
},
1898 { "\0", 0, NULL
, 0, NULL
}
1901 static struct ConfEntry conf_channel_table
[] =
1903 { "default_split_user_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_user_count
},
1904 { "default_split_server_count", CF_INT
, NULL
, 0, &ConfigChannel
.default_split_server_count
},
1905 { "burst_topicwho", CF_YESNO
, NULL
, 0, &ConfigChannel
.burst_topicwho
},
1906 { "invite_ops_only", CF_YESNO
, NULL
, 0, &ConfigChannel
.invite_ops_only
},
1907 { "knock_delay", CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay
},
1908 { "knock_delay_channel",CF_TIME
, NULL
, 0, &ConfigChannel
.knock_delay_channel
},
1909 { "max_bans", CF_INT
, NULL
, 0, &ConfigChannel
.max_bans
},
1910 { "max_chans_per_user", CF_INT
, NULL
, 0, &ConfigChannel
.max_chans_per_user
},
1911 { "no_create_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_create_on_split
},
1912 { "no_join_on_split", CF_YESNO
, NULL
, 0, &ConfigChannel
.no_join_on_split
},
1913 { "quiet_on_ban", CF_YESNO
, NULL
, 0, &ConfigChannel
.quiet_on_ban
},
1914 { "use_except", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_except
},
1915 { "use_invex", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_invex
},
1916 { "use_knock", CF_YESNO
, NULL
, 0, &ConfigChannel
.use_knock
},
1917 { "\0", 0, NULL
, 0, NULL
}
1920 static struct ConfEntry conf_serverhide_table
[] =
1922 { "disable_hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.disable_hidden
},
1923 { "flatten_links", CF_YESNO
, NULL
, 0, &ConfigServerHide
.flatten_links
},
1924 { "hidden", CF_YESNO
, NULL
, 0, &ConfigServerHide
.hidden
},
1925 { "links_delay", CF_TIME
, conf_set_serverhide_links_delay
, 0, NULL
},
1926 { "\0", 0, NULL
, 0, NULL
}
1933 add_top_conf("modules", NULL
, NULL
, NULL
);
1934 add_conf_item("modules", "path", CF_QSTRING
, conf_set_modules_path
);
1935 add_conf_item("modules", "module", CF_QSTRING
, conf_set_modules_module
);
1937 add_top_conf("serverinfo", NULL
, NULL
, conf_serverinfo_table
);
1938 add_top_conf("admin", NULL
, NULL
, conf_admin_table
);
1939 add_top_conf("log", NULL
, NULL
, conf_log_table
);
1940 add_top_conf("operator", conf_begin_oper
, conf_end_oper
, conf_operator_table
);
1941 add_top_conf("class", conf_begin_class
, conf_end_class
, conf_class_table
);
1943 add_top_conf("listen", conf_begin_listen
, conf_end_listen
, NULL
);
1944 add_conf_item("listen", "port", CF_INT
| CF_FLIST
, conf_set_listen_port
);
1945 add_conf_item("listen", "ip", CF_QSTRING
, conf_set_listen_address
);
1946 add_conf_item("listen", "host", CF_QSTRING
, conf_set_listen_address
);
1948 add_top_conf("auth", conf_begin_auth
, conf_end_auth
, conf_auth_table
);
1950 add_top_conf("shared", conf_cleanup_shared
, conf_cleanup_shared
, NULL
);
1951 add_conf_item("shared", "oper", CF_QSTRING
|CF_FLIST
, conf_set_shared_oper
);
1952 add_conf_item("shared", "flags", CF_STRING
| CF_FLIST
, conf_set_shared_flags
);
1954 add_top_conf("connect", conf_begin_connect
, conf_end_connect
, conf_connect_table
);
1956 add_top_conf("exempt", NULL
, NULL
, NULL
);
1957 add_conf_item("exempt", "ip", CF_QSTRING
, conf_set_exempt_ip
);
1959 add_top_conf("cluster", conf_cleanup_cluster
, conf_cleanup_cluster
, NULL
);
1960 add_conf_item("cluster", "name", CF_QSTRING
, conf_set_cluster_name
);
1961 add_conf_item("cluster", "flags", CF_STRING
| CF_FLIST
, conf_set_cluster_flags
);
1963 add_top_conf("general", NULL
, NULL
, conf_general_table
);
1964 add_top_conf("channel", NULL
, NULL
, conf_channel_table
);
1965 add_top_conf("serverhide", NULL
, NULL
, conf_serverhide_table
);
1967 #ifdef ENABLE_SERVICES
1968 add_top_conf("service", conf_begin_service
, NULL
, NULL
);
1969 add_conf_item("service", "name", CF_QSTRING
, conf_set_service_name
);