diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2021-06-28 18:09:09 +0200 |
---|---|---|
committer | Michael Roth <michael.roth@amd.com> | 2021-10-14 16:27:13 -0500 |
commit | 738ff4bf07304399d3d830afd4b5e3296fbb3cce (patch) | |
tree | 31fa155bedcfd2e24ff9bc4aa3ed48acd3dd0e59 | |
parent | 7e84d58e8be9c8b64710982f947f63b95816d311 (diff) | |
download | qemu-738ff4bf07304399d3d830afd4b5e3296fbb3cce.zip qemu-738ff4bf07304399d3d830afd4b5e3296fbb3cce.tar.gz qemu-738ff4bf07304399d3d830afd4b5e3296fbb3cce.tar.bz2 |
block/nbd: Use qcrypto_tls_creds_check_endpoint()
Avoid accessing QCryptoTLSCreds internals by using
the qcrypto_tls_creds_check_endpoint() helper.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 7b3b616838c30830c004b746e7b1209297118318)
Signed-off-by: Michael Roth <michael.roth@amd.com>
-rw-r--r-- | block/nbd.c | 6 | ||||
-rw-r--r-- | blockdev-nbd.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/block/nbd.c b/block/nbd.c index 1d4668d..add03cf 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -2163,9 +2163,9 @@ static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, Error **errp) return NULL; } - if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) { - error_setg(errp, - "Expecting TLS credentials with a client endpoint"); + if (!qcrypto_tls_creds_check_endpoint(creds, + QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, + errp)) { return NULL; } object_ref(obj); diff --git a/blockdev-nbd.c b/blockdev-nbd.c index b264620..bdfa7ed 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -108,9 +108,9 @@ static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, Error **errp) return NULL; } - if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { - error_setg(errp, - "Expecting TLS credentials with a server endpoint"); + if (!qcrypto_tls_creds_check_endpoint(creds, + QCRYPTO_TLS_CREDS_ENDPOINT_SERVER, + errp)) { return NULL; } object_ref(obj); |