summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85123be)
raw | patch | inline | side by side (parent: 85123be)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 11 Oct 2007 11:09:24 +0000 (11:09 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 11 Oct 2007 11:09:24 +0000 (11:09 +0000) |
Check if specified IP & MAC are already used.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7509 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7509 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_termDNS.inc | patch | blob | history |
index b926611329cc5d30bf70d3bfdaa8ecba7585c175..f6d8b1d556d69c1ff5979b43bd2ea7b5e095087f 100644 (file)
var $ipHostNumber = ""; // IP address
var $macAddress = ""; // Mac address
+
+ var $orig_ipHostNumber = ""; // IP address
+ var $orig_macAddress = ""; // Mac address
+
var $cn = ""; // CN of currently edited device
var $OrigCn = ""; // Initial cn
var $IPisMust = false;
var $initial_dhcpHostEntry = array();
var $initial_dhcp_is_Account = FALSE;
+ var $used_ip_mac = array();
/* DNS attributes
*/
}
}
+
+ /* Create a list of used mac and ip addresses */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(|(macAddress=*)(ipHostNumber=*))",array("macAddress","ipHostNumber"));
+ while($attrs = $ldap->fetch()){
+ if(isset($attrs['ipHostNumber'][0])){
+ $this->used_ip_mac["ip:".$attrs['ipHostNumber'][0]] = "ip:".$attrs['ipHostNumber'][0];
+ }
+ if(isset($attrs['macAddress'][0])){
+ $this->used_ip_mac["mac:".$attrs['macAddress'][0]] = "mac:".$attrs['macAddress'][0];
+ }
+ }
+
+ /* Save initial ip and mac values, to be able
+ check if the used values are already in use */
+ $this->orig_ipHostNumber = $this->ipHostNumber;
+ $this->orig_macAddress = $this->macAddress;
/* Store initally account settings
*/
if($this->dhcpEnabled && $this->dhcp_is_Account && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
$message[] =_("You have not configured your dhcp settings yet.");
}
+
+ /* Check if mac and ip are already used */
+ if(!empty($this->ipHostNumber) &&
+ $this->ipHostNumber != $this->orig_ipHostNumber &&
+ in_array("ip:".$this->ipHostNumber,$this->used_ip_mac)){
+ $message[] =_("The specified IP address is already in use.");
+ }
+ if(!empty($this->macAddress) &&
+ $this->macAddress != $this->orig_macAddress &&
+ in_array("mac:".$this->macAddress,$this->used_ip_mac)){
+ $message[] =_("The specified MAC address is already in use.");
+ }
/* Check if ip must be given
*/