Commit b917f6f1 authored by Niels Möller's avatar Niels Möller
Browse files

(do_xauth_exit): Log a message if xauth failed.

(server_x11_setup): Fixed format of display string.
(server_x11_setup): Use an absolute filename for the xauth program.
(server_x11_setup): Added missing new line on the xauth command

Rev: src/server_x11.c:1.4
parent 45d3f5a5
......@@ -45,6 +45,8 @@
#define X11_MIN_COOKIE_LENGTH 10
/* GABA:
......@@ -68,6 +70,10 @@ do_xauth_exit(struct exit_callback *s, int signaled,
const struct exception xauth_failed
EXCEPTION_RAISE(self->e, &xauth_failed);
if (signaled)
werror("xauth invocation failed: Signal %d\n", value);
werror("xauth invocation failed: exit code: %d\n", value);
/* NOTE: Return value is ignored. */
......@@ -96,6 +102,9 @@ bad_string(UINT32 length, const UINT8 *data)
return !!memchr(data, '\0', length);
/* FIXME: Use autoconf */
#define XAUTH_PROGRAM "/usr/X11R6/bin/xauth"
/* On success, returns 1 and sets *DISPLAY and *XAUTHORITY */
struct server_x11_info *
server_x11_setup(struct ssh_channel *channel, struct lsh_user *user,
......@@ -138,12 +147,12 @@ server_x11_setup(struct ssh_channel *channel, struct lsh_user *user,
if (!tmp)
tmp = "tmp";
display = ssh_format("%di:%di", display_number, screen);
display = ssh_format(":%di.%di", display_number, screen);
xauthority = ssh_format("/%lz/.lshd.%lS.Xauthority", tmp, user->name);
struct spawn_info spawn;
const char *args[2] = { "-c", "xauth" };
const char *args[2] = { "-c", XAUTH_PROGRAM };
const struct env_value env[1] =
{ {"XAUTHORITY", xauthority } };
......@@ -152,8 +161,15 @@ server_x11_setup(struct ssh_channel *channel, struct lsh_user *user,
int null;
memset(&spawn, 0, sizeof(spawn));
/* FIXME: Arrange that stderr data (and perhaps stdout data as
* well) is sent as extrended data on the channel. To do that, we
* need another channel flag to determine whether or not EOF
* should be sent when the number of sources gets down to 0. */
null = dup(STDERR_FILENO);
null = open("/dev/null", O_WRONLY);
if (null < 0)
goto fail;
......@@ -191,7 +207,7 @@ server_x11_setup(struct ssh_channel *channel, struct lsh_user *user,
/* NOTE: We pass arbitrary data to the xauth process,
* if the user so wish. */
ssh_format("add %lS %ls %ls",
ssh_format("add %lS %ls %ls\n",
protocol_length, protocol,
cookie_length, cookie));
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