]> Pileus Git - ~andy/linux/blobdiff - fs/cifs/smb1ops.c
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[~andy/linux] / fs / cifs / smb1ops.c
index 384cffe42850cdbdb4365e0ff6d6e8eb1a1fbb87..5f5ba0dc2ee1b9c7b3d26ede9590a185ac6925e0 100644 (file)
@@ -534,10 +534,12 @@ cifs_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
 static int
 cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
                     struct cifs_sb_info *cifs_sb, const char *full_path,
-                    FILE_ALL_INFO *data, bool *adjustTZ)
+                    FILE_ALL_INFO *data, bool *adjustTZ, bool *symlink)
 {
        int rc;
 
+       *symlink = false;
+
        /* could do find first instead but this returns more info */
        rc = CIFSSMBQPathInfo(xid, tcon, full_path, data, 0 /* not legacy */,
                              cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
@@ -554,6 +556,23 @@ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                *adjustTZ = true;
        }
+
+       if (!rc && (le32_to_cpu(data->Attributes) & ATTR_REPARSE)) {
+               int tmprc;
+               int oplock = 0;
+               __u16 netfid;
+
+               /* Need to check if this is a symbolic link or not */
+               tmprc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN,
+                                   FILE_READ_ATTRIBUTES, 0, &netfid, &oplock,
+                                   NULL, cifs_sb->local_nls,
+                       cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
+               if (tmprc == -EOPNOTSUPP)
+                       *symlink = true;
+               else
+                       CIFSSMBClose(xid, tcon, netfid);
+       }
+
        return rc;
 }