summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2835d72)
raw | patch | inline | side by side (parent: 2835d72)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 16 Jan 2007 05:41:49 +0000 (05:41 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 16 Jan 2007 05:41:49 +0000 (05:41 +0000) |
Fixed dns account remove.
Fixed attribute error while saving.
Updated functions_dns.inc to be able to remove accounts
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5570 594d385d-05f5-0310-b6e9-bd551577e9d8
Fixed attribute error while saving.
Updated functions_dns.inc to be able to remove accounts
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5570 594d385d-05f5-0310-b6e9-bd551577e9d8
include/functions_dns.inc | patch | blob | history | |
plugins/admin/systems/class_printGeneric.inc | patch | blob | history | |
plugins/admin/systems/class_termDNS.inc | patch | blob | history |
index 162caeca7123317ad71c30cb84cffa5fdef327b0..4754d822889330a454d624c3e329f075ebbe83da 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];
}
/* Check if zoneName has changed
*/
if(count($newEntry['RECORDS'])){
- if($oldEntry['zoneName'] != $zoneName){
+ if($oldEntry['zoneName'] != $newEntry['zoneName']){
$oldzoneDn = getDNSZoneDN($config,$oldEntry['zoneName']);
$dn = "relativeDomainName=".$oldName.",".$oldzoneDn;
$dn2= "relativeDomainName=".$oldName.",".$zoneDn;
/* 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"));
diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index dc3d3ba2cf06681d394e4c35ff2aee1fb8c790be..59d9cb01ebd975fe55dc20b49bfd70d1d8b21858 100644 (file)
}
show_ldap_error($ldap->get_error(), _("Saving printer failed"));
-
- $this->netConfigDNS->cn = $this->cn;
- $this->netConfigDNS->dn = $this->dn;
- $this->netConfigDNS->save($this->dn);
+ /* Only save dns stuff if we are a standalone printer */
+ if($this->BelongsTo == "Printer"){
+ $this->netConfigDNS->cn = $this->cn;
+ $this->netConfigDNS->dn = $this->dn;
+ $this->netConfigDNS->save($this->dn);
+ }
/* Optionally execute a command after we're done */
$this->postcreate();
index 3852df8a33714cc79f555e24b950ae265eb6273d..19bf04da805af27f57f47fefc2a955c19b614dd9 100644 (file)
/* Add ipHostNumber to aRecords
*/
- $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber);
+ if(!empty($this->ipHostNumber)){
+ $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber);
+ }
/* Create diff and follow instructions
* If Account was disabled, remove account by setting exists to false