pam_env: Handling XDG_DATA_DIRS
Tinu Weber <[email protected]> Tue, 13 Jun 2017 14:53:00 +0200
| Newsgroups | gmane.linux.pam |
|---|---|
| Message-ID | <20170613125300.GA3265@ixh> |
--===============8109533781428974508==
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C"
Content-Disposition: inline
--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hello
In my ~/.pam_environment, I would like to prepend a path to the
XDG_DATA_DIRS variable. As defined in the XDG base directory
specification [1] (XBDS), XDG_DATA_DIRS should be treated as
`/usr/local/share:/usr/share` if not set or empty.
In shell, I would do something like this:
XDG_DATA_DIRS="/foo/bar:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
Playing around with the DEFAULT and OVERRIDE directives as noted in the
pam_env.conf(5) man page, I tried this:
MY_DATA_DIRS DEFAULT="/usr/local/share:/usr/share" OVERRIDE="${XDG_DATA_DIRS}"
XDG_DATA_DIRS DEFAULT="/foo/bar:${MY_DATA_DIRS}"
However, it turns out that assigning a value to XDG_DATA_DIRS causes the
first line to be evaluated again (probably because MY_DATA_DIRS
"depends" on XDG_DATA_DIRS in its OVERRIDE). Next, this causes the
*second* line to evaluated again, and so on...
I guess that PAM stops at the third iteration of this, to avoid an
endless loop, and the resulting XDG_DATA_DIRS looks like this (notice
`/foo/bar` being in there three times):
/foo/bar:/foo/bar:/foo/bar:/usr/local/share:/usr/share
Did I miss something in the documentation? Or is it not possible to have
"Expand a variable that may be empty (in which case it should initially
default to some value)" work in ~/.pam_environment?
Thank you in advance!
Best,
Tinu
[1] https://specifications.freedesktop.org/basedir-spec/latest/
--a8Wt8u1KmwUX3Y2C
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEE/oz2OtIwb9QaVQDm3NRer5IaeCIFAlk/4CgACgkQ3NRer5Ia
eCLOmxAAjEb7oYq8Ux7tD7qV6i6APr7MWVeGYElgS1VyL+wibHcLz6c9Sh77l4op
yjtrWZzplslBmW6hmP40Aka+pl03mDJIu6a2b5iiuCwVVBs7eLt8QWKsV6fKfqyp
uOS6fowJZg/39W14yyf77A5cVxmUuzYNGYA/lus+gBuQxN9qvCCoopkl3ZsBtk4A
tLZkwdIgJFxial/hj1+50zFERX0Clmsv/luKIARd6g00Vp8bOcjMXZH4x00gZ39c
1ZJm53YU0Zs0iH7rrZCaBGLjgUiXgI7NcMkQEfXtCTXXo0YuVlBVSp/OsDl5mpF3
JA27LTtQ0DeTs0JfJ9L3VCXaq5DDFElMJ7roFpXqb9ycFTfJzw9QeUsqEwz3ljeH
/hw8BuPsQn4YlpMbHTQ8ZXts6Lo2+N2erZmplz30FeIP4wYZS9jZLYzH8RM9RtsX
uMOh7OXuM0evkAryIepb/uD3po6l8mVnQu5mi9cewYNu1QRMWzfxUiquPzeCcg85
IpVoCgQUJXzIRRChwKa9QXBL1+AApj9R2rLII4u4EcAd3Ll1nvO2YNRAmzUTzTSu
tQaGwnvqZHsY4oioTFQyScr9EvrYOOfQzbkd4mTs/AsShVWq7tXl/HB0vBCDH6dP
4/BBIsB1cT6nLhSmHVms8eWtAXA6jC4p3Ib2srUAVjDVeiq9+xY=
=ZOkc
-----END PGP SIGNATURE-----
--a8Wt8u1KmwUX3Y2C--
--===============8109533781428974508==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Pam-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pam-list
--===============8109533781428974508==--