#ifdef'ed code which require implementation of extended attributes
parent
bb80ecc29f
commit
e4d19093ba
|
@ -216,7 +216,9 @@ typedef struct {
|
||||||
BOOL no_detach;
|
BOOL no_detach;
|
||||||
BOOL blkdev;
|
BOOL blkdev;
|
||||||
BOOL mounted;
|
BOOL mounted;
|
||||||
|
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||||
BOOL efs_raw;
|
BOOL efs_raw;
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
struct fuse_chan *fc;
|
struct fuse_chan *fc;
|
||||||
BOOL inherit;
|
BOOL inherit;
|
||||||
unsigned int secure_flags;
|
unsigned int secure_flags;
|
||||||
|
@ -675,6 +677,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx,
|
||||||
/* Regular or Interix (INTX) file. */
|
/* Regular or Interix (INTX) file. */
|
||||||
stbuf->st_mode = S_IFREG;
|
stbuf->st_mode = S_IFREG;
|
||||||
stbuf->st_size = ni->data_size;
|
stbuf->st_size = ni->data_size;
|
||||||
|
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||||
/*
|
/*
|
||||||
* return data size rounded to next 512 byte boundary for
|
* return data size rounded to next 512 byte boundary for
|
||||||
* encrypted files to include padding required for decryption
|
* encrypted files to include padding required for decryption
|
||||||
|
@ -682,7 +685,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx,
|
||||||
*/
|
*/
|
||||||
if (ctx->efs_raw && ni->flags & FILE_ATTR_ENCRYPTED)
|
if (ctx->efs_raw && ni->flags & FILE_ATTR_ENCRYPTED)
|
||||||
stbuf->st_size = ((ni->data_size + 511) & ~511) + 2;
|
stbuf->st_size = ((ni->data_size + 511) & ~511) + 2;
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
/*
|
/*
|
||||||
* Temporary fix to make ActiveSync work via Samba 3.0.
|
* Temporary fix to make ActiveSync work via Samba 3.0.
|
||||||
* See more on the ntfs-3g-devel list.
|
* See more on the ntfs-3g-devel list.
|
||||||
|
@ -1203,11 +1206,13 @@ static void ntfs_fuse_open(fuse_req_t req, fuse_ino_t ino,
|
||||||
/* mark a future need to compress the last chunk */
|
/* mark a future need to compress the last chunk */
|
||||||
if (na->data_flags & ATTR_COMPRESSION_MASK)
|
if (na->data_flags & ATTR_COMPRESSION_MASK)
|
||||||
state |= CLOSE_COMPRESSED;
|
state |= CLOSE_COMPRESSED;
|
||||||
|
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||||
/* mark a future need to fixup encrypted inode */
|
/* mark a future need to fixup encrypted inode */
|
||||||
if (ctx->efs_raw
|
if (ctx->efs_raw
|
||||||
&& !(na->data_flags & ATTR_IS_ENCRYPTED)
|
&& !(na->data_flags & ATTR_IS_ENCRYPTED)
|
||||||
&& (ni->flags & FILE_ATTR_ENCRYPTED))
|
&& (ni->flags & FILE_ATTR_ENCRYPTED))
|
||||||
state |= CLOSE_ENCRYPTED;
|
state |= CLOSE_ENCRYPTED;
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
}
|
}
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
} else
|
} else
|
||||||
|
@ -1266,12 +1271,14 @@ static void ntfs_fuse_read(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
/* limit reads at next 512 byte boundary for encrypted attributes */
|
|
||||||
max_read = na->data_size;
|
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) &&
|
if (ctx->efs_raw && (na->data_flags & ATTR_IS_ENCRYPTED) &&
|
||||||
NAttrNonResident(na)) {
|
NAttrNonResident(na)) {
|
||||||
max_read = ((na->data_size+511) & ~511) + 2;
|
max_read = ((na->data_size+511) & ~511) + 2;
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
if (offset + (off_t)size > max_read) {
|
if (offset + (off_t)size > max_read) {
|
||||||
if (max_read < offset)
|
if (max_read < offset)
|
||||||
goto ok;
|
goto ok;
|
||||||
|
@ -1884,11 +1891,13 @@ static int ntfs_fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
|
||||||
if (fi && (ni->flags & FILE_ATTR_COMPRESSED)) {
|
if (fi && (ni->flags & FILE_ATTR_COMPRESSED)) {
|
||||||
state |= CLOSE_COMPRESSED;
|
state |= CLOSE_COMPRESSED;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||||
/* mark a future need to fixup encrypted inode */
|
/* mark a future need to fixup encrypted inode */
|
||||||
if (fi
|
if (fi
|
||||||
&& ctx->efs_raw
|
&& ctx->efs_raw
|
||||||
&& (ni->flags & FILE_ATTR_ENCRYPTED))
|
&& (ni->flags & FILE_ATTR_ENCRYPTED))
|
||||||
state |= CLOSE_ENCRYPTED;
|
state |= CLOSE_ENCRYPTED;
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
ntfs_inode_update_mbsname(dir_ni, name, ni->mft_no);
|
ntfs_inode_update_mbsname(dir_ni, name, ni->mft_no);
|
||||||
NInoSetDirty(ni);
|
NInoSetDirty(ni);
|
||||||
e->ino = ni->mft_no;
|
e->ino = ni->mft_no;
|
||||||
|
@ -2377,8 +2386,10 @@ static void ntfs_fuse_release(fuse_req_t req, fuse_ino_t ino,
|
||||||
res = 0;
|
res = 0;
|
||||||
if (of->state & CLOSE_COMPRESSED)
|
if (of->state & CLOSE_COMPRESSED)
|
||||||
res = ntfs_attr_pclose(na);
|
res = ntfs_attr_pclose(na);
|
||||||
|
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||||
if (of->state & CLOSE_ENCRYPTED)
|
if (of->state & CLOSE_ENCRYPTED)
|
||||||
res = ntfs_efs_fixup_attribute(NULL, na);
|
res = ntfs_efs_fixup_attribute(NULL, na);
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
exit:
|
exit:
|
||||||
if (na)
|
if (na)
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
|
@ -3669,7 +3680,9 @@ static char *parse_mount_options(const char *orig_opts)
|
||||||
int want_permissions = 0;
|
int want_permissions = 0;
|
||||||
|
|
||||||
ctx->secure_flags = 0;
|
ctx->secure_flags = 0;
|
||||||
|
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||||
ctx->efs_raw = FALSE;
|
ctx->efs_raw = FALSE;
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
options = strdup(orig_opts ? orig_opts : "");
|
options = strdup(orig_opts ? orig_opts : "");
|
||||||
if (!options) {
|
if (!options) {
|
||||||
ntfs_log_perror("%s: strdup failed", EXEC_NAME);
|
ntfs_log_perror("%s: strdup failed", EXEC_NAME);
|
||||||
|
@ -3850,10 +3863,12 @@ static char *parse_mount_options(const char *orig_opts)
|
||||||
"'usermapping' option.\n");
|
"'usermapping' option.\n");
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||||
} else if (!strcmp(opt, "efs_raw")) {
|
} else if (!strcmp(opt, "efs_raw")) {
|
||||||
if (bogus_option_value(val, "efs_raw"))
|
if (bogus_option_value(val, "efs_raw"))
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
ctx->efs_raw = TRUE;
|
ctx->efs_raw = TRUE;
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
} else { /* Probably FUSE option. */
|
} else { /* Probably FUSE option. */
|
||||||
if (strappend(&ret, opt))
|
if (strappend(&ret, opt))
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
|
@ -4328,7 +4343,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
ctx->security.vol = ctx->vol;
|
ctx->security.vol = ctx->vol;
|
||||||
ctx->vol->secure_flags = ctx->secure_flags;
|
ctx->vol->secure_flags = ctx->secure_flags;
|
||||||
|
#ifdef HAVE_SETXATTR /* extended attributes interface required */
|
||||||
ctx->vol->efs_raw = ctx->efs_raw;
|
ctx->vol->efs_raw = ctx->efs_raw;
|
||||||
|
#endif /* HAVE_SETXATTR */
|
||||||
/* JPA open $Secure, (whatever NTFS version !) */
|
/* JPA open $Secure, (whatever NTFS version !) */
|
||||||
/* to initialize security data */
|
/* to initialize security data */
|
||||||
if (ntfs_open_secure(ctx->vol) && (ctx->vol->major_ver >= 3))
|
if (ntfs_open_secure(ctx->vol) && (ctx->vol->major_ver >= 3))
|
||||||
|
|
Loading…
Reference in New Issue