1 |
neurogeek 10/01/28 03:57:02 |
2 |
|
3 |
Added: xmpppy-hashlib_ssl_deprecation.patch |
4 |
Log: |
5 |
Added patches for 2.6 deprecation warnings. Closes bug #281997 |
6 |
(Portage version: 2.1.6.13/cvs/Linux i686) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 dev-python/xmpppy/files/xmpppy-hashlib_ssl_deprecation.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/xmpppy/files/xmpppy-hashlib_ssl_deprecation.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/xmpppy/files/xmpppy-hashlib_ssl_deprecation.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: xmpppy-hashlib_ssl_deprecation.patch |
15 |
=================================================================== |
16 |
#Patch by Jesus Rivero (neurogeek) |
17 |
#Added on 01-27-2010 |
18 |
#Sent to upstream on 01-27-2010 |
19 |
|
20 |
diff -uNr xmpppy-0.5.0-rc1.org/xmpp/auth.py xmpppy-0.5.0-rc1/xmpp/auth.py |
21 |
--- xmpppy-0.5.0-rc1.org/xmpp/auth.py 2010-01-28 01:00:03.000000000 +0000 |
22 |
+++ xmpppy-0.5.0-rc1/xmpp/auth.py 2010-01-28 01:03:30.000000000 +0000 |
23 |
@@ -21,11 +21,11 @@ |
24 |
|
25 |
from protocol import * |
26 |
from client import PlugIn |
27 |
-import sha,base64,random,dispatcher,re |
28 |
+from hashlib import sha1 as sha, md5 |
29 |
+import base64,random,dispatcher,re |
30 |
|
31 |
-import md5 |
32 |
-def HH(some): return md5.new(some).hexdigest() |
33 |
-def H(some): return md5.new(some).digest() |
34 |
+def HH(some): return md5(some).hexdigest() |
35 |
+def H(some): return md5(some).digest() |
36 |
def C(some): return ':'.join(some) |
37 |
|
38 |
class NonSASL(PlugIn): |
39 |
@@ -54,15 +54,15 @@ |
40 |
|
41 |
if query.getTag('digest'): |
42 |
self.DEBUG("Performing digest authentication",'ok') |
43 |
- query.setTagData('digest',sha.new(owner.Dispatcher.Stream._document_attrs['id']+self.password).hexdigest()) |
44 |
+ query.setTagData('digest',sha(owner.Dispatcher.Stream._document_attrs['id']+self.password).hexdigest()) |
45 |
if query.getTag('password'): query.delChild('password') |
46 |
method='digest' |
47 |
elif query.getTag('token'): |
48 |
token=query.getTagData('token') |
49 |
seq=query.getTagData('sequence') |
50 |
self.DEBUG("Performing zero-k authentication",'ok') |
51 |
- hash = sha.new(sha.new(self.password).hexdigest()+token).hexdigest() |
52 |
- for foo in xrange(int(seq)): hash = sha.new(hash).hexdigest() |
53 |
+ hash = sha(sha(self.password).hexdigest()+token).hexdigest() |
54 |
+ for foo in xrange(int(seq)): hash = sha(hash).hexdigest() |
55 |
query.setTagData('hash',hash) |
56 |
method='0k' |
57 |
else: |
58 |
@@ -81,7 +81,7 @@ |
59 |
def authComponent(self,owner): |
60 |
""" Authenticate component. Send handshake stanza and wait for result. Returns "ok" on success. """ |
61 |
self.handshake=0 |
62 |
- owner.send(Node(NS_COMPONENT_ACCEPT+' handshake',payload=[sha.new(owner.Dispatcher.Stream._document_attrs['id']+self.password).hexdigest()])) |
63 |
+ owner.send(Node(NS_COMPONENT_ACCEPT+' handshake',payload=[sha(owner.Dispatcher.Stream._document_attrs['id']+self.password).hexdigest()])) |
64 |
owner.RegisterHandler('handshake',self.handshakeHandler,xmlns=NS_COMPONENT_ACCEPT) |
65 |
while not self.handshake: |
66 |
self.DEBUG("waiting on handshake",'notify') |
67 |
|
68 |
diff -uNr xmpppy-0.5.0-rc1.org/xmpp/transports.py xmpppy-0.5.0-rc1/xmpp/transports.py |
69 |
--- xmpppy-0.5.0-rc1.org/xmpp/transports.py 2010-01-28 01:00:03.000000000 +0000 |
70 |
+++ xmpppy-0.5.0-rc1/xmpp/transports.py 2010-01-28 02:35:09.000000000 +0000 |
71 |
@@ -31,6 +31,7 @@ |
72 |
from simplexml import ustr |
73 |
from client import PlugIn |
74 |
from protocol import * |
75 |
+import ssl |
76 |
|
77 |
# determine which DNS resolution library is available |
78 |
HAVE_DNSPYTHON = False |
79 |
@@ -312,9 +313,9 @@ |
80 |
""" Immidiatedly switch socket to TLS mode. Used internally.""" |
81 |
""" Here we should switch pending_data to hint mode.""" |
82 |
tcpsock=self._owner.Connection |
83 |
- tcpsock._sslObj = socket.ssl(tcpsock._sock, None, None) |
84 |
- tcpsock._sslIssuer = tcpsock._sslObj.issuer() |
85 |
- tcpsock._sslServer = tcpsock._sslObj.server() |
86 |
+ tcpsock._sslObj = ssl.wrap_socket(tcpsock._sock, cert_reqs=ssl.CERT_NONE) |
87 |
+ #tcpsock._sslIssuer = tcpsock._sslObj.issuer() |
88 |
+ #tcpsock._sslServer = tcpsock._sslObj.server() |
89 |
tcpsock._recv = tcpsock._sslObj.read |
90 |
tcpsock._send = tcpsock._sslObj.write |