PR#4388: kojikamid fixes
Merges #4388 https://pagure.io/koji/pull-request/4388 Fixes #4398 https://pagure.io/koji/issue/4398
This commit is contained in:
commit
83b4fb5aeb
1 changed files with 10 additions and 6 deletions
|
|
@ -45,7 +45,14 @@ import zipfile
|
||||||
from configparser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
from defusedxml import xmlrpc
|
try:
|
||||||
|
# patching xmlrpc to protect against XML related attacks
|
||||||
|
from defusedxml import xmlrpc
|
||||||
|
xmlrpc.monkey_patch()
|
||||||
|
except ImportError:
|
||||||
|
# just use stdlib in case defusedxml is missing
|
||||||
|
pass
|
||||||
|
import xmlrpc.client # nosec B411, we don't always have non-stdlib libraries
|
||||||
import six # noqa: F401, needed for imported code
|
import six # noqa: F401, needed for imported code
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -53,9 +60,6 @@ MANAGER_PORT = 7000
|
||||||
|
|
||||||
KOJIKAMID = True
|
KOJIKAMID = True
|
||||||
|
|
||||||
# patching xmlrpc to protect against XML related attacks
|
|
||||||
xmlrpc.monkey_patch()
|
|
||||||
|
|
||||||
# INSERT kojikamid dup #
|
# INSERT kojikamid dup #
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -341,7 +345,7 @@ class WindowsBuild(object):
|
||||||
elif checksum_type == 'sha256':
|
elif checksum_type == 'sha256':
|
||||||
checksum = hashlib.sha256()
|
checksum = hashlib.sha256()
|
||||||
elif checksum_type == 'md5':
|
elif checksum_type == 'md5':
|
||||||
checksum = md5_constructor.md5() # noqa: F821
|
checksum = md5_constructor() # noqa: F821
|
||||||
else:
|
else:
|
||||||
raise BuildError('Unknown checksum type %s for %s' % ( # noqa: F821
|
raise BuildError('Unknown checksum type %s for %s' % ( # noqa: F821
|
||||||
checksum_type,
|
checksum_type,
|
||||||
|
|
@ -638,7 +642,7 @@ def get_mgmt_server():
|
||||||
macaddr, gateway = find_net_info()
|
macaddr, gateway = find_net_info()
|
||||||
logger.debug('found MAC address %s, connecting to %s:%s',
|
logger.debug('found MAC address %s, connecting to %s:%s',
|
||||||
macaddr, gateway, MANAGER_PORT)
|
macaddr, gateway, MANAGER_PORT)
|
||||||
server = xmlrpc.xmlrpc_client.ServerProxy(
|
server = xmlrpc.client.ServerProxy(
|
||||||
'http://%s:%s/' % (gateway, MANAGER_PORT), allow_none=True
|
'http://%s:%s/' % (gateway, MANAGER_PORT), allow_none=True
|
||||||
)
|
)
|
||||||
# we would set a timeout on the socket here, but that is apparently not
|
# we would set a timeout on the socket here, but that is apparently not
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue