Changeset 2021

Show
Ignore:
Timestamp:
02/09/2010 02:23:49 PM (6 months ago)
Author:
djb61
Message:

Make the MKD command resolve out a symlink as the parent of the new directory before attempting to create the new directory. Additionally resovle out symlinks in VirtualFileSystem.getInodeByPath() so that a CWD with an absolute path containing symlinks works correctly. This fixes #258

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/master/src/org/drftpd/vfs/VirtualFileSystem.java

    r2005 r2021  
    190190                        if (inode.isDirectory()) { 
    191191                                walker = (VirtualFileSystemDirectory) inode; 
     192                        } else if (inode.isLink()) { 
     193                                walker = (VirtualFileSystemDirectory) getInodeByPath(((VirtualFileSystemLink)inode).getLinkPath()); 
    192194                        } else { // We better be at the end of the array 
    193195                                if (x != values.length - 1) { 
  • trunk/src/plugins/org.drftpd.commands.dir/src/org/drftpd/commands/dir/Dir.java

    r2009 r2021  
    258258 
    259259                try { 
     260                        try { 
     261                                if (!fakeDirectory.getParent().equals(request.getCurrentDirectory()) &&  
     262                                                InodeHandle.isLink(fakeDirectory.getParent().getPath())) { 
     263                                        fakeDirectory = new LinkHandle(fakeDirectory.getParent().getPath()) 
     264                                        .getTargetDirectory(session.getUserNull(request.getUser())) 
     265                                        .getNonExistentDirectoryHandle(dirName); 
     266                                } 
     267                        } catch (FileNotFoundException e1) { 
     268                                return new CommandResponse(550, "Parent directory does not exist"); 
     269                        } catch (ObjectNotValidException e) { 
     270                                return new CommandResponse(550, "Parent directory does not exist"); 
     271                        } 
    260272                        DirectoryHandle newDir = null; 
    261273                        try {