From 8bef644d17f62ea6daf7459b863f05de187966fe Mon Sep 17 00:00:00 2001 From: runge Date: Wed, 10 Dec 2008 17:12:27 +0000 Subject: x11vnc: 0.9.6 release. Some strtok bugfixes. rename -tlsvnc to -anontls. Disable ssl caching. No cert creation prompting in inetd or bg modes. waitpid a bit more carefully on ssl helpers. Tune ssl initial timeouts. Let -create user specify starting X display. fix -rfbport prompt gui for older tk. -sslonly option. Error if no -ssl with related options. -rand option. -ssl implies -ssl SAVE --- x11vnc/connections.c | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) (limited to 'x11vnc/connections.c') diff --git a/x11vnc/connections.c b/x11vnc/connections.c index 2b7d2df..52b3f2a 100644 --- a/x11vnc/connections.c +++ b/x11vnc/connections.c @@ -2338,6 +2338,7 @@ static int do_reverse_connect(char *str_in) { write(vncsock, prestring, prestring_len); free(prestring); } +/* XXX use header */ #define OPENSSL_REVERSE 4 openssl_init(1); accept_openssl(OPENSSL_REVERSE, vncsock); @@ -2345,6 +2346,7 @@ static int do_reverse_connect(char *str_in) { free(host); return 1; } + if (use_stunnel) { if(strcmp(host, "localhost") && strcmp(host, "127.0.0.1")) { if (!getenv("STUNNEL_DISABLE_LOCALHOST")) { @@ -2427,20 +2429,31 @@ void reverse_connect(char *str) { int sleep_min = 1500, sleep_max = 4500, n_max = 5; int n, tot, t, dt = 100, cnt = 0; int nclients0 = client_count; + int lcnt, j; + char **list; if (unixpw_in_progress) return; tmp = strdup(str); + list = (char **) calloc( (strlen(tmp)+2) * sizeof (char *), 1); + lcnt = 0; + p = strtok(tmp, ", \t\r\n"); while (p) { + list[lcnt++] = strdup(p); + p = strtok(NULL, ", \t\r\n"); + } + free(tmp); + + for (j = 0; j < lcnt; j++) { + p = list[j]; + if ((n = do_reverse_connect(p)) != 0) { rfbPE(-1); } cnt += n; - - p = strtok(NULL, ", \t\r\n"); - if (p) { + if (list[j+1] != NULL) { t = 0; while (t < sleep_between_host) { usleep(dt * 1000); @@ -2449,7 +2462,12 @@ void reverse_connect(char *str) { } } } - free(tmp); + + for (j = 0; j < lcnt; j++) { + p = list[j]; + if (p) free(p); + } + free(list); if (cnt == 0) { if (connect_or_exit) { @@ -2739,6 +2757,9 @@ void check_gui_inputs(void) { for (i=0; i