]> jfr.im git - irc/znc/Csocket.git/log
irc/znc/Csocket.git
10 years agoFix code naming consistency. Additionally, put back the default to SSLv23_client_meth...
Jim Hull [Wed, 23 Apr 2014 04:29:46 +0000 (21:29 -0700)] 
Fix code naming consistency. Additionally, put back the default to SSLv23_client_method/SSLv23_server_method since it is already handling TLS and does a graceful degradation to prior SSL/TLS versions (check man page, also examine ssl23_client_hello in openssl code)

10 years agoDefault to TLSv1.2
Kyle Fuller [Sun, 20 Apr 2014 18:54:12 +0000 (19:54 +0100)] 
Default to TLSv1.2

It's 2014, no idea how this made it as a default for the past 16 years...

10 years agoSupport TLSv1.1 and TLSv1.2
Kyle Fuller [Sun, 20 Apr 2014 18:48:16 +0000 (19:48 +0100)] 
Support TLSv1.1 and TLSv1.2

10 years agoFix formatting per style described in header
Jim Hull [Sat, 25 Jan 2014 02:59:27 +0000 (18:59 -0800)] 
Fix formatting per style described in header

10 years agoUps, forgot about no encoding...
Alexey Sokolov [Fri, 24 Jan 2014 23:26:04 +0000 (23:26 +0000)] 
Ups, forgot about no encoding...

10 years agoAdd support for character encodings
Alexey Sokolov [Fri, 24 Jan 2014 22:23:41 +0000 (22:23 +0000)] 
Add support for character encodings

10 years agoprotect literal, unmodified access to m_sSend
Jim Hull [Sat, 7 Dec 2013 18:32:38 +0000 (10:32 -0800)] 
protect literal, unmodified access to m_sSend

10 years agomissed a spot to reset write buffer position
Jim Hull [Sat, 7 Dec 2013 18:20:01 +0000 (10:20 -0800)] 
missed a spot to reset write buffer position

10 years agoFixed a bug where a single large write would cause a CPU spike and data would be...
Jim Hull [Sat, 7 Dec 2013 17:58:01 +0000 (09:58 -0800)] 
Fixed a bug where a single large write would cause a CPU spike and data would be sent at a snails pace. This was due to the buffer m_sSend being erase from the front after every small write/send operation. The fix to this is to simple track a last sent position in m_sSend and then do the erase/clear operation at once when the writing is done.

10 years agochange int usage to cs_sock_t.
Ingmar Runge [Sun, 27 Oct 2013 14:42:35 +0000 (15:42 +0100)] 
change int usage to cs_sock_t.

Replace the remaining instances where int is used as FD type with
cs_sock_t. This fixes a considerable number of warnings on Win32.

10 years agocouple fixes for fbsd
Jim Hull [Thu, 12 Sep 2013 23:55:56 +0000 (16:55 -0700)] 
couple fixes for fbsd

10 years agotweak formatting
Jim Hull [Sun, 16 Jun 2013 14:39:05 +0000 (07:39 -0700)] 
tweak formatting

10 years agoFix "Error: Success" message when remote ssl socket closed without handshake.
Alexey Sokolov [Sun, 16 Jun 2013 06:58:14 +0000 (10:58 +0400)] 
Fix "Error: Success" message when remote ssl socket closed without handshake.

11 years agochanged size() calls to use empty()
Robin Hiroko Walsh [Tue, 4 Dec 2012 20:15:29 +0000 (12:15 -0800)] 
changed size() calls to use empty()

11 years agoFix FTBFS introduced in 1861371ec028dea414c4f3ca2910f5662cc2677a
Alexey Sokolov [Tue, 20 Nov 2012 15:08:51 +0000 (22:08 +0700)] 
Fix FTBFS introduced in 1861371ec028dea414c4f3ca2910f5662cc2677a

See https://github.com/znc/znc/issues/254

11 years agoclean up static callbacks
Jim Hull [Tue, 13 Nov 2012 06:50:56 +0000 (22:50 -0800)] 
clean up static callbacks

11 years agofix precision issue via casting (no math love)
Jim Hull [Tue, 6 Nov 2012 23:39:31 +0000 (15:39 -0800)] 
fix precision issue via casting (no math love)

11 years agousing stdint int types, type fixes, lots of reformatting
Robin Hiroko Walsh [Tue, 6 Nov 2012 23:17:05 +0000 (15:17 -0800)] 
using stdint int types, type fixes, lots of reformatting

12 years agopatch from DGandalf that gives a finer granularity on the interval in which cron...
Jim Hull [Tue, 20 Mar 2012 00:06:48 +0000 (17:06 -0700)] 
patch from DGandalf that gives a finer granularity on the interval in which cron's can fire

12 years agofix doxygen
Jim Hull [Tue, 17 Jan 2012 02:24:11 +0000 (18:24 -0800)] 
fix doxygen

12 years agodon't fall back into getaddrinfo when using gethostbyname
Jim Hull [Sat, 14 Jan 2012 23:52:15 +0000 (15:52 -0800)] 
don't fall back into getaddrinfo when using gethostbyname

12 years agoonly use const char * strerror_r if _GNU_SOURCE is defined
Jim Hull [Sat, 14 Jan 2012 23:32:38 +0000 (15:32 -0800)] 
only use const char * strerror_r if _GNU_SOURCE is defined

12 years agoworkaround for gcc issue
Jim Hull [Fri, 13 Jan 2012 15:47:01 +0000 (07:47 -0800)] 
workaround for gcc issue

12 years agofix license and contact info
Jim Hull [Fri, 13 Jan 2012 15:30:04 +0000 (07:30 -0800)] 
fix license and contact info

12 years agofix typo in macro
Jim Hull [Fri, 13 Jan 2012 15:28:00 +0000 (07:28 -0800)] 
fix typo in macro

12 years agofixed formatting with astyle
Jim Hull [Sat, 31 Dec 2011 17:56:33 +0000 (09:56 -0800)] 
fixed formatting with astyle

12 years agoripped GetAddrInfo into a class with Init(), Process(), and Finish()
Jim Hull [Sat, 31 Dec 2011 05:00:46 +0000 (21:00 -0800)] 
ripped GetAddrInfo into a class with Init(), Process(), and Finish()

12 years agoadded support for non-blocking listener setup (specifically for dns resolution on...
Jim Hull [Fri, 30 Dec 2011 19:48:12 +0000 (11:48 -0800)] 
added support for non-blocking listener setup (specifically for dns resolution on the bind host)

12 years agoupdated SockError to include a text description
Jim Hull [Thu, 29 Dec 2011 22:53:19 +0000 (14:53 -0800)] 
updated SockError to include a text description

12 years agoswitch to sockaddr_storage and getnameinfo in Accept, GetRemoteIP, GetLocalIP. Cleans...
Jim Hull [Mon, 26 Dec 2011 01:13:26 +0000 (17:13 -0800)] 
switch to sockaddr_storage and getnameinfo in Accept, GetRemoteIP, GetLocalIP. Cleans up the code a bit using more abstract concepts. Deprecate use of gethostbyname

12 years agochange htons workaround to a pragma, remove static off CSAdjustTVTimeout as its a...
Jim Hull [Fri, 18 Nov 2011 15:21:44 +0000 (07:21 -0800)] 
change htons workaround to a pragma, remove static off CSAdjustTVTimeout as its a helper function used elsewhere

12 years agoMerge remote branch 'upstream/master' into win32-misc
Ingmar Runge [Mon, 14 Nov 2011 21:47:58 +0000 (22:47 +0100)] 
Merge remote branch 'upstream/master' into win32-misc

12 years agoMore reasoning in comments.
Ingmar Runge [Wed, 9 Nov 2011 22:14:08 +0000 (23:14 +0100)] 
More reasoning in comments.

12 years agoWin32: Make connect() blocking when trying to connect via IPv6. This is required...
Ingmar Runge [Wed, 9 Nov 2011 22:11:40 +0000 (23:11 +0100)] 
Win32: Make connect() blocking when trying to connect via IPv6. This is required to have the IPv4 fallback in Csock::GetAddrInfo() work correctly. When connect() is in none-blocking mode, there doesn't seem to be a way to retrieve the ENETUNREACH/EHOSTUNREACH error code.

12 years agoThis check doesn't make sense on Win32 (always errors out as fd_set works a bit diffe...
Ingmar Runge [Wed, 9 Nov 2011 21:57:25 +0000 (22:57 +0100)] 
This check doesn't make sense on Win32 (always errors out as fd_set works a bit different from *nix).

12 years agoMerge branch 'CSAdjustTVTimeout' of https://github.com/KiNgMaR/Csocket
Jim Hull [Wed, 9 Nov 2011 21:24:31 +0000 (13:24 -0800)] 
Merge branch 'CSAdjustTVTimeout' of https://github.com/KiNgMaR/Csocket

12 years agoMoved CSAdjustTVTimeout outside of LIB_SSL #ifdef, restores compilation-ability witho...
Ingmar Runge [Wed, 9 Nov 2011 21:18:36 +0000 (22:18 +0100)] 
Moved CSAdjustTVTimeout outside of LIB_SSL #ifdef, restores compilation-ability without SSL. Also made it static since it seems private to Csocket.cc.

12 years agoWin32: check for IPV6_V6ONLY socket option availability at runtime. This way, Server...
Ingmar Runge [Wed, 9 Nov 2011 21:14:13 +0000 (22:14 +0100)] 
Win32: check for IPV6_V6ONLY socket option availability at runtime. This way, Server 2008/Vista users and above can use this feature even if the app has been compiled with XP (or lower) compatibility.

12 years agoCsock destructor: The destructor may call closesocket() or other winsock API methods...
Ingmar Runge [Wed, 9 Nov 2011 20:54:48 +0000 (21:54 +0100)] 
Csock destructor: The destructor may call closesocket() or other winsock API methods that (re)set WSAGetLastError() to SUCCESS when there really has been an error before. Since destruction of the socket may be triggered from within Csock classes, unknowingly to the outside callers, the error code should be preserverd.

12 years agorefactor some code, to make m_bssl more obvious of what its intent is. Fix segfault...
Jim Hull [Wed, 19 Oct 2011 02:11:09 +0000 (19:11 -0700)] 
refactor some code, to make m_bssl more obvious of what its intent is. Fix segfault identified by Kyle Fuller where SSL_read/SSL_write were using a NULL ssl pointer. Fixed return type for GetPeerFingerPrint

12 years agomoved some code body from the header to cc
Jim Hull [Mon, 10 Oct 2011 02:55:59 +0000 (19:55 -0700)] 
moved some code body from the header to cc

12 years agorename variable to proper title case format (with integer identifier)
Jim Hull [Mon, 10 Oct 2011 02:50:25 +0000 (19:50 -0700)] 
rename variable to proper title case format (with integer identifier)

12 years agoadded small wrapper for StartTLS support and a simple example
Jim Hull [Mon, 10 Oct 2011 00:29:37 +0000 (17:29 -0700)] 
added small wrapper for StartTLS support and a simple example

12 years agoremove old code that allowed Csock connect() to be called without manager
Jim Hull [Sun, 9 Oct 2011 23:26:43 +0000 (16:26 -0700)] 
remove old code that allowed Csock connect() to be called without manager

12 years agoremove trailing whitespaces
Un1matr1x [Sun, 9 Oct 2011 15:33:08 +0000 (17:33 +0200)] 
remove trailing whitespaces

12 years agomoved CSSockAddr code into cc file, and wrapped htons with an undef during optimization
Jim Hull [Mon, 26 Sep 2011 00:24:33 +0000 (17:24 -0700)] 
moved CSSockAddr code into cc file, and wrapped htons with an undef during optimization

12 years agocomment out set_blocking for now since its not being used
Jim Hull [Mon, 26 Sep 2011 00:20:41 +0000 (17:20 -0700)] 
comment out set_blocking for now since its not being used

12 years agogot rid of the old thinking where Csock could be used stand-alone. Its been deprecate...
Jim Hull [Mon, 26 Sep 2011 00:12:26 +0000 (17:12 -0700)] 
got rid of the old thinking where Csock could be used stand-alone. Its been deprecated for some time and is no longer used by anything. Now everything is presumed to be non-blocking io

12 years agofix dependencies
Jim Hull [Mon, 26 Sep 2011 00:02:15 +0000 (17:02 -0700)] 
fix dependencies

12 years agoadded recieve test
Jim Hull [Sun, 25 Sep 2011 23:56:22 +0000 (16:56 -0700)] 
added recieve test

12 years agocheck for ssl with ipv6 on forth test
Jim Hull [Sun, 25 Sep 2011 23:56:11 +0000 (16:56 -0700)] 
check for ssl with ipv6 on forth test

12 years agoadded data sending test using ncat as the stable listening daemon
Jim Hull [Sun, 25 Sep 2011 22:52:14 +0000 (15:52 -0700)] 
added data sending test using ncat as the stable listening daemon

12 years agoadded some examples directories and a couple test cases
Jim Hull [Sun, 25 Sep 2011 20:22:27 +0000 (13:22 -0700)] 
added some examples directories and a couple test cases

12 years agoOnHeader and OnBody should be virtual
Jim Hull [Sun, 25 Sep 2011 20:22:11 +0000 (13:22 -0700)] 
OnHeader and OnBody should be virtual

12 years agoas of c-ares 1.7.5, 'only fall back to AF_INET searches when looking for AF_UNSPEC...
Jim Hull [Sun, 25 Sep 2011 01:58:52 +0000 (18:58 -0700)] 
as of c-ares 1.7.5, 'only fall back to AF_INET searches when looking for AF_UNSPEC addresses' per 1.7.5 release notes

12 years agoI never really liked how I wrote TSocketManager. I thought it would be convenient...
Jim Hull [Sun, 25 Sep 2011 01:24:38 +0000 (18:24 -0700)] 
I never really liked how I wrote TSocketManager. I thought it would be convenient to have ease of use with different Csock derivitives. It didn't take long before I got annoyed with all the code in the header but I never had the time to change it. So now I have. CSocketManager is now the major class, and TSocketManager is now a very simple template class that makes the object factory convenient. The bulk of the code is now in the cc file

12 years agoadded some dox and cleaned some code up
Jim Hull [Sun, 18 Sep 2011 02:59:11 +0000 (19:59 -0700)] 
added some dox and cleaned some code up

12 years agomissing namespace declaration
Jim Hull [Sat, 17 Sep 2011 04:03:10 +0000 (21:03 -0700)] 
missing namespace declaration

12 years agomap was being modified by callback while being iterated by the caller. woops.
Jim Hull [Sat, 17 Sep 2011 04:02:48 +0000 (21:02 -0700)] 
map was being modified by callback while being iterated by the caller. woops.

12 years agotweaked to work with new system of monitoring by Csock
Jim Hull [Sat, 17 Sep 2011 02:01:50 +0000 (19:01 -0700)] 
tweaked to work with new system of monitoring by Csock

12 years agocreated CSockCommon to share common code between Csock and TSockManager. Added a...
Jim Hull [Sat, 17 Sep 2011 02:01:03 +0000 (19:01 -0700)] 
created CSockCommon to share common code between Csock and TSockManager. Added a new method to monitor file descriptors that are outside of the normal purview of Csock

12 years agoadded hooks to monitor file descriptors outside the scope of TSockManager
Jim Hull [Fri, 16 Sep 2011 02:20:51 +0000 (19:20 -0700)] 
added hooks to monitor file descriptors outside the scope of TSockManager

12 years agohtaccess file not needed here ...
Jim Hull [Wed, 14 Sep 2011 03:14:21 +0000 (20:14 -0700)] 
htaccess file not needed here ...

12 years agoincrease quick reset time to 1 ms
Jim Hull [Sun, 26 Jun 2011 18:50:12 +0000 (11:50 -0700)] 
increase quick reset time to 1 ms

12 years agoRefactor some code so that it unifies the read bit set.
Jim Hull [Sat, 25 Jun 2011 15:35:46 +0000 (08:35 -0700)] 
Refactor some code so that it unifies the read bit set.
Fix a bug resulting is massive CPU spiking
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631590

The end result is instead of setting the write bit when the SSL session
isn't established, but there is data to send we'll just turn the
select timeout way down

13 years agofor SinFamily and SinPort, setup both ipv4 and ipv6 structures at the same time.
Jim Hull [Thu, 2 Jun 2011 02:21:42 +0000 (19:21 -0700)] 
for SinFamily and SinPort, setup both ipv4 and ipv6 structures at the same time.

13 years agoFix a NULL dereference with ares and empty replies
Uli Schlachter [Fri, 27 May 2011 19:12:51 +0000 (21:12 +0200)] 
Fix a NULL dereference with ares and empty replies

c-ares used to set status to ARES_ENODATA if it didn't get any data for a DNS
reply which didn't fail (e.g. a CNAME response without any "useful" replies).

However, this was changed in the following commit (part of c-ares 1.7.4):

https://github.com/bagder/c-ares/commit/2c63440127feed

Now, our DNS callback can be called with status == ARES_SUCCESS, but
hent->h_addr_list[0] == NULL which causes a NULL dereference in memcpy.

This bug was found with ipv6.google.com which has the following answer according
to 'dig ipv6.google.com' (Only a CNAME, no A record):

ipv6.google.com. 599336 IN CNAME ipv6.l.google.com.

Signed-off-by: Uli Schlachter <redacted>
13 years agoundo removal of sgi macro check
Jim Hull [Mon, 16 May 2011 18:01:29 +0000 (11:01 -0700)] 
undo removal of sgi macro check

13 years agoadded ability to use DH Key Exchange - https://github.com/znc/znc/pull/46 (https...
Jim Hull [Mon, 16 May 2011 16:48:41 +0000 (09:48 -0700)] 
added ability to use DH Key Exchange - https://github.com/znc/znc/pull/46 (https://github.com/Hawk777)

13 years agowrap ssl2 with def in the event its disabled
Jim Hull [Fri, 15 Apr 2011 16:16:48 +0000 (09:16 -0700)] 
wrap ssl2 with def in the event its disabled

13 years agoPer psychon:
Jim Hull [Sun, 3 Apr 2011 00:36:27 +0000 (17:36 -0700)] 
Per psychon:
CheckTimeout() assumes that it is called after have the timeout has
  passed (so that it can handle clock jumps)
  so GetDynamicSleepTime() must return a timeout that is in
  half-the-timeout seconds, not the whole timeout in the future
  I moved this into the new Csock::GetNextCheckTimeout() because there
  is no getter got Csock::m_iTcount

13 years agousing 'sgi' macro to workaround irix perror issue.
Jim Hull [Fri, 25 Mar 2011 02:28:25 +0000 (19:28 -0700)] 
using 'sgi' macro to workaround irix perror issue.

13 years agomissing reference to 'this' within template parent function call
Jim Hull [Tue, 15 Feb 2011 22:42:24 +0000 (14:42 -0800)] 
missing reference to 'this' within template parent function call

13 years agoremoved unused var
Jim Hull [Tue, 25 Jan 2011 15:12:58 +0000 (07:12 -0800)] 
removed unused var

13 years agoInclude defines.h earlier
Uli Schlachter [Fri, 7 Jan 2011 15:44:20 +0000 (16:44 +0100)] 
Include defines.h earlier

This commit moves the include for defines.h to the beginning of Csocket.h. This
is needed for projects that use a file like config.h for defining symbols like
HAVE_C_ARES and HAVE_LIBSSL.

Signed-off-by: Uli Schlachter <redacted>
Signed-off-by: Jim Hull <redacted>
13 years agoMake this compile with -Wswitch-enum
Uli Schlachter [Sun, 7 Nov 2010 16:55:10 +0000 (17:55 +0100)] 
Make this compile with -Wswitch-enum

"error: enumeration value ‘SELECT_TRYAGAIN’ not handled in switch"

Signed-off-by: Uli Schlachter <redacted>
Signed-off-by: Jim Hull <redacted>
13 years agouse inet_ntop rather than non-reentrant inet_ntoa
Jim Hull [Thu, 30 Dec 2010 16:03:46 +0000 (08:03 -0800)] 
use inet_ntop rather than non-reentrant inet_ntoa

13 years agocall common function GetSockError rather than errno directly
Jim Hull [Thu, 30 Dec 2010 16:03:06 +0000 (08:03 -0800)] 
call common function GetSockError rather than errno directly

13 years agofix my improper speeling
Jim Hull [Wed, 3 Nov 2010 20:42:46 +0000 (13:42 -0700)] 
fix my improper speeling

13 years agofixed poll bug, add const keyword to IsConnected
imaginos [Sun, 24 Oct 2010 09:12:00 +0000 (02:12 -0700)] 
fixed poll bug, add const keyword to IsConnected

13 years agoclear out the buffer when calling DisableReadLine per psychon
imaginos [Mon, 27 Sep 2010 19:00:24 +0000 (19:00 +0000)] 
clear out the buffer when calling DisableReadLine per psychon

13 years agopull in std::map
imaginos [Mon, 27 Sep 2010 18:55:00 +0000 (18:55 +0000)] 
pull in std::map

13 years agouse std::max
imaginos [Tue, 3 Aug 2010 14:52:01 +0000 (14:52 +0000)] 
use std::max

13 years agoworps, extra ping
imaginos [Sun, 1 Aug 2010 00:42:05 +0000 (00:42 +0000)] 
worps, extra ping

13 years agoworps, highest fd, not num fd
imaginos [Sat, 31 Jul 2010 23:57:28 +0000 (23:57 +0000)] 
worps, highest fd, not num fd

13 years agoadded support for poll() via CSOCK_USE_POLL
imaginos [Sat, 31 Jul 2010 19:16:00 +0000 (19:16 +0000)] 
added support for poll() via CSOCK_USE_POLL

13 years agocheck size of fd prior to calling FD_SET
imaginos [Sat, 31 Jul 2010 10:39:14 +0000 (10:39 +0000)] 
check size of fd prior to calling FD_SET

13 years agoinitialize vars
imaginos [Sat, 31 Jul 2010 09:14:27 +0000 (09:14 +0000)] 
initialize vars

13 years agoonly call ssl_accept once
imaginos [Thu, 15 Jul 2010 17:05:49 +0000 (17:05 +0000)] 
only call ssl_accept once

13 years agochecking timeouts on ares stuff
imaginos [Fri, 2 Jul 2010 18:44:32 +0000 (18:44 +0000)] 
checking timeouts on ares stuff

13 years agomissing error check on isconnected
imaginos [Sun, 27 Jun 2010 14:54:25 +0000 (14:54 +0000)] 
missing error check on isconnected

14 years agofix notation
websites [Sat, 24 Apr 2010 23:39:47 +0000 (23:39 +0000)] 
fix notation

14 years agoadded convertaddr from psychon
imaginos [Sat, 24 Apr 2010 19:49:47 +0000 (19:49 +0000)] 
added convertaddr from psychon

14 years agoneed to return bytes
imaginos [Thu, 22 Apr 2010 16:09:51 +0000 (16:09 +0000)] 
need to return bytes

14 years agovarious additions by Uli Schlachter <psychon@znc.in>
imaginos [Sun, 7 Mar 2010 19:25:28 +0000 (19:25 +0000)] 
various additions by Uli Schlachter <redacted>

14 years agolame elseif
imaginos [Thu, 25 Feb 2010 17:35:10 +0000 (17:35 +0000)] 
lame elseif

14 years agolast couple tweaks for ipv6 listen
imaginos [Thu, 25 Feb 2010 17:32:10 +0000 (17:32 +0000)] 
last couple tweaks for ipv6 listen

14 years agocouple windows fixes per KiNgMaR
imaginos [Fri, 19 Feb 2010 21:55:23 +0000 (21:55 +0000)] 
couple windows fixes per KiNgMaR

14 years agostick ipv6 only
imaginos [Thu, 18 Feb 2010 20:21:58 +0000 (20:21 +0000)] 
stick ipv6 only

14 years agouse empty instead of size
imaginos [Thu, 18 Feb 2010 17:19:53 +0000 (17:19 +0000)] 
use empty instead of size