debug_return_str(val);
}
-/*
- * Merge another environment with our private copy.
- */
-void
-env_merge(char * const envp[], bool overwrite)
-{
- char * const *ep;
- debug_decl(env_merge, SUDO_DEBUG_ENV)
-
- for (ep = envp; *ep != NULL; ep++)
- sudo_putenv(*ep, true, overwrite);
-
- debug_return;
-}
-
/*
* Check the env_delete blacklist.
* Returns true if the variable was found, else false.
debug_return_bool(keepit == true);
}
+/*
+ * Merge another environment with our private copy.
+ * Only overwrite an existing variable if it is not
+ * being preserved from the user's environment.
+ */
+void
+env_merge(char * const envp[])
+{
+ char * const *ep;
+ debug_decl(env_merge, SUDO_DEBUG_ENV)
+
+ for (ep = envp; *ep != NULL; ep++)
+ sudo_putenv(*ep, true, !env_should_keep(*ep));
+
+ debug_return;
+}
+
static void
env_update_didvar(const char *ep, unsigned int *didvar)
{
/* env.c */
char **env_get(void);
-void env_merge(char * const envp[], bool overwrite);
+void env_merge(char * const envp[]);
void env_init(char * const envp[]);
void init_envtables(void);
void insert_env_vars(char * const envp[]);