Commit 2a8ba97e authored by runge's avatar runge

x11vnc: exit(1) for -connect_or_exit failure, quiet query mode for grab_state,...

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.
parent 5c53ccbb
2010-04-09 Karl Runge <runge@karlrunge.com>
* classes/ssl: debugging and workarounds for java viewer
* x11vnc/misc: sync ssvnc, improve util scripts.
* x11vnc: exit(1) for -connect_or_exit failure, quiet query
mode for grab_state, etc. ipv6 support. STUNNEL_LISTEN for
particular interface. -input_eagerly in addition to -allinput.
quiet Xinerama message.
2010-03-20 Karl Runge <runge@karlrunge.com> 2010-03-20 Karl Runge <runge@karlrunge.com>
* classes/ssl: Many improvements to Java SSL applet, onetimekey * classes/ssl: Many improvements to Java SSL applet, onetimekey
serverCert param, debugging printout, user dialogs, catch serverCert param, debugging printout, user dialogs, catch
......
This diff is collapsed.
This diff is collapsed.
...@@ -68,6 +68,7 @@ extern void send_client_info(char *str); ...@@ -68,6 +68,7 @@ extern void send_client_info(char *str);
extern void adjust_grabs(int grab, int quiet); extern void adjust_grabs(int grab, int quiet);
extern void check_new_clients(void); extern void check_new_clients(void);
extern int accept_client(rfbClientPtr client); extern int accept_client(rfbClientPtr client);
extern void check_ipv6_listen(long usec);
extern int run_user_command(char *cmd, rfbClientPtr client, char *mode, char *input, extern int run_user_command(char *cmd, rfbClientPtr client, char *mode, char *input,
int len, FILE *output); int len, FILE *output);
extern int check_access(char *addr); extern int check_access(char *addr);
......
...@@ -66,7 +66,7 @@ so, delete this exception statement from your version. ...@@ -66,7 +66,7 @@ so, delete this exception statement from your version.
* without using SSH or SSL. * without using SSH or SSL.
* *
* ----------------------------------------------------------------------- * -----------------------------------------------------------------------
* Copyright (C) 2008-2009 Karl J. Runge <runge@karlrunge.com> * Copyright (C) 2008-2010 Karl J. Runge <runge@karlrunge.com>
* All rights reserved. * All rights reserved.
* *
* This is free software; you can redistribute it and/or modify * This is free software; you can redistribute it and/or modify
......
This diff is collapsed.
...@@ -44,6 +44,7 @@ char *host2ip(char *host); ...@@ -44,6 +44,7 @@ char *host2ip(char *host);
char *raw2host(char *raw, int len); char *raw2host(char *raw, int len);
char *raw2ip(char *raw); char *raw2ip(char *raw);
char *ip2host(char *ip); char *ip2host(char *ip);
int ipv6_ip(char *host);
int dotted_ip(char *host); int dotted_ip(char *host);
int get_remote_port(int sock); int get_remote_port(int sock);
int get_local_port(int sock); int get_local_port(int sock);
...@@ -51,7 +52,13 @@ char *get_remote_host(int sock); ...@@ -51,7 +52,13 @@ char *get_remote_host(int sock);
char *get_local_host(int sock); char *get_local_host(int sock);
char *ident_username(rfbClientPtr client); char *ident_username(rfbClientPtr client);
int find_free_port(int start, int end); int find_free_port(int start, int end);
int find_free_port6(int start, int end);
int have_ssh_env(void); int have_ssh_env(void);
char *ipv6_getnameinfo(struct sockaddr *paddr, int addrlen);
char *ipv6_getipaddr(struct sockaddr *paddr, int addrlen);
int listen6(int port);
int connect_tcp(char *host, int port);
int listen_tcp(int port, in_addr_t iface, int try6);
static int get_port(int sock, int remote); static int get_port(int sock, int remote);
static char *get_host(int sock, int remote); static char *get_host(int sock, int remote);
...@@ -126,6 +133,43 @@ char *ip2host(char *ip) { ...@@ -126,6 +133,43 @@ char *ip2host(char *ip) {
return str; return str;
} }
int ipv6_ip(char *host_in) {
char *p, *host, a[2];
int ncol = 0, nhex = 0;
if (host_in[0] == '[') {
host = host_in + 1;
} else {
host = host_in;
}
if (strstr(host, "::ffff:") == host) {
return dotted_ip(host + strlen("::ffff:"));
}
a[1] = '\0';
p = host;
while (*p != '\0' && *p != '%' && *p != ']') {
if (*p == ':') {
ncol++;
} else {
nhex++;
}
a[0] = *p;
if (strpbrk(a, ":abcdef0123456789") == a) {
p++;
continue;
}
return 0;
}
if (ncol < 2 || ncol > 8 || nhex == 0) {
return 0;
} else {
return 1;
}
}
int dotted_ip(char *host) { int dotted_ip(char *host) {
char *p = host; char *p = host;
while (*p != '\0') { while (*p != '\0') {
...@@ -251,7 +295,7 @@ char *ident_username(rfbClientPtr client) { ...@@ -251,7 +295,7 @@ char *ident_username(rfbClientPtr client) {
signal(SIGQUIT, SIG_DFL); signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL); signal(SIGTERM, SIG_DFL);
if ((sock = rfbConnectToTcpAddr(client->host, 113)) < 0) { if ((sock = connect_tcp(client->host, 113)) < 0) {
exit(1); exit(1);
} else { } else {
close(sock); close(sock);
...@@ -262,7 +306,7 @@ char *ident_username(rfbClientPtr client) { ...@@ -262,7 +306,7 @@ char *ident_username(rfbClientPtr client) {
#endif #endif
if (block || refused) { if (block || refused) {
; ;
} else if ((sock = rfbConnectToTcpAddr(client->host, 113)) < 0) { } else if ((sock = connect_tcp(client->host, 113)) < 0) {
rfbLog("ident_username: could not connect to ident: %s:%d\n", rfbLog("ident_username: could not connect to ident: %s:%d\n",
client->host, 113); client->host, 113);
} else { } else {
...@@ -356,7 +400,25 @@ int find_free_port(int start, int end) { ...@@ -356,7 +400,25 @@ int find_free_port(int start, int end) {
end = 65530; end = 65530;
} }
for (port = start; port <= end; port++) { for (port = start; port <= end; port++) {
int sock = rfbListenOnTCPPort(port, htonl(INADDR_ANY)); int sock = listen_tcp(port, htonl(INADDR_ANY), 0);
if (sock >= 0) {
close(sock);
return port;
}
}
return 0;
}
int find_free_port6(int start, int end) {
int port;
if (start <= 0) {
start = 1024;
}
if (end <= 0) {
end = 65530;
}
for (port = start; port <= end; port++) {
int sock = listen6(port);
if (sock >= 0) { if (sock >= 0) {
close(sock); close(sock);
return port; return port;
...@@ -428,3 +490,262 @@ if (0) fprintf(stderr, "%d/%d - '%s' '%s'\n", atoi(rport), atoi(lport), rhost, l ...@@ -428,3 +490,262 @@ if (0) fprintf(stderr, "%d/%d - '%s' '%s'\n", atoi(rport), atoi(lport), rhost, l
return 0; return 0;
} }
char *ipv6_getnameinfo(struct sockaddr *paddr, int addrlen) {
#if X11VNC_IPV6
char name[200];
if (noipv6) {
return strdup("unknown");
}
if (getnameinfo(paddr, addrlen, name, sizeof(name), NULL, 0, 0) == 0) {
return strdup(name);
}
#endif
return strdup("unknown");
}
char *ipv6_getipaddr(struct sockaddr *paddr, int addrlen) {
#if X11VNC_IPV6
char name[200];
if (noipv6) {
return strdup("unknown");
}
if (getnameinfo(paddr, addrlen, name, sizeof(name), NULL, 0, NI_NUMERICHOST) == 0) {
return strdup(name);
}
#endif
return strdup("unknown");
}
int listen6(int port) {
#if X11VNC_IPV6
struct sockaddr_in6 sin;
int fd = -1, one = 1;
if (noipv6) {
return -1;
}
fd = socket(AF_INET6, SOCK_STREAM, 0);
if (fd < 0) {
rfbLogPerror("listen6: socket");
return -1;
}
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) < 0) {
rfbLogPerror("listen6: setsockopt1");
close(fd);
return -1;
}
#if defined(SOL_IPV6) && defined(IPV6_V6ONLY)
if (setsockopt(fd, SOL_IPV6, IPV6_V6ONLY, (char *)&one, sizeof(one)) < 0) {
rfbLogPerror("listen6: setsockopt2");
close(fd);
return -1;
}
#endif
memset((char *)&sin, 0, sizeof(sin));
sin.sin6_family = AF_INET6;
sin.sin6_port = htons(port);
sin.sin6_addr = in6addr_any;
if (listen_str6) {
if (!strcmp(listen_str6, "localhost")) {
sin.sin6_addr = in6addr_loopback;
} else if (ipv6_ip(listen_str6)) {
int err = inet_pton(AF_INET6, listen_str6, &(sin.sin6_addr));
if (err <= 0) {
rfbLog("inet_pton[%d] failed -listen6 %s\n", err, listen_str6);
close(fd);
return -1;
}
} else {
rfbLog("Unsupported -listen6 string: %s\n", listen_str6);
close(fd);
return -1;
}
} else if (allow_list && !strcmp(allow_list, "127.0.0.1")) {
sin.sin6_addr = in6addr_loopback;
} else if (listen_str) {
if (!strcmp(listen_str, "localhost")) {
sin.sin6_addr = in6addr_loopback;
}
}
if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
rfbLogPerror("listen6: bind");
close(fd);
return -1;
}
if (listen(fd, 32) < 0) {
rfbLogPerror("listen6: listen");
close(fd);
return -1;
}
return fd;
#else
if (port) {}
return -1;
#endif
}
int connect_tcp(char *host, int port) {
double t0 = dnow();
int fd = -1;
int fail4 = noipv4;
if (getenv("IPV4_FAILS")) {
fail4 = 2;
}
rfbLog("connect_tcp: trying: %s %d\n", host, port);
if (fail4) {
if (fail4 > 1) {
rfbLog("TESTING: IPV4_FAILS for connect_tcp.\n");
}
} else {
fd = rfbConnectToTcpAddr(host, port);
}
if (fd >= 0) {
return fd;
}
rfbLogPerror("connect_tcp: connection failed");
if (dnow() - t0 < 4.0) {
rfbLog("connect_tcp: re-trying %s %d\n", host, port);
usleep (100 * 1000);
if (!fail4) {
fd = rfbConnectToTcpAddr(host, port);
}
if (fd < 0) {
rfbLogPerror("connect_tcp: connection failed");
}
}
if (fd < 0 && !noipv6) {
#if X11VNC_IPV6 && defined(AI_ADDRCONFIG)
int err;
struct addrinfo *ai;
struct addrinfo hints;
char service[32], *host2, *q;
rfbLog("connect_tcp: trying IPv6 %s %d\n", host, port);
memset(&hints, 0, sizeof(hints));
sprintf(service, "%d", port);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ADDRCONFIG;
if(ipv6_ip(host)) {
#ifdef AI_NUMERICHOST
rfbLog("connect_tcp[ipv6]: setting AI_NUMERICHOST for %s\n", host);
hints.ai_flags |= AI_NUMERICHOST;
#else
rfbLog("connect_tcp[ipv6]: no AI_NUMERICHOST for %s\n", host);
#endif
}
#ifdef AI_NUMERICSERV
hints.ai_flags |= AI_NUMERICSERV;
#endif
if (!strcmp(host, "127.0.0.1")) {
host2 = strdup("::1");
} else if (host[0] == '[') {
host2 = strdup(host+1);
} else {
host2 = strdup(host);
}
q = strrchr(host2, ']');
if (q) {
*q = '\0';
}
err = getaddrinfo(host2, service, &hints, &ai);
if (err != 0) {
rfbLog("connect_tcp[ipv6]: getaddrinfo[%d]: %s\n", err, gai_strerror(err));
usleep(100 * 1000);
err = getaddrinfo(host2, service, &hints, &ai);
}
free(host2);
if (err != 0) {
rfbLog("connect_tcp[ipv6]: getaddrinfo[%d]: %s\n", err, gai_strerror(err));
} else {
struct addrinfo *ap = ai;
while (ap != NULL) {
int sock = socket(ap->ai_family, ap->ai_socktype, ap->ai_protocol);
if (sock == -1) {
rfbLogPerror("connect_tcp[ipv6]: socket");
} else {
char *s = ipv6_getipaddr(ap->ai_addr, ap->ai_addrlen);
if (!s) s = strdup("unknown");
rfbLog("connect_tcp[ipv6]: trying sock=%d using %s\n", sock, s);
if (connect(sock, ap->ai_addr, ap->ai_addrlen) == 0) {
rfbLog("connect_tcp[ipv6]: connect OK\n");
fd = sock;
if (!ipv6_client_ip_str) {
ipv6_client_ip_str = strdup(s);
}
free(s);
break;
} else {
close(sock);
rfbLogPerror("connect_tcp[ipv6]: connect");
}
free(s);
}
ap = ap->ai_next;
}
freeaddrinfo(ai);
}
#endif
}
return fd;
}
int listen_tcp(int port, in_addr_t iface, int try6) {
int fd = -1;
int fail4 = noipv4;
if (getenv("IPV4_FAILS")) {
fail4 = 2;
}
if (fail4) {
if (fail4 > 1) {
rfbLog("TESTING: IPV4_FAILS for listen_tcp: port=%d try6=%d\n", port, try6);
}
} else {
fd = rfbListenOnTCPPort(port, iface);
}
if (fd >= 0) {
return fd;
}
if (fail4 > 1) {
rfbLogPerror("listen_tcp: listen failed");
}
if (fd < 0 && try6 && ipv6_listen && !noipv6) {
#if X11VNC_IPV6
char *save = listen_str6;
if (iface == htonl(INADDR_LOOPBACK)) {
listen_str6 = "localhost";
rfbLog("listen_tcp: retrying on IPv6 in6addr_loopback ...\n");
fd = listen6(port);
} else if (iface == htonl(INADDR_ANY)) {
listen_str6 = NULL;
rfbLog("listen_tcp: retrying on IPv6 in6addr_any ...\n");
fd = listen6(port);
}
listen_str6 = save;
#else
if (try6) {}
#endif
}
return fd;
}
...@@ -39,6 +39,7 @@ extern char *host2ip(char *host); ...@@ -39,6 +39,7 @@ extern char *host2ip(char *host);
extern char *raw2host(char *raw, int len); extern char *raw2host(char *raw, int len);
extern char *raw2ip(char *raw); extern char *raw2ip(char *raw);
extern char *ip2host(char *ip); extern char *ip2host(char *ip);
extern int ipv6_ip(char *host);
extern int dotted_ip(char *host); extern int dotted_ip(char *host);
extern int get_remote_port(int sock); extern int get_remote_port(int sock);
extern int get_local_port(int sock); extern int get_local_port(int sock);
...@@ -46,6 +47,12 @@ extern char *get_remote_host(int sock); ...@@ -46,6 +47,12 @@ extern char *get_remote_host(int sock);
extern char *get_local_host(int sock); extern char *get_local_host(int sock);
extern char *ident_username(rfbClientPtr client); extern char *ident_username(rfbClientPtr client);
extern int find_free_port(int start, int end); extern int find_free_port(int start, int end);
extern int find_free_port6(int start, int end);
extern int have_ssh_env(void); extern int have_ssh_env(void);
extern char *ipv6_getnameinfo(struct sockaddr *paddr, int addrlen);
extern char *ipv6_getipaddr(struct sockaddr *paddr, int addrlen);
extern int listen6(int port);
extern int connect_tcp(char *host, int port);
extern int listen_tcp(int port, in_addr_t iface, int try6);
#endif /* _X11VNC_INET_H */ #endif /* _X11VNC_INET_H */
...@@ -134,10 +134,21 @@ int no_external_cmds = 1; /* cannot be turned back on. */ ...@@ -134,10 +134,21 @@ int no_external_cmds = 1; /* cannot be turned back on. */
char *allowed_external_cmds = NULL; char *allowed_external_cmds = NULL;
int started_as_root = 0; int started_as_root = 0;
int host_lookup = 1; int host_lookup = 1;
#ifndef X11VNC_LISTEN6
int ipv6_listen = 0; /* -6 */
#else
int ipv6_listen = 1;
#endif
int ipv6_listen_fd = -1;
int ipv6_http_fd = -1;
int noipv6 = 0;
int noipv4 = 0;
char *ipv6_client_ip_str = NULL;
char *users_list = NULL; /* -users */ char *users_list = NULL; /* -users */
char **user2group = NULL; char **user2group = NULL;
char *allow_list = NULL; /* for -allow and -localhost */ char *allow_list = NULL; /* for -allow and -localhost */
char *listen_str = NULL; char *listen_str = NULL;
char *listen_str6 = NULL;
char *allow_once = NULL; /* one time -allow */ char *allow_once = NULL; /* one time -allow */
char *accept_cmd = NULL; /* for -accept */ char *accept_cmd = NULL; /* for -accept */
char *afteraccept_cmd = NULL; /* for -afteraccept */ char *afteraccept_cmd = NULL; /* for -afteraccept */
...@@ -426,6 +437,7 @@ int napfac = 4; /* time = napfac*waitms, cut load with extra waits */ ...@@ -426,6 +437,7 @@ int napfac = 4; /* time = napfac*waitms, cut load with extra waits */
int napmax = 1500; /* longest nap in ms. */ int napmax = 1500; /* longest nap in ms. */
int ui_skip = 10; /* see watchloop. negative means ignore input */ int ui_skip = 10; /* see watchloop. negative means ignore input */
int all_input = 0; int all_input = 0;
int handle_events_eagerly = 0;
#if LIBVNCSERVER_HAVE_FBPM #if LIBVNCSERVER_HAVE_FBPM
......
...@@ -115,10 +115,17 @@ extern int no_external_cmds; ...@@ -115,10 +115,17 @@ extern int no_external_cmds;
extern char *allowed_external_cmds; extern char *allowed_external_cmds;
extern int started_as_root; extern int started_as_root;
extern int host_lookup; extern int host_lookup;
extern int ipv6_listen;
extern int ipv6_listen_fd;
extern int ipv6_http_fd;
extern int noipv6;
extern int noipv4;
extern char *ipv6_client_ip_str;
extern char *users_list; extern char *users_list;
extern char **user2group; extern char **user2group;
extern char *allow_list; extern char *allow_list;
extern char *listen_str; extern char *listen_str;
extern char *listen_str6;
extern char *allow_once; extern char *allow_once;
extern char *accept_cmd; extern char *accept_cmd;
extern char *afteraccept_cmd; extern char *afteraccept_cmd;
...@@ -331,6 +338,7 @@ extern int napfac; ...@@ -331,6 +338,7 @@ extern int napfac;
extern int napmax; extern int napmax;
extern int ui_skip; extern int ui_skip;
extern int all_input; extern int all_input;
extern int handle_events_eagerly;
extern int watch_fbpm; extern int watch_fbpm;
extern int watch_dpms; extern int watch_dpms;
......
This diff is collapsed.
...@@ -1421,7 +1421,7 @@ char *vnc_reflect_guess(char *str, char **raw_fb_addr) { ...@@ -1421,7 +1421,7 @@ char *vnc_reflect_guess(char *str, char **raw_fb_addr) {
if (first) { if (first) {
argv[argc++] = "x11vnc_rawfb_vnc"; argv[argc++] = "x11vnc_rawfb_vnc";
if (strstr(hp, "listen") == hp) { if (strstr(hp, "listen") == hp) {
char *q = strchr(hp, ':'); char *q = strrchr(hp, ':');
argv[argc++] = strdup("-listen"); argv[argc++] = strdup("-listen");
if (q) { if (q) {
client->listenPort = atoi(q+1); client->listenPort = atoi(q+1);
...@@ -3589,12 +3589,54 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { ...@@ -3589,12 +3589,54 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
defer_update = screen->deferUpdateTime; 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) { if (use_openssl) {
openssl_port(); openssl_port(0);
if (https_port_num >= 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) { ...@@ -3717,7 +3759,8 @@ void do_announce_http(void) {
return; 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")); int enc_none = (enc_str && !strcmp(enc_str, "none"));
char *SPORT = " (single port)"; char *SPORT = " (single port)";
if (use_openssl && ! enc_none) { if (use_openssl && ! enc_none) {
...@@ -3752,6 +3795,7 @@ void do_announce_http(void) { ...@@ -3752,6 +3795,7 @@ void do_announce_http(void) {
void do_mention_java_urls(void) { void do_mention_java_urls(void) {
if (! quiet && screen) { if (! quiet && screen) {
/* XXX ipv6? */
if (screen->httpListenSock > -1 && screen->httpPort) { if (screen->httpListenSock > -1 && screen->httpPort) {
rfbLog("\n"); rfbLog("\n");
rfbLog("The URLs printed out below ('Java ... viewer URL') can\n"); rfbLog("The URLs printed out below ('Java ... viewer URL') can\n");
......
...@@ -114,7 +114,7 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport ...@@ -114,7 +114,7 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
strcat(path, extra); strcat(path, extra);
} }
exe = (char *) malloc(strlen(path) + 1 + strlen("stunnel") + 1); exe = (char *) malloc(strlen(path) + 1 + strlen("stunnel4") + 1);
p = strtok(path, ":"); p = strtok(path, ":");
...@@ -123,6 +123,14 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport ...@@ -123,6 +123,14 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
while (p) { while (p) {
struct stat sbuf; struct stat sbuf;
sprintf(exe, "%s/%s", p, "stunnel4");
if (! stunnel_path && stat(exe, &sbuf) == 0) {
if (! S_ISDIR(sbuf.st_mode)) {
stunnel_path = exe;
break;
}
}
sprintf(exe, "%s/%s", p, "stunnel"); sprintf(exe, "%s/%s", p, "stunnel");
if (! stunnel_path && stat(exe, &sbuf) == 0) { if (! stunnel_path && stat(exe, &sbuf) == 0) {
if (! S_ISDIR(sbuf.st_mode)) { if (! S_ISDIR(sbuf.st_mode)) {
...@@ -137,6 +145,12 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport ...@@ -137,6 +145,12 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
free(path); free(path);
} }
if (getenv("STUNNEL_PROG")) {
free(exe);
exe = strdup(getenv("STUNNEL_PROG"));
stunnel_path = exe;
}
if (! stunnel_path) { if (! stunnel_path) {
free(exe); free(exe);
return 0; return 0;
...@@ -219,6 +233,15 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport ...@@ -219,6 +233,15 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
FILE *in; FILE *in;
char fd[20]; char fd[20];
int i; int i;
char *st_if = getenv("STUNNEL_LISTEN");
if (st_if == NULL) {
st_if = "";
} else {
st_if = (char *) malloc(strlen(st_if) + 2);
sprintf(st_if, "%s:", getenv("STUNNEL_LISTEN"));
}
for (i=3; i<256; i++) { for (i=3; i<256; i++) {
close(i); close(i);
...@@ -293,12 +316,12 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport ...@@ -293,12 +316,12 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
} }
fprintf(in, ";debug = 7\n\n"); fprintf(in, ";debug = 7\n\n");
fprintf(in, "[x11vnc_stunnel]\n"); fprintf(in, "[x11vnc_stunnel]\n");
fprintf(in, "accept = %d\n", stunnel_port); fprintf(in, "accept = %s%d\n", st_if, stunnel_port);
fprintf(in, "connect = %d\n", x11vnc_port); fprintf(in, "connect = %d\n", x11vnc_port);
if (hport > 0 && x11vnc_hport > 0) { if (hport > 0 && x11vnc_hport > 0) {
fprintf(in, "\n[x11vnc_http]\n"); fprintf(in, "\n[x11vnc_http]\n");
fprintf(in, "accept = %d\n", hport); fprintf(in, "accept = %s%d\n", st_if, hport);
fprintf(in, "connect = %d\n", x11vnc_hport); fprintf(in, "connect = %d\n", x11vnc_hport);
} }
......
This diff is collapsed.
...@@ -38,12 +38,16 @@ so, delete this exception statement from your version. ...@@ -38,12 +38,16 @@ so, delete this exception statement from your version.
#define OPENSSL_INETD 1 #define OPENSSL_INETD 1
#define OPENSSL_VNC 2 #define OPENSSL_VNC 2
#define OPENSSL_HTTPS 3 #define OPENSSL_VNC6 3
#define OPENSSL_REVERSE 4 #define OPENSSL_HTTPS 4
#define OPENSSL_HTTPS6 5
#define OPENSSL_REVERSE 6
extern int openssl_sock; extern int openssl_sock;
extern int openssl_sock6;
extern int openssl_port_num; extern int openssl_port_num;
extern int https_sock; extern int https_sock;
extern int https_sock6;
extern pid_t openssl_last_helper_pid; extern pid_t openssl_last_helper_pid;
extern char *openssl_last_ip; extern char *openssl_last_ip;
extern char *certret_str; extern char *certret_str;
...@@ -54,8 +58,8 @@ extern void raw_xfer(int csock, int s_in, int s_out); ...@@ -54,8 +58,8 @@ extern void raw_xfer(int csock, int s_in, int s_out);
extern int openssl_present(void); extern int openssl_present(void);
extern void openssl_init(int); extern void openssl_init(int);
extern void openssl_port(void); extern void openssl_port(int);
extern void https_port(void); extern void https_port(int);
extern void check_openssl(void); extern void check_openssl(void);
extern void check_https(void); extern void check_https(void);
extern void ssl_helper_pid(pid_t pid, int sock); extern void ssl_helper_pid(pid_t pid, int sock);
......
...@@ -789,6 +789,7 @@ char find_display[] = ...@@ -789,6 +789,7 @@ char find_display[] =
" exit 1\n" " exit 1\n"
"fi\n" "fi\n"
"\n" "\n"
"# Set PATH to pick up utilities we use below.\n"
"PATH=$PATH:/bin:/usr/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/ucb\n" "PATH=$PATH:/bin:/usr/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/ucb\n"
"export PATH\n" "export PATH\n"
"\n" "\n"
...@@ -1823,6 +1824,10 @@ char create_display[] = ...@@ -1823,6 +1824,10 @@ char create_display[] =
" chmod 755 $stmp || exit 1\n" " chmod 755 $stmp || exit 1\n"
" echo \"#!/bin/sh\" > $stmp\n" " echo \"#!/bin/sh\" > $stmp\n"
" #echo \"(id; env; env | grep XAUTHORITY | sed -e 's/XAUTHORITY=//' | xargs ls -l) > /tmp/ENV.OUT.$$\" >> $stmp\n" " #echo \"(id; env; env | grep XAUTHORITY | sed -e 's/XAUTHORITY=//' | xargs ls -l) > /tmp/ENV.OUT.$$\" >> $stmp\n"
" if [ \"X$SAVE_PATH\" != \"X\" ]; then\n"
" echo \"PATH=\\\"$SAVE_PATH\\\"\" >> $stmp\n"
" echo \"export PATH\" >> $stmp\n"
" fi\n"
" if [ \"X$noxauth\" = \"X1\" ]; then\n" " if [ \"X$noxauth\" = \"X1\" ]; then\n"
" echo \"unset XAUTHORITY\" >> $stmp\n" " echo \"unset XAUTHORITY\" >> $stmp\n"
" fi\n" " fi\n"
...@@ -1971,25 +1976,6 @@ char create_display[] = ...@@ -1971,25 +1976,6 @@ char create_display[] =
" fi\n" " fi\n"
" done\n" " done\n"
"\n" "\n"
"# if [ \"X$result\" = \"X1\" ]; then\n"
"# if [ \"X$use_xdmcp_query\" = \"X0\" -a \"X$have_xdpyinfo\" != \"X\" ]; then\n"
"# ok=0\n"
"# for t in 1 2 3 4\n"
"# do\n"
"# $have_xdpyinfo >/dev/null 2>&1\n"
"# if [ $? != 0 ]; then\n"
"# sleep 1\n"
"# else\n"
"# ok=1\n"
"# break;\n"
"# fi\n"
"# done\n"
"# if [ \"X$ok\" = \"X0\" ]; then\n"
"# result=0\n"
"# fi\n"
"# fi\n"
"# fi\n"
"\n"
" if [ \"X$redir_daemon\" != \"X\" -a \"X$result\" = \"X1\" ]; then\n" " if [ \"X$redir_daemon\" != \"X\" -a \"X$result\" = \"X1\" ]; then\n"
" redir_daemon=`echo \"$redir_daemon\" | sed -e 's/[~!$&*()|;?<>\"]//g' -e \"s/'//g\"`\n" " redir_daemon=`echo \"$redir_daemon\" | sed -e 's/[~!$&*()|;?<>\"]//g' -e \"s/'//g\"`\n"
" xprog=$X11VNC_PROG\n" " xprog=$X11VNC_PROG\n"
...@@ -2276,6 +2262,8 @@ char create_display[] = ...@@ -2276,6 +2262,8 @@ char create_display[] =
" USER=`whoami`\n" " USER=`whoami`\n"
"fi\n" "fi\n"
"\n" "\n"
"# Set PATH to have a better chance of finding things:\n"
"SAVE_PATH=$PATH\n"
"PATH=$PATH:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/dt/bin:/opt/kde4/bin:/opt/kde3/bin:/opt/gnome/bin:/usr/bin:/bin:/usr/sfw/bin:/usr/local/bin\n" "PATH=$PATH:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/dt/bin:/opt/kde4/bin:/opt/kde3/bin:/opt/gnome/bin:/usr/bin:/bin:/usr/sfw/bin:/usr/local/bin\n"
"\n" "\n"
"have_root=\"\"\n" "have_root=\"\"\n"
......
...@@ -268,6 +268,10 @@ Misc ...@@ -268,6 +268,10 @@ Misc
macmenu macmenu
=GAL LOFF =GAL LOFF
-- --
6
noipv6
noipv4
--
nofb nofb
=D nobell =D nobell
nolookup nolookup
...@@ -2754,6 +2758,7 @@ proc update_menu_vars {{query ""}} { ...@@ -2754,6 +2758,7 @@ proc update_menu_vars {{query ""}} {
set x11vnc_icon_mode 1 set x11vnc_icon_mode 1
#puts stderr "x11vnc_icon_mode: $x11vnc_icon_mode" #puts stderr "x11vnc_icon_mode: $x11vnc_icon_mode"
} }
# XXX ipv6
if {[regexp {^([^:][^:]*):(.*)$} $piece m0 item val]} { if {[regexp {^([^:][^:]*):(.*)$} $piece m0 item val]} {
if {[info exists menu_var($item)]} { if {[info exists menu_var($item)]} {
set old $menu_var($item) set old $menu_var($item)
......
...@@ -279,6 +279,10 @@ char gui_code[] = ""; ...@@ -279,6 +279,10 @@ char gui_code[] = "";
" macmenu\n" " macmenu\n"
" =GAL LOFF\n" " =GAL LOFF\n"
" --\n" " --\n"
" 6\n"
" noipv6\n"
" noipv4\n"
" --\n"
" nofb\n" " nofb\n"
" =D nobell\n" " =D nobell\n"
" nolookup\n" " nolookup\n"
...@@ -2765,6 +2769,7 @@ char gui_code[] = ""; ...@@ -2765,6 +2769,7 @@ char gui_code[] = "";
" set x11vnc_icon_mode 1\n" " set x11vnc_icon_mode 1\n"
" #puts stderr \"x11vnc_icon_mode: $x11vnc_icon_mode\"\n" " #puts stderr \"x11vnc_icon_mode: $x11vnc_icon_mode\"\n"
" }\n" " }\n"
" # XXX ipv6\n"
" if {[regexp {^([^:][^:]*):(.*)$} $piece m0 item val]} {\n" " if {[regexp {^([^:][^:]*):(.*)$} $piece m0 item val]} {\n"
" if {[info exists menu_var($item)]} {\n" " if {[info exists menu_var($item)]} {\n"
" set old $menu_var($item)\n" " set old $menu_var($item)\n"
......
...@@ -1180,9 +1180,11 @@ static void handle_one_http_request(void) { ...@@ -1180,9 +1180,11 @@ static void handle_one_http_request(void) {
screen->port = 0; screen->port = 0;
http_connections(1); http_connections(1);
rfbInitServer(screen); rfbInitServer(screen);
if (!inetd) { if (!inetd) {
/* XXX ipv6 */
int conn = 0; int conn = 0;
while (1) { while (1) {
if (0) fprintf(stderr, "%d %d %d %d\n", conn, screen->listenSock, screen->httpSock, screen->httpListenSock); if (0) fprintf(stderr, "%d %d %d %d\n", conn, screen->listenSock, screen->httpSock, screen->httpListenSock);
...@@ -1234,8 +1236,7 @@ static void handle_one_http_request(void) { ...@@ -1234,8 +1236,7 @@ static void handle_one_http_request(void) {
rfbLog("handle_one_http_request: finished.\n"); rfbLog("handle_one_http_request: finished.\n");
return; return;
} else { } else {
int sock = rfbConnectToTcpAddr("127.0.0.1", int sock = connect_tcp("127.0.0.1", screen->httpPort);
screen->httpPort);
if (sock < 0) { if (sock < 0) {
exit(1); exit(1);
} }
...@@ -1703,6 +1704,7 @@ static void vnc_redirect_loop(char *vnc_redirect_test, int *vnc_redirect_cnt) { ...@@ -1703,6 +1704,7 @@ static void vnc_redirect_loop(char *vnc_redirect_test, int *vnc_redirect_cnt) {
} }
} else { } else {
pid_t pid = 0; pid_t pid = 0;
/* XXX ipv6 */
if (screen->httpListenSock >= 0) { if (screen->httpListenSock >= 0) {
#if LIBVNCSERVER_HAVE_FORK #if LIBVNCSERVER_HAVE_FORK
if ((pid = fork()) > 0) { if ((pid = fork()) > 0) {
...@@ -1817,7 +1819,7 @@ static void vnc_redirect_loop(char *vnc_redirect_test, int *vnc_redirect_cnt) { ...@@ -1817,7 +1819,7 @@ static void vnc_redirect_loop(char *vnc_redirect_test, int *vnc_redirect_cnt) {
static void do_vnc_redirect(int created_disp, char *vnc_redirect_host, int vnc_redirect_port, static void do_vnc_redirect(int created_disp, char *vnc_redirect_host, int vnc_redirect_port,
int vnc_redirect_cnt, char *vnc_redirect_test) { int vnc_redirect_cnt, char *vnc_redirect_test) {
char *q = strchr(use_dpy, ':'); char *q = strrchr(use_dpy, ':');
int vdpy = -1, sock = -1; int vdpy = -1, sock = -1;
int s_in, s_out, i; int s_in, s_out, i;
if (vnc_redirect == 2) { if (vnc_redirect == 2) {
...@@ -1850,7 +1852,7 @@ static void do_vnc_redirect(int created_disp, char *vnc_redirect_host, int vnc_r ...@@ -1850,7 +1852,7 @@ static void do_vnc_redirect(int created_disp, char *vnc_redirect_host, int vnc_r
usleep(1000*1000); usleep(1000*1000);
} }
for (i=0; i < 20; i++) { for (i=0; i < 20; i++) {
sock = rfbConnectToTcpAddr(vnc_redirect_host, vdpy); sock = connect_tcp(vnc_redirect_host, vdpy);
if (sock >= 0) { if (sock >= 0) {
break; break;
} }
...@@ -2993,9 +2995,14 @@ int wait_for_client(int *argc, char** argv, int http) { ...@@ -2993,9 +2995,14 @@ int wait_for_client(int *argc, char** argv, int http) {
if (! screen->port || screen->listenSock < 0) { if (! screen->port || screen->listenSock < 0) {
if (got_rfbport && got_rfbport_val == 0) { if (got_rfbport && got_rfbport_val == 0) {
; ;
} else if (ipv6_listen && ipv6_listen_fd >= 0) {
rfbLog("Info: listening only on IPv6 interface.\n");
} else { } else {
rfbLogEnable(1); rfbLogEnable(1);
rfbLog("Error: could not obtain listening port.\n"); rfbLog("Error: could not obtain listening port.\n");
if (!got_rfbport) {
rfbLog("If this system is IPv6-only, use the -6 option.\n");
}
clean_up_exit(1); clean_up_exit(1);
} }
} }
......
...@@ -495,7 +495,7 @@ void check_allinput_rate(void) { ...@@ -495,7 +495,7 @@ void check_allinput_rate(void) {
if (verb) rfbLog("check_allinput_rate:\n"); if (verb) rfbLog("check_allinput_rate:\n");
if (verb) rfbLog("Client is sending %.1f extra requests per second for the\n", rate); if (verb) rfbLog("Client is sending %.1f extra requests per second for the\n", rate);
if (verb) rfbLog("past %d seconds! (queued: %d)\n", dt, nq); if (verb) rfbLog("past %d seconds! (queued: %d)\n", dt, nq);
if (strstr(getenv("CHECK_RATE"), "allinput") && !all_input) { if (strstr(getenv("CHECK_RATE"), "allinput") && !all_input && !handle_events_eagerly) {
rfbLog("Switching to -allpinput mode.\n"); rfbLog("Switching to -allpinput mode.\n");
all_input = 1; all_input = 1;
} }
...@@ -590,6 +590,9 @@ int rfbPE(long usec) { ...@@ -590,6 +590,9 @@ int rfbPE(long usec) {
} }
} }
if (ipv6_listen) {
check_ipv6_listen(usec);
}
if (check_rate != 0) { if (check_rate != 0) {
if (check_rate < 0) { if (check_rate < 0) {
if (getenv("CHECK_RATE")) { if (getenv("CHECK_RATE")) {
...@@ -643,8 +646,7 @@ void rfbCFD(long usec) { ...@@ -643,8 +646,7 @@ void rfbCFD(long usec) {
if (all_input) { if (all_input) {
do_allinput(usec); do_allinput(usec);
} else { } else {
/* XXX how for cmdline? */ if (handle_events_eagerly) {
if (all_input) {
screen->handleEventsEagerly = TRUE; screen->handleEventsEagerly = TRUE;
} else { } else {
screen->handleEventsEagerly = FALSE; screen->handleEventsEagerly = FALSE;
......
This diff is collapsed.
/* /*
* x11vnc: a VNC server for X displays. * x11vnc: a VNC server for X displays.
* *
* Copyright (C) 2002-2009 Karl J. Runge <runge@karlrunge.com> * Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com>
* All rights reserved. * All rights reserved.
* *
* This file is part of x11vnc. * This file is part of x11vnc.
...@@ -216,9 +216,9 @@ int tsdo(int port, int lsock, int *conn) { ...@@ -216,9 +216,9 @@ int tsdo(int port, int lsock, int *conn) {
if (db) rfbLog("tsdo: using existing csock: %d, port: %d\n", csock, port); if (db) rfbLog("tsdo: using existing csock: %d, port: %d\n", csock, port);
} }
rsock = rfbConnectToTcpAddr("127.0.0.1", port); rsock = connect_tcp("127.0.0.1", port);
if (rsock < 0) { if (rsock < 0) {
if (db) rfbLog("tsdo: rfbConnectToTcpAddr(port=%d) failed.\n", port); if (db) rfbLog("tsdo: connect_tcp(port=%d) failed.\n", port);
close(csock); close(csock);
return 2; return 2;
} }
...@@ -391,7 +391,8 @@ void terminal_services(char *list) { ...@@ -391,7 +391,8 @@ void terminal_services(char *list) {
XSync(dpy, False); XSync(dpy, False);
for (k=1; k <= 5; k++) { for (k=1; k <= 5; k++) {
socks[i] = rfbListenOnTCPPort(listen[i], htonl(INADDR_LOOPBACK)); /* XXX ::1 fallback? */
socks[i] = listen_tcp(listen[i], htonl(INADDR_LOOPBACK), 1);
if (socks[i] >= 0) { if (socks[i] >= 0) {
if (db) fprintf(stderr, " listen succeeded: %d\n", listen[i]); if (db) fprintf(stderr, " listen succeeded: %d\n", listen[i]);
break; break;
...@@ -601,7 +602,7 @@ if (tstk[j] != 0) fprintf(stderr, "B redir[%d][%d] = %d %s\n", i, j, tstk[j], t ...@@ -601,7 +602,7 @@ if (tstk[j] != 0) fprintf(stderr, "B redir[%d][%d] = %d %s\n", i, j, tstk[j], t
redir[i][j] = 0; redir[i][j] = 0;
continue; continue;
} }
s = rfbConnectToTcpAddr("127.0.0.1", p); s = connect_tcp("127.0.0.1", p);
if (s < 0) { if (s < 0) {
redir[i][j] = 0; redir[i][j] = 0;
if (db) fprintf(stderr, "tsdo[%d][%d] clean: connect failed: %d\n", i, j, p); if (db) fprintf(stderr, "tsdo[%d][%d] clean: connect failed: %d\n", i, j, p);
...@@ -646,6 +647,7 @@ void do_tsd(void) { ...@@ -646,6 +647,7 @@ void do_tsd(void) {
char *cmd; char *cmd;
int n, sz = 0; int n, sz = 0;
char *disp = DisplayString(dpy); char *disp = DisplayString(dpy);
char *logfile = getenv("TS_REDIR_LOGFILE");
int db = 0; int db = 0;
if (getenv("TS_REDIR_DEBUG")) { if (getenv("TS_REDIR_DEBUG")) {
...@@ -675,6 +677,12 @@ void do_tsd(void) { ...@@ -675,6 +677,12 @@ void do_tsd(void) {
sz += strlen("-env TSD_RESTART=1") + 1; sz += strlen("-env TSD_RESTART=1") + 1;
sz += strlen("</dev/null 1>/dev/null 2>&1") + 1; sz += strlen("</dev/null 1>/dev/null 2>&1") + 1;
sz += strlen(" &") + 1; sz += strlen(" &") + 1;
if (logfile) {
sz += strlen(logfile);
}
if (ipv6_listen) {
sz += strlen("-6") + 1;
}
cmd = (char *) malloc(sz); cmd = (char *) malloc(sz);
...@@ -684,7 +692,9 @@ void do_tsd(void) { ...@@ -684,7 +692,9 @@ void do_tsd(void) {
*(xauth-2) = '_'; /* yow */ *(xauth-2) = '_'; /* yow */
} }
} }
sprintf(cmd, "%s -display %s -tsd '%s' -env TSD_RESTART=1 </dev/null 1>/dev/null 2>&1 &", program_name, disp, prop); sprintf(cmd, "%s -display %s -tsd '%s' -env TSD_RESTART=1 %s </dev/null 1>%s 2>&1 &",
program_name, disp, prop, ipv6_listen ? "-6" : "",
logfile ? logfile : "/dev/null" );
rfbLog("running: %s\n", cmd); rfbLog("running: %s\n", cmd);
#if LIBVNCSERVER_HAVE_FORK && LIBVNCSERVER_HAVE_SETSID #if LIBVNCSERVER_HAVE_FORK && LIBVNCSERVER_HAVE_SETSID
...@@ -2511,10 +2521,32 @@ int main(int argc, char* argv[]) { ...@@ -2511,10 +2521,32 @@ int main(int argc, char* argv[]) {
got_localhost = 1; got_localhost = 1;
continue; continue;
} }
if (!strcmp(arg, "-listen6")) {
listen_str6 = strdup(argv[++i]);
continue;
}
if (!strcmp(arg, "-nolookup")) { if (!strcmp(arg, "-nolookup")) {
host_lookup = 0; host_lookup = 0;
continue; continue;
} }
#if X11VNC_IPV6
if (!strcmp(arg, "-6")) {
ipv6_listen = 1;
continue;
}
if (!strcmp(arg, "-no6")) {
ipv6_listen = 0;
continue;
}
if (!strcmp(arg, "-noipv6")) {
noipv6 = 1;
continue;
}
if (!strcmp(arg, "-noipv4")) {
noipv4 = 1;
continue;
}
#endif
if (!strcmp(arg, "-input")) { if (!strcmp(arg, "-input")) {
CHECK_ARGC CHECK_ARGC
allowed_input_str = strdup(argv[++i]); allowed_input_str = strdup(argv[++i]);
...@@ -3558,6 +3590,14 @@ int main(int argc, char* argv[]) { ...@@ -3558,6 +3590,14 @@ int main(int argc, char* argv[]) {
all_input = 0; all_input = 0;
continue; continue;
} }
if (!strcmp(arg, "-input_eagerly")) {
handle_events_eagerly = 1;
continue;
}
if (!strcmp(arg, "-noinput_eagerly")) {
handle_events_eagerly = 0;
continue;
}
if (!strcmp(arg, "-speeds")) { if (!strcmp(arg, "-speeds")) {
CHECK_ARGC CHECK_ARGC
speeds_str = strdup(argv[++i]); speeds_str = strdup(argv[++i]);
...@@ -4311,6 +4351,11 @@ int main(int argc, char* argv[]) { ...@@ -4311,6 +4351,11 @@ int main(int argc, char* argv[]) {
close(n); close(n);
} }
} }
if (ipv6_listen) {
if (inetd) {
ipv6_listen = 0;
}
}
if (inetd && quiet && !logfile) { if (inetd && quiet && !logfile) {
int n; int n;
/* /*
...@@ -5735,9 +5780,14 @@ int main(int argc, char* argv[]) { ...@@ -5735,9 +5780,14 @@ int main(int argc, char* argv[]) {
if (! screen->port || screen->listenSock < 0) { if (! screen->port || screen->listenSock < 0) {
if (got_rfbport && got_rfbport_val == 0) { if (got_rfbport && got_rfbport_val == 0) {
; ;
} else if (ipv6_listen && ipv6_listen_fd >= 0) {
rfbLog("Info: listening only on IPv6 interface.\n");
} else { } else {
rfbLogEnable(1); rfbLogEnable(1);
rfbLog("Error: could not obtain listening port.\n"); rfbLog("Error: could not obtain listening port.\n");
if (!got_rfbport) {
rfbLog("If this system is IPv6-only, use the -6 option.\n");
}
clean_up_exit(1); clean_up_exit(1);
} }
} }
...@@ -5776,7 +5826,6 @@ int main(int argc, char* argv[]) { ...@@ -5776,7 +5826,6 @@ int main(int argc, char* argv[]) {
} }
if (screen && screen->httpListenSock >= 0) { if (screen && screen->httpListenSock >= 0) {
close(screen->httpListenSock); close(screen->httpListenSock);
FD_CLR(screen->httpListenSock,&screen->allFds);
screen->httpListenSock = -1; screen->httpListenSock = -1;
} }
if (openssl_sock >= 0) { if (openssl_sock >= 0) {
...@@ -5787,6 +5836,22 @@ int main(int argc, char* argv[]) { ...@@ -5787,6 +5836,22 @@ int main(int argc, char* argv[]) {
close(https_sock); close(https_sock);
https_sock = -1; https_sock = -1;
} }
if (openssl_sock6 >= 0) {
close(openssl_sock6);
openssl_sock6 = -1;
}
if (https_sock6 >= 0) {
close(https_sock6);
https_sock6 = -1;
}
if (ipv6_listen_fd >= 0) {
close(ipv6_listen_fd);
ipv6_listen_fd = -1;
}
if (ipv6_http_fd >= 0) {
close(ipv6_http_fd);
ipv6_http_fd = -1;
}
} }
/* fork into the background now */ /* fork into the background now */
if ((p = fork()) > 0) { if ((p = fork()) > 0) {
......
...@@ -316,6 +316,14 @@ extern int h_errno; ...@@ -316,6 +316,14 @@ extern int h_errno;
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#ifndef X11VNC_IPV6
#if defined(AF_INET6) || defined(PF_INET6)
#define X11VNC_IPV6 1
#else
#define X11VNC_IPV6 0
#endif
#endif
#if LIBVNCSERVER_HAVE_PWD_H #if LIBVNCSERVER_HAVE_PWD_H
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
......
...@@ -47,7 +47,7 @@ int xtrap_base_event_type = 0; ...@@ -47,7 +47,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.10 lastmod: 2010-03-20"; char lastmod[] = "0.9.10 lastmod: 2010-04-08";
/* X display info */ /* X display info */
......
...@@ -50,6 +50,7 @@ so, delete this exception statement from your version. ...@@ -50,6 +50,7 @@ so, delete this exception statement from your version.
#include "pm.h" #include "pm.h"
#include "pointer.h" #include "pointer.h"
#include "remote.h" #include "remote.h"
#include "inet.h"
/* XXX CHECK BEFORE RELEASE */ /* XXX CHECK BEFORE RELEASE */
int grab_buster = 0; int grab_buster = 0;
...@@ -1962,7 +1963,8 @@ static void try_local_chat_window(void) { ...@@ -1962,7 +1963,8 @@ static void try_local_chat_window(void) {
for (i = 0; i < 90; i++) { for (i = 0; i < 90; i++) {
/* find an open port */ /* find an open port */
port = 7300 + i; port = 7300 + i;
lsock = rfbListenOnTCPPort(port, htonl(INADDR_LOOPBACK)); /* XXX ::1 fallback */
lsock = listen_tcp(port, htonl(INADDR_LOOPBACK), 0);
if (lsock >= 0) { if (lsock >= 0) {
break; break;
} }
......
...@@ -331,9 +331,11 @@ void check_xinerama_clip(void) { ...@@ -331,9 +331,11 @@ void check_xinerama_clip(void) {
static void initialize_xinerama (void) { static void initialize_xinerama (void) {
#if !LIBVNCSERVER_HAVE_LIBXINERAMA #if !LIBVNCSERVER_HAVE_LIBXINERAMA
rfbLog("Xinerama: Library libXinerama is not available to determine\n"); if (!raw_fb_str) {
rfbLog("Xinerama: the head geometries, consider using -blackout\n"); rfbLog("Xinerama: Library libXinerama is not available to determine\n");
rfbLog("Xinerama: if the screen is non-rectangular.\n"); rfbLog("Xinerama: the head geometries, consider using -blackout\n");
rfbLog("Xinerama: if the screen is non-rectangular.\n");
}
#else #else
XineramaScreenInfo *sc, *xineramas; XineramaScreenInfo *sc, *xineramas;
sraRegionPtr black_region, tmp_region; sraRegionPtr black_region, tmp_region;
......
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