Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-590

SFTP moveTo operation might fail on permission checks even if the operation itself might succeed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Nightly Builds
    • 2.5.0
    • None

    Description

      Continuing with SFTP moveTo, see VFS-588 and VFS-589 for more details.

      The permission checks that VFS performs during moveTo() can result in failure.

      org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(final FileObject destFile) starts with some checks:

          @Override
          public void moveTo(final FileObject destFile) throws FileSystemException
          {
              if (canRenameTo(destFile))
              {
                  if (!getParent().isWriteable())
                  {
                      throw new FileSystemException("vfs.provider/rename-parent-read-only.error",
                              getName(),
                              getParent().getName());
                  }
              }
              else
              {
                  if (!isWriteable())
                  {
                      throw new FileSystemException("vfs.provider/rename-read-only.error", getName());
                  }
              }
      

      The problem is: isWriteable() might fail or even hang. Performing moveTo without this check might successfully rename the file.

      isWriteable() in case of SFTP can fail if the server disables SSH channelExec. Or if it does not support "id" command.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              klv_m72 L
              Votes:
              5 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m