MINA SSHD
  1. MINA SSHD
  2. SSHD-146

SSH Server : EOF from command not propagating to Process (InvertedShell)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.6.0, 0.7.0
    • Fix Version/s: 0.7.0
    • Labels:
      None

      Description

      This issue is related to SSHD-35.
      The change implemented in that issue causes the EOF to be propagated to the shell, but because the inverted shell has to pump between the SSH streams and the Process streams, the EOF never makes it to the OS process.

      The cause is that ChannelSession.handleEof() calls shellIn.close(), but shellIn is not directly attached to the process. In fact it's InvertedShellWrapper.pumpStream() that copies from the shellIn to the process, and that doesn't handle EOF.

      I can't see a obvious fix.
      I've put a bit of a hack in that does what I need (and proves that this problem is as described), but it really is a hack...

      1. SSH-146.patch
        5 kB
        Pierre-Etienne Poirot
      2. sshd-eof.patch
        1 kB
        Tim Vernum

        Activity

        Tim Vernum created issue -
        Hide
        Tim Vernum added a comment -

        Hack to pump EOF from shellIn to process stdin

        Show
        Tim Vernum added a comment - Hack to pump EOF from shellIn to process stdin
        Tim Vernum made changes -
        Field Original Value New Value
        Attachment sshd-eof.patch [ 12496260 ]
        Hide
        Pierre-Etienne Poirot added a comment -

        SSH-146: Tim's patch (plus a minor change to remove the race condition in InvertedShellWrapper.pumpStream(), where ChannelPipedInputStream.available() was called twice), plus a simple JUnit test

        Show
        Pierre-Etienne Poirot added a comment - SSH-146: Tim's patch (plus a minor change to remove the race condition in InvertedShellWrapper.pumpStream(), where ChannelPipedInputStream.available() was called twice), plus a simple JUnit test
        Pierre-Etienne Poirot made changes -
        Attachment SSHD-146.patch [ 12525055 ]
        Pierre-Etienne Poirot made changes -
        Attachment SSHD-146.patch [ 12525055 ]
        Pierre-Etienne Poirot made changes -
        Attachment SSH-146.patch [ 12525062 ]
        Hide
        Guillaume Nodet added a comment -

        Thx Tim and Pierre. I've applied the patch.

        Show
        Guillaume Nodet added a comment - Thx Tim and Pierre. I've applied the patch.
        Guillaume Nodet made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Guillaume Nodet [ gnt ]
        Fix Version/s 0.7.0 [ 12317953 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Guillaume Nodet
            Reporter:
            Tim Vernum
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development