Commit 067a8816 authored by runge's avatar runge

update to x11vnc 0.9.12

parent ad254469
#!/bin/bash
VERSION="0.9.11"
VERSION="0.9.13"
cd "$(dirname "$0")"
......@@ -33,9 +33,10 @@ echo "" >> Makefile.am
cat Makefile.am.LibVNCServer | \
sed -e "s/^SUBDIRS.*$/#SUBDIRS=libvncserver libvncclient x11vnc classes/" \
-e "s/^DIST_SUBDIRS.*$/#DIST_SUBDIRS=libvncserver libvncclient x11vnc classes/" \
-e "/all: make_config_executable/,\$d" \
-e "/^.*bin_SCRIPTS.*$/d" \
-e "s/include_/noinst_/" \
-e "s/^include_HEADERS/if HAVE_SYSTEM_LIBVNCSERVER^else^include_HEADERS/" \
-e "s/rfbclient\.h/rfbclient.h^endif/" \
| tr '^' '\n' \
>> Makefile.am
mv README README.LibVNCServer
......
......@@ -412,7 +412,7 @@ if (db24 > 2) fprintf(stderr, " check_for_multivis: %.4f\n", now - last_call);
/*
* every 10 seconds we try to clean out and also refresh the window
* info in the the 8bpp window table:
* info in the 8bpp window table:
*/
if (now > last_clear + 10) {
last_clear = now;
......
2010-09-10 Karl Runge <runge@karlrunge.com>
* x11vnc: update classes/ssl jars, patches, and script.
update prepare_x11vnc_dist.sh to 0.9.13. Makefile.am no top_srcdir
Allow user to set avahi name and port via env. vars. Add
avahi_timeout() sigalarm. Rename pointer() to pointer_event()
because Xdefs.h is included for some unknown reason. Add
-always_inject option. Add vnc_reflect_cursor_pos() for -reflect
mode. Attempt at libvncclient VeNCrypt (disabled.) Fix bug
with --with-system-libvncserver missing FinishedFrameBufferUpdate.
More info in VncViewer.class http warning. Look for gdm* in
find display heuristics (e.g. gdm3). More heuristics with
XAUTHLOCALHOSTNAME attempts. X11VNC_CREATE_MAX_DISPLAYS: let user
specify max number of -create displays. FD_USERPREFS modes for
-unixpw (user conf file.) Document all exiting behavior. Let
user set X11VNC_NO_LIMIT_SHM to avoid autoreduction. Look for
kdm when avoiding being killed by dm, change timings too.
2010-05-08 Karl Runge <runge@karlrunge.com>
* x11vnc: set cd->unixname in apply_opts. Print message in
vnc_reflect_resize. Some tweaks to prepare_x11vnc_dist.sh
......
......@@ -30,7 +30,6 @@ INCLUDES_LIBVNCSERVER = @SYSTEM_LIBVNCSERVER_CFLAGS@
else
INCLUDES_LIBVNCSERVER =
endif
INCLUDES = -I$(top_srcdir)
INCLUDES += $(INCLUDES_LIBVNCSERVER) @X_CFLAGS@ @AVAHI_CFLAGS@
INCLUDES = $(INCLUDES_LIBVNCSERVER) @X_CFLAGS@ @AVAHI_CFLAGS@
x11vnc_LDADD=$(LDADD) @SSL_LIBS@ @CRYPT_LIBS@ @X_LIBS@ @AVAHI_LIBS@ $(LD_CYGIPC)
This diff is collapsed.
......@@ -37,7 +37,7 @@ so, delete this exception statement from your version.
#include "cleanup.h"
void avahi_initialise(void);
void avahi_advertise(const char *name, const char *host, const uint16_t port);
void avahi_advertise(char *name, char *host, uint16_t port);
void avahi_reset(void);
void avahi_cleanup(void);
......@@ -45,12 +45,13 @@ static pid_t avahi_pid = 0;
static void kill_avahi_pid(void) {
if (avahi_pid != 0) {
rfbLog("kill_avahi_pid: %d\n", (int) avahi_pid);
kill(avahi_pid, SIGTERM);
avahi_pid = 0;
}
}
static int try_avahi_helper(const char *name, const char *host, const uint16_t port) {
static int try_avahi_helper(char *name, char *host, uint16_t port) {
#if LIBVNCSERVER_HAVE_FORK
char *cmd, *p, *path = getenv("PATH"), portstr[32];
int i;
......@@ -146,7 +147,12 @@ void avahi_initialise(void) {
rfbLog("avahi_initialise: no Avahi support at buildtime.\n");
}
void avahi_advertise(const char *name, const char *host, const uint16_t port) {
void avahi_advertise(char *name, char *host, uint16_t port) {
char *t;
t = getenv("X11VNC_AVAHI_NAME"); if (t) name = t;
t = getenv("X11VNC_AVAHI_HOST"); if (t) host = t;
t = getenv("X11VNC_AVAHI_PORT"); if (t) port = atoi(t);
if (!try_avahi_helper(name, host, port)) {
rfbLog("avahi_advertise: no Avahi support at buildtime.\n");
avahi = 0;
......@@ -243,8 +249,8 @@ if (db) fprintf(stderr, " avahi_initialise: poll not null\n");
if (db) fprintf(stderr, "out avahi_initialise\n");
}
static void _avahi_create_services(const char *name, const char *host,
const uint16_t port);
static void _avahi_create_services(char *name, char *host,
uint16_t port);
static void _avahi_entry_group_callback(AvahiEntryGroup *g,
AvahiEntryGroupState state, void *userdata) {
......@@ -285,12 +291,11 @@ if (db) fprintf(stderr, "in _avahi_entry_group_callback %d 0x%p\n", state, svc)
if (db) fprintf(stderr, "out _avahi_entry_group_callback\n");
}
static void _avahi_create_services(const char *name, const char *host,
const uint16_t port) {
static void _avahi_create_services(char *name, char *host, uint16_t port) {
avahi_service_t *svc = (avahi_service_t *)malloc(sizeof(avahi_service_t));
int ret = 0;
if (db) fprintf(stderr, "in _avahi_create_services %s %s %d\n", name, host, port);
if (db) fprintf(stderr, "in _avahi_create_services '%s' '%s' %d\n", name, host, port);
svc->name = name;
svc->host = host;
svc->port = port;
......@@ -323,9 +328,14 @@ if (db) fprintf(stderr, " _avahi_create_services create group\n");
if (db) fprintf(stderr, "out _avahi_create_services\n");
}
void avahi_advertise(const char *name, const char *host, const uint16_t port) {
void avahi_advertise(char *name, char *host, uint16_t port) {
int i;
if (db) fprintf(stderr, "in avahi_advertise: %s %s %d\n", name, host, port);
char *t;
t = getenv("X11VNC_AVAHI_NAME"); if (t) name = t;
t = getenv("X11VNC_AVAHI_HOST"); if (t) host = t;
t = getenv("X11VNC_AVAHI_PORT"); if (t) port = atoi(t);
if (db) fprintf(stderr, "in avahi_advertise: '%s' '%s' %d\n", name, host, port);
if (!_client) {
if (db) fprintf(stderr, " avahi_advertise client null\n");
return;
......@@ -388,18 +398,34 @@ if (db) fprintf(stderr, " avahi_reset client/group null\n");
if (db) fprintf(stderr, "out avahi_reset\n");
}
static void avahi_timeout (int sig) {
int i;
rfbLog("sig: %d, avahi_cleanup timed out.\n", sig);
exit(1);
}
void avahi_cleanup(void) {
if (db) fprintf(stderr, "in avahi_cleanup\n");
if (!_client) {
if (db) fprintf(stderr, " avahi_cleanup client null\n");
return;
}
if (db) fprintf(stderr, " avahi_cleanup poll_lock\n");
avahi_threaded_poll_lock(_poll);
if (db) fprintf(stderr, " avahi_cleanup poll_stop\n");
signal(SIGALRM, avahi_timeout);
alarm(3);
avahi_threaded_poll_stop(_poll);
alarm(0);
signal(SIGALRM, SIG_DFL);
if (db) fprintf(stderr, " avahi_cleanup client_free\n");
avahi_client_free(_client);
_client = NULL;
if (db) fprintf(stderr, " avahi_cleanup poll_free\n");
avahi_threaded_poll_free(_poll);
_poll = NULL;
if (db) fprintf(stderr, "out avahi_cleanup\n");
......
......@@ -36,7 +36,7 @@ so, delete this exception statement from your version.
/* -- avahi.h -- */
extern void avahi_initialise(void);
extern void avahi_advertise(const char *name, const char *host, const uint16_t port);
extern void avahi_advertise(char *name, char *host, uint16_t port);
extern void avahi_reset(void);
extern void avahi_cleanup(void);
......
......@@ -165,9 +165,6 @@ void clean_up_exit(int ret) {
ssl_helper_pid(0, 0); /* killall */
}
if (avahi) {
avahi_cleanup();
}
if (ssh_pid > 0) {
kill(ssh_pid, SIGTERM);
ssh_pid = 0;
......@@ -242,6 +239,11 @@ void clean_up_exit(int ret) {
rm_flagfile = NULL;
}
if (avahi) {
avahi_cleanup();
fflush(stderr);
}
exit(ret);
}
......
......@@ -932,11 +932,7 @@ void client_gone(rfbClientPtr client) {
kill(gui_pid, SIGTERM);
}
CLIENT_UNLOCK;
if (connect_or_exit) {
clean_up_exit(1);
} else {
clean_up_exit(0);
}
clean_up_exit(0);
}
#ifdef MACOSX
if (macosx_console && client_count == 0) {
......@@ -3149,7 +3145,7 @@ static void pmove(int x, int y) {
return;
}
rfbLog("pmove: x y: %d %d\n", x, y);
pointer(0, x, y, NULL);
pointer_event(0, x, y, NULL);
X_LOCK;
XFlush_wr(dpy);
X_UNLOCK;
......
This diff is collapsed.
......@@ -347,7 +347,7 @@ char *ident_username(rfbClientPtr client) {
if (ret > 0) {
int i;
char *q, *p;
for (i=0; i < sizeof(msg); i++) {
for (i=0; i < (int) sizeof(msg); i++) {
msg[i] = '\0';
}
usleep(250*1000);
......
......@@ -1325,7 +1325,7 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store
* loop over all possible (keycode, group, level) triples
* and record what we find for it:
*/
if (debug_keyboard > 1) {
if (debug_keyboard) {
rfbLog("initialize_xkb_modtweak: XKB keycode -> keysyms "
"mapping info:\n");
}
......@@ -1502,7 +1502,7 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store
xkbignore[kc][grp][lvl] = mods_save | ms2;
}
if (debug_keyboard > 1) {
if (debug_keyboard) {
char *str;
fprintf(stderr, " %03d G%d L%d mod=%s ",
kc, grp+1, lvl+1, bitprint(ms, 8));
......@@ -1560,7 +1560,7 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store
}
free(str);
}
if (debug_keyboard > 1) {
if (debug_keyboard) {
fprintf(stderr, "grp_max=%d lvl_max=%d\n", grp_max, lvl_max);
}
}
......@@ -2898,9 +2898,9 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
t[1] = '\0';
if (sscanf(t, "%d", &butt) == 1) {
mask = 1<<(butt-1);
pointer(mask, x, y, client);
pointer_event(mask, x, y, client);
mask = 0;
pointer(mask, x, y, client);
pointer_event(mask, x, y, client);
}
b++;
}
......
......@@ -725,6 +725,11 @@ sub xfer_both {
}
}
sub fsleep {
my ($time) = @_;
select(undef, undef, undef, $time) if $time;
}
sub cleanup {
close $client_listen if $client_listen;
close $client_listen6 if $client_listen6;
......
......@@ -258,6 +258,7 @@ int cursor_drag_changes = CURSOR_DRAG;
int cursor_pos_updates = 1; /* cursor position updates -cursorpos */
int cursor_shape_updates = 1; /* cursor shape updates -nocursorshape */
int use_xwarppointer = 0; /* use XWarpPointer instead of XTestFake... */
int always_inject = 0; /* inject new mouse coordinates even if dx=dy=0 */
int show_dragging = 1; /* process mouse movement events */
#ifndef WIREFRAME
#define WIREFRAME 1
......
......@@ -222,6 +222,7 @@ extern int cursor_drag_changes;
extern int cursor_pos_updates;
extern int cursor_shape_updates;
extern int use_xwarppointer;
extern int always_inject;
extern int show_dragging;
extern int wireframe;
extern int wireframe_local;
......
......@@ -54,7 +54,7 @@ int pointer_queued_sent = 0;
void initialize_pointer_map(char *pointer_remap);
void do_button_mask_change(int mask, int button);
void pointer(int mask, int x, int y, rfbClientPtr client);
void pointer_event(int mask, int x, int y, rfbClientPtr client);
void initialize_pipeinput(void);
int check_pipeinput(void);
void update_x11_pointer_position(int x, int y);
......@@ -342,20 +342,11 @@ void update_x11_pointer_position(int x, int y) {
return;
#else
int rc;
static int watch_dx_dy = -1;
RAWFB_RET_VOID
if (watch_dx_dy == -1) {
if (getenv("X11VNC_WATCH_DX_DY")) {
watch_dx_dy = 1;
} else {
watch_dx_dy = 0;
}
}
X_LOCK;
if (watch_dx_dy && cursor_x == x && cursor_y == y) {
if (!always_inject && cursor_x == x && cursor_y == y) {
;
} else if (use_xwarppointer) {
/*
......@@ -668,7 +659,7 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) {
* This may queue pointer events rather than sending them immediately
* to the X server. (see update_x11_pointer*())
*/
void pointer(int mask, int x, int y, rfbClientPtr client) {
void pointer_event(int mask, int x, int y, rfbClientPtr client) {
allowed_input_t input;
int sent = 0, buffer_it = 0;
double now;
......
......@@ -39,7 +39,7 @@ extern int pointer_queued_sent;
extern void initialize_pointer_map(char *pointer_remap);
extern void do_button_mask_change(int mask, int button);
extern void pointer(int mask, int x, int y, rfbClientPtr client);
extern void pointer_event(int mask, int x, int y, rfbClientPtr client);
extern int check_pipeinput(void);
extern void initialize_pipeinput(void);
extern void update_x11_pointer_position(int x, int y);
......
......@@ -3443,6 +3443,24 @@ char *process_remote_cmd(char *cmd, int stringonly) {
use_xwarppointer = 0;
goto done;
}
if (strstr(p, "always_inject") == p) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, always_inject);
goto qry;
}
rfbLog("remote_cmd: turning on always_inject mode.\n");
always_inject = 1;
goto done;
}
if (strstr(p, "noalways_inject") == p) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !always_inject);
goto qry;
}
rfbLog("remote_cmd: turning off always_inject mode.\n");
always_inject = 0;
goto done;
}
if (strstr(p, "buttonmap") == p) {
COLON_CHECK("buttonmap:")
if (query) {
......@@ -4426,9 +4444,9 @@ char *process_remote_cmd(char *cmd, int stringonly) {
p += strlen("ptr:");
rfbLog("remote_cmd: insert pointer event: %s\n", p);
if (sscanf(p, "%d,%d,%d", &x, &y, &m) == 3) {
pointer(m, x, y, NULL);
pointer_event(m, x, y, NULL);
} else if (sscanf(p, "%d,%d", &x, &y) == 2) {
pointer(m, x, y, NULL);
pointer_event(m, x, y, NULL);
} else {
rfbLog("remote_cmd: bad ptr:x,y,mask\n");
}
......@@ -4593,7 +4611,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (strstr(res, "GRAB_FAIL") && try < max_tries) {
rfbLog("bcx_xattach: failed grab check for '%s': %s. Retrying[%d]...\n", p, res, try);
free(res);
pointer(0, dpy_x/2 + try, dpy_y/2 + try, NULL);
pointer_event(0, dpy_x/2 + try, dpy_y/2 + try, NULL);
#if !NO_X11
X_LOCK;
XFlush_wr(dpy);
......
......@@ -3550,7 +3550,7 @@ int scan_for_updates(int count_only) {
fb_copy_in_progress = 0;
SCAN_FATAL(cs);
if (use_threads && pointer_mode != 1) {
pointer(-1, 0, 0, NULL);
pointer_event(-1, 0, 0, NULL);
}
nap_check(tile_count);
return tile_count;
......@@ -3637,7 +3637,7 @@ if (tile_count) fprintf(stderr, "XX copytile: %.4f tile_count: %d\n", dnow() -
* tell the pointer handler it can process any queued
* pointer events:
*/
pointer(-1, 0, 0, NULL);
pointer_event(-1, 0, 0, NULL);
}
if (blackouts) {
......
......@@ -1265,6 +1265,28 @@ void vnc_reflect_got_cursorshape(rfbClient *cl, int xhot, int yhot, int width, i
set_cursor(cursor_x, cursor_y, get_which_cursor());
}
rfbBool vnc_reflect_cursor_pos(rfbClient *cl, int x, int y) {
if (cl) {}
if (debug_pointer) {
rfbLog("vnc_reflect_cursor_pos: %d %d\n", x, y);
}
if (unixpw_in_progress) {
if (debug_pointer) {
rfbLog("vnc_reflect_cursor_pos: unixpw_in_progress%d\n", unixpw_in_progress);
}
return TRUE;
}
if (! all_clients_initialized()) {
rfbLog("vnc_reflect_cursor_pos: no send: uninitialized clients\n");
return TRUE; /* some clients initializing, cannot send */
}
cursor_position(x, y);
set_cursor(x, y, get_which_cursor());
return TRUE;
}
static void from_libvncclient_CopyRectangleFromRectangle(rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y) {
int i,j;
......@@ -1350,6 +1372,49 @@ rfbBool vnc_reflect_resize(rfbClient *cl) {
return cl->frameBuffer ? TRUE : FALSE;
}
#ifdef rfbCredentialTypeX509
static rfbCredential* vnc_reflect_get_credential(rfbClient* client, int type) {
char *pass = getenv("X11VNC_REFLECT_PASSWORD");
char *user = getenv("X11VNC_REFLECT_USER");
char *cert = getenv("X11VNC_REFLECT_CACERT");
char *ccrl = getenv("X11VNC_REFLECT_CACRL");
char *clic = getenv("X11VNC_REFLECT_CLIENTCERT");
char *clik = getenv("X11VNC_REFLECT_CLIENTKEY");
int db = 0;
if (client) {}
if (db) fprintf(stderr, "type: %d\n", type);
#ifdef rfbCredentialTypeUser
if (type == rfbCredentialTypeUser) {
if (!pass && !user) {
return NULL;
} else {
rfbCredential *rc = (rfbCredential *) calloc(sizeof(rfbCredential), 1);
rc->userCredential.username = (user ? strdup(user) : NULL);
rc->userCredential.password = (pass ? strdup(pass) : NULL);
return rc;
}
}
#endif
if (type == rfbCredentialTypeX509) {
if (db) fprintf(stderr, "cert: %s\n", cert);
if (db) fprintf(stderr, "ccrl: %s\n", ccrl);
if (db) fprintf(stderr, "clic: %s\n", clic);
if (db) fprintf(stderr, "clik: %s\n", clik);
if (!cert && !ccrl && !clic && !clik) {
return NULL;
} else {
rfbCredential *rc = (rfbCredential *) calloc(sizeof(rfbCredential), 1);
rc->x509Credential.x509CACertFile = (cert ? strdup(cert) : NULL);
rc->x509Credential.x509CACrlFile = (ccrl ? strdup(ccrl) : NULL);
rc->x509Credential.x509ClientCertFile = (clic ? strdup(clic) : NULL);
rc->x509Credential.x509ClientKeyFile = (clik ? strdup(clik) : NULL);
return rc;
}
}
return NULL;
}
#endif
static char* vnc_reflect_get_password(rfbClient* client) {
char *q, *p, *str = getenv("X11VNC_REFLECT_PASSWORD");
int len = 110;
......@@ -1408,17 +1473,32 @@ char *vnc_reflect_guess(char *str, char **raw_fb_addr) {
}
client->appData.useRemoteCursor = TRUE;
client->canHandleNewFBSize = TRUE;
client->HandleCursorPos = vnc_reflect_cursor_pos;
client->GotFrameBufferUpdate = vnc_reflect_got_update;
client->MallocFrameBuffer = vnc_reflect_resize;
client->Bell = vnc_reflect_bell;
#if 0
client->SoftCursorLockArea = NULL;
client->SoftCursorUnlockScreen = NULL;
client->FinishedFrameBufferUpdate = NULL;
client->HandleKeyboardLedState = NULL;
client->HandleTextChat = NULL;
#endif
client->GotXCutText = vnc_reflect_recv_cuttext;
client->GotCopyRect = vnc_reflect_got_copyrect;
client->GotCursorShape = vnc_reflect_got_cursorshape;
client->MallocFrameBuffer = vnc_reflect_resize;
client->canHandleNewFBSize = TRUE;
client->GotFrameBufferUpdate = vnc_reflect_got_update;
client->GotCopyRect = vnc_reflect_got_copyrect;
if (getenv("X11VNC_REFLECT_PASSWORD")) {
client->GetPassword = vnc_reflect_get_password;
}
#ifdef rfbCredentialTypeX509
client->GetCredential = NULL;
if (0 || getenv("LIBVNCCLIENT_GET_CREDENTIAL")) {
client->GetCredential = vnc_reflect_get_credential;
}
#endif
if (first) {
argv[argc++] = "x11vnc_rawfb_vnc";
......@@ -3538,7 +3618,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
/* event callbacks: */
screen->newClientHook = new_client;
screen->kbdAddEvent = keyboard;
screen->ptrAddEvent = pointer;
screen->ptrAddEvent = pointer_event;
screen->setXCutText = xcut_receive;
screen->setTranslateFunction = set_xlate_wrapper;
......
......@@ -4009,7 +4009,11 @@ void accept_openssl(int mode, int presock) {
rfbLog("helper[%d]:\n", pid);
rfbLog("***********************************************************\n");
rfbLog("SSL: WARNING CLIENT ASKED FOR NONEXISTENT 'VncViewer.class'\n");
rfbLog("SSL: USER NEEDS TO **RESTART** HIS WEB BROWSER.\n");
rfbLog("SSL: USER NEEDS TO MAKE SURE THE JAVA PLUGIN IS INSTALLED\n");
rfbLog("SSL: AND WORKING PROPERLY (e.g. a test-java-plugin page.)\n");
rfbLog("SSL: AND/OR USER NEEDS TO **RESTART** HIS WEB BROWSER.\n");
rfbLog("SSL: SOMETIMES THE BROWSER 'REMEMBERS' FAILED APPLET DOWN-\n");
rfbLog("SSL: LOADS AND RESTARTING IT IS THE ONLY WAY TO FIX THINGS.\n");
rfbLog("***********************************************************\n");
rfbLog("\n");
}
......
......@@ -1151,7 +1151,7 @@ char find_display[] =
" list=\"$list \"`xauth list | awk '{print $1}' | grep /unix | grep \"^${host}\" | sed -e 's/^.*:/:/' | sort -n | uniq`\n"
"\n"
" # check for gdm and kdm non-NFS cookies in /tmp: (and now /var/run/gdm)\n"
" for xa in /tmp/.gdm* /tmp/.Xauth* /var/run/gdm/auth-for-*/database /var/run/gdm/auth-cookie-*-for-*\n"
" for xa in /tmp/.gdm* /tmp/.Xauth* /var/run/gdm*/auth-for-*/database /var/run/gdm*/auth-cookie-*-for-*\n"
" do\n"
" # try to be somewhat careful about the real owner of the file:\n"
" if [ \"X$am_root\" = \"X1\" ]; then\n"
......@@ -1307,16 +1307,34 @@ char find_display[] =
" if [ \"X$p\" = \"X\" ]; then\n"
" continue\n"
" fi\n"
"\n"
" env \"$myenv\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" rc=$?\n"
" if [ $rc != 0 -a \"X$XAUTHLOCALHOSTNAME\" = \"X\" ]; then\n"
"\n"
" if [ $rc != 0 ]; then\n"
" # guard against libxcb/desktop silliness: \n"
" env \"$myenv\" XAUTHLOCALHOSTNAME=localhost xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" rc=$?\n"
" if [ $rc = 0 ]; then\n"
" # better export it for cmds below...\n"
" XAUTHLOCALHOSTNAME=localhost\n"
" export XAUTHLOCALHOSTNAME\n"
" xalhn_save=$XAUTHLOCALHOSTNAME\n"
"\n"
" if [ \"X$xalhn_save\" != \"X\" ]; then\n"
" # try it again unset\n"
" unset XAUTHLOCALHOSTNAME\n"
" env \"$myenv\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" rc=$?\n"
" if [ $rc != 0 ]; then\n"
" # did not work; put it back\n"
" XAUTHLOCALHOSTNAME=$xalhn_save\n"
" export XAUTHLOCALHOSTNAME\n"
" fi\n"
" fi\n"
" if [ $rc != 0 -a \"X$xalhn_save\" != \"Xlocalhost\" ]; then\n"
" # try it again with localhost\n"
" env \"$myenv\" XAUTHLOCALHOSTNAME=localhost xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" rc=$?\n"
" if [ $rc = 0 ]; then\n"
" # better export it for cmds below...\n"
" XAUTHLOCALHOSTNAME=localhost\n"
" export XAUTHLOCALHOSTNAME\n"
" fi\n"
" fi\n"
" fi\n"
"\n"
......@@ -1460,11 +1478,14 @@ char create_display[] =
"\n"
"findfree() {\n"
" try=20\n"
" sry=99\n"
" dpymax=79\n"
" if [ \"X$X11VNC_CREATE_STARTING_DISPLAY_NUMBER\" != \"X\" ]; then\n"
" try=$X11VNC_CREATE_STARTING_DISPLAY_NUMBER\n"
" sry=`expr $try + 99`\n"
" fi\n"
" if [ \"X$X11VNC_CREATE_MAX_DISPLAYS\" != \"X\" ]; then\n"
" dpymax=$X11VNC_CREATE_MAX_DISPLAYS\n"
" fi\n"
" sry=`expr $try + $dpymax`\n"
" n=\"\"\n"
" nsout=\"\"\n"
" if [ \"X$have_netstat\" != \"X\" ]; then\n"
......
......@@ -238,6 +238,7 @@ Pointer
buttonmap:
--
xwarppointer
always_inject
Misc
=GD-C:full,icon,tray WindowView:
......
......@@ -249,6 +249,7 @@ char gui_code[] = "";
" buttonmap:\n"
" --\n"
" xwarppointer\n"
" always_inject\n"
"\n"
"Misc\n"
" =GD-C:full,icon,tray WindowView:\n"
......
......@@ -1512,6 +1512,52 @@ static void progress_skippy(void) {
usleep(50*1000);
}
void check_unixpw_userprefs(void) {
char *prefs = getenv("FD_USERPREFS");
if (keep_unixpw_user == NULL || keep_unixpw_opts == NULL) {
return;
}
#if LIBVNCSERVER_HAVE_PWD_H
if (prefs != NULL && !strchr(prefs, '/')) {
struct passwd *pw = getpwnam(keep_unixpw_user);
if (pw != NULL) {
char *file;
FILE *f;
file = (char *) malloc(strlen(pw->pw_dir) + 1 + strlen(prefs) + 1);
sprintf(file, "%s/%s", pw->pw_dir, prefs);
f = fopen(file, "r");
if (f) {
char *t, *q, buf[1024];
memset(buf, 0, sizeof(buf));
fgets(buf, 1024, f);
fclose(f);
q = strchr(buf, '\n');
if (q) *q = '\0';
q = strchr(buf, '\r');
if (q) *q = '\0';
rfbLog("read user prefs %s: %s\n", file, buf);
if (buf[0] == '#') buf[0] = '\0';
t = (char *) malloc(strlen(keep_unixpw_opts) + 1 + strlen(buf) + 1);
sprintf(t, "%s,%s", keep_unixpw_opts, buf);
free(keep_unixpw_opts);
keep_unixpw_opts = t;
} else {
rfbLog("could not read user prefs %s\n", file);
rfbLogPerror("fopen");
}
free(file);
}
}
#endif
}
void unixpw_verify_screen(char *user, char *pass) {
int x, y;
......@@ -1569,7 +1615,9 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "***
} else {
keep_unixpw_opts = strdup("");
}
check_unixpw_userprefs();
}
if (colon) *colon = ':';
return;
......@@ -1759,6 +1807,7 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
} else {
keep_unixpw_opts = strdup("");
}
check_unixpw_userprefs();
}
unixpw_system_greeter_active = 2;
set_env("X11VNC_XDM_ONLY", "1");
......
......@@ -1985,8 +1985,9 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
fdxdmcpif[0] = '\0';
cdout[0] = '\0';
if (unixpw && keep_unixpw_opts && keep_unixpw_opts[0] != '\0') {
if (unixpw && keep_unixpw_opts && !getenv("X11VNC_NO_UNIXPW_OPTS")) {
char *q, *p, *t = strdup(keep_unixpw_opts);
if (strstr(t, "gnome")) {
sprintf(fdsess, "gnome");
} else if (strstr(t, "kde")) {
......
......@@ -3008,7 +3008,7 @@ if (db) fprintf(stderr, "check_xrecord: BUTTON-UP-KEEP-GOING: %.3f/%.3f %d/%d %
pointer_queued_sent = 0;
last_x = cursor_x;
last_y = cursor_y;
pointer(-1, 0, 0, NULL);
pointer_event(-1, 0, 0, NULL);
pointer_flush_delay = 0.0;
if (xrecording && pointer_queued_sent && button_mask_save &&
......@@ -4565,7 +4565,7 @@ if (db) fprintf(stderr, "INTERIOR\n");
/* -threads support for check_wireframe() is rough... crash? */
if (use_threads) {
/* purge any stored up pointer events: */
pointer(-1, 0, 0, NULL);
pointer_event(-1, 0, 0, NULL);
}
if (cursor_noshape_updates_clients(screen)) {
......
This diff is collapsed.
......@@ -992,6 +992,9 @@ static int limit_shm(void) {
if (UT.sysname == NULL) {
return 0;
}
if (getenv("X11VNC_NO_LIMIT_SHM")) {
return 0;
}
if (!strcmp(UT.sysname, "SunOS")) {
char *r = UT.release;
if (*r == '5' && *(r+1) == '.') {
......@@ -1554,6 +1557,7 @@ static void print_settings(int try_http, int bg, char *gui_str) {
fprintf(stderr, " cursorshape:%d\n", cursor_shape_updates);
fprintf(stderr, " cursorpos: %d\n", cursor_pos_updates);
fprintf(stderr, " xwarpptr: %d\n", use_xwarppointer);
fprintf(stderr, " alwaysinj: %d\n", always_inject);
fprintf(stderr, " buttonmap: %s\n", pointer_remap
? pointer_remap : "null");
fprintf(stderr, " dragging: %d\n", show_dragging);
......@@ -2280,7 +2284,7 @@ int main(int argc, char* argv[]) {
}
if (!strcmp(arg, "-reflect")) {
CHECK_ARGC
raw_fb_str = (char *) malloc(4 + strlen(argv[i]) + 1);
raw_fb_str = (char *) malloc(4 + strlen(argv[i+1]) + 1);
sprintf(raw_fb_str, "vnc:%s", argv[++i]);
shared = 1;
continue;
......@@ -3397,6 +3401,10 @@ int main(int argc, char* argv[]) {
got_noxwarppointer = 1;
continue;
}
if (!strcmp(arg, "-always_inject")) {
always_inject = 1;
continue;
}
if (!strcmp(arg, "-buttonmap")) {
CHECK_ARGC
pointer_remap = strdup(argv[++i]);
......
......@@ -47,7 +47,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.11 lastmod: 2010-05-08";
char lastmod[] = "0.9.13 lastmod: 2010-09-10";
/* X display info */
......
......@@ -148,25 +148,34 @@ void initialize_clipboard_atom(void) {
18 gdm_string: Gdm-simple-greeter
24 gdm_string: metacity
36 gdm_string: gdm-simple-greeter
kdmgreet
Kdmgreet
*/
static int gdm_string(char *str) {
static int dm_string(char *str) {
char *s = getenv("DEBUG_WM_RUNNING");
if (str == NULL) {
return 0;
}
if (str[0] == '\0') {
return 0;
}
if (0) fprintf(stderr, "gdm_string: %s\n", str);
if (0) fprintf(stderr, "dm_string: %s\n", str);
if (strstr(str, "gdm-") == str || strstr(str, "Gdm-") == str) {
if (strstr(str, "-greeter") != NULL) {
if (s) rfbLog("dm_string: %s\n", str);
return 1;
}
}
if (!strcmp(str, "kdmgreet") || !strcmp(str, "Kdmgreet")) {
if (s) rfbLog("dm_string: %s\n", str);
return 1;
}
return 0;
}
static int gdm_still_running(void) {
static int dm_still_running(void) {
#if NO_X11
return 0;
#else
......@@ -195,7 +204,7 @@ static int gdm_still_running(void) {
char *name = NULL;
Window w = winlist[i];
if (XFetchName(dpy, w, &name) && name != NULL) {
saw_gdm_name += gdm_string(name);
saw_gdm_name += dm_string(name);
XFree_wr(name);
}
classhint->res_name = NULL;
......@@ -203,12 +212,12 @@ static int gdm_still_running(void) {
if (XGetClassHint(dpy, w, classhint)) {
name = classhint->res_name;
if (name != NULL) {
saw_gdm_name += gdm_string(name);
saw_gdm_name += dm_string(name);
XFree_wr(name);
}
name = classhint->res_class;
if (name != NULL) {
saw_gdm_name += gdm_string(name);
saw_gdm_name += dm_string(name);
XFree_wr(name);
}
}
......@@ -230,6 +239,7 @@ static int gdm_still_running(void) {
static int wm_running(void) {
char *s = getenv("DEBUG_WM_RUNNING");
int ret = 0;
RAWFB_RET(0)
#if NO_X11
return 0;
......@@ -238,30 +248,36 @@ static int wm_running(void) {
* Unfortunately with recent GDM (v2.28), they run gnome-session,
* dbus-launch, and metacity for the Login greeter! So the simple
* XInternAtom checks below no longer work.
* We also see a similar thing with KDE.
*/
if (gdm_still_running()) {
if (dm_still_running()) {
return 0;
}
/* we are xlocked. */
if (XInternAtom(dpy, "_NET_SUPPORTED", True) != None) {
if (s) rfbLog("wm is running (_NET_SUPPORTED).\n");
return 1;
ret++;
}
if (XInternAtom(dpy, "_WIN_PROTOCOLS", True) != None) {
if (s) rfbLog("wm is running (_WIN_PROTOCOLS).\n");
return 1;
ret++;
}
if (XInternAtom(dpy, "_XROOTPMAP_ID", True) != None) {
if (s) rfbLog("wm is running (_XROOTPMAP_ID).\n");
return 1;
ret++;
}
if (XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True) != None) {
if (s) rfbLog("wm is running (_MIT_PRIORITY_COLORS).\n");
ret++;
}
if (!ret) {
if (s) rfbLog("wm is not running.\n");
return 0;
} else {
if (s) rfbLog("wm is running ret=%d.\n", ret);
return 1;
}
if (s) rfbLog("wm is not running.\n");
return 0;
#endif /* NO_X11 */
}
......@@ -307,6 +323,9 @@ int guess_dm_gone(int t1, int t2) {
}
X_UNLOCK;
}
if (getenv("DEBUG_WM_RUNNING")) {
rfbLog("guess_dm_gone: wait=%d\n", wait);
}
/* we assume they've logged in OK after wait seconds... */
if (time(NULL) <= tcheck + wait) {
return 0;
......@@ -365,7 +384,7 @@ static void initialize_xevents(int reset) {
* We try to delay creating selwin until we are past
* any GDM, (or other KillInitClients=true) manager.
*/
if (guess_dm_gone(5, 45)) {
if (guess_dm_gone(8, 45)) {
X_LOCK;
selwin = XCreateSimpleWindow(dpy, rootwin, 3, 2, 1, 1, 0, 0, 0);
X_UNLOCK;
......@@ -400,7 +419,7 @@ static void initialize_xevents(int reset) {
* we are past the display manager, due to Xorg bug:
* http://bugs.freedesktop.org/show_bug.cgi?id=18451
*/
if (guess_dm_gone(5, 45)) {
if (guess_dm_gone(8, 45)) {
initialize_xfixes();
did_xfixes = 1;
if (! quiet) rfbLog("called initialize_xfixes()\n");
......
......@@ -1320,22 +1320,25 @@ Display *XOpenDisplay_wr(char *display_name) {
d = XOpenDisplay(display_name);
if (db) fprintf(stderr, "XOpenDisplay_wr: %s %p\n", display_name, (void *)d);
if (d == NULL) {
if (!getenv("NO_XAUTHLOCALHOSTNAME")) {
if (!getenv("XAUTHLOCALHOSTNAME")) {
if (d == NULL && !getenv("NO_XAUTHLOCALHOSTNAME")) {
char *xalhn = getenv("XAUTHLOCALHOSTNAME");
if (1 || !xalhn) {
rfbLog("XOpenDisplay(\"%s\") failed.\n",
display_name ? display_name : "");
rfbLog("Trying again with XAUTHLOCALHOSTNAME=localhost ...\n");
set_env("XAUTHLOCALHOSTNAME", "localhost");
d = XOpenDisplay(display_name);
if (0) {
if (d == NULL && xalhn) {
char *ptr = getenv("XAUTHLOCALHOSTNAME");
if (ptr) {
*(ptr-2) = '_'; /* yow */
rfbLog("XOpenDisplay(\"%s\") failed.\n",
display_name ? display_name : "");
rfbLog("Trying again with unset XAUTHLOCALHOSTNAME ...\n");
d = XOpenDisplay(display_name);
}
}
}
}
}
xauth_raw(0);
......
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