]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Export XDG_RUNTIME_DIR to child ssh sessions
authorjca@openbsd.org <jca@openbsd.org>
Mon, 17 Nov 2025 12:59:29 +0000 (12:59 +0000)
committerDamien Miller <djm@mindrot.org>
Tue, 18 Nov 2025 00:29:55 +0000 (11:29 +1100)
Currently setusercontext(LOGIN_SETALL) does create the directory in
/tmp/run/user, since LOGIN_SETXDGENV is part of LOGIN_SETALL, but the
env variable wasn't exported.

ok djm@

OpenBSD-Commit-ID: 02b8433f72759b3a07b55cbc5a7cdb84391b0017

session.c

index f265fdc3ed3b533167169077e811882c5347be85..34b049a0f5d96f4994a722cf4624f2c317ab0362 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.344 2025/09/25 02:15:39 jsg Exp $ */
+/* $OpenBSD: session.c,v 1.345 2025/11/17 12:59:29 jca Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
@@ -1012,6 +1012,12 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
 
        if (getenv("TZ"))
                child_set_env(&env, &envsize, "TZ", getenv("TZ"));
+#ifdef HAVE_LOGIN_CAP
+       if (getenv("XDG_RUNTIME_DIR")) {
+               child_set_env(&env, &envsize, "XDG_RUNTIME_DIR",
+                   getenv("XDG_RUNTIME_DIR"));
+       }
+#endif /* HAVE_LOGIN_CAP */
        if (s->term)
                child_set_env(&env, &envsize, "TERM", s->term);
        if (s->display)