From 07e8de89e1330877bb377db0d4f6a51167d2a677 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 23 Jun 2014 13:09:45 +0200 Subject: [PATCH] new option -notls We need this for novnc (encryption is done by websocket) --- vncterm.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/vncterm.c b/vncterm.c index ec5394b..9d74bf6 100644 --- a/vncterm.c +++ b/vncterm.c @@ -2196,6 +2196,8 @@ new_client (rfbClientPtr client) return RFB_CLIENT_ACCEPT; } +static char *vncticket = NULL; + vncTerm * create_vncterm (int argc, char** argv, int maxx, int maxy) { @@ -2204,6 +2206,8 @@ create_vncterm (int argc, char** argv, int maxx, int maxy) rfbScreenInfoPtr screen = rfbGetScreen (&argc, argv, maxx, maxy, 8, 1, 1); screen->frameBuffer=(char*)calloc(maxx*maxy, 1); + char **passwds = calloc(sizeof(char**), 2); + vncTerm *vt = (vncTerm *)calloc (sizeof(vncTerm), 1); rfbColourMap *cmap =&screen->colourMap; @@ -2272,7 +2276,15 @@ create_vncterm (int argc, char** argv, int maxx, int maxy) //screen->autoPort = 1; - rfbRegisterSecurityHandler(&VncSecurityHandlerVencrypt); + if (vncticket) { + passwds[0] = vncticket; + passwds[1] = NULL; + + screen->authPasswdData = (void *)passwds; + screen->passwordCheck = rfbCheckPasswordByList; + } else { + rfbRegisterSecurityHandler(&VncSecurityHandlerVencrypt); + } rfbInitServer(screen); @@ -2334,6 +2346,13 @@ main (int argc, char** argv) auth_perm = argv[i+1]; rfbPurgeArguments(&argc, &i, 2, argv); } + if (!strcmp (argv[i], "-notls")) { + rfbPurgeArguments(&argc, &i, 1, argv); + if ((vncticket = getenv("PVE_VNC_TICKET")) == NULL) { + fprintf(stderr, "missing env PVE_VNC_TICKET (-notls)\n"); + exit(-1); + } + } } #ifdef DEBUG -- 2.39.2