[node-patches] Change in ovirt-node[master]: security: Add encode to getfilecon and chcon

dougsland at redhat.com dougsland at redhat.com
Tue Aug 25 13:20:53 UTC 2015


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: security: Add encode to getfilecon and chcon
......................................................................

security: Add encode to getfilecon and chcon

Make sure both calls are utf8 encoded.

Change-Id: Ic7aa07db42eebfce8242f8bb36af9e628b13d11d
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1252268
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M src/ovirt/node/utils/security.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/01/45301/1

diff --git a/src/ovirt/node/utils/security.py b/src/ovirt/node/utils/security.py
index f4390b0..1a22bc1 100644
--- a/src/ovirt/node/utils/security.py
+++ b/src/ovirt/node/utils/security.py
@@ -110,14 +110,14 @@
     def getcon(self, abspath):
         """ Return context of file, symlink or dir """
         try:
-            return selinux.getfilecon(abspath)[1]
+            return selinux.getfilecon(abspath.encode("utf-8"))[1]
         except OSError:
             self._logger.warning('Cannot get selinux context: "%s"', abspath)
 
     def chcon(self, abspath, context):
         """ Change selinux security context """
         try:
-            return selinux.chcon(abspath, context)
+            return selinux.chcon(abspath.encode("utf-8"), context)
         except OSError:
             self._logger.warning('Cannot change selinux context: "%s" "%s"',
                                  (abspath, context))


-- 
To view, visit https://gerrit.ovirt.org/45301
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7aa07db42eebfce8242f8bb36af9e628b13d11d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list