diff options
author | runge <runge@karlrunge.com> | 2009-06-14 19:00:09 -0400 |
---|---|---|
committer | runge <runge@karlrunge.com> | 2009-06-14 19:00:09 -0400 |
commit | d11b2abd8cf4d9afb1257695f8be1125d5625a65 (patch) | |
tree | 70fd354a069604031a4087620b7965574aeaef8a /x11vnc/screen.c | |
parent | 0e7499fb395ddfe95395bcb70836893dc4c00535 (diff) | |
download | libvncserver-d11b2abd8cf4d9afb1257695f8be1125d5625a65.zip libvncserver-d11b2abd8cf4d9afb1257695f8be1125d5625a65.tar.gz |
X11VNC_REFLECT_PASSWORD env. var., warning about compiz, improve single-port.
Diffstat (limited to 'x11vnc/screen.c')
-rw-r--r-- | x11vnc/screen.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/x11vnc/screen.c b/x11vnc/screen.c index 8c2779c..71f4462 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -1175,6 +1175,39 @@ rfbBool vnc_reflect_resize(rfbClient *cl) { return cl->frameBuffer ? TRUE : FALSE; } +static char* vnc_reflect_get_password(rfbClient* client) { + char *q, *p, *str = getenv("X11VNC_REFLECT_PASSWORD"); + int len = 110; + + if (str) { + len += 2*strlen(str); + } + p = (char *) calloc(len, 1); + if (!str || strlen(str) == 0) { + fprintf(stderr, "VNC Reflect Password: "); + fgets(p, 100, stdin); + } else { + if (strstr(str, "file:") == str) { + FILE *f = fopen(str + strlen("file:"), "r"); + if (f) { + fgets(p, 100, f); + fclose(f); + } + } + if (p[0] == '\0') { + strncpy(p, str, 100); + } + } + q = p; + while (*q != '\0') { + if (*q == '\n') { + *q = '\0'; + } + q++; + } + return p; +} + char *vnc_reflect_guess(char *str, char **raw_fb_addr) { static int first = 1; @@ -1206,6 +1239,10 @@ char *vnc_reflect_guess(char *str, char **raw_fb_addr) { client->canHandleNewFBSize = TRUE; client->GotFrameBufferUpdate = vnc_reflect_got_update; + if (getenv("X11VNC_REFLECT_PASSWORD")) { + client->GetPassword = vnc_reflect_get_password; + } + if (first) { argv[argc++] = "x11vnc_rawfb_vnc"; if (strstr(hp, "listen") == hp) { |