IPPlanv6 Beta1 broken linked address
Brought to you by:
richarde
GetBaseFromIP (class.dbflib.php) used to return a DB resource pointer, but now returns the actual data. Some processes that call GetBaseFromIP are still expecting a resource pointer.
displaysubnet.php UpdateLnk.
displaysubnet6.php UpdateLnk.
modifydnsrecord.php seems to be using the function properly.
Since I have a pending patch against both displaysubnet.php and displaysubnet6.php, here is the fix in the form of the function where the calls are made from. displaysubnet.php actually had to bugs as it continued to call ModifyIP with a inet_aton conversion of the ipaddr.
The version of the UpdateLnk function needs to be put in place before my "Reverse Zone RR" patch. What you see below does NOT include the new recordtype argument in the function call to ModifyIP. Also, you might want to consider removing that old commented out code when you converted GetBaseFromIndex to GetBaseFromIP.
displaysubnet.php and displaysubnet6.php are identical:
// check to see if there is a destination linked address and subnet, if not
// create the destination address record
function UpdateLnk($ds, $w, $cust, $baseindex, $lnk, $ip) {
/*
// got link address, see if there is a subnet for this link
// if no subnet found, do nothing
$result=$ds->GetBaseFromIndex($baseindex);
$row = $result->FetchRow();
$cust=$row["customer"];
*/
if ($result=$ds->GetBaseFromIP($lnk, $cust) ) {
// yep found one, now see if a record exists
$row1 = $result[0];
$lnkidx=$row["baseindex"];
if (!$ds->TestCustomerGrp($lnkidx, getAuthUsername())) {
return sprintf(my_("Destination linked address %s IP record not created as you are not a member of the customers admin group"), $lnk)."\n";
}
if(!$result=$ds->GetIPDetails($lnkidx, $lnk)) {
// no row in subnet, then add one
// NEED TO CHECK DESTINATION OWNERSHIP BEFORE ADDING RECORD
$ds->ModifyIP($lnk, $lnkidx, "", "",
"", "", "Linked address from ".$ip, "", "");
insert($w,textbr(sprintf(my_("Destination linked address %s IP record created"), $lnk)));
}
}
}
displaysubnet6.php
Fixed. Links are now database driven and support multiple linked addresses per ip address.