Sync'ing SAMBA_2_2 with HEAD.
[tprouty/samba.git] / source / smbd / trans2.c
index b46d1e930c3f5b36cf2e6ddbd33822a4d6a86ab3..77cd43f04f9d239f8bf9852afa996e3c35649906 100644 (file)
@@ -508,16 +508,23 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
                                        continue;
                                }
                        } else if (vfs_stat(conn,pathreal,&sbuf) != 0) {
-                               /* Needed to show the msdfs symlinks as directories */
-                               if(!lp_host_msdfs() || !lp_msdfs_root(SNUM(conn)) 
-                                               || !is_msdfs_link(conn, pathreal)) {
+
+                               /* Needed to show the msdfs symlinks as 
+                                * directories */
+
+                               if(lp_host_msdfs() && 
+                                  lp_msdfs_root(SNUM(conn)) &&
+                                  is_msdfs_link(conn, pathreal, NULL, NULL,
+                                                &sbuf)) {
+
+                                       DEBUG(5,("get_lanman2_dir_entry: Masquerading msdfs link %s as a directory\n", pathreal));
+                                       sbuf.st_mode = (sbuf.st_mode & 0xFFF) | S_IFDIR;
+
+                               } else {
+
                                        DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",
-                                                       pathreal,strerror(errno)));
+                                               pathreal,strerror(errno)));
                                        continue;
-                               } else {
-                                       DEBUG(5,("get_lanman2_dir_entry: Masquerading msdfs link %s as a directory\n",
-                                                       pathreal));
-                                       sbuf.st_mode = (sbuf.st_mode & 0xFFF) | S_IFDIR;
                                }
                        }