diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: session.c,v 1.226 2008/02/08 23:24:07 djm Exp $ */ | 1 | /* $OpenBSD: session.c,v 1.227 2008/02/10 10:54:29 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
@@ -1359,6 +1359,8 @@ safely_chroot(const char *path, uid_t uid) | |||
1359 | void | 1359 | void |
1360 | do_setusercontext(struct passwd *pw) | 1360 | do_setusercontext(struct passwd *pw) |
1361 | { | 1361 | { |
1362 | char *chroot_path, *tmp; | ||
1363 | |||
1362 | #ifndef HAVE_CYGWIN | 1364 | #ifndef HAVE_CYGWIN |
1363 | if (getuid() == 0 || geteuid() == 0) | 1365 | if (getuid() == 0 || geteuid() == 0) |
1364 | #endif /* HAVE_CYGWIN */ | 1366 | #endif /* HAVE_CYGWIN */ |
@@ -1442,11 +1444,12 @@ do_setusercontext(struct passwd *pw) | |||
1442 | 1444 | ||
1443 | if (options.chroot_directory != NULL && | 1445 | if (options.chroot_directory != NULL && |
1444 | strcasecmp(options.chroot_directory, "none") != 0) { | 1446 | strcasecmp(options.chroot_directory, "none") != 0) { |
1445 | char *chroot_path; | 1447 | tmp = tilde_expand_filename(options.chroot_directory, |
1446 | 1448 | pw->pw_uid); | |
1447 | chroot_path = percent_expand(options.chroot_directory, | 1449 | chroot_path = percent_expand(tmp, "h", pw->pw_dir, |
1448 | "h", pw->pw_dir, "u", pw->pw_name, (char *)NULL); | 1450 | "u", pw->pw_name, (char *)NULL); |
1449 | safely_chroot(chroot_path, pw->pw_uid); | 1451 | safely_chroot(chroot_path, pw->pw_uid); |
1452 | free(tmp); | ||
1450 | free(chroot_path); | 1453 | free(chroot_path); |
1451 | } | 1454 | } |
1452 | 1455 | ||