[libvirt] [PATCH] conf: Adjust invalid secrettype setting during parse

Martin Kletzander mkletzan at redhat.com
Wed Jun 24 08:40:53 UTC 2015


On Mon, Jun 15, 2015 at 03:00:16PM -0400, John Ferlan wrote:
>Commit id '1feaccf0' attempted to handle an empty secrettype value; however,
>it made a mistake by processing the secretType as if it was the original
>secrettype string.  The 'secretType' is actually whether 'usage' or 'uuid'
>was used.
>
>Thus adjust part of the change to make the same check for def->src->type !=
>VIR_STORAGE_TYPE_VOLUME before setting auth_secret_usage from the
>secrettype field.
>
>Luckily the aforementioned commits misdeed would be overwritten by the
>call to virStorageTranslateDiskSourcePool
>
>Signed-off-by: John Ferlan <jferlan at redhat.com>
>---
>
>Follow up to my recent change and response, see:
>
>http://www.redhat.com/archives/libvir-list/2015-June/msg00666.html
>

ACK

> src/conf/domain_conf.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index ca55981..c31edf5 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -6571,17 +6571,11 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
>                        xmlStrEqual(cur->name, BAD_CAST "auth")) {
>                 if (!(authdef = virStorageAuthDefParse(node->doc, cur)))
>                     goto error;
>-                /* Shared processing code with storage pools can leave
>-                 * this empty, but disk formatting uses it as does command
>-                 * creation - so use the secretType to attempt to fill it in.
>+                /* Disk volume types won't have the secrettype filled in until
>+                 * after virStorageTranslateDiskSourcePool is run
>                  */
>-                if (!authdef->secrettype) {
>-                    const char *secrettype =
>-                        virSecretUsageTypeToString(authdef->secretType);
>-                    if (VIR_STRDUP(authdef->secrettype, secrettype) < 0)
>-                        goto error;
>-                }
>-                if ((auth_secret_usage =
>+                if (def->src->type != VIR_STORAGE_TYPE_VOLUME &&
>+                    (auth_secret_usage =
>                      virSecretUsageTypeFromString(authdef->secrettype)) < 0) {
>                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>                                    _("invalid secret type %s"),
>--
>2.1.0
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150624/e931d5ab/attachment-0001.sig>


More information about the libvir-list mailing list