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

pull/1/head
Karl J. Runge 15 years ago
parent 03666d6a17
commit bce0939c0e

File diff suppressed because it is too large Load Diff

@ -1025,11 +1025,12 @@ void print_help(int mode) {
" this string and the chvt(1) program will also be run.\n" " this string and the chvt(1) program will also be run.\n"
" Any remaining output is taken as XAUTHORITY data.\n" " Any remaining output is taken as XAUTHORITY data.\n"
" It can be either of the form XAUTHORITY=<file> or raw\n" " It can be either of the form XAUTHORITY=<file> or raw\n"
" xauthority data for the display (e.g. \"xauth extract -\n" " xauthority data for the display. For example;\n"
" $DISPLAY\" output).\n" "\n"
" xauth extract - $DISPLAY\"\n"
"\n" "\n"
" In the case of -unixpw (but not -unixpw_nis), then the\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" " via the login and password prompt.\n"
"\n" "\n"
" Also in the case of -unixpw, the user logging in can\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" " a few options: scale=, scale_cursor= (or sc=), solid\n"
" (or so), id=, clear_mods (or cm), clear_keys (or ck),\n" " (or so), id=, clear_mods (or cm), clear_keys (or ck),\n"
" repeat, speeds= (or sp=), readtimeout= (or rd=),\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" " commas if there is more than one. After the user logs\n"
" in successfully, these options will be applied to the\n" " in successfully, these options will be applied to the\n"
" VNC screen. For example,\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" " process that will not switch, but it is only encoding\n"
" and decoding the encrypted stream at that point.\n" " and decoding the encrypted stream at that point.\n"
"\n" "\n"
" Automatic Finding of User X Sessions:\n"
"\n"
" As a special case, WAIT:cmd=FINDDISPLAY will run a\n" " As a special case, WAIT:cmd=FINDDISPLAY will run a\n"
" script that works on most Unixes to determine a user's\n" " script that works on most Unixes to determine a user's\n"
" DISPLAY variable and xauthority data (see who(1)).\n" " DISPLAY variable and xauthority data (see who(1)).\n"
"\n"
" The option \"-find\" is an alias for this mode.\n" " The option \"-find\" is an alias for this mode.\n"
"\n" "\n"
" To have this default script printed to stdout (e.g. for\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" " can also be set by the connecting user via \"nd=\"\n"
" using \"+\" instead of \",\"\n" " using \"+\" instead of \",\"\n"
"\n" "\n"
" Automatic Creation of User X Sessions:\n"
"\n"
" An interesting option is WAIT:cmd=FINDCREATEDISPLAY\n" " An interesting option is WAIT:cmd=FINDCREATEDISPLAY\n"
" that is like FINDDISPLAY in that is uses the same method\n" " that is like FINDDISPLAY in that is uses the same method\n"
" to find an existing display. However, if it does not\n" " to find an existing display. However, if it does not\n"
@ -1172,12 +1178,14 @@ void print_help(int mode) {
"\n" "\n"
" Where /.../x11vnc is the full path to x11vnc.\n" " Where /.../x11vnc is the full path to x11vnc.\n"
"\n" "\n"
" See the -svc/-service option alias above.\n"
"\n"
" If for some reason you do not want x11vnc to ever\n" " If for some reason you do not want x11vnc to ever\n"
" try to find an existing display set the env. var\n" " try to find an existing display set the env. var\n"
" X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (also -env ...)\n" " X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (also -env ...)\n"
"\n" "\n"
" Use WAIT:cmd=FINDCREATEDISPLAY-print to print out the\n" " Use WAIT:cmd=FINDCREATEDISPLAY-print to print out the\n"
" script used.\n" " script that is used for this.\n"
"\n" "\n"
" You can specify the preferred X server order via e.g.,\n" " You can specify the preferred X server order via e.g.,\n"
" WAIT:cmd=FINDCREATEDISPLAY-Xdummy,Xvfb,X and/or leave\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" " -geometry, and -depth and other X server options).\n"
"\n" "\n"
" You can set the environment variable FD_GEOM (or\n" " You can set the environment variable FD_GEOM (or\n"
" X11VNC_CREATE_GEOM) to WxH or WxHxD to set the width and\n" " X11VNC_CREATE_GEOM) to WxH or WxHxD to set the width\n"
" height and optionally the color depth of the created\n" " and height and optionally the color depth of the\n"
" display. You can also set FD_SESS to be the session\n" " created display. You can also set FD_SESS to be the\n"
" (short name of the windowmanager: kde, gnome, twm,\n" " session (short name of the windowmanager: kde, gnome,\n"
" failsafe, etc.). FD_OPTS as extra options to pass to\n" " twm, failsafe, etc.). FD_OPTS contains extra options\n"
" the X server. You can also set FD_PROG to be the full\n" " to pass to the X server. You can also set FD_PROG to\n"
" path to the session/windowmanager program.\n" " be the full path to the session/windowmanager program.\n"
"\n" "\n"
" More FD tricks: FD_CUPS=port or FD_CUPS=host:port\n" " More FD tricks: FD_CUPS=port or FD_CUPS=host:port\n"
" will set the cups printing environment. Similarly\n" " will set the cups printing environment. Similarly\n"
" for FD_ESD=port or FD_ESD=host:port for esddsp sound\n" " for FD_ESD=port or FD_ESD=host:port for esddsp sound\n"
" redirection. FD_XDUMMY_NOROOT means the Xdummy server\n" " redirection. FD_XDUMMY_NOROOT means the Xdummy server\n"
" does not need to be started as root (e.g. it will sudo\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" "\n"
" If you want the FINDCREATEDISPLAY session to contact an\n" " If you want the FINDCREATEDISPLAY session to contact an\n"
" XDMCP login manager (xdm/gdm/kdm) on the same machine,\n" " XDMCP login manager (xdm/gdm/kdm) on the same machine,\n"

@ -2041,7 +2041,9 @@ char create_display[] =
"}\n" "}\n"
"\n" "\n"
"\n" "\n"
"depth=${depth:-16}\n" "depth0=24\n"
"geom0=1280x1024\n"
"depth=${depth:-24}\n"
"geom=${geom:-1280x1024}\n" "geom=${geom:-1280x1024}\n"
"\n" "\n"
"nolisten=${FD_NOLISTEN:-\"-nolisten tcp\"}\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" "if echo \"$depth\" | grep '^[0-9][0-9]*$' > /dev/null; then\n"
" :\n" " :\n"
"else\n" "else\n"
" depth=16\n" " depth=$depth0\n"
"fi\n" "fi\n"
"if echo \"$geom\" | grep '^[0-9][0-9]*x[0-9][0-9]*$' > /dev/null; then\n" "if echo \"$geom\" | grep '^[0-9][0-9]*x[0-9][0-9]*$' > /dev/null; then\n"
" :\n" " :\n"
"else\n" "else\n"
" geom=1280x1024\n" " geom=$geom0\n"
"fi\n" "fi\n"
"\n" "\n"
"if [ \"X$USER\" = \"X\" ]; then\n" "if [ \"X$USER\" = \"X\" ]; then\n"
@ -2165,6 +2167,9 @@ char create_display[] =
" if [ \"X$result\" = \"X1\" ]; then\n" " if [ \"X$result\" = \"X1\" ]; then\n"
" echo \"DISPLAY=:$N\"\n" " echo \"DISPLAY=:$N\"\n"
" $have_xauth -f $authfile extract - :$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" " exit 0\n"
" fi\n" " fi\n"
"done\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 *create_cmd = NULL;
char *opts = strchr(cmd, '-'); char *opts = strchr(cmd, '-');
char st[] = ""; 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 fdxsrv[128], fdxdum[128], fdcups[128], fdesd[128];
char fdnas[128], fdsmb[128], fdtag[128]; char fdnas[128], fdsmb[128], fdtag[128];
char cdout[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'; fdsess[0] = '\0';
fdgeom[0] = '\0'; fdgeom[0] = '\0';
fdopts[0] = '\0'; fdopts[0] = '\0';
fdextra[0] = '\0';
fdprog[0] = '\0'; fdprog[0] = '\0';
fdxsrv[0] = '\0'; fdxsrv[0] = '\0';
fdxdum[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")) { if (fdopts[0] == '\0' && getenv("FD_OPTS")) {
snprintf(fdopts, 120, "%s", 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")) { if (fdprog[0] == '\0' && getenv("FD_PROG")) {
snprintf(fdprog, 120, "%s", 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_GEOM", fdgeom);
set_env("FD_OPTS", fdopts); set_env("FD_OPTS", fdopts);
set_env("FD_EXTRA", fdextra);
set_env("FD_PROG", fdprog); set_env("FD_PROG", fdprog);
set_env("FD_XSRV", fdxsrv); set_env("FD_XSRV", fdxsrv);
set_env("FD_CUPS", fdcups); 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("env USER='' ")
+ strlen("FD_GEOM='' ") + strlen("FD_GEOM='' ")
+ strlen("FD_OPTS='' ") + strlen("FD_OPTS='' ")
+ strlen("FD_EXTRA='' ")
+ strlen("FD_PROG='' ") + strlen("FD_PROG='' ")
+ strlen("FD_XSRV='' ") + strlen("FD_XSRV='' ")
+ strlen("FD_CUPS='' ") + 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(uu) + 1
+ strlen(fdgeom) + 1 + strlen(fdgeom) + 1
+ strlen(fdopts) + 1 + strlen(fdopts) + 1
+ strlen(fdextra) + 1
+ strlen(fdprog) + 1 + strlen(fdprog) + 1
+ strlen(fdxsrv) + 1 + strlen(fdxsrv) + 1
+ strlen(fdcups) + 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(cdout) + 1
+ strlen(opts) + 1); + strlen(opts) + 1);
sprintf(create_cmd, "env USER='%s' FD_GEOM='%s' FD_SESS='%s' " 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_ESD='%s' FD_NAS='%s' FD_SMB='%s' FD_TAG='%s' "
"FD_XDUMMY_NOROOT='%s' %s /bin/sh %s %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); fdcups, fdesd, fdnas, fdsmb, fdtag, fdxdum, cdout, tmp, opts);
} else { } else {
create_cmd = (char *) malloc(strlen(tmp) create_cmd = (char *) malloc(strlen(tmp)

@ -2,7 +2,7 @@
.TH X11VNC "1" "March 2009" "x11vnc " "User Commands" .TH X11VNC "1" "March 2009" "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.9.7, lastmod: 2009-03-08 version: 0.9.7, lastmod: 2009-03-13
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
@ -1207,11 +1207,12 @@ this string and the
program will also be run. program will also be run.
Any remaining output is taken as XAUTHORITY data. Any remaining output is taken as XAUTHORITY data.
It can be either of the form XAUTHORITY=<file> or raw It can be either of the form XAUTHORITY=<file> or raw
xauthority data for the display (e.g. "xauth extract - xauthority data for the display. For example;
$DISPLAY" output). .IP
xauth extract - $DISPLAY"
.IP .IP
In the case of \fB-unixpw\fR (but not \fB-unixpw_nis),\fR then the 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. via the login and password prompt.
.IP .IP
Also in the case of \fB-unixpw,\fR the user logging in can 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 a few options: scale=, scale_cursor= (or sc=), solid
(or so), id=, clear_mods (or cm), clear_keys (or ck), (or so), id=, clear_mods (or cm), clear_keys (or ck),
repeat, speeds= (or sp=), readtimeout= (or rd=), 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 commas if there is more than one. After the user logs
in successfully, these options will be applied to the in successfully, these options will be applied to the
VNC screen. For example, 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 process that will not switch, but it is only encoding
and decoding the encrypted stream at that point. and decoding the encrypted stream at that point.
.IP .IP
Automatic Finding of User X Sessions:
.IP
As a special case, WAIT:cmd=FINDDISPLAY will run a As a special case, WAIT:cmd=FINDDISPLAY will run a
script that works on most Unixes to determine a user's script that works on most Unixes to determine a user's
DISPLAY variable and xauthority data (see DISPLAY variable and xauthority data (see
.IR who (1) .IR who (1)
). ).
.IP
The option "\fB-find\fR" is an alias for this mode. The option "\fB-find\fR" is an alias for this mode.
.IP .IP
To have this default script printed to stdout (e.g. for 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=" can also be set by the connecting user via "nd="
using "+" instead of "," using "+" instead of ","
.IP .IP
Automatic Creation of User X Sessions:
.IP
An interesting option is WAIT:cmd=FINDCREATEDISPLAY An interesting option is WAIT:cmd=FINDCREATEDISPLAY
that is like FINDDISPLAY in that is uses the same method that is like FINDDISPLAY in that is uses the same method
to find an existing display. However, if it does not to find an existing display. However, if it does not
@ -1363,12 +1369,14 @@ on the machine. E.g. a desktop service:
.IP .IP
Where /.../x11vnc is the full path to x11vnc. Where /.../x11vnc is the full path to x11vnc.
.IP .IP
See the \fB-svc/-service\fR option alias above.
.IP
If for some reason you do not want x11vnc to ever If for some reason you do not want x11vnc to ever
try to find an existing display set the env. var try to find an existing display set the env. var
X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (also \fB-env\fR ...) X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (also \fB-env\fR ...)
.IP .IP
Use WAIT:cmd=FINDCREATEDISPLAY-print to print out the Use WAIT:cmd=FINDCREATEDISPLAY-print to print out the
script used. script that is used for this.
.IP .IP
You can specify the preferred X server order via e.g., You can specify the preferred X server order via e.g.,
WAIT:cmd=FINDCREATEDISPLAY-Xdummy,Xvfb,X and/or leave 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). \fB-geometry,\fR and \fB-depth\fR and other X server options).
.IP .IP
You can set the environment variable FD_GEOM (or You can set the environment variable FD_GEOM (or
X11VNC_CREATE_GEOM) to WxH or WxHxD to set the width and X11VNC_CREATE_GEOM) to WxH or WxHxD to set the width
height and optionally the color depth of the created and height and optionally the color depth of the
display. You can also set FD_SESS to be the session created display. You can also set FD_SESS to be the
(short name of the windowmanager: kde, gnome, twm, session (short name of the windowmanager: kde, gnome,
failsafe, etc.). FD_OPTS as extra options to pass to twm, failsafe, etc.). FD_OPTS contains extra options
the X server. You can also set FD_PROG to be the full to pass to the X server. You can also set FD_PROG to
path to the session/windowmanager program. be the full path to the session/windowmanager program.
.IP .IP
More FD tricks: FD_CUPS=port or FD_CUPS=host:port More FD tricks: FD_CUPS=port or FD_CUPS=host:port
will set the cups printing environment. Similarly will set the cups printing environment. Similarly
for FD_ESD=port or FD_ESD=host:port for esddsp sound for FD_ESD=port or FD_ESD=host:port for esddsp sound
redirection. FD_XDUMMY_NOROOT means the Xdummy server redirection. FD_XDUMMY_NOROOT means the Xdummy server
does not need to be started as root (e.g. it will sudo 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 .IP
If you want the FINDCREATEDISPLAY session to contact an If you want the FINDCREATEDISPLAY session to contact an
XDMCP login manager (xdm/gdm/kdm) on the same machine, 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; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* 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 */ /* X display info */

Loading…
Cancel
Save