aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ui/console.h1
-rw-r--r--ui/vnc.c28
2 files changed, 29 insertions, 0 deletions
diff --git a/include/ui/console.h b/include/ui/console.h
index c960b7066c..2714038a0f 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -476,6 +476,7 @@ int vnc_display_password(const char *id, const char *password);
int vnc_display_pw_expire(const char *id, time_t expires);
void vnc_parse(const char *str);
int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
+bool vnc_display_reload_certs(const char *id, Error **errp);
/* input.c */
int index_from_key(const char *key, size_t key_length);
diff --git a/ui/vnc.c b/ui/vnc.c
index e0fac2136e..456db47d71 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