Author: mzugec Date: Fri Sep 25 17:57:54 2009 New Revision: 58786 URL: http://svn.opensuse.org/viewcvs/yast?rev=58786&view=rev Log: separation of netmask and prefix validation in Netmask module Modified: trunk/yast2/VERSION trunk/yast2/library/types/src/Netmask.ycp trunk/yast2/library/types/testsuite/tests/Netmask.ycp trunk/yast2/package/yast2.changes Modified: trunk/yast2/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/VERSION?rev=58786&r1=58785&r2=58786&view=diff ============================================================================== --- trunk/yast2/VERSION (original) +++ trunk/yast2/VERSION Fri Sep 25 17:57:54 2009 @@ -1 +1 @@ -2.18.25 +2.18.26 Modified: trunk/yast2/library/types/src/Netmask.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/types/src/Netmask.ycp?rev=58786&r1=58785&r2=58786&view=diff ============================================================================== --- trunk/yast2/library/types/src/Netmask.ycp (original) +++ trunk/yast2/library/types/src/Netmask.ycp Fri Sep 25 17:57:54 2009 @@ -17,6 +17,16 @@ global string ValidChars4 = "0123456789."; global string ValidChars6 = "0123456789"; +global define boolean CheckPrefix4(string prefix){ + if(prefix == nil || prefix == "") return false; + /* <0,32> */ + if(regexpmatch(prefix, "^[0-9]+$")) { + integer nm = tointeger(prefix); + return nm >= 0 && nm <= 32; + } else + return false; +} + /** * Check the IPv4 netmask * Note that 0.0.0.0 is not a correct netmask. @@ -27,11 +37,6 @@ if(netmask == nil || netmask == "") return false; - /* <0,32> */ - if(regexpmatch(netmask, "^[0-9]+$")) { - integer nm = tointeger(netmask); - return nm >= 0 && nm <= 32; - } /* 255.255.240.0 */ string s1 = "(128|192|224|240|248|252|254|255)"; Modified: trunk/yast2/library/types/testsuite/tests/Netmask.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/types/testsuite/tests/Netmask.ycp?rev=58786&r1=58785&r2=58786&view=diff ============================================================================== --- trunk/yast2/library/types/testsuite/tests/Netmask.ycp (original) +++ trunk/yast2/library/types/testsuite/tests/Netmask.ycp Fri Sep 25 17:57:54 2009 @@ -40,12 +40,12 @@ TEST(``(Netmask::Check4("1.A.3.4")), [], nil); TEST(``(Netmask::Check4("0.0.0.0")), [], nil); -TEST(``(Netmask::Check4(nil)), [], nil); -TEST(``(Netmask::Check4("")), [], nil); -TEST(``(Netmask::Check4("33")), [], nil); -TEST(``(Netmask::Check4("0")), [], nil); -TEST(``(Netmask::Check4("24")), [], nil); -TEST(``(Netmask::Check4("32")), [], nil); +TEST(``(Netmask::CheckPrefix4(nil)), [], nil); +TEST(``(Netmask::CheckPrefix4("")), [], nil); +TEST(``(Netmask::CheckPrefix4("33")), [], nil); +TEST(``(Netmask::CheckPrefix4("0")), [], nil); +TEST(``(Netmask::CheckPrefix4("24")), [], nil); +TEST(``(Netmask::CheckPrefix4("32")), [], nil); DUMP("Netmask::Check6"); TEST(``(Netmask::Check6(nil)), [], nil); Modified: trunk/yast2/package/yast2.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=58786&r1=58785&r2=58786&view=diff ============================================================================== --- trunk/yast2/package/yast2.changes (original) +++ trunk/yast2/package/yast2.changes Fri Sep 25 17:57:54 2009 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Sep 25 17:52:49 CEST 2009 - mzugec@suse.cz + +- separation of netmask and prefix validation in Netmask module +- 2.18.26 + +------------------------------------------------------------------- Mon Sep 14 13:46:56 CEST 2009 - mvidner@suse.cz - YaST would not start from the GNOME menu (Unknown option -S) bnc#537470. -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org