diff options
Diffstat (limited to 'src/ext/Firewall/wixext/FirewallCompiler.cs')
-rw-r--r-- | src/ext/Firewall/wixext/FirewallCompiler.cs | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/ext/Firewall/wixext/FirewallCompiler.cs b/src/ext/Firewall/wixext/FirewallCompiler.cs index 19ee0b6d..ed49ba9c 100644 --- a/src/ext/Firewall/wixext/FirewallCompiler.cs +++ b/src/ext/Firewall/wixext/FirewallCompiler.cs | |||
@@ -135,7 +135,12 @@ namespace WixToolset.Firewall | |||
135 | protocol = FirewallConstants.NET_FW_IP_PROTOCOL_UDP; | 135 | protocol = FirewallConstants.NET_FW_IP_PROTOCOL_UDP; |
136 | break; | 136 | break; |
137 | default: | 137 | default: |
138 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "Protocol", protocolValue, "tcp", "udp")); | 138 | int parsedProtocol; |
139 | if (!Int32.TryParse(protocolValue, out parsedProtocol) || parsedProtocol > 255 || parsedProtocol < 0) | ||
140 | { | ||
141 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "Protocol", protocolValue, "tcp", "udp", "0-255")); | ||
142 | } | ||
143 | protocol = parsedProtocol; | ||
139 | break; | 144 | break; |
140 | } | 145 | } |
141 | break; | 146 | break; |
@@ -149,8 +154,20 @@ namespace WixToolset.Firewall | |||
149 | case "localSubnet": | 154 | case "localSubnet": |
150 | remoteAddresses = "LocalSubnet"; | 155 | remoteAddresses = "LocalSubnet"; |
151 | break; | 156 | break; |
157 | case "DNS": | ||
158 | remoteAddresses = "dns"; | ||
159 | break; | ||
160 | case "DHCP": | ||
161 | remoteAddresses = "dhcp"; | ||
162 | break; | ||
163 | case "WINS": | ||
164 | remoteAddresses = "wins"; | ||
165 | break; | ||
166 | case "defaultGateway": | ||
167 | remoteAddresses = "DefaultGateway"; | ||
168 | break; | ||
152 | default: | 169 | default: |
153 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "Scope", scope, "any", "localSubnet")); | 170 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "Scope", scope, "any", "localSubnet", "DNS", "DHCP", "WINS", "defaultGateway")); |
154 | break; | 171 | break; |
155 | } | 172 | } |
156 | break; | 173 | break; |
@@ -251,6 +268,21 @@ namespace WixToolset.Firewall | |||
251 | this.Messaging.Write(FirewallErrors.NoExceptionSpecified(sourceLineNumbers)); | 268 | this.Messaging.Write(FirewallErrors.NoExceptionSpecified(sourceLineNumbers)); |
252 | } | 269 | } |
253 | 270 | ||
271 | // Ports can only be specified if the protocol is TCP or UDP. | ||
272 | if (!String.IsNullOrEmpty(port) && protocol.HasValue) | ||
273 | { | ||
274 | switch(protocol.Value) | ||
275 | { | ||
276 | case FirewallConstants.NET_FW_IP_PROTOCOL_TCP: | ||
277 | case FirewallConstants.NET_FW_IP_PROTOCOL_UDP: | ||
278 | break; | ||
279 | |||
280 | default: | ||
281 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "Port", "Protocol", protocol.Value.ToString())); | ||
282 | break; | ||
283 | } | ||
284 | } | ||
285 | |||
254 | if (!this.Messaging.EncounteredError) | 286 | if (!this.Messaging.EncounteredError) |
255 | { | 287 | { |
256 | // at this point, File attribute and File parent element are treated the same | 288 | // at this point, File attribute and File parent element are treated the same |
@@ -300,8 +332,8 @@ namespace WixToolset.Firewall | |||
300 | symbol.Attributes = attributes; | 332 | symbol.Attributes = attributes; |
301 | } | 333 | } |
302 | 334 | ||
303 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4SchedFirewallExceptionsInstall", this.Context.Platform, CustomActionPlatforms.ARM64 | CustomActionPlatforms.X64 | CustomActionPlatforms.X86); | 335 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix5SchedFirewallExceptionsInstall", this.Context.Platform, CustomActionPlatforms.ARM64 | CustomActionPlatforms.X64 | CustomActionPlatforms.X86); |
304 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4SchedFirewallExceptionsUninstall", this.Context.Platform, CustomActionPlatforms.ARM64 | CustomActionPlatforms.X64 | CustomActionPlatforms.X86); | 336 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix5SchedFirewallExceptionsUninstall", this.Context.Platform, CustomActionPlatforms.ARM64 | CustomActionPlatforms.X64 | CustomActionPlatforms.X86); |
305 | } | 337 | } |
306 | } | 338 | } |
307 | 339 | ||