Compare commits
10 Commits
edge
...
N2009_11_1
Author | SHA1 | Date |
---|---|---|
|
74686cd644 | |
|
c32f2a4f59 | |
|
670d72620d | |
|
1af26b3d03 | |
|
09dec85cd8 | |
|
5807572640 | |
|
2dfa3412da | |
|
51f768af3b | |
|
c7252ba416 | |
|
b2b236656a |
|
@ -23,8 +23,8 @@
|
|||
|
||||
# Autoconf
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([ntfs-3g],[2009.11.14],[ntfs-3g-devel@lists.sf.net])
|
||||
LIBNTFS_3G_VERSION="71"
|
||||
AC_INIT([ntfs-3g],[2010.1.16],[ntfs-3g-devel@lists.sf.net])
|
||||
LIBNTFS_3G_VERSION="73"
|
||||
AC_CONFIG_SRCDIR([src/ntfs-3g.c])
|
||||
|
||||
# Environment
|
||||
|
@ -273,7 +273,6 @@ AC_C_BIGENDIAN(
|
|||
]
|
||||
,
|
||||
)
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_SIZE_T
|
||||
|
|
|
@ -39,6 +39,9 @@ typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx;
|
|||
extern ntfschar AT_UNNAMED[];
|
||||
extern ntfschar STREAM_SDS[];
|
||||
|
||||
/* The little endian Unicode string $TXF_DATA as a global constant. */
|
||||
extern ntfschar TXF_DATA[10];
|
||||
|
||||
/**
|
||||
* enum ntfs_lcn_special_values - special return values for ntfs_*_vcn_to_lcn()
|
||||
*
|
||||
|
@ -281,8 +284,6 @@ extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn);
|
|||
|
||||
extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol,
|
||||
const ATTR_TYPES type, const s64 size);
|
||||
extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol,
|
||||
const ATTR_TYPES type);
|
||||
extern int ntfs_attr_can_be_resident(const ntfs_volume *vol,
|
||||
const ATTR_TYPES type);
|
||||
int ntfs_attr_make_non_resident(ntfs_attr *na,
|
||||
|
|
|
@ -40,6 +40,9 @@
|
|||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/**
|
||||
* attrib.c - Attribute handling code. Originated from the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2000-2005 Anton Altaparmakov
|
||||
* Copyright (c) 2000-2010 Anton Altaparmakov
|
||||
* Copyright (c) 2002-2005 Richard Russon
|
||||
* Copyright (c) 2002-2008 Szabolcs Szakacsits
|
||||
* Copyright (c) 2004-2007 Yura Pakhuchiy
|
||||
* Copyright (c) 2007-2009 Jean-Pierre Andre
|
||||
* Copyright (c) 2007-2010 Jean-Pierre Andre
|
||||
* Copyright (c) 2010 Erik Larsson
|
||||
*
|
||||
* This program/include file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
|
@ -39,6 +40,9 @@
|
|||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "compat.h"
|
||||
#include "attrib.h"
|
||||
|
@ -69,6 +73,17 @@ ntfschar STREAM_SDS[] = { const_cpu_to_le16('$'),
|
|||
const_cpu_to_le16('S'),
|
||||
const_cpu_to_le16('\0') };
|
||||
|
||||
ntfschar TXF_DATA[] = { const_cpu_to_le16('$'),
|
||||
const_cpu_to_le16('T'),
|
||||
const_cpu_to_le16('X'),
|
||||
const_cpu_to_le16('F'),
|
||||
const_cpu_to_le16('_'),
|
||||
const_cpu_to_le16('D'),
|
||||
const_cpu_to_le16('A'),
|
||||
const_cpu_to_le16('T'),
|
||||
const_cpu_to_le16('A'),
|
||||
const_cpu_to_le16('\0') };
|
||||
|
||||
static int NAttrFlag(ntfs_attr *na, FILE_ATTR_FLAGS flag)
|
||||
{
|
||||
if (na->type == AT_DATA && na->name == AT_UNNAMED)
|
||||
|
@ -1868,6 +1883,7 @@ int ntfs_attr_pclose(ntfs_attr *na)
|
|||
}
|
||||
|
||||
retry:
|
||||
written = 0;
|
||||
if (!NVolReadOnly(vol)) {
|
||||
|
||||
written = ntfs_compressed_close(na, rl, ofs);
|
||||
|
@ -3008,10 +3024,14 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type,
|
|||
/**
|
||||
* ntfs_attr_can_be_non_resident - check if an attribute can be non-resident
|
||||
* @vol: ntfs volume to which the attribute belongs
|
||||
* @type: attribute type which to check
|
||||
* @type: attribute type to check
|
||||
* @name: attribute name to check
|
||||
* @name_len: attribute name length
|
||||
*
|
||||
* Check whether the attribute of @type on the ntfs volume @vol is allowed to
|
||||
* be non-resident. This information is obtained from $AttrDef system file.
|
||||
* Check whether the attribute of @type and @name with name length @name_len on
|
||||
* the ntfs volume @vol is allowed to be non-resident. This information is
|
||||
* obtained from $AttrDef system file and is augmented by rules imposed by
|
||||
* Microsoft (e.g. see http://support.microsoft.com/kb/974729/).
|
||||
*
|
||||
* Return 0 if the attribute is allowed to be non-resident and -1 if not or an
|
||||
* error occurred. On error the error code is stored in errno. The following
|
||||
|
@ -3020,16 +3040,34 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type,
|
|||
* ENOENT - The attribute @type is not specified in $AttrDef.
|
||||
* EINVAL - Invalid parameters (e.g. @vol is not valid).
|
||||
*/
|
||||
int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type)
|
||||
static int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type,
|
||||
const ntfschar *name, int name_len)
|
||||
{
|
||||
ATTR_DEF *ad;
|
||||
BOOL allowed;
|
||||
|
||||
/* Find the attribute definition record in $AttrDef. */
|
||||
ad = ntfs_attr_find_in_attrdef(vol, type);
|
||||
if (!ad)
|
||||
return -1;
|
||||
/* Check the flags and return the result. */
|
||||
if (ad->flags & ATTR_DEF_RESIDENT) {
|
||||
/*
|
||||
* Microsoft has decreed that $LOGGED_UTILITY_STREAM attributes with a
|
||||
* name of $TXF_DATA must be resident despite the entry for
|
||||
* $LOGGED_UTILITY_STREAM in $AttrDef allowing them to be non-resident.
|
||||
* Failure to obey this on the root directory mft record of a volume
|
||||
* causes Windows Vista and later to see the volume as a RAW volume and
|
||||
* thus cannot mount it at all.
|
||||
*/
|
||||
if ((type == AT_LOGGED_UTILITY_STREAM)
|
||||
&& name
|
||||
&& ntfs_names_are_equal(TXF_DATA, 9, name, name_len,
|
||||
CASE_SENSITIVE, vol->upcase, vol->upcase_len))
|
||||
allowed = FALSE;
|
||||
else {
|
||||
/* Find the attribute definition record in $AttrDef. */
|
||||
ad = ntfs_attr_find_in_attrdef(vol, type);
|
||||
if (!ad)
|
||||
return -1;
|
||||
/* Check the flags and return the result. */
|
||||
allowed = !(ad->flags & ATTR_DEF_RESIDENT);
|
||||
}
|
||||
if (!allowed) {
|
||||
errno = EPERM;
|
||||
ntfs_log_trace("Attribute can't be non-resident\n");
|
||||
return -1;
|
||||
|
@ -3294,7 +3332,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (ntfs_attr_can_be_non_resident(ni->vol, type)) {
|
||||
if (ntfs_attr_can_be_non_resident(ni->vol, type, name, name_len)) {
|
||||
if (errno == EPERM)
|
||||
ntfs_log_perror("Attribute can't be non resident");
|
||||
else
|
||||
|
@ -3589,7 +3627,7 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type,
|
|||
}
|
||||
|
||||
/* Sanity checks for always resident attributes. */
|
||||
if (ntfs_attr_can_be_non_resident(ni->vol, type)) {
|
||||
if (ntfs_attr_can_be_non_resident(ni->vol, type, name, name_len)) {
|
||||
if (errno != EPERM) {
|
||||
err = errno;
|
||||
ntfs_log_perror("ntfs_attr_can_be_non_resident failed");
|
||||
|
@ -4154,7 +4192,7 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
|
|||
}
|
||||
|
||||
/* Check that the attribute is allowed to be non-resident. */
|
||||
if (ntfs_attr_can_be_non_resident(vol, na->type))
|
||||
if (ntfs_attr_can_be_non_resident(vol, na->type, na->name, na->name_len))
|
||||
return -1;
|
||||
|
||||
new_allocated_size = (le32_to_cpu(a->value_length) + vol->cluster_size
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include "misc.h"
|
||||
#include "efs.h"
|
||||
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
|
||||
static ntfschar logged_utility_stream_name[] = {
|
||||
const_cpu_to_le16('$'),
|
||||
const_cpu_to_le16('E'),
|
||||
|
@ -337,3 +339,5 @@ err_out:
|
|||
ntfs_attr_put_search_ctx(ctx);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
|
|
@ -1197,6 +1197,8 @@ int ntfs_inode_badclus_bad(u64 mft_no, ATTR_RECORD *attr)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
|
||||
/*
|
||||
* Get high precision NTFS times
|
||||
*
|
||||
|
@ -1344,3 +1346,5 @@ int ntfs_inode_set_times(const char *path __attribute__((unused)),
|
|||
errno = EEXIST;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
|
|
@ -598,7 +598,7 @@ static char *ntfs_get_fulllink(ntfs_volume *vol, ntfschar *junction,
|
|||
if (*p == '/')
|
||||
level++;
|
||||
fulltarget = (char*)ntfs_malloc(3*level
|
||||
+ sizeof(mappingdir) + count - 4);
|
||||
+ sizeof(mappingdir) + strlen(target) - 3);
|
||||
if (fulltarget) {
|
||||
fulltarget[0] = 0;
|
||||
if (level > 1) {
|
||||
|
@ -721,7 +721,7 @@ static char *ntfs_get_abslink(ntfs_volume *vol, ntfschar *junction,
|
|||
if (*p == '/')
|
||||
level++;
|
||||
fulltarget = (char*)ntfs_malloc(3*level
|
||||
+ sizeof(mappingdir) + count - 4);
|
||||
+ sizeof(mappingdir) + strlen(target) - 3);
|
||||
if (fulltarget) {
|
||||
fulltarget[0] = 0;
|
||||
if (level > 1) {
|
||||
|
@ -914,6 +914,8 @@ BOOL ntfs_possible_symlink(ntfs_inode *ni)
|
|||
return (possible);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
|
||||
/*
|
||||
* Set the index for new reparse data
|
||||
*
|
||||
|
@ -951,6 +953,8 @@ static int set_reparse_index(ntfs_inode *ni, ntfs_index_context *xr,
|
|||
return (ntfs_ie_add(xr,(INDEX_ENTRY*)&indx));
|
||||
}
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
||||
/*
|
||||
* Remove a reparse data index entry if attribute present
|
||||
*
|
||||
|
@ -1015,6 +1019,8 @@ static ntfs_index_context *open_reparse_index(ntfs_volume *vol)
|
|||
return (xr);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
|
||||
/*
|
||||
* Update the reparse data and index
|
||||
*
|
||||
|
@ -1079,6 +1085,8 @@ static int update_reparse_data(ntfs_inode *ni, ntfs_index_context *xr,
|
|||
return (res);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
||||
/*
|
||||
* Delete a reparse index entry
|
||||
*
|
||||
|
@ -1116,6 +1124,8 @@ int ntfs_delete_reparse_index(ntfs_inode *ni)
|
|||
return (res);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
|
||||
/*
|
||||
* Get the ntfs reparse data into an extended attribute
|
||||
*
|
||||
|
@ -1294,3 +1304,5 @@ int ntfs_remove_ntfs_reparse_data(const char *path __attribute__((unused)),
|
|||
}
|
||||
return (res ? -1 : 0);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_SETXATTR
|
||||
#include <sys/xattr.h>
|
||||
#endif
|
||||
|
@ -2893,6 +2896,8 @@ BOOL ntfs_allowed_as_owner(struct SECURITY_CONTEXT *scx,
|
|||
return (allowed);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
|
||||
#if POSIXACLS
|
||||
|
||||
/*
|
||||
|
@ -3074,6 +3079,8 @@ int ntfs_set_ntfs_acl(struct SECURITY_CONTEXT *scx,
|
|||
return (res ? -1 : 0);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
||||
/*
|
||||
* Set new permissions to a file
|
||||
* Checks user mapping has been defined before request for setting
|
||||
|
@ -3988,6 +3995,8 @@ int ntfs_build_mapping(struct SECURITY_CONTEXT *scx, const char *usermap_path)
|
|||
return (!scx->mapping[MAPUSERS] || link_group_members(scx));
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
|
||||
/*
|
||||
* Get the ntfs attribute into an extended attribute
|
||||
* The attribute is returned according to cpu endianness
|
||||
|
@ -4073,6 +4082,8 @@ int ntfs_set_ntfs_attrib(const char *path __attribute__((unused)),
|
|||
return (res ? -1 : 0);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
||||
/*
|
||||
* Open $Secure once for all
|
||||
* returns zero if it succeeds
|
||||
|
|
|
@ -151,7 +151,9 @@ typedef struct {
|
|||
BOOL no_detach;
|
||||
BOOL blkdev;
|
||||
BOOL mounted;
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
BOOL efs_raw;
|
||||
#endif /* HAVE_SETXATTR */
|
||||
struct fuse_chan *fc;
|
||||
BOOL inherit;
|
||||
unsigned int secure_flags;
|
||||
|
@ -409,12 +411,6 @@ static void set_fuse_error(int *err)
|
|||
}
|
||||
|
||||
#if defined(__APPLE__) || defined(__DARWIN__)
|
||||
static void *ntfs_macfuse_init(struct fuse_conn_info *conn)
|
||||
{
|
||||
FUSE_ENABLE_XTIMES(conn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int ntfs_macfuse_getxtimes(const char *org_path,
|
||||
struct timespec *bkuptime, struct timespec *crtime)
|
||||
{
|
||||
|
@ -495,29 +491,34 @@ int ntfs_macfuse_setchgtime(const char *path, const struct timespec *tv)
|
|||
|
||||
if (ntfs_fuse_is_named_data_stream(path))
|
||||
return -EINVAL; /* n/a for named data streams. */
|
||||
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
|
||||
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
|
||||
if (!ni)
|
||||
return -errno;
|
||||
|
||||
if (tv) {
|
||||
ni->last_mft_change_time = tv->tv_sec;
|
||||
ni->last_mft_change_time = tv->tv_sec;
|
||||
ntfs_fuse_update_times(ni, 0);
|
||||
}
|
||||
|
||||
if (ntfs_inode_close(ni))
|
||||
set_fuse_error(&res);
|
||||
set_fuse_error(&res);
|
||||
return res;
|
||||
}
|
||||
#else /* defined(__APPLE__) || defined(__DARWIN__) */
|
||||
#ifdef FUSE_CAP_DONT_MASK
|
||||
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
|
||||
|
||||
#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__))
|
||||
static void *ntfs_init(struct fuse_conn_info *conn)
|
||||
{
|
||||
#if defined(__APPLE__) || defined(__DARWIN__)
|
||||
FUSE_ENABLE_XTIMES(conn);
|
||||
#endif
|
||||
#ifdef FUSE_CAP_DONT_MASK
|
||||
/* request umask not to be enforced by fuse */
|
||||
conn->want |= FUSE_CAP_DONT_MASK;
|
||||
#endif /* defined FUSE_CAP_DONT_MASK */
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
|
||||
#endif /* defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__)) */
|
||||
|
||||
static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
|
||||
{
|
||||
|
@ -593,6 +594,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
|
|||
/* Regular or Interix (INTX) file. */
|
||||
stbuf->st_mode = S_IFREG;
|
||||
stbuf->st_size = ni->data_size;
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
/*
|
||||
* return data size rounded to next 512 byte boundary for
|
||||
* encrypted files to include padding required for decryption
|
||||
|
@ -600,7 +602,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
|
|||
*/
|
||||
if (ctx->efs_raw && ni->flags & FILE_ATTR_ENCRYPTED)
|
||||
stbuf->st_size = ((ni->data_size + 511) & ~511) + 2;
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
/*
|
||||
* Temporary fix to make ActiveSync work via Samba 3.0.
|
||||
* See more on the ntfs-3g-devel list.
|
||||
|
@ -629,12 +631,14 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
|
|||
if (na->data_size == 1)
|
||||
stbuf->st_mode = S_IFSOCK;
|
||||
}
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
/* encrypted named stream */
|
||||
/* round size up to next 512 byte boundary */
|
||||
if (ctx->efs_raw && stream_name_len &&
|
||||
(na->data_flags & ATTR_IS_ENCRYPTED) &&
|
||||
NAttrNonResident(na))
|
||||
stbuf->st_size = ((na->data_size+511) & ~511)+2;
|
||||
#endif /* HAVE_SETXATTR */
|
||||
/*
|
||||
* Check whether it's Interix symbolic link, block or
|
||||
* character device.
|
||||
|
@ -969,11 +973,13 @@ static int ntfs_fuse_open(const char *org_path,
|
|||
/* mark a future need to compress the last chunk */
|
||||
if (na->data_flags & ATTR_COMPRESSION_MASK)
|
||||
fi->fh |= CLOSE_COMPRESSED;
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
/* mark a future need to fixup encrypted inode */
|
||||
if (ctx->efs_raw
|
||||
&& !(na->data_flags & ATTR_IS_ENCRYPTED)
|
||||
&& (ni->flags & FILE_ATTR_ENCRYPTED))
|
||||
fi->fh |= CLOSE_ENCRYPTED;
|
||||
#endif /* HAVE_SETXATTR */
|
||||
}
|
||||
ntfs_attr_close(na);
|
||||
} else
|
||||
|
@ -1015,12 +1021,14 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size,
|
|||
res = -errno;
|
||||
goto exit;
|
||||
}
|
||||
/* limit reads at next 512 byte boundary for encrypted attributes */
|
||||
max_read = na->data_size;
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
/* limit reads at next 512 byte boundary for encrypted attributes */
|
||||
if (ctx->efs_raw && (na->data_flags & ATTR_IS_ENCRYPTED) &&
|
||||
NAttrNonResident(na)) {
|
||||
max_read = ((na->data_size+511) & ~511) + 2;
|
||||
}
|
||||
#endif /* HAVE_SETXATTR */
|
||||
if (offset + (off_t)size > max_read) {
|
||||
if (max_read < offset)
|
||||
goto ok;
|
||||
|
@ -1137,8 +1145,10 @@ static int ntfs_fuse_release(const char *org_path,
|
|||
res = 0;
|
||||
if (fi->fh & CLOSE_COMPRESSED)
|
||||
res = ntfs_attr_pclose(na);
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
if (fi->fh & CLOSE_ENCRYPTED)
|
||||
res = ntfs_efs_fixup_attribute(NULL, na);
|
||||
#endif /* HAVE_SETXATTR */
|
||||
exit:
|
||||
if (na)
|
||||
ntfs_attr_close(na);
|
||||
|
@ -1498,11 +1508,13 @@ static int ntfs_fuse_create(const char *org_path, mode_t typemode, dev_t dev,
|
|||
if (fi && (ni->flags & FILE_ATTR_COMPRESSED)) {
|
||||
fi->fh |= CLOSE_COMPRESSED;
|
||||
}
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
/* mark a future need to fixup encrypted inode */
|
||||
if (fi
|
||||
&& ctx->efs_raw
|
||||
&& (ni->flags & FILE_ATTR_ENCRYPTED))
|
||||
fi->fh |= CLOSE_ENCRYPTED;
|
||||
#endif /* HAVE_SETXATTR */
|
||||
NInoSetDirty(ni);
|
||||
/*
|
||||
* closing ni will necessitate to open dir_ni to
|
||||
|
@ -1568,10 +1580,12 @@ static int ntfs_fuse_create_stream(const char *path,
|
|||
/* mark a future need to compress the last block */
|
||||
if (ni->flags & FILE_ATTR_COMPRESSED)
|
||||
fi->fh |= CLOSE_COMPRESSED;
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
/* mark a future need to fixup encrypted inode */
|
||||
if (ctx->efs_raw
|
||||
&& (ni->flags & FILE_ATTR_ENCRYPTED))
|
||||
fi->fh |= CLOSE_ENCRYPTED;
|
||||
#endif /* HAVE_SETXATTR */
|
||||
}
|
||||
|
||||
if (ntfs_inode_close(ni))
|
||||
|
@ -3182,17 +3196,15 @@ static struct fuse_operations ntfs_3g_ops = {
|
|||
.listxattr = ntfs_fuse_listxattr,
|
||||
#endif /* HAVE_SETXATTR */
|
||||
#if defined(__APPLE__) || defined(__DARWIN__)
|
||||
.init = ntfs_macfuse_init,
|
||||
/* MacFUSE extensions. */
|
||||
.getxtimes = ntfs_macfuse_getxtimes,
|
||||
.setcrtime = ntfs_macfuse_setcrtime,
|
||||
.setbkuptime = ntfs_macfuse_setbkuptime,
|
||||
.setchgtime = ntfs_macfuse_setchgtime,
|
||||
#else /* defined(__APPLE__) || defined(__DARWIN__) */
|
||||
#ifdef FUSE_CAP_DONT_MASK
|
||||
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
|
||||
#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__))
|
||||
.init = ntfs_init
|
||||
#endif
|
||||
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
|
||||
};
|
||||
|
||||
static int ntfs_fuse_init(void)
|
||||
|
@ -3321,7 +3333,9 @@ static char *parse_mount_options(const char *orig_opts)
|
|||
int want_permissions = 0;
|
||||
|
||||
ctx->secure_flags = 0;
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
ctx->efs_raw = FALSE;
|
||||
#endif /* HAVE_SETXATTR */
|
||||
options = strdup(orig_opts ? orig_opts : "");
|
||||
if (!options) {
|
||||
ntfs_log_perror("%s: strdup failed", EXEC_NAME);
|
||||
|
@ -3504,10 +3518,12 @@ static char *parse_mount_options(const char *orig_opts)
|
|||
"'usermapping' option.\n");
|
||||
goto err_exit;
|
||||
}
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
} else if (!strcmp(opt, "efs_raw")) {
|
||||
if (bogus_option_value(val, "efs_raw"))
|
||||
goto err_exit;
|
||||
ctx->efs_raw = TRUE;
|
||||
#endif /* HAVE_SETXATTR */
|
||||
} else { /* Probably FUSE option. */
|
||||
if (strappend(&ret, opt))
|
||||
goto err_exit;
|
||||
|
@ -3962,7 +3978,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
ctx->security.vol = ctx->vol;
|
||||
ctx->vol->secure_flags = ctx->secure_flags;
|
||||
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||
ctx->vol->efs_raw = ctx->efs_raw;
|
||||
#endif /* HAVE_SETXATTR */
|
||||
/* JPA open $Secure, (whatever NTFS version !) */
|
||||
/* to initialize security data */
|
||||
if (ntfs_open_secure(ctx->vol) && (ctx->vol->major_ver >= 3))
|
||||
|
|
|
@ -149,6 +149,25 @@
|
|||
*
|
||||
* Nov 2009, version 1.3.9
|
||||
* - allowed security descriptors up to 64K
|
||||
*
|
||||
* Nov 2009, version 1.3.10
|
||||
* - applied patches for MacOSX from Erik Larsson
|
||||
*
|
||||
* Nov 2009, version 1.3.11
|
||||
* - replace <attr/xattr.h> by <sys/xattr.h> (provided by glibc)
|
||||
*
|
||||
* Dec 2009, version 1.3.12
|
||||
* - worked around "const" possibly redefined in config.h
|
||||
*
|
||||
* Dec 2009, version 1.3.13
|
||||
* - fixed the return code of dorestore()
|
||||
*
|
||||
* Dec 2009, version 1.3.14
|
||||
* - adapted to opensolaris
|
||||
*
|
||||
* Jan 2010, version 1.3.15
|
||||
* - more adaptations to opensolaris
|
||||
* - removed the fix for return code of dorestore()
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -172,7 +191,7 @@
|
|||
* General parameters which may have to be adapted to needs
|
||||
*/
|
||||
|
||||
#define AUDT_VERSION "1.3.9"
|
||||
#define AUDT_VERSION "1.3.15"
|
||||
|
||||
#define GET_FILE_SECURITY "ntfs_get_file_security"
|
||||
#define SET_FILE_SECURITY "ntfs_set_file_security"
|
||||
|
@ -234,7 +253,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
#endif
|
||||
#ifdef HAVE_MACHINE_ENDIAN_H
|
||||
#include <machine/endian.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
#endif /* STSC */
|
||||
|
@ -246,20 +270,26 @@
|
|||
#ifndef STSC
|
||||
|
||||
#if !defined(HAVE_CONFIG_H) && POSIXACLS
|
||||
/* require <attr/xattr.h> if not integrated into ntfs-3g package */
|
||||
/* require <sys/xattr.h> if not integrated into ntfs-3g package */
|
||||
#define HAVE_SETXATTR 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
/* <attr/xattr.h> according to config.h if integrated into ntfs-3g package */
|
||||
#ifdef _FILE_OFFSET_BITS
|
||||
#undef _FILE_OFFSET_BITS /* work around "_FILE_OFFSET_BITS" possibly already defined */
|
||||
#endif
|
||||
/* <sys/xattr.h> according to config.h if integrated into ntfs-3g package */
|
||||
#include "config.h"
|
||||
#ifdef const /* work around "const" possibly redefined in config.h */
|
||||
#undef const
|
||||
#endif
|
||||
#ifndef POSIXACLS
|
||||
#define POSIXACLS 0
|
||||
#endif
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#ifdef HAVE_SETXATTR
|
||||
#include <attr/xattr.h>
|
||||
#include <sys/xattr.h>
|
||||
#else
|
||||
#warning "The extended attribute package is not available"
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
@ -5002,14 +5032,23 @@ BOOL singleshow(const char *path)
|
|||
return (err);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETXATTR
|
||||
|
||||
static ssize_t ntfs_getxattr(const char *path, const char *name, void *value, size_t size)
|
||||
{
|
||||
#if defined(__APPLE__) || defined(__DARWIN__)
|
||||
return getxattr(path, name, value, size, 0, 0);
|
||||
#else
|
||||
return getxattr(path, name, value, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Display all the parameters associated to a mounted file
|
||||
*/
|
||||
|
||||
void showmounted(const char *fullname)
|
||||
{
|
||||
#ifdef HAVE_SETXATTR
|
||||
|
||||
static char attr[MAXATTRSZ];
|
||||
struct stat st;
|
||||
#if POSIXACLS
|
||||
|
@ -5030,14 +5069,14 @@ void showmounted(const char *fullname)
|
|||
printname(stdout,fullname);
|
||||
printf("\n");
|
||||
|
||||
attrsz = getxattr(fullname,"system.ntfs_acl",attr,MAXATTRSZ);
|
||||
attrsz = ntfs_getxattr(fullname,"system.ntfs_acl",attr,MAXATTRSZ);
|
||||
if (attrsz > 0) {
|
||||
if (opt_v) {
|
||||
hexdump(attr,attrsz,8);
|
||||
printf("Computed hash : 0x%08lx\n",
|
||||
(unsigned long)hash((le32*)attr,attrsz));
|
||||
}
|
||||
if (getxattr(fullname,"system.ntfs_attrib",&attrib,4) != 4) {
|
||||
if (ntfs_getxattr(fullname,"system.ntfs_attrib",&attrib,4) != 4) {
|
||||
printf("** Could not get file attrib\n");
|
||||
errors++;
|
||||
} else
|
||||
|
@ -5102,9 +5141,17 @@ void showmounted(const char *fullname)
|
|||
}
|
||||
} else
|
||||
printf("%s not found\n",fullname);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else /* HAVE_SETXATTR */
|
||||
|
||||
void showmounted(const char *fullname __attribute__((unused)))
|
||||
{
|
||||
fprintf(stderr,"Not possible on this configuration\n");
|
||||
}
|
||||
|
||||
#endif /* HAVE_SETXATTR */
|
||||
|
||||
#if POSIXACLS
|
||||
|
||||
BOOL recurseset_posix(const char *path, const struct POSIX_SECURITY *pxdesc)
|
||||
|
@ -6587,9 +6634,11 @@ int getoptions(int argc, char *argv[])
|
|||
fprintf(stderr," set the security parameters of file to perms\n");
|
||||
fprintf(stderr," secaudit -r[v] volume perms directory\n");
|
||||
fprintf(stderr," set the security parameters of files in directory to perms\n");
|
||||
#ifdef HAVE_SETXATTR
|
||||
fprintf(stderr," special case, does not require being root :\n");
|
||||
fprintf(stderr," secaudit [-v] mounted-file\n");
|
||||
fprintf(stderr," display the security parameters of a mounted file\n");
|
||||
#endif
|
||||
#if POSIXACLS
|
||||
fprintf(stderr," Note: perms can be an octal mode or a Posix ACL description\n");
|
||||
#else
|
||||
|
@ -7007,7 +7056,7 @@ int main(int argc, char *argv[])
|
|||
if (opt_s) {
|
||||
fd = fopen(argv[xarg+1],"rb");
|
||||
if (fd) {
|
||||
if (!dorestore(argv[xarg],fd))
|
||||
if (dorestore(argv[xarg],fd))
|
||||
cmderr = TRUE;
|
||||
fclose(fd);
|
||||
} else {
|
||||
|
|
|
@ -130,7 +130,11 @@ typedef enum { false, true } boolean;
|
|||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if __bool_true_false_are_defined
|
||||
typedef bool boolean, BOOL;
|
||||
#else
|
||||
typedef enum { false, true } boolean, BOOL;
|
||||
#endif
|
||||
typedef unsigned int DWORD; /* must be 32 bits whatever the platform */
|
||||
typedef DWORD *LPDWORD;
|
||||
|
||||
|
|
Loading…
Reference in New Issue