Commit Graph

554 Commits (4c8d97cbd27db4f415f7bfde5474effcdedc27e3)

Author SHA1 Message Date
Jean-Pierre André 274b89cec9 Avoided truncation in a debug message in secaudit
When compiled for Windows 64-bit, pointers have to be displayed as
"long long" instead of "long" which is 32-bit
2015-04-17 09:03:08 +02:00
Erik Larsson 807ee0f26c Enable ioctl in ntfs-3g unconditionally when building with fuse-lite.
fuse-lite announces a FUSE_VERSION which may not always match the exact
capabilities of the library. Hence we add a special case for 'ioctl',
which we know exists in fuse-lite regardless of the version number
published.
2015-03-14 11:11:43 +01:00
Erik Larsson 1ebf77f769 Fix improper #ifdef conditions around FUSE_CAP_IOCTL_DIR.
The capability actually appeared in FUSE 2.9, not 2.8. However in order
to maintain similarity to earlier #ifdef:s, we simpy check if
FUSE_CAP_IOCTL_DIR is defined rather than checking the FUSE version.
2015-03-14 06:53:31 +01:00
Erik Larsson b970c69c02 usermap.c: Fix uninitialized variable warning in main.
If platform was non-Win32 and open_security_api() failed, the variable
'ok' would end up being uninitialized.
2015-03-13 09:06:17 +01:00
Erik Larsson 36f4957587 lowntfs-3g.c: Fix uninitialized variable warning in ntfs_fuse_getxattr.
The variable 'res' was never initialized if the #ifdef condition
'!KERNELPERMS | (POSIXACLS & !KERNELACLS)' evaluated to true and there
was an error allocating memory for 'value'.
2015-03-13 09:02:38 +01:00
Erik Larsson 3f5d881a70 Compile fix for FUSE versions earlier than 2.8.0. 2015-03-13 08:57:38 +01:00
Jean-Pierre André b2709f60ac Updated the copyright on the drivers to 2015 2015-03-05 18:25:17 +01:00
Jean-Pierre André 0101407feb Made to ignore the -s ("sloppy") mount option
autofs passes the sloppy option to mount(8) for all file systems to mean
that mount should not choke on invalid options such as those meant for
remote mounting on another operating system through nfs or cifs.
Following a recent change, mount(8) passes the -s option on to any file
system, even to local ones (which are not expected to get foreign options),
so ntfs-3g now has to ignore -s.
2015-01-22 08:42:43 +01:00
Jean-Pierre André c358191f91 Disabled option remove_hiberfile on read-only mounts
The mount options remove_hiberfile and read-only are contradictory.
When both are mentioned, ignore remove_hiberfile.
2014-09-02 09:50:27 +02:00
Jean-Pierre André f4e3f126df Implemented fstrim(8)
fstrim(8) discards unused blocks on a mounted filesystem. It is useful for
solid-state drives (SSDs) and thinly-provisioned storage.
Only trimming the full device (with no option) is supported.

Contributed by Richard W.M. Jones
2014-07-31 14:03:11 +02:00
Jean-Pierre André bfc5f3dd3d Fixed processing umask when Posix ACLs are compiled in but not enabled
When Posix ACLs are used, the umask is ignored and the initial permissions
of created files are taken for the parent directory. However the umask
should still be used when the Posix ACLs are not enabled in the mount
options.
2014-06-23 11:20:21 +02:00
Jean-Pierre André 22ecedb996 Fixed a wrong function header in usermap
A wrong header was defined for ntfs_initialize_file_security()
2014-06-23 11:16:02 +02:00
Jean-Pierre André ae4a797473 Disabled the default user mapping when Windows inheritance is used
Windows-type inheritance is meaningful only when used with user
identifications known to Windows, so avoid using default ones.
2014-06-23 10:59:38 +02:00
Jean-Pierre André 19d71c6c9e Fixed apparent const violation in secaudit.c for Windows (cosmetic)
The prototype for SetFileSecurityW() does not exhibit a const attribute
for the second attribute, thus triggering a compiler warning.
This warning can be silenced by copying the argument.
2014-06-23 10:53:23 +02:00
Jean-Pierre André 276c6ec661 Showed Windows ownership in secaudit with verbose option
The Windows ownership can now be displayed without using the "very
verbose" option, and when used on Windows the login name is displayed.
2014-06-23 10:41:39 +02:00
Jean-Pierre André 0ccd90f2fb Fixed ignoring the umask mount option when permissions are used
When permissions are used, umask(2) is supposed to be active and the
umask mount option is supposed to be ignored, but it was still wrongly
applied. This caused permission restrictions when an external disk was
automatically mounted with standard options.
2014-05-22 09:45:46 +02:00
Jean-Pierre André 7154606369 Decoded more "well-known" and generic SIDs in secaudit
More SIDs found in common situations are displayed with their meaning.
2014-05-22 09:25:11 +02:00
Jean-Pierre André c9b0c415fd Decoded the GENERIC_ALL flag in secaudit
The GENERIC_ALL flags was not decoded and could lead to displaying no
access to some directories.
2014-05-22 09:01:37 +02:00
Jean-Pierre André 5554f2e677 Displayed the parent directory of selected files in usermap
Displaying the parent directory facilitates the identification of files
selected by usermap as a base for defining the mapping of Windows users
to Linux ones.
2014-05-22 08:58:03 +02:00
Jean-Pierre André 3e212bb901 Ignored chmod/chown/setfacl when Windows inheritance is applied
chmod/chown/setfacl can only define permissions according to Linux rules
with references to owner and group. Windows rules are more general and
propagated through inheritance, and chmod/chown/setfacl may create unwanted
deviations from these rules. Ignoring them prevents text editors from
creating such deviations when updating a file and creating a backup one.
2014-05-22 08:46:08 +02:00
Jean-Pierre André 556bb9fada Fixed inclusion of <sys/param.h> for Solaris/OpenIndiana
The truncation of oversized file names on Solaris/OpenIndiana requires
the definition of the maximum size from <sys/param.h> instead of
<param.h>
2014-04-23 09:43:43 +02:00
Erik Larsson 9e7184e2a6 Fix readdir I/O error on file names larger than 255 bytes in Solaris.
If a readdir operation returned a file name larger than 255 bytes,
Solaris/Illumos would return I/O error from the readdir operation.
Fixed by truncating the file name returned in the readdir operation.
2014-04-18 11:54:54 +02:00
Chih-Wei Huang a0914beb98 Fix a possible memory leak
In ntfs_fuse_parse_path(), it's possible that strdup() succeeds but
ntfs_mbstoucs() returns a negative value. In such a case the callers
just treat it as an error and ignores the allocated path buffer
that results in a memory leak.
2014-04-16 11:30:50 +02:00
Chih-Wei Huang 419d3399dc Initialize 'path' correctly
It fixes the warnings
src/ntfs-3g.c: In function 'ntfs_fuse_readlink':
src/ntfs-3g.c:987:6: warning: 'path' may be used uninitialized in this function [-Wmaybe-uninitialized]
src/ntfs-3g.c: In function 'ntfs_fuse_create':
src/ntfs-3g.c:1765:6: warning: 'path' may be used uninitialized in this function [-Wmaybe-uninitialized]
2014-04-16 11:30:48 +02:00
Jean-Pierre André cfab9d64c6 Fixed checking whether utimensat() applies to current atime
The check was applied to mtime instead of atime
2014-03-11 11:03:06 +01:00
Jean-Pierre André 543b17b7ef Rejected reserved files names when option windows_names is set
Windows applies legacy restrictions to file names, so when the option
windows_names is applied, reject the same reserved names, which are
CON, PRN, AUX, NUL, COM1..COM9, and LPT1..LPT9
2014-03-11 10:56:31 +01:00
Jean-Pierre André b70df75369 Updated ctime after setting an ACL
When setting a Posix ACL, the ctime was not updated to match ext2/ext3
behavior. This ext2/ext3 behavior has been changed, so do the same.
2014-03-11 10:28:02 +01:00
Jean-Pierre André 04ad1b9c09 Fixed default option for compression in the manual
Mention in the manual that compression is now enabledd by default.
2014-03-11 09:40:18 +01:00
Jean-Pierre André 2ab2994536 Fixed an erroneous reference to compression in the manual
compression was erroneously mentioned in the manual instead of permission.
2014-03-11 09:35:50 +01:00
Jean-Pierre André 1c09012dbc Improved the description of the silent option in the manual
The silent option acts on chown and chown, but also on permission checking,
and when the option is disabled, permission checking errors may emerge.
2014-03-11 09:30:18 +01:00
Jean-Pierre André d2daead832 Updated copyright claims 2014-02-16 18:25:09 +01:00
Jean-Pierre André 5e18e97d0b Silenced warnings by gcc >= 4.8 about aliasing
Added intermediate variables to avoid warnings by gcc >= 4.8
2013-09-09 15:34:14 +02:00
Jean-Pierre André 0c8e776c12 Silenced a compiler warning in ntfs-3g.probe
Avoid some compilers to complain about a missing return value...
2013-07-30 11:13:51 +02:00
Jean-Pierre André b60954ff6a 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.
2013-07-30 10:53:07 +02:00
Jean-Pierre André db35a16838 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.
2013-05-07 11:42:48 +02:00
Jean-Pierre André c5a11341b0 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.
2013-04-22 19:06:49 +02: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
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é 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
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é 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
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é 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é f61b34ee2c 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.
2012-08-20 12:45:21 +02:00
Jean-Pierre André 3103a6c383 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
2012-08-20 12:36:45 +02:00
Jean-Pierre André 4b651b9340 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)
2012-08-20 12:28:15 +02:00
Jean-Pierre André 7a93d1790a 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.
2012-06-18 12:57:40 +02:00
Jean-Pierre André 0f8ef123ea 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.
2012-06-18 12:53:25 +02:00
Jean-Pierre André 93ac6ce3bf 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.
2012-06-18 12:46:21 +02:00
Jean-Pierre André 8f896f112a 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.)
2012-06-18 12:34:56 +02:00
Jean-Pierre André 1ad9bdad4d Avoided interpreting UTIME_NOW and UTIME_OMIT from external fuse
UTIME_NOW and UTIME_OMIT are needed for implementing utimensat() and
futimens(2), but they cannot yet be used with external fuse.
This patch is to avoid errors if they cannot be used, even with fuse 4.9
2012-03-21 19:26:00 +01:00
Jean-Pierre André 911ecba5e2 Set the hidden flag according to the latest name when hide_dot_files is set
When the hide_dot_files option is set, a file is marked hidden if the
first character in its name is a dot. This patch updates the hidden flag
when the file is renamed or hard linked (useful for text editors which
create files with a temporary name)
2012-03-21 19:19:39 +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é 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é 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é 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é 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é 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é 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é a7c61d83a7 Defined option delay_mtime to delay updates of mtime+ctime
This patch avoid updating the time stamps whenever a file is modified,
by delaying the time stamps updating until the file is closed.
This is mostly useful when the ntfs file system hosts another loop-monted
file system to avoid frequent updates of the time stamps in the outer
file system.
2011-10-07 11:16:23 +02:00
Jean-Pierre André 9497aa7974 minor : Fixed ntfs_fuse_read() returning garbage in error case (Fabian Keil) 2011-08-04 15:49:35 +02:00
Erik Larsson fd71e36096 Added a new configure option '--disable-ntfs-3g'.
The binaries 'ntfs-3g', 'lowntfs-3g', 'ntfs-3g.probe' 'ntfs-3g.usermap' and 'ntfs-3g.secaudit' will not be built when this option is passed to 'configure'.

When specifying both '--disable-ntfsprogs' and '--disable-ntfs-3g', only libntfs-3g will be built (no executable binaries).
2011-07-06 19:11:42 +02:00
Jean-Pierre André d7926f72d0 Provided support for big writes 2011-07-05 12:17:30 +02:00
Jean-Pierre André 5cd49257b0 Removed unneeded variables as warned by gcc 4.6 2011-07-05 12:17:29 +02:00
Jean-Pierre André 2be8e64049 Fixed relatime as a default mount option (had become atime) 2011-07-05 12:17:29 +02:00
Jean-Pierre André f5433e02a2 Fixed the description of inherit option in the manual 2011-07-05 12:17:28 +02:00
Jean-Pierre André 571dbc5784 Fixed device path canonicalization for use by devmapper (basilinya)
For some reason, when the monted device is "/dev/mapper/*", a record
in the form "/dev/dm-*" ends up in /etc/mtab and the device cannot be
unmounted.

The reason is unclear, the /dev/mapper name is not a symlink, and the
function doing the name change is not known. No detailed feedback from
the users having met the issue.

The patch changes the name back to the /dev/mapper name after realpath()
is called, and, if there is an actual change, both the name passed to
ntfs-3g and the one passed to fuse and mount are logged in the hope
of getting a clue about what is happening.

But ntfs-3g is probably not the right place for a fix.
2011-07-05 12:17:12 +02:00
Jean-Pierre André 259b8ab308 Fixed compilation on OpenIndiana (Apostolos Syropoulos) 2011-07-05 12:17:11 +02:00
Jean-Pierre André 5cd711248b Fixed options parsing on OSes with no extended attributes 2011-07-05 12:17:11 +02:00
Jean-Pierre André f510c5cdf4 Got the target libs to build libntfs-3g and libfuse-lite if selected 2011-07-05 12:17:11 +02:00
Jean-Pierre André b492b313f9 Fixed a false detection of bad memory release in secaudit 2011-04-08 18:15:43 +02:00
Szaka f246d6ce97 Update ntfs-3g.org references 2011-03-27 15:29:48 +03:00
Jean-Pierre André f219d2e07e Fixed inconsistent interface to ntfs_initialize_file_security()
The "flags" argument of ntfs_initialize_file_security() is intended to
feed the one to ntfs_mount(). Having the same type for both may avoid
future problems.
2011-03-23 09:20:10 +01:00
Jean-Pierre André 3160203c97 Defined option acl to request the use of Posix ACLs 2011-02-08 13:52:12 +01:00
Jean-Pierre André f55f359f4e Moved global options parsing to ntfs-3g_common.c 2011-02-08 13:52:12 +01:00
Jean-Pierre André 461e9f21b8 Moved mount options parsing to ntfs-3g_common.c 2011-02-08 13:52:12 +01:00
Jean-Pierre André a46a395006 Updated copyright notices 2011-02-08 13:52:12 +01:00
Jean-Pierre André bbdfcb017d Restricted listxattr() to environments with extended attributes 2011-02-08 13:52:12 +01:00
Jean-Pierre André e47734baa9 Denied modifications to metadata files 2011-02-08 13:52:11 +01:00
Jean-Pierre André 9ddc70f19b Moved listxattr() to a specific source module 2011-01-17 15:50:25 +01:00
Jean-Pierre André cc0cf6901d Added descriptions of options recover/norecover to the manual 2010-12-21 15:50:13 +01:00
Jean-Pierre André 351aec3f7a Enabled renaming of system extended attributes 2010-10-26 08:59:52 +02:00
Jean-Pierre André f43e972342 Removed obsolete comments 2010-10-26 08:59:52 +02:00
Jean-Pierre André 2f82b18b4b Removed an obsolete debug sequence 2010-10-26 08:59:52 +02:00
Jean-Pierre André a92c57735b Added an extended attribute name for creation time 2010-10-26 08:59:51 +02:00
Jean-Pierre André 13b578d9b1 Added a big endian extended attribute name for attrib and times 2010-10-26 08:59:51 +02:00
Jean-Pierre André 9c0e3a7b4e Enabled use of fuse cacheing in lowntfs-3g under conditions 2010-10-26 08:59:51 +02:00
Jean-Pierre André e1ef554dd2 Grouped system extended attributes functions into a dedicated module 2010-10-26 08:59:51 +02:00
Jean-Pierre André 1afaf16912 Implemented the sync mount option 2010-10-26 08:59:51 +02:00
Jean-Pierre André ecbc2b9103 Implemented fsync() and fsyncdir() 2010-10-26 08:59:51 +02:00
Jean-Pierre André 23aae785c4 Fixed stat(2) for system files with no data 2010-10-25 12:13:28 +02:00
Jean-Pierre André 270b640b99 Fixed adding options -n --no-mtab needed by automount 2010-09-16 18:44:11 +02:00