Commit Graph

4687 Commits

Author SHA1 Message Date
Jean-Pierre André
6aa24b3df3 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.
2013-02-13 08:54:34 +01:00
Jean-Pierre André
0e91e1a9ae 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.
2013-02-13 08:51:47 +01:00
Jean-Pierre André
9442db0d8b 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.
2013-02-12 15:45:54 +01:00
Jean-Pierre André
1e625a9563 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.
2013-02-09 15:19:34 +01:00
Jean-Pierre André
2737f9cbd0 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.
2013-02-09 15:12:56 +01:00
Jean-Pierre André
a6b765c824 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.
2013-02-09 15:07:06 +01:00
Jean-Pierre André
a086683ece 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.
2013-02-09 15:04:41 +01:00
Jean-Pierre André
c73b805062 Rejected reading a volume from stdin in ntfsclone
Reading a volume must be done in a seekable way. Better throw a proper
error.
2013-02-09 15:01:36 +01:00
Jean-Pierre André
c72b569da1 Ported ntfsundelete to Windows
Made a few adaptations to what is available on Windows.
2013-02-09 14:56:46 +01:00
Jean-Pierre André
c17512cde5 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.
2013-02-09 12:57:22 +01:00
Jean-Pierre André
e6eae9fa16 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.
2013-02-09 12:54:44 +01:00
Jean-Pierre André
88de9987a0 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.
2013-02-09 12:53:38 +01:00
Jean-Pierre André
d32c593521 Revert "Ported ntfsclone to Windows", should be "Fixed bad copying of the backup boot sector"
This reverts commit 92cd41b6e5.

The title and description were wrong
2013-02-09 12:50:16 +01:00
Jean-Pierre André
92cd41b6e5 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.
2013-02-09 12:14:19 +01:00
Jean-Pierre André
c4f65e05c4 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.
2013-02-09 12:12:02 +01:00
Jean-Pierre André
2e2550026e 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.
2013-02-09 12:08:58 +01:00
Jean-Pierre André
aebfcf3d27 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.
2013-02-09 12:00:02 +01:00
Jean-Pierre André
b2e1dbbf38 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).
2013-02-09 11:56:09 +01:00
Jean-Pierre André
c972652876 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.
2013-02-09 11:51:40 +01:00
Jean-Pierre André
61eceb2fe5 Cosmetic : use symbolic names for ntfsclone control codes
Defining symbolic names makes it easier to identify where they are used.
2013-02-09 11:48:54 +01:00
Jean-Pierre André
81eb7baf88 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.
2013-02-09 11:41:39 +01:00
Jean-Pierre André
c820cb6d76 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.
2013-02-09 11:37:31 +01:00
Jean-Pierre André
412f09d87d 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".
2013-02-09 11:33:17 +01:00
Jean-Pierre André
7c83060553 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.
2013-02-09 11:29:21 +01:00
Jean-Pierre André
44fbf02a97 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.
2013-02-09 11:22:41 +01:00
Jean-Pierre André
7cb4b99627 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.
2013-02-09 11:12:45 +01:00
Jean-Pierre André
6caa1b0bda 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
2013-02-09 11:06:39 +01:00
Szabolcs Szakacsits
d3dad801b3 Version 2012.1.13 2013-01-13 08:31:50 +02:00
Erik Larsson
7506d8b80b 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.
2012-11-07 16:29:48 +01:00
Erik Larsson
ebb38c4b1c 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*'.
2012-11-07 14:15:53 +01:00
Erik Larsson
ea55e5e3c8 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.
2012-11-06 10:30:48 +01:00
Erik Larsson
11a7e8297d ntfsclone.c: Cleanup in error message. 2012-11-06 08:23:04 +01:00
Erik Larsson
2bee30c2f7 acls.c: Fix compiler warning regarding usage of uninitialized variable.
This warning is really a false alarm, but fix it anyway.
2012-11-06 02:12:48 +01:00
Erik Larsson
e85f9305c1 ntfsclone.c: Fix missing space in error message. 2012-11-06 02:07:53 +01:00
Erik Larsson
72bea99a8f 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
2012-10-28 05:23:39 +01:00
Erik Larsson
941a22e7f8 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.
2012-10-27 13:18:07 +02:00
Jean-Pierre André
761ba29110 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.
2012-10-05 10:42:19 +02:00
Jean-Pierre André
4d3967840c 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.
2012-10-05 10:35:59 +02:00
Jean-Pierre André
67fa6273cf 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.
2012-10-03 11:23:58 +02:00
Jean-Pierre André
559270a8f6 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.
2012-09-25 09:46:54 +02:00
Erik Larsson
9337e0a069 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.
2012-09-24 12:57:22 +02:00
Jean-Pierre André
0b2a85b612 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.
2012-09-12 09:47:36 +02:00
Jean-Pierre André
4d0b9163c9 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.
2012-09-12 09:42:24 +02:00
Jean-Pierre André
c31c7463e8 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.
2012-09-12 09:36:21 +02:00
Jean-Pierre André
2223b8796c 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".
2012-09-12 09:31:35 +02:00
Erik Larsson
7c600754dd 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.
2012-08-27 21:26:57 +02:00
Jean-Pierre André
9403b9e44f 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.
2012-08-22 11:08:20 +02:00
Jean-Pierre André
97342d05bc 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__
2012-08-22 11:02:36 +02:00
Jean-Pierre André
3e4c439520 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.
2012-08-20 14:34:16 +02:00
Jean-Pierre André
3953e929bb Fixed Windows-type inheritance for creator-owner ACE
Inheriting a creator-owner ACE the Windows way led to a buggy ACL
2012-08-20 14:29:51 +02:00