Commit Graph

80 Commits

Author SHA1 Message Date
Jean-Pierre André
004709fcc1 Silenced warnings about fallthrough situations in switch cases of ntfsprogs
Insert comments to silence compiler about fallthrough situations when
they are wanted.
2020-03-08 09:38:00 +01:00
Jean-Pierre André
79ea3b49b1 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.
2017-03-22 17:49:40 +01:00
Erik Larsson
038a45a8a1 Fix compilation errors on OpenIndiana caused by missing limit macros. 2016-02-16 20:43:00 +01:00
Erik Larsson
9893ea9ee6 Merge endianness fixes.
Conflicts:
	libntfs-3g/attrib.c
2016-01-28 09:22:42 +01:00
Erik Larsson
9cf04fd2cd Fix incorrect usage of native/little-endian types, signed types, etc.
This is harmless with regard to code generation but if we turn on strict
type checking these type mismatches will result in errors.
2015-12-21 23:55:31 +01:00
Erik Larsson
dfa4a6647f Fix code to use const_cpu_to_X/const_X_to_cpu macros for constants.
This enables the compiler to optimize this code in cases where compiler
support for endianness swapping is not present.
2015-12-21 23:21:00 +01:00
Jean-Pierre André
cba621e822 Silenced a compiler warning in ntfswipe (cosmetic)
Avoid a signed-to-unsigned compare warning
2015-11-09 15:58:00 +01:00
Jean-Pierre André
baab4c287e Added a sanity check to ntfswipe
Unused entries in the MFT may have a bad length leading to fetch fixups
from unallocated memory. Check the condition, but do not wipe, leave it
to chkdsk to decide what should be fixed.
2015-04-17 10:49:23 +02:00
Jean-Pierre André
1e8ae121fc Rephrased a misleading report message in ntfswipe
When using the "--no-action" option, ntfswipe should display a count
of would-be wiped bytes without suggesting any has been wiped.
2015-04-17 09:42:19 +02:00
Jean-Pierre André
e43f58e0e4 Avoided logging meaningless fixup errors in ntfswipe
As ntfswipe examines all MFT entries, it may find uninitialized ones.
They should not be considered as erroneous ones even if the fixups
are wrong.
2015-04-17 09:37:11 +02:00
Jean-Pierre André
e7b71bb78d Avoided mentioning deleted inodes in non-verbose output of ntfswipe
In non-verbose ntfswipe, avoid displaying deleted inodes as erroneous
ones.
2015-04-17 09:33:04 +02:00
Jean-Pierre André
a7aa91d73d Developped an option --unused-fast for faster ntfswipe
When the new option --unused-fast is used, clusters which appear as wiped
are not written again. This is useful for avoiding virtual partitions to
be extended to their full size.

Contributed by michael
2014-09-02 09:55:53 +02:00
Jean-Pierre André
c0287870e1 Returned success from ntfsprogs utilities with options --version and --help
The ntfsprogs used to return failure when option --version or --help
was used, and this has triggered complains from distribution packagers
who use these options in packaging scripts.
With this patch, success is returned (same behavior as gcc).
2014-04-23 10:13:27 +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
Jean-Pierre André
ab6f7c027d 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.
2012-06-18 13:00:17 +02:00
Jean-Pierre André
24c9f19065 Added optional wiping of file tails and undelete data to ntfswipe (Bogdan)
Added more wiping options to ntfswipe (to avoid leaking of deleted data).
2012-06-18 12:41:51 +02: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
Jean-Pierre André
0ec31405c6 Fixed casting data to printf format in ntfsck, ntfsmove and ntfswipe 2011-07-05 12:17:28 +02:00
Erik Larsson
bcdc76f12d Merge remote branch 'linux-ntfs/libntfs-3g_port-v2_0_0' into PERMISSION_HANDLING_BRANCH
Conflicts:
	.cvsignore
	AUTHORS
	CREDITS
	ChangeLog
	NEWS
	README
	TODO.libntfs
	autogen.sh
	configure.ac
	include/ntfs/Makefile.am
	libntfs-3g/misc.c
	libntfs/Makefile.am
	libntfs/gnome-vfs-method.c
	libntfs/gnome-vfs-module.c
	ntfsprogs.spec.in
	ntfsprogs/.cvsignore
	ntfsprogs/mkntfs.c
	ntfsprogs/ntfscat.8.in
	ntfsprogs/ntfsclone.c
	ntfsprogs/ntfscp.8.in
	ntfsprogs/ntfsinfo.c
	ntfsprogs/ntfsprogs.8.in
	ntfsprogs/ntfsresize.c
	ntfsprogs/ntfsrm.c
	ntfsprogs/ntfsundelete.h
	ntfsprogs/upcase.c
	ntfsprogs/utils.c
	test/Makefile.am
2010-12-17 09:04:01 +01:00
Erik Larsson
16dbcbec0c Restored 'local' includes for all the ntfsprogs instead of using system includes (e.g. #include "yada.h" instead of #include <ntfs-3g/yada.h>). 2010-12-16 09:59:42 +01:00
Erik Larsson
18789cdeaa Replaced all occurrences of the libntfs mount flag NTFS_MNT_FORCE with the libntfs-3g mount flag MS_RECOVER.
Note: The NTFS_MNT_FORCE, in addition to what MS_RECOVER does, also bypasses the check for the 'dirty' bit in libntfs' ntfs_mount.
However, this check does not exist in libntfs-3g (libntfs-3g will not check or change the dirty bit, being confident that it can handle volumes marked as 'dirty'), so in essence the same behaviour is achieved with MS_RECOVER.
2010-12-02 22:37:06 +01:00
Erik Larsson
6ff5d3f8a7 Replaced all occurrences of the libntfs mount flag NTFS_MNT_RDONLY with the corresponding libntfs-3g mount flag MS_RDONLY. 2010-12-02 22:36:58 +01:00
Erik Larsson
f5f3878a8e Replaced all occurrences of the libntfs-specific NVolWasDirty macro with a test for the VOLUME_IS_DIRTY flag in vol->flags.
This is not a perfect conversion. The VOLUME_IS_DIRTY flag reflects the _current_ state of the volume dirty bit and not the mount-time state.
However, since libntfs-3g (as opposed to libntfs) does not automatically change the dirty bit on mount and unmount (only when ntfs_volume_write_flags is called explicitly), and these tests are done directly after a mount (ntfsclone.c, ntfscp.c, ntfsresize.c, ntfswipe.c, utils.c) or when the volume is in an appropriate state (ntfsfix.c), the result will be the same.
2010-12-02 22:34:35 +01:00
Erik Larsson
713fbb390e Merge commit 'v2_0_0' into libntfs-3g_port-v2_0_0
Conflicts:
	configure.ac
	include/ntfs/Makefile.am
	include/ntfs/attrib.h
	include/ntfs/bitmap.h
	include/ntfs/collate.h
	include/ntfs/debug.h
	include/ntfs/dir.h
	include/ntfs/endians.h
	include/ntfs/index.h
	include/ntfs/inode.h
	include/ntfs/layout.h
	include/ntfs/logfile.h
	include/ntfs/logging.h
	include/ntfs/mft.h
	include/ntfs/ntfstime.h
	include/ntfs/runlist.h
	include/ntfs/support.h
	include/ntfs/types.h
	include/ntfs/unistr.h
	include/ntfs/volume.h
	libntfs/Makefile.am
	libntfs/attrib.c
	libntfs/attrlist.c
	libntfs/bitmap.c
	libntfs/bootsect.c
	libntfs/collate.c
	libntfs/compress.c
	libntfs/debug.c
	libntfs/device.c
	libntfs/device_io.c
	libntfs/dir.c
	libntfs/index.c
	libntfs/inode.c
	libntfs/lcnalloc.c
	libntfs/logfile.c
	libntfs/logging.c
	libntfs/mft.c
	libntfs/mst.c
	libntfs/runlist.c
	libntfs/security.c
	libntfs/unistr.c
	libntfs/unix_io.c
	libntfs/volume.c
	libntfs/win32_io.c
	ntfsprogs/Makefile.am
	ntfsprogs/mkntfs.c
	ntfsprogs/ntfscat.c
	ntfsprogs/ntfsclone.c
	ntfsprogs/ntfscmp.c
	ntfsprogs/ntfscp.c
	ntfsprogs/ntfsinfo.c
	ntfsprogs/ntfsmount.8.in
	ntfsprogs/ntfsmount.c
	ntfsprogs/ntfsundelete.c
	ntfsprogs/upcase.c
2010-12-02 22:31:21 +01:00
Erik Larsson
6f42c011be ntfswipe.c: Adapt to the changed interface of ntfs_rl_pwrite in libntfs-3g.
ntfs_rl_pwrite has an additional parameter, ofs, in libntfs-3g. Setting ofs to 0 seems to imply the same behaviour as expected from the libntfs equivalent.
2010-12-02 17:03:08 +01:00
Erik Larsson
196f7f6461 Commented out all references to 'version.h' in the 'extra' utilities until libntfs-3g supports such functionality. 2010-12-02 16:49:56 +01:00
Erik Larsson
07bc8d9d17 Redirected all libntfs includes in the 'extra' utilities to libntfs-3g. 2010-12-02 16:47:06 +01:00
Erik Larsson
5b9b4c7e49 Removing all references to the libntfs library version until we have such functionality in libntfs-3g. 2010-12-02 16:38:16 +01:00
Yura Pakhuchiy
37476cf609 Introduce NTFS_MNT_FORCE instead of third parameter of utils_mount_volume 2007-09-15 18:12:32 +03:00
aia21
5302d23f7b - Empty the journal at mount time. (Anton)
- Set the volume dirty bit at mount time (if it is not set already and
  clear it again at umount time but only if it was not set to start
  with.  (Anton)
2006-11-28 10:09:56 +00:00
yura
cb27c9f616 * Rename MS_{RDONLY,NOATIME} to NTFS_MNT_{RDONLY,NOATIME}.
* Introduce NTFS_MNT_CASE_SENSITIVE.
2006-11-12 22:46:50 +00:00
szaka
c7a53338c0 Fix all incorrect getopt_long() return value usages. 2006-04-05 12:43:06 +00:00
flatcap
8a363705cd upgrade to use new logging
change stderror messages to ntfs_log_perror
2005-10-28 18:23:32 +00:00
flatcap
8a584700c5 whitespace fixes - no code changes 2005-10-26 22:54:57 +00:00
uvman
0dd0cdc6be Remove {Dputs, Dprintf, Dperror} and convert callers to ntfs_log_*. Make ntfsinfo use ntfs_logging_parse_option(). 2005-10-25 01:28:10 +00:00
szaka
746dff1a24 NTFS_INDEX_ prefix $I30, $SII, $SDH, $O and $Q indexes 2005-10-23 18:35:58 +00:00
antona
0c293d0407 - Add API (actually renamed from what Rich/FlatCap did):
volume.[hc]::ntfs_libntfs_version() which returns a pointer to a
  static const string of the libntfs verion, i.e. at the moment this is
  "8.0.0".  This required moving the version specifications from
  libntfs/Makefile.am to configure.ac.  This should hopefully have the
  sideeffect that I will remember to increment it when incrementing the
  ntfsprogs version number when making a release given the two are
  right under one another.  (Anton)
- Change ALL utilities to display the libntfs version they are running
  on.  This should make debugging easier in the case that people are
  running mismatched utilities/library.  (Anton)
2005-10-07 14:10:56 +00:00
antona
8db479a6b1 Patch from Christophe:
A lot of headers are checked by autoconf (AC_CHECK_HEADERS in configure.ac).
Please find a patch that add the missing "#ifdef" to the source code.
2005-09-28 13:47:47 +00:00
antona
2a104d8eda Megapatch!!! Check evecrything!!! I probably broke everything!!! 2005-09-24 22:54:55 +00:00
flatcap
7a142ef54c got bored. don't read the diffs. 2005-07-06 22:47:01 +00:00
flatcap
949043ab36 Tidy whitespace: trailing space; <space><tab> at the beginning of lines
Fix warnings about sign differences
Fix warnings about unused parameters
Tidy a few functions that didn't have { on a new line
2005-06-19 21:09:40 +00:00
cha0smaster
e323ed6a03 Move utils_pathname_to_inode from to library (dir.c), adapt it for library, rename it to ntfs_pathname_to_inode, update all users. 2005-06-12 18:12:55 +00:00
void!yura
0a16746ca2 remove logfile reset
(Logical change 1.672)
2005-01-30 18:13:25 +00:00
cantab.net!aia21
b82469ba50 Remove vol->nr_mft_records and update all users. (Anton)
(Logical change 1.549)
2004-09-13 10:28:54 +00:00
!uv
2e082893fe Warning fixes: missing const and mixing declerations with code.
(Logical change 1.508)
2004-08-20 12:30:34 +00:00