Signed-off-by: Nikolay Shirokovskiy <nshirokovs...@virtuozzo.com>
---
 src/vz/vz_sdk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 2e2cdfd..334b2d0 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1160,6 +1160,7 @@ prlsdkAddVNCInfo(PRL_HANDLE sdkdom, virDomainDefPtr def)
     PRL_VM_REMOTE_DISPLAY_MODE vncMode;
     PRL_UINT32 port;
     PRL_RESULT pret;
+    char *passwd = NULL;
 
     pret = PrlVmCfg_GetVNCMode(sdkdom, &vncMode);
     prlsdkCheckRetGoto(pret, error);
@@ -1170,6 +1171,14 @@ prlsdkAddVNCInfo(PRL_HANDLE sdkdom, virDomainDefPtr def)
     if (VIR_ALLOC(gr) < 0)
         goto error;
 
+    if (!(passwd = prlsdkGetStringParamVar(PrlVmCfg_GetVNCPassword, sdkdom)))
+        goto error;
+
+    if (*passwd != '\0') {
+        gr->data.vnc.auth.passwd = passwd;
+        passwd = NULL;
+    }
+
     pret = PrlVmCfg_GetVNCPort(sdkdom, &port);
     prlsdkCheckRetGoto(pret, error);
 
@@ -1195,6 +1204,7 @@ prlsdkAddVNCInfo(PRL_HANDLE sdkdom, virDomainDefPtr def)
 
  error:
     virDomainGraphicsDefFree(gr);
+    VIR_FREE(passwd);
     return -1;
 }
 
@@ -2756,6 +2766,9 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom,
         return 0;
     }
 
+    pret = PrlVmCfg_SetVNCPassword(sdkdom, gr->data.vnc.auth.passwd ? : "");
+    prlsdkCheckRetExit(pret, -1);
+
     if (gr->data.vnc.autoport) {
         pret = PrlVmCfg_SetVNCMode(sdkdom, PRD_AUTO);
         prlsdkCheckRetGoto(pret, cleanup);
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to