Commit Graph

80 Commits

Author SHA1 Message Date
Uli Schlachter 88e7f093a1 Update to latest Csocket
Fixes:

- A possible crash bug for empty DNS replies with c-ares. E.g. a AAAA lookup for
  google.com doesn't give any reply but is still successful. This might be a
  c-ares bug (there is ARES_ENODATA) or c-ares just changed its behavior?
  (No bug report, just noticed accidentally)
- Connecting to ipv4-only hosts with a v6 bindhost caused weird errors:
  https://github.com/znc/znc/issues/47
- There was a pull request for some DSA server certificate thingy:
  https://github.com/znc/znc/pull/46
- Busy loop waiting for an SSL handshake to finish:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631590
- Some other stuff? No idea what some of the changes in here are actually doing.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-06-26 12:11:40 +02:00
Un1matr1x 708366d9ae remove some more of the evil trailing white spaces & tabs 2011-06-09 21:29:13 +02:00
Uli Schlachter e0c5c3b93c Csocket: Compile when SSLv2 is disabled in openssl
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-15 18:03:38 +02:00
Uli Schlachter cc552fb3f5 Update to latest Csocket
We are using a vanilla version of Csocket again. Previously, our copy of
Csocket.h had a new '#include "zncconfig.h"'.

The other changes are mostly cleanup for various compiler warnings. The switch
from inet_ntoa() to inet_ntop() is for thread-safety reasons.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-18 11:56:39 +01:00
psychon d8f4e31939 Update to latest Csocket
Csocket switched from CVS to git, yay!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2170 726aef4b-f618-498e-8847-2d620e286838
2010-11-06 15:15:09 +00:00
psychon 2809dd1108 Csocket: Clear the buffer in DisableReadLine()
This clears the internal read buffer in DisableReadLine(). This fixes
"accidental bugs" where CHTTPSock does DisableReadLine() and then reads the post
data via ReadData(). The problem is when we do DisableReadLine() in ReadLine()
and then return from it. All the stuff is still in the read buffer which
triggers a MaxBufferReached() call which causes us to drop the connection.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2148 726aef4b-f618-498e-8847-2d620e286838
2010-09-27 18:51:55 +00:00
psychon e48a6be48d Update to latest Csocket
This fixes a busy-loop bug with openssl and adds support for using poll()
instead of select().

Currently, poll() isn't used unless you use
./configure CXXFLAGS="-DCSOCK_USE_POLL".


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2096 726aef4b-f618-498e-8847-2d620e286838
2010-08-03 11:37:52 +00:00
psychon 635fb4bc00 Update to latest Csocket
This adds Csock::ConvertAddress() which produces printable addresses. We use
this function in CZNCSock to strip away 4in6 prefixes (e.g. ::ffff:127.0.0.1).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1930 726aef4b-f618-498e-8847-2d620e286838
2010-04-25 11:17:42 +00:00
psychon e77adef048 Update to latest Csocket
This gets rid of some openssl-related warnings from valgrind's memcheck and adds
Csock::GetPeerFingerprint().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1905 726aef4b-f618-498e-8847-2d620e286838
2010-04-11 19:00:30 +00:00
psychon 8d37abf312 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1814 726aef4b-f618-498e-8847-2d620e286838
2010-03-07 15:46:36 +00:00
psychon f5ede26cea Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1766 726aef4b-f618-498e-8847-2d620e286838
2010-02-18 13:04:11 +00:00
imaginos 94479f3977 commiting the commit i should have comitted prior to the previous commit. (accidently turned the const L into a 0), also allow for missing openssl version
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1753 726aef4b-f618-498e-8847-2d620e286838
2010-02-12 23:29:15 +00:00
imaginos d6b2c4119b <---- i'm with stupid
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1752 726aef4b-f618-498e-8847-2d620e286838
2010-02-12 23:06:19 +00:00
imaginos 558e277968 keep supporting older versions of openssl
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1751 726aef4b-f618-498e-8847-2d620e286838
2010-02-12 22:59:04 +00:00
imaginos 9f7c0db46d added workaround for v23 undefined const function before handshake is finished type bug thing
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1750 726aef4b-f618-498e-8847-2d620e286838
2010-02-10 23:33:22 +00:00
psychon b18e42df55 Update to latest Csocket again
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1735 726aef4b-f618-498e-8847-2d620e286838
2010-02-05 13:13:51 +00:00
psychon c7546c0c05 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1727 726aef4b-f618-498e-8847-2d620e286838
2010-01-28 19:55:23 +00:00
imaginos ebbc126b72 cleanup some, and aggregate common code
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1713 726aef4b-f618-498e-8847-2d620e286838
2010-01-15 20:19:02 +00:00
imaginos ca1e8d43c3 added workaround for a canonical name that points to ipv6 and ipv4 ip's, the ipv6 ip is tried first, followed up by a final try on ipv4 in the event the ipv6 connect results in a network unreachable. I wonder what this will break ...
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1712 726aef4b-f618-498e-8847-2d620e286838
2010-01-15 19:45:58 +00:00
imaginos e566a53585 cleanup some crosseyed code
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1710 726aef4b-f618-498e-8847-2d620e286838
2010-01-12 20:46:52 +00:00
imaginos f1515361fd added workaround for older c-ares version, implemented library init calls per KiNgMaR
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1709 726aef4b-f618-498e-8847-2d620e286838
2010-01-12 20:05:58 +00:00
imaginos 5ea1f8cc05 bring csocket changes up to date with win32 fixes provided by DGandalf, also forgot to implement ares_timeout
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1708 726aef4b-f618-498e-8847-2d620e286838
2010-01-12 18:51:31 +00:00
cflakes 25ef34398d Update to latest Csocket. A Thank You goes out to DGandalf for noticing a bug in Csocket's c-ares code and another one of course to Imaginos for promptly looking into and fixing this.
The issue was that a timeout was being applied when c-ares really takes care of timeouts.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1707 726aef4b-f618-498e-8847-2d620e286838
2010-01-12 00:28:24 +00:00
psychon 1b51f15d47 Switch to Csocket's c-ares code
This removes all of znc's c-ares code and instead enables Csocket's built-in
version. That code is newer than ZNC's, but should hopefully work just as good.
Let's wait for the bug reports....


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1704 726aef4b-f618-498e-8847-2d620e286838
2010-01-10 13:20:20 +00:00
psychon 6ce29e77f2 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1683 726aef4b-f618-498e-8847-2d620e286838
2009-12-19 16:29:26 +00:00
psychon 3fd82a600c Always use blocking DNS for resolving bind hosts
This fixes a bug where ZNC failed to bind to domain names if they weren't
mentioned in /etc/hosts.

Thanks to alturiak for finding and reporting this.
Thanks to Imaginos for finding a quick workaround.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1673 726aef4b-f618-498e-8847-2d620e286838
2009-12-10 21:29:47 +00:00
psychon 2137d5a7cf Update to latest Csocket
This fixes a minor bug where a socket's timeout mode was changed when it was
copied to another socket.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1621 726aef4b-f618-498e-8847-2d620e286838
2009-09-10 06:30:34 +00:00
psychon 9bb57639e1 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1615 726aef4b-f618-498e-8847-2d620e286838
2009-09-02 17:26:06 +00:00
psychon 4c14b1bf61 Fix a DNS bug in Csocket with non-blocking resolvers
After the first attempt to lookup an address, Csocket already created the socket
used for communicating. Since at this point it wasn't yet known whether we will
yield a IPv4 or IPv6 address, Csocket just always used IPv4. This would then
later fail to connect() with 'Address family not supported by protocol'.

This patch fixes this by creating the socket fd only when the DNS lookup
completed successfully.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1556 726aef4b-f618-498e-8847-2d620e286838
2009-07-04 12:54:15 +00:00
psychon 37d0c5e58e Update to latest Csocket
Thanks to Imaginos for implementing this. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1509 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 08:10:00 +00:00
psychon 6faf0980b9 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1490 726aef4b-f618-498e-8847-2d620e286838
2009-04-13 08:18:35 +00:00
psychon 9a2e17c657 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1444 726aef4b-f618-498e-8847-2d620e286838
2009-03-25 15:38:11 +00:00
psychon a2abf0fd44 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1407 726aef4b-f618-498e-8847-2d620e286838
2009-03-03 11:09:44 +00:00
psychon 9210bdc97e Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1335 726aef4b-f618-498e-8847-2d620e286838
2009-01-18 10:32:16 +00:00
psychon c03bd91589 Update to latest Csocket and use its new init interface
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1288 726aef4b-f618-498e-8847-2d620e286838
2008-12-10 15:53:07 +00:00
psychon 583b91f719 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1225 726aef4b-f618-498e-8847-2d620e286838
2008-09-28 17:17:46 +00:00
psychon 69f44c35a0 Update to latest Csocket
SockError() is now called with the correct errno if accept() fails.
This is some preparation for a later patch which will handle EMFILE.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1179 726aef4b-f618-498e-8847-2d620e286838
2008-08-29 18:59:05 +00:00
psychon c3b6a4b29a Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1159 726aef4b-f618-498e-8847-2d620e286838
2008-08-18 11:10:27 +00:00
imaginos 4059f8c3ed missing paren in test
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1087 726aef4b-f618-498e-8847-2d620e286838
2008-06-07 23:35:43 +00:00
psychon 5665fd872d Update to latest Csocket
This breaks (& fixes again, as far as ZNC itself is concerened) API!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1040 726aef4b-f618-498e-8847-2d620e286838
2008-05-06 14:47:13 +00:00
imaginos 3583b4b5de fix state bug when connecting to a remote host thats ssl, results from a hostname that resolves to multiple ip's
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1013 726aef4b-f618-498e-8847-2d620e286838
2008-04-02 16:15:24 +00:00
imaginos 493d515490 this should fix all the ipv4/ipv6 issues, tested it on fbsd and linux
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@999 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 00:22:43 +00:00
imaginos a89fa4618d removing connect() completely. replacing with hint to AI_ADDRCONFIG
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@998 726aef4b-f618-498e-8847-2d620e286838
2008-03-31 06:15:28 +00:00
imaginos a91f86d1c2 commenting out this test for now
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@997 726aef4b-f618-498e-8847-2d620e286838
2008-03-31 04:53:21 +00:00
imaginos 3933f807df wasn't being to smart here, not totally portable when specifying IPPROTO_IP, use the protocol pass in for best portability
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@996 726aef4b-f618-498e-8847-2d620e286838
2008-03-31 02:37:34 +00:00
imaginos fc191e4908 state bug, from previous fix broken vhost binding
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@995 726aef4b-f618-498e-8847-2d620e286838
2008-03-30 16:28:44 +00:00
imaginos 1fb0039732 reverse the order of dns lookup on bind vs dns lookup on remote host. this also does a check on each ip returned by getaddrinfo to be sure its able to connect to that host
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@994 726aef4b-f618-498e-8847-2d620e286838
2008-03-28 05:09:48 +00:00
psychon ba619d0b3f Update to latest Csocket *again*
Csocket closed the sockets before openssl could send the close alert.
This fixes that.

Why am I always finding bugs in this code? :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@968 726aef4b-f618-498e-8847-2d620e286838
2008-02-29 15:51:04 +00:00
psychon 331f8b1e3a Update to latest Csocket
This fixes a bug where Csocket would do busy reads and writes on sockets it
got from listening sockets through accept().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@967 726aef4b-f618-498e-8847-2d620e286838
2008-02-29 06:44:22 +00:00
psychon be3edeee82 Update to latest Csocket
This fixes some trailing whitespaces and space/tab mixups I found.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@958 726aef4b-f618-498e-8847-2d620e286838
2008-02-16 12:50:07 +00:00