]> git.ipfire.org Git - thirdparty/libvirt.git/commit
secret: Add check/validation for correct usage when LookupByUUID
authorJohn Ferlan <jferlan@redhat.com>
Tue, 4 Dec 2018 20:15:22 +0000 (15:15 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 13 Dec 2018 15:22:25 +0000 (10:22 -0500)
commite0eb8a8a696ee334fa33281b880e480e76348052
treeaea45f904f2ac1d106172b5d8238e0b68442114f
parentb7378a6d29b2f59114f988243f5f1600cf6e9a1e
secret: Add check/validation for correct usage when LookupByUUID

https://bugzilla.redhat.com/show_bug.cgi?id=1656255

If virSecretGetSecretString is using by secretLookupByUUID,
then it's possible the found sec->usageType doesn't match the
desired @secretUsageType. If this occurs for the encrypted
volume creation processing and a subsequent pool refresh is
executed, then the secret used to create the volume will not
be found by the storageBackendLoadDefaultSecrets which expects
to find secrets by VIR_SECRET_USAGE_TYPE_VOLUME.

Add a check to virSecretGetSecretString to avoid the possibility
along with an error indicating the incorrect matched types.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
src/secret/secret_util.c
tests/qemuxml2argvtest.c