OSDN Git Service

android-x86/external-ntfs-3g.git
10 years agoSilenced warnings by gcc >= 4.8 about aliasing
Jean-Pierre André [Mon, 9 Sep 2013 13:34:14 +0000 (15:34 +0200)]
Silenced warnings by gcc >= 4.8 about aliasing

Added intermediate variables to avoid warnings by gcc >= 4.8

10 years agoFixed expanding a resident attribute without inserting holes
Jean-Pierre André [Mon, 9 Sep 2013 13:27:38 +0000 (15:27 +0200)]
Fixed expanding a resident attribute without inserting holes

When calling ntfstruncate() to expand a resident attribute, the function
is called again recursively, losing the requirement for not inserting
holes. This is for forwarding the requirement (used by ntfscp).

10 years agoFixed testing whether a stream has been wiped out
Jean-Pierre André [Mon, 9 Sep 2013 13:19:50 +0000 (15:19 +0200)]
Fixed testing whether a stream has been wiped out

When testing whether a stream has been wiped out for possibly changing
its compression status, only the non-resident case was considered.
This fixes the test for streams which were never made non-resident.

11 years agoFixed creating a new image file on Windows
Jean-Pierre André [Tue, 6 Aug 2013 09:44:40 +0000 (11:44 +0200)]
Fixed creating a new image file on Windows

Creating a new image file (clone or metadata) by ntfsclone failed on
Windows, because the file was not opened with the needed flags.

11 years agoFixed dealing with errors getting the file size from Windows
Jean-Pierre André [Tue, 6 Aug 2013 09:39:13 +0000 (11:39 +0200)]
Fixed dealing with errors getting the file size from Windows

Using SetFilePointer() for compatibility with old Windows implies
a specific management of errors....

11 years agoFixed computing a file size on Windows
Jean-Pierre André [Tue, 30 Jul 2013 09:42:59 +0000 (11:42 +0200)]
Fixed computing a file size on Windows

The lower part should not have been sign-extended.

11 years agoFixed struct formats for running on 64-bit Windows
Jean-Pierre André [Tue, 30 Jul 2013 09:31:56 +0000 (11:31 +0200)]
Fixed struct formats for running on 64-bit Windows

Added a few paddings for field alignment in structs whose layout has to
match 64-bit Windows internals.

11 years agoFixed format translations for Windows
Jean-Pierre André [Tue, 30 Jul 2013 09:27:16 +0000 (11:27 +0200)]
Fixed format translations for Windows

Translating "%ll" print formats to "%I64" for Windows was wrong.

11 years agoRemoved duplicated code in mkntfs
Jean-Pierre André [Tue, 30 Jul 2013 09:22:34 +0000 (11:22 +0200)]
Removed duplicated code in mkntfs

Removed a meaningless duplicated test.

11 years agoImproved emulation of stat(2) on Windows
Jean-Pierre André [Tue, 30 Jul 2013 09:17:29 +0000 (11:17 +0200)]
Improved emulation of stat(2) on Windows

Made a distinction between a file and a partition when emulating stat(2)
on Windows (useful for ntfsclone).

11 years agoSilenced a compiler warning in ntfs-3g.probe
Jean-Pierre André [Tue, 30 Jul 2013 09:13:51 +0000 (11:13 +0200)]
Silenced a compiler warning in ntfs-3g.probe

Avoid some compilers to complain about a missing return value...

11 years agoForced 64-bit computation of inode number in ntfsundelete
Jean-Pierre André [Tue, 30 Jul 2013 09:07:12 +0000 (11:07 +0200)]
Forced 64-bit computation of inode number in ntfsundelete

An inode number computation was done with 32 bits, and could (theoretically)
lead to truncation.

11 years agoOutput the modification time when scanning files by ntfsundelete
Jean-Pierre André [Tue, 30 Jul 2013 09:00:46 +0000 (11:00 +0200)]
Output the modification time when scanning files by ntfsundelete

When trying to undelete a file which was modified several times the
same day, it is difficult to tell which one is the latest unless the
modification time is displayed.

11 years agoFixed delayed deletion of files opened multiple times in lowntfs-3g
Jean-Pierre André [Tue, 30 Jul 2013 08:53:07 +0000 (10:53 +0200)]
Fixed delayed deletion of files opened multiple times in lowntfs-3g

Reworked the delayed deletion of open files in lowntfs-3g to cope with
situations where a file was opened multiple times. In such circumstances,
multiple ghost names are created, to avoid having to check the full list
when opening and closing, which are much more frequent than deleting.

11 years agoImproved the manual description of the size option of ntfsresize
Jean-Pierre André [Tue, 30 Jul 2013 08:45:22 +0000 (10:45 +0200)]
Improved the manual description of the size option of ntfsresize

Tried to make clear an NTFS file system size is smaller than the
partition size, and the size wanted by ntfsresize is the partition
size.

11 years agoReserved a single sector for the backup boot sector
Jean-Pierre André [Tue, 30 Jul 2013 08:35:13 +0000 (10:35 +0200)]
Reserved a single sector for the backup boot sector

Reserve a single sector, instead of a full cluster, for the backup boot
sector.

11 years agoSet the backup boot sector in ntfsresize when the size is reliable
Jean-Pierre André [Tue, 30 Jul 2013 08:17:28 +0000 (10:17 +0200)]
Set the backup boot sector in ntfsresize when the size is reliable

Traditionally the backup boot sector is not set by ntfsresize because
the exact partition size is not yet known. A chkdsk is triggered to
subsequently insert it.
However ntfsresize is frequently activated by a partition editor which
has an exact knowledge of the wanted layout, and the backup boot sector
can be inserted by ntfsresize. This is only done if the target partition
size is defined with no unit suffix, and it is a multiple of the sector
size. Anyway the backup boot sector cannot overwrite useful data as it
is inserted between the file system size and the target partition size.

11 years agoFixed processing compressed data beyond file size
Jean-Pierre André [Thu, 30 May 2013 08:23:04 +0000 (10:23 +0200)]
Fixed processing compressed data beyond file size

Windows 8 does not zero any more the end of a compression block beyond
what is needed to reach the end of a file. We must now be careful not
to decompress more data than needed.

11 years agoFixed size truncation when checking for Interix types on 32-bit CPU
Jean-Pierre André [Tue, 7 May 2013 09:42:48 +0000 (11:42 +0200)]
Fixed size truncation when checking for Interix types on 32-bit CPU

A cast, intended to avoid comparing signed to unsigned, led to truncate
the size on a 32-bit CPU, hence to wrongly check for Interix types.

11 years agoFixed the reversing of slashes in relative Windows-type symlinks
Jean-Pierre André [Fri, 26 Apr 2013 17:07:47 +0000 (19:07 +0200)]
Fixed the reversing of slashes in relative Windows-type symlinks

When translating Windows-type symlinks to Linux ones, the directory
separator has to be changed from '\' to '/'. The change was wrong
for multiple "..\" and ".\"

11 years agoFixed usa checking by ntfsck on 4K sectors
Jean-Pierre André [Mon, 22 Apr 2013 17:14:48 +0000 (19:14 +0200)]
Fixed usa checking by ntfsck on 4K sectors

The usa sequence is used to make sure the sectors containing metadata
are fully written. The values are always put at the end of 512-byte
chunks even if the sectors are greater.

11 years agoRemoved obsoleted references to utime_omit_ok
Jean-Pierre André [Mon, 22 Apr 2013 17:06:49 +0000 (19:06 +0200)]
Removed obsoleted references to utime_omit_ok

When issuing an utimensat as a consequence of utime(2) or utimensat(2),
fuse had temporarily defined a flag utime_omit_ok to identify whether
the file system supports the values UTIME_OMIT and UTIME_NOW to mean
specific timestamp updatings. The flag has been obsoleted and all
file system are now supposed to comply with the convention.

11 years agoFixed updating all the MFT runs in a relocated MFT in ntfsresize
Jean-Pierre André [Mon, 22 Apr 2013 16:55:26 +0000 (18:55 +0200)]
Fixed updating all the MFT runs in a relocated MFT in ntfsresize

When the MFT is partially located beyond the end of a resized partition,
it has to be relocated after the other files have been processed
because the MFT data is needed to do the relocations. When the MFT runlist
is split over extents, all of them have to be processed.

11 years agoFixed trying to update the MFT and Bitmap on a test run of ntfsresize
Jean-Pierre André [Mon, 22 Apr 2013 16:45:48 +0000 (18:45 +0200)]
Fixed trying to update the MFT and Bitmap on a test run of ntfsresize

When the beginning of the MFT is beyond the end of the resized
partition, a specific procedure has to be used to relocate this part
of the MFT and adjust the bitmap accordingly. On a test run, these
updates should not be done.

11 years agoUsed /proc/mounts for checking existing mounts
Jean-Pierre André [Mon, 22 Apr 2013 16:37:51 +0000 (18:37 +0200)]
Used /proc/mounts for checking existing mounts

The file /etc/mtab is traditionally checked to avoid multiple mountings
of the same device, but this is not accurate enough in some conditions.
So use /proc/mounts when available and fall back to /etc/mtab on
systems which do not have /proc/mounts.

11 years agoIncreased the maximum format size on Windows
Jean-Pierre André [Mon, 22 Apr 2013 16:31:16 +0000 (18:31 +0200)]
Increased the maximum format size on Windows

The long long printing formats (such as %lld or %llx) have to be
translated to %I64 on older Windows systems, and the buffers to
receive the translated format must be able to hold the tool banners
which can be quite lengthy.

11 years agoFixed a use of uninitialized variable compiler warning
Jean-Pierre André [Wed, 13 Feb 2013 07:54:34 +0000 (08:54 +0100)]
Fixed a use of uninitialized variable compiler warning

Author: Anton Altaparmakov
Date:   Wed Feb 13 02:29:47 2013 +0000

This is a fix to the use of hd library to get the legacy BIOS geometry.

11 years agoMade compilation with --enable-really-static option to ./configure work
Jean-Pierre André [Wed, 13 Feb 2013 07:51:47 +0000 (08:51 +0100)]
Made compilation with --enable-really-static option to ./configure work

Author: Anton Altaparmakov
Date:   Wed Feb 13 02:29:47 2013 +0000

This is a fix to the use of hd library to get the legacy BIOS geometry.

11 years agoAdded use of hd library to get the legacy BIOS geometry
Jean-Pierre André [Tue, 12 Feb 2013 14:45:54 +0000 (15:45 +0100)]
Added use of hd library to get the legacy BIOS geometry

Author: Anton Altaparmakov <anton@tuxera.com>
Date:   Tue Feb 12 10:33:55 2013 +0000

    Modify libntfs-3g to make use of hd library to get the legacy BIOS geometry
    from EDD.  We scan all whole disk devices on the system and check if they
    match the open ntfs device and if not we scan all partition devices on the
    system and check if they match the open ntfs device.

    If we find a partition device to match then we find its parent device again
    using the hd library.

    Once we have the parent of the partition device or we matched a whole disk
    device we get the legacy EDD sectors per track and heads again using the hd
    library.

    Use of the hd library is auto detected (based on finding <hd.h> header file,
    being able to link against libhd and finding the hd_list symbol in libhd.

    Use can also be disabled/enabled/libhd prefix specified at ./configure time.
    See ./configure --help for details.

    Note this obviously requires libhd to be installed.  On Ubuntu 12/04 systems
    the relevant packages needed are libhd-dev and libhd16 (on older Ubuntu
    versions it will be libhdN where N is some number <= 16 but an easy way to
    get the right package is to simply install libhd-dev which by dependency
    pulls in the correct libhdN package) whilst on SLES systems the relevant
    packages needed are hwinfo and hwinfo-devel.

11 years agoMade the meaning of the size argument of ntfsresize more clear in the manual
Jean-Pierre André [Sat, 9 Feb 2013 14:19:34 +0000 (15:19 +0100)]
Made the meaning of the size argument of ntfsresize more clear in the manual

The size argument of ntfsresize is the target partition size. This is
not the file system size as returned by df(1) or statvfs(3) because a
sector is reserved for the backup boot sector, and the remaining sector
count might not be a multiple of clusters per sector.

11 years agoInitialize the random generator for the internal guid generator
Jean-Pierre André [Sat, 9 Feb 2013 14:12:56 +0000 (15:12 +0100)]
Initialize the random generator for the internal guid generator

When uuid/uuid.h is not available, mkntfs uses a home-made guid
generator. Better initialize the random generator to get a random guid.

11 years agoFixed rescuing clusters by physical sectors in ntfsclone
Jean-Pierre André [Sat, 9 Feb 2013 14:07:06 +0000 (15:07 +0100)]
Fixed rescuing clusters by physical sectors in ntfsclone

When a sector is unreadable, consider the whole sector as bad, instead
of trying to find which 512-byte parts of it are bad. This was causing
unwanted retries for devices with 4K sectors.

11 years agoFixed setting a magic header to unreadable sectors in ntfsclone
Jean-Pierre André [Sat, 9 Feb 2013 14:04:41 +0000 (15:04 +0100)]
Fixed setting a magic header to unreadable sectors in ntfsclone

The magic header of an unreadable sectors should have the size of
"BadSectoR", not the size of a pointer to it.

11 years agoRejected reading a volume from stdin in ntfsclone
Jean-Pierre André [Sat, 9 Feb 2013 14:01:36 +0000 (15:01 +0100)]
Rejected reading a volume from stdin in ntfsclone

Reading a volume must be done in a seekable way. Better throw a proper
error.

11 years agoPorted ntfsundelete to Windows
Jean-Pierre André [Sat, 9 Feb 2013 13:56:46 +0000 (14:56 +0100)]
Ported ntfsundelete to Windows

Made a few adaptations to what is available on Windows.

11 years agoTranslated %ll print editing formats to %I64 on Windows
Jean-Pierre André [Sat, 9 Feb 2013 11:57:22 +0000 (12:57 +0100)]
Translated %ll print editing formats to %I64 on Windows

Older msvcrt.dll (on XP and earlier) did not support "%ll" print editing
formats frequently used by ntfsclone. So translate them to "%I64" when
running on Windows. This format appears to be supported by all Windows
versions. Error messages from libntfs-3g are still not translated.

11 years agoPorted ntfsclone to Windows
Jean-Pierre André [Sat, 9 Feb 2013 11:54:44 +0000 (12:54 +0100)]
Ported ntfsclone to Windows

This mainly means using the functions in win32_io.c instead of the
standard msvcrt.dll ones in order to be able to truncate files and
create sparse ones.

11 years agoFixed bad copying of the backup boot sector in ntfsclone
Jean-Pierre André [Sat, 9 Feb 2013 11:53:38 +0000 (12:53 +0100)]
Fixed bad copying of the backup boot sector in ntfsclone

This patch fixes the sector offset to the backup boot sector when creating
a metadata image.

11 years agoRevert "Ported ntfsclone to Windows", should be "Fixed bad copying of the backup...
Jean-Pierre André [Sat, 9 Feb 2013 11:50:16 +0000 (12:50 +0100)]
Revert "Ported ntfsclone to Windows", should be "Fixed bad copying of the backup boot sector"

This reverts commit 92cd41b6e5b3dd755065d345a8f2c44db7b5ce48.

The title and description were wrong

11 years agoPorted ntfsclone to Windows
Jean-Pierre André [Sat, 9 Feb 2013 11:14:19 +0000 (12:14 +0100)]
Ported ntfsclone to Windows

This mainly means using the functions in win32_io.c instead of the
standard msvcrt.dll ones in order to be able to truncate files and
create sparse ones.

11 years agoCleaned selecting stdout or stderr for messages from ntfsclone
Jean-Pierre André [Sat, 9 Feb 2013 11:12:02 +0000 (12:12 +0100)]
Cleaned selecting stdout or stderr for messages from ntfsclone

Depending on the options selected, ntfsclone messages are output on
stdout or stderr. This is now done through standard logging procedures.

11 years agoAvoided displaying in non-verbose mode information which is not computed
Jean-Pierre André [Sat, 9 Feb 2013 11:08:58 +0000 (12:08 +0100)]
Avoided displaying in non-verbose mode information which is not computed

The summary of 'runcount.runs' and 'runcount.fragments' was displayed in
non-verbose mode. However these variables are not updated in non-verbose
mode, so they would always be 0.
We now only display this summary in verbose mode.

11 years agoEnabled relocating the MFT when shrinking a volume
Jean-Pierre André [Sat, 9 Feb 2013 11:00:02 +0000 (12:00 +0100)]
Enabled relocating the MFT when shrinking a volume

This patch makes it possible to shrink a volume to a small size such that
the existing $MFT is beyond the new size.

11 years agoMade possible to run ntfsundelete on systems with no regex.h
Jean-Pierre André [Sat, 9 Feb 2013 10:56:09 +0000 (11:56 +0100)]
Made possible to run ntfsundelete on systems with no regex.h

The filtering of files to undelete is usually done through the regex
library. This patch offers an alternate way when such a library is
not readily available (typically on Windows).

11 years agoAvoided meaningless errors logging during ntfsundelete scans
Jean-Pierre André [Sat, 9 Feb 2013 10:51:40 +0000 (11:51 +0100)]
Avoided meaningless errors logging during ntfsundelete scans

When ntfsundelete scans the $MFT for possible deleted files, it may
examine extries which have never been used, producing error messages
which most users do not understand. This patch silences such messages.

11 years agoCosmetic : use symbolic names for ntfsclone control codes
Jean-Pierre André [Sat, 9 Feb 2013 10:48:54 +0000 (11:48 +0100)]
Cosmetic : use symbolic names for ntfsclone control codes

Defining symbolic names makes it easier to identify where they are used.

11 years agoAllowed cloning a file system despite allocation errors
Jean-Pierre André [Sat, 9 Feb 2013 10:41:39 +0000 (11:41 +0100)]
Allowed cloning a file system despite allocation errors

Allow the "--ignore-fs-check" option to be used when cloning a file system
which has allocation errors. This is useful when there is a fear that
repairing the file system might create further damage, or when the repair
has to be made on another computer.

11 years agoAdded a display of the location of an inconsistency in an image
Jean-Pierre André [Sat, 9 Feb 2013 10:37:31 +0000 (11:37 +0100)]
Added a display of the location of an inconsistency in an image

When an ntfsclone image appears to be corrupted, show at which position
the error happens. This is useful for providing support.

11 years agoFixed the ntfsfix option for testing in the manual
Jean-Pierre André [Sat, 9 Feb 2013 10:33:17 +0000 (11:33 +0100)]
Fixed the ntfsfix option for testing in the manual

The option for checking the behavior of ntfsfix without writing anything
is "--no-action", not "--do-nothing".

11 years agoAdded a new option for testing the consistency of an ntfsclone image
Jean-Pierre André [Sat, 9 Feb 2013 10:29:21 +0000 (11:29 +0100)]
Added a new option for testing the consistency of an ntfsclone image

This patch adds a new option -n to ntfsclone for simulating a restore
without writing anything. This is useful for checking the consistency
of an image without destroying the original partition.

11 years agoUpgraded the Win32 interface for use with ntfsprogs
Jean-Pierre André [Sat, 9 Feb 2013 10:22:41 +0000 (11:22 +0100)]
Upgraded the Win32 interface for use with ntfsprogs

Upgrade the Win32 interface (win32_io.c) which was designed for Cygwin
so that it can be used for using the ntfsprogs utilities on native Windows.
Two new entries are added for truncating a file and creating a sparse
file, both of which not being supported through msvcrt.dll.

11 years agoFixed wiping fragmented metadata when creating a metadata image
Jean-Pierre André [Sat, 9 Feb 2013 10:12:45 +0000 (11:12 +0100)]
Fixed wiping fragmented metadata when creating a metadata image

When creating a metadata image, all user data is supposed to be wiped off,
but this was wrong for $MFT and directory indexes when they were
fragmented. This patch cleans the tails of metadata fragments.

11 years agoAdded directions for getting a user mapping proposal through secaudit
Jean-Pierre André [Sat, 9 Feb 2013 10:06:39 +0000 (11:06 +0100)]
Added directions for getting a user mapping proposal through secaudit

The definition of the user mapping needed to interoperate permissions
with Windows is too complex for most users. Even the "usermap" utility
is too complex. This patch adds explanations for using the "-u" option
of secaudit to get a user mapping proposal

11 years agoVersion 2012.1.13
Szabolcs Szakacsits [Sun, 13 Jan 2013 06:31:50 +0000 (08:31 +0200)]
Version 2012.1.13

11 years agoRename legacy MS_* flags for ntfs_mount with NTFS_MNT_* flags.
Erik Larsson [Wed, 7 Nov 2012 15:29:48 +0000 (16:29 +0100)]
Rename legacy MS_* flags for ntfs_mount with NTFS_MNT_* flags.

The MS_* flags originated from system constants. However the flags
passed to ntfs_mount were really unrelated to the system constants and
many new MS_* flags had to be introduced as different features were
added to the library. Those flags had no counterparts in any system
APIs, so using the same naming scheme is inappropriate.

Instead, let's namespace these flags similarly to what has already been
done in ntfsprogs/libntfs earlier. This avoids any possible conflicts
with system constants.
The values of the flags themselves are kept the same as earlier, so
backward compatibility is retained.

11 years agoAPI cleanup of const arguments.
Erik Larsson [Wed, 7 Nov 2012 13:15:53 +0000 (14:15 +0100)]
API cleanup of const arguments.

- Replaced 'ntfschar*' parameters with 'const ntfschar*' where
  appropriate (the function does not need to modify the string).
- Replaced some instances of 'u8*' and 'char*' read-only buffer
  arguments with 'const u8*' and 'const char*'.

11 years agoconfigure.ac: Restructure uuid library detection.
Erik Larsson [Tue, 6 Nov 2012 09:30:48 +0000 (10:30 +0100)]
configure.ac: Restructure uuid library detection.

The 'uuid' library functionality may be located in a separate 'uuid'
library, but it may also be included in the standard C library. This is
the case on Mac OS X.

Instead of relying on the uuid code being located in a 'uuid' library,
we restructure the code so that it checks different libraries, in order
for the 'uuid_generate' function. This code is easy to extend if we
would find a new configuration where uuid_generate is located in a
different library.

11 years agontfsclone.c: Cleanup in error message.
Erik Larsson [Tue, 6 Nov 2012 07:23:04 +0000 (08:23 +0100)]
ntfsclone.c: Cleanup in error message.

11 years agoacls.c: Fix compiler warning regarding usage of uninitialized variable.
Erik Larsson [Tue, 6 Nov 2012 01:12:48 +0000 (02:12 +0100)]
acls.c: Fix compiler warning regarding usage of uninitialized variable.

This warning is really a false alarm, but fix it anyway.

11 years agontfsclone.c: Fix missing space in error message.
Erik Larsson [Tue, 6 Nov 2012 01:07:53 +0000 (02:07 +0100)]
ntfsclone.c: Fix missing space in error message.

11 years agoFix compilation of libfuse-lite on Solaris/OpenIndiana.
Erik Larsson [Sun, 28 Oct 2012 04:23:39 +0000 (05:23 +0100)]
Fix compilation of libfuse-lite on Solaris/OpenIndiana.

The OpenSolaris port of libfuse, from which our Solaris-port of
libfuse-lite originated, had to be supplied with some additional
compiler flags in order to compile.
The configure script now detects whether it is running on a Solaris
system. If that is the case it passes the proper compiler flags to
libfuse-lite, so it can compile properly.

Tested on:
- OpenIndiana oi_151a3 / gcc 3.4.3
- OpenIndiana oi_151a7 / gcc 4.3.3
- Solaris 11.1 / gcc 4.5.2

11 years agoconfigure.ac: Disable checks for libfuse when not building ntfs-3g.
Erik Larsson [Sat, 27 Oct 2012 11:18:07 +0000 (13:18 +0200)]
configure.ac: Disable checks for libfuse when not building ntfs-3g.

When we aren't building ntfs-3g but only the tools, then there's no need
for libfuse. Still the configure script checked for libfuse availability
and wouln't proceed unless either libfuse was detected or libfuse-lite
was enabled.

This commit fixes this issue by running the libfuse checks only when
ntfs-3g is built, meaning that we can now build the ntfsprogs even when
libfuse library or headers aren't available.

11 years agoInserted updated definitions of reparse tags into layout.h
Jean-Pierre André [Fri, 5 Oct 2012 08:42:19 +0000 (10:42 +0200)]
Inserted updated definitions of reparse tags into layout.h

Replace the obsolete definition of reparse tags in layout.h by the
current definitions from msdn, and use them in reparse.c instead of
redefining them.

11 years agoFixed a memory leak caused by disabling getting/setting DOS names
Jean-Pierre André [Fri, 5 Oct 2012 08:35:59 +0000 (10:35 +0200)]
Fixed a memory leak caused by disabling getting/setting DOS names

After rejecting a DOS name setting on a hardlinked file, the search
context has to be freed.

11 years agoDisabled getting/setting DOS names on hardlinked files
Jean-Pierre André [Wed, 3 Oct 2012 09:23:58 +0000 (11:23 +0200)]
Disabled getting/setting DOS names on hardlinked files

As the path passed to ntfs-3g for getxattr(2)/setxattr(2) are not
guaranteed to be the one mentioned by the caller when there are hard links,
getting/setting DOS names have to be discontinued in that situation.
Getting/setting DOS names is still possible when there is a single
non-DOS name.

11 years agoPrevented partitions with metadata cached in Windows from being mounted
Jean-Pierre André [Tue, 25 Sep 2012 07:46:54 +0000 (09:46 +0200)]
Prevented partitions with metadata cached in Windows from being mounted

Windows 8 includes a "fast restart" feature for restarting without fully
remounting the internal volumes. When this mode is selected, metadata
stored in the cache (probably hiberfil.sys) is used instead of what
is actually on disk, and this may lead to inconsistencies when changes
have been made by ntfs-3g in the meantime.

This patch tries to prevent ntfs-3g from mounting in read-write mode
when a fast restart of Windows 8 is detected. It relies on the restart
pages in the $LogFile being identified as version 2.0, which is
apparently related to data being cached for hibernation or fast restarting.

11 years agobootsect.c: Don't allow negative start clusters for $MFT/$MFTMirr.
Erik Larsson [Mon, 24 Sep 2012 09:35:41 +0000 (11:35 +0200)]
bootsect.c: Don't allow negative start clusters for $MFT/$MFTMirr.

Negative values for mft_lcn / mftmirr_lcn don't make any sense and must
be detected as corruptions.

11 years agoForced option ro when mounting a read-only device
Jean-Pierre André [Wed, 12 Sep 2012 07:47:36 +0000 (09:47 +0200)]
Forced option ro when mounting a read-only device

External devices, such as USB keys, may have a switch to make them
temporarily unwriteable. When such a device is plugged in, mount it
as read-only by default.

11 years agoAccepted processing restart pages v 2.0 with no warning (used by Windows 8)
Jean-Pierre André [Wed, 12 Sep 2012 07:42:24 +0000 (09:42 +0200)]
Accepted processing restart pages v 2.0 with no warning (used by Windows 8)

In the $LogFile, Windows 8 defines restart pages with version 2.0.
The checks designed for version 1.1 appear to apply, so accept v 2.0
and apply the usual checks.

11 years agoAllowed SACLs to to not have any ACE
Jean-Pierre André [Wed, 12 Sep 2012 07:36:21 +0000 (09:36 +0200)]
Allowed SACLs to to not have any ACE

Accept security descriptors in which the SACL is present though it does not
contain any ACE. Such security descriptors have been found in Windows
installation files.

11 years agoAdded an option to secaudit for getting a user mapping proposal
Jean-Pierre André [Wed, 12 Sep 2012 07:31:35 +0000 (09:31 +0200)]
Added an option to secaudit for getting a user mapping proposal

Get a user mapping proposal by designating a file created on Windows
by the user to be mapped to the current one on Linux.
This is expected to be easier to use than "usermap".

12 years agontfsinfo.c: Fix printing all the flags in hex in 'ntfs_dump_flags'.
Erik Larsson [Mon, 27 Aug 2012 19:26:57 +0000 (21:26 +0200)]
ntfsinfo.c: Fix printing all the flags in hex in 'ntfs_dump_flags'.

The variable 'flags' was modified along the way and did not contain the
original flags at the end as assumed by the last printout. Fixed by
storing the original state of the flags in a temporary const variable.

12 years agoAllowed commas within option fsname on OpenIndiana
Jean-Pierre André [Wed, 22 Aug 2012 09:08:20 +0000 (11:08 +0200)]
Allowed commas within option fsname on OpenIndiana

On OpenIndiana, the device names have commas in them. Do not interpret
commas as option separators within the option fsname. As a consequence
this option has to be the last one.

12 years agoMerged libfuse for OpenIndiana into libfuse-lite
Jean-Pierre André [Wed, 22 Aug 2012 09:02:36 +0000 (11:02 +0200)]
Merged libfuse for OpenIndiana into libfuse-lite

The libfuse used by OpenIndiana has the same features as libfuse-lite
though requiring some code variants. Merging them simplifies supporting
both.

Variants for OpenIndiana are selected when defining __SOLARIS__

12 years agoFixed the returned files types in readdir()
Jean-Pierre André [Mon, 20 Aug 2012 12:34:16 +0000 (14:34 +0200)]
Fixed the returned files types in readdir()

The type of special files (symlinks, fifos, etc.) was not returned in
readdir() and they appeared wrongly in the field d_type of "struct dirent".
This prevented some applications which relied on d_type (which does
not exist in Solaris) from navigating in an NTFS tree.

12 years agoFixed Windows-type inheritance for creator-owner ACE
Jean-Pierre André [Mon, 20 Aug 2012 12:29:51 +0000 (14:29 +0200)]
Fixed Windows-type inheritance for creator-owner ACE

Inheriting a creator-owner ACE the Windows way led to a buggy ACL

12 years agoRestored interpreting UTIME_NOW and UTIME_OMIT from external fuse >= 2.9
Jean-Pierre André [Mon, 20 Aug 2012 12:24:49 +0000 (14:24 +0200)]
Restored interpreting UTIME_NOW and UTIME_OMIT from external fuse >= 2.9

Use of UTIME_NOW and UTIME_OMIT had been temporarily removed when using
external fuse, because early versions of external fuse 2.9 did not
support them. They can now be restored as they are supported by released
versions of fuse 2.9

12 years agoMade secaudit to be runnable on OpenIndiana
Jean-Pierre André [Mon, 20 Aug 2012 12:22:10 +0000 (14:22 +0200)]
Made secaudit to be runnable on OpenIndiana

A few differences in dynamic linking.

12 years agoChanged "blocks" to "sectors" in the mkntfs manual
Jean-Pierre André [Mon, 20 Aug 2012 12:17:09 +0000 (14:17 +0200)]
Changed "blocks" to "sectors" in the mkntfs manual

The last (optional) argument in mkntfs was described as a block count,
which may be confusing because in ext[123] a block means a cluster.

12 years agoInserted in the manual an explanation for the $Info stream in $UpCase
Jean-Pierre André [Mon, 20 Aug 2012 12:14:15 +0000 (14:14 +0200)]
Inserted in the manual an explanation for the $Info stream in $UpCase

12 years agoInserted an $Info stream in $UpCase to comply with Windows 8
Jean-Pierre André [Mon, 20 Aug 2012 12:01:53 +0000 (14:01 +0200)]
Inserted an $Info stream in $UpCase to comply with Windows 8

Since Windows 8 a new stream is added to the upper case file to record
a CRC of the upper case data. This way, if the file does not match the
one defined on the current Windows system, chkdsk can tell whether the
file is damaged or just out of date, and an error is only displayed if
the file is damaged.

The $Info data has been checked to be ignored by Windows XP, Windows
Vista and Windows 7. If not present, chkdsk for Windows 8 complains about
a wrong upper case file.

12 years agoFixed the computation of named attributes sizes in mkntfs
Jean-Pierre André [Mon, 20 Aug 2012 11:57:00 +0000 (13:57 +0200)]
Fixed the computation of named attributes sizes in mkntfs

The named attributes sizes were wrongly computed in mkntfs. This did not
lead to visible errors so far owing to 8-byte alignments in attribute
records (current names $SDS, $R, $O, etc).

12 years agoCosmetic : avoided having a hardcoded knowledge of upcase table size in mkntfs
Jean-Pierre André [Mon, 20 Aug 2012 11:53:48 +0000 (13:53 +0200)]
Cosmetic : avoided having a hardcoded knowledge of upcase table size in mkntfs

12 years agoAvoided an unnecessary runlist update when appending data to a file
Jean-Pierre André [Mon, 20 Aug 2012 11:48:49 +0000 (13:48 +0200)]
Avoided an unnecessary runlist update when appending data to a file

Appending data to a file is done in two steps : first extending the
file to the required size, then inserting data in the created space.
There is no need to recompute the runlist at the end of the first
step, just be sure the original configuration is rolled back if inserting
data leads to an error.

12 years agoFixed displaying progress percentage for metadata images
Jean-Pierre André [Mon, 20 Aug 2012 11:44:33 +0000 (13:44 +0200)]
Fixed displaying progress percentage for metadata images

When building (options -ms) or restoring a metadata image, the progress
percentages were wrong (evaluated against a wrong base)

12 years agoIgnored permissions when listing xattrs for special files
Jean-Pierre André [Mon, 20 Aug 2012 10:45:21 +0000 (12:45 +0200)]
Ignored permissions when listing xattrs for special files

Special files (FIFOs, SOCKETs, etc.) are not allowed to have user extended
attributes. When listing their extended attributes, return none without
checking whether the calling process is allowed to access these files.

12 years agoExtended Windows-type ACL inheritance, as needed by Windows 8
Jean-Pierre André [Mon, 20 Aug 2012 10:36:45 +0000 (12:36 +0200)]
Extended Windows-type ACL inheritance, as needed by Windows 8

Windows 8 uses "Authenticated user" principals which needs to be replaced
by the actual owner when inheriting

12 years agoProcessed ACLs with no mentioned rights for owner (used by Windows8)
Jean-Pierre André [Mon, 20 Aug 2012 10:28:15 +0000 (12:28 +0200)]
Processed ACLs with no mentioned rights for owner (used by Windows8)

Windows 8 uses ACL patterns in which the owner has only implicit rights
(pattern not used by previous Windows versions)

12 years agoFixed the fixing of the backup boot sector in ntfsfix
Jean-Pierre André [Fri, 6 Jul 2012 07:56:50 +0000 (09:56 +0200)]
Fixed the fixing of the backup boot sector in ntfsfix

ntfsfix now checks and update the backup boot sector on the last sector of
the partition (instead of the sector next to end of the file system). After
an ntfsresize the file system generally does not use the maximum size because
of different roundings and required alignments in the resizing and the
repartitioning.

12 years agoProcessed junctions and symlinks whose target references another one
Jean-Pierre André [Fri, 6 Jul 2012 07:48:05 +0000 (09:48 +0200)]
Processed junctions and symlinks whose target references another one

When the target of a junction or a Windows-type symlink references another
junction or symlink, the search for the full path on the current partition
and its translation for case-sensitive access is interrupted. The target can
now be dereferenced, provided the end of the path needed no translation.

12 years agoExtended the wiping of file tails to all data attributes in ntfswipe
Jean-Pierre André [Mon, 18 Jun 2012 11:00:17 +0000 (13:00 +0200)]
Extended the wiping of file tails to all data attributes in ntfswipe

This patch adds the wiping of the tails of named data attributes to
ntfswipe.

12 years agoAdded processing of SACLs to secaudit on Windows (nickgarvey)
Jean-Pierre André [Mon, 18 Jun 2012 10:57:40 +0000 (12:57 +0200)]
Added processing of SACLs to secaudit on Windows (nickgarvey)

This patch adds the processing of SACLs to secaudit on Windows, but
requested the required privileges.

12 years agoAdded inheritance of the set-group-id flag
Jean-Pierre André [Mon, 18 Jun 2012 10:53:25 +0000 (12:53 +0200)]
Added inheritance of the set-group-id flag

So far the set-group-id flag could be set in a chmod. This patch enables
the inheritance of the group to files and subdirectories, and the
inheritance of the set-group-id flag to subdirectories.

12 years agoRemoved the suggestions to use option remove_hiberfile
Jean-Pierre André [Mon, 18 Jun 2012 10:46:21 +0000 (12:46 +0200)]
Removed the suggestions to use option remove_hiberfile

The suggestion to use option remove_hiberfile was displayed in the
standard help and when a volume is found dirty. As this option may
lead to loss of data, only mention it in the manual, with a proper
warning.

12 years agoAdded optional wiping of file tails and undelete data to ntfswipe (Bogdan)
Jean-Pierre André [Mon, 18 Jun 2012 10:41:51 +0000 (12:41 +0200)]
Added optional wiping of file tails and undelete data to ntfswipe (Bogdan)

Added more wiping options to ntfswipe (to avoid leaking of deleted data).

12 years agoAdded an optional argument (number of seconds) to the option delay_mtime
Jean-Pierre André [Mon, 18 Jun 2012 10:34:56 +0000 (12:34 +0200)]
Added an optional argument (number of seconds) to the option delay_mtime

The option delay_mtime avoid updating the mtime of a file after each
individual updating. With this patch, the frequency of the update can
be adjusted to needs (default 60s). This is mainly useful for big files
which are kept open for a long period (file system images, virtual
computers, etc.)

12 years agoProcessed ACL inheritance for authenticated users
Jean-Pierre André [Mon, 18 Jun 2012 10:27:38 +0000 (12:27 +0200)]
Processed ACL inheritance for authenticated users

Under some conditions, Windows defines an ACL inheritance for an
unidentified authenticated user. With this patch, such an unidentified
user is treated as any user (same as "world").

12 years agoFixed a wrong computation of ACL size (minor issue)
Jean-Pierre André [Mon, 18 Jun 2012 10:26:36 +0000 (12:26 +0200)]
Fixed a wrong computation of ACL size (minor issue)

12 years agoAdded allocation data to output of "ntfsinfo -m"
Jean-Pierre André [Mon, 18 Jun 2012 10:19:27 +0000 (12:19 +0200)]
Added allocation data to output of "ntfsinfo -m"

Volume state and the level of allocation were added to the output
of "ntfsinfo -m", they are useful to identify the state of a volume.

12 years agoImplemented the fixing of the backup boot sector in ntfsfix
Jean-Pierre André [Wed, 21 Mar 2012 18:35:30 +0000 (19:35 +0100)]
Implemented the fixing of the backup boot sector in ntfsfix

This checks the backup boot sector and fixes it as needed.