OpenSSH_4.3p2 fails to create a pty session
Darren Tucker
dtucker at zip.com.au
Fri Aug 18 00:16:10 EST 2006
On Wed, Aug 16, 2006 at 04:15:31PM -0400, Eric Millbrandt wrote:
> Darren Tucker wrote:
> >In order to figure out what's going on, we need to know what options
> >are enabled on your config.h that affect pty allocation.
> >
> >From our survey data I see that FreeBSD 4 has openpty (which is used
> >if possible) so HAVE_OPENPTY should be set. (Could you please check
> >config.h and confirm, if not post your config.h here.)
> Yes HAVE_OPENPTY is defined.
> >
> >Also, you could try this patch to see what descriptors openpty
> >returns. I suspect that one or both descriptors will be -1 but
> >openpty will have returned 0 (ie success).
> >
> openpty returned 0 descriptors 4/6 name /dev/ttyp3
OK, so openpty returns a success, and hopefully the descriptors it returned
are valid.
[...]
> debug3: mm_request_send entering: type 26
> mm_send_fd: sendmsg(4): Bad file descriptor
I'm not sure if the "Bad descriptor" error refers to the descriptor
being sent or the descriptor over which it is sent. I suspect the former
otherwise sshd would have bailed much sooner.
I suggest using lsof(1) to examine the file descriptors in question, but
since there's a very small window to catch it you probably need something
like the patch below (ie run "lsof -p [pid]" while it's sleeping).
The other thing to check is to make sure all of your device files for
ptys exist (maybe rerun MAKEDEV or whatever FreeBSD uses).
Index: monitor_fdpass.c
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/monitor_fdpass.c,v
retrieving revision 1.20
diff -u -p -r1.20 monitor_fdpass.c
--- monitor_fdpass.c 5 Aug 2006 02:39:40 -0000 1.20
+++ monitor_fdpass.c 17 Aug 2006 14:10:30 -0000
@@ -69,6 +69,9 @@ mm_send_fd(int sock, int fd)
msg.msg_iov = &vec;
msg.msg_iovlen = 1;
+ error("lsof me now! (pid %d, sock %d, fd %d)", getpid(), sock, fd);
+ sleep(1000);
+
if ((n = sendmsg(sock, &msg, 0)) == -1)
fatal("%s: sendmsg(%d): %s", __func__, fd,
strerror(errno));
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
More information about the openssh-unix-dev
mailing list