]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: set $CREDENTIALS_DIRECTORY only when we set up credentials
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 12 Aug 2023 06:25:03 +0000 (15:25 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Aug 2023 02:39:08 +0000 (11:39 +0900)
It is not necessary to set the environment variable on an execution step
we do not support credentials.

src/core/execute.c

index 14e196d4c7a6c33def1bb901cc0d710d8bb2aed0..78d8988e8b1795f537d7ba3d26fce40e1a046c0a 100644 (file)
@@ -2041,7 +2041,9 @@ static int build_environment(
                 our_env[n_env++] = x;
         }
 
-        if (exec_context_has_credentials(c) && p->prefix[EXEC_DIRECTORY_RUNTIME]) {
+        if (exec_context_has_credentials(c) &&
+            p->prefix[EXEC_DIRECTORY_RUNTIME] &&
+            FLAGS_SET(p->flags, EXEC_WRITE_CREDENTIALS)) {
                 x = strjoin("CREDENTIALS_DIRECTORY=", p->prefix[EXEC_DIRECTORY_RUNTIME], "/credentials/", u->id);
                 if (!x)
                         return -ENOMEM;