version 1.7, 2019/06/16 18:16:34 |
version 1.8, 2019/06/17 16:01:26 |
|
|
createenv(const struct rule *rule, const struct passwd *mypw, |
createenv(const struct rule *rule, const struct passwd *mypw, |
const struct passwd *targpw) |
const struct passwd *targpw) |
{ |
{ |
|
static const char *copyset[] = { |
|
"DISPLAY", "TERM", |
|
NULL |
|
}; |
struct env *env; |
struct env *env; |
u_int i; |
u_int i; |
|
|
|
|
env->count = 0; |
env->count = 0; |
|
|
addnode(env, "DOAS_USER", mypw->pw_name); |
addnode(env, "DOAS_USER", mypw->pw_name); |
|
addnode(env, "HOME", targpw->pw_dir); |
|
addnode(env, "LOGNAME", targpw->pw_name); |
|
addnode(env, "PATH", getenv("PATH")); |
|
addnode(env, "SHELL", targpw->pw_shell); |
|
addnode(env, "USER", targpw->pw_name); |
|
|
|
fillenv(env, copyset); |
|
|
if (rule->options & KEEPENV) { |
if (rule->options & KEEPENV) { |
extern const char **environ; |
extern const char **environ; |
|
|
|
|
env->count++; |
env->count++; |
} |
} |
} |
} |
} else { |
|
static const char *copyset[] = { |
|
"DISPLAY", "TERM", |
|
NULL |
|
}; |
|
|
|
addnode(env, "HOME", targpw->pw_dir); |
|
addnode(env, "LOGNAME", targpw->pw_name); |
|
addnode(env, "PATH", getenv("PATH")); |
|
addnode(env, "SHELL", targpw->pw_shell); |
|
addnode(env, "USER", targpw->pw_name); |
|
|
|
fillenv(env, copyset); |
|
} |
} |
|
|
return env; |
return env; |