Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
libvncserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
libvncserver
Commits
1776a3a5
Commit
1776a3a5
authored
19 years ago
by
runge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x11vnc: -display WAIT:..., -users unixpw=, su_verify dpy command.
parent
a60ee2ee
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
3433 additions
and
1338 deletions
+3433
-1338
ChangeLog
ChangeLog
+4
-1
prepare_x11vnc_dist.sh
prepare_x11vnc_dist.sh
+1
-1
ChangeLog
x11vnc/ChangeLog
+5
-0
README
x11vnc/README
+1940
-1159
cleanup.c
x11vnc/cleanup.c
+2
-1
connections.c
x11vnc/connections.c
+1
-0
gui.c
x11vnc/gui.c
+10
-8
help.c
x11vnc/help.c
+118
-52
options.c
x11vnc/options.c
+1
-1
pointer.c
x11vnc/pointer.c
+1
-0
remote.c
x11vnc/remote.c
+2
-2
screen.c
x11vnc/screen.c
+7
-3
solid.c
x11vnc/solid.c
+1
-0
sslcmds.c
x11vnc/sslcmds.c
+1
-0
sslhelper.c
x11vnc/sslhelper.c
+2
-1
tkx11vnc
x11vnc/tkx11vnc
+6
-6
tkx11vnc.h
x11vnc/tkx11vnc.h
+6
-6
unixpw.c
x11vnc/unixpw.c
+134
-10
unixpw.h
x11vnc/unixpw.h
+4
-1
user.c
x11vnc/user.c
+235
-2
user.h
x11vnc/user.h
+1
-0
v4l.c
x11vnc/v4l.c
+1
-0
win_utils.c
x11vnc/win_utils.c
+1
-0
x11vnc.1
x11vnc/x11vnc.1
+801
-38
x11vnc.c
x11vnc/x11vnc.c
+35
-20
x11vnc.h
x11vnc/x11vnc.h
+3
-1
x11vnc_defs.c
x11vnc/x11vnc_defs.c
+3
-1
xevents.c
x11vnc/xevents.c
+3
-3
xkb_bell.c
x11vnc/xkb_bell.c
+5
-0
xrecord.c
x11vnc/xrecord.c
+21
-21
xwrappers.c
x11vnc/xwrappers.c
+74
-0
xwrappers.h
x11vnc/xwrappers.h
+4
-0
No files found.
ChangeLog
View file @
1776a3a5
2006-06-08 Karl Runge <runge@karlrunge.com>
* prepare_x11vnc_dist.sh: to 0.8.2
2006-05-29 Steven Carr <scarr@jsa-usa.com>
2006-05-29 Steven Carr <scarr@jsa-usa.com>
* Identified and removed some memory leaks associated
* Identified and removed some memory leaks associated
with the Encodings RRE, CoRRE, ZLIB, and Ultra.
with the Encodings RRE, CoRRE, ZLIB, and Ultra.
* KeyboardLedState now has portable masks defined.
* KeyboardLedState now has portable masks defined.
* rfb >= 3.7 Security Type Handler list would grow 1
* rfb >= 3.7 Security Type Handler list would grow 1
entry for each new client connection.
entry for each new client connection.
2006-05-16 Steven Carr <scarr@jsa-usa.com>
2006-05-16 Steven Carr <scarr@jsa-usa.com>
* Statistics output now fits in 80-column output
* Statistics output now fits in 80-column output
* Corrected Cursor Statistics reporting as messages
* Corrected Cursor Statistics reporting as messages
...
...
This diff is collapsed.
Click to expand it.
prepare_x11vnc_dist.sh
View file @
1776a3a5
#!/bin/bash
#!/bin/bash
VERSION
=
"0.8.
1
"
VERSION
=
"0.8.
2
"
cd
"
$(
dirname
"
$0
"
)
"
cd
"
$(
dirname
"
$0
"
)
"
...
...
This diff is collapsed.
Click to expand it.
x11vnc/ChangeLog
View file @
1776a3a5
2006-06-08 Karl Runge <runge@karlrunge.com>
* x11vnc: XOpenDisplay wrapper for raw xauth data, -unixpw
su_verify() to run any cmd, -users unixpw= mode. -display WAIT:...
modes for delayed X display opening and dynamic choosing.
2006-06-03 Karl Runge <runge@karlrunge.com>
2006-06-03 Karl Runge <runge@karlrunge.com>
* x11vnc: -capslock and -skip_lockkeys options. map some Alt keys
* x11vnc: -capslock and -skip_lockkeys options. map some Alt keys
to Latin under linuxfb. switch to new stats API. Handle more
to Latin under linuxfb. switch to new stats API. Handle more
...
...
This diff is collapsed.
Click to expand it.
x11vnc/README
View file @
1776a3a5
This diff is collapsed.
Click to expand it.
x11vnc/cleanup.c
View file @
1776a3a5
...
@@ -155,7 +155,7 @@ void clean_up_exit (int ret) {
...
@@ -155,7 +155,7 @@ void clean_up_exit (int ret) {
}
}
#endif
#endif
/* XXX rdpy_ctrl, etc. cannot close w/o blocking */
/* XXX rdpy_ctrl, etc. cannot close w/o blocking */
XCloseDisplay
(
dpy
);
XCloseDisplay
_wr
(
dpy
);
X_UNLOCK
;
X_UNLOCK
;
fflush
(
stderr
);
fflush
(
stderr
);
...
@@ -311,6 +311,7 @@ static void crash_shell(void) {
...
@@ -311,6 +311,7 @@ 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
);
/* crash */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
fprintf
(
stderr
,
"
\n
no_external_cmds=%d
\n
"
,
fprintf
(
stderr
,
"
\n
no_external_cmds=%d
\n
"
,
no_external_cmds
);
no_external_cmds
);
...
...
This diff is collapsed.
Click to expand it.
x11vnc/connections.c
View file @
1776a3a5
...
@@ -448,6 +448,7 @@ static int run_user_command(char *cmd, rfbClientPtr client, char *mode) {
...
@@ -448,6 +448,7 @@ static int run_user_command(char *cmd, rfbClientPtr client, char *mode) {
sprintf
(
str
,
"%d"
,
client_count
);
sprintf
(
str
,
"%d"
,
client_count
);
set_env
(
"RFB_CLIENT_COUNT"
,
str
);
set_env
(
"RFB_CLIENT_COUNT"
,
str
);
/* gone, accept, afteraccept */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLogEnable
(
1
);
rfbLogEnable
(
1
);
rfbLog
(
"cannot run external commands in -nocmds mode:
\n
"
);
rfbLog
(
"cannot run external commands in -nocmds mode:
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
x11vnc/gui.c
View file @
1776a3a5
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include "win_utils.h"
#include "win_utils.h"
#include "remote.h"
#include "remote.h"
#include "cleanup.h"
#include "cleanup.h"
#include "xwrappers.h"
#include "tkx11vnc.h"
#include "tkx11vnc.h"
...
@@ -229,15 +230,15 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
...
@@ -229,15 +230,15 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
}
else
{
}
else
{
old_xauth
=
strdup
(
""
);
old_xauth
=
strdup
(
""
);
}
}
dpy
=
XOpenDisplay
(
x11vnc_xdisplay
);
dpy
=
XOpenDisplay
_wr
(
x11vnc_xdisplay
);
if
(
!
dpy
&&
auth_file
)
{
if
(
!
dpy
&&
auth_file
)
{
set_env
(
"XAUTHORITY"
,
auth_file
);
set_env
(
"XAUTHORITY"
,
auth_file
);
dpy
=
XOpenDisplay
(
x11vnc_xdisplay
);
dpy
=
XOpenDisplay
_wr
(
x11vnc_xdisplay
);
}
}
if
(
!
dpy
&&
!
x11vnc_xdisplay
)
{
if
(
!
dpy
&&
!
x11vnc_xdisplay
)
{
/* worstest case */
/* worstest case */
x11vnc_xdisplay
=
strdup
(
":0"
);
x11vnc_xdisplay
=
strdup
(
":0"
);
dpy
=
XOpenDisplay
(
x11vnc_xdisplay
);
dpy
=
XOpenDisplay
_wr
(
x11vnc_xdisplay
);
}
}
if
(
!
dpy
)
{
if
(
!
dpy
)
{
rfbLog
(
"gui: could not open x11vnc "
rfbLog
(
"gui: could not open x11vnc "
...
@@ -310,7 +311,7 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
...
@@ -310,7 +311,7 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
set_env
(
"X11VNC_CONNECT_FILE"
,
client_connect_file
);
set_env
(
"X11VNC_CONNECT_FILE"
,
client_connect_file
);
}
}
if
(
dpy
)
{
if
(
dpy
)
{
XCloseDisplay
(
dpy
);
XCloseDisplay
_wr
(
dpy
);
dpy
=
NULL
;
dpy
=
NULL
;
}
}
if
(
old_xauth
)
{
if
(
old_xauth
)
{
...
@@ -418,6 +419,7 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
...
@@ -418,6 +419,7 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc
set_env
(
"X11VNC_ICON_FONT"
,
icon_mode_font
);
set_env
(
"X11VNC_ICON_FONT"
,
icon_mode_font
);
}
}
/* gui */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
fprintf
(
stderr
,
"cannot run external commands in -nocmds "
fprintf
(
stderr
,
"cannot run external commands in -nocmds "
"mode:
\n
"
);
"mode:
\n
"
);
...
@@ -576,20 +578,20 @@ void do_gui(char *opts, int sleep) {
...
@@ -576,20 +578,20 @@ void do_gui(char *opts, int sleep) {
fprintf
(
stderr
,
"starting gui, trying display: %s
\n
"
,
fprintf
(
stderr
,
"starting gui, trying display: %s
\n
"
,
gui_xdisplay
);
gui_xdisplay
);
}
}
test_dpy
=
XOpenDisplay
(
gui_xdisplay
);
test_dpy
=
XOpenDisplay
_wr
(
gui_xdisplay
);
if
(
!
test_dpy
&&
auth_file
)
{
if
(
!
test_dpy
&&
auth_file
)
{
if
(
getenv
(
"XAUTHORITY"
)
!=
NULL
)
{
if
(
getenv
(
"XAUTHORITY"
)
!=
NULL
)
{
old_xauth
=
strdup
(
getenv
(
"XAUTHORITY"
));
old_xauth
=
strdup
(
getenv
(
"XAUTHORITY"
));
}
}
set_env
(
"XAUTHORITY"
,
auth_file
);
set_env
(
"XAUTHORITY"
,
auth_file
);
test_dpy
=
XOpenDisplay
(
gui_xdisplay
);
test_dpy
=
XOpenDisplay
_wr
(
gui_xdisplay
);
}
}
if
(
!
test_dpy
)
{
if
(
!
test_dpy
)
{
if
(
!
old_xauth
&&
getenv
(
"XAUTHORITY"
)
!=
NULL
)
{
if
(
!
old_xauth
&&
getenv
(
"XAUTHORITY"
)
!=
NULL
)
{
old_xauth
=
strdup
(
getenv
(
"XAUTHORITY"
));
old_xauth
=
strdup
(
getenv
(
"XAUTHORITY"
));
}
}
set_env
(
"XAUTHORITY"
,
""
);
set_env
(
"XAUTHORITY"
,
""
);
test_dpy
=
XOpenDisplay
(
gui_xdisplay
);
test_dpy
=
XOpenDisplay
_wr
(
gui_xdisplay
);
}
}
if
(
!
test_dpy
)
{
if
(
!
test_dpy
)
{
fprintf
(
stderr
,
"error: cannot connect to gui X DISPLAY: %s
\n
"
,
fprintf
(
stderr
,
"error: cannot connect to gui X DISPLAY: %s
\n
"
,
...
@@ -603,7 +605,7 @@ void do_gui(char *opts, int sleep) {
...
@@ -603,7 +605,7 @@ void do_gui(char *opts, int sleep) {
tray_manager_ok
=
0
;
tray_manager_ok
=
0
;
}
}
}
}
XCloseDisplay
(
test_dpy
);
XCloseDisplay
_wr
(
test_dpy
);
if
(
start_x11vnc
)
{
if
(
start_x11vnc
)
{
...
...
This diff is collapsed.
Click to expand it.
x11vnc/help.c
View file @
1776a3a5
This diff is collapsed.
Click to expand it.
x11vnc/options.c
View file @
1776a3a5
...
@@ -93,7 +93,7 @@ char *allowed_input_str = NULL;
...
@@ -93,7 +93,7 @@ char *allowed_input_str = NULL;
char
*
viewonly_passwd
=
NULL
;
/* view only passwd. */
char
*
viewonly_passwd
=
NULL
;
/* view only passwd. */
char
**
passwd_list
=
NULL
;
/* for -passwdfile */
char
**
passwd_list
=
NULL
;
/* for -passwdfile */
int
begin_viewonly
=
-
1
;
int
begin_viewonly
=
-
1
;
int
inetd
=
0
;
/* spawned from inetd(
1
) */
int
inetd
=
0
;
/* spawned from inetd(
8
) */
#ifndef FILEXFER
#ifndef FILEXFER
#define FILEXFER 1
#define FILEXFER 1
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
x11vnc/pointer.c
View file @
1776a3a5
...
@@ -941,6 +941,7 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p);
...
@@ -941,6 +941,7 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p);
}
}
set_child_info
();
set_child_info
();
/* pipeinput */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLogEnable
(
1
);
rfbLogEnable
(
1
);
rfbLog
(
"cannot run external commands in -nocmds mode:
\n
"
);
rfbLog
(
"cannot run external commands in -nocmds mode:
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
x11vnc/remote.c
View file @
1776a3a5
...
@@ -585,7 +585,7 @@ int remote_control_access_ok(void) {
...
@@ -585,7 +585,7 @@ int remote_control_access_ok(void) {
"XAUTHORITY
\n
"
,
dpy_str
);
"XAUTHORITY
\n
"
,
dpy_str
);
fprintf
(
stderr
,
" -- (ignore any Xlib: errors that"
fprintf
(
stderr
,
" -- (ignore any Xlib: errors that"
" follow) --
\n
"
);
" follow) --
\n
"
);
dpy2
=
XOpenDisplay
(
dpy_str
);
dpy2
=
XOpenDisplay
_wr
(
dpy_str
);
fflush
(
stderr
);
fflush
(
stderr
);
fprintf
(
stderr
,
" -- (done checking) --
\n\n
"
);
fprintf
(
stderr
,
" -- (done checking) --
\n\n
"
);
...
@@ -601,7 +601,7 @@ int remote_control_access_ok(void) {
...
@@ -601,7 +601,7 @@ int remote_control_access_ok(void) {
if
(
dpy2
)
{
if
(
dpy2
)
{
rfbLog
(
"XAUTHORITY is not required on display.
\n
"
);
rfbLog
(
"XAUTHORITY is not required on display.
\n
"
);
rfbLog
(
" %s
\n
"
,
DisplayString
(
dpy
));
rfbLog
(
" %s
\n
"
,
DisplayString
(
dpy
));
XCloseDisplay
(
dpy2
);
XCloseDisplay
_wr
(
dpy2
);
dpy2
=
NULL
;
dpy2
=
NULL
;
return
0
;
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
x11vnc/screen.c
View file @
1776a3a5
...
@@ -541,7 +541,7 @@ void set_raw_fb_params(int restore) {
...
@@ -541,7 +541,7 @@ void set_raw_fb_params(int restore) {
multiple_cursors_mode
=
mc0
;
multiple_cursors_mode
=
mc0
;
if
(
!
dpy
&&
raw_fb_orig_dpy
)
{
if
(
!
dpy
&&
raw_fb_orig_dpy
)
{
dpy
=
XOpenDisplay
(
raw_fb_orig_dpy
);
dpy
=
XOpenDisplay
_wr
(
raw_fb_orig_dpy
);
if
(
dpy
)
{
if
(
dpy
)
{
if
(
!
quiet
)
rfbLog
(
"reopened DISPLAY: %s
\n
"
,
if
(
!
quiet
)
rfbLog
(
"reopened DISPLAY: %s
\n
"
,
raw_fb_orig_dpy
);
raw_fb_orig_dpy
);
...
@@ -881,6 +881,7 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
...
@@ -881,6 +881,7 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
set_child_info
();
set_child_info
();
q
+=
strlen
(
"setup:"
);
q
+=
strlen
(
"setup:"
);
/* rawfb-setup */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLogEnable
(
1
);
rfbLogEnable
(
1
);
rfbLog
(
"cannot run external commands in -nocmds "
rfbLog
(
"cannot run external commands in -nocmds "
...
@@ -988,7 +989,7 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
...
@@ -988,7 +989,7 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
if
(
dpy
)
{
if
(
dpy
)
{
rfbLog
(
"closing X DISPLAY: %s in rawfb mode.
\n
"
,
rfbLog
(
"closing X DISPLAY: %s in rawfb mode.
\n
"
,
DisplayString
(
dpy
));
DisplayString
(
dpy
));
XCloseDisplay
(
dpy
);
/* yow! */
XCloseDisplay
_wr
(
dpy
);
/* yow! */
}
}
dpy
=
NULL
;
dpy
=
NULL
;
}
}
...
@@ -1974,7 +1975,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
...
@@ -1974,7 +1975,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
have_masks
=
0
;
have_masks
=
0
;
}
}
if
(
cmap8to24
&&
depth
==
8
)
{
if
(
cmap8to24
&&
depth
==
8
&&
dpy
)
{
XVisualInfo
vinfo
;
XVisualInfo
vinfo
;
/* more cooking up... */
/* more cooking up... */
have_masks
=
2
;
have_masks
=
2
;
...
@@ -2042,6 +2043,8 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
...
@@ -2042,6 +2043,8 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
rfbLog
(
"Raw fb at addr %p is %dbpp depth=%d "
rfbLog
(
"Raw fb at addr %p is %dbpp depth=%d "
"true color
\n
"
,
raw_fb_addr
,
"true color
\n
"
,
raw_fb_addr
,
fb_bpp
,
fb_depth
);
fb_bpp
,
fb_depth
);
}
else
if
(
!
dpy
)
{
;
}
else
if
(
have_masks
==
2
)
{
}
else
if
(
have_masks
==
2
)
{
rfbLog
(
"
\n
"
);
rfbLog
(
"
\n
"
);
rfbLog
(
"X display %s is %dbpp depth=%d indexed "
rfbLog
(
"X display %s is %dbpp depth=%d indexed "
...
@@ -2206,6 +2209,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
...
@@ -2206,6 +2209,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
fprintf
(
stderr
,
" 8to24_fb: %p
\n
"
,
cmap8to24_fb
);
fprintf
(
stderr
,
" 8to24_fb: %p
\n
"
,
cmap8to24_fb
);
fprintf
(
stderr
,
" snap_fb: %p
\n
"
,
snap_fb
);
fprintf
(
stderr
,
" snap_fb: %p
\n
"
,
snap_fb
);
fprintf
(
stderr
,
" raw_fb: %p
\n
"
,
raw_fb
);
fprintf
(
stderr
,
" raw_fb: %p
\n
"
,
raw_fb
);
fprintf
(
stderr
,
" fake_fb: %p
\n
"
,
fake_fb
);
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
x11vnc/solid.c
View file @
1776a3a5
...
@@ -53,6 +53,7 @@ static int dt_cmd(char *cmd) {
...
@@ -53,6 +53,7 @@ static int dt_cmd(char *cmd) {
return
0
;
return
0
;
}
}
/* dt */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLog
(
"cannot run external commands in -nocmds mode:
\n
"
);
rfbLog
(
"cannot run external commands in -nocmds mode:
\n
"
);
rfbLog
(
"
\"
%s
\"\n
"
,
cmd
);
rfbLog
(
"
\"
%s
\"\n
"
,
cmd
);
...
...
This diff is collapsed.
Click to expand it.
x11vnc/sslcmds.c
View file @
1776a3a5
...
@@ -113,6 +113,7 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
...
@@ -113,6 +113,7 @@ int start_stunnel(int stunnel_port, int x11vnc_port) {
return
0
;
return
0
;
}
}
/* stunnel */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLogEnable
(
1
);
rfbLogEnable
(
1
);
rfbLog
(
"start_stunnel: cannot run external commands in -nocmds mode:
\n
"
);
rfbLog
(
"start_stunnel: cannot run external commands in -nocmds mode:
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
x11vnc/sslhelper.c
View file @
1776a3a5
...
@@ -246,6 +246,7 @@ static char *create_tmp_pem(char *pathin, int prompt) {
...
@@ -246,6 +246,7 @@ static char *create_tmp_pem(char *pathin, int prompt) {
CN
=
strdup
(
line
);
CN
=
strdup
(
line
);
EM
=
strdup
(
"x11vnc@server.nowhere"
);
EM
=
strdup
(
"x11vnc@server.nowhere"
);
/* ssl */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLog
(
"create_tmp_pem: cannot run external commands.
\n
"
);
rfbLog
(
"create_tmp_pem: cannot run external commands.
\n
"
);
return
NULL
;
return
NULL
;
...
@@ -818,7 +819,7 @@ void openssl_port(void) {
...
@@ -818,7 +819,7 @@ void openssl_port(void) {
rfbLog
(
"openssl_port: could not reopen port %d
\n
"
,
port
);
rfbLog
(
"openssl_port: could not reopen port %d
\n
"
,
port
);
clean_up_exit
(
1
);
clean_up_exit
(
1
);
}
}
if
(
db
)
fprintf
(
stderr
,
"
listen on port/sock %d/%d
\n
"
,
port
,
sock
);
rfbLog
(
"openssl_port:
listen on port/sock %d/%d
\n
"
,
port
,
sock
);
openssl_sock
=
sock
;
openssl_sock
=
sock
;
openssl_port_num
=
port
;
openssl_port_num
=
port
;
...
...
This diff is collapsed.
Click to expand it.
x11vnc/tkx11vnc
View file @
1776a3a5
...
@@ -316,6 +316,12 @@ Tuning
...
@@ -316,6 +316,12 @@ Tuning
=D-C:0,1,2,3,4 pointer_mode:
=D-C:0,1,2,3,4 pointer_mode:
input_skip:
input_skip:
=D nodragging
=D nodragging
-- D
speeds:
=D wait:
defer:
=D nap
screen_blank:
--
--
=GAL WireFrame::
=GAL WireFrame::
wireframe
wireframe
...
@@ -337,12 +343,6 @@ Tuning
...
@@ -337,12 +343,6 @@ Tuning
xd_area:
xd_area:
xd_mem:
xd_mem:
=GAL LOFF
=GAL LOFF
-- D
speeds:
=D wait:
defer:
=D nap
screen_blank:
--
--
=GAL SharedMemory::
=GAL SharedMemory::
noshm
noshm
...
...
This diff is collapsed.
Click to expand it.
x11vnc/tkx11vnc.h
View file @
1776a3a5
...
@@ -327,6 +327,12 @@ char gui_code[] = "";
...
@@ -327,6 +327,12 @@ char gui_code[] = "";
" =D-C:0,1,2,3,4 pointer_mode:
\n
"
" =D-C:0,1,2,3,4 pointer_mode:
\n
"
" input_skip:
\n
"
" input_skip:
\n
"
" =D nodragging
\n
"
" =D nodragging
\n
"
" -- D
\n
"
" speeds:
\n
"
" =D wait:
\n
"
" defer:
\n
"
" =D nap
\n
"
" screen_blank:
\n
"
" --
\n
"
" --
\n
"
" =GAL WireFrame::
\n
"
" =GAL WireFrame::
\n
"
" wireframe
\n
"
" wireframe
\n
"
...
@@ -348,12 +354,6 @@ char gui_code[] = "";
...
@@ -348,12 +354,6 @@ char gui_code[] = "";
" xd_area:
\n
"
" xd_area:
\n
"
" xd_mem:
\n
"
" xd_mem:
\n
"
" =GAL LOFF
\n
"
" =GAL LOFF
\n
"
" -- D
\n
"
" speeds:
\n
"
" =D wait:
\n
"
" defer:
\n
"
" =D nap
\n
"
" screen_blank:
\n
"
" --
\n
"
" --
\n
"
" =GAL SharedMemory::
\n
"
" =GAL SharedMemory::
\n
"
" noshm
\n
"
" noshm
\n
"
...
...
This diff is collapsed.
Click to expand it.
x11vnc/unixpw.c
View file @
1776a3a5
...
@@ -49,7 +49,7 @@ void unixpw_screen(int init);
...
@@ -49,7 +49,7 @@ void unixpw_screen(int init);
void
unixpw_keystroke
(
rfbBool
down
,
rfbKeySym
keysym
,
int
init
);
void
unixpw_keystroke
(
rfbBool
down
,
rfbKeySym
keysym
,
int
init
);
void
unixpw_accept
(
char
*
user
);
void
unixpw_accept
(
char
*
user
);
void
unixpw_deny
(
void
);
void
unixpw_deny
(
void
);
int
su_verify
(
char
*
user
,
char
*
pass
);
int
su_verify
(
char
*
user
,
char
*
pass
,
char
*
cmd
,
char
*
rbuf
,
int
*
rbuf_size
);
int
crypt_verify
(
char
*
user
,
char
*
pass
);
int
crypt_verify
(
char
*
user
,
char
*
pass
);
static
int
white
(
void
);
static
int
white
(
void
);
...
@@ -63,6 +63,10 @@ int unixpw_login_viewonly = 0;
...
@@ -63,6 +63,10 @@ int unixpw_login_viewonly = 0;
time_t
unixpw_last_try_time
=
0
;
time_t
unixpw_last_try_time
=
0
;
rfbClientPtr
unixpw_client
=
NULL
;
rfbClientPtr
unixpw_client
=
NULL
;
int
keep_unixpw
=
0
;
char
*
keep_unixpw_user
=
NULL
;
char
*
keep_unixpw_pass
=
NULL
;
static
int
in_login
=
0
,
in_passwd
=
0
,
tries
=
0
;
static
int
in_login
=
0
,
in_passwd
=
0
,
tries
=
0
;
static
int
char_row
=
0
,
char_col
=
0
;
static
int
char_row
=
0
,
char_col
=
0
;
static
int
char_x
=
0
,
char_y
=
0
,
char_w
=
8
,
char_h
=
16
;
static
int
char_x
=
0
,
char_y
=
0
,
char_w
=
8
,
char_h
=
16
;
...
@@ -352,11 +356,11 @@ int crypt_verify(char *user, char *pass) {
...
@@ -352,11 +356,11 @@ int crypt_verify(char *user, char *pass) {
#endif
/* UNIXPW_CRYPT */
#endif
/* UNIXPW_CRYPT */
}
}
int
su_verify
(
char
*
user
,
char
*
pass
)
{
int
su_verify
(
char
*
user
,
char
*
pass
,
char
*
cmd
,
char
*
rbuf
,
int
*
rbuf_size
)
{
#ifndef UNIXPW_SU
#ifndef UNIXPW_SU
return
0
;
return
0
;
#else
#else
int
i
,
j
,
status
,
fd
=
-
1
,
sfd
,
tfd
;
int
i
,
j
,
status
,
fd
=
-
1
,
sfd
,
tfd
,
drain_size
=
4096
,
rsize
;
int
slow_pw
=
1
;
int
slow_pw
=
1
;
char
*
slave
,
*
bin_true
=
NULL
,
*
bin_su
=
NULL
;
char
*
slave
,
*
bin_true
=
NULL
,
*
bin_su
=
NULL
;
pid_t
pid
,
pidw
;
pid_t
pid
,
pidw
;
...
@@ -389,6 +393,7 @@ int su_verify(char *user, char *pass) {
...
@@ -389,6 +393,7 @@ int su_verify(char *user, char *pass) {
return
0
;
return
0
;
}
}
}
}
/* unixpw */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLog
(
"su_verify: cannot run external commands.
\n
"
);
rfbLog
(
"su_verify: cannot run external commands.
\n
"
);
clean_up_exit
(
1
);
clean_up_exit
(
1
);
...
@@ -417,6 +422,10 @@ int su_verify(char *user, char *pass) {
...
@@ -417,6 +422,10 @@ int su_verify(char *user, char *pass) {
}
if
(
stat
(
"/usr/bin/true"
,
&
sbuf
)
==
0
)
{
}
if
(
stat
(
"/usr/bin/true"
,
&
sbuf
)
==
0
)
{
bin_true
=
"/usr/bin/true"
;
bin_true
=
"/usr/bin/true"
;
}
}
if
(
cmd
!=
NULL
&&
cmd
[
0
]
!=
'\0'
)
{
/* this is for ext. cmd su -c "my cmd" */
bin_true
=
cmd
;
}
if
(
bin_true
==
NULL
)
{
if
(
bin_true
==
NULL
)
{
rfbLogPerror
(
"existence /bin/true"
);
rfbLogPerror
(
"existence /bin/true"
);
return
0
;
return
0
;
...
@@ -617,13 +626,13 @@ if (db) fprintf(stderr, "slave is: %s fd=%d\n", slave, fd);
...
@@ -617,13 +626,13 @@ if (db) fprintf(stderr, "slave is: %s fd=%d\n", slave, fd);
if
(
db
)
fprintf
(
stderr
,
"%s"
,
buf
);
if
(
db
)
fprintf
(
stderr
,
"%s"
,
buf
);
if
(
db
>
3
&&
n
==
1
&&
buf
[
0
]
==
':'
)
{
if
(
db
>
3
&&
n
==
1
&&
buf
[
0
]
==
':'
)
{
char
cmd
[
32
];
char
cmd
0
[
32
];
usleep
(
100
*
1000
);
usleep
(
100
*
1000
);
fprintf
(
stderr
,
"
\n\n
"
);
fprintf
(
stderr
,
"
\n\n
"
);
sprintf
(
cmd
,
"ps wu %d"
,
pid
);
sprintf
(
cmd
0
,
"ps wu %d"
,
pid
);
system
(
cmd
);
system
(
cmd
0
);
sprintf
(
cmd
,
"stty -a < %s"
,
slave
);
sprintf
(
cmd
0
,
"stty -a < %s"
,
slave
);
system
(
cmd
);
system
(
cmd
0
);
fprintf
(
stderr
,
"
\n\n
"
);
fprintf
(
stderr
,
"
\n\n
"
);
}
}
...
@@ -675,7 +684,12 @@ if (db) {
...
@@ -675,7 +684,12 @@ if (db) {
* if we don't drain we may block at waitpid. If we close(fd), the
* if we don't drain we may block at waitpid. If we close(fd), the
* make cause child to die by signal.
* make cause child to die by signal.
*/
*/
for
(
i
=
0
;
i
<
4096
;
i
++
)
{
if
(
rbuf
&&
*
rbuf_size
>
0
)
{
/* asked to return output of command */
drain_size
=
*
rbuf_size
;
rsize
=
0
;
}
for
(
i
=
0
;
i
<
drain_size
;
i
++
)
{
int
n
;
int
n
;
buf
[
0
]
=
'\0'
;
buf
[
0
]
=
'\0'
;
...
@@ -691,6 +705,48 @@ if (db) fprintf(stderr, "%s", buf);
...
@@ -691,6 +705,48 @@ if (db) fprintf(stderr, "%s", buf);
if
(
n
<=
0
)
{
if
(
n
<=
0
)
{
break
;
break
;
}
}
if
(
rbuf
)
{
rbuf
[
i
]
=
buf
[
0
];
rsize
++
;
}
}
if
(
rbuf
)
{
char
*
s
=
rbuf
;
char
*
p
=
strdup
(
pass
);
int
n
,
o
=
0
;
n
=
strlen
(
p
);
if
(
p
[
n
-
1
]
==
'\n'
)
{
p
[
n
-
1
]
=
'\0'
;
}
/*
* usually is: Password: mypassword\r\n\r\n<output-of-command>
* and output will have \n -> \r\n
*/
if
(
rbuf
[
0
]
==
' '
)
{
s
++
;
o
++
;
}
if
(
strstr
(
s
,
p
)
==
s
)
{
s
+=
strlen
(
p
);
o
+=
strlen
(
p
);
for
(
n
=
0
;
n
<
4
;
n
++
)
{
if
(
s
[
0
]
==
'\r'
||
s
[
0
]
==
'\n'
)
{
s
++
;
o
++
;
}
}
}
if
(
o
>
0
)
{
int
i
=
0
;
rsize
-=
o
;
while
(
o
<
drain_size
)
{
rbuf
[
i
++
]
=
rbuf
[
o
++
];
}
}
*
rbuf_size
=
rsize
;
strzero
(
p
);
}
}
if
(
db
)
fprintf
(
stderr
,
"
\n
"
);
if
(
db
)
fprintf
(
stderr
,
"
\n
"
);
...
@@ -730,14 +786,39 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "***
...
@@ -730,14 +786,39 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "***
if
(
unixpw_nis
)
{
if
(
unixpw_nis
)
{
if
(
crypt_verify
(
user
,
pass
))
{
if
(
crypt_verify
(
user
,
pass
))
{
unixpw_accept
(
user
);
unixpw_accept
(
user
);
if
(
keep_unixpw
)
{
keep_unixpw_user
=
strdup
(
user
);
keep_unixpw_pass
=
strdup
(
pass
);
}
return
;
return
;
}
else
{
}
else
{
rfbLog
(
"unixpw_verify: crypt_verify login for %s failed.
\n
"
,
user
);
rfbLog
(
"unixpw_verify: crypt_verify login for %s failed.
\n
"
,
user
);
usleep
(
3000
*
1000
);
usleep
(
3000
*
1000
);
}
}
}
else
if
(
0
)
{
char
buf
[
8192
];
int
n
=
8000
;
int
res
=
su_verify
(
user
,
pass
,
"/home/runge/wallycom yegg 33"
,
buf
,
&
n
);
fprintf
(
stderr
,
"su_verify ret: n=%d "
,
n
);
write
(
2
,
buf
,
n
);
if
(
res
)
{
unixpw_accept
(
user
);
if
(
keep_unixpw
)
{
keep_unixpw_user
=
strdup
(
user
);
keep_unixpw_pass
=
strdup
(
pass
);
}
return
;
}
rfbLog
(
"unixpw_verify: su_verify login for %s failed.
\n
"
,
user
);
}
else
{
}
else
{
if
(
su_verify
(
user
,
pass
))
{
if
(
su_verify
(
user
,
pass
,
NULL
,
NULL
,
NULL
))
{
unixpw_accept
(
user
);
unixpw_accept
(
user
);
if
(
keep_unixpw
)
{
keep_unixpw_user
=
strdup
(
user
);
keep_unixpw_pass
=
strdup
(
pass
);
}
return
;
return
;
}
}
rfbLog
(
"unixpw_verify: su_verify login for %s failed.
\n
"
,
user
);
rfbLog
(
"unixpw_verify: su_verify login for %s failed.
\n
"
,
user
);
...
@@ -803,6 +884,14 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
...
@@ -803,6 +884,14 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
user
[
i
]
=
'\0'
;
user
[
i
]
=
'\0'
;
pass
[
i
]
=
'\0'
;
pass
[
i
]
=
'\0'
;
}
}
if
(
keep_unixpw_user
)
{
free
(
keep_unixpw_user
);
keep_unixpw_user
=
NULL
;
}
if
(
keep_unixpw_pass
)
{
free
(
keep_unixpw_pass
);
keep_unixpw_pass
=
NULL
;
}
return
;
return
;
}
}
...
@@ -1027,6 +1116,41 @@ static void apply_opts (char *user) {
...
@@ -1027,6 +1116,41 @@ static void apply_opts (char *user) {
void
unixpw_accept
(
char
*
user
)
{
void
unixpw_accept
(
char
*
user
)
{
apply_opts
(
user
);
apply_opts
(
user
);
if
(
started_as_root
==
1
&&
users_list
&&
strstr
(
users_list
,
"unixpw="
)
==
users_list
)
{
if
(
getuid
()
&&
geteuid
())
{
rfbLog
(
"unixpw_accept: unixpw= but not root
\n
"
);
started_as_root
=
2
;
}
else
{
char
*
u
=
(
char
*
)
malloc
(
strlen
(
user
)
+
1
);
u
[
0
]
=
'\0'
;
if
(
!
strcmp
(
users_list
,
"unixpw="
))
{
sprintf
(
u
,
"+%s"
,
user
);
}
else
{
char
*
p
,
*
str
=
strdup
(
users_list
);
p
=
strtok
(
str
+
strlen
(
"unixpw="
),
","
);
while
(
p
)
{
if
(
!
strcmp
(
p
,
user
))
{
sprintf
(
u
,
"+%s"
,
user
);
break
;
}
p
=
strtok
(
NULL
,
","
);
}
free
(
str
);
}
if
(
u
[
0
]
==
'\0'
)
{
rfbLog
(
"unixpw_accept skipping switch to user: %s
\n
"
,
user
);
}
else
if
(
switch_user
(
u
,
0
))
{
rfbLog
(
"unixpw_accept switched to user: %s
\n
"
,
user
);
}
else
{
rfbLog
(
"unixpw_accept failed to switched to user: %s
\n
"
,
user
);
}
free
(
u
);
}
}
if
(
unixpw_login_viewonly
)
{
if
(
unixpw_login_viewonly
)
{
unixpw_client
->
viewOnly
=
TRUE
;
unixpw_client
->
viewOnly
=
TRUE
;
}
}
...
...
This diff is collapsed.
Click to expand it.
x11vnc/unixpw.h
View file @
1776a3a5
...
@@ -7,12 +7,15 @@ extern void unixpw_screen(int init);
...
@@ -7,12 +7,15 @@ extern void unixpw_screen(int init);
extern
void
unixpw_keystroke
(
rfbBool
down
,
rfbKeySym
keysym
,
int
init
);
extern
void
unixpw_keystroke
(
rfbBool
down
,
rfbKeySym
keysym
,
int
init
);
extern
void
unixpw_accept
(
char
*
user
);
extern
void
unixpw_accept
(
char
*
user
);
extern
void
unixpw_deny
(
void
);
extern
void
unixpw_deny
(
void
);
extern
int
su_verify
(
char
*
user
,
char
*
pass
);
extern
int
su_verify
(
char
*
user
,
char
*
pass
,
char
*
cmd
,
char
*
rbuf
,
int
*
rbuf_size
);
extern
int
crypt_verify
(
char
*
user
,
char
*
pass
);
extern
int
crypt_verify
(
char
*
user
,
char
*
pass
);
extern
int
unixpw_in_progress
;
extern
int
unixpw_in_progress
;
extern
int
unixpw_login_viewonly
;
extern
int
unixpw_login_viewonly
;
extern
time_t
unixpw_last_try_time
;
extern
time_t
unixpw_last_try_time
;
extern
rfbClientPtr
unixpw_client
;
extern
rfbClientPtr
unixpw_client
;
extern
int
keep_unixpw
;
extern
char
*
keep_unixpw_user
;
extern
char
*
keep_unixpw_pass
;
#endif
/* _X11VNC_UNIXPW_H */
#endif
/* _X11VNC_UNIXPW_H */
This diff is collapsed.
Click to expand it.
x11vnc/user.c
View file @
1776a3a5
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
#include "scan.h"
#include "scan.h"
#include "screen.h"
#include "screen.h"
#include "unixpw.h"
#include "unixpw.h"
#include "sslhelper.h"
#include "xwrappers.h"
void
check_switched_user
(
void
);
void
check_switched_user
(
void
);
void
lurk_loop
(
char
*
str
);
void
lurk_loop
(
char
*
str
);
...
@@ -13,6 +15,7 @@ int switch_user(char *user, int fb_mode);
...
@@ -13,6 +15,7 @@ int switch_user(char *user, int fb_mode);
int
read_passwds
(
char
*
passfile
);
int
read_passwds
(
char
*
passfile
);
void
install_passwds
(
void
);
void
install_passwds
(
void
);
void
check_new_passwds
(
void
);
void
check_new_passwds
(
void
);
int
wait_for_client
(
int
*
argc
,
char
**
argv
,
int
http
);
static
void
switch_user_task_dummy
(
void
);
static
void
switch_user_task_dummy
(
void
);
...
@@ -574,9 +577,9 @@ static int try_user_and_display(uid_t uid, char *dpystr) {
...
@@ -574,9 +577,9 @@ static int try_user_and_display(uid_t uid, char *dpystr) {
}
}
fclose
(
stderr
);
fclose
(
stderr
);
dpy2
=
XOpenDisplay
(
dpystr
);
dpy2
=
XOpenDisplay
_wr
(
dpystr
);
if
(
dpy2
)
{
if
(
dpy2
)
{
XCloseDisplay
(
dpy2
);
XCloseDisplay
_wr
(
dpy2
);
exit
(
0
);
/* success */
exit
(
0
);
/* success */
}
else
{
}
else
{
exit
(
2
);
/* fail */
exit
(
2
);
/* fail */
...
@@ -940,4 +943,234 @@ void check_new_passwds(void) {
...
@@ -940,4 +943,234 @@ void check_new_passwds(void) {
}
}
}
}
int
wait_for_client
(
int
*
argc
,
char
**
argv
,
int
http
)
{
static
XImage
ximage_struct
;
XImage
*
fb_image
;
int
w
=
640
,
h
=
480
,
b
=
32
;
int
w0
,
h0
,
i
;
int
chg_raw_fb
=
0
;
char
*
str
,
*
q
,
*
p
;
char
*
cmd
=
NULL
;
int
db
=
0
;
if
(
!
use_dpy
||
strstr
(
use_dpy
,
"WAIT:"
)
!=
use_dpy
)
{
return
0
;
}
rfbLog
(
"into wait_for_client.
\n
"
);
str
=
strdup
(
use_dpy
);
str
+=
strlen
(
"WAIT:"
);
q
=
strchr
(
str
,
':'
);
/* get any leading geometry: */
if
(
q
)
*
q
=
'\0'
;
if
(
sscanf
(
str
,
"%dx%d"
,
&
w0
,
&
h0
)
==
2
)
{
w
=
w0
;
h
=
h0
;
}
if
(
q
)
*
q
=
':'
;
q
=
strchr
(
str
,
':'
);
if
(
!
q
)
{
if
(
strstr
(
str
,
"cmd="
)
!=
str
)
{
str
=
strdup
(
":0"
);
}
}
else
{
str
=
q
;
}
if
(
db
)
fprintf
(
stderr
,
"str: %s
\n
"
,
str
);
if
(
strstr
(
str
,
"cmd="
)
==
str
)
{
cmd
=
str
+
strlen
(
"cmd="
);
if
(
db
)
fprintf
(
stderr
,
"cmd: %s
\n
"
,
cmd
);
/* WAIT */
if
(
no_external_cmds
)
{
rfbLog
(
"wait_for_client external cmds not allowed:"
" %s
\n
"
,
use_dpy
);
clean_up_exit
(
1
);
}
}
if
(
fake_fb
)
{
free
(
fake_fb
);
}
fake_fb
=
(
char
*
)
calloc
(
w
*
h
*
b
/
4
,
1
);
fb_image
=
&
ximage_struct
;
fb_image
->
data
=
fake_fb
;
fb_image
->
format
=
ZPixmap
;
fb_image
->
width
=
w
;
fb_image
->
height
=
h
;
fb_image
->
bits_per_pixel
=
b
;
fb_image
->
bytes_per_line
=
w
*
b
/
8
;
fb_image
->
bitmap_unit
=
-
1
;
fb_image
->
depth
=
24
;
fb_image
->
red_mask
=
0xff0000
;
fb_image
->
green_mask
=
0x00ff00
;
fb_image
->
blue_mask
=
0x0000ff
;
depth
=
fb_image
->
depth
;
dpy_x
=
wdpy_x
=
w
;
dpy_y
=
wdpy_y
=
h
;
off_x
=
0
;
off_y
=
0
;
initialize_allowed_input
();
initialize_screen
(
argc
,
argv
,
fb_image
);
if
(
http
&&
check_httpdir
())
{
http_connections
(
1
);
}
if
(
!
raw_fb
)
{
chg_raw_fb
=
1
;
/* kludge to get RAWFB_RET with dpy == NULL guards */
raw_fb
=
"null"
;
}
if
(
cmd
&&
unixpw
)
{
keep_unixpw
=
1
;
}
if
(
inetd
&&
use_openssl
)
{
accept_openssl
(
OPENSSL_INETD
);
}
while
(
1
)
{
if
(
!
use_threads
)
{
rfbPE
(
-
1
);
}
if
(
use_openssl
)
{
check_openssl
();
}
if
(
!
screen
||
!
screen
->
clientHead
)
{
usleep
(
100
*
1000
);
continue
;
}
rfbLog
(
"wait_for_client: got client
\n
"
);
break
;
}
if
(
unixpw
)
{
if
(
!
unixpw_in_progress
)
{
rfbLog
(
"unixpw but no unixpw_in_progress
\n
"
);
clean_up_exit
(
1
);
}
while
(
1
)
{
if
(
!
use_threads
)
{
rfbPE
(
-
1
);
}
if
(
unixpw_in_progress
)
{
usleep
(
20
*
1000
);
continue
;
}
rfbLog
(
"wait_for_client: unixpw finished.
\n
"
);
break
;
}
}
if
(
cmd
)
{
char
line1
[
1024
];
char
line2
[
16384
];
char
*
q
;
int
n
;
memset
(
line1
,
0
,
1024
);
memset
(
line2
,
0
,
16384
);
if
(
unixpw
)
{
int
res
=
0
,
k
,
j
;
char
line
[
18000
];
memset
(
line
,
0
,
18000
);
if
(
keep_unixpw_user
&&
keep_unixpw_pass
)
{
n
=
18000
;
res
=
su_verify
(
keep_unixpw_user
,
keep_unixpw_pass
,
cmd
,
line
,
&
n
);
strzero
(
keep_unixpw_user
);
strzero
(
keep_unixpw_pass
);
}
keep_unixpw
=
0
;
if
(
!
res
)
{
rfbLog
(
"wait_for_client: cmd failed: %s
\n
"
,
cmd
);
clean_up_exit
(
1
);
}
for
(
k
=
0
;
k
<
1024
;
k
++
)
{
line1
[
k
]
=
line
[
k
];
if
(
line
[
k
]
==
'\n'
)
{
k
++
;
break
;
}
}
n
-=
k
;
while
(
j
<
16384
)
{
line2
[
j
]
=
line
[
k
+
j
];
j
++
;
}
}
else
{
FILE
*
p
=
popen
(
cmd
,
"r"
);
if
(
!
p
)
{
rfbLog
(
"wait_for_client: cmd failed: %s
\n
"
,
cmd
);
rfbLogPerror
(
"popen"
);
clean_up_exit
(
1
);
}
if
(
fgets
(
line1
,
1024
,
p
)
==
NULL
)
{
rfbLog
(
"wait_for_client: read failed: %s
\n
"
,
cmd
);
rfbLogPerror
(
"fgets"
);
clean_up_exit
(
1
);
}
n
=
fread
(
line2
,
1
,
16384
,
p
);
pclose
(
p
);
}
if
(
strstr
(
line1
,
"DISPLAY="
)
!=
line1
)
{
rfbLog
(
"wait_for_client: bad reply %s
\n
"
,
line1
);
clean_up_exit
(
1
);
}
use_dpy
=
strdup
(
line1
+
strlen
(
"DISPLAY="
));
q
=
use_dpy
;
while
(
*
q
!=
'\0'
)
{
if
(
*
q
==
'\n'
||
*
q
==
'\r'
)
*
q
=
'\0'
;
q
++
;
}
if
(
db
)
fprintf
(
stderr
,
"use_dpy: %s n: %d
\n
"
,
use_dpy
,
n
);
if
(
0
)
write
(
2
,
line2
,
n
);
if
(
line2
[
0
]
!=
'\0'
)
{
if
(
strstr
(
line2
,
"XAUTHORITY="
)
==
line2
)
{
q
=
line2
;
while
(
*
q
!=
'\0'
)
{
if
(
*
q
==
'\n'
||
*
q
==
'\r'
)
*
q
=
'\0'
;
q
++
;
}
if
(
auth_file
)
{
free
(
auth_file
);
}
auth_file
=
strdup
(
line2
+
strlen
(
"XAUTHORITY="
));
}
else
{
xauth_raw_data
=
(
char
*
)
malloc
(
n
);
xauth_raw_len
=
n
;
memcpy
(
xauth_raw_data
,
line2
,
n
);
if
(
db
)
fprintf
(
stderr
,
"xauth_raw_len: %d
\n
"
,
n
);
if
(
0
)
{
write
(
2
,
xauth_raw_data
,
xauth_raw_len
);
fprintf
(
stderr
,
"
\n
"
);
}
}
}
}
else
{
use_dpy
=
strdup
(
str
);
}
if
(
chg_raw_fb
)
{
raw_fb
=
NULL
;
}
return
1
;
}
This diff is collapsed.
Click to expand it.
x11vnc/user.h
View file @
1776a3a5
...
@@ -9,5 +9,6 @@ extern int switch_user(char *, int);
...
@@ -9,5 +9,6 @@ extern int switch_user(char *, int);
extern
int
read_passwds
(
char
*
passfile
);
extern
int
read_passwds
(
char
*
passfile
);
extern
void
install_passwds
(
void
);
extern
void
install_passwds
(
void
);
extern
void
check_new_passwds
(
void
);
extern
void
check_new_passwds
(
void
);
extern
int
wait_for_client
(
int
*
argc
,
char
**
argv
,
int
http
);
#endif
/* _X11VNC_USER_H */
#endif
/* _X11VNC_USER_H */
This diff is collapsed.
Click to expand it.
x11vnc/v4l.c
View file @
1776a3a5
...
@@ -1089,6 +1089,7 @@ static char *guess_via_v4l_info(char *dev, int *fd) {
...
@@ -1089,6 +1089,7 @@ static char *guess_via_v4l_info(char *dev, int *fd) {
if
(
*
fd
)
{}
if
(
*
fd
)
{}
/* v4l-info */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLog
(
"guess_via_v4l_info: cannot run external "
rfbLog
(
"guess_via_v4l_info: cannot run external "
"command: v4l-info
\n
"
);
"command: v4l-info
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
x11vnc/win_utils.c
View file @
1776a3a5
...
@@ -304,6 +304,7 @@ int pick_windowid(unsigned long *num) {
...
@@ -304,6 +304,7 @@ int pick_windowid(unsigned long *num) {
if
(
use_dpy
)
{
if
(
use_dpy
)
{
set_env
(
"DISPLAY"
,
use_dpy
);
set_env
(
"DISPLAY"
,
use_dpy
);
}
}
/* id */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
rfbLogEnable
(
1
);
rfbLogEnable
(
1
);
rfbLog
(
"cannot run external commands in -nocmds mode:
\n
"
);
rfbLog
(
"cannot run external commands in -nocmds mode:
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
x11vnc/x11vnc.1
View file @
1776a3a5
This diff is collapsed.
Click to expand it.
x11vnc/x11vnc.c
View file @
1776a3a5
...
@@ -960,7 +960,7 @@ static void quick_pw(char *str) {
...
@@ -960,7 +960,7 @@ static void quick_pw(char *str) {
}
}
fprintf
(
stdout
,
"password: "
);
fprintf
(
stdout
,
"password: "
);
/* no_external_cmds does not apply */
/*
test mode:
no_external_cmds does not apply */
system
(
"stty -echo"
);
system
(
"stty -echo"
);
if
(
fgets
(
tmp
,
128
,
stdin
)
==
NULL
)
{
if
(
fgets
(
tmp
,
128
,
stdin
)
==
NULL
)
{
fprintf
(
stdout
,
"
\n
"
);
fprintf
(
stdout
,
"
\n
"
);
...
@@ -1003,7 +1003,7 @@ static void quick_pw(char *str) {
...
@@ -1003,7 +1003,7 @@ static void quick_pw(char *str) {
exit
(
1
);
exit
(
1
);
}
}
}
else
{
}
else
{
if
(
su_verify
(
p
,
q
+
1
))
{
if
(
su_verify
(
p
,
q
+
1
,
NULL
,
NULL
,
NULL
))
{
fprintf
(
stdout
,
"Y %s
\n
"
,
p
);
fprintf
(
stdout
,
"Y %s
\n
"
,
p
);
exit
(
0
);
exit
(
0
);
}
else
{
}
else
{
...
@@ -1254,7 +1254,7 @@ static void check_loop_mode(int argc, char* argv[]) {
...
@@ -1254,7 +1254,7 @@ static void check_loop_mode(int argc, char* argv[]) {
perror
(
"fork"
);
perror
(
"fork"
);
exit
(
1
);
exit
(
1
);
}
else
{
}
else
{
/* no_external_cmds does not apply */
/*
loop mode:
no_external_cmds does not apply */
execvp
(
argv
[
0
],
argv2
);
execvp
(
argv
[
0
],
argv2
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -1283,6 +1283,7 @@ static void store_homedir_passwd(char *file) {
...
@@ -1283,6 +1283,7 @@ static void store_homedir_passwd(char *file) {
str1
[
0
]
=
'\0'
;
str1
[
0
]
=
'\0'
;
str2
[
0
]
=
'\0'
;
str2
[
0
]
=
'\0'
;
/* storepasswd */
if
(
no_external_cmds
)
{
if
(
no_external_cmds
)
{
fprintf
(
stderr
,
"-nocmds cannot be used with -storepasswd
\n
"
);
fprintf
(
stderr
,
"-nocmds cannot be used with -storepasswd
\n
"
);
exit
(
1
);
exit
(
1
);
...
@@ -1388,6 +1389,7 @@ int main(int argc, char* argv[]) {
...
@@ -1388,6 +1389,7 @@ int main(int argc, char* argv[]) {
int
dt
=
0
,
bg
=
0
;
int
dt
=
0
,
bg
=
0
;
int
got_rfbwait
=
0
;
int
got_rfbwait
=
0
;
int
got_httpdir
=
0
,
try_http
=
0
;
int
got_httpdir
=
0
,
try_http
=
0
;
int
waited_for_client
=
0
;
XImage
*
fb0
=
NULL
;
XImage
*
fb0
=
NULL
;
/* used to pass args we do not know about to rfbGetScreen(): */
/* used to pass args we do not know about to rfbGetScreen(): */
...
@@ -2728,20 +2730,33 @@ int main(int argc, char* argv[]) {
...
@@ -2728,20 +2730,33 @@ int main(int argc, char* argv[]) {
use_xkb_modtweak
=
0
;
use_xkb_modtweak
=
0
;
#endif
#endif
#ifdef LIBVNCSERVER_WITH_TIGHTVNC_FILETRANSFER
if
(
filexfer
)
{
rfbRegisterTightVNCFileTransferExtension
();
}
else
{
rfbUnregisterTightVNCFileTransferExtension
();
}
#endif
initialize_allowed_input
();
if
(
users_list
&&
strstr
(
users_list
,
"lurk="
))
{
if
(
users_list
&&
strstr
(
users_list
,
"lurk="
))
{
if
(
use_dpy
)
{
if
(
use_dpy
)
{
rfbLog
(
"warning: -display does not make sense in "
rfbLog
(
"warning: -display does not make sense in "
"
\"
lurk=
\"
mode...
\n
"
);
"
\"
lurk=
\"
mode...
\n
"
);
}
}
lurk_loop
(
users_list
);
lurk_loop
(
users_list
);
}
else
if
(
use_dpy
&&
strstr
(
use_dpy
,
"WAIT:"
)
==
use_dpy
)
{
waited_for_client
=
wait_for_client
(
&
argc_vnc
,
argv_vnc
,
try_http
&&
!
got_httpdir
);
}
}
if
(
use_dpy
)
{
if
(
use_dpy
)
{
dpy
=
XOpenDisplay
(
use_dpy
);
dpy
=
XOpenDisplay
_wr
(
use_dpy
);
}
else
if
(
(
use_dpy
=
getenv
(
"DISPLAY"
))
)
{
}
else
if
(
(
use_dpy
=
getenv
(
"DISPLAY"
))
)
{
dpy
=
XOpenDisplay
(
use_dpy
);
dpy
=
XOpenDisplay
_wr
(
use_dpy
);
}
else
{
}
else
{
dpy
=
XOpenDisplay
(
""
);
dpy
=
XOpenDisplay
_wr
(
""
);
}
}
if
(
!
dpy
&&
raw_fb_str
)
{
if
(
!
dpy
&&
raw_fb_str
)
{
...
@@ -2764,7 +2779,7 @@ int main(int argc, char* argv[]) {
...
@@ -2764,7 +2779,7 @@ int main(int argc, char* argv[]) {
}
}
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
use_dpy
=
":0"
;
use_dpy
=
":0"
;
dpy
=
XOpenDisplay
(
use_dpy
);
dpy
=
XOpenDisplay
_wr
(
use_dpy
);
if
(
dpy
)
{
if
(
dpy
)
{
rfbLog
(
"*** XOpenDisplay of
\"
:0
\"
successful.
\n
"
);
rfbLog
(
"*** XOpenDisplay of
\"
:0
\"
successful.
\n
"
);
}
}
...
@@ -2803,7 +2818,7 @@ int main(int argc, char* argv[]) {
...
@@ -2803,7 +2818,7 @@ int main(int argc, char* argv[]) {
fflush
(
stderr
);
fflush
(
stderr
);
fflush
(
stdout
);
fflush
(
stdout
);
usleep
(
30
*
1000
);
/* still needed? */
usleep
(
30
*
1000
);
/* still needed? */
XCloseDisplay
(
dpy
);
XCloseDisplay
_wr
(
dpy
);
exit
(
rc
);
exit
(
rc
);
}
}
...
@@ -3133,13 +3148,6 @@ int main(int argc, char* argv[]) {
...
@@ -3133,13 +3148,6 @@ int main(int argc, char* argv[]) {
raw_fb_pass_go_and_collect_200_dollars
:
raw_fb_pass_go_and_collect_200_dollars
:
#ifdef LIBVNCSERVER_WITH_TIGHTVNC_FILETRANSFER
if
(
filexfer
)
{
rfbRegisterTightVNCFileTransferExtension
();
}
else
{
rfbUnregisterTightVNCFileTransferExtension
();
}
#endif
if
(
!
dt
)
{
if
(
!
dt
)
{
static
char
str
[]
=
"-desktop"
;
static
char
str
[]
=
"-desktop"
;
argv_vnc
[
argc_vnc
++
]
=
str
;
argv_vnc
[
argc_vnc
++
]
=
str
;
...
@@ -3162,8 +3170,15 @@ int main(int argc, char* argv[]) {
...
@@ -3162,8 +3170,15 @@ int main(int argc, char* argv[]) {
initialize_screen
(
&
argc_vnc
,
argv_vnc
,
fb0
);
initialize_screen
(
&
argc_vnc
,
argv_vnc
,
fb0
);
if
(
try_http
&&
!
got_httpdir
&&
check_httpdir
())
{
if
(
waited_for_client
&&
fake_fb
)
{
http_connections
(
1
);
free
(
fake_fb
);
fake_fb
=
NULL
;
}
if
(
!
waited_for_client
)
{
if
(
try_http
&&
!
got_httpdir
&&
check_httpdir
())
{
http_connections
(
1
);
}
}
}
initialize_tiles
();
initialize_tiles
();
...
@@ -3180,10 +3195,10 @@ int main(int argc, char* argv[]) {
...
@@ -3180,10 +3195,10 @@ int main(int argc, char* argv[]) {
initialize_keyboard_and_pointer
();
initialize_keyboard_and_pointer
();
initialize_allowed_input
();
if
(
inetd
&&
use_openssl
)
{
if
(
inetd
&&
use_openssl
)
{
accept_openssl
(
OPENSSL_INETD
);
if
(
!
waited_for_client
)
{
accept_openssl
(
OPENSSL_INETD
);
}
}
}
if
(
!
inetd
&&
!
use_openssl
)
{
if
(
!
inetd
&&
!
use_openssl
)
{
if
(
!
screen
->
port
||
screen
->
listenSock
<
0
)
{
if
(
!
screen
->
port
||
screen
->
listenSock
<
0
)
{
...
...
This diff is collapsed.
Click to expand it.
x11vnc/x11vnc.h
View file @
1776a3a5
...
@@ -114,7 +114,7 @@
...
@@ -114,7 +114,7 @@
#define PASSWD_UNLESS_NOPW 0
#define PASSWD_UNLESS_NOPW 0
#endif
#endif
#define REL81
#define
no
REL81
/*
/*
* Beginning of support for small binary footprint build for embedded
* Beginning of support for small binary footprint build for embedded
...
@@ -320,6 +320,8 @@ extern char lastmod[];
...
@@ -320,6 +320,8 @@ extern char lastmod[];
extern
Display
*
dpy
;
/* the single display screen we connect to */
extern
Display
*
dpy
;
/* the single display screen we connect to */
extern
int
scr
;
extern
int
scr
;
extern
char
*
xauth_raw_data
;
extern
int
xauth_raw_len
;
extern
Window
window
,
rootwin
;
/* polled window, root window (usu. same) */
extern
Window
window
,
rootwin
;
/* polled window, root window (usu. same) */
extern
Visual
*
default_visual
;
/* the default visual (unless -visual) */
extern
Visual
*
default_visual
;
/* the default visual (unless -visual) */
extern
int
bpp
,
depth
;
extern
int
bpp
,
depth
;
...
...
This diff is collapsed.
Click to expand it.
x11vnc/x11vnc_defs.c
View file @
1776a3a5
...
@@ -15,12 +15,14 @@ int xtrap_base_event_type = 0;
...
@@ -15,12 +15,14 @@ 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.8.
1 lastmod: 2006-06-03
"
;
char
lastmod
[]
=
"0.8.
2 lastmod: 2006-06-08
"
;
/* X display info */
/* X display info */
Display
*
dpy
=
NULL
;
/* the single display screen we connect to */
Display
*
dpy
=
NULL
;
/* the single display screen we connect to */
int
scr
=
0
;
int
scr
=
0
;
char
*
xauth_raw_data
=
NULL
;
int
xauth_raw_len
=
0
;
Window
window
=
None
,
rootwin
=
None
;
/* polled window, root window (usu. same) */
Window
window
=
None
,
rootwin
=
None
;
/* polled window, root window (usu. same) */
Visual
*
default_visual
=
NULL
;
/* the default visual (unless -visual) */
Visual
*
default_visual
=
NULL
;
/* the default visual (unless -visual) */
int
bpp
=
0
,
depth
=
0
;
int
bpp
=
0
,
depth
=
0
;
...
...
This diff is collapsed.
Click to expand it.
x11vnc/xevents.c
View file @
1776a3a5
...
@@ -454,7 +454,7 @@ static void grab_buster_watch(int parent, char *dstr) {
...
@@ -454,7 +454,7 @@ static void grab_buster_watch(int parent, char *dstr) {
}
}
/* overwrite original dpy, we let orig connection sit unused. */
/* overwrite original dpy, we let orig connection sit unused. */
dpy
=
XOpenDisplay
(
dstr
);
dpy
=
XOpenDisplay
_wr
(
dstr
);
if
(
!
dpy
)
{
if
(
!
dpy
)
{
fprintf
(
stderr
,
"grab_buster_watch: could not reopen: %s
\n
"
,
fprintf
(
stderr
,
"grab_buster_watch: could not reopen: %s
\n
"
,
dstr
);
dstr
);
...
@@ -518,7 +518,7 @@ void spawn_grab_buster(void) {
...
@@ -518,7 +518,7 @@ void spawn_grab_buster(void) {
RAWFB_RET_VOID
RAWFB_RET_VOID
XCloseDisplay
(
dpy
);
XCloseDisplay
_wr
(
dpy
);
dpy
=
NULL
;
dpy
=
NULL
;
if
((
pid
=
fork
())
>
0
)
{
if
((
pid
=
fork
())
>
0
)
{
...
@@ -539,7 +539,7 @@ void spawn_grab_buster(void) {
...
@@ -539,7 +539,7 @@ void spawn_grab_buster(void) {
exit
(
0
);
exit
(
0
);
}
}
dpy
=
XOpenDisplay
(
dstr
);
dpy
=
XOpenDisplay
_wr
(
dstr
);
if
(
!
dpy
)
{
if
(
!
dpy
)
{
rfbLog
(
"failed to reopen display %s in spawn_grab_buster
\n
"
,
rfbLog
(
"failed to reopen display %s in spawn_grab_buster
\n
"
,
dstr
);
dstr
);
...
...
This diff is collapsed.
Click to expand it.
x11vnc/xkb_bell.c
View file @
1776a3a5
...
@@ -40,6 +40,10 @@ void initialize_xkb(void) {
...
@@ -40,6 +40,10 @@ void initialize_xkb(void) {
return
;
return
;
}
}
if
(
!
xauth_raw
(
1
))
{
return
;
}
if
(
!
XkbOpenDisplay
(
DisplayString
(
dpy
),
&
xkb_base_event_type
,
&
ir
,
if
(
!
XkbOpenDisplay
(
DisplayString
(
dpy
),
&
xkb_base_event_type
,
&
ir
,
NULL
,
NULL
,
&
reason
)
)
{
NULL
,
NULL
,
&
reason
)
)
{
if
(
!
quiet
)
{
if
(
!
quiet
)
{
...
@@ -49,6 +53,7 @@ void initialize_xkb(void) {
...
@@ -49,6 +53,7 @@ void initialize_xkb(void) {
xkb_base_event_type
=
0
;
xkb_base_event_type
=
0
;
xkb_present
=
0
;
xkb_present
=
0
;
}
}
xauth_raw
(
0
);
}
}
void
initialize_watch_bell
(
void
)
{
void
initialize_watch_bell
(
void
)
{
...
...
This diff is collapsed.
Click to expand it.
x11vnc/xrecord.c
View file @
1776a3a5
...
@@ -118,8 +118,8 @@ static void xrecord_grabserver(int start) {
...
@@ -118,8 +118,8 @@ static void xrecord_grabserver(int start) {
XSync
(
gdpy_ctrl
,
True
);
XSync
(
gdpy_ctrl
,
True
);
if
(
!
rc_grab
||
trapped_record_xerror
)
{
if
(
!
rc_grab
||
trapped_record_xerror
)
{
XCloseDisplay
(
gdpy_ctrl
);
XCloseDisplay
_wr
(
gdpy_ctrl
);
XCloseDisplay
(
gdpy_data
);
XCloseDisplay
_wr
(
gdpy_data
);
gdpy_ctrl
=
NULL
;
gdpy_ctrl
=
NULL
;
gdpy_data
=
NULL
;
gdpy_data
=
NULL
;
XSetErrorHandler
(
old_handler
);
XSetErrorHandler
(
old_handler
);
...
@@ -127,8 +127,8 @@ static void xrecord_grabserver(int start) {
...
@@ -127,8 +127,8 @@ static void xrecord_grabserver(int start) {
}
}
rc
=
XRecordEnableContextAsync
(
gdpy_data
,
rc_grab
,
record_grab
,
NULL
);
rc
=
XRecordEnableContextAsync
(
gdpy_data
,
rc_grab
,
record_grab
,
NULL
);
if
(
!
rc
||
trapped_record_xerror
)
{
if
(
!
rc
||
trapped_record_xerror
)
{
XCloseDisplay
(
gdpy_ctrl
);
XCloseDisplay
_wr
(
gdpy_ctrl
);
XCloseDisplay
(
gdpy_data
);
XCloseDisplay
_wr
(
gdpy_data
);
gdpy_ctrl
=
NULL
;
gdpy_ctrl
=
NULL
;
gdpy_data
=
NULL
;
gdpy_data
=
NULL
;
XSetErrorHandler
(
old_handler
);
XSetErrorHandler
(
old_handler
);
...
@@ -179,18 +179,18 @@ void initialize_xrecord(void) {
...
@@ -179,18 +179,18 @@ void initialize_xrecord(void) {
X_LOCK
;
X_LOCK
;
/* open a 2nd control connection to DISPLAY: */
/* open a 2nd control connection to DISPLAY: */
if
(
rdpy_data
)
{
if
(
rdpy_data
)
{
XCloseDisplay
(
rdpy_data
);
XCloseDisplay
_wr
(
rdpy_data
);
rdpy_data
=
NULL
;
rdpy_data
=
NULL
;
}
}
if
(
rdpy_ctrl
)
{
if
(
rdpy_ctrl
)
{
XCloseDisplay
(
rdpy_ctrl
);
XCloseDisplay
_wr
(
rdpy_ctrl
);
rdpy_ctrl
=
NULL
;
rdpy_ctrl
=
NULL
;
}
}
rdpy_ctrl
=
XOpenDisplay
(
DisplayString
(
dpy
));
rdpy_ctrl
=
XOpenDisplay
_wr
(
DisplayString
(
dpy
));
XSync
(
dpy
,
True
);
XSync
(
dpy
,
True
);
XSync
(
rdpy_ctrl
,
True
);
XSync
(
rdpy_ctrl
,
True
);
/* open datalink connection to DISPLAY: */
/* open datalink connection to DISPLAY: */
rdpy_data
=
XOpenDisplay
(
DisplayString
(
dpy
));
rdpy_data
=
XOpenDisplay
_wr
(
DisplayString
(
dpy
));
if
(
!
rdpy_ctrl
||
!
rdpy_data
)
{
if
(
!
rdpy_ctrl
||
!
rdpy_data
)
{
X_UNLOCK
;
X_UNLOCK
;
return
;
return
;
...
@@ -206,19 +206,19 @@ void initialize_xrecord(void) {
...
@@ -206,19 +206,19 @@ void initialize_xrecord(void) {
* in place, why? Not sure, so we manually watch for grabs...
* in place, why? Not sure, so we manually watch for grabs...
*/
*/
if
(
gdpy_data
)
{
if
(
gdpy_data
)
{
XCloseDisplay
(
gdpy_data
);
XCloseDisplay
_wr
(
gdpy_data
);
gdpy_data
=
NULL
;
gdpy_data
=
NULL
;
}
}
if
(
gdpy_ctrl
)
{
if
(
gdpy_ctrl
)
{
XCloseDisplay
(
gdpy_ctrl
);
XCloseDisplay
_wr
(
gdpy_ctrl
);
gdpy_ctrl
=
NULL
;
gdpy_ctrl
=
NULL
;
}
}
xserver_grabbed
=
0
;
xserver_grabbed
=
0
;
gdpy_ctrl
=
XOpenDisplay
(
DisplayString
(
dpy
));
gdpy_ctrl
=
XOpenDisplay
_wr
(
DisplayString
(
dpy
));
XSync
(
dpy
,
True
);
XSync
(
dpy
,
True
);
XSync
(
gdpy_ctrl
,
True
);
XSync
(
gdpy_ctrl
,
True
);
gdpy_data
=
XOpenDisplay
(
DisplayString
(
dpy
));
gdpy_data
=
XOpenDisplay
_wr
(
DisplayString
(
dpy
));
if
(
gdpy_ctrl
&&
gdpy_data
)
{
if
(
gdpy_ctrl
&&
gdpy_data
)
{
disable_grabserver
(
gdpy_ctrl
,
0
);
disable_grabserver
(
gdpy_ctrl
,
0
);
disable_grabserver
(
gdpy_data
,
0
);
disable_grabserver
(
gdpy_data
,
0
);
...
@@ -260,19 +260,19 @@ void shutdown_xrecord(void) {
...
@@ -260,19 +260,19 @@ void shutdown_xrecord(void) {
}
}
if
(
rdpy_data
)
{
if
(
rdpy_data
)
{
XCloseDisplay
(
rdpy_data
);
XCloseDisplay
_wr
(
rdpy_data
);
rdpy_data
=
NULL
;
rdpy_data
=
NULL
;
}
}
if
(
rdpy_ctrl
)
{
if
(
rdpy_ctrl
)
{
XCloseDisplay
(
rdpy_ctrl
);
XCloseDisplay
_wr
(
rdpy_ctrl
);
rdpy_ctrl
=
NULL
;
rdpy_ctrl
=
NULL
;
}
}
if
(
gdpy_data
)
{
if
(
gdpy_data
)
{
XCloseDisplay
(
gdpy_data
);
XCloseDisplay
_wr
(
gdpy_data
);
gdpy_data
=
NULL
;
gdpy_data
=
NULL
;
}
}
if
(
gdpy_ctrl
)
{
if
(
gdpy_ctrl
)
{
XCloseDisplay
(
gdpy_ctrl
);
XCloseDisplay
_wr
(
gdpy_ctrl
);
gdpy_ctrl
=
NULL
;
gdpy_ctrl
=
NULL
;
}
}
xserver_grabbed
=
0
;
xserver_grabbed
=
0
;
...
@@ -1367,16 +1367,16 @@ static void shutdown_record_context(XRecordContext rc, int bequiet, int reopen)
...
@@ -1367,16 +1367,16 @@ static void shutdown_record_context(XRecordContext rc, int bequiet, int reopen)
if
(
debug_scroll
)
{
if
(
debug_scroll
)
{
rfbLog
(
"closing RECORD data connection.
\n
"
);
rfbLog
(
"closing RECORD data connection.
\n
"
);
}
}
XCloseDisplay
(
rdpy_data
);
XCloseDisplay
_wr
(
rdpy_data
);
rdpy_data
=
NULL
;
rdpy_data
=
NULL
;
if
(
debug_scroll
)
{
if
(
debug_scroll
)
{
rfbLog
(
"closing RECORD control connection.
\n
"
);
rfbLog
(
"closing RECORD control connection.
\n
"
);
}
}
XCloseDisplay
(
rdpy_ctrl
);
XCloseDisplay
_wr
(
rdpy_ctrl
);
rdpy_ctrl
=
NULL
;
rdpy_ctrl
=
NULL
;
rdpy_ctrl
=
XOpenDisplay
(
dpystr
);
rdpy_ctrl
=
XOpenDisplay
_wr
(
dpystr
);
if
(
!
rdpy_ctrl
)
{
if
(
!
rdpy_ctrl
)
{
rfbLog
(
"Failed to reopen RECORD control connection:"
rfbLog
(
"Failed to reopen RECORD control connection:"
...
@@ -1390,13 +1390,13 @@ static void shutdown_record_context(XRecordContext rc, int bequiet, int reopen)
...
@@ -1390,13 +1390,13 @@ static void shutdown_record_context(XRecordContext rc, int bequiet, int reopen)
disable_grabserver
(
rdpy_ctrl
,
0
);
disable_grabserver
(
rdpy_ctrl
,
0
);
XSync
(
rdpy_ctrl
,
True
);
XSync
(
rdpy_ctrl
,
True
);
rdpy_data
=
XOpenDisplay
(
dpystr
);
rdpy_data
=
XOpenDisplay
_wr
(
dpystr
);
if
(
!
rdpy_data
)
{
if
(
!
rdpy_data
)
{
rfbLog
(
"Failed to reopen RECORD data connection:"
rfbLog
(
"Failed to reopen RECORD data connection:"
"%s
\n
"
,
dpystr
);
"%s
\n
"
,
dpystr
);
rfbLog
(
" disabling RECORD scroll detection.
\n
"
);
rfbLog
(
" disabling RECORD scroll detection.
\n
"
);
XCloseDisplay
(
rdpy_ctrl
);
XCloseDisplay
_wr
(
rdpy_ctrl
);
rdpy_ctrl
=
NULL
;
rdpy_ctrl
=
NULL
;
use_xrecord
=
0
;
use_xrecord
=
0
;
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
x11vnc/xwrappers.c
View file @
1776a3a5
...
@@ -68,6 +68,10 @@ void disable_grabserver(Display *in_dpy, int change);
...
@@ -68,6 +68,10 @@ void disable_grabserver(Display *in_dpy, int change);
Bool
XRecordQueryVersion_wr
(
Display
*
dpy
,
int
*
maj
,
int
*
min
);
Bool
XRecordQueryVersion_wr
(
Display
*
dpy
,
int
*
maj
,
int
*
min
);
int
xauth_raw
(
int
on
);
Display
*
XOpenDisplay_wr
(
char
*
display_name
);
int
XCloseDisplay_wr
(
Display
*
display
);
void
copy_raw_fb
(
XImage
*
dest
,
int
x
,
int
y
,
unsigned
int
w
,
unsigned
int
h
);
void
copy_raw_fb
(
XImage
*
dest
,
int
x
,
int
y
,
unsigned
int
w
,
unsigned
int
h
);
static
void
upup_downdown_warning
(
KeyCode
key
,
Bool
down
);
static
void
upup_downdown_warning
(
KeyCode
key
,
Bool
down
);
...
@@ -879,4 +883,74 @@ Bool XRecordQueryVersion_wr(Display *dpy, int *maj, int *min) {
...
@@ -879,4 +883,74 @@ Bool XRecordQueryVersion_wr(Display *dpy, int *maj, int *min) {
#endif
#endif
}
}
int
xauth_raw
(
int
on
)
{
char
tmp
[]
=
"/tmp/x11vnc-xauth.XXXXXX"
;
int
tmp_fd
=
-
1
;
static
char
*
old_xauthority
=
NULL
;
static
char
*
old_tmp
=
NULL
;
int
db
=
0
;
if
(
on
)
{
if
(
old_xauthority
)
{
free
(
old_xauthority
);
old_xauthority
=
NULL
;
}
if
(
old_tmp
)
{
free
(
old_tmp
);
old_tmp
=
NULL
;
}
if
(
xauth_raw_data
)
{
tmp_fd
=
mkstemp
(
tmp
);
if
(
tmp_fd
<
0
)
{
rfbLog
(
"could not create tmp xauth file: %s
\n
"
,
tmp
);
return
0
;
}
if
(
db
)
fprintf
(
stderr
,
"tmp: %s
\n
"
,
tmp
);
write
(
tmp_fd
,
xauth_raw_data
,
xauth_raw_len
);
close
(
tmp_fd
);
if
(
getenv
(
"XAUTHORITY"
))
{
old_xauthority
=
strdup
(
getenv
(
"XAUTHORITY"
));
}
else
{
old_xauthority
=
strdup
(
""
);
}
set_env
(
"XAUTHORITY"
,
tmp
);
old_tmp
=
strdup
(
tmp
);
}
return
1
;
}
else
{
if
(
old_xauthority
)
{
set_env
(
"XAUTHORITY"
,
old_xauthority
);
free
(
old_xauthority
);
old_xauthority
=
NULL
;
}
if
(
old_tmp
)
{
unlink
(
old_tmp
);
free
(
old_tmp
);
old_tmp
=
NULL
;
}
return
1
;
}
}
Display
*
XOpenDisplay_wr
(
char
*
display_name
)
{
Display
*
d
;
int
db
=
0
;
if
(
!
xauth_raw
(
1
))
{
return
NULL
;
}
d
=
XOpenDisplay
(
display_name
);
if
(
db
)
fprintf
(
stderr
,
"XOpenDisplay_wr: %s 0x%x
\n
"
,
display_name
,
d
);
xauth_raw
(
0
);
return
d
;
}
int
XCloseDisplay_wr
(
Display
*
display
)
{
int
db
=
0
;
if
(
db
)
fprintf
(
stderr
,
"XCloseDisplay_wr: 0x%x
\n
"
,
display
);
return
XCloseDisplay
(
display
);
}
This diff is collapsed.
Click to expand it.
x11vnc/xwrappers.h
View file @
1776a3a5
...
@@ -68,4 +68,8 @@ extern void disable_grabserver(Display *in_dpy, int change);
...
@@ -68,4 +68,8 @@ extern void disable_grabserver(Display *in_dpy, int change);
extern
Bool
XRecordQueryVersion_wr
(
Display
*
dpy
,
int
*
maj
,
int
*
min
);
extern
Bool
XRecordQueryVersion_wr
(
Display
*
dpy
,
int
*
maj
,
int
*
min
);
extern
int
xauth_raw
(
int
on
);
extern
Display
*
XOpenDisplay_wr
(
char
*
display_name
);
extern
int
XCloseDisplay_wr
(
Display
*
display
);
#endif
/* _X11VNC_XWRAPPERS_H */
#endif
/* _X11VNC_XWRAPPERS_H */
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment