*-*, *-l*, *--login*::
Start the shell as a login shell with an environment similar to a real login:
+
-* clears all the environment variables except for *TERM* and variables specified by *--whitelist-environment*
+* clears all the environment variables except for *TERM*, *COLORTERM*, *NO_COLOR* and variables specified by *--whitelist-environment*
* initializes the environment variables *HOME*, *SHELL*, *USER*, *LOGNAME*, and *PATH*
* changes to the target user's home directory
* sets argv[0] of the shell to '*-*' in order to make the shell a login shell
* --whitelist-environment if specified.
*/
if (su->simulate_login) {
- /* leave TERM unchanged */
+ /* leave unchanged */
su->env_whitelist = env_list_add_getenv(su->env_whitelist, "TERM", NULL);
+ su->env_whitelist = env_list_add_getenv(su->env_whitelist, "COLORTERM", NULL);
+ su->env_whitelist = env_list_add_getenv(su->env_whitelist, "NO_COLOR", NULL);
/* Note that original su(1) has allocated environ[] by malloc
* to the number of expected variables. This seems unnecessary
+
*su* does:
+
-* clears all the environment variables except *TERM* and variables specified by *--whitelist-environment*
+* clears all the environment variables except *TERM*, *COLORTERM*, *NO_COLOR* and variables specified by *--whitelist-environment*
* initializes the environment variables *HOME*, *SHELL*, *USER*, *LOGNAME*, and *PATH*
* changes to the target user's home directory
* sets argv[0] of the shell to '*-*' in order to make the shell a login shell