summaryrefslogtreecommitdiffstats
path: root/x11vnc/screen.c
diff options
context:
space:
mode:
authorrunge <runge@karlrunge.com>2010-04-09 20:09:15 -0400
committerrunge <runge@karlrunge.com>2010-04-09 20:09:15 -0400
commit2a8ba97ec5b0f7fbfcfc8adab6732a95e95c7204 (patch)
tree7da693c36f06f4e16e8bc2b030c54b67f01d8671 /x11vnc/screen.c
parent5c53ccbbe99dbf098dbb396a65b487f08315d825 (diff)
downloadlibtdevnc-2a8ba97ec5b0f7fbfcfc8adab6732a95e95c7204.tar.gz
libtdevnc-2a8ba97ec5b0f7fbfcfc8adab6732a95e95c7204.zip
x11vnc: exit(1) for -connect_or_exit failure, quiet query mode for grab_state, pointer_pos, etc. ipv6 support. STUNNEL_LISTEN for particular interface. -input_eagerly in addition to -allinput. quiet Xinerama message.
Diffstat (limited to 'x11vnc/screen.c')
-rw-r--r--x11vnc/screen.c54
1 files changed, 49 insertions, 5 deletions
diff --git a/x11vnc/screen.c b/x11vnc/screen.c
index 4595f56..127267d 100644
--- a/x11vnc/screen.c
+++ b/x11vnc/screen.c
@@ -1421,7 +1421,7 @@ char *vnc_reflect_guess(char *str, char **raw_fb_addr) {
if (first) {
argv[argc++] = "x11vnc_rawfb_vnc";
if (strstr(hp, "listen") == hp) {
- char *q = strchr(hp, ':');
+ char *q = strrchr(hp, ':');
argv[argc++] = strdup("-listen");
if (q) {
client->listenPort = atoi(q+1);
@@ -3589,12 +3589,54 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
defer_update = screen->deferUpdateTime;
}
- rfbInitServer(screen);
+ if (noipv4 || getenv("IPV4_FAILS")) {
+ rfbBool ap = screen->autoPort;
+ int port = screen->port;
+
+ if (getenv("IPV4_FAILS")) {
+ rfbLog("TESTING: IPV4_FAILS for rfbInitServer()\n");
+ }
+
+ screen->autoPort = FALSE;
+ screen->port = 0;
+
+ rfbInitServer(screen);
+
+ screen->autoPort = ap;
+ screen->port = port;
+
+ } else {
+ rfbInitServer(screen);
+ }
if (use_openssl) {
- openssl_port();
+ openssl_port(0);
if (https_port_num >= 0) {
- https_port();
+ https_port(0);
+ }
+ } else {
+ if (ipv6_listen) {
+ int fd = -1;
+ if (screen->port <= 0) {
+ if (got_rfbport) {
+ screen->port = got_rfbport_val;
+ } else {
+ int ap = 5900;
+ if (auto_port > 0) {
+ ap = auto_port;
+ }
+ screen->port = find_free_port6(ap, ap+200);
+ }
+ }
+ fd = listen6(screen->port);
+ if (fd < 0) {
+ ipv6_listen = 0;
+ } else {
+ rfbLog("%slistening on IPv6 port=%d sock=%d\n",
+ screen->listenSock < 0 ? "Only " : "Also ",
+ screen->port, fd);
+ ipv6_listen_fd = fd;
+ }
}
}
@@ -3717,7 +3759,8 @@ void do_announce_http(void) {
return;
}
- if (screen->httpListenSock > -1 && screen->httpPort) {
+ /* XXX ipv6? */
+ if ((screen->httpListenSock > -1 || ipv6_http_fd > -1) && screen->httpPort) {
int enc_none = (enc_str && !strcmp(enc_str, "none"));
char *SPORT = " (single port)";
if (use_openssl && ! enc_none) {
@@ -3752,6 +3795,7 @@ void do_announce_http(void) {
void do_mention_java_urls(void) {
if (! quiet && screen) {
+ /* XXX ipv6? */
if (screen->httpListenSock > -1 && screen->httpPort) {
rfbLog("\n");
rfbLog("The URLs printed out below ('Java ... viewer URL') can\n");