From 49fd93718cd95f63a2af6e3214deb119d763cbf9 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 24 Feb 2006 09:20:10 +0000 Subject: [PATCH] Cope with attribute list attribute having invalid flags. Windows copes with this and even chkdsk does not detect or fix this so we have to cope with it, too. Thanks to a Pawel for reporting the problem. (Anton) --- ChangeLog | 6 +++++- libntfs/attrib.c | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 855dee5e..51e14881 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -02/01/2006 - 1.13.0 - Lots and lots and lots of fixes and enhancements. +24/02/2006 - 1.13.0 - Lots and lots and lots of fixes and enhancements. - Temporarily disable use of the legal ansi character checking in libntfs/unistr.c::ntfs_names_collate() pending a proper fix at some @@ -118,6 +118,10 @@ - Deal with missing syslog function by making code conditional on presence of syslog.h header file (DOS/djgpp). (Christophe) - Avoid clash with existing constants (OSX). (Christophe) + - Cope with attribute list attribute having invalid flags. Windows + copes with this and even chkdsk does not detect or fix this so we + have to cope with it, too. Thanks to a Pawel for reporting the + problem. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index b6533756..3f1cc9d5 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -104,7 +104,12 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, return 0; } /* Complex attribute? */ - if (a->flags) { + /* + * Ignore the flags in case they are not zero for an attribute list + * attribute. Windows does not complain about invalid flags and chkdsk + * does not detect or fix them so we need to cope with it, too. + */ + if (a->type != AT_ATTRIBUTE_LIST && a->flags) { ntfs_log_error("Non-zero (%04x) attribute flags. Cannot handle " "this yet.\n", le16_to_cpu(a->flags)); errno = EOPNOTSUPP; @@ -380,6 +385,13 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, } a = ctx->attr; + /* + * Wipe the flags in case they are not zero for an attribute list + * attribute. Windows does not complain about invalid flags and chkdsk + * does not detect or fix them so we need to cope with it, too. + */ + if (type == AT_ATTRIBUTE_LIST) + a->flags = 0; cs = a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE); if (!name) { if (a->name_length) {