summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'session.c')
-rw-r--r--session.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/session.c b/session.c
index 58826db16..5ceebff51 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: session.c,v 1.294 2018/03/03 03:15:51 djm Exp $ */ 1/* $OpenBSD: session.c,v 1.295 2018/06/01 03:33:53 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
@@ -1324,7 +1324,7 @@ safely_chroot(const char *path, uid_t uid)
1324void 1324void
1325do_setusercontext(struct passwd *pw) 1325do_setusercontext(struct passwd *pw)
1326{ 1326{
1327 char *chroot_path, *tmp; 1327 char uidstr[32], *chroot_path, *tmp;
1328 1328
1329 platform_setusercontext(pw); 1329 platform_setusercontext(pw);
1330 1330
@@ -1356,8 +1356,10 @@ do_setusercontext(struct passwd *pw)
1356 strcasecmp(options.chroot_directory, "none") != 0) { 1356 strcasecmp(options.chroot_directory, "none") != 0) {
1357 tmp = tilde_expand_filename(options.chroot_directory, 1357 tmp = tilde_expand_filename(options.chroot_directory,
1358 pw->pw_uid); 1358 pw->pw_uid);
1359 snprintf(uidstr, sizeof(uidstr), "%llu",
1360 (unsigned long long)pw->pw_uid);
1359 chroot_path = percent_expand(tmp, "h", pw->pw_dir, 1361 chroot_path = percent_expand(tmp, "h", pw->pw_dir,
1360 "u", pw->pw_name, (char *)NULL); 1362 "u", pw->pw_name, "U", uidstr, (char *)NULL);
1361 safely_chroot(chroot_path, pw->pw_uid); 1363 safely_chroot(chroot_path, pw->pw_uid);
1362 free(tmp); 1364 free(tmp);
1363 free(chroot_path); 1365 free(chroot_path);