Commit 6fbba525 authored by runge's avatar runge

x11vnc: x11vnc.desktop file. -reopen, -dhparams, -sslCRL,

  -setdefer options. -rfbport PROMPT VeNCrypt and TLSVNC SSL/TLS
  encryption support.  Tweaks to choose_delay() algorithm.
  -ssl ANON anonymouse Diffie-Hellman mode.  Fix bugs in certs
  management.  Additions to tray=setpass naive user mode.
parent 63b98dba
2008-11-22 Karl Runge <runge@karlrunge.com>
* x11vnc: x11vnc.desktop file. -reopen, -dhparams, -sslCRL,
-setdefer options. -rfbport PROMPT VeNCrypt and TLSVNC SSL/TLS
encryption support. Tweaks to choose_delay() algorithm.
-ssl ANON anonymouse Diffie-Hellman mode. Fix bugs in certs
management. Additions to tray=setpass naive user mode.
2008-11-09 Karl Runge <runge@karlrunge.com> 2008-11-09 Karl Runge <runge@karlrunge.com>
* x11vnc: add zeroconf external helpers (avahi-publish and * x11vnc: add zeroconf external helpers (avahi-publish and
dns-sd). Alias -zeroconf. Close pipeinput_fh on exit. dns-sd). Alias -zeroconf. Close pipeinput_fh on exit.
......
...@@ -13,8 +13,11 @@ endif ...@@ -13,8 +13,11 @@ endif
SUBDIRS = misc SUBDIRS = misc
DIST_SUBDIRS = misc DIST_SUBDIRS = misc
desktopdir = $(datadir)/applications
desktop_DATA = x11vnc.desktop
man_MANS=x11vnc.1 man_MANS=x11vnc.1
EXTRA_DIST=ChangeLog README tkx11vnc $(man_MANS) EXTRA_DIST=ChangeLog README tkx11vnc $(man_MANS) $(desktop_DATA)
if CYGIPC if CYGIPC
LD_CYGIPC=-lcygipc LD_CYGIPC=-lcygipc
......
This diff is collapsed.
...@@ -113,6 +113,7 @@ void avahi_initialise(void) { ...@@ -113,6 +113,7 @@ void avahi_initialise(void) {
void avahi_advertise(const char *name, const char *host, const uint16_t port) { void avahi_advertise(const char *name, const char *host, const uint16_t port) {
if (!try_avahi_helper(name, host, port)) { if (!try_avahi_helper(name, host, port)) {
rfbLog("avahi_advertise: no Avahi support at buildtime.\n"); rfbLog("avahi_advertise: no Avahi support at buildtime.\n");
avahi = 0;
} }
} }
......
...@@ -259,7 +259,51 @@ static int Xerror(Display *d, XErrorEvent *error) { ...@@ -259,7 +259,51 @@ static int Xerror(Display *d, XErrorEvent *error) {
} }
static int XIOerr(Display *d) { static int XIOerr(Display *d) {
static int reopen = 0, rmax = 1;
X_UNLOCK; X_UNLOCK;
if (getenv("X11VNC_REOPEN_DISPLAY")) {
rmax = atoi(getenv("X11VNC_REOPEN_DISPLAY"));
}
#if !NO_X11
if (reopen < rmax && getenv("X11VNC_REOPEN_DISPLAY")) {
int db = getenv("X11VNC_REOPEN_DEBUG") ? 1 : 0;
Display *save_dpy = dpy;
char *dstr = DisplayString(save_dpy);
reopen++;
rfbLog("*** XIO error: Trying to reopen[%d/%d] display '%s'\n", reopen, rmax, dstr);
rfbLog("*** XIO error: Note the reopened state may be unstable.\n");
usleep (3000 * 1000);
dpy = XOpenDisplay_wr(dstr);
if (dpy) {
rfbLog("*** XIO error: Reopened display '%s' successfully.\n", dstr);
if (db) rfbLog("*** XIO error: '%s' 0x%x\n", dstr, dpy);
scr = DefaultScreen(dpy);
rootwin = RootWindow(dpy, scr);
if (db) rfbLog("*** XIO error: disable_grabserver\n");
disable_grabserver(dpy, 0);
if (db) rfbLog("*** XIO error: xrecord\n");
zerodisp_xrecord();
initialize_xrecord();
if (db) rfbLog("*** XIO error: xdamage\n");
create_xdamage_if_needed(1);
if (db) rfbLog("*** XIO error: do_new_fb\n");
if (using_shm) {
if (db) rfbLog("*** XIO error: clean_shm\n");
clean_shm(1);
}
do_new_fb(1);
if (db) rfbLog("*** XIO error: check_xevents\n");
check_xevents(1);
/* sadly, we can never return... */
if (db) rfbLog("*** XIO error: watch_loop\n");
watch_loop();
clean_up_exit(1);
}
}
#endif
interrupted(-1); interrupted(-1);
if (d) {} /* unused vars warning: */ if (d) {} /* unused vars warning: */
......
...@@ -772,7 +772,8 @@ void client_gone(rfbClientPtr client) { ...@@ -772,7 +772,8 @@ void client_gone(rfbClientPtr client) {
*/ */
if ((client->state == RFB_PROTOCOL_VERSION || if ((client->state == RFB_PROTOCOL_VERSION ||
client->state == RFB_SECURITY_TYPE || client->state == RFB_SECURITY_TYPE ||
client->state == RFB_AUTHENTICATION) && accepted_client) { client->state == RFB_AUTHENTICATION ||
client->state == RFB_INITIALISATION) && accepted_client) {
rfbLog("connect_once: invalid password or early " rfbLog("connect_once: invalid password or early "
"disconnect.\n"); "disconnect.\n");
rfbLog("connect_once: waiting for next connection.\n"); rfbLog("connect_once: waiting for next connection.\n");
...@@ -3208,7 +3209,7 @@ void adjust_grabs(int grab, int quiet) { ...@@ -3208,7 +3209,7 @@ void adjust_grabs(int grab, int quiet) {
} }
void check_new_clients(void) { void check_new_clients(void) {
static int last_count = 0; static int last_count = -1;
rfbClientIteratorPtr iter; rfbClientIteratorPtr iter;
rfbClientPtr cl; rfbClientPtr cl;
int i, send_info = 0; int i, send_info = 0;
...@@ -3243,7 +3244,9 @@ void check_new_clients(void) { ...@@ -3243,7 +3244,9 @@ void check_new_clients(void) {
} }
} }
if (client_count == last_count) { if (last_count == -1) {
last_count = 0;
} else if (client_count == last_count) {
return; return;
} }
......
...@@ -229,15 +229,17 @@ static void sigusr1 (int sig) { ...@@ -229,15 +229,17 @@ static void sigusr1 (int sig) {
if (0) sig = 0; if (0) sig = 0;
} }
static char *extra_path = ":/usr/local/bin:/usr/bin/X11:/usr/sfw/bin"
":/usr/X11R6/bin:/usr/openwin/bin:/usr/dt/bin";
static char *wishes[] = {"wish8.4", "wish", "wish8.3", "wish8.5", "wish8.0", NULL};
static void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int start_x11vnc, static void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int start_x11vnc,
int simple_gui, pid_t parent, char *gui_opts) { int simple_gui, pid_t parent, char *gui_opts) {
char *x11vnc_xdisplay = NULL; char *x11vnc_xdisplay = NULL;
char extra_path[] = ":/usr/local/bin:/usr/bin/X11:/usr/sfw/bin"
":/usr/X11R6/bin:/usr/openwin/bin:/usr/dt/bin";
char cmd[100]; char cmd[100];
char *wish = NULL, *orig_path, *full_path, *tpath, *p; char *wish = NULL, *orig_path, *full_path, *tpath, *p;
char *old_xauth = NULL; char *old_xauth = NULL;
int try_max = 4, sleep = 300, totms; int try_max = 4, sleep = 300, totms, rc = 0;
pid_t mypid = getpid(); pid_t mypid = getpid();
FILE *pipe, *tmpf; FILE *pipe, *tmpf;
...@@ -255,7 +257,7 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc ...@@ -255,7 +257,7 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
x11vnc_xdisplay = strdup(use_dpy); x11vnc_xdisplay = strdup(use_dpy);
} }
if (connect_to_x11vnc) { if (connect_to_x11vnc) {
int rc, i; int i;
rfbLogEnable(1); rfbLogEnable(1);
if (! client_connect_file) { if (! client_connect_file) {
if (getenv("XAUTHORITY") != NULL) { if (getenv("XAUTHORITY") != NULL) {
...@@ -383,17 +385,18 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc ...@@ -383,17 +385,18 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
while (p) { while (p) {
char *try; char *try;
struct stat sbuf; struct stat sbuf;
char *wishes[] = {"wish", "wish8.3", "wish8.4", "wish8.5", int i;
"wish8.0"};
int nwishes = 3, i;
try = (char *) malloc(strlen(p) + 1 + strlen("wish8.4") + 1); try = (char *) malloc(strlen(p) + 1 + strlen("wish8.4") + 1);
for (i=0; i<nwishes; i++) { i = 0;
while (wishes[i] != NULL) {
sprintf(try, "%s/%s", p, wishes[i]); sprintf(try, "%s/%s", p, wishes[i]);
if (stat(try, &sbuf) == 0) { if (stat(try, &sbuf) == 0) {
/* assume executable, should check mode */ /* assume executable, should check mode */
wish = wishes[i]; wish = wishes[i];
break;
} }
i++;
} }
free(try); free(try);
if (wish) { if (wish) {
...@@ -442,6 +445,9 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc ...@@ -442,6 +445,9 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
while (p) { while (p) {
if(strstr(p, "setp") == p) { if(strstr(p, "setp") == p) {
set_env("X11VNC_ICON_SETPASS", "1"); set_env("X11VNC_ICON_SETPASS", "1");
if (rc != 0) {
set_env("X11VNC_SETPASS_FAIL", "1");
}
} else if(strstr(p, "noadvanced") == p) { } else if(strstr(p, "noadvanced") == p) {
set_env("X11VNC_ICON_NOADVANCED", "1"); set_env("X11VNC_ICON_NOADVANCED", "1");
} else if(strstr(p, "minimal") == p) { } else if(strstr(p, "minimal") == p) {
...@@ -518,6 +524,7 @@ void do_gui(char *opts, int sleep) { ...@@ -518,6 +524,7 @@ void do_gui(char *opts, int sleep) {
int start_x11vnc = 1; int start_x11vnc = 1;
int connect_to_x11vnc = 0; int connect_to_x11vnc = 0;
int simple_gui = 0, none_gui = 0; int simple_gui = 0, none_gui = 0;
int portprompt = 0;
Display *test_dpy; Display *test_dpy;
if (opts) { if (opts) {
...@@ -553,6 +560,10 @@ void do_gui(char *opts, int sleep) { ...@@ -553,6 +560,10 @@ void do_gui(char *opts, int sleep) {
connect_to_x11vnc = 0; connect_to_x11vnc = 0;
} else if (!strcmp(p, "none")) { } else if (!strcmp(p, "none")) {
none_gui = 1; none_gui = 1;
} else if (!strcmp(p, "portprompt")) {
start_x11vnc = 0;
connect_to_x11vnc = 0;
portprompt = 1;
} else if (!strcmp(p, "conn") || !strcmp(p, "connect")) { } else if (!strcmp(p, "conn") || !strcmp(p, "connect")) {
start_x11vnc = 0; start_x11vnc = 0;
connect_to_x11vnc = 1; connect_to_x11vnc = 1;
...@@ -603,6 +614,7 @@ void do_gui(char *opts, int sleep) { ...@@ -603,6 +614,7 @@ void do_gui(char *opts, int sleep) {
connect_to_x11vnc = 1; connect_to_x11vnc = 1;
} }
#ifdef MACOSX #ifdef MACOSX
goto startit; goto startit;
#endif #endif
...@@ -622,7 +634,7 @@ void do_gui(char *opts, int sleep) { ...@@ -622,7 +634,7 @@ void do_gui(char *opts, int sleep) {
" to display on.\n"); " to display on.\n");
exit(1); exit(1);
} }
if (!quiet) { if (!quiet && !portprompt) {
fprintf(stderr, "starting gui, trying display: %s\n", fprintf(stderr, "starting gui, trying display: %s\n",
gui_xdisplay); gui_xdisplay);
} }
...@@ -658,6 +670,156 @@ void do_gui(char *opts, int sleep) { ...@@ -658,6 +670,156 @@ void do_gui(char *opts, int sleep) {
#ifdef MACOSX #ifdef MACOSX
startit: startit:
#endif #endif
if (portprompt) {
char *cmd, *p, *p2, *p1, *p0 = getenv("PATH");
char tf1[] = "/tmp/x11vnc_port_prompt.2XXXXXX";
char tf2[] = "/tmp/x11vnc_port_prompt.1XXXXXX";
int fd, i, port;
char *dstr = "", *wish = NULL;
char line[128];
FILE *fp;
if (no_external_cmds || !cmd_ok("gui")) {
return;
}
if (gui_xdisplay) {
dstr = gui_xdisplay;
if (strchr(gui_xdisplay, '\'')) {
return;
}
}
if (!p0) {
p0 = "";
}
if (strchr(p0, '\'')) {
return;
}
fd = mkstemp(tf2);
if (fd < 0) {
return;
}
close(fd);
fd = mkstemp(tf1);
if (fd < 0) {
unlink(tf2);
return;
}
write(fd, gui_code, strlen(gui_code));
close(fd);
p1 = (char *) malloc(10 + strlen(p0) + strlen(extra_path));
sprintf(p1, "%s:%s", p0, extra_path);
p2 = strdup(p1);
p = strtok(p2, ":");
while (p) {
char *try;
struct stat sbuf;
int i;
try = (char *) malloc(strlen(p) + 1 + strlen("wish8.4") + 1);
i = 0;
while (wishes[i] != NULL) {
sprintf(try, "%s/%s", p, wishes[i]);
if (stat(try, &sbuf) == 0) {
/* assume executable, should check mode */
wish = wishes[i];
break;
}
i++;
}
free(try);
if (wish) {
break;
}
p = strtok(NULL, ":");
}
free(p2);
if (!wish) {
wish = "wish";
}
cmd = (char *) malloc(200 + strlen(dstr) + strlen(p1));
if (!strcmp(dstr, "")) {
sprintf(cmd, "env PATH='%s' %s %s -name x11vnc_port_prompt -portprompt > %s", p1, wish, tf1, tf2);
} else {
sprintf(cmd, "env PATH='%s' DISPLAY='%s' %s %s -name x11vnc_port_prompt -portprompt > %s", p1, dstr, wish, tf1, tf2);
}
if (getenv("X11VNC_DEBUG_PORTPROMPT")) {
fprintf(stderr, "cmd=%s\n", cmd);
}
if (use_openssl) {
set_env("X11VNC_SSL_ENABLED", "1");
}
if (allow_list && !strcmp(allow_list, "127.0.0.1")) {
set_env("X11VNC_LOCALHOST_ENABLED", "1");
}
if (got_ultrafilexfer) {
set_env("X11VNC_FILETRANSFER_ENABLED", "ultra");
} else if (tightfilexfer) {
set_env("X11VNC_FILETRANSFER_ENABLED", "tight");
}
system(cmd);
free(cmd);
free(p1);
fp = fopen(tf2, "r");
memset(line, 0, sizeof(line));
if (fp) {
fgets(line, 128, fp);
fclose(fp);
if (line[0] != '\0') {
int readport = atoi(line);
if (readport > 0) {
got_rfbport_val = readport;
}
}
}
if (strstr(line, "ssl0")) {
if (use_openssl) use_openssl = 0;
} else if (strstr(line, "ssl1")) {
if (!use_openssl) {
use_openssl = 1;
openssl_pem = strdup("SAVE_NOPROMPT");
set_env("X11VNC_GOT_SSL", "1");
}
}
if (strstr(line, "localhost0")) {
if (allow_list && !strcmp(allow_list, "127.0.0.1")) {
allow_list = NULL;
}
} else if (strstr(line, "localhost1")) {
allow_list = strdup("127.0.0.1");
}
if (strstr(line, "ft_ultra")) {
got_ultrafilexfer = 1;
tightfilexfer = 0;
} else if (strstr(line, "ft_tight")) {
got_ultrafilexfer = 0;
tightfilexfer = 1;
} else if (strstr(line, "ft_none")) {
got_ultrafilexfer = 0;
tightfilexfer = 0;
}
unlink(tf1);
unlink(tf2);
if (old_xauth) {
set_env("XAUTHORITY", old_xauth);
}
return;
}
if (start_x11vnc) { if (start_x11vnc) {
......
This diff is collapsed.
...@@ -31,9 +31,16 @@ int ssl_no_fail = 0; ...@@ -31,9 +31,16 @@ int ssl_no_fail = 0;
char *openssl_pem = NULL; char *openssl_pem = NULL;
char *ssl_certs_dir = NULL; char *ssl_certs_dir = NULL;
char *enc_str = NULL; char *enc_str = NULL;
int vencrypt_mode = VENCRYPT_SUPPORT;
int vencrypt_kx = VENCRYPT_BOTH;
int vencrypt_enable_plain_login = 0;
int tlsvnc_mode = TLSVNC_SUPPORT;
int create_fresh_dhparams = 0;
char *dhparams_file = NULL;
int https_port_num = -1; int https_port_num = -1;
int https_port_redir = 0; int https_port_redir = 0;
char *ssl_verify = NULL; char *ssl_verify = NULL;
char *ssl_crl = NULL;
int ssl_initialized = 0; int ssl_initialized = 0;
int ssl_timeout_secs = -1; int ssl_timeout_secs = -1;
char *ssh_str = NULL; char *ssh_str = NULL;
...@@ -110,6 +117,7 @@ int inetd = 0; /* spawned from inetd(8) */ ...@@ -110,6 +117,7 @@ int inetd = 0; /* spawned from inetd(8) */
#define TIGHTFILEXFER 0 #define TIGHTFILEXFER 0
#endif #endif
int tightfilexfer = TIGHTFILEXFER; int tightfilexfer = TIGHTFILEXFER;
int got_ultrafilexfer = 0;
int first_conn_timeout = 0; /* -timeout */ int first_conn_timeout = 0; /* -timeout */
int ping_interval = 0; /* -ping */ int ping_interval = 0; /* -ping */
int flash_cmap = 0; /* follow installed colormaps */ int flash_cmap = 0; /* follow installed colormaps */
...@@ -361,6 +369,7 @@ double slow_fb = 0.0; ...@@ -361,6 +369,7 @@ double slow_fb = 0.0;
double xrefresh = 0.0; double xrefresh = 0.0;
int wait_bog = 1; int wait_bog = 1;
int defer_update = 20; /* deferUpdateTime ms to wait before sends. */ int defer_update = 20; /* deferUpdateTime ms to wait before sends. */
int set_defer = 1;
int got_defer = 0; int got_defer = 0;
int got_deferupdate = 0; int got_deferupdate = 0;
......
...@@ -31,9 +31,16 @@ extern int ssl_no_fail; ...@@ -31,9 +31,16 @@ extern int ssl_no_fail;
extern char *openssl_pem; extern char *openssl_pem;
extern char *ssl_certs_dir; extern char *ssl_certs_dir;
extern char *enc_str; extern char *enc_str;
extern int vencrypt_mode;
extern int vencrypt_kx;
extern int vencrypt_enable_plain_login;
extern int tlsvnc_mode;
extern int create_fresh_dhparams;
extern char *dhparams_file;
extern int https_port_num; extern int https_port_num;
extern int https_port_redir; extern int https_port_redir;
extern char *ssl_verify; extern char *ssl_verify;
extern char *ssl_crl;
extern int ssl_initialized; extern int ssl_initialized;
extern int ssl_timeout_secs; extern int ssl_timeout_secs;
extern char *ssh_str; extern char *ssh_str;
...@@ -85,6 +92,7 @@ extern char **passwd_list; ...@@ -85,6 +92,7 @@ extern char **passwd_list;
extern int begin_viewonly; extern int begin_viewonly;
extern int inetd; extern int inetd;
extern int tightfilexfer; extern int tightfilexfer;
extern int got_ultrafilexfer;
extern int first_conn_timeout; extern int first_conn_timeout;
extern int ping_interval; extern int ping_interval;
extern int flash_cmap; extern int flash_cmap;
...@@ -266,6 +274,7 @@ extern double slow_fb; ...@@ -266,6 +274,7 @@ extern double slow_fb;
extern double xrefresh; extern double xrefresh;
extern int wait_bog; extern int wait_bog;
extern int defer_update; extern int defer_update;
extern int set_defer;
extern int got_defer; extern int got_defer;
extern int got_deferupdate; extern int got_deferupdate;
......
...@@ -54,4 +54,18 @@ ...@@ -54,4 +54,18 @@
#define ROTATE_90Y 6 #define ROTATE_90Y 6
#define ROTATE_270 7 #define ROTATE_270 7
#define VENCRYPT_NONE 0
#define VENCRYPT_SUPPORT 1
#define VENCRYPT_SOLE 2
#define VENCRYPT_FORCE 3
#define VENCRYPT_BOTH 0
#define VENCRYPT_NODH 1
#define VENCRYPT_NOX509 2
#define TLSVNC_NONE 0
#define TLSVNC_SUPPORT 1
#define TLSVNC_SOLE 2
#define TLSVNC_FORCE 3
#endif /* _X11VNC_PARAMS_H */ #endif /* _X11VNC_PARAMS_H */
...@@ -2843,7 +2843,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -2843,7 +2843,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
use_xdamage = 1; use_xdamage = 1;
if (use_xdamage != orig) { if (use_xdamage != orig) {
initialize_xdamage(); initialize_xdamage();
create_xdamage_if_needed(); create_xdamage_if_needed(0);
} }
goto done; goto done;
} }
...@@ -3927,6 +3927,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -3927,6 +3927,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
d = atoi(p); d = atoi(p);
if (d < 0) d = 0; if (d < 0) d = 0;
rfbLog("remote_cmd: setting defer to %d ms.\n", d); rfbLog("remote_cmd: setting defer to %d ms.\n", d);
defer_update = d;
screen->deferUpdateTime = d; screen->deferUpdateTime = d;
got_defer = 1; got_defer = 1;
goto done; goto done;
...@@ -3947,10 +3948,22 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -3947,10 +3948,22 @@ char *process_remote_cmd(char *cmd, int stringonly) {
d = atoi(p); d = atoi(p);
if (d < 0) d = 0; if (d < 0) d = 0;
rfbLog("remote_cmd: setting defer to %d ms.\n", d); rfbLog("remote_cmd: setting defer to %d ms.\n", d);
defer_update = d;
screen->deferUpdateTime = d; screen->deferUpdateTime = d;
got_defer = 1; got_defer = 1;
goto done; goto done;
} }
if (strstr(p, "setdefer") == p) {
COLON_CHECK("setdefer:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co, set_defer);
goto qry;
}
p += strlen("setdefer:");
set_defer = atoi(p);
rfbLog("remote_cmd: setting set_defer to %d\n", set_defer);
goto done;
}
if (strstr(p, "wait_ui") == p) { if (strstr(p, "wait_ui") == p) {
double w; double w;
COLON_CHECK("wait_ui:") COLON_CHECK("wait_ui:")
...@@ -5177,7 +5190,6 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -5177,7 +5190,6 @@ char *process_remote_cmd(char *cmd, int stringonly) {
snprintf(buf, bufn, "aro=%s:%s", p, NONUL(passwdfile)); snprintf(buf, bufn, "aro=%s:%s", p, NONUL(passwdfile));
goto qry; goto qry;
} }
#ifndef NO_SSL_OR_UNIXPW
if (!strcmp(p, "unixpw")) { if (!strcmp(p, "unixpw")) {
snprintf(buf, bufn, "aro=%s:%d", p, unixpw); snprintf(buf, bufn, "aro=%s:%d", p, unixpw);
goto qry; goto qry;
...@@ -5218,7 +5230,6 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -5218,7 +5230,6 @@ char *process_remote_cmd(char *cmd, int stringonly) {
snprintf(buf, bufn, "aro=%s:%d", p, https_port_redir); snprintf(buf, bufn, "aro=%s:%d", p, https_port_redir);
goto qry; goto qry;
} }
#endif
if (!strcmp(p, "usepw")) { if (!strcmp(p, "usepw")) {
snprintf(buf, bufn, "aro=%s:%d", p, usepw); snprintf(buf, bufn, "aro=%s:%d", p, usepw);
goto qry; goto qry;
......
...@@ -341,12 +341,17 @@ static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, ...@@ -341,12 +341,17 @@ static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h,
void shm_delete(XShmSegmentInfo *shm) { void shm_delete(XShmSegmentInfo *shm) {
#if LIBVNCSERVER_HAVE_XSHM #if LIBVNCSERVER_HAVE_XSHM
if (getenv("X11VNC_SHM_DEBUG")) fprintf(stderr, "shm_delete: 0x%x\n", shm);
if (shm != NULL && shm->shmaddr != (char *) -1) { if (shm != NULL && shm->shmaddr != (char *) -1) {
shmdt(shm->shmaddr); shmdt(shm->shmaddr);
} }
if (shm != NULL && shm->shmid != -1) { if (shm != NULL && shm->shmid != -1) {
shmctl(shm->shmid, IPC_RMID, 0); shmctl(shm->shmid, IPC_RMID, 0);
} }
if (shm != NULL) {
shm->shmaddr = (char *) -1;
shm->shmid = -1;
}
#else #else
if (!shm) {} if (!shm) {}
#endif #endif
...@@ -2664,6 +2669,27 @@ void nap_sleep(int ms, int split) { ...@@ -2664,6 +2669,27 @@ void nap_sleep(int ms, int split) {
} }
} }
static char *get_load(void) {
static char tmp[64];
static int count = 0;
if (count++ % 5 == 0) {
struct stat sb;
memset(tmp, 0, sizeof(tmp));
if (stat("/proc/loadavg", &sb) == 0) {
int d = open("/proc/loadavg", O_RDONLY);
if (d >= 0) {
read(d, tmp, 60);
close(d);
}
}
if (tmp[0] == '\0') {
strcat(tmp, "unknown");
}
}
return tmp;
}
/* /*
* see if we should take a nap of some sort between polls * see if we should take a nap of some sort between polls
*/ */
...@@ -2687,14 +2713,14 @@ static void nap_check(int tile_cnt) { ...@@ -2687,14 +2713,14 @@ static void nap_check(int tile_cnt) {
if (dt_fbu > screen_blank) { if (dt_fbu > screen_blank) {
/* sleep longer for no fb requests */ /* sleep longer for no fb requests */
if (debug_tiles > 1) { if (debug_tiles > 1) {
fprintf(stderr, "screen blank sleep1: %d ms / 16\n", 2 * ms); fprintf(stderr, "screen blank sleep1: %d ms / 16, load: %s\n", 2 * ms, get_load());
} }
nap_sleep(2 * ms, 16); nap_sleep(2 * ms, 16);
return; return;
} }
if (dt_ev > screen_blank) { if (dt_ev > screen_blank) {
if (debug_tiles > 1) { if (debug_tiles > 1) {
fprintf(stderr, "screen blank sleep2: %d ms / 8\n", ms); fprintf(stderr, "screen blank sleep2: %d ms / 8, load: %s\n", ms, get_load());
} }
nap_sleep(ms, 8); nap_sleep(ms, 8);
return; return;
...@@ -2709,7 +2735,7 @@ static void nap_check(int tile_cnt) { ...@@ -2709,7 +2735,7 @@ static void nap_check(int tile_cnt) {
nap_ok = 0; nap_ok = 0;
} else { } else {
if (debug_tiles > 1) { if (debug_tiles > 1) {
fprintf(stderr, "nap_check sleep: %d ms / 1\n", ms); fprintf(stderr, "nap_check sleep: %d ms / 1, load: %s\n", ms, get_load());
} }
nap_sleep(ms, 1); nap_sleep(ms, 1);
} }
...@@ -3198,7 +3224,8 @@ int scan_for_updates(int count_only) { ...@@ -3198,7 +3224,8 @@ int scan_for_updates(int count_only) {
static int bad = 0; static int bad = 0;
if (xd_misses > (5 * xd_samples) / 100) { if (xd_misses > (5 * xd_samples) / 100) {
rfbLog("XDAMAGE is not working well... misses: %d/%d\n", xd_misses, xd_samples); rfbLog("XDAMAGE is not working well... misses: %d/%d\n", xd_misses, xd_samples);
rfbLog("Maybe a OpenGL app like Beryl is the problem? Use -noxdamage\n"); rfbLog("Maybe an OpenGL app like Beryl or Compiz is the problem?\n");
rfbLog("Use x11vnc -noxdamage or disable the Beryl/Compiz app.\n");
rfbLog("To disable this check and warning specify -xdamage twice.\n"); rfbLog("To disable this check and warning specify -xdamage twice.\n");
if (++bad >= 10) { if (++bad >= 10) {
rfbLog("XDAMAGE appears broken (OpenGL app?), turning it off.\n"); rfbLog("XDAMAGE appears broken (OpenGL app?), turning it off.\n");
......
...@@ -3072,6 +3072,8 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { ...@@ -3072,6 +3072,8 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
} }
if (! got_deferupdate) { if (! got_deferupdate) {
screen->deferUpdateTime = defer_update; screen->deferUpdateTime = defer_update;
} else {
defer_update = screen->deferUpdateTime;
} }
rfbInitServer(screen); rfbInitServer(screen);
...@@ -3429,9 +3431,15 @@ static int choose_delay(double dt) { ...@@ -3429,9 +3431,15 @@ static int choose_delay(double dt) {
int bogdown = 1, bcnt = 0; int bogdown = 1, bcnt = 0;
int ndt = 8, nave = 3; int ndt = 8, nave = 3;
double fac = 1.0; double fac = 1.0;
int db = 0; static int db = 0, did_set_defer = 0;
static double dts[8]; static double dts[8];
static int link = LR_UNSET, latency = -1, netrate = -1;
static double last_link = 0.0;
if (screen && did_set_defer) {
/* reset defer in case we changed it */
screen->deferUpdateTime = defer_update;
}
if (waitms == 0) { if (waitms == 0) {
return waitms; return waitms;
} }
...@@ -3443,11 +3451,22 @@ static int choose_delay(double dt) { ...@@ -3443,11 +3451,22 @@ static int choose_delay(double dt) {
for(i=0; i<ndt; i++) { for(i=0; i<ndt; i++) {
dts[i] = 0.0; dts[i] = 0.0;
} }
if (getenv("DEBUG_DELAY")) {
db = atoi(getenv("DEBUG_DELAY"));
}
if (getenv("SET_DEFER")) {
set_defer = atoi(getenv("SET_DEFER"));
}
first = 0; first = 0;
} }
now = dnow(); now = dnow();
if (now > last_link + 30.0 || link == LR_UNSET) {
link = link_rate(&latency, &netrate);
last_link = now;
}
/* /*
* first check for bogdown, e.g. lots of activity, scrolling text * first check for bogdown, e.g. lots of activity, scrolling text
* from command output, etc. * from command output, etc.
...@@ -3514,6 +3533,7 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx()); ...@@ -3514,6 +3533,7 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx());
db = (db || debug_tiles); db = (db || debug_tiles);
if (db) fprintf(stderr, "bogg[%d] %.3f %.3f %.3f %.3f\n", if (db) fprintf(stderr, "bogg[%d] %.3f %.3f %.3f %.3f\n",
msec, dts[ndt-4], dts[ndt-3], dts[ndt-2], dts[ndt-1]); msec, dts[ndt-4], dts[ndt-3], dts[ndt-2], dts[ndt-1]);
return msec; return msec;
} }
...@@ -3526,6 +3546,8 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx()); ...@@ -3526,6 +3546,8 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx());
dy0 = nabs(y1 - y0); dy0 = nabs(y1 - y0);
dx1 = nabs(x2 - x1); dx1 = nabs(x2 - x1);
dy1 = nabs(y2 - y1); dy1 = nabs(y2 - y1);
/* bigger displacement for most recent dt: */
if (dx1 > dy1) { if (dx1 > dy1) {
dm = dx1; dm = dx1;
} else { } else {
...@@ -3533,21 +3555,53 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx()); ...@@ -3533,21 +3555,53 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx());
} }
if ((dx0 || dy0) && (dx1 || dy1)) { if ((dx0 || dy0) && (dx1 || dy1)) {
/* if mouse moved the previous two times: */
if (t2 < t0 + cut1 || t2 < t1 + cut2 || dm > 20) { if (t2 < t0 + cut1 || t2 < t1 + cut2 || dm > 20) {
fac = wait_ui * 1.25; /*
* if within 0.15s(0) or 0.075s(1) or mouse
* moved > 20pixels, set and bump up the cut
* down factor.
*/
fac = wait_ui * 1.5;
} else if ((dx1 || dy1) && dm > 40) {
fac = wait_ui;
} else {
/* still 1.0? */
if (db > 1) fprintf(stderr, "wait_ui: still 1.0\n");
} }
} else if ((dx1 || dy1) && dm > 40) { } else if ((dx1 || dy1) && dm > 40) {
/* if mouse moved > 40 last time: */
fac = wait_ui; fac = wait_ui;
} }
if (fac == 1 && t2 < last_keyboard_time + cut3) { if (fac == 1.0 && t2 < last_keyboard_time + cut3) {
/* if typed in last 0.25s set wait_ui */
fac = wait_ui; fac = wait_ui;
} }
msec = (int) ((double) waitms / fac); if (fac != 1.0) {
if (link == LR_LAN || latency <= 3) {
fac *= 1.5;
}
}
msec = (int) (((double) waitms) / fac);
if (msec == 0) { if (msec == 0) {
msec = 1; msec = 1;
} }
if (set_defer && fac != 1.0 && screen) {
/* this is wait_ui mode, set defer to match wait: */
if (set_defer >= 1) {
screen->deferUpdateTime = msec;
} else if (set_defer <= -1) {
screen->deferUpdateTime = 0;
}
if (nabs(set_defer) == 2) {
urgent_update = 1;
}
did_set_defer = 1;
}
x0 = x1; x0 = x1;
y0 = y1; y0 = y1;
t0 = t1; t0 = t1;
...@@ -3556,6 +3610,8 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx()); ...@@ -3556,6 +3610,8 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx());
y1 = y2; y1 = y2;
t1 = t2; t1 = t2;
if (db > 1) fprintf(stderr, "wait: %2d defer[%02d]: %2d\n", msec, defer_update, screen->deferUpdateTime);
return msec; return msec;
} }
...@@ -3563,7 +3619,7 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx()); ...@@ -3563,7 +3619,7 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnowx());
* main x11vnc loop: polls, checks for events, iterate libvncserver, etc. * main x11vnc loop: polls, checks for events, iterate libvncserver, etc.
*/ */
void watch_loop(void) { void watch_loop(void) {
int cnt = 0, tile_diffs = 0, skip_pe = 0; int cnt = 0, tile_diffs = 0, skip_pe = 0, wait;
double tm, dtr, dt = 0.0; double tm, dtr, dt = 0.0;
time_t start = time(NULL); time_t start = time(NULL);
...@@ -3812,26 +3868,27 @@ void watch_loop(void) { ...@@ -3812,26 +3868,27 @@ void watch_loop(void) {
last_dt = dt; last_dt = dt;
} }
if ((debug_tiles || debug_scroll > 1 || debug_wireframe > 1) if ((debug_tiles || debug_scroll > 1 || debug_wireframe > 1)
&& (tile_diffs > 4 || debug_tiles > 1)) { && (tile_diffs > 4 || debug_tiles > 1)) {
double rate = (tile_x * tile_y * bpp/8 * tile_diffs) / dt; double rate = (tile_x * tile_y * bpp/8 * tile_diffs) / dt;
fprintf(stderr, "============================= TILES: %d dt: %.4f" fprintf(stderr, "============================= TILES: %d dt: %.4f"
" t: %.4f %.2f MB/s nap_ok: %d\n", tile_diffs, dt, " t: %.4f %.2f MB/s nap_ok: %d\n", tile_diffs, dt,
tm - x11vnc_start, rate/1000000.0, nap_ok); tm - x11vnc_start, rate/1000000.0, nap_ok);
} }
} }
/* sleep a bit to lessen load */ /* sleep a bit to lessen load */
if (! urgent_update) { wait = choose_delay(dt);
int wait = choose_delay(dt); if (urgent_update) {
if (wait > 2*waitms) { ;
/* bog case, break it up */ } else if (wait > 2*waitms) {
nap_sleep(wait, 10); /* bog case, break it up */
} else { nap_sleep(wait, 10);
usleep(wait * 1000); } else {
} usleep(wait * 1000);
} }
cnt++; cnt++;
} }
} }
......
...@@ -15,10 +15,6 @@ ...@@ -15,10 +15,6 @@
#endif #endif
#endif #endif
#ifdef NO_SSL_OR_UNIXPW
#undef SSLCMDS
#endif
void check_stunnel(void); void check_stunnel(void);
int start_stunnel(int stunnel_port, int x11vnc_port); int start_stunnel(int stunnel_port, int x11vnc_port);
...@@ -64,6 +60,7 @@ int start_stunnel(int stunnel_port, int x11vnc_port) { ...@@ -64,6 +60,7 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
char *path, *p, *exe; char *path, *p, *exe;
char *stunnel_path = NULL; char *stunnel_path = NULL;
struct stat verify_buf; struct stat verify_buf;
struct stat crl_buf;
int status; int status;
if (stunnel_pid) { if (stunnel_pid) {
...@@ -146,6 +143,12 @@ int start_stunnel(int stunnel_port, int x11vnc_port) { ...@@ -146,6 +143,12 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
clean_up_exit(1); clean_up_exit(1);
} }
} }
if (ssl_crl) {
if (stat(ssl_crl, &crl_buf) != 0) {
rfbLog("stunnel: %s does not exist.\n", ssl_crl);
clean_up_exit(1);
}
}
stunnel_pid = fork(); stunnel_pid = fork();
...@@ -180,6 +183,11 @@ int start_stunnel(int stunnel_port, int x11vnc_port) { ...@@ -180,6 +183,11 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
a = "-A"; a = "-A";
} }
} }
if (ssl_crl) {
rfbLog("stunnel: stunnel3 does not support CRL. %s\n", ssl_crl);
clean_up_exit(1);
}
if (stunnel_pem && ssl_verify) { if (stunnel_pem && ssl_verify) {
/* XXX double check -v 2 */ /* XXX double check -v 2 */
...@@ -210,6 +218,13 @@ int start_stunnel(int stunnel_port, int x11vnc_port) { ...@@ -210,6 +218,13 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
if (stunnel_pem) { if (stunnel_pem) {
fprintf(in, "cert = %s\n", stunnel_pem); fprintf(in, "cert = %s\n", stunnel_pem);
} }
if (ssl_crl) {
if(S_ISDIR(crl_buf.st_mode)) {
fprintf(in, "CRLpath = %s\n", ssl_crl);
} else {
fprintf(in, "CRLfile = %s\n", ssl_crl);
}
}
if (ssl_verify) { if (ssl_verify) {
if(S_ISDIR(verify_buf.st_mode)) { if(S_ISDIR(verify_buf.st_mode)) {
fprintf(in, "CApath = %s\n", ssl_verify); fprintf(in, "CApath = %s\n", ssl_verify);
......
This diff is collapsed.
...@@ -15,6 +15,8 @@ extern int https_sock; ...@@ -15,6 +15,8 @@ extern int https_sock;
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;
extern char *dhret_str;
extern char *new_dh_params;
extern void raw_xfer(int csock, int s_in, int s_out); extern void raw_xfer(int csock, int s_in, int s_out);
......
...@@ -228,7 +228,14 @@ char genCA[] = ...@@ -228,7 +228,14 @@ char genCA[] =
"echo \"----------------------------------------------------------------------\"\n" "echo \"----------------------------------------------------------------------\"\n"
"echo \"\"\n" "echo \"\"\n"
"\n" "\n"
"\"$OPENSSL\" req -config \"$DIR/CA/ssl.cnf\" -new -x509 \\\n" "req_args=$REQ_ARGS\n"
"if echo \"$req_args\" | grep 'days' > /dev/null; then\n"
" :\n"
"else\n"
" req_args=\"$req_args -days 730\"\n"
"fi\n"
"\n"
"\"$OPENSSL\" req -config \"$DIR/CA/ssl.cnf\" -new -x509 -days 730 $req_args \\\n"
" -keyout \"$DIR/CA/private/cakey.pem\" \\\n" " -keyout \"$DIR/CA/private/cakey.pem\" \\\n"
" -out \"$DIR/CA/cacert.pem\"\n" " -out \"$DIR/CA/cacert.pem\"\n"
"\n" "\n"
...@@ -394,8 +401,12 @@ char genCert[] = ...@@ -394,8 +401,12 @@ char genCert[] =
" echo \"time you start the VNC viewer SSL tunnel using this key.\"\n" " echo \"time you start the VNC viewer SSL tunnel using this key.\"\n"
" fi\n" " fi\n"
" echo \"\"\n" " echo \"\"\n"
" printf \"Protect key with a passphrase? [y]/n \"\n" " if [ \"X$GENCERT_NOPROMPT\" = \"X\" ]; then\n"
" read x\n" " printf \"Protect key with a passphrase? [y]/n \"\n"
" read x\n"
" else\n"
" x=n\n"
" fi\n"
" estr=\" *unencrypted*\"\n" " estr=\" *unencrypted*\"\n"
" if [ \"x$ENCRYPT_ONLY\" != \"x\" ]; then\n" " if [ \"x$ENCRYPT_ONLY\" != \"x\" ]; then\n"
" target=\"$ENCRYPT_ONLY\"\n" " target=\"$ENCRYPT_ONLY\"\n"
...@@ -448,8 +459,10 @@ char genCert[] = ...@@ -448,8 +459,10 @@ char genCert[] =
" echo \" This file should be kept secret.\"\n" " echo \" This file should be kept secret.\"\n"
" echo \"----------------------------------------------------------------------\"\n" " echo \"----------------------------------------------------------------------\"\n"
" echo \"\"\n" " echo \"\"\n"
" printf \"Press Enter to print the $dest.req cert request to the screen: \"\n" " if [ \"X$GENCERT_NOPROMPT\" = \"X\" ]; then\n"
" read x\n" " printf \"Press Enter to print the $dest.req cert request to the screen: \"\n"
" read x\n"
" fi\n"
" echo \"\"\n" " echo \"\"\n"
" cat \"$DIR/$dest.req\"\n" " cat \"$DIR/$dest.req\"\n"
" exit 0\n" " exit 0\n"
...@@ -507,8 +520,10 @@ char genCert[] = ...@@ -507,8 +520,10 @@ char genCert[] =
" echo \"\"\n" " echo \"\"\n"
" fi\n" " fi\n"
"\n" "\n"
" printf \"Press Enter to print the $dest.crt certificate to the screen: \"\n" " if [ \"X$GENCERT_NOPROMPT\" = \"X\" ]; then\n"
" read x\n" " printf \"Press Enter to print the $dest.crt certificate to the screen: \"\n"
" read x\n"
" fi\n"
" echo \"\"\n" " echo \"\"\n"
" cat \"$DIR/$dest.crt\"\n" " cat \"$DIR/$dest.crt\"\n"
"}\n" "}\n"
......
This diff is collapsed.
This diff is collapsed.
...@@ -56,11 +56,6 @@ extern char *crypt(const char*, const char *); ...@@ -56,11 +56,6 @@ extern char *crypt(const char*, const char *);
#define IS_BSD #define IS_BSD
#endif #endif
#ifdef NO_SSL_OR_UNIXPW
#undef UNIXPW_SU
#undef UNIXPW_CRYPT
#endif
int white_pixel(void); int white_pixel(void);
void unixpw_screen(int init); void unixpw_screen(int init);
void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init); void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init);
...@@ -70,12 +65,11 @@ void unixpw_msg(char *msg, int delay); ...@@ -70,12 +65,11 @@ void unixpw_msg(char *msg, int delay);
int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int nodisp); int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int nodisp);
int crypt_verify(char *user, char *pass); int crypt_verify(char *user, char *pass);
int cmd_verify(char *user, char *pass); int cmd_verify(char *user, char *pass);
void unixpw_verify_screen(char *user, char *pass);
static int text_x(void); static int text_x(void);
static int text_y(void); static int text_y(void);
static void set_db(void); static void set_db(void);
static void unixpw_verify(char *user, char *pass);
int unixpw_in_progress = 0; int unixpw_in_progress = 0;
int unixpw_denied = 0; int unixpw_denied = 0;
...@@ -1008,38 +1002,8 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int ...@@ -1008,38 +1002,8 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
#endif /* UNIXPW_SU */ #endif /* UNIXPW_SU */
} }
static void unixpw_verify(char *user, char *pass) { int unixpw_verify(char *user, char *pass) {
int x, y; int ok = 0;
char li[] = "Login incorrect";
char log[] = "login: ";
char *colon = NULL;
ClientData *cd = NULL;
int ok;
if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "********");
rfbLog("unixpw_verify: '%s'\n", user ? user : "(null)");
if (user) {
colon = strchr(user, ':');
}
if (colon) {
*colon = '\0';
rfbLog("unixpw_verify: colon: '%s'\n", user);
}
if (unixpw_client) {
cd = (ClientData *) unixpw_client->clientData;
if (cd) {
char *str = (char *)malloc(strlen("UNIX:") +
strlen(user) + 1);
sprintf(str, "UNIX:%s", user);
if (cd->username) {
free(cd->username);
}
cd->username = str;
}
}
ok = 0;
if (unixpw_cmd) { if (unixpw_cmd) {
if (cmd_verify(user, pass)) { if (cmd_verify(user, pass)) {
rfbLog("unixpw_verify: cmd_verify login for '%s'" rfbLog("unixpw_verify: cmd_verify login for '%s'"
...@@ -1074,6 +1038,42 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "*** ...@@ -1074,6 +1038,42 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "***
ok = 0; ok = 0;
} }
} }
return ok;
}
void unixpw_verify_screen(char *user, char *pass) {
int x, y;
char li[] = "Login incorrect";
char log[] = "login: ";
char *colon = NULL;
ClientData *cd = NULL;
int ok;
if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "********");
rfbLog("unixpw_verify: '%s'\n", user ? user : "(null)");
if (user) {
colon = strchr(user, ':');
}
if (colon) {
*colon = '\0';
rfbLog("unixpw_verify: colon: '%s'\n", user);
}
if (unixpw_client) {
cd = (ClientData *) unixpw_client->clientData;
if (cd) {
char *str = (char *)malloc(strlen("UNIX:") +
strlen(user) + 1);
sprintf(str, "UNIX:%s", user);
if (cd->username) {
free(cd->username);
}
cd->username = str;
}
}
ok = unixpw_verify(user, pass);
if (ok) { if (ok) {
unixpw_accept(user); unixpw_accept(user);
...@@ -1385,7 +1385,7 @@ if (db && db <= 2) fprintf(stderr, "u_cnt: %d %d/%d ks: 0x%x '%s'\n", u_cnt, x, ...@@ -1385,7 +1385,7 @@ if (db && db <= 2) fprintf(stderr, "u_cnt: %d %d/%d ks: 0x%x '%s'\n", u_cnt, x,
in_passwd = 0; in_passwd = 0;
pass[p_cnt++] = '\n'; pass[p_cnt++] = '\n';
unixpw_verify(user, pass); unixpw_verify_screen(user, pass);
for (i=0; i<nmax; i++) { for (i=0; i<nmax; i++) {
user[i] = '\0'; user[i] = '\0';
pass[i] = '\0'; pass[i] = '\0';
......
...@@ -12,6 +12,8 @@ extern void unixpw_msg(char *msg, int delay); ...@@ -12,6 +12,8 @@ extern void unixpw_msg(char *msg, int delay);
extern int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int nodisp); extern int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int nodisp);
extern int crypt_verify(char *user, char *pass); extern int crypt_verify(char *user, char *pass);
extern int cmd_verify(char *user, char *pass); extern int cmd_verify(char *user, char *pass);
extern int unixpw_verify(char *user, char *pass);
extern void unixpw_verify_screen(char *user, char *pass);
extern int unixpw_in_progress; extern int unixpw_in_progress;
extern int unixpw_denied; extern int unixpw_denied;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
/* /*
* user input handling heuristics * user input handling heuristics
*/ */
int defer_update_nofb = 6; /* defer a shorter time under -nofb */ int defer_update_nofb = 4; /* defer a shorter time under -nofb */
int last_scroll_type = SCR_NONE; int last_scroll_type = SCR_NONE;
...@@ -10026,7 +10026,7 @@ if (ncdb) fprintf(stderr, "----%02d: UnmapNotify 0x%lx %3d\n", ik, win, id ...@@ -10026,7 +10026,7 @@ if (ncdb) fprintf(stderr, "----%02d: UnmapNotify 0x%lx %3d\n", ik, win, id
#if 0 #if 0
/* /*
// if (cache_list[idx].map_state == IsViewable || desktop_change || macosx_console) if (cache_list[idx].map_state == IsViewable || desktop_change || macosx_console)
*/ */
#endif #endif
if (1) { if (1) {
......
This diff is collapsed.
This diff is collapsed.
[Desktop Entry]
Name=X11VNC Server
Comment=Share this desktop by VNC
Exec=x11vnc -gui tray=setpass -rfbport PROMPT -bg -o %%HOME/.x11vnc.log.%%VNCDISPLAY
Icon=computer
Terminal=false
Type=Application
StartupNotify=false
#StartupWMClass=x11vnc_port_prompt
Categories=Network;RemoteAccess;
...@@ -158,7 +158,6 @@ ...@@ -158,7 +158,6 @@
#endif #endif
/* these are for delaying features: */ /* these are for delaying features: */
#define xxNO_SSL_OR_UNIXPW
#define xxNO_NCACHE #define xxNO_NCACHE
/* /*
......
...@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; ...@@ -15,7 +15,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.6 lastmod: 2008-11-04"; char lastmod[] = "0.9.6 lastmod: 2008-11-22";
/* X display info */ /* X display info */
......
...@@ -35,7 +35,7 @@ int collect_non_X_xdamage(int x_in, int y_in, int w_in, int h_in, int call); ...@@ -35,7 +35,7 @@ int collect_non_X_xdamage(int x_in, int y_in, int w_in, int h_in, int call);
int collect_xdamage(int scancnt, int call); int collect_xdamage(int scancnt, int call);
int xdamage_hint_skip(int y); int xdamage_hint_skip(int y);
void initialize_xdamage(void); void initialize_xdamage(void);
void create_xdamage_if_needed(void); void create_xdamage_if_needed(int force);
void destroy_xdamage_if_needed(void); void destroy_xdamage_if_needed(void);
void check_xdamage_state(void); void check_xdamage_state(void);
...@@ -684,12 +684,12 @@ void initialize_xdamage(void) { ...@@ -684,12 +684,12 @@ void initialize_xdamage(void) {
} }
} }
void create_xdamage_if_needed(void) { void create_xdamage_if_needed(int force) {
RAWFB_RET_VOID RAWFB_RET_VOID
#if LIBVNCSERVER_HAVE_LIBXDAMAGE #if LIBVNCSERVER_HAVE_LIBXDAMAGE
if (! xdamage) { if (! xdamage || force) {
X_LOCK; X_LOCK;
xdamage = XDamageCreate(dpy, window, XDamageReportRawRectangles); xdamage = XDamageCreate(dpy, window, XDamageReportRawRectangles);
XDamageSubtract(dpy, xdamage, None, None); XDamageSubtract(dpy, xdamage, None, None);
...@@ -731,7 +731,7 @@ void check_xdamage_state(void) { ...@@ -731,7 +731,7 @@ void check_xdamage_state(void) {
* one if no clients are connected. * one if no clients are connected.
*/ */
if (client_count && use_xdamage) { if (client_count && use_xdamage) {
create_xdamage_if_needed(); create_xdamage_if_needed(0);
if (xdamage_scheduled_mark > 0.0 && dnow() > if (xdamage_scheduled_mark > 0.0 && dnow() >
xdamage_scheduled_mark) { xdamage_scheduled_mark) {
if (xdamage_scheduled_mark_region) { if (xdamage_scheduled_mark_region) {
......
...@@ -23,7 +23,7 @@ extern int collect_non_X_xdamage(int x_in, int y_in, int w_in, int h_in, int cal ...@@ -23,7 +23,7 @@ extern int collect_non_X_xdamage(int x_in, int y_in, int w_in, int h_in, int cal
extern int collect_xdamage(int scancnt, int call); extern int collect_xdamage(int scancnt, int call);
extern int xdamage_hint_skip(int y); extern int xdamage_hint_skip(int y);
extern void initialize_xdamage(void); extern void initialize_xdamage(void);
extern void create_xdamage_if_needed(void); extern void create_xdamage_if_needed(int force);
extern void destroy_xdamage_if_needed(void); extern void destroy_xdamage_if_needed(void);
extern void check_xdamage_state(void); extern void check_xdamage_state(void);
......
...@@ -134,6 +134,7 @@ static void initialize_xevents(int reset) { ...@@ -134,6 +134,7 @@ static void initialize_xevents(int reset) {
selwin = XCreateSimpleWindow(dpy, rootwin, 0, 0, 1, 1, 0, 0, 0); selwin = XCreateSimpleWindow(dpy, rootwin, 0, 0, 1, 1, 0, 0, 0);
X_UNLOCK; X_UNLOCK;
did_xcreate_simple_window = 1; did_xcreate_simple_window = 1;
if (0) rfbLog("selwin: 0x%lx\n", selwin);
} }
if ((xrandr || xrandr_maybe) && !did_xrandr) { if ((xrandr || xrandr_maybe) && !did_xrandr) {
......
...@@ -32,11 +32,13 @@ Display *rdpy_data = NULL; /* Data connection for RECORD */ ...@@ -32,11 +32,13 @@ Display *rdpy_data = NULL; /* Data connection for RECORD */
Display *rdpy_ctrl = NULL; /* Control connection for RECORD */ Display *rdpy_ctrl = NULL; /* Control connection for RECORD */
Display *gdpy_ctrl = NULL; Display *gdpy_ctrl = NULL;
Display *gdpy_data = NULL;
int xserver_grabbed = 0; int xserver_grabbed = 0;
int trap_record_xerror(Display *, XErrorEvent *); int trap_record_xerror(Display *, XErrorEvent *);
void initialize_xrecord(void); void initialize_xrecord(void);
void zerodisp_xrecord(void);
void shutdown_xrecord(void); void shutdown_xrecord(void);
int xrecord_skip_keysym(rfbKeySym keysym); int xrecord_skip_keysym(rfbKeySym keysym);
int xrecord_skip_button(int new, int old); int xrecord_skip_button(int new, int old);
...@@ -57,7 +59,6 @@ static XRecordContext rc_grab; ...@@ -57,7 +59,6 @@ static XRecordContext rc_grab;
static XRecordClientSpec rcs_grab; static XRecordClientSpec rcs_grab;
#endif #endif
static XErrorEvent *trapped_record_xerror_event; static XErrorEvent *trapped_record_xerror_event;
static Display *gdpy_data = NULL;
static void xrecord_grabserver(int start); static void xrecord_grabserver(int start);
static int xrecord_vi_scroll_keysym(rfbKeySym keysym); static int xrecord_vi_scroll_keysym(rfbKeySym keysym);
...@@ -144,6 +145,13 @@ static void xrecord_grabserver(int start) { ...@@ -144,6 +145,13 @@ static void xrecord_grabserver(int start) {
} }
} }
void zerodisp_xrecord(void) {
rdpy_data = NULL;
rdpy_ctrl = NULL;
gdpy_data = NULL;
gdpy_ctrl = NULL;
}
void initialize_xrecord(void) { void initialize_xrecord(void) {
use_xrecord = 0; use_xrecord = 0;
if (! xrecord_present) { if (! xrecord_present) {
......
...@@ -25,6 +25,7 @@ extern Display *gdpy_ctrl; ...@@ -25,6 +25,7 @@ extern Display *gdpy_ctrl;
extern int xserver_grabbed; extern int xserver_grabbed;
extern void initialize_xrecord(void); extern void initialize_xrecord(void);
extern void zerodisp_xrecord(void);
extern void shutdown_xrecord(void); extern void shutdown_xrecord(void);
extern int xrecord_skip_keysym(rfbKeySym keysym); extern int xrecord_skip_keysym(rfbKeySym keysym);
extern int xrecord_skip_button(int new, int old); extern int xrecord_skip_button(int new, int old);
......
...@@ -189,6 +189,7 @@ Status XShmAttach_wr(Display *disp, XShmSegmentInfo *shminfo) { ...@@ -189,6 +189,7 @@ Status XShmAttach_wr(Display *disp, XShmSegmentInfo *shminfo) {
Status XShmDetach_wr(Display *disp, XShmSegmentInfo *shminfo) { Status XShmDetach_wr(Display *disp, XShmSegmentInfo *shminfo) {
#if LIBVNCSERVER_HAVE_XSHM #if LIBVNCSERVER_HAVE_XSHM
if (getenv("X11VNC_SHM_DEBUG")) fprintf(stderr, "XShmDetach_wr: 0x%x disp: 0x%x\n", shminfo, disp);
return XShmDetach(disp, shminfo); return XShmDetach(disp, shminfo);
#else #else
if (!disp || !shminfo) {} if (!disp || !shminfo) {}
......
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