[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] storage: support all file permissions



sticky, setuid and setgid are no longer ignored.
---
 src/conf/storage_conf.c       |    6 ++++--
 src/storage/storage_backend.c |    3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7944555..c492106 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1035,7 +1035,8 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
 
         virBufferAddLit(&buf,"    <permissions>\n");
         virBufferAsprintf(&buf,"      <mode>0%o</mode>\n",
-                          def->target.perms.mode);
+                          def->target.perms.mode &
+                          (S_ISUID | S_ISGID | S_ISVTX | S_IRWXUGO));
         virBufferAsprintf(&buf,"      <owner>%u</owner>\n",
                           (unsigned int) def->target.perms.uid);
         virBufferAsprintf(&buf,"      <group>%u</group>\n",
@@ -1275,7 +1276,8 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
 
     virBufferAddLit(buf,"    <permissions>\n");
     virBufferAsprintf(buf,"      <mode>0%o</mode>\n",
-                      def->perms.mode);
+                      def->perms.mode &
+                      (S_ISUID | S_ISGID | S_ISVTX | S_IRWXUGO));
     virBufferAsprintf(buf,"      <owner>%u</owner>\n",
                       (unsigned int) def->perms.uid);
     virBufferAsprintf(buf,"      <group>%u</group>\n",
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index e677cda..e9ec7a5 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1210,7 +1210,8 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
         }
     }
 
-    target->perms.mode = sb.st_mode & S_IRWXUGO;
+    target->perms.mode = sb.st_mode &
+                         (S_ISUID | S_ISGID | S_ISVTX | S_IRWXUGO);
     target->perms.uid = sb.st_uid;
     target->perms.gid = sb.st_gid;
 
-- 
1.7.8.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]