]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
execute: Cleanup the environment early
authorJouke Witteveen <j.witteveen@gmail.com>
Thu, 7 Jul 2016 10:36:33 +0000 (12:36 +0200)
committerJouke Witteveen <j.witteveen@gmail.com>
Thu, 7 Jul 2016 12:15:50 +0000 (14:15 +0200)
By cleaning up before setting up PAM we maintain control of overriding
behavior in setting variables. Otherwise, pam_putenv is in control.
This also makes sure we use a cleaned up environment in replacing
variables in argv.

src/core/execute.c

index 8cb18dbd5b5c4fca55cda809b6c8af2aab02e03b..1a7620b0848c56882c7103260d8dccfb93fb3ba8 100644 (file)
@@ -1858,6 +1858,7 @@ static int exec_child(
                 *exit_status = EXIT_MEMORY;
                 return -ENOMEM;
         }
+        accum_env = strv_env_clean(accum_env);
 
         umask(context->umask);
 
@@ -2166,8 +2167,6 @@ static int exec_child(
                 return -ENOMEM;
         }
 
-        accum_env = strv_env_clean(accum_env);
-
         if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) {
                 _cleanup_free_ char *line;