NicTool 2.12 release

Started by matt, January 05, 2012, 02:44:38 PM

Previous topic - Next topic

matt

NicToolClient Changes are mainly code cleanups:


  • HTML 5 validation
  • validating the CSS and Javascript
  • replaced huge swaths of 20th century HTML markup with HTML 5 and CSS
  • rewrote much of the perl from OBF to tidy paragraph sized subs
  • separated much of the perl from the HTML in the .cgi files. Makes both easier to maintain.
  • index.cgi honors valid cookies, so login sessions are preserved
NicToolServer changes


  • fixed a problem where records from deleted zones were sometimes published
  • rewrote SQL queries so they look like SQL
  • improved the nameserver export status messages
  • added additional tests

See the changes pages for more details:

Download from the tnpi store: http://www.tnpi.net/cart/index.php?downloads=1

Christian Adler

Hi,

I found a bug in NicTool-2.12:

After changing a parameter of the zone (e.g. NS-set, mailaddr etc.) the NicToolServer build a wrong SQL-Statement:

UPDATE nt_zone SET nt_group_id = '1',mailaddr = 'hostmaster.mcs.de.',description = '',serial = 'refr
esh' WHERE nt_zone_id = '11'


As you can see the field 'serial' get the string "refresh", this results in a serial 0.


Any idea whats wrong??


Cheers
Christian

Christian Adler

Possibly a relation to this error:

I get sometimes an alert in the browser (three different alerts), whan I change a record:

* could not get element id: tr_weight
* could not get element id: tr_priority
* could not get element id: tr_other


Cheers
Christian

Christian Adler

Log-Entry in NicTool for this change:

   changed serial from '0' to 'refresh', changed zone from 'test1.mcs' to 'nameservers', changed mailaddr from 'hostmaster.ZONE.TLD.' to 'hostmaster.mcs.de.'


...

matt

I'm taking a look into the zone editing error. I know about the JavaScript error (I discovered it a day after release), but it's merely annoying.

matt


matt

And now a fix for the zone editing problem is on github as well. The solution is in nictoolclient, htdocs/zone.cgi:


@@ -140,22 +142,27 @@ sub do_edit_zone {
         return;
     };

-    my @fields = qw/ nt_zone_id nt_group_id zone nameservers
-        description mailaddr serial refresh retry expire ttl minimum /;
-    my %data = map { $_ => $q->param($_) } @fields;
+    my @fields = qw/ nt_zone_id nt_group_id zone description
+                     mailaddr serial refresh retry expire ttl minimum /;
+    my %data;
+    foreach ( @fields ) {
+        next if ! defined $q->param($_);
+        $data{$_} = $q->param($_);
+    };
     $data{'nameservers'} = join( ',', $q->param('nameservers') );


https://github.com/msimerson/NicTool/commit/7a019f78043cd11b9a0152a5ae4239b83d31d0a9

Christian Adler

#7
Thanks for the patches - looks good :-)

But if I change something of the basic zone data like Refresh etc. or changing the nameserver-set, the serial will not increased. The logfile says:

modified    zone       final1.mcs   nothing modified

but I delete one of the nameserver from the set. Looks like the zone_edit doesnt notice correctly that the NS-set was changed.


Adding/editing/deleting a RR the serial increase as expected.

Can you please check this ??

Cheers
Christian

Christian Adler

Hi,

when I delete a RR and click "recover" from the log-entry, I get just an empty form for a new record, but 'recover' should mean that the NicTool presents me the old entry.

Cheers
Christian

matt

It turns out this was a feature. :)  NicTool has never (at least not since 2.00 incremented the serial number when zone properties or nameservers are altered.

I believe that is contrary to what most people expect, so I have added the requisite code to implement this.

Sorry the patch is so long, I also rewrote the serial # incrementing logic and added tests for it.

https://github.com/msimerson/NicTool/commit/de0b21c89442e7c2a30693773185d8b898c16175


Christian Adler

Hi Matt,

me again :-)

When the User-Session for NicToolClient expired and the user try to click some of the links, an apache error 500 (Server Error) appears.

[Thu Jan 12 08:44:11 2012] [error] Can't use string ("1") as a HASH ref while "strict refs" in use at /var/www/NicToolClient/htdocs/group_zones.cgi line 57.\n



I know whats the problem, but the normal user cannot understand this.
In 2.07 you get the login-page with the alert "session expired".


Cheers
Christian


Christian Adler

Hi Matt,

thanks for the great job! Now its as expected!

I check this functionality on our production-site with vers. 2.07 and found that the serial increase on every change:
* add/modify/delete a record
* modify the properties like Retry/Refresh etc
* modify the nameserver-set (adding/deleting nameservers to/from the zone)

:-)


Cheers
Christian

matt

Ah, right you are.

I looked it over again, to see just how that could be. It turns out that the serial number incrementing logic depended on the serial # being passed in the request from NicToolClient to NicToolServer as an empty string. Not an undef, not an undefined key, but a defined key with a value of empty string. No other value would work. NicToolClient passed in that value as an empty string as a byproduct of how CGI.pm treats undefined parameters. And so, it actually worked when NicToolClient submitted the request.

But not when the API submitted it, or even the test suite. The tests made alterations to the zone properties and nameservers and expected the result to come back without having bumped the serial. And they did. Hence my initial belief that NicToolServer never incremented the serial for those operations.

My changes to NicToolServer ignore any serial value sent in the request and increment the serial value that's stored in the database if any change is made.


Christian Adler

Hi,

I need the underscore in a dns-label for DKIM, but NicTool reject this record due to RFC1035.

I think it's the best way to allow this character in the sanity-check?

Cheers
Christian