[rudesocket/f17] fix hardcoded timeout and connection leaking (#665658)

Jiří Popelka jpopelka at fedoraproject.org
Wed Apr 4 15:00:50 UTC 2012


commit 694cdd3ee6cacaffc258903da51ceb8e8d3d1f02
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Wed Apr 4 16:58:31 2012 +0200

    fix hardcoded timeout and connection leaking (#665658)
    
    clean up spec file

 rudesocket-1.3.0-leak-connection.patch |   35 ++++++++++++++++++++++++++++++++
 rudesocket-1.3.0-timeout.patch         |   16 ++++++++++++++
 rudesocket.spec                        |   31 ++++++++++++++-------------
 3 files changed, 67 insertions(+), 15 deletions(-)
---
diff --git a/rudesocket-1.3.0-leak-connection.patch b/rudesocket-1.3.0-leak-connection.patch
new file mode 100644
index 0000000..edb6196
--- /dev/null
+++ b/rudesocket-1.3.0-leak-connection.patch
@@ -0,0 +1,35 @@
+diff -up rudesocket-1.3.0/src/socket_tcpclient.cpp.leak rudesocket-1.3.0/src/socket_tcpclient.cpp
+--- rudesocket-1.3.0/src/socket_tcpclient.cpp.leak	2008-02-07 00:01:02.000000000 +0100
++++ rudesocket-1.3.0/src/socket_tcpclient.cpp	2012-04-04 16:57:30.810990682 +0200
+@@ -303,7 +303,7 @@ bool Socket_TCPClient::close()
+ {
+ 	if(d_comm != (Socket_Comm*) 0)
+ 	{
+-		if(d_comm->finish())
++		if((void*) d_sock != NULL)
+ 		{
+ 		
+ #ifdef WIN32
+@@ -312,10 +312,11 @@ bool Socket_TCPClient::close()
+ 			::shutdown(d_sock, SHUT_RDWR);
+ 			::close(d_sock);
+ #endif
+-			return true;
++		} else {
++			setError("Socket_TCPClient::close: d_sock is null!");
++			return false;
+ 		}
+-		else
+-		{
++		if (!d_comm->finish()) {
+ 			setError(d_comm->getError());
+ 			return false;
+ 		}
+@@ -325,6 +326,6 @@ bool Socket_TCPClient::close()
+ 		setError("Socket_TCPClient::close does not have a Socket_Comm to close");
+ 		return false;
+ 	}
++	return true;
+ }
+ }}
+-
diff --git a/rudesocket-1.3.0-timeout.patch b/rudesocket-1.3.0-timeout.patch
new file mode 100644
index 0000000..f110cab
--- /dev/null
+++ b/rudesocket-1.3.0-timeout.patch
@@ -0,0 +1,16 @@
+diff -up rudesocket-1.3.0/src/socket_connect_normal.cpp.timeout rudesocket-1.3.0/src/socket_connect_normal.cpp
+--- rudesocket-1.3.0/src/socket_connect_normal.cpp.timeout	2008-02-06 16:52:17.000000000 +0100
++++ rudesocket-1.3.0/src/socket_connect_normal.cpp	2012-04-04 16:38:58.607570481 +0200
+@@ -128,10 +128,8 @@ int Socket_Connect_Normal::connecttimeou
+ 		FD_ZERO(&wset); 
+ 		FD_SET(socket, &wset); 
+  
+-		tv.tv_sec = 5; 
+-		// Why the hell is this times 1000?????
+-		//tv.tv_usec = 1000 * (msec % 1000); 
+-		tv.tv_usec = 0;// 1000 * msec % 1000;
++		tv.tv_sec = msec / 1000;
++		tv.tv_usec = 1000 * msec % 1000;
+  
+ 		ret = select(socket+1, NULL, &wset, NULL, &tv); 
+  
diff --git a/rudesocket.spec b/rudesocket.spec
index bf46420..51a1dc2 100644
--- a/rudesocket.spec
+++ b/rudesocket.spec
@@ -1,62 +1,59 @@
 Name:           rudesocket
 Version:        1.3.0
-Release:        8%{?dist}
+Release:        9%{?dist}
 Summary:        Library (C++ API) for creating client sockets
 
 Group:          System Environment/Libraries
 License:        GPLv2+
 URL:            http://www.rudeserver.com/socket
-Source0:        http://homeless.fedorapeople.org/rudesocket/%{name}-%{version}.tar.bz2
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Source0:        http://homeless.fedorapeople.org/rudesocket/rudesocket-%{version}.tar.bz2
+Patch0:         rudesocket-1.3.0-leak-connection.patch
+Patch1:         rudesocket-1.3.0-timeout.patch
 
 BuildRequires:  openssl-devel
 Requires:       openssl
 
 %description
-%{name} is a library provides client socket services to an application.
+rudesocket is a library provides client socket services to an application.
 In addition to normal and SSL TCP connections, it supports 
 proxies, SOCK4 and SOCKS5 servers. Furthermore, it allows you 
 to chain proxies together.
 
 %package        devel
-Summary:        Development files for %{name}
+Summary:        Development files for rudesocket
 Group:          Development/Libraries
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name}%{?_isa} = %{version}-%{release}
 
 %description    devel
-%{name} is a library provides client socket services to an application.
+rudesocket is a library provides client socket services to an application.
 In addition to normal and SSL TCP connections, it supports 
 proxies, SOCK4 and SOCKS5 servers. Furthermore, it allows you 
-to chain proxies together. The %{name}-devel package 
+to chain proxies together. The rudesocket-devel package 
 contains libraries, header files, and documentation needed 
-to develop C++ applications using %{name}. 
+to develop C++ applications using rudesocket. 
 
 %prep
 %setup -q
+%patch0 -p1 -b .leak
+%patch1 -p1 -b .timeout
 
 %build
 %configure --disable-static --with-openssl
 make %{?_smp_mflags}
 
 %install
-rm -rf $RPM_BUILD_ROOT
 make install DESTDIR=$RPM_BUILD_ROOT
 find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
 
 %files
-%defattr(-,root,root,-)
 %doc AUTHORS COPYING README NEWS ChangeLog
 %{_libdir}/*.so.*
 
 %files devel
-%defattr(-,root,root,-)
 %doc 
 %dir %{_includedir}/rude
 %{_includedir}/rude/socket.h
@@ -64,6 +61,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man3/*
 
 %changelog
+* Wed Apr 04 2012 Jiri Popelka <jpopelka at redhat.com> - 1.3.0-9
+- fix hardcoded timeout and connection leaking (#665658)
+- clean up spec file
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3.0-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list