added host-name
This commit is contained in:
parent
493a2553e1
commit
d8d03789d4
|
@ -4,7 +4,7 @@ $Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2008 Thomas Manninger
|
Copyright (C) 2008 Thomas Manninger
|
||||||
2008 Roland Gruber
|
2008 - 2009 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -465,12 +465,16 @@ class fixed_ip extends baseModule {
|
||||||
foreach($this->fixed_ip AS $idB=>$arr) {
|
foreach($this->fixed_ip AS $idB=>$arr) {
|
||||||
if ($this->orig_ips[$id]['cn']==$this->fixed_ip[$idB]['cn']) {
|
if ($this->orig_ips[$id]['cn']==$this->fixed_ip[$idB]['cn']) {
|
||||||
$in_arr = true;
|
$in_arr = true;
|
||||||
|
// check if IP changed
|
||||||
// Was cn edit?
|
|
||||||
if($this->orig_ips[$id]['ip']!=$this->fixed_ip[$idB]['ip']) {
|
if($this->orig_ips[$id]['ip']!=$this->fixed_ip[$idB]['ip']) {
|
||||||
$delete[] = $this->orig_ips[$id]['cn'];
|
$delete[] = $this->orig_ips[$id]['cn'];
|
||||||
$add[] = $this->fixed_ip[$idB];
|
$add[] = $this->fixed_ip[$idB];
|
||||||
}
|
}
|
||||||
|
// check if MAC changed
|
||||||
|
elseif($this->orig_ips[$id]['mac']!=$this->fixed_ip[$idB]['mac']) {
|
||||||
|
$delete[] = $this->orig_ips[$id]['cn'];
|
||||||
|
$add[] = $this->fixed_ip[$idB];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$in_arr) {
|
if (!$in_arr) {
|
||||||
|
@ -478,9 +482,9 @@ class fixed_ip extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($this->fixed_ip))
|
if (!is_array($this->fixed_ip)) {
|
||||||
$this->fixed_ip = array();
|
$this->fixed_ip = array();
|
||||||
|
}
|
||||||
// Which entrys are new:
|
// Which entrys are new:
|
||||||
foreach($this->fixed_ip AS $id=>$arr) {
|
foreach($this->fixed_ip AS $id=>$arr) {
|
||||||
$in_arr = false;
|
$in_arr = false;
|
||||||
|
@ -503,9 +507,10 @@ class fixed_ip extends baseModule {
|
||||||
$attr['cn'] = $add[$id]['cn'];
|
$attr['cn'] = $add[$id]['cn'];
|
||||||
$attr['objectClass'][0] = 'top';
|
$attr['objectClass'][0] = 'top';
|
||||||
$attr['objectClass'][1] = 'dhcpHost';
|
$attr['objectClass'][1] = 'dhcpHost';
|
||||||
$attr['dhcpHWAddress'] = 'ethernet '.$add[$id]['mac'];
|
$attr['dhcpHWAddress'] = 'ethernet ' . $add[$id]['mac'];
|
||||||
$attr['dhcpStatements'] = 'fixed-address '.$add[$id]['ip'];
|
$attr['dhcpStatements'] = 'fixed-address '.$add[$id]['ip'];
|
||||||
if ($attr['cn']!="")
|
$attr['dhcpOption'] = 'host-name "' . $add[$id]['cn'] . '"';
|
||||||
|
if ($attr['cn'] != "")
|
||||||
ldap_add($_SESSION['ldap']->server(),'cn='.$add[$id]['cn'].',cn='.$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0].','.$_SESSION['config']->get_suffix('dhcp'),$attr);
|
ldap_add($_SESSION['ldap']->server(),'cn='.$add[$id]['cn'].',cn='.$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0].','.$_SESSION['config']->get_suffix('dhcp'),$attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue