Commit Graph

4815 Commits

Author SHA1 Message Date
Erik Larsson
701cd61cca volume.c: Fix passing bad pointer type to ntfs_is_[baad|mft]_recordp. 2016-01-25 11:31:12 +01:00
Erik Larsson
8aa2769d70 mst.c: Fix mixed native/little-endian usage of variable 'usn'. 2016-01-25 11:30:13 +01:00
Erik Larsson
84f042e739 reparse.c: Fix big-endian bug when converting file name to lowercase.
When looking up the lowercase equivalent of a Unicode character in
ntfs_fix_file_name, no byte swapping was performed on the ntfschar used
as index into the 'locase' array. This would lead to very strange
results on big-endian systems.
2016-01-04 10:19:05 +01:00
Erik Larsson
75da0ce302 Fix inverted usage of endian conversion macros.
This is mostly a semantic issue since the end result would be the same.
2016-01-04 10:08:15 +01:00
Erik Larsson
9cf04fd2cd Fix incorrect usage of native/little-endian types, signed types, etc.
This is harmless with regard to code generation but if we turn on strict
type checking these type mismatches will result in errors.
2015-12-21 23:55:31 +01:00
Erik Larsson
f076fae75a Fix endianness issues in log and terminal output.
This commit addresses issues where little-endian variables are emitted
raw to a log or output stream which is to be interpreted by the user.

Outputting data in non-native endianness can cause confusion for anybody
attempting to debug issues with a file system.
2015-12-21 23:31:09 +01:00
Erik Larsson
dfa4a6647f Fix code to use const_cpu_to_X/const_X_to_cpu macros for constants.
This enables the compiler to optimize this code in cases where compiler
support for endianness swapping is not present.
2015-12-21 23:21:00 +01:00
Erik Larsson
58bb59487c endians.h: Add const endian conversion macros for s{l,b}e{16,32,64}. 2015-12-21 23:05:36 +01:00
Erik Larsson
9191d85e28 Use appropriate little-endian/big-endian types in struct definitions.
On-disk struct definitions used native types (u16/u32/u64/s16/s32/s64),
which doesn't say anything about the intended interpretation of the
data. The intention of having little-endian-specific types and
big-endian-specific types must have been to clarify interpretation of
data and intentions in the code. Therefore it seems reasonable to use
these types in struct definitions to clarify what data represention is
used to encode field data.

Because some struct members in layout.h are big-endian, this change also
means moving the duplicated definitions for big-endian byteswapping
macros and big-endian types found in acls.h and security.h to the
appropriate locations in endians.h and types.h respectively in order to
make them available for the struct definitions in layout.h.
2015-10-03 12:58:08 +02:00
Erik Larsson
deeb0ad584 Version 2015.3.14. 2015-03-14 12:49:43 +01:00
Erik Larsson
807ee0f26c Enable ioctl in ntfs-3g unconditionally when building with fuse-lite.
fuse-lite announces a FUSE_VERSION which may not always match the exact
capabilities of the library. Hence we add a special case for 'ioctl',
which we know exists in fuse-lite regardless of the version number
published.
2015-03-14 11:11:43 +01:00
Erik Larsson
1ebf77f769 Fix improper #ifdef conditions around FUSE_CAP_IOCTL_DIR.
The capability actually appeared in FUSE 2.9, not 2.8. However in order
to maintain similarity to earlier #ifdef:s, we simpy check if
FUSE_CAP_IOCTL_DIR is defined rather than checking the FUSE version.
2015-03-14 06:53:31 +01:00
Erik Larsson
d0cb2ea735 Version 2015.3.13. 2015-03-13 15:04:43 +01:00
Erik Larsson
b970c69c02 usermap.c: Fix uninitialized variable warning in main.
If platform was non-Win32 and open_security_api() failed, the variable
'ok' would end up being uninitialized.
2015-03-13 09:06:17 +01:00
Erik Larsson
36f4957587 lowntfs-3g.c: Fix uninitialized variable warning in ntfs_fuse_getxattr.
The variable 'res' was never initialized if the #ifdef condition
'!KERNELPERMS | (POSIXACLS & !KERNELACLS)' evaluated to true and there
was an error allocating memory for 'value'.
2015-03-13 09:02:38 +01:00
Erik Larsson
82bb43eed3 ntfsclone.c: Compile fix for OS X.
OS X keeps the statfs declarations in sys/mount.h.
2015-03-13 08:59:20 +01:00
Erik Larsson
3f5d881a70 Compile fix for FUSE versions earlier than 2.8.0. 2015-03-13 08:57:38 +01:00
Jean-Pierre André
b275f41cd8 Set release version 2015.3.5 2015-03-05 18:47:06 +01:00
Jean-Pierre André
b2709f60ac Updated the copyright on the drivers to 2015 2015-03-05 18:25:17 +01:00
Jean-Pierre André
0101407feb Made to ignore the -s ("sloppy") mount option
autofs passes the sloppy option to mount(8) for all file systems to mean
that mount should not choke on invalid options such as those meant for
remote mounting on another operating system through nfs or cifs.
Following a recent change, mount(8) passes the -s option on to any file
system, even to local ones (which are not expected to get foreign options),
so ntfs-3g now has to ignore -s.
2015-01-22 08:42:43 +01:00
Jean-Pierre André
39c7d8538d Set the fuse protocol fall back to 7.12 when available
The support for ioctls has been added to fuse when using protocol 7.18,
and an equivalent upgrade has been done in fuse lite with commit [ae9aee].
For old kernels, a fall back to protocol 7.8 was implemented, but this
appears not to be supported in not-so-old kernels (e.g. 2.6.35).
With this patch, the fall back protocol is set to 7.12 or to the highest
level supported by the kernel.
2014-11-10 08:52:23 +01:00
Jean-Pierre André
3a8d923c13 Fixed accessing security attributes the old way on ntfs 3.x
When the security attribute is present, chkdsk may set a null security id
in the standard attributes, and this should not be considered as an error.
(this partially reverts commit [70e5b1])
2014-11-10 08:43:32 +01:00
Jean-Pierre André
3bfff8ea3f Fixed reading the MFT bitmap when expanding downward
When expanding downward the MFT bitmap was wrongly read when fragmented,
leading to inconsistencies and cancellation of the process.
2014-10-20 08:58:04 +02:00
Jean-Pierre André
e1d2b7faa7 Silenced a const qualifier dropping (cosmetic) 2014-09-02 10:03:23 +02:00
Jean-Pierre André
a7aa91d73d Developped an option --unused-fast for faster ntfswipe
When the new option --unused-fast is used, clusters which appear as wiped
are not written again. This is useful for avoiding virtual partitions to
be extended to their full size.

Contributed by michael
2014-09-02 09:55:53 +02:00
Jean-Pierre André
c358191f91 Disabled option remove_hiberfile on read-only mounts
The mount options remove_hiberfile and read-only are contradictory.
When both are mentioned, ignore remove_hiberfile.
2014-09-02 09:50:27 +02:00
Jean-Pierre André
b6152757c5 Reengineered the compression algorithm
This patch changes the algorithm to use hash chains instead of binary
trees, with much stronger hashing.  It also introduces useful (for
performance) parameters, such as the "nice match length" and "maximum
search depth", that are similar to those used in other commonly used
compression algorithms such as zlib's DEFLATE implementation.

The speed improvement is very significant, with some loss of compression
rate. The compression rate is still better than then Windows one.

Contributed by Eric Biggers
2014-09-02 09:45:16 +02:00
Jean-Pierre André
54833dffc0 Inserted missing ea.h and ioctl.h in devel file list
ea.h and ioctl.h were not mentioned in include/ntfs-3g/Makefile.am
so they were not released as public headers in devel files.
2014-09-02 09:39:12 +02:00
Jean-Pierre André
c26a519da1 Fixed fstrim(8) applied to partitions
The new way goes via /sys/dev/block/MAJOR:MINOR to map partitions to
devices and get discard parameters of the parent device. It also ensures
that the partition is aligned to the discard block size.

Contributed by Richard W.M. Jones
2014-08-04 17:39:50 +02:00
Jean-Pierre André
f4e3f126df Implemented fstrim(8)
fstrim(8) discards unused blocks on a mounted filesystem. It is useful for
solid-state drives (SSDs) and thinly-provisioned storage.
Only trimming the full device (with no option) is supported.

Contributed by Richard W.M. Jones
2014-07-31 14:03:11 +02:00
Jean-Pierre André
ae9aeebbbf Upgraded fuse-lite to support ioctls
This is backporting code from the full FUSE library in order to support
ioctls. The fuse protocol level negociated is now 7.18 instead of 7.8.
A fallback protocol to 7.8 is provided for compatibility with older kernels.

32-bit ioctls are not supported by a 64-bit library
2014-07-30 16:44:18 +02:00
Jean-Pierre André
9325fa3ca6 Enabled new manual entries for ntfsprogs utilities
There were no manual entries so far for ntfswipe, ntfsdecrypt, ntfstruncate
and ntfsfallocate.
2014-06-25 12:50:45 +02:00
Jean-Pierre André
5d5d9f5b98 Added a manual entry for ntfsfallocate 2014-06-25 12:48:35 +02:00
Jean-Pierre André
fbf18a2953 Added a manual entry for ntfstruncate 2014-06-25 12:47:33 +02:00
Jean-Pierre André
781c97cb76 Added a manual entry for ntfsdecrypt 2014-06-25 12:46:36 +02:00
Jean-Pierre André
a42b52ea61 Added a manual entry for ntfswipe 2014-06-25 12:45:15 +02:00
Jean-Pierre André
935ce8d08b Fixed inappropriate description of ntfs_build_basic_posix() (cosmetic)
Fixed a missing description and wrongly copied+pasted comment
2014-06-23 11:46:58 +02:00
Jean-Pierre André
ab8f021861 Fixed checking permissions when Posix ACLs are compiled in but not enabled
When the Posix ACLs are not enabled in the mount options, the permission
checks should not take into account the extra owners and groups of the
file.
2014-06-23 11:26:00 +02:00
Jean-Pierre André
bfc5f3dd3d Fixed processing umask when Posix ACLs are compiled in but not enabled
When Posix ACLs are used, the umask is ignored and the initial permissions
of created files are taken for the parent directory. However the umask
should still be used when the Posix ACLs are not enabled in the mount
options.
2014-06-23 11:20:21 +02:00
Jean-Pierre André
22ecedb996 Fixed a wrong function header in usermap
A wrong header was defined for ntfs_initialize_file_security()
2014-06-23 11:16:02 +02:00
Jean-Pierre André
973949964c Fixed ownership of files created by root with no user mapping
Ownership of files should always represent the creator of files.
This fixes a situation, currently disabled, where there is no user
mapping and the owner of the parent directory is used as the owner
of the created file.
2014-06-23 11:11:07 +02:00
Jean-Pierre André
ae4a797473 Disabled the default user mapping when Windows inheritance is used
Windows-type inheritance is meaningful only when used with user
identifications known to Windows, so avoid using default ones.
2014-06-23 10:59:38 +02:00
Jean-Pierre André
19d71c6c9e Fixed apparent const violation in secaudit.c for Windows (cosmetic)
The prototype for SetFileSecurityW() does not exhibit a const attribute
for the second attribute, thus triggering a compiler warning.
This warning can be silenced by copying the argument.
2014-06-23 10:53:23 +02:00
Jean-Pierre André
952917bccf Fixed const violation in win32_io.c (cosmetic)
Fixed the read-modify-write procedure to be compatible with the
write-only one to avoid violating the "const" attibute of the latter.
2014-06-23 10:46:31 +02:00
Jean-Pierre André
276c6ec661 Showed Windows ownership in secaudit with verbose option
The Windows ownership can now be displayed without using the "very
verbose" option, and when used on Windows the login name is displayed.
2014-06-23 10:41:39 +02:00
Jean-Pierre André
21f6d9d0a3 Included ntfsfallocate in the quarantined ntfsprogs
ntfsfallocate is the equivalent of fallocate(1) :
Usage : ntfsfallocate [-n] [-p] [-o offset] -l length filename
For now, it is only released as a quarantined ntfsprogs because it can
produce configurations which cause subsequent updates of the file by
Windows to hang.
2014-06-23 10:33:22 +02:00
Jean-Pierre André
6abf81721c Defined the configure option --enable-quarantined for non functional utilities
Distributions have complained about releasing a non-functional ntfsck.
Actually, ntfsck and a few other developer-oriented utilities were not
meant to be released by distributions and are only compiled in if the
configure option --enable-extra is set, and, for some reason, this
option is set by most distributions.

In order to get distributions to not complain, though making the source
code available for candidate developers to improve it, the non functional
or developer-oriented utilities (ntfsck, ntfsdump_logfile, ntfsmftalloc
and ntfsmove) are now only compiled in if the configure option
--enable-quarantined is set.
2014-06-23 10:15:24 +02:00
Jean-Pierre André
37862daf83 Fixed getting inherited security ids from cache
When using Windows inheritance, the cacheing of ACLs for files created
within a directory only depended on the directory. Actually it also
depends on the user who creates the file. With the patch, only the ACLs
created by the owner of the directory are cached.
2014-05-22 09:52:42 +02:00
Jean-Pierre André
0ccd90f2fb Fixed ignoring the umask mount option when permissions are used
When permissions are used, umask(2) is supposed to be active and the
umask mount option is supposed to be ignored, but it was still wrongly
applied. This caused permission restrictions when an external disk was
automatically mounted with standard options.
2014-05-22 09:45:46 +02:00
Jean-Pierre André
e8c43f434b Fixed checking static groups against process owner
When grouping of users are determined from /etc/group (a compile-time
option not currently used), the groups examined for checking access rights
to a file were wrongly derived from the uid of the file instead of the
uid of the current process.
2014-05-22 09:38:47 +02:00