Commit 7b933e17 authored by runge's avatar runge

configure.ac: HP-UX and OSF1 no -R, x11vnc: second round of beta-testing fixes.

parent 543e64d3
2005-06-18 Karl Runge <runge@karlrunge.com>
* configure.ac: don't use -R on HP-UX and OSF1.
* x11vnc: don't free the current cursor, close stderr
for -inetd -q and no -o logfile, set DISPLAY for -solid
external calls.
2005-06-14 Karl Runge <runge@karlrunge.com> 2005-06-14 Karl Runge <runge@karlrunge.com>
* configure.ac: XReadScreen and XReadDisplay checks. * configure.ac: XReadScreen and XReadDisplay checks.
* libvncserver/cursor.c: fix unsigned long crash for 64bits. * libvncserver/cursor.c: fix unsigned long crash for 64bits.
......
...@@ -184,7 +184,12 @@ if test "x$with_jpeg" != "xno"; then ...@@ -184,7 +184,12 @@ if test "x$with_jpeg" != "xno"; then
saved_LDFLAGS="$LDFLAGS" saved_LDFLAGS="$LDFLAGS"
CPPFLAGS="$CPPFLAGS -I$with_jpeg/include" CPPFLAGS="$CPPFLAGS -I$with_jpeg/include"
LDFLAGS="$LDFLAGS -L$with_jpeg/lib" LDFLAGS="$LDFLAGS -L$with_jpeg/lib"
if test "x$GCC" = "xyes"; then uname_s=`(uname -s) 2>/dev/null`
if test "x$uname_s" = "xHP-UX"; then
:
elif test "x$uname_s" = "xOSF1"; then
:
elif test "x$GCC" = "xyes"; then
# this is not complete... in general a rat's nest. # this is not complete... in general a rat's nest.
LDFLAGS="$LDFLAGS -Xlinker -R$with_jpeg/lib" LDFLAGS="$LDFLAGS -Xlinker -R$with_jpeg/lib"
else else
...@@ -229,7 +234,12 @@ if test "x$with_zlib" != "xno" -a "x$with_libz" != "xno"; then ...@@ -229,7 +234,12 @@ if test "x$with_zlib" != "xno" -a "x$with_libz" != "xno"; then
saved_LDFLAGS="$LDFLAGS" saved_LDFLAGS="$LDFLAGS"
CPPFLAGS="$CPPFLAGS -I$with_zlib/include" CPPFLAGS="$CPPFLAGS -I$with_zlib/include"
LDFLAGS="$LDFLAGS -L$with_zlib/lib" LDFLAGS="$LDFLAGS -L$with_zlib/lib"
if test "x$GCC" = "xyes"; then uname_s=`(uname -s) 2>/dev/null`
if test "x$uname_s" = "xHP-UX"; then
:
elif test "x$uname_s" = "xOSF1"; then
:
elif test "x$GCC" = "xyes"; then
LDFLAGS="$LDFLAGS -Xlinker -R$with_zlib/lib" LDFLAGS="$LDFLAGS -Xlinker -R$with_zlib/lib"
else else
LDFLAGS="$LDFLAGS -R$with_zlib/lib" LDFLAGS="$LDFLAGS -R$with_zlib/lib"
......
2005-06-18 Karl Runge <runge@karlrunge.com>
* clean up some malloc/free problems (don't free the current cursor)
* set DISPLAY before calling gconf, dcop under -solid
* -inetd -q and no -o logfile implies closing stderr.
2005-06-14 Karl Runge <runge@karlrunge.com> 2005-06-14 Karl Runge <runge@karlrunge.com>
* -DNOGUI and -DVIEWONLY build options * -DNOGUI and -DVIEWONLY build options
* -noskip_dups the default (windows viewer sends no ups when * -noskip_dups the default (windows viewer sends no ups when
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.TH X11VNC "1" "June 2005" "x11vnc " "User Commands" .TH X11VNC "1" "June 2005" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.7.2, lastmod: 2005-06-14 version: 0.7.2, lastmod: 2005-06-18
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
...@@ -246,8 +246,10 @@ Launched by ...@@ -246,8 +246,10 @@ Launched by
.IR inetd (1): .IR inetd (1):
stdio instead of listening socket. stdio instead of listening socket.
Note: if you are not redirecting stderr to a log file Note: if you are not redirecting stderr to a log file
(via shell 2> or \fB-o\fR option) you must also specify the (via shell 2> or \fB-o\fR option) you must also specify the \fB-q\fR
\fB-q\fR option, otherwise the stderr goes to the viewer. option, otherwise the stderr goes to the viewer which
will cause it to abort. Specifying both \fB-inetd\fR and \fB-q\fR
and no \fB-o\fR will automatically close the stderr.
.PP .PP
\fB-http\fR \fB-http\fR
.IP .IP
......
...@@ -382,7 +382,7 @@ double xdamage_scheduled_mark = 0.0; ...@@ -382,7 +382,7 @@ double xdamage_scheduled_mark = 0.0;
sraRegionPtr xdamage_scheduled_mark_region = NULL; sraRegionPtr xdamage_scheduled_mark_region = NULL;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.7.2 lastmod: 2005-06-14"; char lastmod[] = "0.7.2 lastmod: 2005-06-18";
int hack_val = 0; int hack_val = 0;
/* X display info */ /* X display info */
...@@ -1262,6 +1262,9 @@ int parse_geom(char *str, int *wp, int *hp, int *xp, int *yp, int W, int H) { ...@@ -1262,6 +1262,9 @@ int parse_geom(char *str, int *wp, int *hp, int *xp, int *yp, int W, int H) {
void set_env(char *name, char *value) { void set_env(char *name, char *value) {
char *str; char *str;
if (!value) {
value = "";
}
str = (char *) malloc(strlen(name)+strlen(value)+2); str = (char *) malloc(strlen(name)+strlen(value)+2);
sprintf(str, "%s=%s", name, value); sprintf(str, "%s=%s", name, value);
putenv(str); putenv(str);
...@@ -2343,7 +2346,9 @@ char *ident_username(rfbClientPtr client) { ...@@ -2343,7 +2346,9 @@ char *ident_username(rfbClientPtr client) {
newuser = strdup("unknown-user"); newuser = strdup("unknown-user");
} }
if (cd) { if (cd) {
free(cd->username); if (cd->username) {
free(cd->username);
}
cd->username = newuser; cd->username = newuser;
} }
user = newuser; user = newuser;
...@@ -4139,6 +4144,7 @@ void record_switch(XPointer ptr, XRecordInterceptData *rec_data) { ...@@ -4139,6 +4144,7 @@ void record_switch(XPointer ptr, XRecordInterceptData *rec_data) {
void record_grab(XPointer ptr, XRecordInterceptData *rec_data) { void record_grab(XPointer ptr, XRecordInterceptData *rec_data) {
xReq *req; xReq *req;
int db = 0;
/* should handle control msgs, start/stop/etc */ /* should handle control msgs, start/stop/etc */
if (rec_data->category == XRecordStartOfData) { if (rec_data->category == XRecordStartOfData) {
...@@ -4163,7 +4169,7 @@ void record_grab(XPointer ptr, XRecordInterceptData *rec_data) { ...@@ -4163,7 +4169,7 @@ void record_grab(XPointer ptr, XRecordInterceptData *rec_data) {
if (req->reqType == X_GrabServer) { if (req->reqType == X_GrabServer) {
double now = dnow() - x11vnc_start; double now = dnow() - x11vnc_start;
xserver_grabbed++; xserver_grabbed++;
if (0) rfbLog("X server Grabbed: %d %.5f\n", xserver_grabbed, now); if (db) rfbLog("X server Grabbed: %d %.5f\n", xserver_grabbed, now);
if (xserver_grabbed > 1) { if (xserver_grabbed > 1) {
/* /*
* some apps do multiple grabs... very unlikely * some apps do multiple grabs... very unlikely
...@@ -4177,7 +4183,7 @@ void record_grab(XPointer ptr, XRecordInterceptData *rec_data) { ...@@ -4177,7 +4183,7 @@ void record_grab(XPointer ptr, XRecordInterceptData *rec_data) {
if (xserver_grabbed < 0) { if (xserver_grabbed < 0) {
xserver_grabbed = 0; xserver_grabbed = 0;
} }
if (0) rfbLog("X server Un-Grabbed: %d %.5f\n", xserver_grabbed, now); if (db) rfbLog("X server Un-Grabbed: %d %.5f\n", xserver_grabbed, now);
} else { } else {
; ;
} }
...@@ -5562,7 +5568,7 @@ static int run_user_command(char *cmd, rfbClientPtr client, char *mode) { ...@@ -5562,7 +5568,7 @@ static int run_user_command(char *cmd, rfbClientPtr client, char *mode) {
} else { } else {
char *sip = get_local_host(client->sock); char *sip = get_local_host(client->sock);
set_env("RFB_SERVER_IP", sip); set_env("RFB_SERVER_IP", sip);
free(sip); if (sip) free(sip);
} }
if (cd && cd->server_port > 0) { if (cd && cd->server_port > 0) {
...@@ -5649,15 +5655,19 @@ static void client_gone(rfbClientPtr client) { ...@@ -5649,15 +5655,19 @@ static void client_gone(rfbClientPtr client) {
if (cd) { if (cd) {
if (cd->server_ip) { if (cd->server_ip) {
free(cd->server_ip); free(cd->server_ip);
cd->server_ip = NULL;
} }
if (cd->hostname) { if (cd->hostname) {
free(cd->hostname); free(cd->hostname);
cd->hostname = NULL;
} }
if (cd->username) { if (cd->username) {
free(cd->username); free(cd->username);
cd->username = NULL;
} }
} }
free(client->clientData); free(client->clientData);
client->clientData = NULL;
} }
if (inetd) { if (inetd) {
...@@ -8697,9 +8707,11 @@ void initialize_allowed_input(void) { ...@@ -8697,9 +8707,11 @@ void initialize_allowed_input(void) {
if (allowed_input_normal) { if (allowed_input_normal) {
free(allowed_input_normal); free(allowed_input_normal);
allowed_input_normal = NULL;
} }
if (allowed_input_view_only) { if (allowed_input_view_only) {
free(allowed_input_view_only); free(allowed_input_view_only);
allowed_input_view_only = NULL;
} }
if (! allowed_input_str) { if (! allowed_input_str) {
...@@ -12956,7 +12968,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -12956,7 +12968,9 @@ char *process_remote_cmd(char *cmd, int stringonly) {
if (is_loopback) { if (is_loopback) {
rfbLog("re-setting -allow list to all " rfbLog("re-setting -allow list to all "
"hosts for non-loopback listening.\n"); "hosts for non-loopback listening.\n");
free(allow_list); if (allow_list) {
free(allow_list);
}
allow_list = NULL; allow_list = NULL;
} }
} else { } else {
...@@ -16216,22 +16230,29 @@ void setup_cursors(void) { ...@@ -16216,22 +16230,29 @@ void setup_cursors(void) {
/* this is the rfbCursor part: */ /* this is the rfbCursor part: */
if (ci->rfb->richSource) { if (ci->rfb->richSource) {
free(ci->rfb->richSource); free(ci->rfb->richSource);
ci->rfb->richSource = NULL;
} }
if (ci->rfb->source) { if (ci->rfb->source) {
free(ci->rfb->source); free(ci->rfb->source);
ci->rfb->source = NULL;
} }
if (ci->rfb->mask) { if (ci->rfb->mask) {
free(ci->rfb->mask); free(ci->rfb->mask);
ci->rfb->mask = NULL;
} }
free(ci->rfb); free(ci->rfb);
ci->rfb = NULL;
} }
if (ci->data) { if (ci->data) {
free(ci->data); free(ci->data);
ci->data = NULL;
} }
if (ci->mask) { if (ci->mask) {
free(ci->mask); free(ci->mask);
ci->mask = NULL;
} }
free(ci); free(ci);
ci = NULL;
} }
/* create new struct: */ /* create new struct: */
...@@ -16388,6 +16409,8 @@ void setup_cursors(void) { ...@@ -16388,6 +16409,8 @@ void setup_cursors(void) {
rfb_curs->backGreen = 0xffff; rfb_curs->backGreen = 0xffff;
rfb_curs->backBlue = 0xffff; rfb_curs->backBlue = 0xffff;
} }
rfb_curs->alphaSource = NULL;
rfb_curs->xhot = ci->sx; rfb_curs->xhot = ci->sx;
rfb_curs->yhot = ci->sy; rfb_curs->yhot = ci->sy;
rfb_curs->cleanup = FALSE; rfb_curs->cleanup = FALSE;
...@@ -16895,10 +16918,15 @@ int get_xfixes_cursor(int init) { ...@@ -16895,10 +16918,15 @@ int get_xfixes_cursor(int init) {
} }
oldest = CURS_DYN_MIN; oldest = CURS_DYN_MIN;
if (screen && screen->cursor == cursors[oldest]->rfb) {
oldest++;
}
oldtime = curs_times[oldest]; oldtime = curs_times[oldest];
now = time(0); now = time(0);
for (i = CURS_DYN_MIN; i <= CURS_DYN_MAX; i++) { for (i = CURS_DYN_MIN; i <= CURS_DYN_MAX; i++) {
if (curs_times[i] < oldtime) { if (screen && screen->cursor == cursors[i]->rfb) {
;
} else if (curs_times[i] < oldtime) {
/* watch for oldest one to overwrite */ /* watch for oldest one to overwrite */
oldest = i; oldest = i;
oldtime = curs_times[i]; oldtime = curs_times[i];
...@@ -16924,17 +16952,22 @@ int get_xfixes_cursor(int init) { ...@@ -16924,17 +16952,22 @@ int get_xfixes_cursor(int init) {
/* clean up oldest if it exists */ /* clean up oldest if it exists */
if (cursors[use]->rfb->richSource) { if (cursors[use]->rfb->richSource) {
free(cursors[use]->rfb->richSource); free(cursors[use]->rfb->richSource);
cursors[use]->rfb->richSource = NULL;
} }
if (cursors[use]->rfb->alphaSource) { if (cursors[use]->rfb->alphaSource) {
free(cursors[use]->rfb->alphaSource); free(cursors[use]->rfb->alphaSource);
cursors[use]->rfb->alphaSource = NULL;
} }
if (cursors[use]->rfb->source) { if (cursors[use]->rfb->source) {
free(cursors[use]->rfb->source); free(cursors[use]->rfb->source);
cursors[use]->rfb->source = NULL;
} }
if (cursors[use]->rfb->mask) { if (cursors[use]->rfb->mask) {
free(cursors[use]->rfb->mask); free(cursors[use]->rfb->mask);
cursors[use]->rfb->mask = NULL;
} }
free(cursors[use]->rfb); free(cursors[use]->rfb);
cursors[use]->rfb = NULL;
} }
/* place cursor into our collection */ /* place cursor into our collection */
...@@ -17424,6 +17457,7 @@ void set_colormap(int reset) { ...@@ -17424,6 +17457,7 @@ void set_colormap(int reset) {
first = 1; first = 1;
if (screen->colourMap.data.shorts) { if (screen->colourMap.data.shorts) {
free(screen->colourMap.data.shorts); free(screen->colourMap.data.shorts);
screen->colourMap.data.shorts = NULL;
} }
} }
...@@ -19099,7 +19133,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { ...@@ -19099,7 +19133,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
/* called from inetd, we need to treat stdio as our socket */ /* called from inetd, we need to treat stdio as our socket */
if (inetd) { if (inetd) {
int fd = dup(0); int fd = dup(0);
if (fd < 3) { if (fd < 0) {
rfbLogEnable(1); rfbLogEnable(1);
rfbErr("dup(0) = %d failed.\n", fd); rfbErr("dup(0) = %d failed.\n", fd);
rfbLogPerror("dup"); rfbLogPerror("dup");
...@@ -19191,6 +19225,10 @@ int dt_cmd(char *cmd) { ...@@ -19191,6 +19225,10 @@ int dt_cmd(char *cmd) {
return 1; return 1;
} }
if (getenv("DISPLAY") == NULL) {
set_env("DISPLAY", DisplayString(dpy));
}
rfbLog("running command:\n %s\n", cmd); rfbLog("running command:\n %s\n", cmd);
usr_bin_path(0); usr_bin_path(0);
rc = system(cmd); rc = system(cmd);
...@@ -23175,7 +23213,7 @@ int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h, ...@@ -23175,7 +23213,7 @@ int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h,
Bool ret; Bool ret;
int rootx, rooty, wx, wy; int rootx, rooty, wx, wy;
unsigned int mask; unsigned int mask;
ret = XQueryPointer(dpy, rootwin, &r, &c, &rootx, &rooty, &wx, &wy, ret = XQueryPointer(dpy, rootwin, &r, &c, &rootx, &rooty, &wx, &wy,
&mask); &mask);
...@@ -23508,6 +23546,8 @@ void set_wirecopyrect_mode(char *str) { ...@@ -23508,6 +23546,8 @@ void set_wirecopyrect_mode(char *str) {
} else { } else {
if (! wireframe_copyrect) { if (! wireframe_copyrect) {
wireframe_copyrect = strdup(wireframe_copyrect_default); wireframe_copyrect = strdup(wireframe_copyrect_default);
} else {
orig = NULL;
} }
rfbLog("unknown -wirecopyrect mode: %s, using: %s\n", str, rfbLog("unknown -wirecopyrect mode: %s, using: %s\n", str,
wireframe_copyrect); wireframe_copyrect);
...@@ -23536,6 +23576,8 @@ void set_scrollcopyrect_mode(char *str) { ...@@ -23536,6 +23576,8 @@ void set_scrollcopyrect_mode(char *str) {
} else { } else {
if (! scroll_copyrect) { if (! scroll_copyrect) {
scroll_copyrect = strdup(scroll_copyrect_default); scroll_copyrect = strdup(scroll_copyrect_default);
} else {
orig = NULL;
} }
rfbLog("unknown -scrollcopyrect mode: %s, using: %s\n", str, rfbLog("unknown -scrollcopyrect mode: %s, using: %s\n", str,
scroll_copyrect); scroll_copyrect);
...@@ -23861,6 +23903,7 @@ void draw_box(int x, int y, int w, int h, int restore) { ...@@ -23861,6 +23903,7 @@ void draw_box(int x, int y, int w, int h, int restore) {
if (! first && save[i]) { if (! first && save[i]) {
if (save[i]->data) { if (save[i]->data) {
free(save[i]->data); free(save[i]->data);
save[i]->data = NULL;
} }
free(save[i]); free(save[i]);
} }
...@@ -26403,6 +26446,8 @@ if (db) fprintf(stderr, "INTERIOR\n"); ...@@ -26403,6 +26446,8 @@ if (db) fprintf(stderr, "INTERIOR\n");
spin += dtime(&tm); spin += dtime(&tm);
if (0) fprintf(stderr, "wf-spin: %.3f\n", spin);
/* check for any timeouts: */ /* check for any timeouts: */
if (frame_changed) { if (frame_changed) {
double delay; double delay;
...@@ -26509,7 +26554,6 @@ if (db) fprintf(stderr, "OUT-OF-FRAME: old: x: %d y: %d px: %d py: %d 0x%lx\n" ...@@ -26509,7 +26554,6 @@ if (db) fprintf(stderr, "OUT-OF-FRAME: old: x: %d y: %d px: %d py: %d 0x%lx\n"
} }
X_UNLOCK; X_UNLOCK;
/* debugging output, to be removed: */
if (db) fprintf(stderr, " frame: x: %d y: %d w: %d h: %d px: %d py: %d fr: 0x%lx\n", x, y, w, h, px, py, frame); if (db) fprintf(stderr, " frame: x: %d y: %d w: %d h: %d px: %d py: %d fr: 0x%lx\n", x, y, w, h, px, py, frame);
if (db) fprintf(stderr, " MO,PT,FR: %d/%d %d/%d %d/%d\n", cursor_x - orig_cursor_x, cursor_y - orig_cursor_y, px - orig_px, py - orig_py, x - orig_x, y - orig_y); if (db) fprintf(stderr, " MO,PT,FR: %d/%d %d/%d %d/%d\n", cursor_x - orig_cursor_x, cursor_y - orig_cursor_y, px - orig_px, py - orig_py, x - orig_x, y - orig_y);
...@@ -28431,8 +28475,10 @@ static void print_help(int mode) { ...@@ -28431,8 +28475,10 @@ static void print_help(int mode) {
" of startup.\n" " of startup.\n"
"-inetd Launched by inetd(1): stdio instead of listening socket.\n" "-inetd Launched by inetd(1): stdio instead of listening socket.\n"
" Note: if you are not redirecting stderr to a log file\n" " Note: if you are not redirecting stderr to a log file\n"
" (via shell 2> or -o option) you must also specify the\n" " (via shell 2> or -o option) you must also specify the -q\n"
" -q option, otherwise the stderr goes to the viewer.\n" " option, otherwise the stderr goes to the viewer which\n"
" will cause it to abort. Specifying both -inetd and -q\n"
" and no -o will automatically close the stderr.\n"
"-http Instead of using -httpdir (see below) to specify\n" "-http Instead of using -httpdir (see below) to specify\n"
" where the Java vncviewer applet is, have x11vnc try\n" " where the Java vncviewer applet is, have x11vnc try\n"
" to *guess* where the directory is by looking relative\n" " to *guess* where the directory is by looking relative\n"
...@@ -31113,6 +31159,24 @@ int main(int argc, char* argv[]) { ...@@ -31113,6 +31159,24 @@ int main(int argc, char* argv[]) {
close(n); close(n);
} }
} }
if (inetd && quiet && !logfile) {
int n;
/*
* Redir stderr to /dev/null under -inetd and -quiet
* but no -o logfile. Typical problem:
* Xlib: extension "RECORD" missing on display ":1.0".
* If they want this info, they should use -o logfile,
* or no -q and 2>logfile.
*/
n = open("/dev/null", O_WRONLY);
if (n >= 0) {
if (dup2(n, 2) >= 0) {
if (n > 2) {
close(n);
}
}
}
}
if (! quiet && ! inetd) { if (! quiet && ! inetd) {
int i; int i;
for (i=1; i < argc_vnc; i++) { for (i=1; i < argc_vnc; i++) {
...@@ -31292,6 +31356,7 @@ int main(int argc, char* argv[]) { ...@@ -31292,6 +31356,7 @@ int main(int argc, char* argv[]) {
shared = 0; shared = 0;
connect_once = 1; connect_once = 1;
bg = 0; bg = 0;
/* others? */
} }
if (flip_byte_order && using_shm && ! quiet) { if (flip_byte_order && using_shm && ! quiet) {
......
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