]> wimlib.net Git - wimlib/blobdiff - src/ntfs-apply.c
Add --noacls options and set dwDesiredAccess more appropriately
[wimlib] / src / ntfs-apply.c
index 8bc6c49b28d579917d753cd36d05a597c11395c8..4d2292b743df8aad8f9472e3c5e50609238d16e4 100644 (file)
@@ -274,7 +274,8 @@ static int
 apply_file_attributes_and_security_data(ntfs_inode *ni,
                                        ntfs_inode *dir_ni,
                                        const struct wim_dentry *dentry,
 apply_file_attributes_and_security_data(ntfs_inode *ni,
                                        ntfs_inode *dir_ni,
                                        const struct wim_dentry *dentry,
-                                       const WIMStruct *w)
+                                       const WIMStruct *w,
+                                       int extract_flags)
 {
        int ret;
        struct SECURITY_CONTEXT ctx;
 {
        int ret;
        struct SECURITY_CONTEXT ctx;
@@ -298,7 +299,9 @@ apply_file_attributes_and_security_data(ntfs_inode *ni,
                       dentry->full_path);
                return WIMLIB_ERR_NTFS_3G;
        }
                       dentry->full_path);
                return WIMLIB_ERR_NTFS_3G;
        }
-       if (inode->i_security_id != -1) {
+       if (inode->i_security_id != -1 &&
+           !(extract_flags & WIMLIB_EXTRACT_FLAG_NOACLS))
+       {
                const char *desc;
                const struct wim_security_data *sd;
 
                const char *desc;
                const struct wim_security_data *sd;
 
@@ -439,7 +442,8 @@ do_apply_dentry_ntfs(struct wim_dentry *dentry, ntfs_inode *dir_ni,
        }
 
        ret = apply_file_attributes_and_security_data(ni, dir_ni, dentry,
        }
 
        ret = apply_file_attributes_and_security_data(ni, dir_ni, dentry,
-                                                     args->w);
+                                                     args->w,
+                                                     args->extract_flags);
        if (ret != 0)
                goto out_close_dir_ni;
 
        if (ret != 0)
                goto out_close_dir_ni;
 
@@ -497,7 +501,8 @@ out:
 
 static int
 apply_root_dentry_ntfs(const struct wim_dentry *dentry,
 
 static int
 apply_root_dentry_ntfs(const struct wim_dentry *dentry,
-                      ntfs_volume *vol, const WIMStruct *w)
+                      ntfs_volume *vol, const WIMStruct *w,
+                      int extract_flags)
 {
        ntfs_inode *ni;
        int ret = 0;
 {
        ntfs_inode *ni;
        int ret = 0;
@@ -507,7 +512,8 @@ apply_root_dentry_ntfs(const struct wim_dentry *dentry,
                ERROR_WITH_ERRNO("Could not find root NTFS inode");
                return WIMLIB_ERR_NTFS_3G;
        }
                ERROR_WITH_ERRNO("Could not find root NTFS inode");
                return WIMLIB_ERR_NTFS_3G;
        }
-       ret = apply_file_attributes_and_security_data(ni, ni, dentry, w);
+       ret = apply_file_attributes_and_security_data(ni, ni, dentry, w,
+                                                     extract_flags);
        if (ntfs_inode_close(ni) != 0) {
                ERROR_WITH_ERRNO("Failed to close NTFS inode for root "
                                 "directory");
        if (ntfs_inode_close(ni) != 0) {
                ERROR_WITH_ERRNO("Failed to close NTFS inode for root "
                                 "directory");
@@ -529,7 +535,8 @@ apply_dentry_ntfs(struct wim_dentry *dentry, void *arg)
 
        /* Treat the root dentry specially. */
        if (dentry_is_root(dentry))
 
        /* Treat the root dentry specially. */
        if (dentry_is_root(dentry))
-               return apply_root_dentry_ntfs(dentry, vol, w);
+               return apply_root_dentry_ntfs(dentry, vol, w,
+                                             args->extract_flags);
 
        /* NTFS filename namespaces need careful consideration.  A name for a
         * NTFS file may be in either the POSIX, Win32, DOS, or Win32+DOS
 
        /* NTFS filename namespaces need careful consideration.  A name for a
         * NTFS file may be in either the POSIX, Win32, DOS, or Win32+DOS