msdfs on 3.0.25b - hide unreadable on DFS links
Jeremy Allison
jra at samba.org
Fri Aug 10 00:07:01 GMT 2007
On Thu, Aug 09, 2007 at 11:24:13AM +0200, Jan Martin wrote:
>
> What about a small patch as an implementation of my proposal no. 2?
> It forces showing of dangling msdfs links only, honoring a target stat
> if available.
>
> -----------------------------------------------------
> diff -rU 5 samba_30_25/source/smbd/dir.c
> samba_30_25_hidemsdfs/source/smbd/dir.c
> --- samba_30_25/source/smbd/dir.c 2007-08-07 12:46:40.000000000
> +0200
> +++ samba_30_25_hidemsdfs/source/smbd/dir.c 2007-08-09
> 10:28:30.000000000 +0200
> @@ -1022,14 +1022,16 @@
>
> if (asprintf(&entry, "%s/%s", dir_path, name) == -1) {
> return False;
> }
>
> - /* If it's a dfs symlink, ignore _hide xxxx_ options */
> + /* If it's a dangling dfs symlink, ignore _hide xxxx_
> options */
> if (lp_host_msdfs() &&
> lp_msdfs_root(SNUM(conn)) &&
> - is_msdfs_link(conn, entry, link_target,
> NULL)) {
> + is_msdfs_link(conn, entry, link_target,
> NULL) &&
> + !VALID_STAT(*pst) &&
> + (SMB_VFS_STAT(conn, name, pst) != 0)) {
> SAFE_FREE(entry);
> return True;
> }
>
> /* Honour _hide unreadable_ option */
> ----------------------------------------------------------
This patch doesn't work - you need to be doing a SMB_VFS_STAT
of "entry" here, not "name". In addition, callers of is_visible_file
don't all ensure that the passed in stat struct is zeroed (that's
a bug, I'll fix it :-) plus this may have an effect on servers
operating in POSIX mode, as they must do an LSTAT not a STAT
on paths.
This isn't quite as simple as it looks :-).
Jeremy.
More information about the samba-technical
mailing list