Bug 1461 - session.c: don't chdir() after chroot() if chroot_path==pw->pw_dir
Summary: session.c: don't chdir() after chroot() if chroot_path==pw->pw_dir
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 5.0p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_1
  Show dependency treegraph
 
Reported: 2008-04-28 22:28 AEST by konrad rzentarzewski
Modified: 2008-07-22 12:22 AEST (History)
2 users (show)

See Also:


Attachments
suppress chdir failure warning when ChrootDirectory set (1.10 KB, patch)
2008-06-15 04:20 AEST, Damien Miller
dtucker: ok+
Details | Diff
suppress chdir failure warning when ChrootDirectory set (portable) (1.12 KB, patch)
2008-06-15 04:21 AEST, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description konrad rzentarzewski 2008-04-28 22:28:58 AEST
i have a setup where user directory is chroot directory (ChrootDirectory %h). after user logs in it's presented with error "Could not chdir to home directory /home/vhosts/user: No such file or directory" which doesn't make sense with this setup and leaks information about paths above chroot.

i expect that user should be left in chroot's root (from chdir() and chroot() sequence in safely_chroot()) or chdir to $HOME setup by pam_env.
Comment 1 Damien Miller 2008-06-15 04:20:30 AEST
Created attachment 1524 [details]
suppress chdir failure warning when ChrootDirectory set

Patch for OpenBSD
Comment 2 Damien Miller 2008-06-15 04:21:42 AEST
Created attachment 1525 [details]
suppress chdir failure warning when ChrootDirectory set (portable)

portable OpenSSH patch
Comment 3 Damien Miller 2008-06-15 04:23:20 AEST
Please try one of the attached patches. They simply suppress the warning when ChrootDirectory is set and the login does not require a home directory.
Comment 4 Darren Tucker 2008-06-15 04:29:35 AEST
Comment on attachment 1524 [details]
suppress chdir failure warning when ChrootDirectory set

You misspelled "homdir", but otherwise ok
Comment 5 Darren Tucker 2008-06-15 05:47:17 AEST
This has now been applied and will be in the next release (5.1) and tomorrow's snapshots (http://www.mindrot.org/openssh_snap/).

Thanks.
Comment 6 Damien Miller 2008-07-22 12:22:00 AEST
Mass update RESOLVED->CLOSED after release of openssh-5.1