Commit bce0939c authored by Karl J. Runge's avatar Karl J. Runge

Tweak settings and docs for create_display. Add FD_EXTRA finishing cmd.

parent 03666d6a
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1025,11 +1025,12 @@ void print_help(int mode) {
" this string and the chvt(1) program will also be run.\n"
" Any remaining output is taken as XAUTHORITY data.\n"
" It can be either of the form XAUTHORITY=<file> or raw\n"
" xauthority data for the display (e.g. \"xauth extract -\n"
" $DISPLAY\" output).\n"
" xauthority data for the display. For example;\n"
"\n"
" xauth extract - $DISPLAY\"\n"
"\n"
" In the case of -unixpw (but not -unixpw_nis), then the\n"
" above command is run as the user who just authenticated\n"
" cmd= command is run as the user who just authenticated\n"
" via the login and password prompt.\n"
"\n"
" Also in the case of -unixpw, the user logging in can\n"
......@@ -1037,7 +1038,7 @@ void print_help(int mode) {
" a few options: scale=, scale_cursor= (or sc=), solid\n"
" (or so), id=, clear_mods (or cm), clear_keys (or ck),\n"
" repeat, speeds= (or sp=), readtimeout= (or rd=),\n"
" rotate= (or ro=), or noncache (or nc) separated by\n"
" rotate= (or ro=), or noncache (or nc), all separated by\n"
" commas if there is more than one. After the user logs\n"
" in successfully, these options will be applied to the\n"
" VNC screen. For example,\n"
......@@ -1087,9 +1088,12 @@ void print_help(int mode) {
" process that will not switch, but it is only encoding\n"
" and decoding the encrypted stream at that point.\n"
"\n"
" Automatic Finding of User X Sessions:\n"
"\n"
" As a special case, WAIT:cmd=FINDDISPLAY will run a\n"
" script that works on most Unixes to determine a user's\n"
" DISPLAY variable and xauthority data (see who(1)).\n"
"\n"
" The option \"-find\" is an alias for this mode.\n"
"\n"
" To have this default script printed to stdout (e.g. for\n"
......@@ -1125,6 +1129,8 @@ void print_help(int mode) {
" can also be set by the connecting user via \"nd=\"\n"
" using \"+\" instead of \",\"\n"
"\n"
" Automatic Creation of User X Sessions:\n"
"\n"
" An interesting option is WAIT:cmd=FINDCREATEDISPLAY\n"
" that is like FINDDISPLAY in that is uses the same method\n"
" to find an existing display. However, if it does not\n"
......@@ -1172,12 +1178,14 @@ void print_help(int mode) {
"\n"
" Where /.../x11vnc is the full path to x11vnc.\n"
"\n"
" See the -svc/-service option alias above.\n"
"\n"
" If for some reason you do not want x11vnc to ever\n"
" try to find an existing display set the env. var\n"
" X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (also -env ...)\n"
"\n"
" Use WAIT:cmd=FINDCREATEDISPLAY-print to print out the\n"
" script used.\n"
" script that is used for this.\n"
"\n"
" You can specify the preferred X server order via e.g.,\n"
" WAIT:cmd=FINDCREATEDISPLAY-Xdummy,Xvfb,X and/or leave\n"
......@@ -1194,20 +1202,21 @@ void print_help(int mode) {
" -geometry, and -depth and other X server options).\n"
"\n"
" You can set the environment variable FD_GEOM (or\n"
" X11VNC_CREATE_GEOM) to WxH or WxHxD to set the width and\n"
" height and optionally the color depth of the created\n"
" display. You can also set FD_SESS to be the session\n"
" (short name of the windowmanager: kde, gnome, twm,\n"
" failsafe, etc.). FD_OPTS as extra options to pass to\n"
" the X server. You can also set FD_PROG to be the full\n"
" path to the session/windowmanager program.\n"
" X11VNC_CREATE_GEOM) to WxH or WxHxD to set the width\n"
" and height and optionally the color depth of the\n"
" created display. You can also set FD_SESS to be the\n"
" session (short name of the windowmanager: kde, gnome,\n"
" twm, failsafe, etc.). FD_OPTS contains extra options\n"
" to pass to the X server. You can also set FD_PROG to\n"
" be the full path to the session/windowmanager program.\n"
"\n"
" More FD tricks: FD_CUPS=port or FD_CUPS=host:port\n"
" will set the cups printing environment. Similarly\n"
" for FD_ESD=port or FD_ESD=host:port for esddsp sound\n"
" redirection. FD_XDUMMY_NOROOT means the Xdummy server\n"
" does not need to be started as root (e.g. it will sudo\n"
" automatically)\n"
" automatically). Set FD_EXTRA to a command to be run\n"
" a few seconds after the X server starts up.\n"
"\n"
" If you want the FINDCREATEDISPLAY session to contact an\n"
" XDMCP login manager (xdm/gdm/kdm) on the same machine,\n"
......
......@@ -2041,7 +2041,9 @@ char create_display[] =
"}\n"
"\n"
"\n"
"depth=${depth:-16}\n"
"depth0=24\n"
"geom0=1280x1024\n"
"depth=${depth:-24}\n"
"geom=${geom:-1280x1024}\n"
"\n"
"nolisten=${FD_NOLISTEN:-\"-nolisten tcp\"}\n"
......@@ -2068,12 +2070,12 @@ char create_display[] =
"if echo \"$depth\" | grep '^[0-9][0-9]*$' > /dev/null; then\n"
" :\n"
"else\n"
" depth=16\n"
" depth=$depth0\n"
"fi\n"
"if echo \"$geom\" | grep '^[0-9][0-9]*x[0-9][0-9]*$' > /dev/null; then\n"
" :\n"
"else\n"
" geom=1280x1024\n"
" geom=$geom0\n"
"fi\n"
"\n"
"if [ \"X$USER\" = \"X\" ]; then\n"
......@@ -2165,6 +2167,9 @@ char create_display[] =
" if [ \"X$result\" = \"X1\" ]; then\n"
" echo \"DISPLAY=:$N\"\n"
" $have_xauth -f $authfile extract - :$N\n"
" if [ \"X$FD_EXTRA\" != \"X\" ]; then\n"
" $have_nohup env DISPLAY=:$N sh -c \"(sleep 2; $FD_EXTRA) &\" 1>&2 &\n"
" fi\n"
" exit 0\n"
" fi\n"
"done\n"
......
......@@ -1875,7 +1875,7 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
char *create_cmd = NULL;
char *opts = strchr(cmd, '-');
char st[] = "";
char fdgeom[128], fdsess[128], fdopts[128], fdprog[128];
char fdgeom[128], fdsess[128], fdopts[128], fdextra[256], fdprog[128];
char fdxsrv[128], fdxdum[128], fdcups[128], fdesd[128];
char fdnas[128], fdsmb[128], fdtag[128];
char cdout[128];
......@@ -1892,6 +1892,7 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
fdsess[0] = '\0';
fdgeom[0] = '\0';
fdopts[0] = '\0';
fdextra[0] = '\0';
fdprog[0] = '\0';
fdxsrv[0] = '\0';
fdxdum[0] = '\0';
......@@ -1985,6 +1986,11 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
if (fdopts[0] == '\0' && getenv("FD_OPTS")) {
snprintf(fdopts, 120, "%s", getenv("FD_OPTS"));
}
if (fdextra[0] == '\0' && getenv("FD_EXTRA")) {
if (!strchr(getenv("FD_EXTRA"), '\'')) {
snprintf(fdextra, 250, "%s", getenv("FD_EXTRA"));
}
}
if (fdprog[0] == '\0' && getenv("FD_PROG")) {
snprintf(fdprog, 120, "%s", getenv("FD_PROG"));
}
......@@ -2015,6 +2021,7 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
set_env("FD_GEOM", fdgeom);
set_env("FD_OPTS", fdopts);
set_env("FD_EXTRA", fdextra);
set_env("FD_PROG", fdprog);
set_env("FD_XSRV", fdxsrv);
set_env("FD_CUPS", fdcups);
......@@ -2034,6 +2041,7 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
+ strlen("env USER='' ")
+ strlen("FD_GEOM='' ")
+ strlen("FD_OPTS='' ")
+ strlen("FD_EXTRA='' ")
+ strlen("FD_PROG='' ")
+ strlen("FD_XSRV='' ")
+ strlen("FD_CUPS='' ")
......@@ -2046,6 +2054,7 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
+ strlen(uu) + 1
+ strlen(fdgeom) + 1
+ strlen(fdopts) + 1
+ strlen(fdextra) + 1
+ strlen(fdprog) + 1
+ strlen(fdxsrv) + 1
+ strlen(fdcups) + 1
......@@ -2058,10 +2067,10 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
+ strlen(cdout) + 1
+ strlen(opts) + 1);
sprintf(create_cmd, "env USER='%s' FD_GEOM='%s' FD_SESS='%s' "
"FD_OPTS='%s' FD_PROG='%s' FD_XSRV='%s' FD_CUPS='%s' "
"FD_OPTS='%s' FD_EXTRA='%s' FD_PROG='%s' FD_XSRV='%s' FD_CUPS='%s' "
"FD_ESD='%s' FD_NAS='%s' FD_SMB='%s' FD_TAG='%s' "
"FD_XDUMMY_NOROOT='%s' %s /bin/sh %s %s",
uu, fdgeom, fdsess, fdopts, fdprog, fdxsrv,
uu, fdgeom, fdsess, fdopts, fdextra, fdprog, fdxsrv,
fdcups, fdesd, fdnas, fdsmb, fdtag, fdxdum, cdout, tmp, opts);
} else {
create_cmd = (char *) malloc(strlen(tmp)
......
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "March 2009" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.7, lastmod: 2009-03-08
version: 0.9.7, lastmod: 2009-03-13
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -1207,11 +1207,12 @@ this string and the
program will also be run.
Any remaining output is taken as XAUTHORITY data.
It can be either of the form XAUTHORITY=<file> or raw
xauthority data for the display (e.g. "xauth extract -
$DISPLAY" output).
xauthority data for the display. For example;
.IP
xauth extract - $DISPLAY"
.IP
In the case of \fB-unixpw\fR (but not \fB-unixpw_nis),\fR then the
above command is run as the user who just authenticated
cmd= command is run as the user who just authenticated
via the login and password prompt.
.IP
Also in the case of \fB-unixpw,\fR the user logging in can
......@@ -1219,7 +1220,7 @@ place a colon at the end of her username and supply
a few options: scale=, scale_cursor= (or sc=), solid
(or so), id=, clear_mods (or cm), clear_keys (or ck),
repeat, speeds= (or sp=), readtimeout= (or rd=),
rotate= (or ro=), or noncache (or nc) separated by
rotate= (or ro=), or noncache (or nc), all separated by
commas if there is more than one. After the user logs
in successfully, these options will be applied to the
VNC screen. For example,
......@@ -1270,11 +1271,14 @@ the user as well. Note: there will be a 2nd SSL helper
process that will not switch, but it is only encoding
and decoding the encrypted stream at that point.
.IP
Automatic Finding of User X Sessions:
.IP
As a special case, WAIT:cmd=FINDDISPLAY will run a
script that works on most Unixes to determine a user's
DISPLAY variable and xauthority data (see
.IR who (1)
).
.IP
The option "\fB-find\fR" is an alias for this mode.
.IP
To have this default script printed to stdout (e.g. for
......@@ -1312,6 +1316,8 @@ Ranges n-m e.g. 0-20 can also be supplied. This string
can also be set by the connecting user via "nd="
using "+" instead of ","
.IP
Automatic Creation of User X Sessions:
.IP
An interesting option is WAIT:cmd=FINDCREATEDISPLAY
that is like FINDDISPLAY in that is uses the same method
to find an existing display. However, if it does not
......@@ -1363,12 +1369,14 @@ on the machine. E.g. a desktop service:
.IP
Where /.../x11vnc is the full path to x11vnc.
.IP
See the \fB-svc/-service\fR option alias above.
.IP
If for some reason you do not want x11vnc to ever
try to find an existing display set the env. var
X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (also \fB-env\fR ...)
.IP
Use WAIT:cmd=FINDCREATEDISPLAY-print to print out the
script used.
script that is used for this.
.IP
You can specify the preferred X server order via e.g.,
WAIT:cmd=FINDCREATEDISPLAY-Xdummy,Xvfb,X and/or leave
......@@ -1390,20 +1398,21 @@ this be a wrapper script if you like (it must handle :N,
\fB-geometry,\fR and \fB-depth\fR and other X server options).
.IP
You can set the environment variable FD_GEOM (or
X11VNC_CREATE_GEOM) to WxH or WxHxD to set the width and
height and optionally the color depth of the created
display. You can also set FD_SESS to be the session
(short name of the windowmanager: kde, gnome, twm,
failsafe, etc.). FD_OPTS as extra options to pass to
the X server. You can also set FD_PROG to be the full
path to the session/windowmanager program.
X11VNC_CREATE_GEOM) to WxH or WxHxD to set the width
and height and optionally the color depth of the
created display. You can also set FD_SESS to be the
session (short name of the windowmanager: kde, gnome,
twm, failsafe, etc.). FD_OPTS contains extra options
to pass to the X server. You can also set FD_PROG to
be the full path to the session/windowmanager program.
.IP
More FD tricks: FD_CUPS=port or FD_CUPS=host:port
will set the cups printing environment. Similarly
for FD_ESD=port or FD_ESD=host:port for esddsp sound
redirection. FD_XDUMMY_NOROOT means the Xdummy server
does not need to be started as root (e.g. it will sudo
automatically)
automatically). Set FD_EXTRA to a command to be run
a few seconds after the X server starts up.
.IP
If you want the FINDCREATEDISPLAY session to contact an
XDMCP login manager (xdm/gdm/kdm) on the same machine,
......
......@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.7 lastmod: 2009-03-08";
char lastmod[] = "0.9.7 lastmod: 2009-03-13";
/* X display info */
......
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