diff options
author | Rob Mensching <rob@firegiant.com> | 2022-11-15 15:47:48 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-11-15 22:04:07 -0800 |
commit | d14c02d4ca6ee820b7111b789d9f904e0fd52804 (patch) | |
tree | 012cf555619080c80a8688ad44257bd5e9d7a90b /src/ext | |
parent | 266aed497296cdb087eac157c575e95253ed67ca (diff) | |
download | wix-d14c02d4ca6ee820b7111b789d9f904e0fd52804.tar.gz wix-d14c02d4ca6ee820b7111b789d9f904e0fd52804.tar.bz2 wix-d14c02d4ca6ee820b7111b789d9f904e0fd52804.zip |
Fix when xmlns placed directly on PermissionEx
This is NOT recommended in v4 and its converter will move namespaces to
the root element, but WiX v3 allowed it so we'll continued to do so in
v4.
Fixes 7010
Diffstat (limited to 'src/ext')
-rw-r--r-- | src/ext/Util/test/WixToolsetTest.Util/TestData/PermissionEx/PackageComponents.wxs | 9 | ||||
-rw-r--r-- | src/ext/Util/wixext/UtilCompiler.cs | 36 |
2 files changed, 27 insertions, 18 deletions
diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/PermissionEx/PackageComponents.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/PermissionEx/PackageComponents.wxs index 0634d7d4..09f0a724 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/TestData/PermissionEx/PackageComponents.wxs +++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/PermissionEx/PackageComponents.wxs | |||
@@ -1,4 +1,4 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> |
2 | <Fragment> | 2 | <Fragment> |
3 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | 3 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> |
4 | <Component> | 4 | <Component> |
@@ -15,7 +15,12 @@ | |||
15 | <util:PermissionEx User="Everyone" GenericAll="yes" /> | 15 | <util:PermissionEx User="Everyone" GenericAll="yes" /> |
16 | </RegistryKey> | 16 | </RegistryKey> |
17 | <RegistryValue Root="HKLM" Key="TestRegistryValueKey" Value="abc"> | 17 | <RegistryValue Root="HKLM" Key="TestRegistryValueKey" Value="abc"> |
18 | <util:PermissionEx User="Everyone" GenericAll="yes" /> | 18 | <!-- |
19 | Example of placing the namespace on the extension element. This is NOT recommended | ||
20 | in v4 and its converter will move namespaces to the root, but WiX v3 allowed it so | ||
21 | we'll continued to do so for now. | ||
22 | --> | ||
23 | <PermissionEx User="Everyone" GenericAll="yes" xmlns="http://wixtoolset.org/schemas/v4/wxs/util" /> | ||
19 | </RegistryValue> | 24 | </RegistryValue> |
20 | </Component> | 25 | </Component> |
21 | </ComponentGroup> | 26 | </ComponentGroup> |
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs index 47f82ca6..96b2ee0a 100644 --- a/src/ext/Util/wixext/UtilCompiler.cs +++ b/src/ext/Util/wixext/UtilCompiler.cs | |||
@@ -1286,6 +1286,8 @@ namespace WixToolset.Util | |||
1286 | var bits = new BitArray(32); | 1286 | var bits = new BitArray(32); |
1287 | string user = null; | 1287 | string user = null; |
1288 | 1288 | ||
1289 | var validBitNames = new HashSet<string>(UtilConstants.StandardPermissions.Concat(UtilConstants.GenericPermissions).Concat(UtilConstants.FolderPermissions)); | ||
1290 | |||
1289 | foreach (var attrib in element.Attributes()) | 1291 | foreach (var attrib in element.Attributes()) |
1290 | { | 1292 | { |
1291 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1293 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
@@ -1297,18 +1299,18 @@ namespace WixToolset.Util | |||
1297 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, UtilSymbolDefinitions.User, user); | 1299 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, UtilSymbolDefinitions.User, user); |
1298 | break; | 1300 | break; |
1299 | default: | 1301 | default: |
1300 | var attribValue = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 1302 | if (validBitNames.Contains(attrib.Name.LocalName)) |
1301 | if (!this.TrySetBitFromName(UtilConstants.StandardPermissions, attrib.Name.LocalName, attribValue, bits, 16)) | ||
1302 | { | 1303 | { |
1303 | if (!this.TrySetBitFromName(UtilConstants.GenericPermissions, attrib.Name.LocalName, attribValue, bits, 28)) | 1304 | var attribValue = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
1305 | if (this.TrySetBitFromName(UtilConstants.StandardPermissions, attrib.Name.LocalName, attribValue, bits, 16) || | ||
1306 | this.TrySetBitFromName(UtilConstants.GenericPermissions, attrib.Name.LocalName, attribValue, bits, 28) || | ||
1307 | this.TrySetBitFromName(UtilConstants.FolderPermissions, attrib.Name.LocalName, attribValue, bits, 0)) | ||
1304 | { | 1308 | { |
1305 | if (!this.TrySetBitFromName(UtilConstants.FolderPermissions, attrib.Name.LocalName, attribValue, bits, 0)) | 1309 | break; |
1306 | { | ||
1307 | this.ParseHelper.UnexpectedAttribute(element, attrib); | ||
1308 | break; | ||
1309 | } | ||
1310 | } | 1310 | } |
1311 | } | 1311 | } |
1312 | |||
1313 | this.ParseHelper.UnexpectedAttribute(element, attrib); | ||
1312 | break; | 1314 | break; |
1313 | } | 1315 | } |
1314 | } | 1316 | } |
@@ -2477,6 +2479,8 @@ namespace WixToolset.Util | |||
2477 | break; | 2479 | break; |
2478 | } | 2480 | } |
2479 | 2481 | ||
2482 | var validBitNames = new HashSet<string>(UtilConstants.StandardPermissions.Concat(UtilConstants.GenericPermissions).Concat(specialPermissions)); | ||
2483 | |||
2480 | foreach (var attrib in element.Attributes()) | 2484 | foreach (var attrib in element.Attributes()) |
2481 | { | 2485 | { |
2482 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 2486 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
@@ -2500,18 +2504,18 @@ namespace WixToolset.Util | |||
2500 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 2504 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
2501 | break; | 2505 | break; |
2502 | default: | 2506 | default: |
2503 | var attribValue = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 2507 | if (validBitNames.Contains(attrib.Name.LocalName)) |
2504 | if (!this.TrySetBitFromName(UtilConstants.StandardPermissions, attrib.Name.LocalName, attribValue, bits, 16)) | ||
2505 | { | 2508 | { |
2506 | if (!this.TrySetBitFromName(UtilConstants.GenericPermissions, attrib.Name.LocalName, attribValue, bits, 28)) | 2509 | var attribValue = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
2510 | if (this.TrySetBitFromName(UtilConstants.StandardPermissions, attrib.Name.LocalName, attribValue, bits, 16) || | ||
2511 | this.TrySetBitFromName(UtilConstants.GenericPermissions, attrib.Name.LocalName, attribValue, bits, 28) || | ||
2512 | this.TrySetBitFromName(specialPermissions, attrib.Name.LocalName, attribValue, bits, 0)) | ||
2507 | { | 2513 | { |
2508 | if (!this.TrySetBitFromName(specialPermissions, attrib.Name.LocalName, attribValue, bits, 0)) | 2514 | break; |
2509 | { | ||
2510 | this.ParseHelper.UnexpectedAttribute(element, attrib); | ||
2511 | break; | ||
2512 | } | ||
2513 | } | 2515 | } |
2514 | } | 2516 | } |
2517 | |||
2518 | this.ParseHelper.UnexpectedAttribute(element, attrib); | ||
2515 | break; | 2519 | break; |
2516 | } | 2520 | } |
2517 | } | 2521 | } |