diff options
author | runge <[email protected]> | 2009-12-15 09:17:37 -0500 |
---|---|---|
committer | runge <[email protected]> | 2009-12-15 09:17:37 -0500 |
commit | d6c012e9688d32d80c288541615c01cd082ecf0a (patch) | |
tree | 83ab0988d56d3a4f29cd419a8d20381fb35ed128 /x11vnc/user.c | |
parent | 8f5c9ef01ef9101cf8f8d8f1eacdaab27ac7c2c8 (diff) | |
download | libtdevnc-d6c012e9688d32d80c288541615c01cd082ecf0a.tar.gz libtdevnc-d6c012e9688d32d80c288541615c01cd082ecf0a.zip |
X props names via env var. fakebuttonevent action, connect_switch and
ultravnc_repeater.pl scripts, find_display try FD_XDM on failure,
-quiet and -storepasswd changes, better port 113 testing.
Diffstat (limited to 'x11vnc/user.c')
-rw-r--r-- | x11vnc/user.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/x11vnc/user.c b/x11vnc/user.c index 2eb939e..fb4c604 100644 --- a/x11vnc/user.c +++ b/x11vnc/user.c @@ -1895,11 +1895,20 @@ char *setup_cmd(char *str, int *vnc_redirect, char **vnc_redirect_host, int *vnc char com[100]; int fd = mkstemp(tmp); if (fd >= 0) { + int ret; write(fd, find_display, strlen(find_display)); close(fd); set_env("FINDDISPLAY_run", "1"); - sprintf(com, "/bin/sh %s -n; rm -f %s", tmp, tmp); - system(com); + sprintf(com, "/bin/sh %s -n", tmp); + ret = system(com); + if (WIFEXITED(ret) && WEXITSTATUS(ret) != 0) { + if (got_findauth && !getenv("FD_XDM")) { + if (getuid() == 0 || geteuid() == 0) { + set_env("FD_XDM", "1"); + system(com); + } + } + } } unlink(tmp); exit(0); @@ -2328,8 +2337,8 @@ static int do_run_cmd(char *cmd, char *create_cmd, char *users_list_save, int cr int internal_cmd = 0; int tried_switch = 0; - memset(line1, 0, 1024); - memset(line2, 0, 16384); + memset(line1, 0, sizeof(line1)); + memset(line2, 0, sizeof(line2)); if (users_list && strstr(users_list, "sslpeer=") == users_list) { usslpeer = get_usslpeer(); @@ -2397,13 +2406,13 @@ static int do_run_cmd(char *cmd, char *create_cmd, char *users_list_save, int cr int res = 0, k, j, i; char line[18000]; - memset(line, 0, 18000); + memset(line, 0, sizeof(line)); if (unixpw_system_greeter_active == 2) { rfbLog("unixpw_system_greeter: forcing find display failure.\n"); res = 0; } else if (keep_unixpw_user && keep_unixpw_pass) { - n = 18000; + n = sizeof(line); if (unixpw_cmd != NULL) { res = unixpw_cmd_run(keep_unixpw_user, keep_unixpw_pass, cmd, line, &n); @@ -2432,13 +2441,13 @@ if (db) {fprintf(stderr, "line: "); write(2, line, n); write(2, "\n", 1); fprint if (unixpw_cmd != NULL) { /* let the external unixpw command do it: */ - n = 18000; + n = sizeof(line); close_exec_fds(); res = unixpw_cmd_run(keep_unixpw_user, keep_unixpw_pass, create_cmd, line, &n); } else if (getuid() != 0 && unixpw_system_greeter_active != 2) { /* if not root, run as the other user... */ - n = 18000; + n = sizeof(line); close_exec_fds(); res = su_verify(keep_unixpw_user, keep_unixpw_pass, create_cmd, line, &n, nodisp); |