* [PATCH] crypto: fix getter of a QCryptoSecret's property
@ 2020-01-09 20:09 Tong Ho
2020-01-10 9:35 ` Daniel P. Berrangé
0 siblings, 1 reply; 2+ messages in thread
From: Tong Ho @ 2020-01-09 20:09 UTC (permalink / raw)
To: qemu-devel; +Cc: berrange
This fixes the condition-check done by the "loaded" property
getter, such that the property returns true even when the
secret is loaded by the 'file' option.
Signed-off-by: Tong Ho <tong.ho@xilinx.com>
---
Pre-existing getter returns true only when the secret is loaded
by the 'data' option.
crypto/secret.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/crypto/secret.c b/crypto/secret.c
index 1cf0ad0..5fb6bbe 100644
--- a/crypto/secret.c
+++ b/crypto/secret.c
@@ -221,6 +221,7 @@ qcrypto_secret_prop_set_loaded(Object *obj,
secret->rawlen = inputlen;
} else {
g_free(secret->rawdata);
+ secret->rawdata = NULL;
secret->rawlen = 0;
}
}
@@ -231,7 +232,7 @@ qcrypto_secret_prop_get_loaded(Object *obj,
Error **errp G_GNUC_UNUSED)
{
QCryptoSecret *secret = QCRYPTO_SECRET(obj);
- return secret->data != NULL;
+ return secret->rawdata != NULL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: fix getter of a QCryptoSecret's property
2020-01-09 20:09 [PATCH] crypto: fix getter of a QCryptoSecret's property Tong Ho
@ 2020-01-10 9:35 ` Daniel P. Berrangé
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2020-01-10 9:35 UTC (permalink / raw)
To: Tong Ho; +Cc: qemu-devel
On Thu, Jan 09, 2020 at 12:09:58PM -0800, Tong Ho wrote:
> This fixes the condition-check done by the "loaded" property
> getter, such that the property returns true even when the
> secret is loaded by the 'file' option.
>
> Signed-off-by: Tong Ho <tong.ho@xilinx.com>
> ---
> Pre-existing getter returns true only when the secret is loaded
> by the 'data' option.
>
> crypto/secret.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Added to my pending queue
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-10 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-09 20:09 [PATCH] crypto: fix getter of a QCryptoSecret's property Tong Ho
2020-01-10 9:35 ` Daniel P. Berrangé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).