Are paths passed to VFS funcs normalized?
rb at sernet.de
Mon Oct 27 14:16:52 MDT 2014
On Mon, Oct 27, 2014 at 01:09:44PM -0700, Jeremy Allison wrote:
> On Sat, Oct 25, 2014 at 09:53:47AM +0200, Ralph Böhme wrote:
> > are paths guaranteed to be normalized when passed to VFS functions
> > like SMB_VFS_MKDIR() (besides possibly beginning with "./") ?
> Yes, check_path_syntax_internal() in source3/smbd/reply.c
> cuts out any ../ and ./ entries so they shouldn't exist
> inside smbd.
thanks! While I came across the check_path functions later on while
going through the code, it seemed the semantics are that it's up to
each specifc SMB(1/2/3) function whether it makes use of it or not. I
checked trans2/findfirst which does use it, but then got distracted by
other fun stuff like waf bugs. ;)
> > I'm currently working on fixing up a 3rd party VFS module that goes
> > great length towards catching "/.." and stuff in paths.
> The only thing that can re-introduce this is via
> a symlink, but smbd does not follow call readlink
> other than for MSDFS or returning a link path to
> the client, so that should never be seen internally.
> We follow the link, but never see the link path
> we followed.
> If either widelinks or follow symlinks are disallowed,
> we use realpath to remove link artifacts.
Good to know!
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
More information about the samba-technical