Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.4.0
    • Labels:
      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.

        Activity

        Hide
        Guillaume Nodet added a comment -

        Do you think you could write a patch for this problem ?

        Show
        Guillaume Nodet added a comment - Do you think you could write a patch for this problem ?
        Hide
        Marcus Lagergren added a comment -

        Sure - I can give it a try, but I am currently under a lot of tight deadlines so I can't promise you when it'll be done.

        Show
        Marcus Lagergren added a comment - Sure - I can give it a try, but I am currently under a lot of tight deadlines so I can't promise you when it'll be done.
        Hide
        Guillaume Nodet added a comment -

        Committing to https://svn.apache.org/repos/asf/mina/sshd/trunk ...
        A sshd-core/src/main/java/org/apache/sshd/common/util/DirectoryScanner.java
        A sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
        M sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommand.java
        M sshd-core/src/test/java/org/apache/sshd/ScpTest.java
        Committed r939298

        Show
        Guillaume Nodet added a comment - Committing to https://svn.apache.org/repos/asf/mina/sshd/trunk ... A sshd-core/src/main/java/org/apache/sshd/common/util/DirectoryScanner.java A sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java M sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommand.java M sshd-core/src/test/java/org/apache/sshd/ScpTest.java Committed r939298

          People

          • Assignee:
            Guillaume Nodet
            Reporter:
            Marcus Lagergren
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development