From 6fbba525a924961083bf2e43bb841bd15671f526 Mon Sep 17 00:00:00 2001 From: runge Date: Sat, 22 Nov 2008 18:36:33 +0000 Subject: x11vnc: x11vnc.desktop file. -reopen, -dhparams, -sslCRL, -setdefer options. -rfbport PROMPT VeNCrypt and TLSVNC SSL/TLS encryption support. Tweaks to choose_delay() algorithm. -ssl ANON anonymouse Diffie-Hellman mode. Fix bugs in certs management. Additions to tray=setpass naive user mode. --- x11vnc/gui.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 171 insertions(+), 9 deletions(-) (limited to 'x11vnc/gui.c') diff --git a/x11vnc/gui.c b/x11vnc/gui.c index 940a069..41c4202 100644 --- a/x11vnc/gui.c +++ b/x11vnc/gui.c @@ -229,15 +229,17 @@ static void sigusr1 (int sig) { if (0) sig = 0; } +static char *extra_path = ":/usr/local/bin:/usr/bin/X11:/usr/sfw/bin" + ":/usr/X11R6/bin:/usr/openwin/bin:/usr/dt/bin"; +static char *wishes[] = {"wish8.4", "wish", "wish8.3", "wish8.5", "wish8.0", NULL}; + static void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int start_x11vnc, int simple_gui, pid_t parent, char *gui_opts) { char *x11vnc_xdisplay = NULL; - char extra_path[] = ":/usr/local/bin:/usr/bin/X11:/usr/sfw/bin" - ":/usr/X11R6/bin:/usr/openwin/bin:/usr/dt/bin"; char cmd[100]; char *wish = NULL, *orig_path, *full_path, *tpath, *p; char *old_xauth = NULL; - int try_max = 4, sleep = 300, totms; + int try_max = 4, sleep = 300, totms, rc = 0; pid_t mypid = getpid(); FILE *pipe, *tmpf; @@ -255,7 +257,7 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc x11vnc_xdisplay = strdup(use_dpy); } if (connect_to_x11vnc) { - int rc, i; + int i; rfbLogEnable(1); if (! client_connect_file) { if (getenv("XAUTHORITY") != NULL) { @@ -383,17 +385,18 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc while (p) { char *try; struct stat sbuf; - char *wishes[] = {"wish", "wish8.3", "wish8.4", "wish8.5", - "wish8.0"}; - int nwishes = 3, i; + int i; try = (char *) malloc(strlen(p) + 1 + strlen("wish8.4") + 1); - for (i=0; i %s", p1, wish, tf1, tf2); + } else { + sprintf(cmd, "env PATH='%s' DISPLAY='%s' %s %s -name x11vnc_port_prompt -portprompt > %s", p1, dstr, wish, tf1, tf2); + } + if (getenv("X11VNC_DEBUG_PORTPROMPT")) { + fprintf(stderr, "cmd=%s\n", cmd); + } + if (use_openssl) { + set_env("X11VNC_SSL_ENABLED", "1"); + } + if (allow_list && !strcmp(allow_list, "127.0.0.1")) { + set_env("X11VNC_LOCALHOST_ENABLED", "1"); + } + if (got_ultrafilexfer) { + set_env("X11VNC_FILETRANSFER_ENABLED", "ultra"); + } else if (tightfilexfer) { + set_env("X11VNC_FILETRANSFER_ENABLED", "tight"); + } + system(cmd); + free(cmd); + free(p1); + + fp = fopen(tf2, "r"); + memset(line, 0, sizeof(line)); + if (fp) { + fgets(line, 128, fp); + fclose(fp); + if (line[0] != '\0') { + int readport = atoi(line); + if (readport > 0) { + got_rfbport_val = readport; + } + } + } + + if (strstr(line, "ssl0")) { + if (use_openssl) use_openssl = 0; + } else if (strstr(line, "ssl1")) { + if (!use_openssl) { + use_openssl = 1; + openssl_pem = strdup("SAVE_NOPROMPT"); + set_env("X11VNC_GOT_SSL", "1"); + } + } + + if (strstr(line, "localhost0")) { + if (allow_list && !strcmp(allow_list, "127.0.0.1")) { + allow_list = NULL; + } + } else if (strstr(line, "localhost1")) { + allow_list = strdup("127.0.0.1"); + } + + if (strstr(line, "ft_ultra")) { + got_ultrafilexfer = 1; + tightfilexfer = 0; + } else if (strstr(line, "ft_tight")) { + got_ultrafilexfer = 0; + tightfilexfer = 1; + } else if (strstr(line, "ft_none")) { + got_ultrafilexfer = 0; + tightfilexfer = 0; + } + + unlink(tf1); + unlink(tf2); + + if (old_xauth) { + set_env("XAUTHORITY", old_xauth); + } + + return; + } if (start_x11vnc) { -- cgit v1.2.1