2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Only define _PATH_ENVIRONMENT on systems where we use /etc/environment.

This commit is contained in:
Todd C. Miller 2023-09-20 16:49:27 -06:00
parent 0c67456923
commit f2d267bfb4
3 changed files with 4 additions and 3 deletions

View File

@ -53,7 +53,8 @@
# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
#endif /* _PATH_STDPATH */
#ifndef _PATH_ENVIRONMENT
/* Use /etc/environment on AIX or Linux w/o PAM (where pam_env handles it). */
#if defined(_AIX) || (defined(__linux__) && !defined(HAVE_PAM))
# define _PATH_ENVIRONMENT "/etc/environment"
#endif /* _PATH_ENVIRONMENT */

View File

@ -911,7 +911,7 @@ rebuild_env(const struct sudoers_context *ctx)
}
}
#endif /* HAVE_LOGIN_CAP_H */
#if defined(_AIX) || (defined(__linux__) && !defined(HAVE_PAM))
#ifdef _PATH_ENVIRONMENT
/* Insert system-wide environment variables. */
if (!read_env_file(ctx, _PATH_ENVIRONMENT, true, false))
sudo_warn("%s", _PATH_ENVIRONMENT);

View File

@ -725,7 +725,7 @@ sudoers_check_cmnd(int argc, char * const argv[], char *env_add[],
sudoers_ctx.runas.argc++;
}
#if defined(_AIX) || (defined(__linux__) && !defined(HAVE_PAM))
#ifdef _PATH_ENVIRONMENT
/* Insert system-wide environment variables. */
if (!read_env_file(&sudoers_ctx, _PATH_ENVIRONMENT, true, false))
sudo_warn("%s", _PATH_ENVIRONMENT);