summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c4790c5)
raw | patch | inline | side by side (parent: c4790c5)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Sep 2008 13:25:41 +0000 (13:25 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Sep 2008 13:25:41 +0000 (13:25 +0000) |
-Strip Domain Part from Host Name, if specified in host generic tab.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12398 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12398 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc | patch | blob | history |
diff --git a/gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc b/gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc
index 7338000e0e8ec3b95e0e7c98375ca8a2c998f3a3..151c79ac1b36ee1f0bd63131fedc56804473ae90 100644 (file)
*/
$foundIn = array();
$zones = DNS::getAvailableZones($config);
-
$zonesArr = array();
foreach($zones as $zoneMix){
$zoneIndex = split("/",$zoneMix);
foreach($zonesArr as $nameServer => $nameServerArr){
$foundInTmp = array();
foreach($nameServerArr as $zoneArr => $zone){
+
+ /* Strip eventually domain part from hostname
+ */
+ $zN = trim($zone,".");
+ $nN = trim($name,".");
+ if(preg_match("/".normalizePreg($zN)."$/",$nN)){
+ $nN = preg_replace("/[\.]*".normalizePreg($zN)."[\.]*$/","",$nN);
+ }else{
+ $nN = $name;
+ }
$zoneMix = $nameServer."/".$zone;
$zoneDn = DNS::getDNSZoneDN($config,$zoneMix);
- $ldap->ls("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=".$name.")(!(relativeDomainName=@)))", $zoneDn,$attrs = array("*"));
+ $ldap->ls("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=".$nN.")(!(relativeDomainName=@)))", $zoneDn,$attrs = array("*"));
while($attrs = $ldap->fetch()){
$foundInTmp [$zoneMix] = $attrs['dn'];
$foundIn [$zoneMix] = $attrs['dn'];
$ldap->search("(&(objectClass=dNSZone)(zoneName=*)(!(relativeDomainName=@)))",array("*"));
while($attrs = $ldap->fetch()){
- /* If relative domainname == cn
- * Try to read dnsclass / TTl / zone
+ /* Strip eventually domain part from hostname
*/
- if($attrs['relativeDomainName'][0] == $name){
+ $zN = trim($attrs['zoneName'][0],".");
+ $nN = trim($name,".");
+
+ $testname = $attrs['relativeDomainName'][0].".".$zN;
+
+ /* Check given host name with zone settings
+ */
+ if(preg_match("/".normalizePreg($testname)."[\.]*$/",$nN)){
$ret['exists'] = true;
$ret['zoneName'] = $id_tmp;
foreach(array("dNSClass","dNSTTL") as $atr){
$tmp = array_flip($zones);
$zoneName = DNS::getNameFromMix($zoneNameMix);
+ /* Strip domain part out of dns host entry
+ */
+ $zN = trim($zoneName,".");
+ $nN = trim($newName,".");
+ $newName = preg_replace("/[\.]*".normalizePreg($zN)."$/i","",$nN);
+
/* If reverseZone can't be resolved ... this
* can't be a valid entry, so remove this account
*/