qubes/storage: py3k related fixes
This commit is contained in:
parent
3e0f225938
commit
f7d73893d7
@ -55,7 +55,7 @@ class DomainPool(Pool):
|
|||||||
# /qubes-block-devices/foo/{desc,mode,size} we need to merge this
|
# /qubes-block-devices/foo/{desc,mode,size} we need to merge this
|
||||||
devices = {}
|
devices = {}
|
||||||
for untrusted_device_path in untrusted_qubes_devices:
|
for untrusted_device_path in untrusted_qubes_devices:
|
||||||
if not all(c in safe_set for c in untrusted_device_path):
|
if not all(chr(c) in safe_set for c in untrusted_device_path):
|
||||||
msg = ("%s vm's device path name contains unsafe characters. "
|
msg = ("%s vm's device path name contains unsafe characters. "
|
||||||
"Skipping it.")
|
"Skipping it.")
|
||||||
self.vm.log.warning(msg % self.vm.name)
|
self.vm.log.warning(msg % self.vm.name)
|
||||||
@ -63,7 +63,8 @@ class DomainPool(Pool):
|
|||||||
|
|
||||||
# name can be trusted because it was checked as a part of
|
# name can be trusted because it was checked as a part of
|
||||||
# untrusted_device_path check above
|
# untrusted_device_path check above
|
||||||
_, _, name, untrusted_atr = untrusted_device_path.split('/', 4)
|
_, _, name, untrusted_atr = untrusted_device_path.\
|
||||||
|
decode('ascii').split('/', 4)
|
||||||
|
|
||||||
if untrusted_atr in allowed_attributes.keys():
|
if untrusted_atr in allowed_attributes.keys():
|
||||||
atr = untrusted_atr
|
atr = untrusted_atr
|
||||||
@ -75,8 +76,8 @@ class DomainPool(Pool):
|
|||||||
|
|
||||||
untrusted_value = qdb.read(untrusted_device_path)
|
untrusted_value = qdb.read(untrusted_device_path)
|
||||||
allowed_characters = allowed_attributes[atr]
|
allowed_characters = allowed_attributes[atr]
|
||||||
if all(c in allowed_characters for c in untrusted_value):
|
if all(chr(c) in allowed_characters for c in untrusted_value):
|
||||||
value = untrusted_value
|
value = untrusted_value.decode('ascii')
|
||||||
else:
|
else:
|
||||||
msg = ("{!s} vm's device path {!s} contains unsafe characters")
|
msg = ("{!s} vm's device path {!s} contains unsafe characters")
|
||||||
self.vm.log.error(msg.format(self.vm.name, atr))
|
self.vm.log.error(msg.format(self.vm.name, atr))
|
||||||
|
@ -536,7 +536,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
result += [volume]
|
result += [volume]
|
||||||
break
|
break
|
||||||
|
|
||||||
return result + self.volumes.values()
|
return result + list(self.volumes.values())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def libvirt_domain(self):
|
def libvirt_domain(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user