aboutsummaryrefslogtreecommitdiffstats
path: root/net-im/py-xmpppy
diff options
context:
space:
mode:
authorwen <wen@FreeBSD.org>2010-05-07 15:35:39 +0800
committerwen <wen@FreeBSD.org>2010-05-07 15:35:39 +0800
commitc6890cde3507998cbb0d2f0a3cdad5b81764bf97 (patch)
treec009d26f60d41a04213bec5f179572483e297c4e /net-im/py-xmpppy
parent1c22b40aa9b2b9173a1a7d388ed34f2363fd2aba (diff)
downloadfreebsd-ports-gnome-c6890cde3507998cbb0d2f0a3cdad5b81764bf97.tar.gz
freebsd-ports-gnome-c6890cde3507998cbb0d2f0a3cdad5b81764bf97.tar.zst
freebsd-ports-gnome-c6890cde3507998cbb0d2f0a3cdad5b81764bf97.zip
- Fix the run error with python-2.6
PR: ports/145986 Submitted by: Thorkill <fbsd@grid.einherjar.de> Approved by: maintainer(timeout, > 2 weeks)
Diffstat (limited to 'net-im/py-xmpppy')
-rw-r--r--net-im/py-xmpppy/Makefile1
-rw-r--r--net-im/py-xmpppy/files/patch-xmpp-auth.py57
2 files changed, 49 insertions, 9 deletions
diff --git a/net-im/py-xmpppy/Makefile b/net-im/py-xmpppy/Makefile
index 5a6cc8a86010..d6cdca1c68e6 100644
--- a/net-im/py-xmpppy/Makefile
+++ b/net-im/py-xmpppy/Makefile
@@ -7,6 +7,7 @@
PORTNAME= xmpppy
PORTVERSION= 0.5.0
+PORTREVISION= 1
CATEGORIES= net-im python
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTVERSION}-rc1/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
diff --git a/net-im/py-xmpppy/files/patch-xmpp-auth.py b/net-im/py-xmpppy/files/patch-xmpp-auth.py
index a3e262bec652..290a82b3fca0 100644
--- a/net-im/py-xmpppy/files/patch-xmpp-auth.py
+++ b/net-im/py-xmpppy/files/patch-xmpp-auth.py
@@ -1,20 +1,59 @@
---- xmpp/auth.py.orig 2010-04-03 21:45:50.000000000 +0800
-+++ xmpp/auth.py 2010-04-03 21:45:56.000000000 +0800
-@@ -19,13 +19,13 @@ Provides library with all Non-SASL and S
- Can be used both for client and transport authentication.
- """
+--- xmpp/auth.py.orig 2007-08-28 12:03:33.000000000 +0200
++++ xmpp/auth.py 2010-04-23 11:29:16.000000000 +0200
+@@ -21,13 +21,23 @@
-+from hashlib import md5
from protocol import *
from client import PlugIn
-import sha,base64,random,dispatcher,re
-+import base64,random,dispatcher,re
++import base64, random, dispatcher, re, sys
-import md5
-def HH(some): return md5.new(some).hexdigest()
-def H(some): return md5.new(some).digest()
-+def HH(some): return md5(some).hexdigest()
-+def H(some): return md5(some).digest()
def C(some): return ':'.join(some)
++if sys.version_info[0:2] < (2, 6):
++ import sha, md5
++ def _SHA(some): return sha.new(some)
++ def HH(some): return md5.new(some).hexdigest()
++ def H(some): return md5.new(some).digest()
++else:
++ import hashlib
++ """ For python version >= 2.6 """
++ def _SHA(some): return hashlib.sha1(some)
++ def HH(some): return hashlib.md5(some).hexdigest()
++ def h(some): return hashlib.md5(some).digest()
++
++
class NonSASL(PlugIn):
+ """ Implements old Non-SASL (JEP-0078) authentication used in jabberd1.4 and transport authentication."""
+ def __init__(self,user,password,resource):
+@@ -54,15 +64,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', _SHA(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 = _SHA(_SHA(self.password).hexdigest()+token).hexdigest()
++ for foo in xrange(int(seq)): hash = _SHA(hash).hexdigest()
+ query.setTagData('hash',hash)
+ method='0k'
+ else:
+@@ -81,7 +91,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=[_SHA(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')
+