diff mbox series

[v3,6/7] ui/vnc: Use qcrypto_tls_session_check_role()

Message ID 20210615172746.2212998-7-philmd@redhat.com
State New
Headers show
Series crypto: Make QCryptoTLSCreds* structures private | expand

Commit Message

Philippe Mathieu-Daudé June 15, 2021, 5:27 p.m. UTC
Avoid accessing QCryptoTLSCreds internals by using
the qcrypto_tls_session_check_role() helper.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 ui/vnc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/ui/vnc.c b/ui/vnc.c
index b3d4d7b9a5f..c7c8454b873 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4080,9 +4080,9 @@  void vnc_display_open(const char *id, Error **errp)
         }
         object_ref(OBJECT(vd->tlscreds));
 
-        if (vd->tlscreds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-            error_setg(errp,
-                       "Expecting TLS credentials with a server endpoint");
+        if (!qcrypto_tls_session_check_role(vd->tlscreds,
+                                            QCRYPTO_TLS_CREDS_ENDPOINT_SERVER,
+                                            errp)) {
             goto fail;
         }
     }