Commit Graph

5161 Commits (edge)
 

Author SHA1 Message Date
Jean-Pierre André 84478c4012 Checked attributes layout against length actually used
The end of the attributes must be checked against the space in use
rather than the allocated space. This contributes to the safety of
subsequent attribute resizing.
2021-07-12 08:31:18 +02:00
Jean-Pierre André ec7bf54377 Checked the MFTMirr lcn to be consistent with the boot sector
The lcn of the initial run of the MFTMirr data must be the same as
described in the boot sector. As a consequence this cannot be a hole.
2021-07-12 08:31:18 +02:00
Jean-Pierre André 4e094563d4 Checked $MFT data to be ready before fetching an extent 2021-07-12 08:31:18 +02:00
Jean-Pierre André e2e625065d Checked the layout of attribute list entries
Make sure the attribute list has at least one element, and that each of
them has the minimal size and does not overflow out of the end of list.
2021-07-12 08:31:17 +02:00
Jean-Pierre André 4e09b252af Checked name limits while looking up for an external attribute
Make sure the name of an attribute does not overflow beyond the
attribute length.
2021-07-12 08:31:17 +02:00
Jean-Pierre André f3999a74c6 Fixed consistency check of MFT attributes in ntfsfix
The consistency check could be defeated as a consequence of integer overflow.
Reorganize it to avoid such situations.
2021-07-12 08:31:17 +02:00
Jean-Pierre André fc295da55e Configured for version 2021.5.19 2021-05-19 15:18:56 +02:00
Jean-Pierre André a4177d625c Made sure an error code is issued for failed mounts
In case of failure to mount a file system, an error code is expected to
indicate the failure reason. In an unclear case the error code was not
set, so force an EIO when this happens.
2021-05-17 15:42:31 +03:00
Jean-Pierre André d86c34390d Added a consistency check of attribute size in readall()
Make sure the attribute designated to readall() has a reasonable size.
Apart from a bitmap, in a valid call, the attribute size is limited to
65536, and bitmaps are limited by the number of cluster.
2021-05-17 15:39:52 +03:00
Jean-Pierre André 37a330ea8c Improved the consistency checks of standard information
Make sure the standard information attribute has a valid size.
2021-05-17 15:39:13 +03:00
Jean-Pierre André 218d93b37b Cleaned the tail of compressed buffer before writing a full cluster
When appending to an existing compressed file, the last block must first
be decompressed. When doing so, clear the tail of buffer in order to not
leak unrelated data.
2021-05-17 15:38:20 +03:00
Jean-Pierre André 02e199978b Fixed initialization of a Posix ACL
A posix ACL record was not fully initialized.
2021-05-17 15:37:45 +03:00
Jean-Pierre André d60175230a Added consistency check of MFT attributes in ntfsfix
Make sure the searched attribute is fully within the MFT record and is
correctly aligned.
2021-05-17 15:36:58 +03:00
Jean-Pierre André 5bdfac9704 Added generic checks of MFT records in ntfsfix
Before acting on MFT, make sure it passes the consistency check.
2021-05-17 15:35:51 +03:00
Jean-Pierre André 8adc9c6184 Hardened consistency checks of MFT records
Check the record is properly aligned and does not flow beyond the
expected end of the record.
2021-05-17 15:35:02 +03:00
Jean-Pierre André bb0168e56b Rejected updates of uninitialized MFTMirr
Reject updating uninitialized MFTMirr because it leads to endless
recursions as updating the MFTMirr entry of MFT implies further updating
MFTMirr.
This is probably specific to ntfsfix, as mounts are normally rejected
when MFTMirr does not match MFT.
2021-05-17 15:33:41 +03:00
Jean-Pierre André 3f3b771cb0 Added consistency checks of index root
The index root must lie within the space allocated for it.
2021-05-17 15:33:04 +03:00
Jean-Pierre André 00a5478625 Added check of layout of attributes
Make sure the attributes fully lie within the MFT record, and make sure
their variable components (name, runlist, value) fully lie within the
attribute.
2021-05-17 15:31:52 +03:00
Jean-Pierre André 1258474e07 Improved check of upcase table length
The consistency check on the upcase size was laxist.
The unicode points are limited to 1048575 (20 bits), but there is no
provision to support code points beyond 65535.
In the current implementation the upcase size must be even and <= 131072.
2021-05-17 15:30:17 +03:00
Erik Larsson a4a837025b Add the official git repository location to the README file. 2021-03-05 14:56:40 +02:00
Erik Larsson 442e12fc32 Update outdated copyright notice. 2021-03-05 14:56:38 +02:00
Erik Larsson e464ca7574 Update last two entries in README to match style of previous entries. 2021-03-05 14:56:36 +02:00
Erik Larsson 83b66b3f39 Change http links in README to https for security. 2021-03-05 14:56:34 +02:00
Erik Larsson 3a53515016 Update README to mention support for Windows 8 and 10 NTFS formats. 2021-03-05 14:56:32 +02:00
Erik Larsson 477a4dfe5e ntfscp.c: Fix improper unsigned const endianness macro for signed type. 2021-03-05 14:56:31 +02:00
Jean-Pierre André 2ede3b67ee Improved checking of the location of MFT
Terminate cleanly when the MFT is improperly located, by making sure it
is located within the volume and that it contains its own data.
2021-03-05 10:21:36 +01:00
Jean-Pierre André e5ee8b325c Signalled support of UTIME_OMIT to external libfuse2
The external libfuse2 optionally uses UTIME_OMIT to tell whether mtime
or ctime should not be changed in a utimensat(2) call. Set the flag
flag_utime_omit_ok so that it knows that ntfs-3g supports this feature.
Note : this is the default with internal libfuse and with libfuse3.
2021-03-05 10:05:24 +01:00
Erik Larsson dd75ea7420 configure.ac: Fix obsolete 2-argument AM_INIT_AUTOMAKE invocation.
The 2-argument form has been replaced with fetching the package/version
information from autoconf (AC_INIT). Instead the 1-argument form takes a
list of automake options but we currently do not need to specify any.
2021-03-03 16:39:45 +02:00
Erik Larsson bcd42e5ef3 configure.ac: Respect 'with_fuse' user setting on non-Linux/Solaris.
Previously the configure script simply disregarded the value of the
'with_fuse' flag on non-Linux/Solaris systems. This is not unreasonable
since the 'internal' option doesn't work on those systems, however in
some situations we want to specify the libfuse CFLAGS/LDFLAGS manually
and bypass the pkg-config check with '--with-fuse=none' and this was not
possible with this logic. So add a special test to bypass the automatic
determination when the user has specified a 'with_fuse' value.
2021-02-26 08:09:18 +02:00
Erik Larsson da1b61ec22 lowntfs-3g.c: Fix compile error when building with libfuse < 2.8.0.
The libfuse function 'fuse_lowlevel_notify_inval_inode' is only
available starting with libfuse 2.8.0 while we advertise compatibility
with FUSE 2.6.0 as the baseline. So add a preprocessor check to exclude
this code from libfuse < 2.8.0.
2021-02-25 17:13:24 +02:00
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