Mailinglist Archive: yast-devel (121 mails)

< Previous Next >
[yast-devel] Re: [yast-commit] r64422 - in /trunk/yast2/library/network: src/SuSEFirewallExpertRules.ycp testsuite/tests/SuSEFirewallExpertRules.out testsuite/tests/SuSEFirewallExpertRules.ycp
On Thu, Jun 16, 2011 at 01:09:58PM -0000, locilka@xxxxxxxxxxxxxxxxx wrote:
Author: locilka
Date: Thu Jun 16 15:09:58 2011
New Revision: 64422

URL: http://svn.opensuse.org/viewcvs/yast?rev=64422&view=rev
Log:
A better fix for my previous commit (stricter/correct validation)

Wow! That is a sign that having tests does help.

Modified:
trunk/yast2/library/network/src/SuSEFirewallExpertRules.ycp
trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.out
trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.ycp

Modified: trunk/yast2/library/network/src/SuSEFirewallExpertRules.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/network/src/SuSEFirewallExpertRules.ycp?rev=64422&r1=64421&r2=64422&view=diff
==============================================================================
--- trunk/yast2/library/network/src/SuSEFirewallExpertRules.ycp (original)
+++ trunk/yast2/library/network/src/SuSEFirewallExpertRules.ycp Thu Jun 16
15:09:58 2011
@@ -83,7 +83,7 @@
// A.B.C.D/1 - A.B.C.D/32 (IP with a numeric netmask)
else if (regexpmatch(network, "^" + type_ip4 + "/[01234567890]+$")) {
string part_ip = regexpsub (network, "^(" + type_ip4 +
")/[01234567890]+$", "\\1");
- string part_bits = regexpsub (network, "^" + type_ip4 +
"/([01234567890])+$", "\\1");
+ string part_bits = regexpsub (network, "^" + type_ip4 +
"/([01234567890]+)$", "\\1");

BTW there is still 0 twice. Next time use [0-9] which is safe (unlike [a-z]).

return (IP::Check4(part_ip) &&
ValidNetmaskBits(tointeger(part_bits)));
}

Modified:
trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.out?rev=64422&r1=64421&r2=64422&view=diff
==============================================================================
--- trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.out
(original)
+++ trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.out
Thu Jun 16 15:09:58 2011
@@ -6,8 +6,11 @@
Return true
Return true
Return true
+Return true
Dump All these should be *invalid* (false):
Return false
Return false
Return false
+Return false
+Return false
Dump == Done ==

Modified:
trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.ycp?rev=64422&r1=64421&r2=64422&view=diff
==============================================================================
--- trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.ycp
(original)
+++ trunk/yast2/library/network/testsuite/tests/SuSEFirewallExpertRules.ycp
Thu Jun 16 15:09:58 2011
@@ -9,11 +9,12 @@

list <string> valid_network_definitions = [
"192.168.0.1", "192.168.0.0/24", "192.168.0.1/32",
"192.168.0.0/255.255.0.0",
- "192.168.0.0/255.255.224.0", "0/0",
+ "192.168.0.0/255.255.224.0", "0/0", "192.168.0.1/16",
];

list <string> invalid_network_definitions = [
"192.168.0.355", "192.168.0.1/0", "192.168.0.0/255.255.333.0",
+ "192.168.0.1/888", "192.168.0.1/33",
];

DUMP("All these should be *valid* (true):");

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

--
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner

Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
< Previous Next >
This Thread
  • No further messages