x11vnc: close fd > 2 in run_user_command(), -nocmds in crash_debug, fix 64bit bug for -solid.

pull/1/head
runge 19 years ago
parent 0b7a0030ac
commit 57cf0cdab5

@ -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> 2006-01-08 Karl Runge <runge@karlrunge.com>
* x11vnc: the big split. opts: -afteraccept and -passwdfile read: * x11vnc: the big split. opts: -afteraccept and -passwdfile read:

@ -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: The following information is taken from these URLs:
@ -2367,7 +2367,7 @@ if [ "X$RFB_MODE" = "Xafteraccept" ]; then
elif [ "X$RFB_MODE" = "Xgone" ]; then elif [ "X$RFB_MODE" = "Xgone" ]; then
if [ "X$RFB_STATE" = "XNORMAL" ]; then # require valid login if [ "X$RFB_STATE" = "XNORMAL" ]; then # require valid login
if [ "X$RFB_CLIENT_COUNT" = "X0" ]; then if [ "X$RFB_CLIENT_COUNT" = "X0" ]; then
xlock & xlock -mode blank &
fi fi
fi fi
fi fi
@ -4783,7 +4783,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options: Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions) % 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: x11vnc options:
-display disp -auth file -display disp -auth file
@ -4893,7 +4893,7 @@ libvncserver-tight-extension options:
% x11vnc -help % 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: Typical usage is:

@ -299,6 +299,11 @@ static void crash_shell(void) {
crash_shell_help(); crash_shell_help();
} else if (*str == 's' && *(str+1) == '\0') { } else if (*str == 's' && *(str+1) == '\0') {
sprintf(cmd, "sh -c '(%s) &'", crash_stack_command1); 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", fprintf(stderr, "\nrunning:\n\t%s\n\n",
crash_stack_command1); crash_stack_command1);
system(cmd); system(cmd);
@ -316,6 +321,7 @@ static void crash_shell(void) {
free(p); free(p);
} }
crash_prompt:
fprintf(stderr, "crash> "); fprintf(stderr, "crash> ");
} }
} }

@ -428,8 +428,29 @@ static int run_user_command(char *cmd, rfbClientPtr client, char *mode) {
rfbLog("running command:\n"); rfbLog("running command:\n");
rfbLog(" %s\n", cmd); 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); rc = system(cmd);
#endif
if (rc >= 256) { if (rc >= 256) {
rc = rc/256; rc = rc/256;
@ -963,7 +984,7 @@ static int action_match(char *action, int rc) {
p = strtok(s, ","); p = strtok(s, ",");
while (p) { while (p) {
if ((q = strchr(p, ':')) != NULL) { if ((q = strchr(p, ':')) != NULL) {
int in, k; int in, k = 1;
*q = '\0'; *q = '\0';
q++; q++;
if (strstr(p, "yes") == p) { if (strstr(p, "yes") == p) {
@ -1662,6 +1683,8 @@ void start_client_info_sock(char *host_port_cookie) {
time_t oldest = 0; time_t oldest = 0;
int db = 0; int db = 0;
port = -1;
for (i = 0; i < ICON_MODE_SOCKS; i++) { for (i = 0; i < ICON_MODE_SOCKS; i++) {
if (icon_mode_socks[i] < 0) { if (icon_mode_socks[i] < 0) {
next = i; next = i;

@ -932,7 +932,7 @@ static rfbCursorPtr pixels2curs(unsigned long *pixels, int w, int h,
char *bitmap, *rich, *alpha; char *bitmap, *rich, *alpha;
char *pixels_new = NULL; char *pixels_new = NULL;
int n_opaque, n_trans, n_alpha, len, histo[256]; 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; int i, x, y;
if (first && dpy) { /* raw_fb hack */ if (first && dpy) { /* raw_fb hack */

@ -751,7 +751,7 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
} }
if (!down && !keycode_state[key] && !IsModifierKey(keysym)) { 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 nmods_down = track_mod_state(NoSymbol, FALSE, FALSE);
int mods_down[256]; 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 (grp = 0; grp < GRP; grp++) {
for (lvl = 0; lvl < LVL; lvl++) { for (lvl = 0; lvl < LVL; lvl++) {
unsigned int ms, mods; unsigned int ms, mods;
int state_save = -1, mods_save; int state_save = -1, mods_save = -1;
KeySym ks2; KeySym ks2;
/* look up the Keysym, if any */ /* 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, grp, lvl, i, kci;
int kc_f[0x100], grp_f[0x100], lvl_f[0x100], state_f[0x100], found; int kc_f[0x100], grp_f[0x100], lvl_f[0x100], state_f[0x100], found;
int ignore_f[0x100]; int ignore_f[0x100];
unsigned int state; unsigned int state = 0;
/* these are used for finding modifiers, etc */ /* these are used for finding modifiers, etc */
XkbStateRec kbstate; XkbStateRec kbstate;
int got_kbstate = 0; 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 int Kc_last_down = -1;
static KeySym Ks_last_down = NoSymbol; static KeySym Ks_last_down = NoSymbol;
@ -1544,7 +1544,7 @@ static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym,
if (found > 1) { if (found > 1) {
if (down) { if (down) {
int l, score[0x100]; int l, score[0x100];
int best, best_score = -1; int best = 0, best_score = -1;
/* need to break the tie... */ /* need to break the tie... */
if (! got_kbstate) { if (! got_kbstate) {
XkbGetState(dpy, XkbUseCoreKbd, &kbstate); XkbGetState(dpy, XkbUseCoreKbd, &kbstate);

@ -382,7 +382,7 @@ void do_button_mask_change(int mask, int button) {
* Send a pointer button event to the X server. * Send a pointer button event to the X server.
*/ */
static void update_x11_pointer_mask(int mask) { 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); last_event = last_input = last_pointer_input = time(0);

@ -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 x1, y1, x2, y2; /* x-y coords for destination pixels edges */
double dx, dy; /* size of destination pixel */ 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 */ char *src, *dest; /* pointers to the two framebuffers */
unsigned short us; unsigned short us = 0;
unsigned char uc; unsigned char uc = 0;
unsigned int ui; unsigned int ui = 0;
int use_noblend_shortcut = 1; int use_noblend_shortcut = 1;
int shrink; /* whether shrinking or expanding */ int shrink; /* whether shrinking or expanding */

@ -1064,7 +1064,7 @@ XImage *initialize_xdisplay_fb(void) {
XImage *fb; XImage *fb;
char *vis_str = visual_str; char *vis_str = visual_str;
int try = 0, subwin_tries = 3; int try = 0, subwin_tries = 3;
XErrorHandler old_handler; XErrorHandler old_handler = NULL;
int subwin_bs; int subwin_bs;
if (raw_fb_str) { if (raw_fb_str) {

@ -300,7 +300,7 @@ static void solid_cde(char *color) {
int format; int format;
unsigned long length, after; unsigned long length, after;
unsigned char *data; unsigned char *data;
unsigned int * dp; unsigned long *dp; /* crash on 64bit with int */
nws = 0; nws = 0;
@ -323,7 +323,7 @@ static void solid_cde(char *color) {
return; return;
} }
dp = (unsigned int *) data; dp = (unsigned long *) data;
wm_win = (Window) *(dp+1); /* 2nd item. */ wm_win = (Window) *(dp+1); /* 2nd item. */

@ -722,8 +722,8 @@ static void draw_box(int x, int y, int w, int h, int restore) {
int sz, lw = wireframe_lw; int sz, lw = wireframe_lw;
unsigned long shade = wireframe_shade; unsigned long shade = wireframe_shade;
int color = 0; int color = 0;
unsigned short us; unsigned short us = 0;
unsigned long ul; unsigned long ul = 0;
if (clipshift) { if (clipshift) {
x -= coff_x; x -= coff_x;
@ -3218,7 +3218,7 @@ static int wireframe_mod_state() {
* the toplevel windows to get better info on moves and resizes. * the toplevel windows to get better info on moves and resizes.
*/ */
int check_wireframe(void) { int check_wireframe(void) {
Window frame, orig_frame; Window frame = None, orig_frame = None;
XWindowAttributes attr; XWindowAttributes attr;
int dx, dy; int dx, dy;
@ -3227,7 +3227,7 @@ int check_wireframe(void) {
int box_x, box_y, box_w, box_h; int box_x, box_y, box_w, box_h;
int orig_cursor_x, orig_cursor_y, g; int orig_cursor_x, orig_cursor_y, g;
int already_down = 0, win_gone = 0, win_unmapped = 0; 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 frame_changed = 0, drew_box = 0, got_2nd_pointer = 0;
int special_t1 = 0, break_reason = 0; int special_t1 = 0, break_reason = 0;
static double first_dt_ave = 0.0; static double first_dt_ave = 0.0;

@ -330,7 +330,7 @@ int pick_windowid(unsigned long *num) {
} }
Window descend_pointer(int depth, Window start, char *name_info, int len) { 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 i, rx, ry, wx, wy;
int written = 0, filled = 0; int written = 0, filled = 0;
char *store = NULL; char *store = NULL;

@ -2,7 +2,7 @@
.TH X11VNC "1" "January 2006" "x11vnc " "User Commands" .TH X11VNC "1" "January 2006" "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.3, lastmod: 2006-01-08 version: 0.7.3, lastmod: 2006-01-10
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...

@ -207,7 +207,7 @@ static void record_last_fb_update(void) {
static int rbs0 = -1; static int rbs0 = -1;
static time_t last_call = 0; static time_t last_call = 0;
time_t now = time(0); time_t now = time(0);
int rbs; int rbs = -1;
rfbClientIteratorPtr iter; rfbClientIteratorPtr iter;
rfbClientPtr cl; rfbClientPtr cl;
@ -629,7 +629,7 @@ static void check_rcfile(int argc, char **argv) {
int i, j, pwlast, norc = 0, argmax = 1024; int i, j, pwlast, norc = 0, argmax = 1024;
char *infile = NULL; char *infile = NULL;
char rcfile[1024]; char rcfile[1024];
FILE *rc; FILE *rc = NULL;
for (i=1; i < argc; i++) { for (i=1; i < argc; i++) {
if (!strcmp(argv[i], "-printgui")) { if (!strcmp(argv[i], "-printgui")) {

@ -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.7.3 lastmod: 2006-01-08"; char lastmod[] = "0.7.3 lastmod: 2006-01-10";
/* X display info */ /* X display info */

@ -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 use_direct_fb_copy = 0;
int wh_min, wh_max; int wh_min, wh_max;
static int first = 1, udfb = 0; static int first = 1, udfb = 0;
/* compiler warning: */
nt_x1 = 0; nt_y1 = 0; nt_x2 = 0; nt_y2 = 0;
if (first) { if (first) {
if (getenv("XD_DFC")) { if (getenv("XD_DFC")) {
udfb = 1; udfb = 1;
@ -214,7 +218,7 @@ int collect_xdamage(int scancnt, int call) {
static time_t last_rpt = 0; static time_t last_rpt = 0;
time_t now; time_t now;
int x, y, w, h, x2, y2; 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 #define DUPSZ 32
int dup_x[DUPSZ], dup_y[DUPSZ], dup_w[DUPSZ], dup_h[DUPSZ]; int dup_x[DUPSZ], dup_y[DUPSZ], dup_w[DUPSZ], dup_h[DUPSZ];
double tm, dt; double tm, dt;

@ -408,7 +408,7 @@ int xrecord_scroll_keysym(rfbKeySym keysym) {
} }
static int lookup_attr_cache(Window win, int *cache_index, int *next_index) { 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; int i, old_index = -1, count = 0;
Window cwin; Window cwin;

Loading…
Cancel
Save