Revert keeping LANG variable of original user when switching to

another user. LANG is not kept unless explicitly passed in the doas.conf file.
This commit is contained in:
Jesse Smith 2021-06-03 11:47:42 -03:00
parent 6613c9d10c
commit 014d8655fe
2 changed files with 2 additions and 7 deletions

2
doas.c
View file

@ -529,7 +529,7 @@ main(int argc, char **argv)
LOGIN_SETUSER) != 0)
errx(1, "failed to set user context for target");
}
/* No imulated login, skip setting target environment */
/* No simulated login, skip setting target environment */
else
{
if (setusercontext(NULL, target_pw, target,

7
env.c
View file

@ -117,7 +117,6 @@ createenv(struct rule *rule, struct passwd *original, struct passwd *target)
{
struct env *env;
u_int i;
char *language = NULL;
env = malloc(sizeof(*env));
if (!env)
@ -134,10 +133,6 @@ createenv(struct rule *rule, struct passwd *original, struct passwd *target)
addnode(env, "PATH", GLOBAL_PATH);
addnode(env, "SHELL", target->pw_shell);
addnode(env, "USER", target->pw_name);
/* avoid dropping language of original user */
language = getenv("LANG");
if (language)
addnode(env, "LANG", language);
if (rule->options & KEEPENV) {
#ifndef linux
@ -200,7 +195,7 @@ fillenv(struct env *env, const char **envlist)
struct envnode *node, key;
const char *e, *eq;
const char *val;
char name[1024];
char name[MAX_ENV_LENGTH];
u_int i;
size_t len;