OSDN Git Service

android-x86/external-ntfs-3g.git
7 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into marshmallow-x86 marshmallow-x86 android-x86-6.0-r3
Chih-Wei Huang [Thu, 23 Mar 2017 13:16:19 +0000 (21:16 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into marshmallow-x86

7 years agoVersion 2017.3.23
Jean-Pierre André [Thu, 23 Mar 2017 09:39:59 +0000 (10:39 +0100)]
Version 2017.3.23

7 years agoFixed computing the replacement bytes in ntfswipe
Jean-Pierre André [Wed, 22 Mar 2017 16:49:40 +0000 (17:49 +0100)]
Fixed computing the replacement bytes in ntfswipe

The computing of replacement bytes for overwriting undeletable files
uses random values and standard ones instead of the values provided in
option --bytes. Fix the mixup between both logics, mention the difference
in the documentation and reject defining both options --bytes and --undel.

7 years agontfsusermap.c: Fix warning about implicit conversion between enums.
Erik Larsson [Tue, 21 Mar 2017 11:06:04 +0000 (12:06 +0100)]
ntfsusermap.c: Fix warning about implicit conversion between enums.

7 years agoFix bad native->little endian byteswap of little endian value.
Erik Larsson [Tue, 21 Mar 2017 10:58:30 +0000 (11:58 +0100)]
Fix bad native->little endian byteswap of little endian value.

7 years agoUse signed endian conversion macros for signed little-endian members.
Erik Larsson [Tue, 21 Mar 2017 10:55:41 +0000 (11:55 +0100)]
Use signed endian conversion macros for signed little-endian members.

7 years agoRemoved the loader from boot image
Jean-Pierre André [Sat, 18 Mar 2017 14:42:00 +0000 (15:42 +0100)]
Removed the loader from boot image

The license for using the boot loader which used to be inserted by mkntfs
is unclear, so remove it, and only keep the boot sector restricted to
what is needed for having it recognized as such. The space for a loader
is still reserved so that an operating system being installed can insert
its own loader.

7 years agoVersion 2017.2.15
Jean-Pierre André [Wed, 15 Feb 2017 16:04:57 +0000 (17:04 +0100)]
Version 2017.2.15

7 years agoLoaded the fuse kernel module with no environment
Jean-Pierre André [Sat, 11 Feb 2017 10:03:02 +0000 (11:03 +0100)]
Loaded the fuse kernel module with no environment

Avoided leaking the current environment when loading the fuse kernel
module

7 years agoFixed expanding $STANDARD_INFORMATION with almost-full MFT record
Jean-Pierre André [Sat, 11 Feb 2017 09:58:46 +0000 (10:58 +0100)]
Fixed expanding $STANDARD_INFORMATION with almost-full MFT record

When setting a security descriptor on an NTFS v1.2 format file in an
NTFS v3.0+ volume, NTFS-3G would migrate $STANDARD_INFORMATION to the
new format, which requires extending its size from 48 to 72 bytes.  If
this happened while the file's MFT record was almost full, and none of
the file's attributes could be made non-resident, and the file did not
have an attribute list attribute, then the operation would unexpectedly
fail with ENOENT.  Fix this by adding an attribute list to the file in
this situation.

(contributed by Eric Biggers)

7 years agoAllowed names with trailing dot or space on conditions
Jean-Pierre André [Sat, 11 Feb 2017 09:54:51 +0000 (10:54 +0100)]
Allowed names with trailing dot or space on conditions

Windows places filenames with a trailing dot or space in the Win32
namespace and allows setting DOS names on such files.  This is true even
though on Windows such filenames can only be created and accessed using
WinNT-style paths and will confuse most Windows software.  Regardless,
because libntfs-3g did not allow setting DOS names on such files, in
some cases it was impossible to correctly restore, using libntfs-3g, a
directory structure that was created under Windows.

Update ntfs_set_ntfs_dos_name() to permit operating on a file that has a
long name with a trailing dot or space.  But continue to forbid creating
such names on a filesystem FUSE-mounted with the windows_name option.
Additionally, continue to forbid a trailing a dot or space in DOS names;
this matches the Windows behavior.

(contributed by Eric Biggers)

7 years agoFixed setting opening contexts for plugins
Jean-Pierre André [Sat, 11 Feb 2017 09:44:02 +0000 (10:44 +0100)]
Fixed setting opening contexts for plugins

The opening context was incorrectly passed to plugins by lowntfs-3g

(contributed by Eric Biggers)

7 years agoAccepted displaying bad security descriptors on conditions
Jean-Pierre André [Sat, 11 Feb 2017 09:37:47 +0000 (10:37 +0100)]
Accepted displaying bad security descriptors on conditions

Display security descriptors in ntfssecaudit when they appear as
correctly formed, even when they contain unsupported items.

7 years agoFixed memory leak when failing to lookup an index
Jean-Pierre André [Sat, 11 Feb 2017 09:29:39 +0000 (10:29 +0100)]
Fixed memory leak when failing to lookup an index

When an index could not be used, the search context was not freed

7 years agoGot ready for Posix ACL support in fuse kernel
Jean-Pierre André [Sat, 11 Feb 2017 09:21:07 +0000 (10:21 +0100)]
Got ready for Posix ACL support in fuse kernel

Following a recent patch to the fuse kernel, the Posix ACL checks can
be done within the kernel instead of having to be done in the file
system, provided lowntfs-3g is used.

This mode is still not used by default until the fuse patch is
released by distributions.

7 years agoRemoved unused argument from ntfs_make_symlink()
Jean-Pierre André [Sat, 11 Feb 2017 09:11:01 +0000 (10:11 +0100)]
Removed unused argument from ntfs_make_symlink()

Now that the size of the reparse point attribute is no longer used by
the FUSE drivers to populate st_size for symlinks and junctions, it no
longer needs to be returned by ntfs_make_symlink().

(contributed by Eric Biggers)

7 years agoReturned the size of locale encoded target as the size of symlinks
Jean-Pierre André [Sat, 11 Feb 2017 09:04:15 +0000 (10:04 +0100)]
Returned the size of locale encoded target as the size of symlinks

Made ntfs-3f conform to the standard POSIX convention of setting st_size
to the length of the symlink target without a terminating null.

(contributed by Eric Biggers)

7 years agoValidated minimum size of mountpoint/symlink reparse points
Jean-Pierre André [Sat, 11 Feb 2017 09:00:34 +0000 (10:00 +0100)]
Validated minimum size of mountpoint/symlink reparse points

valid_reparse_data() would read past the end of the reparse point buffer
if it was passed a malformed reparse point that had the tag for a
mountpoint or a symlink but had a data buffer smaller than expected.
Fix this by validating the buffer size.

(contributed by Eric Biggers)

7 years agoEliminated unnecessary strlen() in ntfs_get_ntfs_dos_name()
Jean-Pierre André [Sat, 11 Feb 2017 08:58:30 +0000 (09:58 +0100)]
Eliminated unnecessary strlen() in ntfs_get_ntfs_dos_name()

Since ntfs_ucstombs() returns the output string length, there is no need
to call strlen().

(contributed by Eric Biggers)

7 years agoFixed a possible buffer overrun in ntfs_utf16_to_utf8()
Jean-Pierre André [Sat, 11 Feb 2017 08:51:17 +0000 (09:51 +0100)]
Fixed a possible buffer overrun in ntfs_utf16_to_utf8()

If an output buffer was provided, ntfs_utf16_to_utf8() limited the
output string length without the terminating null to 'outs_len'.  This
was incorrect because a terminating null was always added to the string,
causing a buffer overrun if the output string happened to have exactly
the maximum length.  This was a longstanding bug.  Fix it by leaving
space for a terminating null.

(contributed by Eric Biggers)

7 years agoMade utf16_to_utf8_size() always honor @outs_len
Jean-Pierre André [Sat, 11 Feb 2017 08:49:03 +0000 (09:49 +0100)]
Made utf16_to_utf8_size() always honor @outs_len

utf16_to_utf8_size() was not guaranteed to fail with ENAMETOOLONG if the
computed length was greater than @outs_len.  This could cause a buffer
overrun in ntfs_utf16_to_utf8().

(contributed by Eric Biggers)

7 years agoPreventing --enable-plugins from disabling the plugins
Jean-Pierre André [Sat, 11 Feb 2017 08:36:30 +0000 (09:36 +0100)]
Preventing --enable-plugins from disabling the plugins

The plugins are enabled by default, and the can be disabled by the
configure option --disable-plugins, but the option --enable-plugins
also led to disabling them.

7 years agoFixed DISABLE_PLUGINS as the condition for not using plugins
Jean-Pierre André [Sat, 11 Feb 2017 08:33:27 +0000 (09:33 +0100)]
Fixed DISABLE_PLUGINS as the condition for not using plugins

The condition for using plugins did not match the definition by
./configure

7 years agoFixed nesting when not using plugins
Jean-Pierre André [Sat, 11 Feb 2017 08:26:58 +0000 (09:26 +0100)]
Fixed nesting when not using plugins

The logical nesting (defined by {...}) did not match the physical nesting
(defined by #ifdef...#endif)

7 years agoFixed updating the backup boot sector in ntfslabel
Jean-Pierre André [Sat, 11 Feb 2017 08:22:50 +0000 (09:22 +0100)]
Fixed updating the backup boot sector in ntfslabel

The location of the backup boot sector was one-off

7 years agoLogged more information when a plugin could not be loaded
Jean-Pierre André [Sat, 11 Feb 2017 08:15:33 +0000 (09:15 +0100)]
Logged more information when a plugin could not be loaded

Put the explanation from dlerr() into the syslog when a plugin could
not be loaded.

7 years agoDecoded the reparse tag for deduplication in ntfsinfo
Jean-Pierre André [Sat, 11 Feb 2017 08:11:51 +0000 (09:11 +0100)]
Decoded the reparse tag for deduplication in ntfsinfo

Take into account the reparse tag for deduplication and display its meaning

7 years agoIncluded <paths.h> where useful in fuse-lite
Jean-Pierre André [Sat, 11 Feb 2017 08:08:22 +0000 (09:08 +0100)]
Included <paths.h> where useful in fuse-lite

Both fusermount.c and mount_util.c use _PATH_MOUNTED, so they should
include <paths.h>, which provides this definition.
This is required for building with the musl C library.

Contributed by Thomas Petazzoni

7 years agoDenied creating/removing files or directories from $Extend
Jean-Pierre André [Sat, 11 Feb 2017 08:00:49 +0000 (09:00 +0100)]
Denied creating/removing files or directories from $Extend

$Extend is a directory reserved for metadata specific to Windows.
Inserting other files or directories there leads to problems with
some Windows versions.

7 years agoReplaced secaudit by ntfssecaudit in its own usage output
Jean-Pierre André [Sat, 11 Feb 2017 07:57:37 +0000 (08:57 +0100)]
Replaced secaudit by ntfssecaudit in its own usage output

The usage output did not match the command name change

7 years agoFixed bad indentations (cosmetic)
Jean-Pierre André [Sat, 11 Feb 2017 07:53:20 +0000 (08:53 +0100)]
Fixed bad indentations (cosmetic)

7 years agoImproved opening/closing $Secure when un/mounting NTFS volume
Jean-Pierre André [Fri, 2 Sep 2016 06:30:07 +0000 (08:30 +0200)]
Improved opening/closing $Secure when un/mounting NTFS volume

Call ntfs_close_secure() earlier, check for error, and other cleanups

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoCorrected code with misleading indentation
Jean-Pierre André [Thu, 28 Jul 2016 14:30:05 +0000 (16:30 +0200)]
Corrected code with misleading indentation

GCC 6 reports a warning in ntfs_allowed_dir_access() because the code has
misleading indentation.  Fix by adding braces.  There is no actual change
in behavior because of the '(allowed == 2)' condition.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoCorrected validation of multi sector transfer protected records
Jean-Pierre André [Thu, 28 Jul 2016 14:26:21 +0000 (16:26 +0200)]
Corrected validation of multi sector transfer protected records

The validation contained an off-by-one error.  The
expression '(u32)(usa_ofs + (usa_count * 2)) > size' used 'usa_count'
after it had been decremented to skip the update sequence number entry.
Consequently, the code could read out of bounds, up to two bytes past the
end of the MST-protected record.

Furthermore, as documented in the comment in layout.h for "NTFS_RECORD"
and also on MSDN for "MULTI_SECTOR_HEADER", the update sequence array
must end before the last le16 in the first logical sector --- not merely
before the end of the record.

Fix the validation and move it into a helper function, as it was done
identically in the read and write paths.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoAlways opened $Secure when mounting NTFS volume
Jean-Pierre André [Thu, 28 Jul 2016 14:22:16 +0000 (16:22 +0200)]
Always opened $Secure when mounting NTFS volume

Currently, applications that wish to access security descriptors have to
explicitly open the volume's security descriptor index ("$Secure") using
ntfs_open_secure().  Applications are also responsible for closing the
index when done with it.  However, the cleanup function for doing,
ntfs_close_secure(), cannot be called easily by all applications because
it requires a SECURITY_CONTEXT argument, not simply the ntfs_volume.
Some applications therefore have to close the inode and index contexts
manually in order to clean up properly.

This proposal updates libntfs-3g to open $Secure unconditonally as part
of ntfs_mount(), so that applications do not have to worry about it.

This proposal updates libntfs-3g to open $Secure unconditonally as part
of ntfs_mount(), so that applications do not have to worry about it.

ntfs_close_secure() is updated to take in a ntfs_volume for internal use,
and ntfs_destroy_security_context() is now the function to call to free
memory associated with a SECURITY_CONTEXT rather than a ntfs_volume.

Some memory leaks in error paths of ntfs_open_secure() are also fixed.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoFixed tautological comparison
Jean-Pierre André [Thu, 28 Jul 2016 14:19:29 +0000 (16:19 +0200)]
Fixed tautological comparison

Wrong comparison in ntfscmp.c

8 years agoRemoved unused variables
Jean-Pierre André [Thu, 28 Jul 2016 14:16:42 +0000 (16:16 +0200)]
Removed unused variables

A few variables in xattrs.c are not used any more

8 years agoAllowed using full library API on systems without extended attributes support
Jean-Pierre André [Thu, 28 Jul 2016 14:13:59 +0000 (16:13 +0200)]
Allowed using full library API on systems without extended attributes support

A number of functions in libntfs-3g are generally useful, but are tied to
extended attributes support and are not included when the library is
built on platforms without extended attributes support.

This proposal updates libntfs-3g to always include these functions.

The only tricky part is dealing with the XATTR_CREATE and XATTR_REPLACE
flags.  These flags are defined in <sys/xattr.h>, so they must be
redefined on platforms without extended attributes support.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoCleaned up file name collation code
Jean-Pierre André [Thu, 28 Jul 2016 14:10:14 +0000 (16:10 +0200)]
Cleaned up file name collation code

- Update documentation for COLLATION_RULES
- Document how ntfs_names_full_collate() compares names
- Update comments and DEBUG code to reflect that ntfs_names_full_collate()
  always access 'upcase', even in CASE_SENSITIVE mode
- Remove unneeded assignments to 'c1' and 'c2' in IGNORE_CASE mode

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoAllowed dlopen API to be either in libc or libdl
Jean-Pierre André [Tue, 19 Jul 2016 09:53:28 +0000 (11:53 +0200)]
Allowed dlopen API to be either in libc or libdl

On Linux, the functions in the dlopen API are in libdl.  However, on
FreeBSD, libdl doesn't exist and the functions are instead in libc.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoMade plugin.h include all prerequisite declarations
Jean-Pierre André [Tue, 19 Jul 2016 09:50:32 +0000 (11:50 +0200)]
Made plugin.h include all prerequisite declarations

Only <plugin.h> to be included in plugins code.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoRenamed include guard for plugin.h to _NTFS_PLUGIN_H
Jean-Pierre André [Tue, 19 Jul 2016 09:49:04 +0000 (11:49 +0200)]
Renamed include guard for plugin.h to _NTFS_PLUGIN_H

Be consistent with other NTFS-3G headers and use the "_NTFS_" prefix.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoCleared the sparse flags when clearing the bad cluster list
Jean-Pierre André [Tue, 19 Jul 2016 09:44:59 +0000 (11:44 +0200)]
Cleared the sparse flags when clearing the bad cluster list

The bad cluster list may be updated in ntfsresize and ntfsfix. Though
technically it is organized as a sparse file, Windows does not set
the sparse flags. Do the same to avoid problems with third-party
packages.

8 years agoTolerated garbage put by Windows 10 into the last ACE
Jean-Pierre André [Tue, 19 Jul 2016 09:40:20 +0000 (11:40 +0200)]
Tolerated garbage put by Windows 10 into the last ACE

For some reason, Windows 10 sometimes inserts garbage after the
last ACE of an ACL. The ACL consistency check has to tolerate this.

8 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into marshmallow-x86 android-x86-6.0-r1 android-x86-6.0-r2
Chih-Wei Huang [Wed, 6 Jul 2016 17:33:21 +0000 (01:33 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into marshmallow-x86

8 years agoAndroid.mk: create symbolic links required by vold
Chih-Wei Huang [Wed, 6 Jul 2016 17:31:42 +0000 (01:31 +0800)]
Android.mk: create symbolic links required by vold

8 years agoAndroid.mk: clean up
Chih-Wei Huang [Wed, 6 Jul 2016 17:28:17 +0000 (01:28 +0800)]
Android.mk: clean up

Get the include paths automatically by LOCAL_EXPORT_C_INCLUDE_DIRS.

8 years agoCompiled out conditionally debug-oriented code
Jean-Pierre André [Wed, 22 Jun 2016 10:01:25 +0000 (12:01 +0200)]
Compiled out conditionally debug-oriented code

Although ntfs_log_trace() is defined to a no-op in non-DEBUG builds,
ntfs_attr_name_get() is not.  This function performs a string conversion
and a memory allocation, so it is nice to have the call to it compiled
out when not needed.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoFixed ntfs_delete() failure caused by string conversion error
Jean-Pierre André [Wed, 22 Jun 2016 09:58:20 +0000 (11:58 +0200)]
Fixed ntfs_delete() failure caused by string conversion error

It was possible for ntfs_attr_name_get() to set errno due to a wide
character string that could not be converted to a multibyte string.  This
caused ntfs_delete() to fail.

Fix by checking for a nonzero return value specifically from
ntfs_attr_lookup(), rather than assuming that nothing else sets errno.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
8 years agoSwitch to using the standard autoconf AC_HEADER_MAJOR macro
Jean-Pierre André [Tue, 31 May 2016 06:33:10 +0000 (08:33 +0200)]
Switch to using the standard autoconf AC_HEADER_MAJOR macro

Switch to the standard autoconf AC_HEADER_MAJOR macro which takes care
of the ugly details like when to use mkdev.h and when to use sysmacros.h.
(requires <sys/types.h> to be included)
Also include these in all files that use major/minor/makedev funcs.

(Contributed by Mike Frysinger)

8 years agoSilenced a truncation warning in upper case table
Jean-Pierre André [Tue, 31 May 2016 06:24:23 +0000 (08:24 +0200)]
Silenced a truncation warning in upper case table

The upper case value for 0x1d79 is 0xa77d, so the difference is 0x8a04,
which overflows in the table which defines the computation of upper case
values. Rewriting this difference as -0x75fc leads to the same result
in an upper case table truncated to two bytes, and this avoid the
compiler warning.

8 years agoPorted patches to libfuse from the OpenIndiana variant
Jean-Pierre André [Wed, 4 May 2016 08:15:35 +0000 (10:15 +0200)]
Ported patches to libfuse from the OpenIndiana variant

A few patches had been found useful to the OpenIndiana variant of libfuse
(2.7.6). Port them to libfuse-lite and restrict them to Solaris/OpenIndiana.

8 years ago383 Fixed masks for major and minor in fuse-lite for OpenIndiana
Jean-Pierre André [Wed, 4 May 2016 08:08:06 +0000 (10:08 +0200)]
383 Fixed masks for major and minor in fuse-lite for OpenIndiana

On Solaris/OpenIndiana, the major and minor fields in st_rdev have to
be represented on 14 bits and 18 bits respectively. They must have
the same representation on 32-bit and 64-bit builds as the kernel
and the library do not know the word size of each other.

8 years agoUsed <sys/mkdev.h> instead of <sys/sysmacros.h> on OpenIndiana
Jean-Pierre André [Wed, 4 May 2016 08:03:39 +0000 (10:03 +0200)]
Used <sys/mkdev.h> instead of <sys/sysmacros.h> on OpenIndiana

On Solaris/OpenIndiana, use the macroes makedev(), major() and minor()
from <sys/mkdev.h>. Those from <sys/sysmacros.h> are inappropriate for
current builds.

8 years agoRedefined ELIBBAD as ENOEXEC when missing
Jean-Pierre André [Wed, 4 May 2016 07:59:18 +0000 (09:59 +0200)]
Redefined ELIBBAD as ENOEXEC when missing

When a plugin cannot be initialized a ELIBBAD error is returned on Linux
and OpenIndiana. As this is not a Posix error code, use ENOEXEC on
systems which do not define ELIBBAD.

8 years agoUpdated information about ntfsprogs to the README file
Jean-Pierre André [Wed, 4 May 2016 07:55:16 +0000 (09:55 +0200)]
Updated information about ntfsprogs to the README file

Added mentions of ntfssecaudit, ntfsusermap and ntfsrecover to the
README file.

8 years agoDefined an option to kill the Windows cache and play the log file
Jean-Pierre André [Wed, 4 May 2016 07:47:51 +0000 (09:47 +0200)]
Defined an option to kill the Windows cache and play the log file

The new ntfsrecover option --kill-fast-restart can be used to delete
the Windows fast-restart indication before playing the log. This can
lead to data loss, but is needed before mounting a partition improperly
unmounted from Windows when remounting on Windows is inconvenient.

8 years agoRejected implicit mounting read-only when hiberfile option is present
Jean-Pierre André [Wed, 4 May 2016 07:39:48 +0000 (09:39 +0200)]
Rejected implicit mounting read-only when hiberfile option is present

If the remove_hiberfile mount option is present, explicitly disallow
the library from switching to a read-only mount. This is only to avoid
confusion, as the remove_hiberfile is processed before taking the
decision to fall back to read-only.

8 years agoUsed Microsoft terminology for SID names
Jean-Pierre André [Wed, 4 May 2016 07:33:42 +0000 (09:33 +0200)]
Used Microsoft terminology for SID names

A few SIDs descriptions might be confusing because of a wording different
from Microsoft usage.

8 years agoDisplayed the SID revision as an unsigned number (cosmetic)
Jean-Pierre André [Wed, 4 May 2016 07:30:48 +0000 (09:30 +0200)]
Displayed the SID revision as an unsigned number (cosmetic)

Properly display a SID revision if it should ever reach 128.
(suggested by Ulf Zibis)

8 years agoChecked the number of subauthorities before accessing them
Jean-Pierre André [Wed, 4 May 2016 07:27:32 +0000 (09:27 +0200)]
Checked the number of subauthorities before accessing them

Be more crash resistent when analyzing a badly formed SID.
(contributed by Ulf Zibis)

8 years agoFixed segmentation fault on empty $LogFile in ntfsrecover
Jean-Pierre André [Wed, 4 May 2016 07:24:51 +0000 (09:24 +0200)]
Fixed segmentation fault on empty $LogFile in ntfsrecover

ntfsrecover -f -v <log file> receives a SIGSEGV because of trying to
read memory outside allocated buffer because of no sanity checks on
restart page header values. This happens on an empty $LogFile because
of no basic checks present. Attached patch adds basic checks similar
to those inside logfile library and allows tool to exit with more
suitable message.
(contributed by Rakesh Pandit)

8 years agoFixed a missing "break" in ntfssecaudit.c
Jean-Pierre André [Wed, 4 May 2016 07:19:39 +0000 (09:19 +0200)]
Fixed a missing "break" in ntfssecaudit.c

A missing "break" in a case construct could be troublesome.
(suggested by Ulf Zibis)

8 years agoFixed indentation in ntfssecaudit.c (cosmetic)
Jean-Pierre André [Wed, 4 May 2016 07:15:43 +0000 (09:15 +0200)]
Fixed indentation in ntfssecaudit.c (cosmetic)

There was an abusive indentation.

8 years agounistr.c: Unify the two defines NOREVBOM and ALLOW_BROKEN_SURROGATES.
Erik Larsson [Tue, 12 Apr 2016 15:02:40 +0000 (17:02 +0200)]
unistr.c: Unify the two defines NOREVBOM and ALLOW_BROKEN_SURROGATES.

In the mailing list discussion we came to the conclusion that there
doesn't seem to be any reason to keep these declarations separate since
they address the same issue, namely libntfs-3g's tolerance for bad
Unicode data in filenames and other UTF-16 strings in the file system,
so merge the two defines into the new define ALLOW_BROKEN_UNICODE.

8 years agounistr.c: Enable encoding broken UTF-16 into broken UTF-8, A.K.A. WTF-8.
Erik Larsson [Fri, 8 Apr 2016 03:39:48 +0000 (05:39 +0200)]
unistr.c: Enable encoding broken UTF-16 into broken UTF-8, A.K.A. WTF-8.

Windows filenames may contain invalid UTF-16 sequences (specifically
broken surrogate pairs), which cannot be converted to UTF-8 if we do
strict conversion.

This patch enables encoding broken UTF-16 into similarly broken UTF-8 by
encoding any surrogate character that don't have a match into a separate
3-byte UTF-8 sequence.

This is "sort of" valid UTF-8, but not valid Unicode since the code
points used for surrogate pair encoding are not supposed to occur in a
valid Unicode string... but on the other hand the source UTF-16 data is
also broken, so we aren't really making things any worse.

This format is sometimes referred to as WTF-8 (Wobbly Translation
Format, 8-bit encoding) and is a common solution to represent broken
UTF-16 as UTF-8.

It is a lossless round-trip conversion, i.e converting from broken
UTF-16 to "WTF-8" and back to UTF-16 yields the same broken UTF-16
sequence. Because of this property it enables accessing these files
by filename through ntfs-3g and the ntfsprogs (e.g. ls -la works as
expected).

To disable this behaviour you can pass the preprocessor/compiler flag
'-DALLOW_BROKEN_SURROGATES=0' when building ntfs-3g.

8 years agoDeleted file secaudit.h
Jean-Pierre André [Thu, 7 Apr 2016 07:36:01 +0000 (09:36 +0200)]
Deleted file secaudit.h

The declarations for compiling secaudit on Windows are not used any more
and can be dropped.

8 years agoRemoved declarations for using acls.c outside ntfs-3g
Jean-Pierre André [Thu, 7 Apr 2016 07:32:26 +0000 (09:32 +0200)]
Removed declarations for using acls.c outside ntfs-3g

The declarations for using acls.c within secaudit on Windows are not used
any more and can be dropped.

8 years agoAdapted secaudit and usermap (now ntfssecaudit and ntfsusermap) to ntfsprogs
Jean-Pierre André [Thu, 7 Apr 2016 07:20:23 +0000 (09:20 +0200)]
Adapted secaudit and usermap (now ntfssecaudit and ntfsusermap) to ntfsprogs

These tools were originally developed for running on Windows and later
ported to libntfs-3g. This patch makes them similar to other ntfsprogs
tools, dropping the native Windows interfaces and using libntfs-3g on
all platforms.

There is no change in usage or supported features, only the command
names have changed.

8 years agoMoved secaudit and usermap to directory ntfsprogs
Jean-Pierre André [Thu, 7 Apr 2016 07:07:13 +0000 (09:07 +0200)]
Moved secaudit and usermap to directory ntfsprogs

These tools were developped before the ntfsprogs were merged into ntfs-3g,
redesigning them like the ntfsprogs make the code simpler.

Note : at this stage secaudit and usermap cannot be built any more.

8 years agoFixed indentation in ntfsclone help text (cosmetic)
Jean-Pierre André [Wed, 6 Apr 2016 09:09:35 +0000 (11:09 +0200)]
Fixed indentation in ntfsclone help text (cosmetic)

The tabs in source code appear differently in actual output.

8 years agoFixed a spelling error in ntfsresize manual (cosmetic)
Jean-Pierre André [Wed, 6 Apr 2016 09:07:30 +0000 (11:07 +0200)]
Fixed a spelling error in ntfsresize manual (cosmetic)

an other -> another

8 years agoMoved general declarations from ntfsrecover.h to logfile.h
Jean-Pierre André [Wed, 6 Apr 2016 09:03:31 +0000 (11:03 +0200)]
Moved general declarations from ntfsrecover.h to logfile.h

The declarations related to the log file structure are now grouped
in logfile.h, those specific to the recovery process are kept in
ntfsrecover.h

8 years agoAdded a usn field to RESTART_PAGE_HEADER
Jean-Pierre André [Wed, 6 Apr 2016 08:58:25 +0000 (10:58 +0200)]
Added a usn field to RESTART_PAGE_HEADER

Prepare merging ntfsrecover.h into logfile.h by adding a usn field to
RESTART_PAGE_HEADER. As this changes the record size, ignore the new
field in existing code.

8 years agoRenamed reserved fields in ntfsrecover the same way as in logfile.h
Jean-Pierre André [Wed, 6 Apr 2016 08:54:51 +0000 (10:54 +0200)]
Renamed reserved fields in ntfsrecover the same way as in logfile.h

Prepare merging ntfsrecover.h into logfile.h by naming reserved fields
the same way.

8 years agoRenamed record_length as log_record_header_length in ntfsrecover.h
Jean-Pierre André [Wed, 6 Apr 2016 08:52:18 +0000 (10:52 +0200)]
Renamed record_length as log_record_header_length in ntfsrecover.h

Prepare merging ntfsrecover.h into logfile.h by naming the record
header length the same way.

8 years agoRenamed restart_offset as restart_area_offset in ntfsrecover.h
Jean-Pierre André [Wed, 6 Apr 2016 08:50:31 +0000 (10:50 +0200)]
Renamed restart_offset as restart_area_offset in ntfsrecover.h

Prepare merging ntfsrecover.h into logfile.h by renaming the restart
offset the same way.

8 years agoRedefined target_vcn on 64 bits in ntfsrecover.h
Jean-Pierre André [Wed, 6 Apr 2016 08:45:30 +0000 (10:45 +0200)]
Redefined target_vcn on 64 bits in ntfsrecover.h

In a log record, the target vcn has to be stored on 64 bits

8 years agoRedefined file_offset on 64 bits in ntfsrecover.h
Jean-Pierre André [Wed, 6 Apr 2016 08:40:28 +0000 (10:40 +0200)]
Redefined file_offset on 64 bits in ntfsrecover.h

The log file offsets are apparently stored on 64 bits, though the file
size is unlikely to reach 2MB.

8 years agoUnfolded record headers in ntfsrecover the same way as in logfile.h
Jean-Pierre André [Wed, 6 Apr 2016 08:38:06 +0000 (10:38 +0200)]
Unfolded record headers in ntfsrecover the same way as in logfile.h

Prepare merging ntfsrecover.h into logfile.h by unfolding the record
headers the same way.

8 years agoTypedef'ed new structs in ntfsrecover the same way as in logfile.h
Jean-Pierre André [Wed, 6 Apr 2016 08:34:46 +0000 (10:34 +0200)]
Typedef'ed new structs in ntfsrecover the same way as in logfile.h

Prepare merging ntfsrecover.h into logfile.h by declaring new structs
the same was as in logfile.h

8 years agoTypedef'ed old structs in ntfsrecover the same way as in logfile.h
Jean-Pierre André [Wed, 6 Apr 2016 08:32:39 +0000 (10:32 +0200)]
Typedef'ed old structs in ntfsrecover the same way as in logfile.h

Prepare merging ntfsrecover.h into logfile.h by declaring duplicated
structs the same way

8 years agoRedefined ntfsrecover enums as little-endian values
Jean-Pierre André [Wed, 6 Apr 2016 08:26:46 +0000 (10:26 +0200)]
Redefined ntfsrecover enums as little-endian values

Rather than cpu-endian values, use little-endian ones in ntfsrecover
for similarity with layout.h

8 years agoMade a full check for whether a user extended attribute is allowed
Jean-Pierre André [Wed, 6 Apr 2016 08:17:27 +0000 (10:17 +0200)]
Made a full check for whether a user extended attribute is allowed

User extended attributes should only be set on files and directories,
not on symlinks, sockets, devices, etc. For safety they are also
forbidden on metadata files, but should be allowed on the root
directory. For files based on reparse points, requests are made
to the plugin to determine the type.

8 years agoTranslated directory separators when running ntfscluster on Windows
Jean-Pierre André [Wed, 6 Apr 2016 08:11:08 +0000 (10:11 +0200)]
Translated directory separators when running ntfscluster on Windows

Use \ as a directory separator when running on Windows.

8 years agoReturned an error code for an exclusive access violation on Windows
Jean-Pierre André [Wed, 6 Apr 2016 08:08:01 +0000 (10:08 +0200)]
Returned an error code for an exclusive access violation on Windows

Translate to Windows error code STATUS_SHARING_VIOLATION to Unix error
code EBUSY.

8 years agoFixed the maximum size of an ACL
Jean-Pierre André [Wed, 6 Apr 2016 08:02:23 +0000 (10:02 +0200)]
Fixed the maximum size of an ACL

Define the maximum size of an ACL as results from the maximum number of
sub-authorities defined in layout.h

8 years agoUsed a more portable way to force alignment in security.h
Jean-Pierre André [Wed, 6 Apr 2016 07:57:59 +0000 (09:57 +0200)]
Used a more portable way to force alignment in security.h

Defining an array of zero elements does not force alignment on some CPUs,
insert a filler.

8 years agoEnabled fallback to read-only mount when volume is hibernated
Jean-Pierre André [Wed, 6 Apr 2016 07:51:47 +0000 (09:51 +0200)]
Enabled fallback to read-only mount when volume is hibernated

When a volume is found hibernated (or prepared for fast restarting),
it is force-mounted as read-only.

8 years agoAllowed kernel cacheing by lowntfs-3g when not using Posix ACLs
Jean-Pierre André [Wed, 6 Apr 2016 07:44:59 +0000 (09:44 +0200)]
Allowed kernel cacheing by lowntfs-3g when not using Posix ACLs

Kernel cacheing of file attributes is usually not used by ntfs-3g,
because it has defects when dealing with hard linked files and directory
permission checks. Kernel cacheing is however possible when using
lowntfs-3g and not using Posix ACLs.

8 years agoFixed bad test in fuse mount
Jean-Pierre André [Wed, 6 Apr 2016 07:42:16 +0000 (09:42 +0200)]
Fixed bad test in fuse mount

Apply a fix from the full fuse library

8 years agoSilenced fixup warnings when allocating a new MFT record
Jean-Pierre André [Wed, 6 Apr 2016 07:32:18 +0000 (09:32 +0200)]
Silenced fixup warnings when allocating a new MFT record

When creating a new MFT record, do not issue a warning if the current
record has bad fixups. These warnings are meaningless, difficult to
interpret and cause unneeded worries.

8 years agoAdded clarification about creating a partition to the ntfsclone manual
Jean-Pierre André [Wed, 6 Apr 2016 07:27:07 +0000 (09:27 +0200)]
Added clarification about creating a partition to the ntfsclone manual

Try to make clear the option --output feeds data into a partition, but
does not create the partition.

8 years agoUsed plugins to process reparse points
Jean-Pierre André [Wed, 6 Apr 2016 07:10:35 +0000 (09:10 +0200)]
Used plugins to process reparse points

The new "system compression" files used by Windows 10 make use of reparse
points to record the compression parameters, and a specific named data
stream is used to store the compressed data. With this patch, processing
of reparse points can be done by an external plugin only loaded as needed.
Junctions and symlinks, which are also based on reparse points, are now
processed by "internal plugins".

8 years agoAdded an option for preserving the full log file in ntfsclone
Jean-Pierre André [Wed, 6 Apr 2016 06:51:36 +0000 (08:51 +0200)]
Added an option for preserving the full log file in ntfsclone

Usually, only a few pages of the Windows log file are saved in an
ntfsclone image. This is inappropriate for building reference images
for recovering the log, and the --full-logfile option serves that
purpose.

8 years agoReworked decisions to undo related to unreadable records
Jean-Pierre André [Wed, 6 Apr 2016 06:44:38 +0000 (08:44 +0200)]
Reworked decisions to undo related to unreadable records

When an INDX or MFT record could not be read while undoing the creation
of this record, there is nothing to do. However if this was undoing the
deletion of the last entry in an index, a new void index block has to be
created.

8 years agoVersion 2016.2.22
Jean-Pierre André [Mon, 22 Feb 2016 07:28:50 +0000 (08:28 +0100)]
Version 2016.2.22

8 years agoFix compilation errors on OpenIndiana caused by missing limit macros.
Erik Larsson [Tue, 16 Feb 2016 19:43:00 +0000 (20:43 +0100)]
Fix compilation errors on OpenIndiana caused by missing limit macros.

8 years agoendians.h: Fix bad assumption of valid __BYTE_ORDER__ values.
Erik Larsson [Tue, 16 Feb 2016 19:29:56 +0000 (20:29 +0100)]
endians.h: Fix bad assumption of valid __BYTE_ORDER__ values.

On the OpenIndiana Hipster distribution, compiling with GCC 4.9 would
fail because __BYTE_ORDER__ was defined but not to any of the values
assumed to be associated with this define (__LITTLE_ENDIAN__ or
__BIG_ENDIAN__). Instead it was defined to either
__ORDER_LITTLE_ENDIAN__ or __ORDER_BIG_ENDIAN__. This caused
compilation to fail.

Fixed by checking that all referenced defines are in fact defined
before using them and adding an additional #elif clause for this newly
discovered condition.

8 years agontfsrecover.c: Fix compiler warning about uninitialized 'savebuf' usage.
Erik Larsson [Tue, 16 Feb 2016 08:38:12 +0000 (09:38 +0100)]
ntfsrecover.c: Fix compiler warning about uninitialized 'savebuf' usage.

The previous fix for the warning referred to 'prevbuf' being used
uninitialized and this is also what the compiler says. However
initializing 'prevbuf' doesn't make the warning go away and further
testing revealed that it is really 'savebuf' being possibly used prior
to initialization that is the source of the warning (the incorrect
warning message is probably an optimization-related gcc bug). So replace
previous ineffective fix with explicit initialization of 'savebuf'.