mirror of
https://github.com/qemu/qemu.git
synced 2024-12-04 09:13:39 +08:00
chardev/socket: 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 8612df2ebe
)
Signed-off-by: Michael Roth <michael.roth@amd.com>
This commit is contained in:
parent
8d5c255a25
commit
0a7e2c99f9
@ -1402,18 +1402,12 @@ static void qmp_chardev_open_socket(Chardev *chr,
|
||||
return;
|
||||
}
|
||||
object_ref(OBJECT(s->tls_creds));
|
||||
if (is_listen) {
|
||||
if (s->tls_creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
|
||||
error_setg(errp, "%s",
|
||||
"Expected TLS credentials for server endpoint");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (s->tls_creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) {
|
||||
error_setg(errp, "%s",
|
||||
"Expected TLS credentials for client endpoint");
|
||||
return;
|
||||
}
|
||||
if (!qcrypto_tls_creds_check_endpoint(s->tls_creds,
|
||||
is_listen
|
||||
? QCRYPTO_TLS_CREDS_ENDPOINT_SERVER
|
||||
: QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT,
|
||||
errp)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
s->tls_authz = g_strdup(sock->tls_authz);
|
||||
|
Loading…
Reference in New Issue
Block a user