Bob Hutchinson wrote:
> On Tuesday 25 Apr 2006 02:56, Robin Bowes wrote:
>> I've fixed all these.
> 
> You beat me to it ;-)
> 
> make a patch and submit it, perhaps Bill will feed it in.

Patch attached.

This contains the following fixes:

axfr-get.php
============
Add "-R" to the tcpclient command.
This stops tcpclient looking up TCPREMOTEINFO which is often not
available and simply causes the tcpclient command to hang until it times
out (default 26 seconds)

index.php
=========
Turn on Full error reporting (E_ALL)
This is useful for debugging when evaluating vegadns but should be
disabled in production.

create_tables.php
=================
Add quotes to md5() function when creating default password.
VegaDNS wouldn't work for me without this. Identified by Bob Hutchinson.

domains.php
===========
Add checks for default_ns and default_soa being present in the $_REQUEST
array before accessing them.
This prevents php warning notices in the form:
Notice: Undefined index: default_soa in
/var/www/vegadns/vegadns-0.9.9.1/src/domains.php on line 534

functions.php
=============
Set a default value for $out_array in the parse_dataline function.
This prevents phph warning notices in the form:
Notice: Undefined index: out_array in
/var/www/vegadns/vegadns-0.9.9.1/src/functions.php on line 433

R,
diff -ur vegadns-0.9.9.1/axfr_get.php vegadns-0.9.9.1-working/axfr_get.php
--- vegadns-0.9.9.1/axfr_get.php        2005-02-04 00:07:16.000000000 +0000
+++ vegadns-0.9.9.1-working/axfr_get.php        2006-04-25 01:23:48.000000000 
+0100
@@ -45,7 +45,7 @@
 $rand = rand();
 $file = "/tmp/$domain.$rand";
 
-$command = "/usr/local/bin/tcpclient '".escapeshellcmd($hostname)."' 53 
/usr/local/bin/axfr-get '".escapeshellcmd($domain)."' $file $file.tmp 2>&1";
+$command = "/usr/local/bin/tcpclient -R '".escapeshellcmd($hostname)."' 53 
/usr/local/bin/axfr-get '".escapeshellcmd($domain)."' $file $file.tmp 2>&1";
 exec($command, $out);
 
 // Print any errors first
diff -ur vegadns-0.9.9.1/index.php vegadns-0.9.9.1-working/index.php
--- vegadns-0.9.9.1/index.php   2005-09-10 17:49:22.000000000 +0100
+++ vegadns-0.9.9.1-working/index.php   2006-03-29 20:26:44.000000000 +0100
@@ -23,6 +23,7 @@
 ini_set('log_errors', 1);
 ini_set('allow_url_fopen', 0);
 ini_set('session.use_cookies',0);
+ini_set('error_reporting', E_ALL);
 
 // Check that register_globals is off
 if(ini_get('register_globals')) {
diff -ur vegadns-0.9.9.1/src/create_tables.php 
vegadns-0.9.9.1-working/src/create_tables.php
--- vegadns-0.9.9.1/src/create_tables.php       2005-02-04 00:05:34.000000000 
+0000
+++ vegadns-0.9.9.1-working/src/create_tables.php       2006-03-29 
20:28:51.000000000 +0100
@@ -40,7 +40,7 @@
 ) TYPE=MyISAM";
 mysql_query($q) or die(mysql_error());
 
-$q = "INSERT INTO accounts VALUES 
(0,0,'[email protected]','".md5(test)."','Test','User','','senior_admin','active')";
+$q = "INSERT INTO accounts VALUES 
(0,0,'[email protected]','".md5('test')."','Test','User','','senior_admin','active')";
 mysql_query($q) or die(mysql_error()."<br>".$q);
 
 $q = "CREATE TABLE active_sessions (
diff -ur vegadns-0.9.9.1/src/domains.php vegadns-0.9.9.1-working/src/domains.php
--- vegadns-0.9.9.1/src/domains.php     2005-09-10 12:35:33.000000000 +0100
+++ vegadns-0.9.9.1-working/src/domains.php     2006-04-25 02:44:46.000000000 
+0100
@@ -531,10 +531,10 @@
 
     $counter = 0;
     // default SOA and NS
-    if ($_REQUEST['default_soa']=="on")
+    if (isset($REQUEST['default_soa']) && $_REQUEST['default_soa']=="on")
      $def_soa=mysql_fetch_array(
       mysql_query("SELECT host,val FROM default_records WHERE type='S'"));
-    if ($_REQUEST['default_ns']=="on") {
+    if (isset($REQUEST['default_ns']) && $_REQUEST['default_ns']=="on") {
      $q=mysql_query("SELECT host,val,distance,ttl FROM default_records WHERE 
type='N'");
      while ($l = mysql_fetch_array($q))
       $def_ns[]=$l;
@@ -582,11 +582,11 @@
             if($line_key != 'domain' && !ereg("^#", $value)) {
                 $result = parse_dataline($value);
                 if(is_array($result)) {
-                   if (($_REQUEST['default_soa']=="on") && 
($result['type']=='S')) {
+                   if ((isset($_REQUEST['default_soa']) && 
$_REQUEST['default_soa']=="on") && ($result['type']=='S')) {
                     $result['val']=$def_soa['val'];
                     $result['host']=$def_soa['host'];
                    }
-                   if (($_REQUEST['default_ns']!="on") || 
($result['type']!='N')) {
+                   if ((isset($_REQUEST['default_ns']) && 
$_REQUEST['default_ns']!="on") || ($result['type']!='N')) {
                      $q = "insert into records 
                          (domain_id,host,type,val,distance,ttl) 
                          values(
@@ -601,7 +601,7 @@
                 }
             }
        }
-        if ($_REQUEST['default_ns']=="on") {
+        if (isset($_REQUEST['default_ns']) && $_REQUEST['default_ns']=="on") {
         $counter=0;
          while ($ns = $def_ns[$counter]) {
          $host = ereg_replace("DOMAIN", $domain, $ns['host']);
diff -ur vegadns-0.9.9.1/src/functions.php 
vegadns-0.9.9.1-working/src/functions.php
--- vegadns-0.9.9.1/src/functions.php   2005-09-10 17:48:07.000000000 +0100
+++ vegadns-0.9.9.1-working/src/functions.php   2006-04-25 02:46:45.000000000 
+0100
@@ -381,6 +381,7 @@
     // Strip first char
     $stripped = ereg_replace("^.", "", $line);
     $array = explode(":", $stripped);
+    $out_array = '';
 
     // Format the array according to the type
     if(strncmp('+', $line, 1) == 0) {

Reply via email to