diff --git a/libntfs-3g/reparse.c b/libntfs-3g/reparse.c index 538e5d9d..a2463560 100644 --- a/libntfs-3g/reparse.c +++ b/libntfs-3g/reparse.c @@ -115,6 +115,7 @@ static u64 ntfs_fix_file_name(ntfs_inode *dir_ni, ntfschar *uname, u64 mref; le64 lemref; int lkup; + int olderrno; int i; FILE_NAME_ATTR *found; struct { @@ -132,7 +133,10 @@ static u64 ntfs_fix_file_name(ntfs_inode *dir_ni, ntfschar *uname, find.attr.file_name[i] = vol->upcase[uname[i]]; else find.attr.file_name[i] = uname[i]; + olderrno = errno; lkup = ntfs_index_lookup(&find, uname_len, icx); + if (errno == ENOENT) + errno = olderrno; found = (FILE_NAME_ATTR*)icx->data; /* * We generally only get the first matching candidate, @@ -397,6 +401,11 @@ char *ntfs_junction_point(ntfs_volume *vol, const char *org_path, reparse_attr = (REPARSE_POINT*)ntfs_attr_readall(ni, AT_REPARSE_POINT,(ntfschar*)NULL, 0, &attr_size); if (reparse_attr && attr_size) { + /* + * reparse_tag 0xa000000c has been found for + * \Users\All Users + * (not supported until properly understood) + */ if (reparse_attr->reparse_tag == IO_REPARSE_TAG_MOUNT_POINT) { path_data = (struct SYMLNK_REPARSE_DATA*)reparse_attr->reparse_data; offs = le16_to_cpu(path_data->subst_name_offset); diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index ca602831..a0392228 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -578,25 +578,32 @@ static int ntfs_fuse_readlink(const char *org_path, char *buf, size_t buf_size) if (!ni) { res = -errno; goto exit; + } + /* + * Directory and reparse point : analyze as a + * junction point + */ + if ((ni->flags & FILE_ATTR_REPARSE_POINT) + && (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)) { + char *target; + int attr_size; + + errno = 0; + res = 0; + target = ntfs_junction_point(ctx->vol,org_path, ni, &attr_size); + if (target) { + strncpy(buf,target,buf_size); + free(target); + } else + if (errno == EOPNOTSUPP) + strcpy(buf,ntfs_bad_reparse); + else + res = -errno; + goto exit; } /* Sanity checks. */ if (!(ni->flags & FILE_ATTR_SYSTEM)) { - if (ni->flags & FILE_ATTR_REPARSE_POINT) { - char *target; - int attr_size; - - errno = 0; - target = ntfs_junction_point(ctx->vol,org_path, ni, &attr_size); - if (target) { - strncpy(buf,target,buf_size); - free(target); - } else - if (errno == EOPNOTSUPP) - strcpy(buf,ntfs_bad_reparse); - else - res = -errno; - } else - res = -EINVAL; + res = -EINVAL; goto exit; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0);