summaryrefslogtreecommitdiffstats
path: root/x11vnc/sslcmds.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/sslcmds.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/sslcmds.c')
-rw-r--r--x11vnc/sslcmds.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/x11vnc/sslcmds.c b/x11vnc/sslcmds.c
index 0abe9c7..7c4bdc1 100644
--- a/x11vnc/sslcmds.c
+++ b/x11vnc/sslcmds.c
@@ -114,7 +114,7 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
strcat(path, extra);
}
- exe = (char *) malloc(strlen(path) + 1 + strlen("stunnel") + 1);
+ exe = (char *) malloc(strlen(path) + 1 + strlen("stunnel4") + 1);
p = strtok(path, ":");
@@ -123,6 +123,14 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
while (p) {
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");
if (! stunnel_path && stat(exe, &sbuf) == 0) {
if (! S_ISDIR(sbuf.st_mode)) {
@@ -137,6 +145,12 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
free(path);
}
+ if (getenv("STUNNEL_PROG")) {
+ free(exe);
+ exe = strdup(getenv("STUNNEL_PROG"));
+ stunnel_path = exe;
+ }
+
if (! stunnel_path) {
free(exe);
return 0;
@@ -219,6 +233,15 @@ int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport
FILE *in;
char fd[20];
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++) {
close(i);
@@ -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, "[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);
if (hport > 0 && x11vnc_hport > 0) {
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);
}