msdfs on 3.0.25b - hide unreadable on DFS links

Jan Martin Jan.Martin at rwedea.com
Thu Aug 9 09:24:13 GMT 2007


> a feature request (albeit to return to a mode
> that we used to support)
Right

> on some systems there is no lchmod
> call to change permissions on symlinks.
That's our problem

> The ideal solution would be to use the permissions
> on the link itself to determine this,
> but this would exclude Linux (which doesn't
> support permission changes on symlinks).
Agreed. That's where we started thinking about alternative ways to
describe msdfs links (proposal no. 4), but after some hours of
brainstorming, we didn't have a solution that was nearly as elegant as
the current syntax.

> Would this work for you ?
Unfortunately not, we're using Linux.

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 */
----------------------------------------------------------


Jan Martin


More information about the samba-technical mailing list