[Python-apps-commits] r3112 - in packages/charm/trunk/debian (3 files)

binarymutant-guest at users.alioth.debian.org binarymutant-guest at users.alioth.debian.org
Sat Jun 13 00:42:53 UTC 2009


    Date: Saturday, June 13, 2009 @ 00:42:52
  Author: binarymutant-guest
Revision: 3112

Added hashlib patch for deprecated md5 and sha modules

Added:
  packages/charm/trunk/debian/patches/02_hashlib.dpatch
Modified:
  packages/charm/trunk/debian/changelog
  packages/charm/trunk/debian/patches/00list

Modified: packages/charm/trunk/debian/changelog
===================================================================
--- packages/charm/trunk/debian/changelog	2009-06-12 05:16:25 UTC (rev 3111)
+++ packages/charm/trunk/debian/changelog	2009-06-13 00:42:52 UTC (rev 3112)
@@ -1,6 +1,13 @@
+charm (1.9.1-2) unstable; urgency=low
+
+  * hashlib patch added
+
+ -- Christopher Lunsford <binarymutant at gmail.com>  Fri, 12 Jun 2009 20:27:52 -0400
+
 charm (1.9.1-1) unstable; urgency=low
 
-  * Changed the long description(Closes: #522272), and updated the Standards-Version to 3.8.1
+  * Changed the long description(Closes: #522272)
+  * Updated the Standards-Version to 3.8.1
   
   * Initial release (Closes: #502231)
 

Modified: packages/charm/trunk/debian/patches/00list
===================================================================
--- packages/charm/trunk/debian/patches/00list	2009-06-12 05:16:25 UTC (rev 3111)
+++ packages/charm/trunk/debian/patches/00list	2009-06-13 00:42:52 UTC (rev 3112)
@@ -1 +1,2 @@
 01_hyphens.dpatch
+02_hashlib.dpatch

Added: packages/charm/trunk/debian/patches/02_hashlib.dpatch
===================================================================
--- packages/charm/trunk/debian/patches/02_hashlib.dpatch	                        (rev 0)
+++ packages/charm/trunk/debian/patches/02_hashlib.dpatch	2009-06-13 00:42:52 UTC (rev 3112)
@@ -0,0 +1,57 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## hashlib.dpatch by  <binarymutant at gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Use hashlib instead of deprecated md5 and sha modules
+
+ at DPATCH@
+diff -urNad charm-1.9.1~/ljcharm.py charm-1.9.1/ljcharm.py
+--- charm-1.9.1~/ljcharm.py	2009-01-11 16:21:15.000000000 -0500
++++ charm-1.9.1/ljcharm.py	2009-06-12 20:23:45.000000000 -0400
+@@ -38,7 +38,7 @@
+ import time
+ import locale
+ import stat
+-import md5
++import hashlib
+ import urllib
+ import calendar
+ 
+@@ -47,7 +47,6 @@
+     import httplib
+     import base64
+     import datetime
+-    import sha
+     atom_ok = 1
+ except:
+     atom_ok = 0
+@@ -289,9 +288,9 @@
+     #    module. We provide an alternative, for earlier versions.
+ 
+     try:
+-	hexd = md5.hexdigest(sstr)
++	hexd = hashlib.md5.hexdigest(sstr)
+     except AttributeError:
+-	digest = md5.new(sstr).digest()
++	digest = hashlib.md5(sstr).digest()
+         hexd = string.join(map(lambda c: "%s%s" % (string.hexdigits[ord(c) / 16], string.hexdigits[ord(c) % 16]), digest), "")
+ 
+     return hexd
+@@ -300,7 +299,7 @@
+ def get_nonce(tstamp):
+     "Create a nonce."
+ 
+-    sstr = sha.new("%s:%s" % (tstamp, Client_Name)).hexdigest() 
++    sstr = hashlib.sha("%s:%s" % (tstamp, Client_Name)).hexdigest() 
+     return "%s %s" % (tstamp, sstr)
+ 
+ 
+@@ -5808,7 +5807,7 @@
+ 
+             tstamp = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
+             nonce = get_nonce(tstamp)
+-            pdigest = base64.encodestring(sha.new("%s%s%s" % (nonce, tstamp, self.Params["hpassword"])).digest())[:-1]
++            pdigest = base64.encodestring(hashlib.sha("%s%s%s" % (nonce, tstamp, self.Params["hpassword"])).digest())[:-1]
+             
+             headers["Authorization"] = 'WSSE profile="UsernameToken"'
+             headers["X-WSSE"] = 'UsernameToken Username="%s", PasswordDigest="%s", Created="%s", Nonce="%s"' % (self.Params["user"], pdigest, tstamp, nonce)


Property changes on: packages/charm/trunk/debian/patches/02_hashlib.dpatch
___________________________________________________________________
Added: svn:executable
   + *




More information about the Python-apps-commits mailing list