diff options
author | Chris Johns <chrisj@rtems.org> | 2014-05-29 15:05:56 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-06-04 22:32:55 +1000 |
commit | bb581906a68a07074a5b0bc6cb6698fe983ca3ca (patch) | |
tree | 21cdfe7a360964039699f6d0a26414906d0f0af5 /cpukit/libmisc/shell/login_check.c | |
parent | score: Rename _Scheduler_Update() (diff) | |
download | rtems-bb581906a68a07074a5b0bc6cb6698fe983ca3ca.tar.bz2 |
shell: Add rtems_shell_dup_current_env to get a default env.
Remove rtems_current_shell_env as this is dangerous because
the env can be NULL if used outside of a valid shell with the
POSIX key to an env set up.
Clean up the usage of rtems_current_shell_env.
Diffstat (limited to 'cpukit/libmisc/shell/login_check.c')
-rw-r--r-- | cpukit/libmisc/shell/login_check.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cpukit/libmisc/shell/login_check.c b/cpukit/libmisc/shell/login_check.c index 4efed779ce..8be5be2c1a 100644 --- a/cpukit/libmisc/shell/login_check.c +++ b/cpukit/libmisc/shell/login_check.c @@ -43,11 +43,13 @@ bool rtems_shell_login_check( /* Valid user? */ if (pw != NULL && strcmp( pw->pw_passwd, "!") != 0) { + rtems_shell_env_t *env = rtems_shell_get_current_env(); setuid( pw->pw_uid); setgid( pw->pw_gid); rtems_current_user_env->euid = 0; rtems_current_user_env->egid = 0; - chown( rtems_current_shell_env->devname, pw->pw_uid, 0); + if (env) + chown( env->devname, pw->pw_uid, 0); rtems_current_user_env->euid = pw->pw_uid; rtems_current_user_env->egid = pw->pw_gid; if (strcmp( pw->pw_passwd, "*") == 0) { |