gentoo/dev-python/xmpppy/files/xmpppy-hashlib_ssl_deprecation.patch
Robin H. Johnson 56bd759df1
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.

This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.

Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
2015-08-08 17:38:18 -07:00

70 lines
2.9 KiB
Diff

--- xmpp/auth.py
+++ xmpp/auth.py
@@ -21,11 +21,16 @@
from protocol import *
from client import PlugIn
-import sha,base64,random,dispatcher,re
+import base64,random,dispatcher,re
-import md5
-def HH(some): return md5.new(some).hexdigest()
-def H(some): return md5.new(some).digest()
+try:
+ from hashlib import md5, sha1
+except ImportError:
+ from md5 import new as md5
+ from sha import new as sha1
+
+def HH(some): return md5(some).hexdigest()
+def H(some): return md5(some).digest()
def C(some): return ':'.join(some)
class NonSASL(PlugIn):
@@ -54,15 +59,15 @@
if query.getTag('digest'):
self.DEBUG("Performing digest authentication",'ok')
- query.setTagData('digest',sha.new(owner.Dispatcher.Stream._document_attrs['id']+self.password).hexdigest())
+ query.setTagData('digest',sha1(owner.Dispatcher.Stream._document_attrs['id']+self.password).hexdigest())
if query.getTag('password'): query.delChild('password')
method='digest'
elif query.getTag('token'):
token=query.getTagData('token')
seq=query.getTagData('sequence')
self.DEBUG("Performing zero-k authentication",'ok')
- hash = sha.new(sha.new(self.password).hexdigest()+token).hexdigest()
- for foo in xrange(int(seq)): hash = sha.new(hash).hexdigest()
+ hash = sha1(sha1(self.password).hexdigest()+token).hexdigest()
+ for foo in xrange(int(seq)): hash = sha1(hash).hexdigest()
query.setTagData('hash',hash)
method='0k'
else:
@@ -81,7 +86,7 @@
def authComponent(self,owner):
""" Authenticate component. Send handshake stanza and wait for result. Returns "ok" on success. """
self.handshake=0
- owner.send(Node(NS_COMPONENT_ACCEPT+' handshake',payload=[sha.new(owner.Dispatcher.Stream._document_attrs['id']+self.password).hexdigest()]))
+ owner.send(Node(NS_COMPONENT_ACCEPT+' handshake',payload=[sha1(owner.Dispatcher.Stream._document_attrs['id']+self.password).hexdigest()]))
owner.RegisterHandler('handshake',self.handshakeHandler,xmlns=NS_COMPONENT_ACCEPT)
while not self.handshake:
self.DEBUG("waiting on handshake",'notify')
--- xmpp/transports.py
+++ xmpp/transports.py
@@ -31,6 +31,7 @@
from simplexml import ustr
from client import PlugIn
from protocol import *
+import warnings
# determine which DNS resolution library is available
HAVE_DNSPYTHON = False
@@ -312,6 +313,7 @@
""" Immidiatedly switch socket to TLS mode. Used internally."""
""" Here we should switch pending_data to hint mode."""
tcpsock=self._owner.Connection
+ warnings.filterwarnings("ignore", "socket\.ssl.*ssl\.wrap_socket", DeprecationWarning)
tcpsock._sslObj = socket.ssl(tcpsock._sock, None, None)
tcpsock._sslIssuer = tcpsock._sslObj.issuer()
tcpsock._sslServer = tcpsock._sslObj.server()