From 75e57af7a89f502ac74c16f710654510feb53159 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 27 Jan 2015 22:31:41 -0600 Subject: [PATCH] win32_apply.c: test for EFS data before reparse data --- src/win32_apply.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/win32_apply.c b/src/win32_apply.c index 54c247ce..fb629845 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -1737,22 +1737,6 @@ begin_extract_stream_instance(const struct wim_lookup_table_entry *stream, build_extraction_path(dentry, ctx); } - /* Reparse point? */ - if (unlikely(inode->i_attributes & FILE_ATTRIBUTE_REPARSE_POINT) - && (stream_name_nchars == 0)) - { - if (!ctx->common.supported_features.reparse_points) - return 0; - - /* We can't write the reparse stream directly; we must set it - * with FSCTL_SET_REPARSE_POINT, which requires that all the - * data be available. So, stage the data in a buffer. */ - - if (!prepare_data_buffer(ctx, stream->size)) - return WIMLIB_ERR_NOMEM; - list_add_tail(&dentry->tmp_list, &ctx->reparse_dentries); - return 0; - } /* Encrypted file? */ if (unlikely(inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED) @@ -1778,6 +1762,28 @@ begin_extract_stream_instance(const struct wim_lookup_table_entry *stream, return 0; } + /* Reparse point? + * + * Note: FILE_ATTRIBUTE_REPARSE_POINT is tested *after* + * FILE_ATTRIBUTE_ENCRYPTED since the WIM format does not store both EFS + * data and reparse data for the same file, and the EFS data takes + * precedence. */ + if (unlikely(inode->i_attributes & FILE_ATTRIBUTE_REPARSE_POINT) + && (stream_name_nchars == 0)) + { + if (!ctx->common.supported_features.reparse_points) + return 0; + + /* We can't write the reparse stream directly; we must set it + * with FSCTL_SET_REPARSE_POINT, which requires that all the + * data be available. So, stage the data in a buffer. */ + + if (!prepare_data_buffer(ctx, stream->size)) + return WIMLIB_ERR_NOMEM; + list_add_tail(&dentry->tmp_list, &ctx->reparse_dentries); + return 0; + } + if (ctx->num_open_handles == MAX_OPEN_STREAMS) { /* XXX: Fix this. But because of the checks in * extract_stream_list(), this can now only happen on a -- 2.43.0