summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrunge <runge>2006-01-11 15:01:12 +0000
committerrunge <runge>2006-01-11 15:01:12 +0000
commit57cf0cdab5480efebaf447d5675e51b0d311ceee (patch)
treecb4b1419712454d31e85bd8558ff67b2d8fdac90
parent0b7a0030acc27377b01e3afa41f672dc4d6a7561 (diff)
downloadlibtdevnc-57cf0cda.tar.gz
libtdevnc-57cf0cda.zip
x11vnc: close fd > 2 in run_user_command(), -nocmds in crash_debug, fix 64bit bug for -solid.
-rw-r--r--x11vnc/ChangeLog4
-rw-r--r--x11vnc/README8
-rw-r--r--x11vnc/cleanup.c6
-rw-r--r--x11vnc/connections.c27
-rw-r--r--x11vnc/cursor.c2
-rw-r--r--x11vnc/keyboard.c10
-rw-r--r--x11vnc/pointer.c2
-rw-r--r--x11vnc/scan.c8
-rw-r--r--x11vnc/screen.c2
-rw-r--r--x11vnc/solid.c4
-rw-r--r--x11vnc/userinput.c8
-rw-r--r--x11vnc/win_utils.c2
-rw-r--r--x11vnc/x11vnc.12
-rw-r--r--x11vnc/x11vnc.c4
-rw-r--r--x11vnc/x11vnc_defs.c2
-rw-r--r--x11vnc/xdamage.c6
-rw-r--r--x11vnc/xrecord.c2
17 files changed, 68 insertions, 31 deletions
diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog
index af81d27..41c058e 100644
--- a/x11vnc/ChangeLog
+++ b/x11vnc/ChangeLog
@@ -1,3 +1,7 @@
+2006-01-11 Karl Runge <runge@karlrunge.com>
+ * x11vnc: close fd > 2 in run_user_command(), -nocmds in crash_debug,
+ fix 64bit bug for -solid.
+
2006-01-08 Karl Runge <runge@karlrunge.com>
* x11vnc: the big split. opts: -afteraccept and -passwdfile read:
diff --git a/x11vnc/README b/x11vnc/README
index 960994e..99e3d59 100644
--- a/x11vnc/README
+++ b/x11vnc/README
@@ -1,5 +1,5 @@
-x11vnc README file Date: Sun Jan 8 17:44:25 EST 2006
+x11vnc README file Date: Wed Jan 11 09:49:16 EST 2006
The following information is taken from these URLs:
@@ -2367,7 +2367,7 @@ if [ "X$RFB_MODE" = "Xafteraccept" ]; then
elif [ "X$RFB_MODE" = "Xgone" ]; then
if [ "X$RFB_STATE" = "XNORMAL" ]; then # require valid login
if [ "X$RFB_CLIENT_COUNT" = "X0" ]; then
- xlock &
+ xlock -mode blank &
fi
fi
fi
@@ -4783,7 +4783,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions)
-x11vnc: allow VNC connections to real X11 displays. 0.7.3 lastmod: 2006-01-08
+x11vnc: allow VNC connections to real X11 displays. 0.7.3 lastmod: 2006-01-10
x11vnc options:
-display disp -auth file
@@ -4893,7 +4893,7 @@ libvncserver-tight-extension options:
% x11vnc -help
-x11vnc: allow VNC connections to real X11 displays. 0.7.3 lastmod: 2006-01-08
+x11vnc: allow VNC connections to real X11 displays. 0.7.3 lastmod: 2006-01-10
Typical usage is:
diff --git a/x11vnc/cleanup.c b/x11vnc/cleanup.c
index f8c4ae4..890afa8 100644
--- a/x11vnc/cleanup.c
+++ b/x11vnc/cleanup.c
@@ -299,6 +299,11 @@ static void crash_shell(void) {
crash_shell_help();
} else if (*str == 's' && *(str+1) == '\0') {
sprintf(cmd, "sh -c '(%s) &'", crash_stack_command1);
+ if (no_external_cmds) {
+ fprintf(stderr, "\nno_external_cmds=%d\n",
+ no_external_cmds);
+ goto crash_prompt;
+ }
fprintf(stderr, "\nrunning:\n\t%s\n\n",
crash_stack_command1);
system(cmd);
@@ -316,6 +321,7 @@ static void crash_shell(void) {
free(p);
}
+crash_prompt:
fprintf(stderr, "crash> ");
}
}
diff --git a/x11vnc/connections.c b/x11vnc/connections.c
index addd215..b444208 100644
--- a/x11vnc/connections.c
+++ b/x11vnc/connections.c
@@ -428,8 +428,29 @@ static int run_user_command(char *cmd, rfbClientPtr client, char *mode) {
rfbLog("running command:\n");
rfbLog(" %s\n", cmd);
- /* XXX need to close port 5900, etc.. */
+#if LIBVNCSERVER_HAVE_FORK
+ {
+ pid_t pid, pidw;
+ if ((pid = fork()) > 0) {
+ pidw = waitpid(pid, &rc, 0);
+ } else if (pid == -1) {
+ fprintf(stderr, "could not fork\n");
+ rfbLogPerror("fork");
+ rc = system(cmd);
+ } else {
+ /* this should close port 5900, etc.. */
+ int fd;
+ for (fd=3; fd<256; fd++) {
+ close(fd);
+ }
+ execlp("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL);
+ exit(1);
+ }
+ }
+#else
+ /* this will still have port 5900 open */
rc = system(cmd);
+#endif
if (rc >= 256) {
rc = rc/256;
@@ -963,7 +984,7 @@ static int action_match(char *action, int rc) {
p = strtok(s, ",");
while (p) {
if ((q = strchr(p, ':')) != NULL) {
- int in, k;
+ int in, k = 1;
*q = '\0';
q++;
if (strstr(p, "yes") == p) {
@@ -1662,6 +1683,8 @@ void start_client_info_sock(char *host_port_cookie) {
time_t oldest = 0;
int db = 0;
+ port = -1;
+
for (i = 0; i < ICON_MODE_SOCKS; i++) {
if (icon_mode_socks[i] < 0) {
next = i;
diff --git a/x11vnc/cursor.c b/x11vnc/cursor.c
index 4c8cca7..a840cc7 100644
--- a/x11vnc/cursor.c
+++ b/x11vnc/cursor.c
@@ -932,7 +932,7 @@ static rfbCursorPtr pixels2curs(unsigned long *pixels, int w, int h,
char *bitmap, *rich, *alpha;
char *pixels_new = NULL;
int n_opaque, n_trans, n_alpha, len, histo[256];
- int send_alpha = 0, alpha_shift, thresh;
+ int send_alpha = 0, alpha_shift = 0, thresh;
int i, x, y;
if (first && dpy) { /* raw_fb hack */
diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c
index 1fba4c9..8542785 100644
--- a/x11vnc/keyboard.c
+++ b/x11vnc/keyboard.c
@@ -751,7 +751,7 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
}
if (!down && !keycode_state[key] && !IsModifierKey(keysym)) {
- int i, cnt = 0, downkey;
+ int i, cnt = 0, downkey = -1;
int nmods_down = track_mod_state(NoSymbol, FALSE, FALSE);
int mods_down[256];
@@ -1156,7 +1156,7 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store
for (grp = 0; grp < GRP; grp++) {
for (lvl = 0; lvl < LVL; lvl++) {
unsigned int ms, mods;
- int state_save = -1, mods_save;
+ int state_save = -1, mods_save = -1;
KeySym ks2;
/* look up the Keysym, if any */
@@ -1398,13 +1398,13 @@ static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym,
int kc, grp, lvl, i, kci;
int kc_f[0x100], grp_f[0x100], lvl_f[0x100], state_f[0x100], found;
int ignore_f[0x100];
- unsigned int state;
+ unsigned int state = 0;
/* these are used for finding modifiers, etc */
XkbStateRec kbstate;
int got_kbstate = 0;
- int Kc_f, Grp_f, Lvl_f;
+ int Kc_f, Grp_f = 0, Lvl_f = 0;
static int Kc_last_down = -1;
static KeySym Ks_last_down = NoSymbol;
@@ -1544,7 +1544,7 @@ static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym,
if (found > 1) {
if (down) {
int l, score[0x100];
- int best, best_score = -1;
+ int best = 0, best_score = -1;
/* need to break the tie... */
if (! got_kbstate) {
XkbGetState(dpy, XkbUseCoreKbd, &kbstate);
diff --git a/x11vnc/pointer.c b/x11vnc/pointer.c
index 6ff92d4..9622a7d 100644
--- a/x11vnc/pointer.c
+++ b/x11vnc/pointer.c
@@ -382,7 +382,7 @@ void do_button_mask_change(int mask, int button) {
* Send a pointer button event to the X server.
*/
static void update_x11_pointer_mask(int mask) {
- int snapped, xr_mouse = 1, i;
+ int snapped = 0, xr_mouse = 1, i;
last_event = last_input = last_pointer_input = time(0);
diff --git a/x11vnc/scan.c b/x11vnc/scan.c
index ad5f032..45fbd3f 100644
--- a/x11vnc/scan.c
+++ b/x11vnc/scan.c
@@ -724,14 +724,14 @@ void scale_rect(double factor, int blend, int interpolate, int Bpp,
double x1, y1, x2, y2; /* x-y coords for destination pixels edges */
double dx, dy; /* size of destination pixel */
- double ddx, ddy; /* for interpolation expansion */
+ double ddx=0, ddy=0; /* for interpolation expansion */
char *src, *dest; /* pointers to the two framebuffers */
- unsigned short us;
- unsigned char uc;
- unsigned int ui;
+ unsigned short us = 0;
+ unsigned char uc = 0;
+ unsigned int ui = 0;
int use_noblend_shortcut = 1;
int shrink; /* whether shrinking or expanding */
diff --git a/x11vnc/screen.c b/x11vnc/screen.c
index ac4bf7b..ae81ec4 100644
--- a/x11vnc/screen.c
+++ b/x11vnc/screen.c
@@ -1064,7 +1064,7 @@ XImage *initialize_xdisplay_fb(void) {
XImage *fb;
char *vis_str = visual_str;
int try = 0, subwin_tries = 3;
- XErrorHandler old_handler;
+ XErrorHandler old_handler = NULL;
int subwin_bs;
if (raw_fb_str) {
diff --git a/x11vnc/solid.c b/x11vnc/solid.c
index 5e91bf6..9b85725 100644
--- a/x11vnc/solid.c
+++ b/x11vnc/solid.c
@@ -300,7 +300,7 @@ static void solid_cde(char *color) {
int format;
unsigned long length, after;
unsigned char *data;
- unsigned int * dp;
+ unsigned long *dp; /* crash on 64bit with int */
nws = 0;
@@ -323,7 +323,7 @@ static void solid_cde(char *color) {
return;
}
- dp = (unsigned int *) data;
+ dp = (unsigned long *) data;
wm_win = (Window) *(dp+1); /* 2nd item. */
diff --git a/x11vnc/userinput.c b/x11vnc/userinput.c
index 75f0fa4..062fea5 100644
--- a/x11vnc/userinput.c
+++ b/x11vnc/userinput.c
@@ -722,8 +722,8 @@ static void draw_box(int x, int y, int w, int h, int restore) {
int sz, lw = wireframe_lw;
unsigned long shade = wireframe_shade;
int color = 0;
- unsigned short us;
- unsigned long ul;
+ unsigned short us = 0;
+ unsigned long ul = 0;
if (clipshift) {
x -= coff_x;
@@ -3218,7 +3218,7 @@ static int wireframe_mod_state() {
* the toplevel windows to get better info on moves and resizes.
*/
int check_wireframe(void) {
- Window frame, orig_frame;
+ Window frame = None, orig_frame = None;
XWindowAttributes attr;
int dx, dy;
@@ -3227,7 +3227,7 @@ int check_wireframe(void) {
int box_x, box_y, box_w, box_h;
int orig_cursor_x, orig_cursor_y, g;
int already_down = 0, win_gone = 0, win_unmapped = 0;
- double spin = 0.0, tm, last_ptr, last_draw;
+ double spin = 0.0, tm, last_ptr = 0.0, last_draw;
int frame_changed = 0, drew_box = 0, got_2nd_pointer = 0;
int special_t1 = 0, break_reason = 0;
static double first_dt_ave = 0.0;
diff --git a/x11vnc/win_utils.c b/x11vnc/win_utils.c
index 11efaca..798d14a 100644
--- a/x11vnc/win_utils.c
+++ b/x11vnc/win_utils.c
@@ -330,7 +330,7 @@ int pick_windowid(unsigned long *num) {
}
Window descend_pointer(int depth, Window start, char *name_info, int len) {
- Window r, c, clast;
+ Window r, c, clast = None;
int i, rx, ry, wx, wy;
int written = 0, filled = 0;
char *store = NULL;
diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1
index 28f8c05..1dac936 100644
--- a/x11vnc/x11vnc.1
+++ b/x11vnc/x11vnc.1
@@ -2,7 +2,7 @@
.TH X11VNC "1" "January 2006" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
- version: 0.7.3, lastmod: 2006-01-08
+ version: 0.7.3, lastmod: 2006-01-10
.SH SYNOPSIS
.B x11vnc
[OPTION]...
diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c
index 70026fc..aba7808 100644
--- a/x11vnc/x11vnc.c
+++ b/x11vnc/x11vnc.c
@@ -207,7 +207,7 @@ static void record_last_fb_update(void) {
static int rbs0 = -1;
static time_t last_call = 0;
time_t now = time(0);
- int rbs;
+ int rbs = -1;
rfbClientIteratorPtr iter;
rfbClientPtr cl;
@@ -629,7 +629,7 @@ static void check_rcfile(int argc, char **argv) {
int i, j, pwlast, norc = 0, argmax = 1024;
char *infile = NULL;
char rcfile[1024];
- FILE *rc;
+ FILE *rc = NULL;
for (i=1; i < argc; i++) {
if (!strcmp(argv[i], "-printgui")) {
diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c
index c3d77c8..d676ec1 100644
--- a/x11vnc/x11vnc_defs.c
+++ b/x11vnc/x11vnc_defs.c
@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
-char lastmod[] = "0.7.3 lastmod: 2006-01-08";
+char lastmod[] = "0.7.3 lastmod: 2006-01-10";
/* X display info */
diff --git a/x11vnc/xdamage.c b/x11vnc/xdamage.c
index e54c0b9..5b13d05 100644
--- a/x11vnc/xdamage.c
+++ b/x11vnc/xdamage.c
@@ -58,6 +58,10 @@ static void record_desired_xdamage_rect(int x, int y, int w, int h) {
int use_direct_fb_copy = 0;
int wh_min, wh_max;
static int first = 1, udfb = 0;
+
+ /* compiler warning: */
+ nt_x1 = 0; nt_y1 = 0; nt_x2 = 0; nt_y2 = 0;
+
if (first) {
if (getenv("XD_DFC")) {
udfb = 1;
@@ -214,7 +218,7 @@ int collect_xdamage(int scancnt, int call) {
static time_t last_rpt = 0;
time_t now;
int x, y, w, h, x2, y2;
- int i, dup, next, dup_max = 0;
+ int i, dup, next = 0, dup_max = 0;
#define DUPSZ 32
int dup_x[DUPSZ], dup_y[DUPSZ], dup_w[DUPSZ], dup_h[DUPSZ];
double tm, dt;
diff --git a/x11vnc/xrecord.c b/x11vnc/xrecord.c
index 21b7d61..7162167 100644
--- a/x11vnc/xrecord.c
+++ b/x11vnc/xrecord.c
@@ -408,7 +408,7 @@ int xrecord_scroll_keysym(rfbKeySym keysym) {
}
static int lookup_attr_cache(Window win, int *cache_index, int *next_index) {
- double now, t, oldest;
+ double now, t, oldest = 0.0;
int i, old_index = -1, count = 0;
Window cwin;