From: hickert Date: Tue, 25 Sep 2007 07:52:10 +0000 (+0000) Subject: Updated dhcp service. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=10b7a592c5121139271dbd8fcaaac1e07b049bf0;p=gosa.git Updated dhcp service. Don't save the dhcpOption "server-name" for the dhcp service base object (cn=dhcp,cn=server...). Save this attribute to all child objects instead. (host,group,subnet,sharedNetwork). Fixed saving for newly created savers with dhcp service, some attributes were not available while editing an entry like cn and dn. This caused PHP Warnings and empty server-name options. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7397 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_dhcpService.inc b/plugins/admin/systems/class_dhcpService.inc index b3d7e0b0b..57f76cc9e 100644 --- a/plugins/admin/systems/class_dhcpService.inc +++ b/plugins/admin/systems/class_dhcpService.inc @@ -171,7 +171,7 @@ class dhcpService extends dhcpPlugin $this->attrs['dhcpPrimaryDN']= array($this->dhcpPrimaryDN); $this->removeOption('server-name'); - $this->attrs['dhcpOption'][]= "server-name $server_name"; +# $this->attrs['dhcpOption'][]= "server-name $server_name"; return ($this->attrs); } diff --git a/plugins/admin/systems/class_servDHCP.inc b/plugins/admin/systems/class_servDHCP.inc index d631b1385..aea61346b 100644 --- a/plugins/admin/systems/class_servDHCP.inc +++ b/plugins/admin/systems/class_servDHCP.inc @@ -452,6 +452,27 @@ class servdhcp extends goService continue; } + /* Opdate dhcp option 'server-name' to actual server name */ + if($this->dn != $this->orig_dn){ + $fixed = FALSE; + foreach(array("dhcpHost","dhcpSubnet","dhcpGroup","dhcpSharedNetwork") as $object){ + if(in_array($object,$data['objectClass']) && isset($data['dhcpOption'])){ + foreach($data['dhcpOption'] as $key => $option){ + if(preg_match("/^server-name /",$option)){ + $data['dhcpOption'][$key] = "server-name ".$this->cn; + $data['MODIFIED'] = TRUE; + break; + } + } + } + + /* Skip next loops if entry is updated */ + if($fixed){ + break; + } + } + } + /* Modify existing entry? */ if (isset($data['MODIFIED']) || $this->orig_dn != $this->dn){