Discussion:
Bug#913468: startx: doesn't cope with multiple xauth cookies
Thorsten Glaser
2018-11-11 13:14:08 UTC
Permalink
Package: xinit
Version: 1.4.0-1
Severity: minor

/usr/bin/startx contains this around line 198:

for displayname in $authdisplay $hostname$authdisplay; do
authcookie=`xauth list "$displayname" \
| sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
[…]
dummy=$(($dummy+1));
xauth -q -f "$xserverauthfile" << EOF
add :$dummy . $authcookie
EOF

This clearly assumes that $authcookie is only one.
However, on my system I somehow get two (the same but,
nevertheless, two), leading to xauth throwing a syntax
error upon running startx.

***@tglase-nb:~ $ displayname=tglase-nb.lan.tarent.de:0
***@tglase-nb:~ $ xauth list "$displayname" | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"
2f5582db6c1e1d0f6da34c7f4fec89c7
2f5582db6c1e1d0f6da34c7f4fec89c7


-- System Information:
Debian Release: buster/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'buildd-unstable'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)

Versions of packages xinit depends on:
ii coreutils 8.30-1
ii libc6 2.27-8
ii libx11-6 2:1.6.7-1
ii x11-common 1:7.7+19
ii xauth 1:1.0.10-1

Versions of packages xinit recommends:
ii evilwm [x-window-manager] 1.1.1-1
ii icewm [x-window-manager] 1.4.3.0~pre-20181030-2
ii konsole [x-terminal-emulator] 4:18.04.0-1
ii kwin-x11 [x-window-manager] 4:5.13.5-1+b1
ii plasma-workspace [x-session-manager] 4:5.13.5-1+b1
ii tigervnc-standalone-server [xserver] 1.9.0+dfsg-2
ii xserver-xorg [xserver] 1:7.7+19
ii xterm [x-terminal-emulator] 337-1

xi
Thorsten Glaser
2018-11-11 13:31:56 UTC
Permalink
Dixi quod=E2=80=A6
Post by Thorsten Glaser
However, on my system I somehow get two (the same but,
I think these come from startx itself, plus the system having
had crashed once while X was running.

If I rm ~/.Xauthority then startx, and, under X, run =E2=80=9Cxauth list=E2=
=80=9D,
I get:

tglase-nb.lan.tarent.de/unix:0 MIT-MAGIC-COOKIE-1 1d91628277c6a2e586377f1=
1ad5e94c4
tglase-nb.lan.tarent.de:0 MIT-MAGIC-COOKIE-1 1d91628277c6a2e586377f11ad5e=
94c4
tglase-nb.lan.tarent.de:0 MIT-MAGIC-COOKIE-1 1d91628277c6a2e586377f11ad5e=
94c4

The actual cookie is now different every session, but we see
that the duplicate is there. So chances are this issue will
pop up over the lifetime of a $HOME in all startx users.

startx adds the cookie twoce in line 203 (since the previous
=2EXauthority was empty, $authcookie also is, so we hit this
one instead of line 209 from my initial report). I don=E2=80=99t have
an idea why :0 is added as hostname:0 though.

I don=E2=80=99t know how to test this right now, as =E2=80=9Cxauth add=E2=
=80=9D seems
to misbehave: instead of adding one line it replaces all three
lines:

***@tglase-nb:~ $ xauth list =
=20
tglase-nb.lan.tarent.de/unix:0 MIT-MAGIC-COOKIE-1 1d91628277c6a2e586377f1=
1ad5e94c4
tglase-nb.lan.tarent.de:0 MIT-MAGIC-COOKIE-1 65cf233332362c15bf009a13d32c=
115f
tglase-nb.lan.tarent.de:0 MIT-MAGIC-COOKIE-1 65cf233332362c15bf009a13d32c=
115f
***@tglase-nb:~ $ xauth add tglase-nb.lan.tarent.de:0 . $(mcookie) =
=20
***@tglase-nb:~ $ xauth list =
=20
tglase-nb.lan.tarent.de/unix:0 MIT-MAGIC-COOKIE-1 2f2178f0974e8b0e3654eb0=
84e469b39
tglase-nb.lan.tarent.de:0 MIT-MAGIC-COOKIE-1 2f2178f0974e8b0e3654eb084e46=
9b39
tglase-nb.lan.tarent.de:0 MIT-MAGIC-COOKIE-1 2f2178f0974e8b0e3654eb084e46=
9b39

(That=E2=80=99s still running under X.)

So perhaps this is one, or even two, bugs in xauth instead?

(That being said, I=E2=80=99d add a =E2=80=9C| uniq=E2=80=9D, at the very l=
east, in the
indicated place in startx, if not handling for multiple cookies.)

bye,
//mirabilos
--=20
=C2=ABMyISAM tables -will- get corrupted eventually. This is a fact of life=
=2E =C2=BB
=E2=80=9Cmysql is about as much database as ms access=E2=80=9D =E2=80=93 =
=E2=80=9CMSSQL at least descends
from a database=E2=80=9D =E2=80=9Cit's a rebranded SyBase=E2=80=9D =E2=80=
=9CMySQL however was born from a
flatfile and went downhill from there=E2=80=9D =E2=80=93 =E2=80=9Cat least =
jetDB doesn=E2=80=99t claim to
be a database=E2=80=9D=09(#nosec) =E2=80=A3=E2=80=A3=E2=80=A3 Please let=
MySQL and MariaDB finally die!
Thorsten Glaser
2018-11-11 13:33:53 UTC
Permalink
Dixi quod=E2=80=A6
Post by Thorsten Glaser
I don=E2=80=99t know how to test this right now, as =E2=80=9Cxauth add=E2=
=80=9D seems
Post by Thorsten Glaser
to misbehave: instead of adding one line it replaces all three
[=E2=80=A6]
Post by Thorsten Glaser
(That=E2=80=99s still running under X.)
From=20outside X I get:

***@tglase-nb:~ $ xauth list
***@tglase-nb:~ $ xauth add :0 . $(mcookie)
***@tglase-nb:~ $ xauth list
tglase-nb.lan.tarent.de/unix:0 MIT-MAGIC-COOKIE-1 fc863a474bbaf9d38bd7cff=
bd7bba100
***@tglase-nb:~ $ xauth add :0 . $(mcookie)
***@tglase-nb:~ $ xauth list
tglase-nb.lan.tarent.de/unix:0 MIT-MAGIC-COOKIE-1 0e3aea779d160c8308c57f3=
923debe8f

So, similar misbehaviour, but :0 is added as hostname/unix:0.
No idea where the duplicate other entry comes from.

bye,
//mirabilos
--=20
15:41=E2=8E=9C<Lo-lan-do:#fusionforge> Somebody write a testsuite for hello=
world :-)

Loading...