OSDN Git Service

android-x86/external-ntfs-3g.git
6 years agoFix building errors on Android 8.1 android-x86-8.1-r1
Chih-Wei Huang [Tue, 12 Dec 2017 09:20:00 +0000 (17:20 +0800)]
Fix building errors on Android 8.1

Define MAJOR_IN_SYSMACROS to provide prototypes of major and minor.

6 years agoandroid: fix parsing issue of Android 8.0
Chih-Wei Huang [Thu, 30 Nov 2017 06:23:56 +0000 (14:23 +0800)]
android: fix parsing issue of Android 8.0

Android 8.0 stupidly uses comma in vold's device node name, say
"/dev/block/vold/public:8,32". The libfuse-lite can't parse it
correctly since a comma is usually used as a separator between
options.

Modify the options parser to handle it specially.

6 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into oreo-x86
Chih-Wei Huang [Wed, 29 Nov 2017 07:35:50 +0000 (15:35 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into oreo-x86

6 years agoProcessed redo log actions associated to undoing a CompensationlogRecord
Jean-Pierre André [Thu, 26 Oct 2017 08:44:36 +0000 (10:44 +0200)]
Processed redo log actions associated to undoing a CompensationlogRecord

At least when there is a shortage of space on the target device, several
redo actions are associated to undoing a CompensationlogRecord, and they
should be redone upon recovery.

6 years agoChecked log file blocks more recent than temporary ones
Jean-Pierre André [Thu, 26 Oct 2017 08:40:17 +0000 (10:40 +0200)]
Checked log file blocks more recent than temporary ones

Under some circumstances, the temporary log file blocks are not the
latest ones, so check whether there are more recent ones.
Only done for log version 1.x, as log version 2.x follow a different
logic.

6 years agoAligned internal log buffers on CPUs which require them
Jean-Pierre André [Thu, 26 Oct 2017 08:33:29 +0000 (10:33 +0200)]
Aligned internal log buffers on CPUs which require them

The generic buffer structure should respect the alignment of included
log structures. This is required by some CPUs (such as Sparc).

6 years agolowntfs-3g.c: Fix compile error when struct stat doesn't have st_*tim.
Erik Larsson [Wed, 20 Sep 2017 02:56:06 +0000 (04:56 +0200)]
lowntfs-3g.c: Fix compile error when struct stat doesn't have st_*tim.

The struct members for the time fields in struct stat vary depending on
platform, so introduce #ifdefs using the config.h-supplied definitions
for determining which stat time definition is appropriate.

6 years agoLogged falling back to mounting read-only
Jean-Pierre André [Fri, 11 Aug 2017 07:56:44 +0000 (09:56 +0200)]
Logged falling back to mounting read-only

When the ntfs image is unclean, usually because it was not unmounted
properly from Windows, mounting read-write is denied and falls back
to read-only. Log this situation in the syslog, so that users mounting
through /etc/fstab can more easily know what is going on. Also remove
the "rw" option if it was stated.

6 years agoDecoded more reparse tags in ntfsinfo
Jean-Pierre André [Fri, 11 Aug 2017 07:52:54 +0000 (09:52 +0200)]
Decoded more reparse tags in ntfsinfo

Displayed some information in ntfsinfo output about a few new types of
reparse point brought by Windows 10.

6 years agoEnabled directory operations in plugins
Jean-Pierre André [Fri, 11 Aug 2017 07:42:37 +0000 (09:42 +0200)]
Enabled directory operations in plugins

Windows 10 brought a new type of reparse point for directories (0x80000018),
so add opendir() and readdir() to the plugin interface to take directories
into account. The interface for releasedir() is merged with release() as
the plugins can discriminate them if needed.

6 years agoRelaxed limitations on security descriptors
Jean-Pierre André [Fri, 11 Aug 2017 07:34:31 +0000 (09:34 +0200)]
Relaxed limitations on security descriptors

Windows 10 brought security descriptors which contain ACE's related to
new ways of accessing files or directories. These ACE are now accepted
with minimal consistency checks. They are still ignored for translating
permissions and for Windows-type inheritance.

6 years agoFixed a typo
Jean-Pierre André [Fri, 11 Aug 2017 07:29:52 +0000 (09:29 +0200)]
Fixed a typo

A typo made a directive for plugin developers difficult to understand

7 years agoFixed updating the vcn of subtree in ntfsrecover
Jean-Pierre André [Tue, 20 Jun 2017 06:56:00 +0000 (08:56 +0200)]
Fixed updating the vcn of subtree in ntfsrecover

The logic for determining where the actions SetIndexEntryVcnRoot and
SetIndexEntryVcnAllocation had to insert a new vcn was unclear and was
wrong in some situations. This is to fix the logic as determined by new
evidence.

7 years agoMentioned ntfsfallocate and ntfsrecover in the general ntfsprogs manual
Jean-Pierre André [Tue, 20 Jun 2017 06:51:09 +0000 (08:51 +0200)]
Mentioned ntfsfallocate and ntfsrecover in the general ntfsprogs manual

The most recent ntfsprogs utilities should be referenced in the table of
contents.

7 years agoMerge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into nougat-x86 nougat-x86 android-x86-7.1-r1 android-x86-7.1-r2 android-x86-7.1-r3 android-x86-7.1-r4 android-x86-7.1-r5
Chih-Wei Huang [Thu, 1 Jun 2017 03:18:38 +0000 (11:18 +0800)]
Merge branch 'edge' of git://git.code.sf.net/p/ntfs-3g/ntfs-3g into nougat-x86

7 years agoFixed the computation of highest_vcn when applying a runlist fixup
Jean-Pierre André [Thu, 25 May 2017 08:52:54 +0000 (10:52 +0200)]
Fixed the computation of highest_vcn when applying a runlist fixup

When a file is partially truncated, the highest_vcn has to be recomputed
before the file size is adjusted. As a consequence the unmapped run
inserted at the end of runlist to match the file size should not be taken
into account when determining the higest_vcn.

7 years agoUpgraded ntfsrecover to support log files 2.0
Jean-Pierre André [Thu, 25 May 2017 08:44:18 +0000 (10:44 +0200)]
Upgraded ntfsrecover to support log files 2.0

When the fast restart mode of Windows 8 (or later) is activated, the
log file format is different (version 2.0 instead of 1.1), having 32
temporaty blocks instead of 2. This patch upgrades ntfsrecover to take
the new format into account.

7 years agoBypassed cluster allocation errors using --ignore-fs-check in ntfsclone
Jean-Pierre André [Thu, 25 May 2017 08:28:05 +0000 (10:28 +0200)]
Bypassed cluster allocation errors using --ignore-fs-check in ntfsclone

When using option --ignore-fs-check in ntfsclone, doubly allocated cluster
still lead to aborting the process. Bypassing the error is useful for
creating a metadata image intended for debugging, for example when the
partition was not closed properly and the logfile has to be applied to
restore the integrity of metadata.

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