| 1 |
|
/* |
| 2 |
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
< |
* s_conf.h: A header for the configuration functions. |
| 3 |
> |
* conf.h: A header for the configuration functions. |
| 4 |
|
* |
| 5 |
|
* Copyright (C) 2005 by the past and present ircd coders, and others. |
| 6 |
|
* |
| 28 |
|
#ifdef HAVE_LIBCRYPTO |
| 29 |
|
#include <openssl/rsa.h> |
| 30 |
|
#endif |
| 31 |
– |
#include "fileio.h" /* FBFILE */ |
| 31 |
|
#include "ircd_defs.h" |
| 32 |
|
#include "motd.h" /* MessageFile */ |
| 33 |
|
#include "client.h" |
| 34 |
|
#include "hook.h" |
| 36 |
– |
#include "pcre.h" |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
#define CONF_SERVER_INFO_TLS_VERSION_SSLV3 0x1 |
| 38 |
|
#define CONF_SERVER_INFO_TLS_VERSION_TLSV1 0x2 |
| 39 |
|
|
| 40 |
|
struct Client; |
| 43 |
– |
struct DNSReply; |
| 44 |
– |
struct hostent; |
| 41 |
|
|
| 42 |
|
extern struct Callback *client_check_cb; |
| 43 |
|
|
| 45 |
|
{ |
| 46 |
|
unsigned int boot; |
| 47 |
|
unsigned int pass; |
| 48 |
< |
FBFILE *conf_file; |
| 48 |
> |
FILE *conf_file; |
| 49 |
|
}; |
| 50 |
|
|
| 51 |
|
extern struct conf_parser_context conf_parser_ctx; |
| 70 |
|
GLINE_TYPE, |
| 71 |
|
CRESV_TYPE, |
| 72 |
|
NRESV_TYPE, |
| 73 |
< |
GDENY_TYPE |
| 73 |
> |
GDENY_TYPE, |
| 74 |
> |
SERVICE_TYPE |
| 75 |
|
} ConfType; |
| 76 |
|
|
| 77 |
|
struct split_nuh_item |
| 90 |
|
|
| 91 |
|
struct ConfItem |
| 92 |
|
{ |
| 93 |
+ |
dlink_node node; /* link into known ConfItems of this type */ |
| 94 |
+ |
|
| 95 |
|
char *name; /* Primary key */ |
| 96 |
< |
pcre *regexpname; |
| 98 |
< |
dlink_node node; /* link into known ConfItems of this type */ |
| 96 |
> |
void *regexpname; |
| 97 |
|
unsigned int flags; |
| 98 |
|
ConfType type; |
| 99 |
|
}; |
| 117 |
|
struct AccessItem |
| 118 |
|
{ |
| 119 |
|
dlink_node node; |
| 120 |
+ |
unsigned int dns_failed; |
| 121 |
+ |
unsigned int dns_pending; |
| 122 |
|
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */ |
| 123 |
|
unsigned int flags; |
| 124 |
|
unsigned int modes; |
| 125 |
+ |
unsigned int port; |
| 126 |
|
int clients; /* Number of *LOCAL* clients using this */ |
| 127 |
+ |
int bits; |
| 128 |
+ |
int type; |
| 129 |
|
struct irc_ssaddr my_ipnum; /* ip to bind to for outgoing connect */ |
| 130 |
|
struct irc_ssaddr ipnum; /* ip to connect to */ |
| 131 |
|
char * host; /* host part of user@host */ |
| 134 |
|
char * reason; |
| 135 |
|
char * oper_reason; |
| 136 |
|
char * user; /* user part of user@host */ |
| 134 |
– |
int port; |
| 135 |
– |
char * fakename; /* Mask name */ |
| 137 |
|
time_t hold; /* Hold action until this time (calendar time) */ |
| 138 |
|
struct ConfItem *class_ptr; /* Class of connection */ |
| 138 |
– |
struct DNSQuery* dns_query; |
| 139 |
|
int aftype; |
| 140 |
|
#ifdef HAVE_LIBCRYPTO |
| 141 |
+ |
/* certs */ |
| 142 |
+ |
char *cipher_list; |
| 143 |
|
char * rsa_public_key_file; |
| 144 |
|
RSA * rsa_public_key; |
| 143 |
– |
struct EncCapability *cipher_preference; |
| 145 |
|
#endif |
| 146 |
< |
pcre *regexuser; |
| 147 |
< |
pcre *regexhost; |
| 146 |
> |
void *regexuser; |
| 147 |
> |
void *regexhost; |
| 148 |
|
}; |
| 149 |
|
|
| 150 |
|
struct ClassItem |
| 151 |
|
{ |
| 152 |
+ |
dlink_list list_ipv4; /* base of per cidr ipv4 client link list */ |
| 153 |
+ |
dlink_list list_ipv6; /* base of per cidr ipv6 client link list */ |
| 154 |
|
unsigned int max_sendq; |
| 155 |
|
int con_freq; |
| 156 |
|
int ping_freq; |
| 164 |
|
int cidr_bitlen_ipv4; |
| 165 |
|
int cidr_bitlen_ipv6; |
| 166 |
|
int number_per_cidr; |
| 164 |
– |
dlink_list list_ipv4; /* base of per cidr ipv4 client link list */ |
| 165 |
– |
dlink_list list_ipv6; /* base of per cidr ipv6 client link list */ |
| 167 |
|
int active; |
| 168 |
|
}; |
| 169 |
|
|
| 170 |
|
struct CidrItem |
| 171 |
|
{ |
| 172 |
+ |
dlink_node node; |
| 173 |
|
struct irc_ssaddr mask; |
| 174 |
|
int number_on_this_cidr; |
| 173 |
– |
dlink_node node; |
| 175 |
|
}; |
| 176 |
|
|
| 177 |
|
#define ConFreq(x) ((x)->con_freq) |
| 209 |
|
#define CONF_ULINE 0x00002000 |
| 210 |
|
#define CONF_EXEMPTDLINE 0x00004000 |
| 211 |
|
#define CONF_GLINE 0x00008000 |
| 212 |
+ |
#define CONF_SERVICE 0x00010000 |
| 213 |
|
|
| 214 |
|
#define CONF_SERVER_MASK CONF_SERVER |
| 215 |
|
#define CONF_CLIENT_MASK (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER_MASK) |
| 247 |
|
#define CONF_FLAGS_NOMATCH_IP 0x00000020 |
| 248 |
|
#define CONF_FLAGS_EXEMPTKLINE 0x00000040 |
| 249 |
|
#define CONF_FLAGS_NOLIMIT 0x00000080 |
| 250 |
< |
#define CONF_FLAGS_IDLE_LINED 0x00000100 |
| 250 |
> |
/* 0x00000100 */ |
| 251 |
|
#define CONF_FLAGS_SPOOF_IP 0x00000200 |
| 252 |
|
#define CONF_FLAGS_SPOOF_NOTICE 0x00000400 |
| 253 |
|
#define CONF_FLAGS_REDIR 0x00000800 |
| 254 |
|
#define CONF_FLAGS_EXEMPTGLINE 0x00001000 |
| 255 |
< |
#define CONF_FLAGS_RESTRICTED 0x00002000 |
| 255 |
> |
/* 0x00002000 */ |
| 256 |
|
#define CONF_FLAGS_CAN_FLOOD 0x00100000 |
| 257 |
|
#define CONF_FLAGS_NEED_PASSWORD 0x00200000 |
| 258 |
|
/* server flags */ |
| 259 |
|
#define CONF_FLAGS_ALLOW_AUTO_CONN 0x00004000 |
| 260 |
< |
#define CONF_FLAGS_LAZY_LINK 0x00008000 |
| 260 |
> |
/* 0x00008000 */ |
| 261 |
|
#define CONF_FLAGS_ENCRYPTED 0x00010000 |
| 262 |
< |
#define CONF_FLAGS_COMPRESSED 0x00020000 |
| 262 |
> |
#define CONF_FLAGS_UNUSED1___ 0x00020000 |
| 263 |
|
#define CONF_FLAGS_TEMPORARY 0x00040000 |
| 264 |
< |
#define CONF_FLAGS_CRYPTLINK 0x00080000 |
| 264 |
> |
#define CONF_FLAGS_UNUSED2___ 0x00080000 |
| 265 |
|
#define CONF_FLAGS_BURST_AWAY 0x00400000 |
| 266 |
|
#define CONF_FLAGS_EXEMPTRESV 0x00800000 |
| 267 |
|
#define CONF_FLAGS_TOPICBURST 0x01000000 |
| 268 |
+ |
#define CONF_FLAGS_SSL 0x02000000 |
| 269 |
|
|
| 270 |
|
/* Macros for struct AccessItem */ |
| 271 |
|
#define IsLimitIp(x) ((x)->flags & CONF_FLAGS_LIMIT_IP) |
| 278 |
|
#define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT) |
| 279 |
|
#define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE) |
| 280 |
|
#define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV) |
| 278 |
– |
#define IsConfIdlelined(x) ((x)->flags & CONF_FLAGS_IDLE_LINED) |
| 281 |
|
#define IsConfDoIdentd(x) ((x)->flags & CONF_FLAGS_DO_IDENTD) |
| 282 |
|
#define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP) |
| 283 |
|
#define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE) |
| 282 |
– |
#define IsConfRestricted(x) ((x)->flags & CONF_FLAGS_RESTRICTED) |
| 284 |
|
#define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED) |
| 285 |
|
#define SetConfEncrypted(x) ((x)->flags |= CONF_FLAGS_ENCRYPTED) |
| 286 |
|
#define ClearConfEncrypted(x) ((x)->flags &= ~CONF_FLAGS_ENCRYPTED) |
| 286 |
– |
#define IsConfCompressed(x) ((x)->flags & CONF_FLAGS_COMPRESSED) |
| 287 |
– |
#define SetConfCompressed(x) ((x)->flags |= CONF_FLAGS_COMPRESSED) |
| 288 |
– |
#define ClearConfCompressed(x) ((x)->flags &= ~CONF_FLAGS_COMPRESSED) |
| 289 |
– |
#define IsConfCryptLink(x) ((x)->flags & CONF_FLAGS_CRYPTLINK) |
| 290 |
– |
#define SetConfCryptLink(x) ((x)->flags |= CONF_FLAGS_CRYPTLINK) |
| 291 |
– |
#define ClearConfCryptLink(x) ((x)->flags &= ~CONF_FLAGS_CRYPTLINK) |
| 287 |
|
#define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN) |
| 288 |
|
#define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN) |
| 289 |
|
#define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN) |
| 296 |
|
#define IsConfTopicBurst(x) ((x)->flags & CONF_FLAGS_TOPICBURST) |
| 297 |
|
#define SetConfTopicBurst(x) ((x)->flags |= CONF_FLAGS_TOPICBURST) |
| 298 |
|
#define ClearConfTopicBurst(x) ((x)->flags &= ~CONF_FLAGS_TOPICBURST) |
| 299 |
+ |
#define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL) |
| 300 |
+ |
#define SetConfSSL(x) ((x)->flags |= CONF_FLAGS_SSL) |
| 301 |
+ |
#define ClearConfSSL(x) ((x)->flags &= ~CONF_FLAGS_SSL) |
| 302 |
|
|
| 303 |
|
/* shared/cluster server entry types |
| 304 |
|
* These defines are used for both shared and cluster. |
| 305 |
|
*/ |
| 306 |
|
#define SHARED_KLINE 0x0001 |
| 307 |
< |
#define SHARED_TKLINE 0x0002 |
| 308 |
< |
#define SHARED_UNKLINE 0x0004 |
| 309 |
< |
#define SHARED_XLINE 0x0008 |
| 310 |
< |
#define SHARED_TXLINE 0x0010 |
| 311 |
< |
#define SHARED_UNXLINE 0x0020 |
| 312 |
< |
#define SHARED_RESV 0x0040 |
| 313 |
< |
#define SHARED_TRESV 0x0080 |
| 314 |
< |
#define SHARED_UNRESV 0x0100 |
| 315 |
< |
#define SHARED_LOCOPS 0x0200 |
| 316 |
< |
#define SHARED_ALL (SHARED_KLINE | SHARED_TKLINE | SHARED_UNKLINE | \ |
| 317 |
< |
SHARED_XLINE | SHARED_TXLINE | SHARED_UNXLINE | \ |
| 318 |
< |
SHARED_RESV | SHARED_TRESV | SHARED_UNRESV |\ |
| 321 |
< |
SHARED_LOCOPS) |
| 307 |
> |
#define SHARED_UNKLINE 0x0002 |
| 308 |
> |
#define SHARED_XLINE 0x0004 |
| 309 |
> |
#define SHARED_UNXLINE 0x0008 |
| 310 |
> |
#define SHARED_RESV 0x0010 |
| 311 |
> |
#define SHARED_UNRESV 0x0020 |
| 312 |
> |
#define SHARED_LOCOPS 0x0040 |
| 313 |
> |
#define SHARED_DLINE 0x0080 |
| 314 |
> |
#define SHARED_UNDLINE 0x0100 |
| 315 |
> |
#define SHARED_ALL (SHARED_KLINE | SHARED_UNKLINE |\ |
| 316 |
> |
SHARED_XLINE | SHARED_UNXLINE |\ |
| 317 |
> |
SHARED_RESV | SHARED_UNRESV |\ |
| 318 |
> |
SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE) |
| 319 |
|
|
| 320 |
|
/* gline acl entry actions */ |
| 321 |
|
#define GDENY_BLOCK 0x1 |
| 336 |
|
|
| 337 |
|
char *logpath; |
| 338 |
|
char *operlog; |
| 342 |
– |
|
| 343 |
– |
char *servlink_path; |
| 339 |
|
char *egdpool_path; |
| 340 |
+ |
char *service_name; |
| 341 |
|
|
| 342 |
|
MessageFile motd; |
| 343 |
|
MessageFile opermotd; |
| 344 |
|
MessageFile linksfile; |
| 345 |
|
|
| 350 |
– |
unsigned char compression_level; |
| 346 |
|
int gline_min_cidr; |
| 347 |
|
int gline_min_cidr6; |
| 353 |
– |
int dot_in_ip6_addr; |
| 348 |
|
int dots_in_ident; |
| 349 |
|
int failed_oper_notice; |
| 350 |
|
int anti_spam_exit_message_time; |
| 379 |
|
int pace_wait_simple; |
| 380 |
|
int gline_time; |
| 381 |
|
int gline_logging; |
| 388 |
– |
int idletime; |
| 382 |
|
int oper_only_umodes; |
| 383 |
|
int oper_umodes; |
| 384 |
|
int max_targets; |
| 394 |
|
int ping_cookie; |
| 395 |
|
int disable_auth; |
| 396 |
|
int disable_remote; |
| 404 |
– |
#ifdef HAVE_LIBCRYPTO |
| 405 |
– |
struct EncCapability *default_cipher_preference; |
| 406 |
– |
#endif |
| 397 |
|
}; |
| 398 |
|
|
| 399 |
|
struct config_channel_entry |
| 418 |
|
|
| 419 |
|
struct config_server_hide |
| 420 |
|
{ |
| 421 |
+ |
char *hidden_name; |
| 422 |
|
int flatten_links; |
| 423 |
|
int hide_servers; |
| 433 |
– |
char *hidden_name; |
| 424 |
|
int links_delay; |
| 425 |
|
int links_disabled; |
| 426 |
|
int hidden; |
| 430 |
|
|
| 431 |
|
struct server_info |
| 432 |
|
{ |
| 433 |
+ |
char *sid; |
| 434 |
|
char *name; |
| 435 |
|
char *description; |
| 436 |
|
char *network_name; |
| 440 |
|
RSA *rsa_private_key; |
| 441 |
|
SSL_CTX *server_ctx; |
| 442 |
|
SSL_CTX *client_ctx; |
| 452 |
– |
unsigned int tls_version; |
| 443 |
|
#endif |
| 454 |
– |
char *sid; |
| 444 |
|
int hub; |
| 445 |
|
struct irc_ssaddr ip; |
| 446 |
|
struct irc_ssaddr ip6; |
| 447 |
< |
int max_clients; |
| 447 |
> |
unsigned int max_clients; |
| 448 |
|
int specific_ipv4_vhost; |
| 449 |
|
int specific_ipv6_vhost; |
| 450 |
|
struct sockaddr_in dns_host; |
| 461 |
|
struct logging_entry |
| 462 |
|
{ |
| 463 |
|
unsigned int use_logging; |
| 475 |
– |
char operlog[PATH_MAX + 1]; |
| 476 |
– |
char userlog[PATH_MAX + 1]; |
| 477 |
– |
char glinelog[PATH_MAX + 1]; |
| 478 |
– |
char ioerrlog[PATH_MAX + 1]; |
| 479 |
– |
char klinelog[PATH_MAX + 1]; |
| 480 |
– |
char killlog[PATH_MAX + 1]; |
| 481 |
– |
char operspylog[PATH_MAX + 1]; |
| 482 |
– |
char failed_operlog[PATH_MAX + 1]; |
| 464 |
|
}; |
| 465 |
|
|
| 466 |
< |
extern int ypass; |
| 466 |
> |
extern dlink_list gdeny_items; |
| 467 |
|
extern dlink_list class_items; |
| 468 |
|
extern dlink_list server_items; |
| 469 |
|
extern dlink_list cluster_items; |
| 471 |
|
extern dlink_list rxconf_items; |
| 472 |
|
extern dlink_list rkconf_items; |
| 473 |
|
extern dlink_list leaf_items; |
| 474 |
+ |
extern dlink_list service_items; |
| 475 |
|
extern dlink_list temporary_klines; |
| 476 |
|
extern dlink_list temporary_dlines; |
| 477 |
|
extern dlink_list temporary_glines; |
| 513 |
|
extern void split_nuh(struct split_nuh_item *); |
| 514 |
|
extern struct ConfItem *find_matching_name_conf(ConfType, const char *, |
| 515 |
|
const char *, const char *, int); |
| 516 |
< |
extern struct ConfItem *find_exact_name_conf(ConfType, const char *, |
| 516 |
> |
extern struct ConfItem *find_exact_name_conf(ConfType, const struct Client *, const char *, |
| 517 |
|
const char *, const char *); |
| 518 |
|
extern void delete_conf_item(struct ConfItem *); |
| 519 |
|
extern void report_confitem_types(struct Client *, ConfType, int); |
| 520 |
|
extern void yyerror(const char *); |
| 521 |
|
extern int conf_yy_fatal_error(const char *); |
| 522 |
< |
extern int conf_fbgets(char *, unsigned int, FBFILE *); |
| 522 |
> |
extern int conf_fbgets(char *, unsigned int, FILE *); |
| 523 |
|
extern void write_conf_line(struct Client *, struct ConfItem *, |
| 524 |
|
const char *, time_t); |
| 525 |
|
extern int remove_conf_line(ConfType, struct Client *, const char *, |
| 530 |
|
extern int rehash(int); |
| 531 |
|
extern int conf_add_server(struct ConfItem *, const char *); |
| 532 |
|
extern void conf_add_class_to_conf(struct ConfItem *, const char *); |
| 551 |
– |
extern void conf_add_d_conf(struct AccessItem *); |
| 533 |
|
|
| 534 |
|
/* XXX consider moving these into csvlib.h */ |
| 535 |
< |
extern void parse_csv_file(FBFILE *, ConfType); |
| 535 |
> |
extern void parse_csv_file(FILE *, ConfType); |
| 536 |
|
|
| 537 |
|
extern char *get_oper_name(const struct Client *); |
| 538 |
|
|
| 548 |
|
|
| 549 |
|
#define TK_SECONDS 0 |
| 550 |
|
#define TK_MINUTES 1 |
| 551 |
< |
extern time_t valid_tkline(char *, int); |
| 551 |
> |
extern time_t valid_tkline(const char *, int); |
| 552 |
|
extern int match_conf_password(const char *, const struct AccessItem *); |
| 553 |
|
|
| 554 |
|
#define NOT_AUTHORIZED (-1) |
| 564 |
|
extern void rebuild_cidr_class(struct ConfItem *, struct ClassItem *); |
| 565 |
|
|
| 566 |
|
/* XXX **/ |
| 567 |
< |
extern int yylex(void); |
| 567 |
> |
//extern int yylex(void); |
| 568 |
|
|
| 569 |
|
#endif /* INCLUDED_s_conf_h */ |