diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-06-27 14:06:52 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-06-27 14:06:52 -0700 |
| commit | 8181317ba1b9f718b6e54ce13cba04351e464c01 (patch) | |
| tree | 244f72ad9bda71e8b1663304817693499c6f0302 /src | |
| parent | f1d9b41bde2786f9d982a6f6663e1b6675035213 (diff) | |
| download | wix-8181317ba1b9f718b6e54ce13cba04351e464c01.tar.gz wix-8181317ba1b9f718b6e54ce13cba04351e464c01.tar.bz2 wix-8181317ba1b9f718b6e54ce13cba04351e464c01.zip | |
Remove use of RemoteAddress inner text
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs | 2 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Firewall/TestData/UsingOutboundFirewall/PackageComponents.wxs | 2 | ||||
| -rw-r--r-- | src/wixext/FirewallCompiler.cs | 11 | ||||
| -rw-r--r-- | src/wixext/FirewallErrors.cs | 6 | ||||
| -rw-r--r-- | src/wixext/firewall.xsd | 58 |
5 files changed, 38 insertions, 41 deletions
diff --git a/src/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs b/src/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs index 910cca2d..53e75427 100644 --- a/src/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs +++ b/src/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | <Component> | 6 | <Component> |
| 7 | <File Source="example.txt" /> | 7 | <File Source="example.txt" /> |
| 8 | <fw:FirewallException Id="ExampleFirewall" Description="An example firewall" Name="example" Port="42"> | 8 | <fw:FirewallException Id="ExampleFirewall" Description="An example firewall" Name="example" Port="42"> |
| 9 | <fw:RemoteAddress>*</fw:RemoteAddress> | 9 | <fw:RemoteAddress Value="*" /> |
| 10 | </fw:FirewallException> | 10 | </fw:FirewallException> |
| 11 | </Component> | 11 | </Component> |
| 12 | </ComponentGroup> | 12 | </ComponentGroup> |
diff --git a/src/test/WixToolsetTest.Firewall/TestData/UsingOutboundFirewall/PackageComponents.wxs b/src/test/WixToolsetTest.Firewall/TestData/UsingOutboundFirewall/PackageComponents.wxs index f8c1e781..8084706e 100644 --- a/src/test/WixToolsetTest.Firewall/TestData/UsingOutboundFirewall/PackageComponents.wxs +++ b/src/test/WixToolsetTest.Firewall/TestData/UsingOutboundFirewall/PackageComponents.wxs | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | <Component> | 6 | <Component> |
| 7 | <File Source="example.txt" /> | 7 | <File Source="example.txt" /> |
| 8 | <fw:FirewallException Description="An example outbound firewall" Name="example" Port="42" Outbound="yes"> | 8 | <fw:FirewallException Description="An example outbound firewall" Name="example" Port="42" Outbound="yes"> |
| 9 | <fw:RemoteAddress>*</fw:RemoteAddress> | 9 | <fw:RemoteAddress Value="*" /> |
| 10 | </fw:FirewallException> | 10 | </fw:FirewallException> |
| 11 | </Component> | 11 | </Component> |
| 12 | </ComponentGroup> | 12 | </ComponentGroup> |
diff --git a/src/wixext/FirewallCompiler.cs b/src/wixext/FirewallCompiler.cs index aefc7f2c..e3cf201b 100644 --- a/src/wixext/FirewallCompiler.cs +++ b/src/wixext/FirewallCompiler.cs | |||
| @@ -312,13 +312,19 @@ namespace WixToolset.Firewall | |||
| 312 | private void ParseRemoteAddressElement(Intermediate intermediate, IntermediateSection section, XElement element, ref string remoteAddresses) | 312 | private void ParseRemoteAddressElement(Intermediate intermediate, IntermediateSection section, XElement element, ref string remoteAddresses) |
| 313 | { | 313 | { |
| 314 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 314 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
| 315 | string address = null; | ||
| 315 | 316 | ||
| 316 | // no attributes | 317 | // no attributes |
| 317 | foreach (var attrib in element.Attributes()) | 318 | foreach (var attrib in element.Attributes()) |
| 318 | { | 319 | { |
| 319 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 320 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 320 | { | 321 | { |
| 321 | this.ParseHelper.UnexpectedAttribute(element, attrib); | 322 | switch (attrib.Name.LocalName) |
| 323 | { | ||
| 324 | case "Value": | ||
| 325 | address = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 326 | break; | ||
| 327 | } | ||
| 322 | } | 328 | } |
| 323 | else | 329 | else |
| 324 | { | 330 | { |
| @@ -328,10 +334,9 @@ namespace WixToolset.Firewall | |||
| 328 | 334 | ||
| 329 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | 335 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| 330 | 336 | ||
| 331 | var address = this.ParseHelper.GetTrimmedInnerText(element); | ||
| 332 | if (String.IsNullOrEmpty(address)) | 337 | if (String.IsNullOrEmpty(address)) |
| 333 | { | 338 | { |
| 334 | this.Messaging.Write(FirewallErrors.IllegalEmptyRemoteAddress(sourceLineNumbers)); | 339 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Value")); |
| 335 | } | 340 | } |
| 336 | else | 341 | else |
| 337 | { | 342 | { |
diff --git a/src/wixext/FirewallErrors.cs b/src/wixext/FirewallErrors.cs index 3fff8c8d..b2dac782 100644 --- a/src/wixext/FirewallErrors.cs +++ b/src/wixext/FirewallErrors.cs | |||
| @@ -12,11 +12,6 @@ namespace WixToolset.Firewall | |||
| 12 | return Message(sourceLineNumbers, Ids.IllegalRemoteAddressWithScopeAttribute, "The RemoteAddress element cannot be specified because its parent FirewallException already specified the Scope attribute. To use RemoteAddress elements, omit the Scope attribute."); | 12 | return Message(sourceLineNumbers, Ids.IllegalRemoteAddressWithScopeAttribute, "The RemoteAddress element cannot be specified because its parent FirewallException already specified the Scope attribute. To use RemoteAddress elements, omit the Scope attribute."); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | public static Message IllegalEmptyRemoteAddress(SourceLineNumber sourceLineNumbers) | ||
| 16 | { | ||
| 17 | return Message(sourceLineNumbers, Ids.IllegalEmptyRemoteAddress, "The RemoteAddress element's inner text cannot be an empty string or completely whitespace."); | ||
| 18 | } | ||
| 19 | |||
| 20 | public static Message NoExceptionSpecified(SourceLineNumber sourceLineNumbers) | 15 | public static Message NoExceptionSpecified(SourceLineNumber sourceLineNumbers) |
| 21 | { | 16 | { |
| 22 | return Message(sourceLineNumbers, Ids.NoExceptionSpecified, "The FirewallException element doesn't identify the target of the firewall exception. To create an application exception, nest the FirewallException element under a File element or provide a value for the File or Program attributes. To create a port exception, provide a value for the Port attribute."); | 17 | return Message(sourceLineNumbers, Ids.NoExceptionSpecified, "The FirewallException element doesn't identify the target of the firewall exception. To create an application exception, nest the FirewallException element under a File element or provide a value for the File or Program attributes. To create a port exception, provide a value for the Port attribute."); |
| @@ -35,7 +30,6 @@ namespace WixToolset.Firewall | |||
| 35 | public enum Ids | 30 | public enum Ids |
| 36 | { | 31 | { |
| 37 | IllegalRemoteAddressWithScopeAttribute = 6401, | 32 | IllegalRemoteAddressWithScopeAttribute = 6401, |
| 38 | IllegalEmptyRemoteAddress = 6402, | ||
| 39 | NoExceptionSpecified = 6403, | 33 | NoExceptionSpecified = 6403, |
| 40 | } | 34 | } |
| 41 | } | 35 | } |
diff --git a/src/wixext/firewall.xsd b/src/wixext/firewall.xsd index fec7e37a..20ad065f 100644 --- a/src/wixext/firewall.xsd +++ b/src/wixext/firewall.xsd | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | <xs:choice minOccurs="0" maxOccurs="unbounded"> | 33 | <xs:choice minOccurs="0" maxOccurs="unbounded"> |
| 34 | <xs:annotation> | 34 | <xs:annotation> |
| 35 | <xs:documentation> | 35 | <xs:documentation> |
| 36 | Explicitly-listed remote addresses that this exception allows through the | 36 | Explicitly-listed remote addresses that this exception allows through the |
| 37 | firewall. | 37 | firewall. |
| 38 | </xs:documentation> | 38 | </xs:documentation> |
| 39 | </xs:annotation> | 39 | </xs:annotation> |
| @@ -51,7 +51,7 @@ | |||
| 51 | <xs:attribute name="Name" type="xs:string" use="required"> | 51 | <xs:attribute name="Name" type="xs:string" use="required"> |
| 52 | <xs:annotation> | 52 | <xs:annotation> |
| 53 | <xs:documentation> | 53 | <xs:documentation> |
| 54 | Name of this firewall exception, visible to the user in the firewall | 54 | Name of this firewall exception, visible to the user in the firewall |
| 55 | control panel. | 55 | control panel. |
| 56 | </xs:documentation> | 56 | </xs:documentation> |
| 57 | </xs:annotation> | 57 | </xs:annotation> |
| @@ -63,7 +63,7 @@ | |||
| 63 | The scope of this firewall exception, which indicates whether incoming | 63 | The scope of this firewall exception, which indicates whether incoming |
| 64 | connections can come from any computer including those on the Internet | 64 | connections can come from any computer including those on the Internet |
| 65 | or only those on the local network subnet. To more precisely specify | 65 | or only those on the local network subnet. To more precisely specify |
| 66 | allowed remote address, specify a custom scope using RemoteAddress | 66 | allowed remote address, specify a custom scope using RemoteAddress |
| 67 | child elements. | 67 | child elements. |
| 68 | </xs:documentation> | 68 | </xs:documentation> |
| 69 | </xs:annotation> | 69 | </xs:annotation> |
| @@ -78,10 +78,10 @@ | |||
| 78 | <xs:attribute name="Port" type="xs:string"> | 78 | <xs:attribute name="Port" type="xs:string"> |
| 79 | <xs:annotation> | 79 | <xs:annotation> |
| 80 | <xs:documentation> | 80 | <xs:documentation> |
| 81 | Port to allow through the firewall for this exception. | 81 | Port to allow through the firewall for this exception. |
| 82 | 82 | ||
| 83 | If you use Port and also File or Program in the same | 83 | If you use Port and also File or Program in the same |
| 84 | FirewallException element, the exception will fail to install on | 84 | FirewallException element, the exception will fail to install on |
| 85 | Windows XP and Windows Server 2003. IgnoreFailure="yes" can be used to | 85 | Windows XP and Windows Server 2003. IgnoreFailure="yes" can be used to |
| 86 | ignore the resulting failure, but the exception will not be added. | 86 | ignore the resulting failure, but the exception will not be added. |
| 87 | </xs:documentation> | 87 | </xs:documentation> |
| @@ -91,11 +91,11 @@ | |||
| 91 | <xs:attribute name="Protocol"> | 91 | <xs:attribute name="Protocol"> |
| 92 | <xs:annotation> | 92 | <xs:annotation> |
| 93 | <xs:documentation> | 93 | <xs:documentation> |
| 94 | IP protocol used for this firewall exception. If Port is defined, | 94 | IP protocol used for this firewall exception. If Port is defined, |
| 95 | "tcp" is assumed if the protocol is not specified. | 95 | "tcp" is assumed if the protocol is not specified. |
| 96 | 96 | ||
| 97 | If you use Protocol and also File or Program in the same | 97 | If you use Protocol and also File or Program in the same |
| 98 | FirewallException element, the exception will fail to install on | 98 | FirewallException element, the exception will fail to install on |
| 99 | Windows XP and Windows Server 2003. IgnoreFailure="yes" can be used to | 99 | Windows XP and Windows Server 2003. IgnoreFailure="yes" can be used to |
| 100 | ignore the resulting failure, but the exception will not be added. | 100 | ignore the resulting failure, but the exception will not be added. |
| 101 | </xs:documentation> | 101 | </xs:documentation> |
| @@ -111,11 +111,11 @@ | |||
| 111 | <xs:attribute name="File" type="xs:string"> | 111 | <xs:attribute name="File" type="xs:string"> |
| 112 | <xs:annotation> | 112 | <xs:annotation> |
| 113 | <xs:documentation> | 113 | <xs:documentation> |
| 114 | Identifier of a file to be granted access to all incoming ports and | 114 | Identifier of a file to be granted access to all incoming ports and |
| 115 | protocols. If you use File, you cannot also use Program. | 115 | protocols. If you use File, you cannot also use Program. |
| 116 | 116 | ||
| 117 | If you use File and also Port or Protocol in the same | 117 | If you use File and also Port or Protocol in the same |
| 118 | FirewallException element, the exception will fail to install on | 118 | FirewallException element, the exception will fail to install on |
| 119 | Windows XP and Windows Server 2003. IgnoreFailure="yes" can be used to | 119 | Windows XP and Windows Server 2003. IgnoreFailure="yes" can be used to |
| 120 | ignore the resulting failure, but the exception will not be added. | 120 | ignore the resulting failure, but the exception will not be added. |
| 121 | </xs:documentation> | 121 | </xs:documentation> |
| @@ -125,13 +125,13 @@ | |||
| 125 | <xs:attribute name="Program" type="xs:string"> | 125 | <xs:attribute name="Program" type="xs:string"> |
| 126 | <xs:annotation> | 126 | <xs:annotation> |
| 127 | <xs:documentation> | 127 | <xs:documentation> |
| 128 | Path to a target program to be granted access to all incoming ports and | 128 | Path to a target program to be granted access to all incoming ports and |
| 129 | protocols. Note that this is a formatted field, so you can use [#fileId] | 129 | protocols. Note that this is a formatted field, so you can use [#fileId] |
| 130 | syntax to refer to a file being installed. If you use Program, you cannot | 130 | syntax to refer to a file being installed. If you use Program, you cannot |
| 131 | also use File. | 131 | also use File. |
| 132 | 132 | ||
| 133 | If you use Program and also Port or Protocol in the same | 133 | If you use Program and also Port or Protocol in the same |
| 134 | FirewallException element, the exception will fail to install on | 134 | FirewallException element, the exception will fail to install on |
| 135 | Windows XP and Windows Server 2003. IgnoreFailure="yes" can be used to | 135 | Windows XP and Windows Server 2003. IgnoreFailure="yes" can be used to |
| 136 | ignore the resulting failure, but the exception will not be added. | 136 | ignore the resulting failure, but the exception will not be added. |
| 137 | </xs:documentation> | 137 | </xs:documentation> |
| @@ -141,7 +141,7 @@ | |||
| 141 | <xs:attribute name="IgnoreFailure" type="YesNoType"> | 141 | <xs:attribute name="IgnoreFailure" type="YesNoType"> |
| 142 | <xs:annotation> | 142 | <xs:annotation> |
| 143 | <xs:documentation> | 143 | <xs:documentation> |
| 144 | If "yes", failures to register this firewall exception will be silently | 144 | If "yes", failures to register this firewall exception will be silently |
| 145 | ignored. If "no" (the default), failures will cause rollback. | 145 | ignored. If "no" (the default), failures will cause rollback. |
| 146 | </xs:documentation> | 146 | </xs:documentation> |
| 147 | </xs:annotation> | 147 | </xs:annotation> |
| @@ -165,7 +165,7 @@ | |||
| 165 | <xs:attribute name="Description" type="xs:string"> | 165 | <xs:attribute name="Description" type="xs:string"> |
| 166 | <xs:annotation> | 166 | <xs:annotation> |
| 167 | <xs:documentation> | 167 | <xs:documentation> |
| 168 | Description for this firewall rule displayed in Windows Firewall manager in | 168 | Description for this firewall rule displayed in Windows Firewall manager in |
| 169 | Windows Vista and later. | 169 | Windows Vista and later. |
| 170 | </xs:documentation> | 170 | </xs:documentation> |
| 171 | </xs:annotation> | 171 | </xs:annotation> |
| @@ -184,26 +184,24 @@ | |||
| 184 | <xs:element name="RemoteAddress"> | 184 | <xs:element name="RemoteAddress"> |
| 185 | <xs:annotation> | 185 | <xs:annotation> |
| 186 | <xs:documentation> | 186 | <xs:documentation> |
| 187 | A remote address to which the port or program can listen. Address formats vary | 187 | A remote address to which the port or program can listen. Address formats vary |
| 188 | based on the version of Windows and Windows Firewall the program is being installed | 188 | based on the version of Windows and Windows Firewall the program is being installed |
| 189 | on. For Windows XP SP2 and Windows Server 2003 SP1, see | 189 | on. For Windows XP SP2 and Windows Server 2003 SP1, see |
| 190 | <html:a href="http://msdn.microsoft.com/en-us/library/aa365270.aspx"> | 190 | <html:a href="http://msdn.microsoft.com/en-us/library/aa365270.aspx"> |
| 191 | RemoteAddresses Property</html:a>. | 191 | RemoteAddresses Property</html:a>. |
| 192 | For Windows Vista and Windows Server 2008, see | 192 | For Windows Vista and Windows Server 2008, see |
| 193 | <html:a href="http://msdn.microsoft.com/en-us/library/aa365366.aspx"> | 193 | <html:a href="https://docs.microsoft.com/en-us/windows/win32/api/netfw/nf-netfw-inetfwrule-get_remoteaddresses"> |
| 194 | RemoteAddresses Property</html:a>. | 194 | RemoteAddresses Property</html:a>. |
| 195 | </xs:documentation> | 195 | </xs:documentation> |
| 196 | </xs:annotation> | 196 | </xs:annotation> |
| 197 | <xs:complexType> | 197 | <xs:complexType> |
| 198 | <xs:simpleContent> | 198 | <xs:attribute name="Value" type="xs:string" use="required"> |
| 199 | <xs:extension base="xs:string"> | 199 | <xs:annotation> |
| 200 | <xs:annotation> | 200 | <xs:documentation> |
| 201 | <xs:documentation> | ||
| 202 | A remote address. | 201 | A remote address. |
| 203 | </xs:documentation> | 202 | </xs:documentation> |
| 204 | </xs:annotation> | 203 | </xs:annotation> |
| 205 | </xs:extension> | 204 | </xs:attribute> |
| 206 | </xs:simpleContent> | ||
| 207 | </xs:complexType> | 205 | </xs:complexType> |
| 208 | </xs:element> | 206 | </xs:element> |
| 209 | 207 | ||
