diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-09-15 07:13:52 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-09-15 07:13:52 +0000 |
commit | 42a3e69c05af72afbc1d37574fba7729b828289b (patch) | |
tree | becf08be7a11e201542de4de93b8cd0f8650f9e1 /libexec/rshd | |
parent | b74ef7bac5077f29fc1c12e8b5ccaf0e2f1f8fdc (diff) |
check return value for setenv(3) for failure, and deal appropriately
Diffstat (limited to 'libexec/rshd')
-rw-r--r-- | libexec/rshd/rshd.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c index 55aa2446fb0..1b3c8fb377d 100644 --- a/libexec/rshd/rshd.c +++ b/libexec/rshd/rshd.c @@ -39,7 +39,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; */ -static char *rcsid = "$Id: rshd.c,v 1.32 2000/08/20 18:42:38 millert Exp $"; +static char *rcsid = "$Id: rshd.c,v 1.33 2000/09/15 07:13:47 deraadt Exp $"; #endif /* not lint */ /* @@ -721,10 +721,12 @@ fail: pwd->pw_shell = _PATH_BSHELL; environ = envinit; - setenv("HOME", pwd->pw_dir, 1); - setenv("SHELL", pwd->pw_shell, 1); - setenv("USER", pwd->pw_name, 1); - setenv("LOGNAME", pwd->pw_name, 1); + if (setenv("HOME", pwd->pw_dir, 1) == -1 || + setenv("SHELL", pwd->pw_shell, 1) == -1 || + setenv("USER", pwd->pw_name, 1) == -1 || + setenv("LOGNAME", pwd->pw_name, 1) == -1) + errx(1, "cannot setup environment"); + if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETALL)) errx(1, "cannot set user context"); |