|
|
1d9719 |
diff --git a/rhn/SSL.py b/rhn/SSL.py
|
|
|
1d9719 |
index db26fd8..c3d3388 100644
|
|
|
1d9719 |
--- a/rhn/SSL.py
|
|
|
1d9719 |
+++ b/rhn/SSL.py
|
|
|
1d9719 |
@@ -28,6 +28,7 @@ from OpenSSL import SSL
|
|
|
1d9719 |
# SSL.crypto is provided to other modules
|
|
|
1d9719 |
from OpenSSL import crypto
|
|
|
1d9719 |
import os
|
|
|
1d9719 |
+import sys
|
|
|
1d9719 |
|
|
|
1d9719 |
import socket
|
|
|
1d9719 |
import select
|
|
|
1d9719 |
@@ -134,7 +135,19 @@ class SSLSocket:
|
|
|
1d9719 |
self._makefile_called = self._makefile_called - 1
|
|
|
1d9719 |
|
|
|
1d9719 |
def _really_close(self):
|
|
|
1d9719 |
- self._connection.shutdown()
|
|
|
1d9719 |
+ # No connection was established
|
|
|
1d9719 |
+ if self._connection is None:
|
|
|
1d9719 |
+ return
|
|
|
1d9719 |
+
|
|
|
1d9719 |
+ # for Python 3
|
|
|
1d9719 |
+ if sys.version_info[0] == 3:
|
|
|
1d9719 |
+ if self._connection.get_state_string() == b'SSL negotiation finished successfully':
|
|
|
1d9719 |
+ self._connection.shutdown()
|
|
|
1d9719 |
+ # for Python 2
|
|
|
1d9719 |
+ else:
|
|
|
1d9719 |
+ if self._connection.state_string() == 'SSL negotiation finished successfully':
|
|
|
1d9719 |
+ self._connection.shutdown()
|
|
|
1d9719 |
+
|
|
|
1d9719 |
self._connection.close()
|
|
|
1d9719 |
self._closed = 1
|
|
|
1d9719 |
|
|
|
1d9719 |
diff --git a/rhnlib.spec b/rhnlib.spec
|
|
|
1d9719 |
index 2de48689..57e2128 100644
|
|
|
1d9719 |
--- a/rhnlib.spec
|
|
|
1d9719 |
+++ b/rhnlib.spec
|
|
|
1d9719 |
@@ -5,7 +5,7 @@ Name: rhnlib
|
|
|
1d9719 |
URL: https://fedorahosted.org/spacewalk
|
|
|
1d9719 |
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
|
|
|
1d9719 |
Version: 2.5.65
|
|
|
1d9719 |
-Release: 4%{?dist}
|
|
|
1d9719 |
+Release: 5%{?dist}
|
|
|
1d9719 |
|
|
|
1d9719 |
Group: Development/Libraries
|
|
|
1d9719 |
License: GPLv2
|
|
|
1d9719 |
@@ -59,6 +59,10 @@ rm -rf $RPM_BUILD_ROOT
|
|
|
1d9719 |
%{python_sitelib}/*
|
|
|
1d9719 |
|
|
|
1d9719 |
%changelog
|
|
|
1d9719 |
+* Thu Sep 21 2017 Tomas Kasparek <tkasparek@redhat.com> 2.5.65-5
|
|
|
1d9719 |
+- Resolves: #1471045 - check a state of handshake before shutdown SSL
|
|
|
1d9719 |
+ connection (grinrag@gmail.com)
|
|
|
1d9719 |
+
|
|
|
1d9719 |
* Mon Mar 06 2017 Gennadii Altukhov <galt@redhat.com> 2.5.65-4
|
|
|
1d9719 |
- Resolves: #1409577 - fixed BZ ID in changelog (galt@redhat.com)
|
|
|
1d9719 |
|