render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c401cc
From 61cbc22311d3241a32fd49dab600d9ba759fbc80 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <61cbc22311d3241a32fd49dab600d9ba759fbc80@dist-git>
c401cc
From: Peter Krempa <pkrempa@redhat.com>
c401cc
Date: Wed, 26 Feb 2014 14:54:51 +0100
c401cc
Subject: [PATCH] conf: Add helper do clear disk source authentication struct
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
c401cc
c401cc
Add virDomainDiskAuthClear to help cleaning out the struct in other
c401cc
places too.
c401cc
c401cc
(cherry picked from commit 0018477fb24962955a49d9591e7779bfb9b06b85)
c401cc
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/conf/domain_conf.c   | 17 ++++++++++++++---
c401cc
 src/conf/domain_conf.h   |  1 +
c401cc
 src/libvirt_private.syms |  1 +
c401cc
 3 files changed, 16 insertions(+), 3 deletions(-)
c401cc
c401cc
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
c401cc
index 4e182f1..6e833c8 100644
c401cc
--- a/src/conf/domain_conf.c
c401cc
+++ b/src/conf/domain_conf.c
c401cc
@@ -1196,12 +1196,9 @@ void virDomainDiskDefFree(virDomainDiskDefPtr def)
c401cc
     VIR_FREE(def->driverName);
c401cc
     virStorageFileFreeMetadata(def->backingChain);
c401cc
     VIR_FREE(def->mirror);
c401cc
-    VIR_FREE(def->auth.username);
c401cc
     VIR_FREE(def->wwn);
c401cc
     VIR_FREE(def->vendor);
c401cc
     VIR_FREE(def->product);
c401cc
-    if (def->auth.secretType == VIR_DOMAIN_DISK_SECRET_TYPE_USAGE)
c401cc
-        VIR_FREE(def->auth.secret.usage);
c401cc
     virStorageEncryptionFree(def->encryption);
c401cc
     virDomainDeviceInfoClear(&def->info);
c401cc
 
c401cc
@@ -1212,10 +1209,24 @@ void virDomainDiskDefFree(virDomainDiskDefPtr def)
c401cc
     }
c401cc
 
c401cc
     virDomainDiskHostDefFree(def->nhosts, def->hosts);
c401cc
+    virDomainDiskAuthClear(def);
c401cc
 
c401cc
     VIR_FREE(def);
c401cc
 }
c401cc
 
c401cc
+
c401cc
+void
c401cc
+virDomainDiskAuthClear(virDomainDiskDefPtr def)
c401cc
+{
c401cc
+    VIR_FREE(def->auth.username);
c401cc
+
c401cc
+    if (def->auth.secretType == VIR_DOMAIN_DISK_SECRET_TYPE_USAGE)
c401cc
+        VIR_FREE(def->auth.secret.usage);
c401cc
+
c401cc
+    def->auth.secretType = VIR_DOMAIN_DISK_SECRET_TYPE_NONE;
c401cc
+}
c401cc
+
c401cc
+
c401cc
 void virDomainDiskHostDefClear(virDomainDiskHostDefPtr def)
c401cc
 {
c401cc
     if (!def)
c401cc
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
c401cc
index 3d8666a..ff44a5d 100644
c401cc
--- a/src/conf/domain_conf.h
c401cc
+++ b/src/conf/domain_conf.h
c401cc
@@ -2209,6 +2209,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
c401cc
 void virDomainInputDefFree(virDomainInputDefPtr def);
c401cc
 void virDomainDiskDefFree(virDomainDiskDefPtr def);
c401cc
 void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
c401cc
+void virDomainDiskAuthClear(virDomainDiskDefPtr def);
c401cc
 void virDomainDiskHostDefClear(virDomainDiskHostDefPtr def);
c401cc
 void virDomainDiskHostDefFree(size_t nhosts, virDomainDiskHostDefPtr hosts);
c401cc
 virDomainDiskHostDefPtr virDomainDiskHostDefCopy(size_t nhosts,
c401cc
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
c401cc
index 827b1ec..0650a61 100644
c401cc
--- a/src/libvirt_private.syms
c401cc
+++ b/src/libvirt_private.syms
c401cc
@@ -178,6 +178,7 @@ virDomainDeviceFindControllerModel;
c401cc
 virDomainDeviceInfoCopy;
c401cc
 virDomainDeviceInfoIterate;
c401cc
 virDomainDeviceTypeToString;
c401cc
+virDomainDiskAuthClear;
c401cc
 virDomainDiskBusTypeToString;
c401cc
 virDomainDiskCacheTypeFromString;
c401cc
 virDomainDiskCacheTypeToString;
c401cc
-- 
c401cc
1.9.0
c401cc