aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc.c
diff options
context:
space:
mode:
authorZihao Chang <changzihao1@huawei.com>2021-03-16 15:58:44 +0800
committerGerd Hoffmann <kraxel@redhat.com>2021-03-23 08:48:21 +0100
commit1f08e3415120637cad7f540d9ceb4dba3136dbdd (patch)
tree618455273446f9fc60ba940f7679f92bef9f1bf8 /ui/vnc.c
parenta29acc9c318781b59063091b895773fc6cbe96e7 (diff)
downloadqemu-1f08e3415120637cad7f540d9ceb4dba3136dbdd.zip
qemu-1f08e3415120637cad7f540d9ceb4dba3136dbdd.tar.gz
qemu-1f08e3415120637cad7f540d9ceb4dba3136dbdd.tar.bz2
vnc: support reload x509 certificates for vnc
This patch add vnc_display_reload_certs() to support update x509 certificates. Signed-off-by: Zihao Chang <changzihao1@huawei.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20210316075845.1476-3-changzihao1@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/vnc.c')
-rw-r--r--ui/vnc.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index e0fac21..456db47 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -585,6 +585,34 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
return prev;
}
+bool vnc_display_reload_certs(const char *id, Error **errp)
+{
+ VncDisplay *vd = vnc_display_find(id);
+ QCryptoTLSCredsClass *creds = NULL;
+
+ if (!vd) {
+ error_setg(errp, "Can not find vnc display");
+ return false;
+ }
+
+ if (!vd->tlscreds) {
+ error_setg(errp, "vnc tls is not enable");
+ return false;
+ }
+
+ creds = QCRYPTO_TLS_CREDS_GET_CLASS(OBJECT(vd->tlscreds));
+ if (creds->reload == NULL) {
+ error_setg(errp, "%s doesn't support to reload TLS credential",
+ object_get_typename(OBJECT(vd->tlscreds)));
+ return false;
+ }
+ if (!creds->reload(vd->tlscreds, errp)) {
+ return false;
+ }
+
+ return true;
+}
+
/* TODO
1) Get the queue working for IO.
2) there is some weirdness when using the -S option (the screen is grey