Commit f31f7159 authored by runge's avatar runge

x11vnc: add reverse -connect support to -display WAIT:, fix SSL Fetch cert only for -display WAIT:

parent eb2eeed9
2007-08-15 Karl Runge <runge@karlrunge.com>
* x11vnc: add reverse -connect support to -display WAIT:
i.e. -find, -create, -svc, ... mode. Document need for
-shared under -connect host1,host2,... Fix bug in -display
WAIT: mode if vnc client tries to only retrieve SSL cert.
2007-08-03 Karl Runge <runge@karlrunge.com>
* x11vnc: add -xrefresh option, fix KDE .DCOPserver parse bug,
make sure UNIXPW_DISABLE_LOCALHOST/-unixpw_unsafe ignore
......
This diff is collapsed.
......@@ -405,8 +405,12 @@ void print_help(int mode) {
"\n"
"-connect string For use with \"vncviewer -listen\" reverse connections.\n"
" If \"string\" has the form \"host\" or \"host:port\"\n"
" the connection is made once at startup. Use commas\n"
" for a list of host's and host:port's.\n"
" the connection is made once at startup.\n"
"\n"
" Use commas for a list of host's and host:port's.\n"
" E.g. -connect host1,host2 or host1:0,host2:5678.\n"
" Note that to reverse connect to multiple hosts at the\n"
" same time you will likely need to also supply: -shared\n"
"\n"
" Note that unlike most vnc servers, x11vnc will require a\n"
" password for reverse as well as for forward connections.\n"
......
......@@ -1328,6 +1328,8 @@ int wait_for_client(int *argc, char** argv, int http) {
char *users_list_save = NULL;
int created_disp = 0;
int ncache_save;
int did_client_connect = 0;
int loop = 0;
if (! use_dpy || strstr(use_dpy, "WAIT:") != use_dpy) {
return 0;
......@@ -1527,20 +1529,113 @@ int wait_for_client(int *argc, char** argv, int http) {
#endif
}
if (inetd && use_openssl) {
accept_openssl(OPENSSL_INETD, -1);
}
if (client_connect != NULL) {
char *remainder = NULL;
if (inetd) {
rfbLog("wait_for_client: -connect disallowed in inetd mode: %s\n",
client_connect);
} else if (screen && screen->clientHead) {
rfbLog("wait_for_client: -connect disallowed: client exists: %s\n",
client_connect);
} else if (strchr(client_connect, '=')) {
rfbLog("wait_for_client: invalid -connect string: %s\n",
client_connect);
} else {
char *q = strchr(client_connect, ',');
if (q) {
rfbLog("wait_for_client: only using first"
" connect host in: %s\n", client_connect);
remainder = strdup(q+1);
*q = '\0';
}
rfbLog("wait_for_client: reverse_connect(%s)\n",
client_connect);
reverse_connect(client_connect);
did_client_connect = 1;
}
free(client_connect);
if (remainder != NULL) {
/* reset to host2,host3,... */
client_connect = remainder;
} else {
client_connect = NULL;
}
}
while (1) {
loop++;
if (shut_down) {
clean_up_exit(0);
}
if (use_openssl) {
if (loop < 2) {
if (did_client_connect) {
goto screen_check;
}
if (inetd) {
goto screen_check;
}
if (screen && screen->clientHead) {
goto screen_check;
}
}
if (use_openssl && !inetd) {
check_openssl();
/*
* This is to handle an initial verify cert from viewer,
* they disconnect right after fetching the cert.
*/
if (! use_threads) rfbPE(-1);
if (screen && screen->clientHead) {
int i;
if (unixpw) {
if (! unixpw_in_progress) {
rfbLog("unixpw but no unixpw_in_progress\n");
clean_up_exit(1);
}
if (unixpw_client && unixpw_client->onHold) {
rfbLog("taking unixpw_client off hold\n");
unixpw_client->onHold = FALSE;
}
}
for (i=0; i<10; i++) {
if (shut_down) {
clean_up_exit(0);
}
usleep(20 * 1000);
if (0) rfbLog("wait_for_client: %d\n", i);
if (! use_threads) {
if (unixpw) {
unixpw_in_rfbPE = 1;
}
rfbPE(-1);
if (unixpw) {
unixpw_in_rfbPE = 0;
}
}
if (unixpw && !unixpw_in_progress) {
/* XXX too soon. */
goto screen_check;
}
if (!screen->clientHead) {
break;
}
}
}
} else if (use_openssl) {
check_openssl();
}
if (! use_threads) {
rfbPE(-1);
}
screen_check:
if (! screen || ! screen->clientHead) {
usleep(100 * 1000);
continue;
......
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "August 2007" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.3, lastmod: 2007-08-03
version: 0.9.3, lastmod: 2007-08-15
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -480,8 +480,12 @@ Same as \fB-avahi.\fR
.IP
For use with "vncviewer -listen" reverse connections.
If \fIstring\fR has the form "host" or "host:port"
the connection is made once at startup. Use commas
for a list of host's and host:port's.
the connection is made once at startup.
.IP
Use commas for a list of host's and host:port's.
E.g. \fB-connect\fR host1,host2 or host1:0,host2:5678.
Note that to reverse connect to multiple hosts at the
same time you will likely need to also supply: \fB-shared\fR
.IP
Note that unlike most vnc servers, x11vnc will require a
password for reverse as well as for forward connections.
......
......@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.3 lastmod: 2007-08-03";
char lastmod[] = "0.9.3 lastmod: 2007-08-15";
/* X display info */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment