Commit Graph

4610 Commits

Author SHA1 Message Date
Jean-Pierre André
37ae85a9d5 Cosmetic : moved the basename(3) redefinition to a better location
basename(3) is not available on OpenIndiana and had to be redefined.
Just move the redefinition to a more standard location
2012-03-21 19:09:52 +01:00
Jean-Pierre André
2b779a6510 Implemented the check for already mounted device on OpenIndiana
This adds a variant for checking on OpenIndiana whether a device
is mentioned in /etc/mnttab as being mounted.
2012-03-21 19:01:33 +01:00
Jean-Pierre André
66416041ec Reverted the workaround for ftruncate() and access(W_OK) on OpenIndiana
The special tests for accepting ftruncate(2) and access(W_OK) applied
to a file being created read-only have been implemented in the fuse
kernel module, so there is no need to duplicate them in the file system.
2012-03-21 18:56:05 +01:00
Jean-Pierre André
1c93e2a97d Avoided setuid/setgid removal by chown on OpenIndiana
On OpenIndiana, it is not customary to remove the setuid/setgid flags
when doing a chown, so comply with the local rules.
2012-03-21 18:52:07 +01:00
Jean-Pierre André
319958545e Made sure directories are not hard linked
On OpenIndiana the fuse kernel module does not prevent link(2) from
hard linking directories, so this has to be done in the lowntfs-3g
driver.
2012-03-21 18:48:38 +01:00
Jean-Pierre André
e82240f499 Made sure rmdir is only used for directories, and unlink otherwise
On OpenIndiana the fuse kernel module does not prevent unlink(2)
from deleting directories, nor prevent rmdir(2) from deleting files,
so this has to be done in the lowntfs-3g driver.
2012-03-21 18:42:29 +01:00
Jean-Pierre André
f78cc45208 Implemented supplementary group checks for OpenIndiana
Checking supplementary groups permissions to access a file relies on
a supplementary group list available in /proc/PID. This patch adds a
variant to implement the checks based on the specific format used
by OpenIndiana.
2012-03-21 18:34:48 +01:00
Jean-Pierre André
66d30c86b3 Implemented an option to set a new serial number in ntfslabel
Defined new options --new-serial and --new-half-serial to set a new
serial number (either the given one or a random one) to a file system.
Useful for mounting the original and the cloned file system at the
same time.
2012-01-23 18:22:59 +01:00
Jean-Pierre André
54f96e4af1 Implemented an option to set a new serial number in ntfsclone
Defined new options --new-serial and --new-half-serial to set a new
random serial number when cloning or restoring a file system.
Useful for mounting the original and the cloned file system at the
same time.
2012-01-23 18:19:17 +01:00
Jean-Pierre André
e7bfd31de4 Fixed clearing user data when creating metadata images
Clearing of user data was wrong when extracting the metadata into a
special format image. In this situation the clearing has to be done
without mounting the file system.
2012-01-23 18:13:59 +01:00
Jean-Pierre André
4a0892eb26 Implemented a new option -q to avoid updating the progress information (Matthew Boyle)
The progress bars complexify the integration of ntfsclone into other
tools, the option -q (or --quiet) gets rid of them.
2012-01-23 18:10:26 +01:00
Jean-Pierre André
cd0be288b9 Fixed debug check for double opening after deleting an inode
A debug check could be defeated when a deleted inode number was reused.
2012-01-23 18:05:27 +01:00
Jean-Pierre André
a5e656751d Worked around basename(3) not present on OpenIndiana 2012-01-23 18:03:59 +01:00
Jean-Pierre André
e85d986494 Put the device name as the last option
On OpenIndiana the device names have commas, so put it as the last option
to prevent defeating the options parsing.
2012-01-23 18:00:18 +01:00
Jean-Pierre André
08ad3b4977 Mounted with an absolute mount point on OpenIndiana
OpenIndiana requires that the mount points be defined on a full
absolute patch. Give it what it needs.
2012-01-23 17:56:15 +01:00
Jean-Pierre André
458c5eb191 Worked around write checks for ftruncate() and access(W_OK) on OpenIndiana
When a file is created with no write permissions, ftruncate and
access(W_OK) should be allowed, but this check has to be made by the
file system on OpenIndiana.
This patch is not active on Linux (#ifdef'ed)
2012-01-23 17:49:38 +01:00
Jean-Pierre André
b25178fec3 Strengthened sanity checks on readdir/closedir
Be more defensive against readdir() on closed directories.
2012-01-23 17:45:12 +01:00
Jean-Pierre André
ac8a980e7a Preferred access control by file system on OpenIndiana
ntfs-3g cannot reliably use the access control made by the kernel on
OpenIndiana, so do it at the file system level until this is solved.
2012-01-23 17:39:47 +01:00
Jean-Pierre André
d85675bf6d Returned unmount errors in ntfs-3g.probe (Diego Elio Petteno)
ntfs-3g.probe is used to get information about mounting errors, this
extends the use for unmounting errors.
2012-01-23 17:34:19 +01:00
Jean-Pierre André
528b4303b2 Accepted multiple read-only mounts
Multiple mounts of a partition is now allowed provided they are all
in read-only mode.
2012-01-23 17:31:15 +01:00
Jean-Pierre André
c9edd32113 changed error return for user access to trusted xattr
When a user queries an extended attribute in the trusted namespace,
the traditional error return was EPERM. This has been recently changed
to ENODATA. See https://lkml.org/lkml/2011/5/27/199
2012-01-23 17:25:55 +01:00
Jean-Pierre André
0aa68c128d output the numbers of runs and fragments in ntfsinfo
It is difficult to identify whether a file from a user complaining about
bad throughput is over-fragmented, so get the information from ntfsinfo.
2012-01-23 17:20:20 +01:00
Jean-Pierre André
3c6e88cb0f fixed checking whether Windows 7 was hibernated
On Windows XP and Vista, the system hibernation is identified by the
sequence "hibr" at the beginning of hiberfil.sys. This had been changed
to "HIBR" in Windows 7, so both sequences have to be accepted as
hibernation criteria.
2012-01-23 17:16:07 +01:00
Jean-Pierre André
5593ee2711 fixed clearing the end of extents when extracting metadata
When extracting the metadata, unused data at the end of MFT records is
supposed to be cleared. This was done for the base record of each file,
but not for the extent records.
2012-01-23 17:11:46 +01:00
Jean-Pierre André
4ce33daf6c Cosmetic : fixed an indentation in unistr 2012-01-23 17:09:19 +01:00
Jean-Pierre André
162b4f8051 Fixed clearing the bad cluster list in ntfsfix
Clearing the bad cluster list was done by truncating $BadClus:$Bad,
this turned out not to be reliable because chkdsk does not adjust
the size of $BadClus:$Bad when declaring a cluster bad.
2012-01-23 16:59:49 +01:00
Jean-Pierre André
9b5bd2cbbc Allowed building for kfreebsd (Robert Millan)
Extended several #ifdef's to account for "FreeBSD kernel"
2012-01-23 16:55:04 +01:00
Jean-Pierre André
d06ee35332 Used ENOENT instead of ENODATA when the latter is not defined (Robert Millan)
ENODATA is not defined by Posix and is lacking on FreeBSD
2012-01-23 16:50:25 +01:00
Szabolcs Szakacsits
e38154dde2 Version 2012.1.15 2012-01-15 15:21:52 +02:00
Erik Larsson
e08c40170b Prefix all functions and macros in ntfsprogs/list.h with 'ntfs_/NTFS_'.
This avoids name collisions with Mac OS X system headers (specifically
/usr/include/sys/queue.h). It's quite possible that other operating
systems also have similarly named macros in their system headers since
the function/macro names are very generic.
2012-01-13 13:37:33 +01:00
Erik Larsson
9fca9caf5c ntfswipe.c: Deduplicated MFT write code in wipe_mft. 2012-01-13 08:54:46 +01:00
Erik Larsson
50774cd274 ntfswipe.c: Code cleanup.
Changed the code to use the structs in layout.h instead of addressing
byte addresses directly. This makes the code a lot more readable.
2012-01-13 08:54:46 +01:00
Erik Larsson
7e2ee67097 ntfswipe.c: Big endian fix for wipe_mft.
The 'bytes_in_use' member was not byteswapped after being read from the
buffer and used in a calculation.
2012-01-13 08:54:46 +01:00
Erik Larsson
887ccbf868 ntfswipe.c: Write newly manufactured MFT entries to $MFTMirr if needed.
'wipe_mft' didn't write any $MFTMirr entries for newly manufactured
entries (i.e. entries that were unused and therefore competely wiped and
replaced with a newly initialized copy).
2012-01-13 08:54:46 +01:00
Erik Larsson
7213211c96 ntfswipe.c: Fixed writing incorrect $MFTMirr entries in wipe_mft.
The dereferencing of 'offset' and 'usa' from the MFT record wasn't an
le16* dereference but a u8* dereference, leading to only the least
significant byte (little-endian systems) or the most significant byte
(big-endian systems) being part of the value. (So while this bug could
go unnoticed on little-endian systems for volumes with small values of
'usa', it caused even more significant problems on big-endian systems.)

Fixed by properly casting the address to le16* before dereferencing.
2012-01-13 08:54:46 +01:00
Erik Larsson
82ea9c6e07 ntfswipe.c: Fix support for non-1024 byte MFT record sizes in wipe_mft.
'wipe_mft' was hardcoded to use the USA size of a 1024 byte MFT record
when creating new blank MFT entries. It now calculates the USA size
based on vol->mft_record_size.
2012-01-13 08:54:45 +01:00
Erik Larsson
5f7c535b55 utils.c: Fixed apparently incorrect initial value of 'bmpmref'.
This bug led 'utils_mftrec_in_use' to use 'cached' data before it had
been initialized (i.e. its contents was undefined), producing incorrect
results for the first 3584 MFT entries.
2012-01-13 08:54:45 +01:00
Jean-Pierre André
debeb762c1 secaudit : minor : fixed a false memory leak detection 2011-11-10 21:34:39 +01:00
Jean-Pierre André
2fb7a43638 secaudit : prefixed owner and group SID in ACL display 2011-11-10 21:33:06 +01:00
Jean-Pierre André
1df34a6056 New : implemented an option -d to clear the dirty flag if ntfsfix is successful 2011-11-04 11:15:01 +01:00
Jean-Pierre André
cb3aad8a63 Minor : fixed a test of volume dirty flag in ntfsfix 2011-11-04 11:11:40 +01:00
Jean-Pierre André
b76883dc84 major : Fixed computation of index block size (Anton Altaparmakov)
When the cluster size is bigger than the index block size, the index
block size unit is 512 (not the sector size) instead of the cluster size.
The partitions formatted by mkntfs and used by ntfs-3g were not
interoperable with Windows when the cluster size is bigger than 4K
and the sector size is not 512.
2011-11-04 11:01:11 +01:00
Jean-Pierre André
4629a7af14 manual : Added a warning against checks at boot time
The booting process has recently been changed so that partitions
which are requested to be checked at mount time with no checker
available, cause a specific user interaction while booting.
The patch warns users against requesting such a check, as there
is no known open-source ntfs file system checker.
2011-10-20 19:11:38 +02:00
Jean-Pierre André
864cf7232e Fixed huge data writes
When computing the runlist for the first non-resident write to an
attribute, an inconsistency was created between the attribute image
and the ntfs_attr structure, which could cause an MFT record overflow
when the first write is huge and fragmented (reported by Vito Caputo).
2011-10-20 19:05:27 +02:00
Jean-Pierre André
59ecea5c80 new : allow compression in default setup
With the default mount options, compression of new files are now done
if the parent directory is marked for compression. The mount option
"compression" is not needed any more, but the option "nocompression"
can be used to disable compression of new files.

The default option also applies to applications using libntfs-3g with
no mount command.
2011-10-20 18:55:32 +02:00
Jean-Pierre André
69549be496 fix : fed in the available space in ntfscp 2011-10-20 18:51:15 +02:00
Jean-Pierre André
650eaddb89 new : allowed compression in ntfscp 2011-10-20 18:49:58 +02:00
Szabolcs Szakacsits
360e9475f4 Release 2011.10.9-RC 2011-10-09 11:29:41 +03:00
Jean-Pierre André
328f36447e Inserted the inode number when naming unnamed undeleted files
When undeleting a file whose name cannot be recovered, this patch
defines a name to which the inode number is appended to facilitate
a bulk recovery (recovering the unwanted deletion of a subtree).
2011-10-07 11:52:21 +02:00
Jean-Pierre André
6e52a39608 Added to ntfsundelete an attempt to recover the name of a deleted file
When a file is deleted, ntfs-3g deletes the name from the MFT record,
so the name is not available when the file has to be undeleted.
This patch tries to recover the name when it has not been overwritten.
This is mostly possible when data is non-resident and not fragmented.
2011-10-07 11:45:47 +02:00