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

Re: [libvirt] [PATCH] 6/10 AppArmor driver updates



On Mon, 2010-04-05 at 16:15 -0500, Jamie Strandboge wrote:

> 6_apparmor-fix-backingstore.patch: adjust virt-aa-helper to handle
> backing store[4]

-- 
Jamie Strandboge             | http://www.canonical.com
Author: Jamie Strandboge <jamie canonical com>
Description: adjust virt-aa-helper to handle backing store
Bug-Ubuntu: https://launchpad.net/bugs/470636

Index: libvirt-0.7.7/src/security/virt-aa-helper.c
===================================================================
--- libvirt-0.7.7.orig/src/security/virt-aa-helper.c	2010-03-31 15:13:22.000000000 -0500
+++ libvirt-0.7.7/src/security/virt-aa-helper.c	2010-03-31 15:15:09.000000000 -0500
@@ -36,6 +36,7 @@
 #include "uuid.h"
 #include "hostusb.h"
 #include "pci.h"
+#include "storage_file.h"
 
 static char *progname;
 
@@ -809,6 +810,33 @@
     for (i = 0; i < ctl->def->ndisks; i++)
         if (ctl->def->disks[i] && ctl->def->disks[i]->src) {
             int ret;
+            const char *path;
+
+            path = ctl->def->disks[i]->src;
+            do {
+                virStorageFileMetadata meta;
+
+                memset(&meta, 0, sizeof(meta));
+
+                ret = virStorageFileGetMetadata(path, &meta);
+
+                if (path != ctl->def->disks[i]->src)
+                    VIR_FREE(path);
+                path = NULL;
+
+                if (ret < 0) {
+                    vah_warning("skipping backingStore check (open failed)");
+                    continue;
+                }
+
+                if (meta.backingStore != NULL &&
+                    (ret = vah_add_file(&buf, meta.backingStore, "rw")) != 0) {
+                    VIR_FREE(meta.backingStore);
+                    goto clean;
+                }
+
+                path = meta.backingStore;
+            } while (path != NULL);
 
             if (ctl->def->disks[i]->readonly)
                 ret = vah_add_file(&buf, ctl->def->disks[i]->src, "r");

Attachment: signature.asc
Description: This is a digitally signed message part


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