aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/include/libbb.h b/include/libbb.h
index daa310776..a0ffbef62 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1726,15 +1726,16 @@ extern void selinux_or_die(void) FAST_FUNC;
1726 1726
1727 1727
1728/* setup_environment: 1728/* setup_environment:
1729 * if chdir pw->pw_dir: ok: else if to_tmp == 1: goto /tmp else: goto / or die 1729 * if !SETUP_ENV_NO_CHDIR:
1730 * if clear_env = 1: cd(pw->pw_dir), clear environment, then set 1730 * if cd(pw->pw_dir): ok: else if SETUP_ENV_TO_TMP: cd(/tmp) else: cd(/) or die
1731 * if SETUP_ENV_CLEARENV: cd(pw->pw_dir), clear environment, then set
1731 * TERM=(old value) 1732 * TERM=(old value)
1732 * USER=pw->pw_name, LOGNAME=pw->pw_name 1733 * USER=pw->pw_name, LOGNAME=pw->pw_name
1733 * PATH=bb_default_[root_]path 1734 * PATH=bb_default_[root_]path
1734 * HOME=pw->pw_dir 1735 * HOME=pw->pw_dir
1735 * SHELL=shell 1736 * SHELL=shell
1736 * else if change_env = 1: 1737 * else if SETUP_ENV_CHANGEENV:
1737 * if not root (if pw->pw_uid != 0): 1738 * if not root (if pw->pw_uid != 0) or if SETUP_ENV_CHANGEENV_LOGNAME:
1738 * USER=pw->pw_name, LOGNAME=pw->pw_name 1739 * USER=pw->pw_name, LOGNAME=pw->pw_name
1739 * HOME=pw->pw_dir 1740 * HOME=pw->pw_dir
1740 * SHELL=shell 1741 * SHELL=shell
@@ -1743,10 +1744,11 @@ extern void selinux_or_die(void) FAST_FUNC;
1743 * NB: CHANGEENV and CLEARENV use setenv() - this leaks memory! 1744 * NB: CHANGEENV and CLEARENV use setenv() - this leaks memory!
1744 * If setup_environment() is used is vforked child, this leaks memory _in parent too_! 1745 * If setup_environment() is used is vforked child, this leaks memory _in parent too_!
1745 */ 1746 */
1746#define SETUP_ENV_CHANGEENV (1 << 0) 1747#define SETUP_ENV_CHANGEENV (1 << 0)
1747#define SETUP_ENV_CLEARENV (1 << 1) 1748#define SETUP_ENV_CHANGEENV_LOGNAME (1 << 1)
1748#define SETUP_ENV_TO_TMP (1 << 2) 1749#define SETUP_ENV_CLEARENV (1 << 2)
1749#define SETUP_ENV_NO_CHDIR (1 << 4) 1750#define SETUP_ENV_TO_TMP (1 << 3)
1751#define SETUP_ENV_NO_CHDIR (1 << 4)
1750void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC; 1752void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC;
1751void nuke_str(char *str) FAST_FUNC; 1753void nuke_str(char *str) FAST_FUNC;
1752#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM 1754#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM