Subject: Re: Comments on draft-ietf-secsh-filexfer-05.txt

From: Joseph Galbraith <[email-masked]>
Date: Tue, 05 Oct 2004 10:23:43 -0600

Damien Miller wrote:
> Another comment/query on the filexfer draft:
> 
> I think that SSH_FXP_OPEN should support a flag to stop it from
> following symlinks, like O_NOFOLLOW on some Unices.
> 
> Without something like this, I believe that SSH_FXP_FSTAT isn't very
> useful as a race-free means to collect attributes. One could end up
> following a symlink unless one checks it first - which opens another race.
> 
> Even using the hypothetical nofollow isn't entirely race-free, but it
> enables a server to not chase symlinks (e.g. to /dev/st0) if it doesn't
> want to.

If no one else has any thoughts or objections to this,
I will add it to the draft as follows:

New flag to open command:

     SSH_FXF_NOFOLLOW                  = 0x00000200

SSH_FXF_NOFOLLOW
   If the final component of the path is a symlink, the link
   file itself should be opened instead of the the target.

What should the behavior be if a symlink file is opened and
then read or written to?

Thanks,

- Joseph

---

From: Damien Miller <[email-masked]>
Date: Wed, 06 Oct 2004 09:58:22 +1000

> What should the behavior be if a symlink file is opened and

I think that the open() should fail when NOFOLLOW is set and the target
is a symlink. This is what the open(2) flag in Linux/BSD does, returning
errno == ELOOP.

-d

---

From: Joseph Galbraith <[email-masked]>
Date: Wed, 06 Oct 2004 13:37:18 -0600

> is a symlink. This is what the open(2) flag in Linux/BSD does, returning

Okay, I've changed the description to read:

   If the final component of the path is a symlink,
   the open must fail, with the error SSH_FX_SYMLINK.

And added the error code SSH_FX_SYMLINK, with the
following description:

   The file could not be opened because it is a symbolic link
   and the NOFOLLOW flag was specified.

Does that sound right?

Thanks,

Joseph

---

From: Joseph Galbraith <[email-masked]>
Date: Wed, 06 Oct 2004 13:38:39 -0600

>   and the NOFOLLOW flag was specified.

I take that back... if the OS is return ELOOP, I have
the error be SSH_FX_LINK_LOOP, and get rid of
SSH_FX_SYMLINK.

Thanks,

- Joseph