Commit Graph

5081 Commits

Author SHA1 Message Date
Jean-Pierre André
56b8e713d5 Fixed a constant string concatenation
Adjust for recent compilers requiring a space between concatenated strings.
2021-01-26 10:06:18 +01:00
Jean-Pierre André
094f9b3f2d Fixed a minor endianness ajustment bug
The endianness ajustment was the wrong one though it did the correct thing.
2021-01-26 10:06:18 +01:00
Jean-Pierre André
894b7dd36e Checked the locations of MFT and MFTMirr at startup
On startup make sure the lcns of the MFT and the MFTMirr are not null and
they are different, so that the mounting is denied gracefully if they are.
2021-01-26 10:06:18 +01:00
Jean-Pierre André
5d46b32b91 Enabled Recording the special files the same way as WSL
Optionally record the special files (symlinks, fifos, sockets, character
and block devices) using reparse points instead of using Interix representation.
Doing so, the special files are interoperable with Windows Subsystem for
linux (WSL).
2021-01-26 10:06:18 +01:00
Jean-Pierre André
172da09947 Dropped rejecting having both EA and reparse data
Windows traditionally rejected having both EA and reparse data assigned
to a file, but Windows 10 has dropped the constraint and it uses this
condition massively, so do the same. Note that pre-Windows 10 chkdsk.exe
removes the EA' on reparse points, potentially damaging more recent
volumes.
2021-01-26 10:06:17 +01:00
Jean-Pierre André
8073ab6764 Supported use of WSL special file
The Windows Subsystem for Linux (WSL) of Windows 10 uses reparse points
to record special files (symlinks, fifos, sockets, char or block devices).
Honor such reparse points with the same meaning as WSL.
2021-01-26 10:06:17 +01:00
Jean-Pierre André
a67746c8a8 Relocated the mount point field in volume
The location of the mount point field in the volume attributes was
dependent on compiling options, thus creating an uneasy dependency
for plugins. So relocate the field to be independent on options.
2021-01-26 10:06:17 +01:00
Jean-Pierre André
8fa3dd3f22 Defined ntfs_realloc() and ntfs_free()
Currently memory allocations are done through ntfs_malloc() and
ntfs_calloc(), but releases are done through free(3). Defining an
ntfs_free() relay facilitates the debugging of memory leaks in
plugins.
2021-01-26 10:06:17 +01:00
Jean-Pierre André
76fe04d03d Built reparse symlinks from mount point recorded in volume
When building a symlink to emulate a Windows junction or absolute
symlink, use the mount point recorded in the volume attributes.
This enables the plugins to emulate object as symlinks.
2021-01-26 10:06:17 +01:00
Jean-Pierre André
c3c5c77be3 Checked file type on OpenIndiana when deleting a file with a reparse point
On OpenIndiana a check is needed to ensure directories are not removed
by rm(1) and files not removed by rmdir(1)
2021-01-26 10:06:17 +01:00
Jean-Pierre André
b086c9ef73 Inserted the reparse tag in the bad reparse symlink
The reparse tag is not quoted in the "unsupported reparse point"
fake symlink shown when a reparse point cannot be processed. The tag
is useful to determine which plugin, if any, is missing.
2021-01-26 10:06:17 +01:00
Jean-Pierre André
02673bd04a Enabled actions on directories in reparse plugins
The plugins triggered by reparse points can now act on a directory
through link(2) unlink(2) and creat(2).
2021-01-26 10:06:17 +01:00
Jean-Pierre André
4b8a660006 Fixed maintining the allocated size when updating sparse files
When filling a hole in a sparse file, the beginning of the runlist
does not need to be updated. However the allocated size is within
the extent holding its beginning and it needs to be updated.
2020-11-18 11:33:49 +01:00
Jean-Pierre André
7bcae8743f Allowed customization of sbin for tool directory
Enabled the configure option --sbindir to define where a few ntfsprogs
tools should be installed
2020-11-18 11:29:05 +01:00
Erik Larsson
903db231ec Change default xattr access method to 'openxattr' for macOS builds.
The namespaced way of accessing extended attributes doesn't make sense
in macOS which doesn't use namespaces.
2020-08-25 11:29:42 +03:00
Erik Larsson
1511a5ca51 Add support for 'position' argument in macOS xattr functions.
The 'position' argument is only used for the legacy resource fork and is
disallowed for other extended attributes. The name check is placed first
in the functions as this is how macOS behaves (EINVAL is returned if the
attribute is not the resource fork attribute and the position is non-0
even when the attribute does not exist).
2020-08-25 11:26:29 +03:00
Erik Larsson
4ecc13c0ac Replace ENODATA with ENOATTR in xattrs functions for macOS builds.
The contract in macOS xattr functions is to return ENOATTR when an
extended attribute cannot be found.
2020-08-24 16:50:18 +03:00
Jean-Pierre André
39579a045d Fixed possible null dereferencings
A null directory pointer could appear as being dereferenced. Fix that,
though it probably never occurs in real conditions.
2020-08-14 12:03:09 +02:00
Jean-Pierre André
cd68a084fc Recovered space when an index root is shortened
In rare situations, removing an entry from an index root while
rebalancing the index tree, its space was not recovered from the index
root, causing chkdsk to complain. Truncate the index root when this
happens.
2020-08-14 11:57:02 +02:00
Jean-Pierre André
d6558f1dea Defined option "posix_nlink" to compute a Posix compliant st_nlink
When the mount option "posix_nlink" is used, the number of links
returned by stat complies with Posix : the legacy 8.3 names are not
taken into account, and the subdirectories are taken into account
for directories. This causes some overhead for recomputing the
number of links.
2020-08-14 11:50:35 +02:00
Jean-Pierre André
1bc996f52f Avoided information leak when processing garbled compressed data
When a compressed file has been deteriorated through hardware error
or accidental overwriting, some unrelated data could be leaked.
Make sure to zero fill the buffer when this happens.
2020-08-14 11:36:57 +02:00
Jean-Pierre André
6bdd1e85ac Displayed the plugin path in the basic help message
The ntfs-3g plugin directory depends on the distribution and may be
difficult to determine. This displays the directory in the basic help.
2020-08-14 11:32:50 +02:00
Jean-Pierre André
5d6fd5c2d2 Used kernel cacheing on read-only mounts or with lowntfs-3g
Kernel cacheing is now safe when using lowntfs-3g on Linux. It is also
safe on read-only mounts with both ntfs-3g and lowntfs-3g.
2020-08-14 11:27:24 +02:00
Jean-Pierre André
4163390f2b Fixed defining the request argument of ioctl()
An occurrence of changing the request from int to unsigned long was
missing.
2020-03-08 10:34:17 +01:00
Jean-Pierre André
3f65ccd949 Exported the translations of Windows paths
The translations of Windows paths designed for translating Windows symlinks
and mount points may also be used in plugins for translation execlinks,
so make them available.
2020-03-08 10:17:21 +01:00
Jean-Pierre André
7cd46f95df Fixed object types returned in readdir() for reparse points
The types of reparse point objects cannot be decided upon the data
available in a directory, so we must delegate their determination to a
specific plugin when available, and be consistent if there is none.
2020-03-08 10:03:23 +01:00
Jean-Pierre André
aecd9f011e Decoded execlink reparse data
Add execlink to the list of recognized reparse tags.
2020-03-08 09:57:27 +01:00
Jean-Pierre André
4c8d97cbd2 Fixed ntfsfallocate on a void file
The situation when there were no runlist when ntfsfallocate is applied
was not taken into account.
2020-03-08 09:51:48 +01:00
Jean-Pierre André
eddd96f9e6 Fixed a poorly sized string in ntfsinfo
A string overflow was possible, extend its size to worst case.
2020-03-08 09:44:52 +01:00
Jean-Pierre André
8e01e1ed65 Fixed a wrong fallthrough situation in ntfscat
A fallthrough situation was not intentional.
2020-03-08 09:42:15 +01:00
Jean-Pierre André
004709fcc1 Silenced warnings about fallthrough situations in switch cases of ntfsprogs
Insert comments to silence compiler about fallthrough situations when
they are wanted.
2020-03-08 09:38:00 +01:00
Jean-Pierre André
b68c27ea74 Silenced warnings about string lengths in snprintf()
Adjust string lengths to the worst case estimated by the compiler, even
though they cannot be reached.
2020-03-08 09:29:04 +01:00
Jean-Pierre André
c5530af508 Silenced warnings about fallthrough situations in libntfs-3g
Insert a comment when fallthrough situations are desired in switch cases.
2020-03-07 12:00:11 +01:00
Jean-Pierre André
ef61c82529 Avoided using a truncate strncpy() in the fuse library
Replace strncpy() by memcpy() when the exact size if known, thus
silencing the compiler warnings.
2020-03-07 11:56:46 +01:00
Jean-Pierre André
688578c1a6 Removed <linux/fs.h> from lowntfs-3g.c
The headers from <linux.fs.h> now conflicts with <sys/uio.h> and are
not needed any more, so remove them.
2020-03-07 11:50:26 +01:00
Jean-Pierre André
39384c8a1b Disabled the use of cache in lowntfs-3g
Following some change in the Linux kernel, the kernel cacheing of
attributes is not satisfactory (at least the number of hard links is
not refreshed), and has to be disabled.
2020-03-07 11:43:49 +01:00
Jean-Pierre André
aa7af7d53b Fixed returning EPERM when not allowed as owner
For actions which may be allowed depending on the ownership rather than
permissions (such as utime()), return EPERM if the owner cannot be
determined.
2020-03-07 11:35:48 +01:00
Jean-Pierre André
314b5396bd Fixed returning errno in setxattr
In case of error in setxattr, it must be returned in errno instead
of the return value.
2020-03-07 10:51:53 +01:00
Jean-Pierre André
2c6472ee5a Accepted alternative recording of cluster size
Since Windows 10, the cluster size may be greater than 128 sectors, and
it has to be recorded as a power of 2 in the boot sector. Hence there
are two possible ways of cluster size. Accept both ways leading to
valid values.
2020-03-07 10:43:00 +01:00
Jean-Pierre André
32c27a8a4f Defined the request argument of ioctl() as unsigned long
On linux the request argument of ioctl() is defined as an unsigned long,
but the fuse protocol squashes it into a signed int. As a consequence
the value received by ntfs-3g may appear as negative and different from
the value defined by the corresponding macro.
So define the request argument as unsigned long in ntfs-3g. It has
however to be fed as unsigned from fuse until the fuse protocol is
updated.
2020-03-07 10:31:12 +01:00
Jean-Pierre André
3433dd0b3c Updated the copyright notice
Updated the copyright notice to 2019
2020-03-07 10:18:01 +01:00
Jean-Pierre André
b9ad82ced7 Truncated SSD trimming zones to granularity supported by the device
When the trimming granularity is greater than the cluster size, the
free zones have to be truncated to match the granularity.
2019-01-23 17:43:47 +01:00
Jean-Pierre André
1ae6d818f0 Returned a low level error when an ioctl fails
When an ioctl fails, the errno is not correctly propagated, and the
log was wrong.
2019-01-23 17:40:23 +01:00
Jean-Pierre André
006799ab80 Fixed an endianness error in ntfscp
The file timestamp was not set according to CPU endianness.
2019-01-23 17:38:10 +01:00
Jean-Pierre André
facb697303 Fixed reacting to missing plugin
When a plugin is missing, dlopen() does not set errno, which leads
to erratic behavior. Set errno as ELIBACC when this occurs.
2019-01-23 17:33:15 +01:00
Jean-Pierre André
96825f3c2b Cleaned object ids beyond the updated part
An earlier patch enabled updating a file proper id without changing
the other id (birth, volume, domain). However the first time the id
is set, these other ids have to be zeroed.
2019-01-23 17:27:25 +01:00
Jean-Pierre André
7a3ed93463 Reverted accessing reparse directories through internal plugins
As similar reparse tags are being used for accessing OneDrive files
and directories, a similar policy has to be used for accessing them.
Until giving full access to OneDrive files with a local copy is
mature enough to have it processed internally, it is safer to have
it delegated to an external plugin. This reverts [4f450a]
2019-01-23 17:13:12 +01:00
Jean-Pierre André
da39fbf24a Fixed reporting an error when setxattr is rejected
When permissions are enabled and setxattr() is rejected, an error
must be returned even though the option silent is set. This is needed
for "cp -p" to know it has to try setting the permissions again and use
chmod().
2018-12-19 16:01:53 +01:00
Jean-Pierre André
85c1634a26 Fixed reporting an error when failed to build the mountpoint
The size check was inefficient because getcwd() uses an unsigned int
argument.
2018-12-19 15:57:50 +01:00
Jean-Pierre André
f424cea20a Fixed a typo in the ntfscluster manual
An essential word was missing.
2018-12-19 15:53:08 +01:00