From fb2e8cb8a28a2a1a84909a8793a57d0d575da610 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 16 Mar 2021 16:12:50 -0700 Subject: Make ResetAcl opt-in instead of opt-out --- src/WixToolset.Core/Bind/TransferFilesCommand.cs | 10 +++++----- src/WixToolset.Core/CommandLine/BuildCommand.cs | 8 +++++++- src/WixToolset.Core/LayoutContext.cs | 2 +- src/WixToolset.Core/LayoutCreator.cs | 6 +----- 4 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Core/Bind/TransferFilesCommand.cs b/src/WixToolset.Core/Bind/TransferFilesCommand.cs index 51d5a744..b3b74fbc 100644 --- a/src/WixToolset.Core/Bind/TransferFilesCommand.cs +++ b/src/WixToolset.Core/Bind/TransferFilesCommand.cs @@ -13,12 +13,12 @@ namespace WixToolset.Core.Bind internal class TransferFilesCommand { - public TransferFilesCommand(IMessaging messaging, IEnumerable extensions, IEnumerable fileTransfers, bool suppressAclReset) + public TransferFilesCommand(IMessaging messaging, IEnumerable extensions, IEnumerable fileTransfers, bool resetAcls) { this.Extensions = extensions; this.Messaging = messaging; this.FileTransfers = fileTransfers; - this.SuppressAclReset = suppressAclReset; + this.ResetAcls = resetAcls; } private IMessaging Messaging { get; } @@ -27,7 +27,7 @@ namespace WixToolset.Core.Bind private IEnumerable FileTransfers { get; } - private bool SuppressAclReset { get; } + private bool ResetAcls { get; } public void Execute() { @@ -152,9 +152,9 @@ namespace WixToolset.Core.Bind } while (retry); } - // Finally, if there were any files remove the ACL that may have been added to + // Finally, if directed then reset remove ACLs that may may have been picked up // during the file transfer process. - if (0 < destinationFiles.Count && !this.SuppressAclReset) + if (this.ResetAcls && 0 < destinationFiles.Count) { try { diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index eda93f31..9efef830 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs @@ -372,7 +372,7 @@ namespace WixToolset.Core.CommandLine context.ContentsFile = this.ContentsFile; context.OutputsFile = this.OutputsFile; context.BuiltOutputsFile = this.BuiltOutputsFile; - context.SuppressAclReset = false; // TODO: correctly set SuppressAclReset + context.ResetAcls = this.commandLine.ResetAcls; context.CancellationToken = cancellationToken; var layout = this.ServiceProvider.GetService(); @@ -547,6 +547,8 @@ namespace WixToolset.Core.CommandLine public bool SuppressValidation { get; set; } + public bool ResetAcls { get; set; } + public CommandLine(IServiceProvider serviceProvider, IMessaging messaging) { this.ServiceProvider = serviceProvider; @@ -702,6 +704,10 @@ namespace WixToolset.Core.CommandLine case "sval": this.SuppressValidation = true; return true; + + case "resetacls": + this.ResetAcls = true; + return true; } if (parameter.StartsWith("sw")) diff --git a/src/WixToolset.Core/LayoutContext.cs b/src/WixToolset.Core/LayoutContext.cs index e4c8db7c..deb5057f 100644 --- a/src/WixToolset.Core/LayoutContext.cs +++ b/src/WixToolset.Core/LayoutContext.cs @@ -33,7 +33,7 @@ namespace WixToolset.Core public string BuiltOutputsFile { get; set; } - public bool SuppressAclReset { get; set; } + public bool ResetAcls { get; set; } public CancellationToken CancellationToken { get; set; } } diff --git a/src/WixToolset.Core/LayoutCreator.cs b/src/WixToolset.Core/LayoutCreator.cs index b31c4e16..0c5aaf63 100644 --- a/src/WixToolset.Core/LayoutCreator.cs +++ b/src/WixToolset.Core/LayoutCreator.cs @@ -18,13 +18,9 @@ namespace WixToolset.Core { internal LayoutCreator(IServiceProvider serviceProvider) { - this.ServiceProvider = serviceProvider; - this.Messaging = serviceProvider.GetService(); } - private IServiceProvider ServiceProvider { get; } - private IMessaging Messaging { get; } public void Layout(ILayoutContext context) @@ -44,7 +40,7 @@ namespace WixToolset.Core { this.Messaging.Write(VerboseMessages.LayingOutMedia()); - var command = new TransferFilesCommand(this.Messaging, context.Extensions, context.FileTransfers, context.SuppressAclReset); + var command = new TransferFilesCommand(this.Messaging, context.Extensions, context.FileTransfers, context.ResetAcls); command.Execute(); } -- cgit v1.2.3-55-g6feb