Bug 1461

Summary: session.c: don't chdir() after chroot() if chroot_path==pw->pw_dir
Product: Portable OpenSSH Reporter: konrad rzentarzewski <kondi>
Component: sshdAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm, dtucker
Priority: P2    
Version: 5.0p1   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1452    
Attachments:
Description Flags
suppress chdir failure warning when ChrootDirectory set
dtucker: ok+
suppress chdir failure warning when ChrootDirectory set (portable) dtucker: ok+

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