#include <errno.h>
#include "rbtree.h"
-/* Structure that allows searching the security descriptors by SHA1 message
- * digest. */
+/* Red-black tree that maps SHA1 message digests of security descriptors to
+ * security IDs, which are themselves indices into the table of security
+ * descriptors in the 'struct wim_security_data'. */
struct sd_set {
struct wim_security_data *sd;
struct rb_root rb_root;
};
-/* Binary tree node of security descriptors, indexed by the @hash field. */
struct sd_node {
int security_id;
u8 hash[SHA1_HASH_SIZE];
if (ntfs_attr_pread(na, 0, 8, buf) != 8)
goto out_error;
*reparse_tag_ret = le32_to_cpu(*(u32*)buf);
+ DEBUG("ReparseTag = %#x", *reparse_tag_ret);
pos = 8;
bytes_remaining -= 8;
}
if (ret != 0)
goto out_put_actx;
+ if (type == AT_REPARSE_POINT)
+ dentry->d_inode->i_reparse_tag = reparse_tag;
+
/* Make a lookup table entry for the stream, or use an existing
* one if there's already an identical stream. */
lte = __lookup_resource(lookup_table, attr_hash);
lte->ntfs_loc = ntfs_loc;
lte->resource_location = RESOURCE_IN_NTFS_VOLUME;
if (type == AT_REPARSE_POINT) {
- dentry->d_inode->i_reparse_tag = reparse_tag;
ntfs_loc->is_reparse_point = true;
lte->resource_entry.original_size = data_size - 8;
lte->resource_entry.size = data_size - 8;
if (name_length == 0) {
/* Unnamed data stream. Put the reference to it in the
* dentry's inode. */
+ #if 0
if (dentry->d_inode->i_lte) {
ERROR("Found two un-named data streams for "
"`%s'", path);
goto out_free_lte;
}
dentry->d_inode->i_lte = lte;
+ #else
+ if (dentry->d_inode->i_lte) {
+ WARNING("Found two un-named data streams for "
+ "`%s'", path);
+ free_lookup_table_entry(lte);
+ } else {
+ dentry->d_inode->i_lte = lte;
+ }
+ #endif
} else {
/* Named data stream. Put the reference to it in the
* alternate data stream entries */
if (dentry->is_win32_name) {
node = lookup_dos_name(map, dentry->d_inode->i_ino);
if (node) {
- dentry->short_name = MALLOC(node->name_len_bytes + 2);
+ dentry->short_name = MALLOC(node->name_len_bytes);
if (!dentry->short_name)
return WIMLIB_ERR_NOMEM;
memcpy(dentry->short_name, node->dos_name,
node->name_len_bytes);
- *(u16*)&dentry->short_name[node->name_len_bytes] = 0;
dentry->short_name_len = node->name_len_bytes;
DEBUG("Assigned DOS name to ino %"PRIu64,
dentry->d_inode->i_ino);
} else {
- DEBUG("ino %"PRIu64" has Win32 name with no "
- "corresponding DOS name",
- dentry->d_inode->i_ino);
+ WARNING("NTFS inode %"PRIu64" has Win32 name with no "
+ "corresponding DOS name",
+ dentry->d_inode->i_ino);
}
}
return 0;
ctx = dirent;
if (name_type & FILE_NAME_DOS) {
- /* Special case: If this is the entry for a DOS name, store it
- * for later. */
+ /* If this is the entry for a DOS name, store it for later. */
ret = insert_dos_name(ctx->dos_name_map, name,
name_len, mref & MFT_REF_MASK_CPU);
- if (ret != 0)
+
+ /* Return now if an error occurred or if this is just a DOS name
+ * and not a Win32+DOS name. */
+ if (ret != 0 || name_type == FILE_NAME_DOS)
return ret;
- if (name_type == FILE_NAME_DOS) /* DOS only, not Win32 + DOS */
- return 0;
}
ret = utf16_to_utf8((const char*)name, name_len * 2,
&utf8_name, &utf8_name_len);