diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/libbb.h b/include/libbb.h index e332f165a..e540f2a90 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1776,15 +1776,16 @@ extern void selinux_or_die(void) FAST_FUNC; | |||
1776 | 1776 | ||
1777 | 1777 | ||
1778 | /* setup_environment: | 1778 | /* setup_environment: |
1779 | * if chdir pw->pw_dir: ok: else if to_tmp == 1: goto /tmp else: goto / or die | 1779 | * if !SETUP_ENV_NO_CHDIR: |
1780 | * if clear_env = 1: cd(pw->pw_dir), clear environment, then set | 1780 | * if cd(pw->pw_dir): ok: else if SETUP_ENV_TO_TMP: cd(/tmp) else: cd(/) or die |
1781 | * if SETUP_ENV_CLEARENV: cd(pw->pw_dir), clear environment, then set | ||
1781 | * TERM=(old value) | 1782 | * TERM=(old value) |
1782 | * USER=pw->pw_name, LOGNAME=pw->pw_name | 1783 | * USER=pw->pw_name, LOGNAME=pw->pw_name |
1783 | * PATH=bb_default_[root_]path | 1784 | * PATH=bb_default_[root_]path |
1784 | * HOME=pw->pw_dir | 1785 | * HOME=pw->pw_dir |
1785 | * SHELL=shell | 1786 | * SHELL=shell |
1786 | * else if change_env = 1: | 1787 | * else if SETUP_ENV_CHANGEENV: |
1787 | * if not root (if pw->pw_uid != 0): | 1788 | * if not root (if pw->pw_uid != 0) or if SETUP_ENV_CHANGEENV_LOGNAME: |
1788 | * USER=pw->pw_name, LOGNAME=pw->pw_name | 1789 | * USER=pw->pw_name, LOGNAME=pw->pw_name |
1789 | * HOME=pw->pw_dir | 1790 | * HOME=pw->pw_dir |
1790 | * SHELL=shell | 1791 | * SHELL=shell |
@@ -1793,10 +1794,11 @@ extern void selinux_or_die(void) FAST_FUNC; | |||
1793 | * NB: CHANGEENV and CLEARENV use setenv() - this leaks memory! | 1794 | * NB: CHANGEENV and CLEARENV use setenv() - this leaks memory! |
1794 | * If setup_environment() is used is vforked child, this leaks memory _in parent too_! | 1795 | * If setup_environment() is used is vforked child, this leaks memory _in parent too_! |
1795 | */ | 1796 | */ |
1796 | #define SETUP_ENV_CHANGEENV (1 << 0) | 1797 | #define SETUP_ENV_CHANGEENV (1 << 0) |
1797 | #define SETUP_ENV_CLEARENV (1 << 1) | 1798 | #define SETUP_ENV_CHANGEENV_LOGNAME (1 << 1) |
1798 | #define SETUP_ENV_TO_TMP (1 << 2) | 1799 | #define SETUP_ENV_CLEARENV (1 << 2) |
1799 | #define SETUP_ENV_NO_CHDIR (1 << 4) | 1800 | #define SETUP_ENV_TO_TMP (1 << 3) |
1801 | #define SETUP_ENV_NO_CHDIR (1 << 4) | ||
1800 | void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC; | 1802 | void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC; |
1801 | void nuke_str(char *str) FAST_FUNC; | 1803 | void nuke_str(char *str) FAST_FUNC; |
1802 | #if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM | 1804 | #if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM |