Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-56

SCPCommand can't handle wildcards

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.4.0
    • None

    Description

      Neither option -t or -f handles wildcards.

      1) Option f: Copying from the server to the client might be ok, since we can just refuse to work with wildcards

      2) Option t: Copying from client to server on the form scp filepattern* server.with.mina.sshd:/ just makes ScpCommand crash, since SSHD can't handle multiple input lines, when the scp client expands the wildcards.

      Furthermore, the SCPCommand should handle warnings and failures sent from the client, which it currently doesn't do.

      Propsed very ugly fix for 2) and the failure/warning problem

      if (optT) {
      ack();
      for (; {
      String line;

      boolean isDir = false;
      char c = readAck();
      switch (c)

      { case 'D': isDir = true; case 'C': case 'E': line = c + readLine(); break; default: //a real ack that has been acted upon already continue; }

      if (optR && isDir)

      { writeDir(line, root); }

      else

      { writeFile(line, root); }


      }
      }

      And replacing readAck with something like:

      private char readAck() throws IOException {
      int c = in.read();
      switch (c)

      { case -1: throw new EOFException(); case 0: break; case 1: logger.warn("received warning " +readLine()) break; case 2: throw new IOException(readLine()); default: break; }

      return (char)c;
      }

      Proposed fix for 1): use some wildcard matcher on the local file system. I have one, but it's proprietary so I can't submit it here.

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            lagergren Marcus Lagergren
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: