[PATCH][BZ #14516] Don't make ttyname fail if procfs is unavailable
Siddhesh Poyarekar
siddhesh@redhat.com
Fri Aug 24 09:21:00 GMT 2012
Hi,
SSH chroot using pam_chroot.so does not work when there is no
mounted /proc inside the chroot. The ssh server throws the following
error in /var/log/secure:
Aug 24 13:26:06 rawhide sshd[11735]: fatal: openpty returns device for
which ttyname fails.
while the client shows the following error and disconnects:
Connection to localhost closed by remote host.
Connection to localhost closed.
This failure occurs because sshd calls ttyname() and fails due to /proc
not being present inside the chroot by returning -1 and setting errno
to EBADF. Thanks to Masahiro Matsuya <mmatsuya@redhat.com> for
isolating the root cause of this problem.
Steps to reproduce this are mentioned in the bugzilla. Attached patch
removes the failure path and allows ttyname() to fall back to
traversing /dev/pts/ for the file descriptor if /proc is unavailable.
I have tested this on Fedora rawhide x86_64 and found no regressions
resulting from this fix.
Regards,
Siddhesh
ChangeLog:
[BZ #14516]
* sysdeps/unix/sysv/linux/ttyname.c (ttyname): Don't return
failure if reading from procfs failed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glibc-ttyname.patch
Type: text/x-patch
Size: 506 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120824/0ef87e3e/attachment.bin>
More information about the Libc-alpha
mailing list