[Bug 1698] New: Connection stalls on PTY allocation failure

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Fri Jan 15 01:43:54 EST 2010


https://bugzilla.mindrot.org/show_bug.cgi?id=1698

           Summary: Connection stalls on PTY allocation failure
           Product: Portable OpenSSH
           Version: 5.3p1
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: sshd
        AssignedTo: unassigned-bugs at mindrot.org
        ReportedBy: alex at rtfs.hu


If on the server side sshd was not able to allocate a PTY (in my case a
wrongly configured FreeBSD's ugidfw rule wont allow opening those
files) both sshd and the client ssh will stall.

Client ssh log:

debug1: Requesting no-more-sessions at openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug2: channel 0: request shell confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_confirm: type 100 id 0
PTY allocation request failed on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_confirm: type 99 id 0
debug2: shell request accepted on channel 0

Server side log:
Jan 14 14:40:09 www sshd[50855]: error: openpty: Permission denied
Jan 14 14:40:09 www sshd[50855]: error: session_pty_req: session 0
alloc failed

--

I traced down this to session.c:session_pty_req:

        if (no_pty_flag) {
                debug("Allocating a pty not permitted for this
authentication.");
                return 0;
        }
        if (s->ttyfd != -1) {
                packet_disconnect("Protocol error: you already have a
pty.");
                return 0;
        }

...

        debug("Allocating pty.");
        if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty,
            sizeof(s->tty)))) {
                if (s->term)
                        xfree(s->term);
                s->term = NULL;
                s->ptyfd = -1;
                s->ttyfd = -1;
                error("session_pty_req: session %d alloc failed",
s->self);
                return 0;
        }

--

I am not that deeply into openssh but to me it looks like a
packet_disconnect() might be missing after the error().

-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list