From 8db00894ab7750513d8750290e508b5802bc1fc5 Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Sun, 6 Apr 2008 18:52:42 +0400 Subject: [PATCH] ssl sync with http://hg.angelforce.ru/charybdis-old --- doc/example.conf | 9 + doc/reference.conf | 9 + include/client.h | 37 ++- include/hash.h | 7 + include/ircd.h | 2 + include/listener.h | 2 +- include/packet.h | 1 - include/s_conf.h | 8 +- include/s_newconf.h | 2 + include/s_serv.h | 4 - include/send.h | 2 - modules/core/m_server.c | 9 + modules/m_connect.c | 16 + modules/m_info.c | 2 +- modules/m_whois.c | 8 +- src/.depend | 704 ++++++++++++++++++++++++++++++++++++++++ src/Makefile.in | 1 + src/client.c | 18 +- src/hash.c | 35 ++ src/ircd.c | 20 +- src/listener.c | 37 ++- src/messages.tab | 2 +- src/newconf.c | 38 ++- src/packet.c | 126 ------- src/s_conf.c | 23 ++ src/s_serv.c | 430 ++++-------------------- src/send.c | 98 ++---- 27 files changed, 1055 insertions(+), 595 deletions(-) diff --git a/doc/example.conf b/doc/example.conf index 3346ce7..74c8e15 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -42,6 +42,15 @@ serverinfo { #vhost = "192.169.0.1"; /* for IPv6 */ #vhost6 = "3ffe:80e8:546::2"; + + /* ssl_private_key: our ssl private key */ + ssl_private_key = "etc/test.key"; + + /* ssl_cert: certificate for our ssl server */ + ssl_cert = "etc/test.cert"; + + /* ssl_dh_params: DH parameters, generate with openssl dhparam -out dh.pem 1024 */ + ssl_dh_params = "etc/dh.pem"; /* default max clients: the default maximum number of clients * allowed to connect. This can be changed once ircd has started by diff --git a/doc/reference.conf b/doc/reference.conf index e1a6e6f..8096b9c 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -115,6 +115,15 @@ serverinfo { * This should be an ipv6 IP only. */ #vhost6 = "3ffe:80e8:546::2"; + + /* ssl_private_key: our ssl private key */ + ssl_private_key = "etc/test.key"; + + /* ssl_cert: certificate for our ssl server */ + ssl_cert = "etc/test.cert"; + + /* ssl_dh_params: DH parameters, generate with openssl dhparam -out dh.pem 1024 */ + ssl_dh_params = "etc/dh.pem"; /* default max clients: the default maximum number of clients * allowed to connect. This can be changed once ircd has started by diff --git a/include/client.h b/include/client.h index 90c0161..edf585f 100644 --- a/include/client.h +++ b/include/client.h @@ -254,17 +254,6 @@ struct LocalUser /* time challenge response is valid for */ time_t chal_time; - rb_fde_t *ctrlF; /* For servers: - control fd used for sending commands - to servlink */ - - struct SlinkRpl slinkrpl; /* slink reply being parsed */ - unsigned char *slinkq; /* sendq for control data */ - int slinkq_ofs; /* ofset into slinkq */ - int slinkq_len; /* length remaining after slinkq_ofs */ - - struct ZipStats zipstats; - struct DNSQuery *dnsquery; /* for outgoing server's name lookup */ time_t last_away; /* Away since... */ @@ -298,6 +287,12 @@ struct LocalUser char *mangledhost; /* non-NULL if host mangling module loaded and applicable to this client */ + + struct _ssl_ctl *ssl_ctl; /* which ssl daemon we're associate with */ + rb_uint32_t localflags; + struct ZipStats *zipstats; /* zipstats */ + rb_uint16_t cork_count; /* used for corking/uncorking connections */ + struct ev_entry *event; /* used for associated events */ }; struct PreClient @@ -433,6 +428,11 @@ struct exit_client_hook #define FLAGS_DYNSPOOF 0x1000000 /* dynamic spoof, only opers see ip */ #define FLAGS_EXUNKNOWN 0x2000000 /* too many unknowns exit.. */ +/* flags for local clients, this needs stuff moved from above to here at some point */ +#define LFLAGS_SSL 0x00000001 +#define LFLAGS_FLUSH 0x00000002 +#define LFLAGS_CORK 0x00000004 + /* umodes, settable flags */ /* lots of this moved to snomask -- jilles */ #define UMODE_SERVNOTICE 0x0001 /* server notices */ @@ -506,6 +506,16 @@ struct exit_client_hook #define IsExUnknown(x) ((x)->flags & FLAGS_EXUNKNOWN) #define SetExUnknown(x) ((x)->flags |= FLAGS_EXUNKNOWN) +/* local flags */ + +#define IsSSL(x) ((x)->localClient->localflags & LFLAGS_SSL) +#define SetSSL(x) ((x)->localClient->localflags |= LFLAGS_SSL) +#define ClearSSL(x) ((x)->localClient->localflags &= ~LFLAGS_SSL) + +#define IsFlush(x) ((x)->localClient->localflags & LFLAGS_FLUSH) +#define SetFlush(x) ((x)->localClient->localflags |= LFLAGS_FLUSH) +#define ClearFlush(x) ((x)->localClient->localflags &= ~LFLAGS_FLUSH) + /* oper flags */ #define MyOper(x) (MyConnect(x) && IsOper(x)) @@ -559,6 +569,11 @@ struct exit_client_hook #define IsFloodDone(x) ((x)->flags & FLAGS_FLOODDONE) #define SetFloodDone(x) ((x)->flags |= FLAGS_FLOODDONE) +/* These also operate on the uplink from which it came */ +#define IsCork(x) (MyConnect(x) ? (x)->localClient->cork_count : (x)->from->localClient->cork_count) +#define SetCork(x) (MyConnect(x) ? (x)->localClient->cork_count++ : (x)->from->localClient->cork_count++ ) +#define ClearCork(x) (MyConnect(x) ? (x)->localClient->cork_count-- : (x)->from->localClient->cork_count--) + /* * definitions for get_client_name */ diff --git a/include/hash.h b/include/hash.h index 9766022..a28a8d4 100644 --- a/include/hash.h +++ b/include/hash.h @@ -45,6 +45,9 @@ extern struct Dictionary *nd_dict; #define U_MAX_BITS 17 #define U_MAX 131072 /* 2^17 */ +/* Client fd hash table size, used in hash.c */ +#define CLI_FD_MAX 4096 + /* Channel hash table size, hash.c/s_debug.c */ #define CH_MAX_BITS 16 #define CH_MAX 65536 /* 2^16 */ @@ -98,6 +101,10 @@ extern void del_from_resv_hash(const char *name, struct ConfItem *aconf); extern struct ConfItem *hash_find_resv(const char *name); extern void clear_resv_hash(void); +void add_to_cli_fd_hash(struct Client *client_p); +void del_from_cli_fd_hash(struct Client *client_p); +struct Client *find_cli_fd_hash(int fd); + extern void hash_stats(struct Client *); #endif /* INCLUDED_hash_h */ diff --git a/include/ircd.h b/include/ircd.h index 0061950..7a63706 100644 --- a/include/ircd.h +++ b/include/ircd.h @@ -103,6 +103,8 @@ extern int testing_conf; extern struct ev_entry *check_splitmode_ev; +extern int ssl_ok; +extern int zlib_ok; extern int maxconnections; #endif diff --git a/include/listener.h b/include/listener.h index 468ce3c..796e79a 100644 --- a/include/listener.h +++ b/include/listener.h @@ -44,7 +44,7 @@ struct Listener char vhost[HOSTLEN + 1]; /* virtual name of listener */ }; -extern void add_listener(int port, const char *vaddr_ip, int family); +extern void add_listener(int port, const char *vaddr_ip, int family, int ssl); extern void close_listener(struct Listener *listener); extern void close_listeners(void); extern const char *get_listener_name(const struct Listener *listener); diff --git a/include/packet.h b/include/packet.h index 6f7e3d3..e66dd52 100644 --- a/include/packet.h +++ b/include/packet.h @@ -46,7 +46,6 @@ #define MAX_FLOOD 5 #define MAX_FLOOD_BURST MAX_FLOOD * 8 -extern PF read_ctrl_packet; extern PF read_packet; extern EVH flood_recalc; extern void flood_endgrace(struct Client *); diff --git a/include/s_conf.h b/include/s_conf.h index 79a8766..da08740 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -271,6 +271,7 @@ struct server_info char *network_desc; int hub; struct sockaddr_in ip; + int default_max_clients; #ifdef RB_IPV6 struct sockaddr_in6 ip6; #endif @@ -278,8 +279,11 @@ struct server_info #ifdef RB_IPV6 int specific_ipv6_vhost; #endif - - int default_max_clients; + char *ssl_private_key; + char *ssl_ca_cert; + char *ssl_cert; + char *ssl_dh_params; + int ssld_count; }; struct admin_info diff --git a/include/s_newconf.h b/include/s_newconf.h index 3567098..42a4daa 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -216,6 +216,7 @@ struct server_conf #define SERVER_COMPRESSED 0x0008 #define SERVER_TB 0x0010 #define SERVER_AUTOCONN 0x0020 +#define SERVER_SSL 0x0040 #define ServerConfIllegal(x) ((x)->flags & SERVER_ILLEGAL) #define ServerConfVhosted(x) ((x)->flags & SERVER_VHOSTED) @@ -223,6 +224,7 @@ struct server_conf #define ServerConfCompressed(x) ((x)->flags & SERVER_COMPRESSED) #define ServerConfTb(x) ((x)->flags & SERVER_TB) #define ServerConfAutoconn(x) ((x)->flags & SERVER_AUTOCONN) +#define ServerConfSSL(x) ((x)->flags & SERVER_SSL) extern struct server_conf *make_server_conf(void); extern void free_server_conf(struct server_conf *); diff --git a/include/s_serv.h b/include/s_serv.h index 5de8eb1..804569e 100644 --- a/include/s_serv.h +++ b/include/s_serv.h @@ -123,8 +123,6 @@ struct SlinkRplDef unsigned int flags; }; -extern struct SlinkRplDef slinkrpltab[]; - /* * Globals * @@ -154,8 +152,6 @@ extern int hunt_server(struct Client *client_pt, extern void send_capabilities(struct Client *, int); extern const char *show_capabilities(struct Client *client); extern void try_connections(void *unused); -extern void start_collect_zipstats(void); -extern void collect_zipstats(void *unused); extern int check_server(const char *name, struct Client *server); extern int server_estab(struct Client *client_p); diff --git a/include/send.h b/include/send.h index 20b623f..c47bd23 100644 --- a/include/send.h +++ b/include/send.h @@ -42,8 +42,6 @@ extern void send_pop_queue(struct Client *); extern void send_queued(struct Client *to); -extern void send_queued_slink_write(rb_fde_t *F, void *data); - extern void sendto_one(struct Client *target_p, const char *, ...) AFP(2, 3); extern void sendto_one_notice(struct Client *target_p,const char *, ...) AFP(2, 3); extern void sendto_one_prefix(struct Client *target_p, struct Client *source_p, diff --git a/modules/core/m_server.c b/modules/core/m_server.c index 4608bdb..3a34c53 100644 --- a/modules/core/m_server.c +++ b/modules/core/m_server.c @@ -173,6 +173,15 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char return 0; /* NOT REACHED */ break; + case -5: + sendto_realops_flags(SNO_GENERAL, L_ALL, + "Connection from servername %s requires SSL/TLS but is plaintext", + name); + ilog(L_SERVER, "Access denied, requires SSL/TLS but is plaintext from %s", + log_client_name(client_p, SHOW_IP)); + + exit_client(client_p, client_p, client_p, "Access denied, requires SSL/TLS but is plaintext"); + return 0; } if((target_p = find_server(NULL, name))) diff --git a/modules/m_connect.c b/modules/m_connect.c index 6bca0a1..bd2b438 100644 --- a/modules/m_connect.c +++ b/modules/m_connect.c @@ -97,6 +97,14 @@ mo_connect(struct Client *client_p, struct Client *source_p, int parc, const cha return 0; } + if(ServerConfSSL(server_p) && (!ssl_ok || !get_ssld_count())) + { + sendto_one_notice(source_p, + ":Connect: Server %s is set to use SSL/TLS but SSL/TLS is not configured.", + parv[1]); + return 0; + } + /* * Get port number from user, if given. If not specified, * use the default form configuration structure. If missing @@ -191,6 +199,14 @@ ms_connect(struct Client *client_p, struct Client *source_p, int parc, const cha return 0; } + if(ServerConfSSL(server_p) && (!ssl_ok || !get_ssld_count())) + { + sendto_one_notice(source_p, + ":Connect: Server %s is set to use SSL/TLS but SSL/TLS is not configured.", + parv[1]); + return 0; + } + /* * Get port number from user, if given. If not specified, * use the default form configuration structure. If missing diff --git a/modules/m_info.c b/modules/m_info.c index aed3469..e265e9f 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -639,6 +639,7 @@ m_info(struct Client *client_p, struct Client *source_p, int parc, const char *p info_spy(source_p); + SetCork(source_p); send_info_text(source_p); send_birthdate_online_time(source_p); @@ -657,7 +658,6 @@ mo_info(struct Client *client_p, struct Client *source_p, int parc, const char * if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME) { info_spy(source_p); - send_info_text(source_p); if(IsOper(source_p)) diff --git a/modules/m_whois.c b/modules/m_whois.c index 516863e..c2a00ef 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -190,7 +190,10 @@ do_whois(struct Client *client_p, struct Client *source_p, int parc, const char nick++; } - target_p = find_named_person(nick); + if(MyClient(source_p)) + target_p = find_named_person(nick); + else + target_p = find_person(nick); if(target_p != NULL) { @@ -347,6 +350,9 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) target_p->name, rb_current_time() - target_p->localClient->last, target_p->localClient->firsttime); + + sendto_one_notice(source_p, ":%ld %ld", target_p->localClient->last, + target_p->localClient->firsttime); } else { diff --git a/src/.depend b/src/.depend index e69de29..1c8c58d 100644 --- a/src/.depend +++ b/src/.depend @@ -0,0 +1,704 @@ +blacklist.o: blacklist.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/res.h ../include/numeric.h \ + ../include/reject.h ../include/s_conf.h ../include/class.h \ + ../include/s_user.h ../include/blacklist.h +cache.o: cache.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/ircd_defs.h \ + ../include/common.h ../include/s_conf.h ../include/class.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/hash.h ../include/cache.h \ + ../include/sprintf_irc.h ../include/irc_dictionary.h \ + ../include/numeric.h +channel.o: channel.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/channel.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/client.h ../include/common.h \ + ../include/hash.h ../include/hook.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/numeric.h \ + ../include/s_serv.h ../include/s_user.h ../include/send.h \ + ../include/whowas.h ../include/s_conf.h ../include/class.h \ + ../include/s_newconf.h ../include/logger.h +chmode.o: chmode.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/channel.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/common.h ../include/hash.h \ + ../include/hook.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/numeric.h ../include/s_serv.h \ + ../include/s_user.h ../include/send.h ../include/whowas.h \ + ../include/s_conf.h ../include/class.h ../include/s_newconf.h \ + ../include/logger.h +class.o: class.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/config.h \ + ../include/class.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/client.h ../include/common.h \ + ../include/ircd.h ../include/numeric.h ../include/s_conf.h \ + ../include/class.h ../include/s_newconf.h ../include/send.h \ + ../include/irc_string.h +client.o: client.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/config.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/class.h ../include/common.h \ + ../include/hash.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/s_gline.h ../include/numeric.h \ + ../include/packet.h ../include/s_auth.h ../include/s_conf.h \ + ../include/class.h ../include/s_newconf.h ../include/logger.h \ + ../include/s_serv.h ../include/s_stats.h ../include/send.h \ + ../include/whowas.h ../include/s_user.h ../include/hostmask.h \ + ../include/listener.h ../include/hook.h ../include/msg.h \ + ../include/monitor.h ../include/blacklist.h ../include/reject.h \ + ../include/scache.h ../include/irc_dictionary.h +extban.o: extban.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/channel.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/common.h +getopt.o: getopt.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/ircd_getopt.h +hash.o: hash.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/ircd_defs.h \ + ../include/s_conf.h ../include/class.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/channel.h \ + ../include/client.h ../include/common.h ../include/hash.h \ + ../include/irc_string.h ../include/ircd.h ../include/numeric.h \ + ../include/send.h ../include/msg.h ../include/cache.h \ + ../include/s_newconf.h +hook.o: hook.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/hook.h \ + ../include/irc_string.h +hostmask.o: hostmask.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/ircd_defs.h ../include/s_conf.h ../include/class.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/hostmask.h ../include/numeric.h ../include/send.h \ + ../include/irc_string.h +irc_string.o: irc_string.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/sprintf_irc.h ../include/irc_string.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/client.h \ + ../include/setup.h +irc_dictionary.o: irc_dictionary.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/sprintf_irc.h ../include/irc_string.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/client.h \ + ../include/setup.h ../include/irc_dictionary.h +ircd.o: ircd.c ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/setup.h \ + ../include/config.h ../include/ircd.h ../include/channel.h \ + ../include/class.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/client.h ../include/common.h \ + ../include/hash.h ../include/irc_string.h ../include/ircd_signal.h \ + ../include/sprintf_irc.h ../include/s_gline.h ../include/msg.h \ + ../include/hostmask.h ../include/numeric.h ../include/parse.h \ + ../include/irc_dictionary.h ../include/res.h ../include/restart.h \ + ../include/s_auth.h ../include/s_conf.h ../include/class.h \ + ../include/logger.h ../include/s_serv.h ../include/s_user.h \ + ../include/s_stats.h ../include/scache.h ../include/send.h \ + ../include/supported.h ../include/whowas.h ../include/modules.h \ + ../include/parse.h ../include/msg.h ../include/hook.h ../include/hook.h \ + ../include/ircd_getopt.h ../include/newconf.h ../include/reject.h \ + ../include/s_newconf.h ../include/cache.h ../include/monitor.h \ + ../include/patchlevel.h ../include/serno.h +ircd_signal.o: ircd_signal.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/ircd_signal.h ../include/ircd.h ../include/restart.h \ + ../include/logger.h ../include/s_conf.h ../include/class.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/send.h +ircd_state.o: ircd_state.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/setup.h ../include/config.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/client.h \ + ../include/ircd.h ../include/channel.h ../include/class.h \ + ../include/common.h ../include/hash.h ../include/irc_string.h \ + ../include/ircd_signal.h ../include/sprintf_irc.h ../include/s_gline.h \ + ../include/msg.h ../include/hostmask.h ../include/numeric.h \ + ../include/parse.h ../include/irc_dictionary.h ../include/res.h \ + ../include/restart.h ../include/s_auth.h ../include/s_conf.h \ + ../include/class.h ../include/logger.h ../include/s_serv.h \ + ../include/s_user.h ../include/s_stats.h ../include/scache.h \ + ../include/send.h ../include/whowas.h ../include/modules.h \ + ../include/parse.h ../include/msg.h ../include/hook.h ../include/hook.h \ + ../include/ircd_getopt.h ../include/newconf.h ../include/reject.h \ + ../include/s_newconf.h ../include/cache.h ../include/monitor.h \ + ../include/patchlevel.h ../include/serno.h +kdparse.o: kdparse.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/logger.h ../include/s_conf.h ../include/class.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/s_newconf.h ../include/hostmask.h ../include/client.h \ + ../include/irc_string.h ../include/hash.h +listener.o: listener.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/setup.h ../include/listener.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/client.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/ircd_defs.h ../include/numeric.h ../include/s_conf.h \ + ../include/class.h ../include/s_newconf.h ../include/s_stats.h \ + ../include/send.h ../include/s_auth.h ../include/reject.h \ + ../include/hostmask.h +logger.o: logger.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/ircd_defs.h \ + ../include/logger.h ../include/s_conf.h ../include/class.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/sprintf_irc.h ../include/send.h ../include/client.h \ + ../include/s_serv.h +match.o: match.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/config.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/ircd.h ../include/irc_string.h +modules.o: modules.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/modules.h ../include/parse.h ../include/irc_dictionary.h \ + ../include/msg.h ../include/hook.h ../include/logger.h \ + ../include/ircd.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/client.h ../include/send.h \ + ../include/s_conf.h ../include/class.h ../include/s_newconf.h \ + ../include/numeric.h ../include/parse.h ../include/ircd_defs.h \ + ../include/irc_string.h ../include/sprintf_irc.h +monitor.o: monitor.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/monitor.h ../include/hash.h \ + ../include/numeric.h +newconf.o: newconf.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/newconf.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/ircd_defs.h ../include/sprintf_irc.h \ + ../include/common.h ../include/logger.h ../include/s_conf.h \ + ../include/class.h ../include/s_user.h ../include/s_newconf.h \ + ../include/send.h ../include/setup.h ../include/modules.h \ + ../include/parse.h ../include/irc_dictionary.h ../include/msg.h \ + ../include/hook.h ../include/listener.h ../include/hostmask.h \ + ../include/s_serv.h ../include/hash.h ../include/cache.h \ + ../include/ircd.h ../include/snomask.h ../include/blacklist.h +numeric.o: numeric.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/setup.h ../include/config.h ../include/s_conf.h \ + ../include/class.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/numeric.h ../include/irc_string.h \ + ../include/common.h messages.tab +packet.o: packet.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/s_conf.h \ + ../include/class.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/s_serv.h ../include/client.h \ + ../include/common.h ../include/ircd.h ../include/parse.h \ + ../include/irc_dictionary.h ../include/packet.h ../include/irc_string.h \ + ../include/hook.h ../include/send.h +parse.o: parse.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/parse.h \ + ../include/irc_dictionary.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/client.h ../include/channel.h \ + ../include/common.h ../include/hash.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/numeric.h \ + ../include/logger.h ../include/s_stats.h ../include/send.h \ + ../include/msg.h ../include/s_conf.h ../include/class.h \ + ../include/s_serv.h ../include/packet.h +res.o: res.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/ircd_defs.h \ + ../include/common.h ../include/ircd.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/numeric.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/snomask.h ../include/client.h +reslib.o: reslib.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/ircd_defs.h \ + ../include/common.h ../include/ircd.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h +reject.o: reject.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/config.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/s_conf.h ../include/class.h \ + ../include/reject.h ../include/s_stats.h ../include/msg.h \ + ../include/hash.h +restart.o: restart.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/restart.h ../include/ircd.h ../include/send.h \ + ../include/logger.h ../include/s_conf.h ../include/class.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/ircd_signal.h +s_auth.o: s_auth.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/config.h \ + ../include/s_auth.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/s_conf.h ../include/class.h \ + ../include/client.h ../include/channel.h ../include/snomask.h \ + ../include/client.h ../include/common.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/numeric.h \ + ../include/packet.h ../include/res.h ../include/logger.h \ + ../include/s_stats.h ../include/send.h ../include/hook.h \ + ../include/blacklist.h +s_conf.o: s_conf.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/ircd_defs.h \ + ../include/s_conf.h ../include/class.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/s_newconf.h \ + ../include/s_serv.h ../include/s_stats.h ../include/channel.h \ + ../include/class.h ../include/client.h ../include/common.h \ + ../include/hash.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/listener.h ../include/hostmask.h \ + ../include/modules.h ../include/parse.h ../include/irc_dictionary.h \ + ../include/msg.h ../include/hook.h ../include/numeric.h \ + ../include/logger.h ../include/send.h ../include/s_gline.h \ + ../include/reject.h ../include/cache.h ../include/blacklist.h +s_newconf.o: s_newconf.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/ircd_defs.h ../include/common.h ../include/s_conf.h \ + ../include/class.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/s_newconf.h ../include/client.h \ + ../include/s_serv.h ../include/send.h ../include/hostmask.h \ + ../include/newconf.h ../include/hash.h ../include/sprintf_irc.h \ + ../include/irc_dictionary.h +s_gline.o: s_gline.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/channel.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/client.h ../include/common.h \ + ../include/config.h ../include/irc_string.h ../include/ircd.h \ + ../include/hostmask.h ../include/numeric.h ../include/s_conf.h \ + ../include/class.h ../include/scache.h ../include/send.h \ + ../include/msg.h ../include/s_serv.h ../include/s_gline.h \ + ../include/hash.h +s_serv.o: s_serv.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/s_serv.h \ + ../include/class.h ../include/client.h ../include/channel.h \ + ../include/res.h ../include/common.h ../include/reslib.h \ + ../include/irc_string.h ../include/sprintf_irc.h ../include/ircd.h \ + ../include/snomask.h ../include/client.h ../include/common.h \ + ../include/hash.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/ircd_defs.h ../include/numeric.h \ + ../include/packet.h ../include/res.h ../include/s_conf.h \ + ../include/class.h ../include/s_newconf.h ../include/logger.h \ + ../include/s_stats.h ../include/s_user.h ../include/scache.h \ + ../include/send.h ../include/channel.h ../include/hook.h \ + ../include/msg.h ../include/reject.h +s_user.o: s_user.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/s_user.h \ + ../include/channel.h ../include/class.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/client.h \ + ../include/common.h ../include/hash.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/listener.h \ + ../include/msg.h ../include/numeric.h ../include/s_conf.h \ + ../include/class.h ../include/s_newconf.h ../include/logger.h \ + ../include/s_serv.h ../include/s_stats.h ../include/scache.h \ + ../include/send.h ../include/supported.h ../include/whowas.h \ + ../include/packet.h ../include/reject.h ../include/cache.h \ + ../include/hook.h ../include/monitor.h ../include/snomask.h \ + ../include/blacklist.h ../include/substitution.h ../include/stdinc.h +scache.o: scache.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/client.h \ + ../include/common.h ../include/irc_string.h ../include/ircd.h \ + ../include/numeric.h ../include/send.h ../include/scache.h \ + ../include/s_conf.h ../include/class.h +send.o: send.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/send.h \ + ../include/channel.h ../include/class.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/client.h \ + ../include/common.h ../include/irc_string.h ../include/ircd.h \ + ../include/numeric.h ../include/s_serv.h ../include/sprintf_irc.h \ + ../include/s_conf.h ../include/class.h ../include/s_newconf.h \ + ../include/logger.h ../include/hook.h ../include/monitor.h +snomask.o: snomask.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/snomask.h +sslproc.o: sslproc.c ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/stdinc.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/s_conf.h ../include/class.h ../include/client.h \ + ../include/channel.h ../include/res.h ../include/common.h \ + ../include/reslib.h ../include/irc_string.h ../include/sprintf_irc.h \ + ../include/ircd.h ../include/snomask.h ../include/logger.h \ + ../include/listener.h ../include/sslproc.h ../include/s_serv.h \ + ../include/ircd.h ../include/hash.h ../include/client.h \ + ../include/send.h ../include/packet.h +substitution.o: substitution.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/s_user.h ../include/irc_string.h +supported.o: supported.c ../include/stdinc.h \ + ../libratbox/include/ratbox_lib.h ../libratbox/include/librb-config.h \ + ../libratbox/include/rb_tools.h ../libratbox/include/rb_memory.h \ + ../libratbox/include/rb_commio.h ../libratbox/include/rb_balloc.h \ + ../libratbox/include/rb_linebuf.h ../libratbox/include/rb_snprintf.h \ + ../libratbox/include/rb_event.h ../libratbox/include/rb_helper.h \ + ../libratbox/include/rb_rawbuf.h ../libratbox/include/rb_patricia.h \ + ../include/config.h ../include/setup.h ../include/defaults.h \ + ../include/ircd_defs.h ../include/logger.h ../include/send.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/common.h ../include/numeric.h \ + ../include/ircd.h ../include/s_conf.h ../include/class.h \ + ../include/supported.h +whowas.o: whowas.c ../include/stdinc.h ../libratbox/include/ratbox_lib.h \ + ../libratbox/include/librb-config.h ../libratbox/include/rb_tools.h \ + ../libratbox/include/rb_memory.h ../libratbox/include/rb_commio.h \ + ../libratbox/include/rb_balloc.h ../libratbox/include/rb_linebuf.h \ + ../libratbox/include/rb_snprintf.h ../libratbox/include/rb_event.h \ + ../libratbox/include/rb_helper.h ../libratbox/include/rb_rawbuf.h \ + ../libratbox/include/rb_patricia.h ../include/config.h \ + ../include/setup.h ../include/defaults.h ../include/ircd_defs.h \ + ../include/logger.h ../include/send.h ../include/whowas.h \ + ../include/client.h ../include/channel.h ../include/res.h \ + ../include/common.h ../include/reslib.h ../include/irc_string.h \ + ../include/sprintf_irc.h ../include/ircd.h ../include/snomask.h \ + ../include/client.h ../include/common.h ../include/hash.h \ + ../include/irc_string.h ../include/ircd.h ../include/ircd_defs.h \ + ../include/numeric.h ../include/s_serv.h ../include/s_user.h \ + ../include/send.h ../include/s_conf.h ../include/class.h \ + ../include/scache.h diff --git a/src/Makefile.in b/src/Makefile.in index 16376bd..9c62278 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -93,6 +93,7 @@ SRCS = \ scache.c \ send.c \ snomask.c \ + sslproc.c \ substitution.c \ supported.c \ whowas.c diff --git a/src/client.c b/src/client.c index b45acb2..06e051c 100644 --- a/src/client.c +++ b/src/client.c @@ -56,6 +56,7 @@ #include "reject.h" #include "scache.h" #include "irc_dictionary.h" +#include "sslproc.h" #define DEBUG_EXITED_CLIENTS @@ -161,7 +162,6 @@ make_client(struct Client *from) client_p->localClient->lasttime = client_p->localClient->firsttime = rb_current_time(); client_p->localClient->F = NULL; - client_p->localClient->ctrlF = NULL; client_p->preClient = (struct PreClient *) rb_bh_alloc(pclient_heap); @@ -220,8 +220,11 @@ free_local_client(struct Client *client_p) client_p->localClient->listener = 0; } - if(client_p->localClient->F) + if(client_p->localClient->F != NULL) + { + del_from_cli_fd_hash(client_p); rb_close(client_p->localClient->F); + } if(client_p->localClient->passwd) { @@ -235,6 +238,8 @@ free_local_client(struct Client *client_p) rb_free(client_p->localClient->opername); rb_free(client_p->localClient->mangledhost); + ssld_decrement_clicount(client_p->localClient->ssl_ctl); + rb_bh_free(lclient_heap, client_p->localClient); client_p->localClient = NULL; } @@ -2090,22 +2095,17 @@ close_connection(struct Client *client_p) else ServerStats.is_ni++; - if(client_p->localClient->F) + if(client_p->localClient->F != NULL) { /* attempt to flush any pending dbufs. Evil, but .. -- adrian */ if(!IsIOError(client_p)) send_queued(client_p); + del_from_cli_fd_hash(client_p); rb_close(client_p->localClient->F); client_p->localClient->F = NULL; } - if(client_p->localClient->ctrlF) - { - rb_close(client_p->localClient->ctrlF); - client_p->localClient->ctrlF = NULL; - } - rb_linebuf_donebuf(&client_p->localClient->buf_sendq); rb_linebuf_donebuf(&client_p->localClient->buf_recvq); detach_conf(client_p); diff --git a/src/hash.c b/src/hash.c index 561c7dc..ccc74d6 100644 --- a/src/hash.c +++ b/src/hash.c @@ -39,6 +39,10 @@ #include "cache.h" #include "s_newconf.h" +#define hash_cli_fd(x) (x % CLI_FD_MAX) + +static rb_dlink_list clientbyfdTable[U_MAX]; + rb_dlink_list *clientTable; rb_dlink_list *channelTable; rb_dlink_list *idTable; @@ -660,6 +664,37 @@ clear_resv_hash(void) HASH_WALK_END } +void +add_to_cli_fd_hash(struct Client *client_p) +{ + rb_dlinkAddAlloc(client_p, &clientbyfdTable[hash_cli_fd(rb_get_fd(client_p->localClient->F))]); +} + + +void +del_from_cli_fd_hash(struct Client *client_p) +{ + unsigned int hashv; + hashv = hash_cli_fd(rb_get_fd(client_p->localClient->F)); + rb_dlinkFindDestroy(client_p, &clientbyfdTable[hashv]); +} + +struct Client * +find_cli_fd_hash(int fd) +{ + struct Client *target_p; + rb_dlink_node *ptr; + unsigned int hashv; + hashv = hash_cli_fd(fd); + RB_DLINK_FOREACH(ptr, clientbyfdTable[hashv].head) + { + target_p = ptr->data; + if(rb_get_fd(target_p->localClient->F) == fd) + return target_p; + } + return NULL; +} + static void output_hash(struct Client *source_p, const char *name, int length, int *counts, int deepest) { diff --git a/src/ircd.c b/src/ircd.c index 5e108e0..9d659ef 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -65,6 +65,7 @@ #include "monitor.h" #include "patchlevel.h" #include "serno.h" +#include "sslproc.h" /* * Try and find the correct name to use with getrlimit() for setting the max. @@ -91,6 +92,9 @@ struct admin_info AdminInfo; struct Counter Count; struct ServerStatistics ServerStats; +int ssl_ok = 0; +int zlib_ok = 1; + /* * print_startup - print startup information */ @@ -565,6 +569,8 @@ main(int argc, char *argv[]) mod_add_path(MODULE_DIR "/autoload"); #endif + init_ssld(); + initialize_server_capabs(); /* Set up default_server_capabs */ initialize_global_set_options(); @@ -591,6 +597,18 @@ main(int argc, char *argv[]) } strlcpy(me.info, ServerInfo.description, sizeof(me.info)); + if(ServerInfo.ssl_cert != NULL && ServerInfo.ssl_private_key != NULL) + { + /* just do the rb_setup_ssl_server to validate the config */ + if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params)) + { + ilog(L_MAIN, "WARNING: Unable to setup SSL."); + ssl_ok = 0; + } + else + ssl_ok = 1; + } + if (testing_conf) { fprintf(stderr, "\nConfig testing complete.\n"); @@ -628,8 +646,6 @@ main(int argc, char *argv[]) rb_event_addish("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME); rb_event_addonce("try_connections_startup", try_connections, NULL, 0); - rb_event_addish("collect_zipstats", collect_zipstats, NULL, ZIPSTATS_TIME); - /* Setup the timeout check. I'll shift it later :) -- adrian */ rb_event_addish("rb_checktimeouts", rb_checktimeouts, NULL, 1); diff --git a/src/listener.c b/src/listener.c index e8a9260..c95e34f 100644 --- a/src/listener.c +++ b/src/listener.c @@ -41,6 +41,8 @@ #include "reject.h" #include "s_conf.h" #include "hostmask.h" +#include "sslproc.h" +#include "hash.h" #ifndef INADDR_NONE #define INADDR_NONE ((unsigned int) 0xffffffff) @@ -145,7 +147,8 @@ show_ports(struct Client *source_p) ntohs(((struct sockaddr_in *)&listener->addr)->sin_port), #endif IsOperAdmin(source_p) ? listener->name : me.name, - listener->ref_count, (listener->active) ? "active" : "disabled"); + listener->ref_count, (listener->active) ? "active" : "disabled", + listener->ssl ? " ssl" : ""); } } @@ -303,7 +306,7 @@ find_listener(struct rb_sockaddr_storage *addr) * the format "255.255.255.255" */ void -add_listener(int port, const char *vhost_ip, int family) +add_listener(int port, const char *vhost_ip, int family, int ssl) { listener_t *listener; struct rb_sockaddr_storage vaddr; @@ -375,6 +378,7 @@ add_listener(int port, const char *vhost_ip, int family) } listener->F = NULL; + listener->ssl = ssl; if(inetport(listener)) listener->active = 1; @@ -432,7 +436,7 @@ close_listeners() * any client list yet. */ static void -add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, int exempt) +add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, void *ssl_ctl, int exempt) { struct Client *new_client; s_assert(NULL != listener); @@ -456,8 +460,12 @@ add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, int strlcpy(new_client->host, new_client->sockhost, sizeof(new_client->host)); new_client->localClient->F = F; - + add_to_cli_fd_hash(new_client); new_client->localClient->listener = listener; + new_client->localClient->ssl_ctl = ssl_ctl; + if(ssl_ctl != NULL || rb_fd_ssl(F)) + SetSSL(new_client); + ++listener->ref_count; if(!exempt) @@ -479,6 +487,12 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi struct ConfItem *aconf; static time_t last_oper_notice = 0; + if(listener->ssl && (!ssl_ok || !get_ssld_count())) + { + rb_close(F); + return 0; + } + if((maxconnections - 10) < rb_get_fd(F)) /* XXX this is kinda bogus */ { ++ServerStats.is_ref; @@ -529,6 +543,16 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi return 1; } +static void +accept_ssld(rb_fde_t *F, struct sockaddr *addr, struct sockaddr *laddr, struct Listener *listener) +{ + ssl_ctl_t *ctl; + rb_fde_t *xF[2]; + rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF[0], &xF[1], "Incoming ssld Connection"); + ctl = start_ssld_accept(F, xF[1], rb_get_fd(xF[0])); /* this will close F for us */ + add_connection(listener, xF[0], addr, ctl, 1); +} + static void accept_callback(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t addrlen, void *data) { @@ -545,5 +569,8 @@ accept_callback(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t add rb_close(F); } - add_connection(listener, F, addr, 1); + if(listener->ssl) + accept_ssld(F, addr, (struct sockaddr *)&lip, listener); + else + add_connection(listener, F, addr, NULL, 1); } diff --git a/src/messages.tab b/src/messages.tab index d4f1486..0c97836 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -240,7 +240,7 @@ static const char * replies[] = { /* 217 RPL_STATSQLINE, */ "%c %d %s :%s", /* 218 RPL_STATSYLINE, */ "Y %s %d %d %d %u %d.%d %d.%d %u", /* 219 RPL_ENDOFSTATS, */ "%c :End of /STATS report", -/* 220 RPL_STATSPLINE, */ "%c %d %s %d :%s", +/* 220 RPL_STATSPLINE, */ "%c %d %s %d :%s%s", /* 221 RPL_UMODEIS, */ "%s", /* 222 */ NULL, /* 223 */ NULL, diff --git a/src/newconf.c b/src/newconf.c index e2032da..b436b54 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -28,6 +28,7 @@ #include "ircd.h" #include "snomask.h" #include "blacklist.h" +#include "sslproc.h" #define CF_TYPE(x) ((x) & CF_MTYPE) @@ -351,6 +352,7 @@ static struct mode_table connect_table[] = { { "compressed", SERVER_COMPRESSED }, { "encrypted", SERVER_ENCRYPTED }, { "topicburst", SERVER_TB }, + { "ssl", SERVER_SSL }, { NULL, 0 }, }; @@ -744,8 +746,10 @@ conf_end_listen(struct TopConf *tc) return 0; } + + static void -conf_set_listen_port(void *data) +conf_set_listen_port_both(void *data, int ssl) { conf_parm_t *args = data; for (; args; args = args->next) @@ -758,9 +762,9 @@ conf_set_listen_port(void *data) } if(listener_address == NULL) { - add_listener(args->v.number, listener_address, AF_INET); + add_listener(args->v.number, listener_address, AF_INET, ssl); #ifdef RB_IPV6 - add_listener(args->v.number, listener_address, AF_INET6); + add_listener(args->v.number, listener_address, AF_INET6, ssl); #endif } else @@ -773,13 +777,25 @@ conf_set_listen_port(void *data) #endif family = AF_INET; - add_listener(args->v.number, listener_address, family); + add_listener(args->v.number, listener_address, family, ssl); } } } +static void +conf_set_listen_port(void *data) +{ + conf_set_listen_port_both(data, 0); +} + +static void +conf_set_listen_sslport(void *data) +{ + conf_set_listen_port_both(data, 1); +} + static void conf_set_listen_address(void *data) { @@ -1150,6 +1166,13 @@ conf_end_connect(struct TopConf *tc) yy_server->flags &= ~SERVER_COMPRESSED; } #endif + if(ServerConfCompressed(yy_server) && ServerConfSSL(yy_server)) + { + conf_report_error("Ignoring compressed for connect block %s -- " + "ssl and compressed are mutually exclusive (OpenSSL does its own compression)", + yy_server->name); + yy_server->flags &= ~SERVER_COMPRESSED; + } add_server_conf(yy_server); rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list); @@ -1893,6 +1916,12 @@ static struct ConfEntry conf_serverinfo_table[] = { "vhost", CF_QSTRING, conf_set_serverinfo_vhost, 0, NULL }, { "vhost6", CF_QSTRING, conf_set_serverinfo_vhost6, 0, NULL }, + { "ssl_private_key", CF_QSTRING, NULL, 0, &ServerInfo.ssl_private_key }, + { "ssl_ca_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_ca_cert }, + { "ssl_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_cert }, + { "ssl_dh_params", CF_QSTRING, NULL, 0, &ServerInfo.ssl_dh_params }, + { "ssld_count", CF_INT, NULL, 0, &ServerInfo.ssld_count }, + { "default_max_clients",CF_INT, NULL, 0, &ServerInfo.default_max_clients }, { "\0", 0, NULL, 0, NULL } @@ -2099,6 +2128,7 @@ newconf_init() add_top_conf("listen", conf_begin_listen, conf_end_listen, NULL); add_conf_item("listen", "port", CF_INT | CF_FLIST, conf_set_listen_port); + add_conf_item("listen", "sslport", CF_INT | CF_FLIST, conf_set_listen_sslport); add_conf_item("listen", "ip", CF_QSTRING, conf_set_listen_address); add_conf_item("listen", "host", CF_QSTRING, conf_set_listen_address); diff --git a/src/packet.c b/src/packet.c index 1434f2c..9d8207b 100644 --- a/src/packet.c +++ b/src/packet.c @@ -224,132 +224,6 @@ flood_recalc(void *unused) } } -/* - * read_ctrl_packet - Read a 'packet' of data from a servlink control - * link and process it. - */ -void -read_ctrl_packet(rb_fde_t *F, void *data) -{ - struct Client *server = data; - struct LocalUser *lserver = server->localClient; - struct SlinkRpl *reply; - int length = 0; - unsigned char tmp[2]; - unsigned char *len = tmp; - struct SlinkRplDef *replydef; -#ifdef USE_IODEBUG_HOOKS - hook_data_int hdata; -#endif - - s_assert(lserver != NULL); - if(IsAnyDead(server)) - return; - - reply = &lserver->slinkrpl; - - - if(!reply->command) - { - reply->gotdatalen = 0; - reply->readdata = 0; - reply->data = NULL; - - length = rb_read(F, tmp, 1); - - if(length <= 0) - { - if((length == -1) && rb_ignore_errno(errno)) - goto nodata; - error_exit_client(server, length); - return; - } - - reply->command = tmp[0]; - } - - for (replydef = slinkrpltab; replydef->handler; replydef++) - { - if((int)replydef->replyid == reply->command) - break; - } - - /* we should be able to trust a local slink process... - * and if it sends an invalid command, that's a bug.. */ - s_assert(replydef->handler); - - if((replydef->flags & SLINKRPL_FLAG_DATA) && (reply->gotdatalen < 2)) - { - /* we need a datalen u16 which we don't have yet... */ - length = rb_read(F, len, (2 - reply->gotdatalen)); - if(length <= 0) - { - if((length == -1) && rb_ignore_errno(errno)) - goto nodata; - error_exit_client(server, length); - return; - } - - if(reply->gotdatalen == 0) - { - reply->datalen = *len << 8; - reply->gotdatalen++; - length--; - len++; - } - if(length && (reply->gotdatalen == 1)) - { - reply->datalen |= *len; - reply->gotdatalen++; - if(reply->datalen > 0) - reply->data = rb_malloc(reply->datalen); - } - - if(reply->gotdatalen < 2) - return; /* wait for more data */ - } - - if(reply->readdata < reply->datalen) /* try to get any remaining data */ - { - length = rb_read(F, (reply->data + reply->readdata), - (reply->datalen - reply->readdata)); - if(length <= 0) - { - if((length == -1) && rb_ignore_errno(errno)) - goto nodata; - error_exit_client(server, length); - return; - } - - reply->readdata += length; - if(reply->readdata < reply->datalen) - return; /* wait for more data */ - } - -#ifdef USE_IODEBUG_HOOKS - hdata.client = server; - hdata.arg1 = NULL; - hdata.arg2 = reply->command; - hdata.data = NULL; - call_hook(h_iorecvctrl_id, &hdata); -#endif - - /* we now have the command and any data, pass it off to the handler */ - (*replydef->handler) (reply->command, reply->datalen, reply->data, server); - - /* reset SlinkRpl */ - if(reply->datalen > 0) - rb_free(reply->data); - reply->command = 0; - - if(IsAnyDead(server)) - return; - - nodata: - /* If we get here, we need to register for another COMM_SELECT_READ */ - rb_setselect(F, RB_SELECT_READ, read_ctrl_packet, server); -} - /* * read_packet - Read a 'packet' of data from a connection and process it. */ diff --git a/src/s_conf.c b/src/s_conf.c index db2eba7..d35eed4 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -48,6 +48,7 @@ #include "reject.h" #include "cache.h" #include "blacklist.h" +#include "sslproc.h" struct config_server_hide ConfigServerHide; @@ -882,6 +883,26 @@ validate_conf(void) if(ServerInfo.network_desc == NULL) ServerInfo.network_desc = rb_strdup(NETWORK_DESC_DEFAULT); + if(ServerInfo.ssld_count < 1) + ServerInfo.ssld_count = 1; + + if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params)) + { + ilog(L_MAIN, "WARNING: Unable to setup SSL."); + ssl_ok = 0; + } else { + ssl_ok = 1; + send_new_ssl_certs(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params); + } + + if(ServerInfo.ssld_count > get_ssld_count()) + { + int start = ServerInfo.ssld_count - get_ssld_count(); + /* start up additional ssld if needed */ + start_ssldaemon(start, ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params); + + } + if((ConfigFileEntry.client_flood < CLIENT_FLOOD_MIN) || (ConfigFileEntry.client_flood > CLIENT_FLOOD_MAX)) ConfigFileEntry.client_flood = CLIENT_FLOOD_MAX; @@ -1240,6 +1261,8 @@ clear_out_old_conf(void) rb_free(ServerInfo.network_desc); ServerInfo.network_desc = NULL; + ServerInfo.ssld_count = 1; + /* clean out AdminInfo */ rb_free(AdminInfo.name); AdminInfo.name = NULL; diff --git a/src/s_serv.c b/src/s_serv.c index 0f6839a..60768e4 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -54,6 +54,7 @@ #include "hook.h" #include "msg.h" #include "reject.h" +#include "sslproc.h" extern char *crypt(); @@ -71,10 +72,6 @@ int refresh_user_links = 0; static char buf[BUFSIZE]; -static void start_io(struct Client *server); - -static SlinkRplHnd slink_error; -static SlinkRplHnd slink_zipstats; /* * list of recognized server capabilities. "TS" is not on the list * because all servers that we talk to already do TS, and the kludged @@ -101,128 +98,8 @@ struct Capability captab[] = { {0, 0} }; -struct SlinkRplDef slinkrpltab[] = { - {SLINKRPL_ERROR, slink_error, SLINKRPL_FLAG_DATA}, - {SLINKRPL_ZIPSTATS, slink_zipstats, SLINKRPL_FLAG_DATA}, - {0, 0, 0}, -}; - -static int fork_server(struct Client *client_p); - static CNCB serv_connect_callback; - -void -slink_error(unsigned int rpl, unsigned int len, unsigned char *data, struct Client *server_p) -{ - char squitreason[256]; - - s_assert(rpl == SLINKRPL_ERROR); - - s_assert(len < 256); - data[len - 1] = '\0'; - - sendto_realops_snomask(SNO_GENERAL, L_ALL, "SlinkError for %s: %s", server_p->name, data); - snprintf(squitreason, sizeof squitreason, "servlink error: %s", data); - exit_client(server_p, server_p, &me, squitreason); -} - -void -slink_zipstats(unsigned int rpl, unsigned int len, unsigned char *data, struct Client *server_p) -{ - struct ZipStats zipstats; - u_int32_t in = 0, in_wire = 0, out = 0, out_wire = 0; - int i = 0; - - s_assert(rpl == SLINKRPL_ZIPSTATS); - s_assert(len == 16); - s_assert(IsCapable(server_p, CAP_ZIP)); - - /* Yes, it needs to be done this way, no we cannot let the compiler - * work with the pointer to the structure. This works around a GCC - * bug on SPARC that affects all versions at the time of this writing. - * I will feed you to the creatures living in RMS's beard if you do - * not leave this as is, without being sure that you are not causing - * regression for most of our installed SPARC base. - * -jmallett, 04/27/2002 - */ - memcpy(&zipstats, &server_p->localClient->zipstats, sizeof(struct ZipStats)); - - in |= (data[i++] << 24); - in |= (data[i++] << 16); - in |= (data[i++] << 8); - in |= (data[i++]); - - in_wire |= (data[i++] << 24); - in_wire |= (data[i++] << 16); - in_wire |= (data[i++] << 8); - in_wire |= (data[i++]); - - out |= (data[i++] << 24); - out |= (data[i++] << 16); - out |= (data[i++] << 8); - out |= (data[i++]); - - out_wire |= (data[i++] << 24); - out_wire |= (data[i++] << 16); - out_wire |= (data[i++] << 8); - out_wire |= (data[i++]); - - zipstats.in += in; - zipstats.inK += zipstats.in >> 10; - zipstats.in &= 0x03ff; - - zipstats.in_wire += in_wire; - zipstats.inK_wire += zipstats.in_wire >> 10; - zipstats.in_wire &= 0x03ff; - - zipstats.out += out; - zipstats.outK += zipstats.out >> 10; - zipstats.out &= 0x03ff; - - zipstats.out_wire += out_wire; - zipstats.outK_wire += zipstats.out_wire >> 10; - zipstats.out_wire &= 0x03ff; - - if(zipstats.inK > 0) - zipstats.in_ratio = - (((double) (zipstats.inK - zipstats.inK_wire) / - (double) zipstats.inK) * 100.00); - else - zipstats.in_ratio = 0; - - if(zipstats.outK > 0) - zipstats.out_ratio = - (((double) (zipstats.outK - zipstats.outK_wire) / - (double) zipstats.outK) * 100.00); - else - zipstats.out_ratio = 0; - - memcpy(&server_p->localClient->zipstats, &zipstats, sizeof(struct ZipStats)); -} - -void -collect_zipstats(void *unused) -{ - rb_dlink_node *ptr; - struct Client *target_p; - - RB_DLINK_FOREACH(ptr, serv_list.head) - { - target_p = ptr->data; - if(IsCapable(target_p, CAP_ZIP)) - { - /* only bother if we haven't already got something queued... */ - if(!target_p->localClient->slinkq) - { - target_p->localClient->slinkq = rb_malloc(1); /* sigh.. */ - target_p->localClient->slinkq[0] = SLINKCMD_ZIPSTATS; - target_p->localClient->slinkq_ofs = 0; - target_p->localClient->slinkq_len = 1; - send_queued_slink_write(target_p->localClient->ctrlF, target_p); - } - } - } -} +static CNCB serv_connect_ssl_callback; /* * hunt_server - Do the basic thing in delivering the message (command) @@ -361,6 +238,10 @@ try_connections(void *unused) if(ServerConfIllegal(tmp_p) || !ServerConfAutoconn(tmp_p)) continue; + /* don't allow ssl connections if ssl isn't setup */ + if(ServerConfSSL(tmp_p) && (!ssl_ok || !get_ssld_count())) + continue; + cltmp = tmp_p->class; /* @@ -488,6 +369,11 @@ check_server(const char *name, struct Client *client_p) if(server_p == NULL) return error; + if(ServerConfSSL(server_p) && client_p->localClient->ssl_ctl == NULL) + { + return -5; + } + attach_server_conf(client_p, server_p); /* clear ZIP/TB if they support but we dont want them */ @@ -1063,21 +949,11 @@ server_estab(struct Client *client_p) if(!rb_set_buffers(client_p->localClient->F, READBUF_SIZE)) ilog_error("rb_set_buffers failed for server"); - /* Hand the server off to servlink now */ - if(IsCapable(client_p, CAP_ZIP)) - { - if(fork_server(client_p) < 0) - { - sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL, - "Warning: fork failed for server %s -- check servlink_path (%s)", - get_server_name(client_p, HIDE_IP), - ConfigFileEntry.servlink_path); - return exit_client(client_p, client_p, client_p, "Fork failed"); - } - start_io(client_p); - SetServlink(client_p); - } - + /* Enable compression now */ + if(IsCapable(client_p, CAP_ZIP)) + { + start_zlib_session(client_p); + } sendto_one(client_p, "SVINFO %d %d 0 :%ld", TS_CURRENT, TS_MIN, rb_current_time()); client_p->servptr = &me; @@ -1133,21 +1009,8 @@ server_estab(struct Client *client_p) hdata.target = client_p; call_hook(h_server_introduced, &hdata); - if(HasServlink(client_p)) - { - /* we won't overflow FD_DESC_SZ here, as it can hold - * client_p->name + 64 - */ - rb_snprintf(note, sizeof note, "slink data: %s", client_p->name); - rb_note(client_p->localClient->F, note); - rb_snprintf(note, sizeof note, "slink ctrl: %s", client_p->name); - rb_note(client_p->localClient->ctrlF, note); - } - else - { - rb_snprintf(note, sizeof note, "Server: %s", client_p->name); - rb_note(client_p->localClient->F, note); - } + rb_snprintf(note, sizeof(note), "Server: %s", client_p->name); + rb_note(client_p->localClient->F, note); /* ** Old sendto_serv_but_one() call removed because we now @@ -1240,201 +1103,10 @@ server_estab(struct Client *client_p) free_pre_client(client_p); - return 0; -} - -static void -start_io(struct Client *server) -{ - unsigned char *iobuf; - int c = 0; - int linecount = 0; - int linelen; - - iobuf = rb_malloc(256); /* XXX: This seems arbitrary. Perhaps make it IRCD_BUFSIZE? --nenolod */ - - if(IsCapable(server, CAP_ZIP)) - { - /* ziplink */ - iobuf[c++] = SLINKCMD_SET_ZIP_OUT_LEVEL; - iobuf[c++] = 0; /* | */ - iobuf[c++] = 1; /* \ len is 1 */ - iobuf[c++] = ConfigFileEntry.compression_level; - iobuf[c++] = SLINKCMD_START_ZIP_IN; - iobuf[c++] = SLINKCMD_START_ZIP_OUT; - } - - while (MyConnect(server)) - { - linecount++; - - iobuf = rb_realloc(iobuf, (c + READBUF_SIZE + 64)); - - /* store data in c+3 to allow for SLINKCMD_INJECT_RECVQ and len u16 */ - linelen = rb_linebuf_get(&server->localClient->buf_recvq, (char *) (iobuf + c + 3), READBUF_SIZE, LINEBUF_PARTIAL, LINEBUF_RAW); /* include partial lines */ - - if(linelen) - { - iobuf[c++] = SLINKCMD_INJECT_RECVQ; - iobuf[c++] = (linelen >> 8); - iobuf[c++] = (linelen & 0xff); - c += linelen; - } - else - break; - } - - while (MyConnect(server)) - { - linecount++; - - iobuf = rb_realloc(iobuf, (c + BUF_DATA_SIZE + 64)); - - /* store data in c+3 to allow for SLINKCMD_INJECT_RECVQ and len u16 */ - linelen = rb_linebuf_get(&server->localClient->buf_sendq, - (char *) (iobuf + c + 3), READBUF_SIZE, - LINEBUF_PARTIAL, LINEBUF_PARSED); /* include partial lines */ - - if(linelen) - { - iobuf[c++] = SLINKCMD_INJECT_SENDQ; - iobuf[c++] = (linelen >> 8); - iobuf[c++] = (linelen & 0xff); - c += linelen; - } - else - break; - } - - /* start io */ - iobuf[c++] = SLINKCMD_INIT; - - server->localClient->slinkq = iobuf; - server->localClient->slinkq_ofs = 0; - server->localClient->slinkq_len = c; - - /* schedule a write */ - send_queued_slink_write(server->localClient->ctrlF, server); -} - -/* - * fork_server - * - * inputs - struct Client *server - * output - success: 0 / failure: -1 - * side effect - fork, and exec SERVLINK to handle this connection - */ -static int -fork_server(struct Client *server) -{ - int ret; - int i; - int ctrl_fds[2]; - int data_fds[2]; - - char fd_str[4][6]; - char *kid_argv[7]; - char slink[] = "-slink"; - - - /* ctrl */ -#ifdef HAVE_SOCKETPAIR - if(socketpair(AF_UNIX, SOCK_STREAM, 0, ctrl_fds) < 0) -#else - if(inet_socketpair(AF_INET,SOCK_STREAM, 0, ctrl_fds) < 0) -#endif - goto fork_error; - - - - /* data */ -#ifdef HAVE_SOCKETPAIR - if(socketpair(AF_UNIX, SOCK_STREAM, 0, data_fds) < 0) -#else - if(inet_socketpair(AF_INET,SOCK_STREAM, 0, data_fds) < 0) -#endif - goto fork_error; - - -#ifdef __CYGWIN__ - if((ret = vfork()) < 0) -#else - if((ret = fork()) < 0) -#endif - goto fork_error; - else if(ret == 0) - { - int maxconn = maxconnections; - - /* set our fds as non blocking and close everything else */ - for (i = 0; i < maxconn; i++) - { - - - if((i == ctrl_fds[1]) || (i == data_fds[1]) || (i == rb_get_fd(server->localClient->F))) - { - // XXX rb_set_nb(i); - } - else - { -#ifdef __CYGWIN__ - if(i > 2) /* don't close std* */ -#endif - close(i); - } - } - - rb_snprintf(fd_str[0], sizeof(fd_str[0]), "%d", ctrl_fds[1]); - rb_snprintf(fd_str[1], sizeof(fd_str[1]), "%d", data_fds[1]); - rb_snprintf(fd_str[2], sizeof(fd_str[2]), "%d", rb_get_fd(server->localClient->F)); - kid_argv[0] = slink; - kid_argv[1] = fd_str[0]; - kid_argv[2] = fd_str[1]; - kid_argv[3] = fd_str[2]; - kid_argv[4] = NULL; - - /* exec servlink program */ - execv(ConfigFileEntry.servlink_path, kid_argv); - - /* We're still here, abort. */ - _exit(1); - } - else - { - rb_close(server->localClient->F); - - /* close the childs end of the pipes */ - close(ctrl_fds[1]); - close(data_fds[1]); - - s_assert(server->localClient); - server->localClient->ctrlF = rb_open(ctrl_fds[0], RB_FD_PIPE, "servlink ctrl"); - server->localClient->F = rb_open(data_fds[0], RB_FD_PIPE, "servlink data"); - - if(!rb_set_nb(server->localClient->ctrlF)) - { - ilog_error("setting a slink fd nonblocking"); - } - - if(!rb_set_nb(server->localClient->F)) - { - ilog_error("setting a slink fd nonblocking"); - } - - read_ctrl_packet(server->localClient->ctrlF, server); - read_packet(server->localClient->F, server); - } + if (!IsCapable(client_p, CAP_ZIP)) + send_pop_queue(client_p); return 0; - - fork_error: - /* this is ugly, but nicer than repeating - * about 50 close() statements everywhre... */ - close(data_fds[0]); - close(data_fds[1]); - close(ctrl_fds[0]); - close(ctrl_fds[1]); - return -1; } /* @@ -1499,11 +1171,16 @@ serv_connect_resolved(struct Client *client_p) #endif (server_p->aftype == AF_INET ? "IPv4" : "?")); - rb_connect_tcp(client_p->localClient->F, - (struct sockaddr *) &client_p->localClient->ip, - NULL, 0, - serv_connect_callback, client_p, - ConfigFileEntry.connect_timeout); + if(ServerConfSSL(server_p)) + { + rb_connect_tcp(client_p->localClient->F, (struct sockaddr *)&client_p->localClient->ip, + NULL, 0, serv_connect_ssl_callback, + client_p, ConfigFileEntry.connect_timeout); + } + else + rb_connect_tcp(client_p->localClient->F, (struct sockaddr *)&client_p->localClient->ip, + NULL, 0, serv_connect_callback, + client_p, ConfigFileEntry.connect_timeout); return 1; } @@ -1516,11 +1193,16 @@ serv_connect_resolved(struct Client *client_p) (server_p->aftype == AF_INET ? "IPv4" : "?"), vhoststr); - rb_connect_tcp(client_p->localClient->F, - (struct sockaddr *) &client_p->localClient->ip, - (struct sockaddr *) &myipnum, GET_SS_LEN(&myipnum), - serv_connect_callback, client_p, - ConfigFileEntry.connect_timeout); + if(ServerConfSSL(server_p)) + rb_connect_tcp(client_p->localClient->F, (struct sockaddr *)&client_p->localClient->ip, + (struct sockaddr *) &myipnum, + GET_SS_LEN(&myipnum), serv_connect_ssl_callback, client_p, + ConfigFileEntry.connect_timeout); + else + rb_connect_tcp(client_p->localClient->F, (struct sockaddr *)&client_p->localClient->ip, + (struct sockaddr *) &myipnum, + GET_SS_LEN(&myipnum), serv_connect_callback, client_p, + ConfigFileEntry.connect_timeout); return 1; } @@ -1626,6 +1308,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) strlcpy(client_p->host, server_p->host, sizeof(client_p->host)); strlcpy(client_p->sockhost, server_p->host, sizeof(client_p->sockhost)); client_p->localClient->F = F; + add_to_cli_fd_hash(client_p); /* * Set up the initial server evilness, ripped straight from @@ -1703,6 +1386,34 @@ serv_connect(struct server_conf *server_p, struct Client *by) } } +static void +serv_connect_ev(void *data) +{ + struct Client *client_p = data; + serv_connect_callback(client_p->localClient->F, RB_OK, client_p); +} + +static void +serv_connect_ssl_callback(rb_fde_t *F, int status, void *data) +{ + struct Client *client_p = data; + rb_fde_t *xF[2]; + if(status != RB_OK) + { + /* XXX deal with failure */ + return; + } + rb_connect_sockaddr(F, (struct sockaddr *)&client_p->localClient->ip, sizeof(client_p->localClient->ip)); + rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF[0], &xF[1], "Outgoing ssld connection"); + del_from_cli_fd_hash(client_p); + client_p->localClient->F = xF[0]; + add_to_cli_fd_hash(client_p); + + client_p->localClient->ssl_ctl = start_ssld_connect(F, xF[1], rb_get_fd(xF[0])); + SetSSL(client_p); + rb_event_addonce("serv_connect_ev", serv_connect_ev, client_p, 1); +} + /* * serv_connect_callback() - complete a server connection. * @@ -1735,6 +1446,9 @@ serv_connect_callback(rb_fde_t *F, int status, void *data) return; } + if(client_p->localClient->ssl_ctl == NULL) + rb_connect_sockaddr(F, (struct sockaddr *)&client_p->localClient->ip, sizeof(client_p->localClient->ip)); + /* Check the status */ if(status != RB_OK) { diff --git a/src/send.c b/src/send.c index 4b64c2d..d2d603f 100644 --- a/src/send.c +++ b/src/send.c @@ -149,6 +149,14 @@ send_queued(struct Client *to) if(IsIOError(to)) return; + /* Something wants us to not send anything currently */ + /* if(IsCork(to)) + return; */ + + /* try to flush later when the write event resets this */ + if(IsFlush(to)) + return; + #ifdef USE_IODEBUG_HOOKS hd.client = to; if(to->localClient->buf_sendq.list.head) @@ -173,6 +181,8 @@ send_queued(struct Client *to) #endif + ClearFlush(to); + to->localClient->sendB += retlen; me.localClient->sendB += retlen; if(to->localClient->sendB > 1023) @@ -193,9 +203,26 @@ send_queued(struct Client *to) return; } } - if(rb_linebuf_len(&to->localClient->buf_sendq)) - rb_setselect(to->localClient->F, RB_SELECT_WRITE, - send_queued_write, to); + + if(rb_linebuf_len(&to->localClient->buf_sendq)) + { + SetFlush(to); + rb_setselect(to->localClient->F, RB_SELECT_WRITE, + send_queued_write, to); + } + else + ClearFlush(to); +} + +void +send_pop_queue(struct Client *to) +{ + if(to->from != NULL) + to = to->from; + if(!MyConnect(to) || IsIOError(to)) + return; + if(rb_linebuf_len(&to->localClient->buf_sendq) > 0) + send_queued(to); } /* send_queued_write() @@ -208,73 +235,10 @@ static void send_queued_write(rb_fde_t *F, void *data) { struct Client *to = data; - /*ClearFlush(to);*/ + ClearFlush(to); send_queued(to); } -/* send_queued_slink_write() - * - * inputs - fd to have queue sent, client we're sending to - * outputs - contents of queue - * side effects - write is rescheduled if queue isnt emptied - */ -void -send_queued_slink_write(rb_fde_t *F, void *data) -{ - struct Client *to = data; - int retlen; - - /* - ** Once socket is marked dead, we cannot start writing to it, - ** even if the error is removed... - */ - if(IsIOError(to)) - return; - - /* Next, lets try to write some data */ - if(to->localClient->slinkq) - { - retlen = rb_write(to->localClient->ctrlF, - to->localClient->slinkq + to->localClient->slinkq_ofs, - to->localClient->slinkq_len); - - if(retlen < 0) - { - /* If we have a fatal error */ - if(!rb_ignore_errno(errno)) - { - dead_link(to); - return; - } - } - /* 0 bytes is an EOF .. */ - else if(retlen == 0) - { - dead_link(to); - return; - } - else - { - to->localClient->slinkq_len -= retlen; - - s_assert(to->localClient->slinkq_len >= 0); - if(to->localClient->slinkq_len) - to->localClient->slinkq_ofs += retlen; - else - { - to->localClient->slinkq_ofs = 0; - rb_free(to->localClient->slinkq); - to->localClient->slinkq = NULL; - } - } - } - - /* if we have any more data, reschedule a write */ - if(to->localClient->slinkq_len) - rb_setselect(to->localClient->ctrlF, - RB_SELECT_WRITE, send_queued_slink_write, to); -} - /* sendto_one() * * inputs - client to send to, va_args