Bug 141211

Summary: yast2 dns zone editor sets refresh to 0
Product: [openSUSE] SUSE LINUX 10.0 Reporter: michel munnix <michel.munnix>
Component: YaST2Assignee: Lukas Ocilka <locilka>
Status: RESOLVED FIXED QA Contact: Klaus Kämpf <kkaempf>
Severity: Major    
Priority: P5 - None    
Version: Final   
Target Milestone: ---   
Hardware: i586   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: test case
y2log

Description michel munnix 2006-01-03 10:15:41 UTC
when editing a zone in yast2 dns-server zone editor, values for refresh, retry, expire and minimum are trucated to 0.
This can cause high network traffic with some bad dns servers
error message in console follows:
Command: /sbin/yast2 dns-server &
Argument "" isn't numeric in addition (+) at
        /usr/share/YaST2/modules//DnsServerAPI.pm line 455 (#1)
    (W numeric) The indicated string was fed as an argument to an operator
    that expected a numeric value instead.  If you're fortunate the message
    will identify which operator was so unfortunate.
I'll attach the test case I constructed
Comment 1 michel munnix 2006-01-03 10:16:58 UTC
Created attachment 61867 [details]
test case
Comment 2 Martin Lasarsch 2006-01-03 10:22:42 UTC
please attach /var/log/YaST2/y2log after changing something again, thanks
Comment 3 michel munnix 2006-01-03 10:42:17 UTC
Created attachment 61870 [details]
y2log
Comment 4 Lukas Ocilka 2006-01-03 12:26:25 UTC
Was that zone file created by YaST?
Is seems that the yast2-dnes-server had found an uknown syntax...
Comment 5 michel munnix 2006-01-03 13:40:24 UTC
No, the zone has not been created by YaST, it was fetched from an other server by defining it as slave zone in named.conf and then starting bind (service named). Once bind got the zone file (so it passed binds syntax checks, I guess), the service was stopped, the zone changed from slave to master type, zone file transfered from slave to master directory.
This process is documented in the first attachment (test case).
I guess yast uses a more restrictive syntax than bind, but I could not check it because didn't find an RFC describing the zone file's syntax.
Through trial and error, I found out that yast expects the four values to have an explicit unit of time (s m h d), it seems bind works with seconds if not specified explicitly (so unit is optional, not mandatory)
Comment 6 Lukas Ocilka 2006-01-03 14:22:20 UTC
Please, try this patch for in the file /usr/share/YaST2/modules/DnsServerAPI.pm
Does it help?

The syntax is known for the agent reading the configuration but then it was not parsed well. YaST allways tries to define a human-understandable form of the time value, such as 2D5H1S. The same procedure is for reading the configuration but upside down.

Index: DnsServerAPI.pm
===================================================================
--- DnsServerAPI.pm     (revision 26731)
+++ DnsServerAPI.pm     (working copy)
@@ -451,8 +451,8 @@
            $totaltime += $1;
        }
     }
-    if ($time =~ s/^\d+$//) {
-       $totaltime += $time;
+    if ($time =~ s/^(\d+)$//) {
+       $totaltime += $1;
     }
     if ($time ne '') {
        y2error("Wrong time format '".$originaltime."', unable to parse.");
Comment 7 michel munnix 2006-01-03 15:39:36 UTC
Yes, if I apply this patch, now it parses the values correctly.

Before applying that patch, I also tried to modify the comments on these lines, that worked also

from                             3600       ; refresh (1 hour)
to                               3600       ; refresh
Comment 10 Lukas Ocilka 2006-01-04 09:31:20 UTC
Fixing in SVN for 10.1
Thans for your help