Hi Guillaume, as far as I can tell stepping through the code, the exception is 
swallowed and logged in SftpSubsystem.java lines 372-375:

} catch (Throwable t) {
            if (!closed && !(t instanceof EOFException)) { // Ignore han
                log.error("Exception caught in SFTP subsystem", t);
            }
        } finally {

This is in the public SftpSubsystem#run() method.  The stacktrace is like this, 
my exception trickles up and is caught in the run() method.

SftpSubsystem.run()
 SftpSubsystem.process()
  FileSystemView.getFile() 

-----Original Message-----
From: Guillaume Nodet [mailto:[email protected]] 
Sent: Monday, September 12, 2011 11:47 AM
To: [email protected]
Subject: Re: sftp questions

I think the message on the exception is sent back to the user, but currently
there's no way to return a different error code than SSH_FX_FAILURE.
I suppose we could define an exception containing the error code and use it
if such an exception is caught.

On Mon, Sep 12, 2011 at 17:10, Davis Ford <[email protected]> wrote:

> Ok, I figured this out by implementing my own FileSystemView interface, and
> related interfaces, and I can detect when a user tries to cd .. up to a
> parent dir -- if I detect this, I'm just throwing a RuntimeException and the
> client just gets an error indicating the SFTP command was not received.
>
> Technically this works, but it isn't clear to me how to do this gracefully
> so they would get some kind of permissions error.
>
> This is in my own implementation of FileSystemView#getFile(String file)
> which returns SshFile.  Is there some way to code this, so the Sftp
> subsystem will return some kind of auth or permissions error to the client?
>
> -----Original Message-----
> From: Davis Ford
> Sent: Friday, September 09, 2011 3:42 PM
> To: '[email protected]'
> Subject: RE: sftp questions
>
> Guillame -- Thanks for the info, appreciate it.  One other quick follow-up
> if I may - is there an easy way to pin a client into a specific directory
> for uploads?
>
>
>


-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to