Skip to content

Commit

Permalink
Merge pull request #158 from plushambush/C2DEVEL-14669-redos-boto
Browse files Browse the repository at this point in the history
C2DEVEL-14669: Build for redos 7.3c
  • Loading branch information
Sharpeye90 authored Apr 8, 2024
2 parents 62110bd + 4f24ae3 commit 9e67b1c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions boto/ecs/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


import xml.sax
import cgi
import html
from boto.compat import six, StringIO

class ResponseGroup(xml.sax.ContentHandler):
Expand Down Expand Up @@ -67,7 +67,7 @@ def startElement(self, name, attrs, connection):
return None

def endElement(self, name, value, connection):
self._xml.write("%s</%s>" % (cgi.escape(value).replace("&amp;amp;", "&amp;"), name))
self._xml.write("%s</%s>" % (html.escape(value, quote=False).replace("&amp;amp;", "&amp;"), name))
if len(self._nodepath) == 0:
return
obj = None
Expand Down
9 changes: 7 additions & 2 deletions python-boto.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%{!?__python3: %global __python3 /usr/bin/python3}
%{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%if 0%{?el8}
%if 0%{?rhel} == 8 || 0%{?redos} == 7
%global el_python3_pkgversion 3
%else
%global el_python3_pkgversion 36
Expand All @@ -21,7 +21,7 @@ cloud systems like Eucalyptus, OpenStack and Open Nebula.
Summary: A simple, lightweight interface to Amazon Web Services
Name: python-%{pkgname}
Version: 2.46.1
Release: CROC48%{?buildid}%{?dist}
Release: CROC49%{?buildid}%{?dist}
License: MIT
Group: Development/Languages
URL: https://github.com/c2devel/boto
Expand Down Expand Up @@ -67,6 +67,11 @@ rm -f %buildroot/%{_bindir}/*


%changelog
* Thu Dec 21 2023 Ivan Konov <[email protected]> - 2.46.1-CROC49
- tests: add parameter required since py3.8 to hmac.new() calls
- tests: replace deprecated cgi.escape() with html.escape()
- spec: fixes for redos build

* Thu Oct 12 2023 Grigoriy Kulagin <[email protected]> - 2.46.1-CROC48
- .github: remove old py version checks
- ec2: add os and new instance type format
Expand Down
7 changes: 5 additions & 2 deletions tests/db/test_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import logging
import time

from hashlib import md5


log= logging.getLogger('password_property_test')
log.setLevel(logging.DEBUG)

Expand All @@ -37,7 +40,7 @@ def tearDown(self):
def hmac_hashfunc(self):
import hmac
def hashfunc(msg):
return hmac.new('mysecret', msg)
return hmac.new('mysecret', msg, digestmod=md5)
return hashfunc

def test_model(self,hashfunc=None):
Expand Down Expand Up @@ -98,7 +101,7 @@ def test_aaa_default_password_property(self):

def test_password_constructor_hashfunc(self):
import hmac
myhashfunc=lambda msg: hmac.new('mysecret', msg)
myhashfunc=lambda msg: hmac.new('mysecret', msg, digestmod=md5)
cls = self.test_model(hashfunc=myhashfunc)
obj = cls()
obj.password='hello'
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_hmac(self):
def hmac_hashfunc(cls, msg):
if not isinstance(msg, bytes):
msg = msg.encode('utf-8')
return hmac.new(b'mysecretkey', msg)
return hmac.new(b'mysecretkey', msg, digestmod=hashlib.md5)

class HMACPassword(Password):
hashfunc = hmac_hashfunc
Expand All @@ -95,15 +95,15 @@ class HMACPassword(Password):
password.set('foo')

self.assertEquals(str(password),
hmac.new(b'mysecretkey', b'foo').hexdigest())
hmac.new(b'mysecretkey', b'foo', digestmod=hashlib.md5).hexdigest())

def test_constructor(self):
hmac_hashfunc = lambda msg: hmac.new(b'mysecretkey', msg)
hmac_hashfunc = lambda msg: hmac.new(b'mysecretkey', msg, digestmod=hashlib.md5)

password = Password(hashfunc=hmac_hashfunc)
password.set('foo')
self.assertEquals(password.str,
hmac.new(b'mysecretkey', b'foo').hexdigest())
hmac.new(b'mysecretkey', b'foo', digestmod=hashlib.md5).hexdigest())


class TestPythonizeName(unittest.TestCase):
Expand Down

0 comments on commit 9e67b1c

Please sign in to comment.