Author: locilka Date: Thu Feb 9 15:24:21 2012 New Revision: 67399 URL: http://svn.opensuse.org/viewcvs/yast?rev=67399&view=rev Log: - Fixed transforming records from relative to absolute format. The final dot is added only to records including a zone name (bnc#745560). Modified: trunk/dns-server/package/yast2-dns-server.changes trunk/dns-server/src/dialog-masterzone.ycp Modified: trunk/dns-server/package/yast2-dns-server.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/dns-server/package/yast2-dns-server.changes?rev=67399&r1=67398&r2=67399&view=diff ============================================================================== --- trunk/dns-server/package/yast2-dns-server.changes (original) +++ trunk/dns-server/package/yast2-dns-server.changes Thu Feb 9 15:24:21 2012 @@ -1,3 +1,10 @@ +------------------------------------------------------------------ +Thu Feb 9 15:16:58 CET 2012 - locilka@suse.com + +- Fixed transforming records from relative to absolute format. + The final dot is added only to records including a zone name + (bnc#745560). + ------------------------------------------------------------------- Wed Nov 16 11:55:12 CET 2011 - jsuchome@suse.cz Modified: trunk/dns-server/src/dialog-masterzone.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/dns-server/src/dialog-masterzone.ycp?rev=67399&r1=67398&r2=67399&view=diff ============================================================================== --- trunk/dns-server/src/dialog-masterzone.ycp (original) +++ trunk/dns-server/src/dialog-masterzone.ycp Thu Feb 9 15:24:21 2012 @@ -1561,6 +1561,21 @@ return false; } +// Transform a given key/value by adding the ending dot if +// it ends with the current zone name +string TransformRecord (string record) { + string zone_regexp = mergestring ( + splitstring (current_zone["zone"]:"", "."), + "\\." + ); + + // key terminated with zone name without dot + if (regexpmatch (record, ".*\\." + zone_regexp + "$")) + record = record + "."; + + return record; +} + boolean CheckAndModifyRecord (string & type, string & key, string & val) { // (SYNTAX) Checking the record by record-type (true or false) if (CheckNewZoneRecordSyntax ($[ "key" : key, "type" : type, "val" : val ]) != true) { @@ -1601,11 +1616,15 @@ y2milestone("MX Priority decrased to maximal 65535 from %1", prio); } } - } else if (contains (["ns", "mx", "cname"], tolower_type)) { - if (regexpmatch (val, "\\..*[^.]$")) - val = val + "."; - } else if (regexpmatch (key, "\\..*[^.]$")) { - key = key + "."; + } + + if (tolower_type == "cname") { + key = TransformRecord (key); + val = TransformRecord (val); + } else if (contains (["ns", "mx"], tolower_type)) { + val = TransformRecord (val); + } else if (tolower_type == "a") { + key = TransformRecord (key); } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org