summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 64f2204)
raw | patch | inline | side by side (parent: 64f2204)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 27 Nov 2006 04:52:48 +0000 (04:52 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 27 Nov 2006 04:52:48 +0000 (04:52 +0000) |
-getDNSZoneDN will return valid zoneNames like 'server/zone.de' instead of 'zone.de'
-DNS settings be removed again from server/workstations...
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5222 594d385d-05f5-0310-b6e9-bd551577e9d8
-DNS settings be removed again from server/workstations...
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5222 594d385d-05f5-0310-b6e9-bd551577e9d8
include/functions_dns.inc | patch | blob | history |
index 162caeca7123317ad71c30cb84cffa5fdef327b0..abc92a23645701766b390aa7c11b55620b1eff80 100644 (file)
$zonesArr = array();
foreach($zones as $zoneMix){
$zoneIndex = split("/",$zoneMix);
- if(!array_key_exists($zoneIndex[0],$zonesArr)) $zonesArr[$zoneIndex[0]] = array();
+ if(!array_key_exists($zoneIndex[0],$zonesArr)) {
+ $zonesArr[$zoneIndex[0]] = array();
+ }
array_push($zonesArr[$zoneIndex[0]],$zoneIndex[1]);
}
$zoneDn = getDNSZoneDN($config,$zoneMix);
$ldap->ls("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=".$name.")(!(relativeDomainName=@)))", $zoneDn,$attrs = array("*"));
while($attrs = $ldap->fetch()){
- $foundInTmp [] = $attrs['dn'];
- $foundIn [] = $attrs['dn'];
+ $foundInTmp [$zoneMix] = $attrs['dn'];
+ $foundIn [$zoneMix] = $attrs['dn'];
}
}
}
/* Get host informations from zone
*/
- $ldap->cd($foundIn[0]);
+ $id_tmp = key($foundIn);
+ $ldap->cd($foundIn[$id_tmp]);
$ldap->search("(&(objectClass=dNSZone)(zoneName=*)(!(relativeDomainName=@)))",array("*"));
while($attrs = $ldap->fetch()){
*/
if($attrs['relativeDomainName'][0] == $name){
$ret['exists'] = true;
- foreach(array("dNSClass","zoneName","dNSTTL") as $atr){
+ $ret['zoneName'] = $id_tmp;
+ foreach(array("dNSClass","dNSTTL") as $atr){
if(isset($attrs[$atr][0])){
$ret[$atr] = $attrs[$atr][0];
}
/* returns the dn for a specified zone
*/
-function getDNSZoneDN($config,$zoneNameMix){
+function getDNSZoneDN($config,$zoneNameMix)
+{
$ret = "";
- if(!strstr($zoneNameMix, '/')) return($ret);
+ if(!strstr($zoneNameMix, '/')) {
+ print_red(sprintf(_("Undefined zone name '%s'. Zone name must look like this 'server/zone.com'."),$zoneNameMix));
+ return($ret);
+ }
+
$zoneNameIndex = split("/",$zoneNameMix);
$zoneName = $zoneNameIndex[1];
$nameServer = strtolower($zoneNameIndex[0]);
- $ldap = $config->get_ldap_link();
+ $ldap = $config->get_ldap_link();
/* search for the nameserver */
$ldap-> cd($config->current['BASE']);
$ldap->search("(&(objectClass=goServer)(cn=".$nameServer."))",array("cn"));
if($ldap->count()){
$attr = $ldap->fetch();
- } else return($ret);
+ } else {
+ return($ret);
+ }
$ldap-> cd($attr['dn']);
$ldap->search("(&(objectClass=dNSZone)(sOARecord=*)(zoneName=".$zoneName."))",array("zoneName"));