Fix bug #10097 - MacOSX 10.9 will not follow path-based DFS referrals handed out...
authorRichard Sharpe <realrichardsharpe@gmail.com>
Sun, 18 Aug 2013 14:34:31 +0000 (07:34 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 19 Aug 2013 20:21:34 +0000 (22:21 +0200)
Windows overloads the EA Length field in the DIRECTORY INFO leves of FIND FIRST/FIND NEXT.

This field indicates either the REPARSE_TAG if the file/folder has a reparse proint or
the EA Length if it has EAs, and is the fundamental reason you cannot have both on a
file or folder.

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Aug 19 22:21:34 CEST 2013 on sn-devel-104

source3/include/ntioctl.h
source3/smbd/dosmode.c
source3/smbd/trans2.c

index e09e1c85db3a46e7ccfdc3bbb026c4a63a2451c0..65bed645b5ccac219c5b0d915e612937221a7ff8 100644 (file)
@@ -26,6 +26,7 @@
 #define IO_REPARSE_TAG_MOUNT_POINT   0xA0000003
 #define IO_REPARSE_TAG_HSM           0xC0000004
 #define IO_REPARSE_TAG_SIS           0x80000007
+#define IO_REPARSE_TAG_DFS          0x8000000A
 
 
 /* For FSCTL_GET_SHADOW_COPY_DATA ...*/
index a6ad107a01e68c40b100fc8365770df495a47bf5..2d07dd9aa74527f7d5589efb51e7555781571861 100644 (file)
@@ -489,6 +489,11 @@ uint32 dos_mode_msdfs(connection_struct *conn,
 
        result = filter_mode_by_protocol(result);
 
+       /*
+        * Add in that it is a reparse point
+        */
+       result |= FILE_ATTRIBUTE_REPARSE_POINT;
+
        DEBUG(8,("dos_mode_msdfs returning "));
 
        if (result & FILE_ATTRIBUTE_HIDDEN) DEBUG(8, ("h"));
index 2bff483d7063a85b9efb111d760fa3cde92336cb..81f80c3bcb3cd4637c3861a3eb1462431ece951c 100644 (file)
@@ -24,6 +24,7 @@
 */
 
 #include "includes.h"
+#include "ntioctl.h"
 #include "system/filesys.h"
 #include "version.h"
 #include "smbd/smbd.h"
@@ -1817,12 +1818,14 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx,
                SOFF_T(p,0,allocation_size); p += 8;
                SIVAL(p,0,mode); p += 4;
                q = p; p += 4; /* q is placeholder for name length. */
-               {
+               if (mode & FILE_ATTRIBUTE_REPARSE_POINT) {
+                       SIVAL(p, 0, IO_REPARSE_TAG_DFS);
+               } else {
                        unsigned int ea_size = estimate_ea_size(conn, NULL,
                                                                smb_fname);
                        SIVAL(p,0,ea_size); /* Extended attributes */
-                       p += 4;
                }
+               p += 4;
                /* Clear the short name buffer. This is
                 * IMPORTANT as not doing so will trigger
                 * a Win2k client bug. JRA.
@@ -1994,12 +1997,14 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx,
                SOFF_T(p,0,allocation_size); p += 8;
                SIVAL(p,0,mode); p += 4;
                q = p; p += 4; /* q is placeholder for name length. */
-               {
+               if (mode & FILE_ATTRIBUTE_REPARSE_POINT) {
+                       SIVAL(p, 0, IO_REPARSE_TAG_DFS);
+               } else {
                        unsigned int ea_size = estimate_ea_size(conn, NULL,
                                                                smb_fname);
                        SIVAL(p,0,ea_size); /* Extended attributes */
-                       p +=4;
                }
+               p += 4;
                SIVAL(p,0,0); p += 4; /* Unknown - reserved ? */
                SBVAL(p,0,file_index); p += 8;
                len = srvstr_push(base_data, flags2, p,
@@ -2040,12 +2045,14 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx,
                SOFF_T(p,0,allocation_size); p += 8;
                SIVAL(p,0,mode); p += 4;
                q = p; p += 4; /* q is placeholder for name length */
-               {
+               if (mode & FILE_ATTRIBUTE_REPARSE_POINT) {
+                       SIVAL(p, 0, IO_REPARSE_TAG_DFS);
+               } else {
                        unsigned int ea_size = estimate_ea_size(conn, NULL,
                                                                smb_fname);
                        SIVAL(p,0,ea_size); /* Extended attributes */
-                       p +=4;
                }
+               p += 4;
                /* Clear the short name buffer. This is
                 * IMPORTANT as not doing so will trigger
                 * a Win2k client bug. JRA.