Commit Graph

4833 Commits

Author SHA1 Message Date
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
Jean-Pierre André
fa158031f2 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
2012-08-20 14:24:49 +02:00
Jean-Pierre André
f61aaf012c Made secaudit to be runnable on OpenIndiana
A few differences in dynamic linking.
2012-08-20 14:22:10 +02:00
Jean-Pierre André
3461acd0c2 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.
2012-08-20 14:17:09 +02:00
Jean-Pierre André
eecc700df1 Inserted in the manual an explanation for the $Info stream in $UpCase 2012-08-20 14:14:15 +02:00