From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Apr 23 17:15:37 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D670106566C for ; Fri, 23 Apr 2010 17:15:37 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 20F598FC1A for ; Fri, 23 Apr 2010 17:15:37 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o3NHFb9r083680 for ; Fri, 23 Apr 2010 17:15:37 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o3NHFbgF083679; Fri, 23 Apr 2010 17:15:37 GMT (envelope-from gnats) Resent-Date: Fri, 23 Apr 2010 17:15:37 GMT Resent-Message-Id: <201004231715.o3NHFbgF083679@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Thorkill Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E5F2106564A for ; Fri, 23 Apr 2010 09:41:42 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 0303F8FC19 for ; Fri, 23 Apr 2010 09:41:42 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N9ffGl049456 for ; Fri, 23 Apr 2010 09:41:41 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o3N9ffmK049455; Fri, 23 Apr 2010 09:41:41 GMT (envelope-from nobody) Message-Id: <201004230941.o3N9ffmK049455@www.freebsd.org> Date: Fri, 23 Apr 2010 09:41:41 GMT From: Thorkill To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/145986: py-xmpppy does not work with python2.6 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2010 17:15:37 -0000 >Number: 145986 >Category: ports >Synopsis: py-xmpppy does not work with python2.6 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Apr 23 17:15:36 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Thorkill >Release: 8.0 >Organization: >Environment: >Description: python2.6 do not support sha anymore - we have to use hashlib.sha1() instead. >How-To-Repeat: Just try to use py-xmpppy with python2.6 >Fix: Patch included, replace the old patch - files/patch-xmpp-auth.py with attached patch. Patch attached with submission follows: --- 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 protocol import * from client import PlugIn -import sha,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 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') >Release-Note: >Audit-Trail: >Unformatted: