summaryrefslogtreecommitdiffstats
path: root/x11vnc/x11vnc.c
diff options
context:
space:
mode:
authorrunge <runge@karlrunge.com>2009-12-07 09:15:22 -0500
committerrunge <runge@karlrunge.com>2009-12-07 09:15:22 -0500
commit8f5c9ef01ef9101cf8f8d8f1eacdaab27ac7c2c8 (patch)
treeb56c0f6b003075bffc43cae033c647ab31eeff60 /x11vnc/x11vnc.c
parent6153bd69835da0e7217ae844bdba4e2ba676f981 (diff)
downloadlibtdevnc-8f5c9ef01ef9101cf8f8d8f1eacdaab27ac7c2c8.tar.gz
libtdevnc-8f5c9ef01ef9101cf8f8d8f1eacdaab27ac7c2c8.zip
X11VNC_EXTRA_HTTPS_PARAMS, X11VNC_HTTP_LISTEN_LOCALHOST, X11VNC_REOPEN_SLEEP_MAX,
-findauth/-auth guess FD_XDM=1 for root, work around xhost SI:localuser:root.
Diffstat (limited to 'x11vnc/x11vnc.c')
-rw-r--r--x11vnc/x11vnc.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c
index e13e228..b5e27b4 100644
--- a/x11vnc/x11vnc.c
+++ b/x11vnc/x11vnc.c
@@ -2013,6 +2013,7 @@ int main(int argc, char* argv[]) {
int got_tls = 0;
int got_inetd = 0;
int got_noxrandr = 0;
+ int got_findauth = 0;
/* used to pass args we do not know about to rfbGetScreen(): */
int argc_vnc_max = 1024;
@@ -2180,24 +2181,14 @@ int main(int argc, char* argv[]) {
continue;
}
if (!strcmp(arg, "-findauth")) {
- int ic = 0;
- if (use_dpy != NULL) {
- set_env("DISPLAY", use_dpy);
- }
- use_dpy = strdup("WAIT:cmd=FINDDISPLAY-run");
+ got_findauth = 1;
if (argc > i+1) {
- set_env("X11VNC_SKIP_DISPLAY", argv[i+1]);
- } else if (getenv("DISPLAY")) {
- set_env("X11VNC_SKIP_DISPLAY", getenv("DISPLAY"));
- } else {
- set_env("X11VNC_SKIP_DISPLAY", ":0");
+ char *s = argv[i+1];
+ if (s[0] != '-') {
+ set_env("FINDAUTH_DISPLAY", argv[i+1]);
+ i++;
+ }
}
- set_env("X11VNC_SKIP_DISPLAY_NEGATE", "1");
- set_env("FIND_DISPLAY_XAUTHORITY_PATH", "1");
- set_env("FIND_DISPLAY_NO_SHOW_XAUTH", "1");
- set_env("FIND_DISPLAY_NO_SHOW_DISPLAY", "1");
- wait_for_client(&ic, NULL, 0);
- exit(0);
continue;
}
if (!strcmp(arg, "-create")) {
@@ -4030,6 +4021,33 @@ int main(int argc, char* argv[]) {
set_env("PATH", "/bin:/usr/bin");
}
+ /* handle -findauth case now that cmdline has been read */
+ if (got_findauth) {
+ char *s;
+ int ic = 0;
+ if (use_dpy != NULL) {
+ set_env("DISPLAY", use_dpy);
+ }
+ use_dpy = strdup("WAIT:cmd=FINDDISPLAY-run");
+
+ s = getenv("FINDAUTH_DISPLAY");
+ if (s && strcmp("", s)) {
+ set_env("DISPLAY", s);
+ }
+ s = getenv("DISPLAY");
+ if (s && strcmp("", s)) {
+ set_env("X11VNC_SKIP_DISPLAY", s);
+ } else {
+ set_env("X11VNC_SKIP_DISPLAY", ":0");
+ }
+ set_env("X11VNC_SKIP_DISPLAY_NEGATE", "1");
+ set_env("FIND_DISPLAY_XAUTHORITY_PATH", "1");
+ set_env("FIND_DISPLAY_NO_SHOW_XAUTH", "1");
+ set_env("FIND_DISPLAY_NO_SHOW_DISPLAY", "1");
+ wait_for_client(&ic, NULL, 0);
+ exit(0);
+ }
+
/* set OS struct UT */
uname(&UT);