sshd -i always exiting with exit status 255

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



Hi,

I've created a tool which utilizes sshd to enable users to get an interactive session on a Linux compute cluster. The tool submits a wrapper into the cluster. This wrapper creates the listen socket on a dynamic port number, accepts a connection on that socket and then calls sshd in inetd mode with '-i'. Everything works fine and as intended.

However, there is one nuisance: I've noticed that sshd always terminates with exit status 255 even if the interactive session is closed normally. Because of this I can't just exec() sshd from the wrapper as its last step, but need to fork sshd, wait for it, ignore its exit status and exit the wrapper with exit status 0 to communicate a normal exit to the cluster scheduler. This could cover real and unexpected errors.

I've used gdbserver to attach to the sshd process, so I can tell that the exit status of the main (the "privileged" process?) of sshd originates in mm_request_receive from the EPIPE errno check:

void
mm_request_receive(int sock, struct sshbuf *m)
{
    u_char buf[4], *p = NULL;
    u_int msg_len;
    int r;

    debug3_f("entering");

    if (atomicio(read, sock, buf, sizeof(buf)) != sizeof(buf)) {
        if (errno == EPIPE)
            cleanup_exit(255);
        fatal_f("read: %s", strerror(errno));
    }

Questions:

- Is this the expected exit point of `sshd -i` ?
- If so, is there a reason to return a failure exit status?

Thanks!

  Donald

--
Donald Buczek
buczek@xxxxxxxxxxxxx
Tel: +49 30 8413 1433
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux