summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ldap-site-mngmt/webinterface/lib')
-rw-r--r--ldap-site-mngmt/webinterface/lib/au_management_functions.php1
-rw-r--r--ldap-site-mngmt/webinterface/lib/config.inc.php2
-rw-r--r--ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php57
-rw-r--r--ldap-site-mngmt/webinterface/lib/host_management_functions.php24
-rw-r--r--ldap-site-mngmt/webinterface/lib/rbs_management_functions.php22
5 files changed, 67 insertions, 39 deletions
diff --git a/ldap-site-mngmt/webinterface/lib/au_management_functions.php b/ldap-site-mngmt/webinterface/lib/au_management_functions.php
index e6f46cfc..0f725198 100644
--- a/ldap-site-mngmt/webinterface/lib/au_management_functions.php
+++ b/ldap-site-mngmt/webinterface/lib/au_management_functions.php
@@ -46,6 +46,7 @@ function new_childau($childDN,$childou,$childcn,$childdesc,$mainadmin){
$entryAU ["objectclass"][1] = "organizationalunit";
$entryAU ["objectclass"][2] = "top";
$entryAU ["ou"] = $childou;
+ $entryAU ["dhcpmtime"] = 0;
if ($childcn != ""){$entryAU ["cn"] = $childcn;}
if ($childdesc != ""){$entryAU ["description"] = $childdesc;}
diff --git a/ldap-site-mngmt/webinterface/lib/config.inc.php b/ldap-site-mngmt/webinterface/lib/config.inc.php
index e6dc17b1..fe76a958 100644
--- a/ldap-site-mngmt/webinterface/lib/config.inc.php
+++ b/ldap-site-mngmt/webinterface/lib/config.inc.php
@@ -3,7 +3,7 @@
#Pfad festlegen wo die Anwendungsskripte sich befinden
#$START_PATH="http://132.230.4.150/test/";
#$START_PATH="https://132.230.9.56/lsm/";
- $START_PATH="https://dhcp.uni-freiburg.de/lsm/";
+ $START_PATH="https://dhcp.uni-freiburg.de/";
# Anlegen einer Variablen für den Speicherort von den CSVs
# $TMPPATH_CSV="/home/gruppe1/public_html/htdocs/";
diff --git a/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php b/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php
index fd939369..05d47f49 100644
--- a/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php
+++ b/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php
@@ -18,19 +18,46 @@ $ldapError = null;
###################################################################################################
-# immer wenn ein DHCP Objekt geändert wird (DHCP modify time aktualisieren)
-function update_dhcpmtime(){
+# wenn DHCP Objekte geändert werden DHCP modify time der AU aktualisieren, und auch der AUs
+# referenzierter Objekte (Subnetz, RBS Dhcp Optionen) aktualisieren
+function update_dhcpmtime($au_array){
global $ds, $auDN, $ldapError;
$entry ['dhcpmtime'] = time();
+
+ # eigene AU
$results = ldap_mod_replace($ds,$auDN,$entry);
if ($results){
- echo "<br><b>dhcpMTime</b> erfolgreich aktualisiert!<br>" ;
- return 1;
+ echo "<br><b>dhcpMTime</b> erfolgreich in AU ".$auDN." aktualisiert!<br>" ;
+ #return 1;
}else{
echo "<br>Fehler beim Aktualisieren der <b>dhcpMTime</b>!<br>" ;
}
+
+ # andere AUs
+ if ( count($au_array) != 0 ) {
+ $au_array = array_unique($au_array);
+ # Bind als DHCP Manager
+ $dhcp_uid = "dhcpmanager";
+ $dhcp_userPassword = "dhcpman02";
+ if (!($dhcp_ds = uniLdapConnect($dhcp_uid,$dhcp_userPassword))){
+ echo "Konnte nicht als <b>DHCP-Manager</b> mit LDAP Server verbinden";
+ die;
+ }else{
+ #echo "DHCP BIND erfolgreich";
+ foreach ($au_array as $au){
+ $results = ldap_mod_replace($dhcp_ds,$au,$entry);
+ if ($results){
+ echo "<b>dhcpMTime</b> erfolgreich in AU ".$au." aktualisiert!<br>" ;
+ #return 1;
+ }else{
+ echo "<br>Fehler beim Aktualisieren der <b>dhcpMTime</b>!<br>" ;
+ }
+ }
+ ldap_unbind($dhcp_ds);
+ }
+ }
}
@@ -270,7 +297,7 @@ function add_dhcpservice ($dhcpserviceName,$dhcpoffer,$atts){
}
-
+# Löschen von Referenzen (dhcpHlpService) auf DHCP Service Objekt
function cleanup_del_dhcpservice ($dhcpserviceDN){
global $ds, $suffix, $auDN, $ldapError;
@@ -289,7 +316,7 @@ function cleanup_del_dhcpservice ($dhcpserviceDN){
}
-
+# Anpassen von Referenzen auf DHCP Service Objekt an neuen DN
function adjust_dhcpservice_dn ($newdhcpserviceDN,$dhcpserviceDN){
global $ds, $suffix, $auDN, $ldapError;
@@ -318,7 +345,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){
$expip = explode('.',$ip);
$subnetDN = "";
- if ($objecttype == "subnet"){
+ /*if ($objecttype == "subnet"){
# alternative DHCP Dienstobjekte eigene AU/übergeordnete AUs
$servarray = alternative_dhcpservices("");
#print_r($servarray); echo "<br>";
@@ -337,7 +364,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){
}
}
}
- }
+ }*/
if ($objecttype == "service"){
# alternative DHCP Dienstobjekte eigene AU/übergeordnete AUs
@@ -348,7 +375,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){
$alt_dhcp[] = $servarray[$i];
}
}
- # Subnetz entsprechend IP
+ /*# Subnetz entsprechend IP
$subarray = alternative_dhcpsubnets($objectDN);
#print_r($subarray);
if (count($subarray) != 0){
@@ -369,7 +396,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){
$alt_dhcp[] = $subarray[$i];
}
}
- }
+ }*/
}
if ($objecttype == "nodhcp"){
@@ -381,7 +408,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){
$alt_dhcp[] = $servarray[$i];
}
}
- # Subnetz entsprechend IP
+ /*# Subnetz entsprechend IP
$subarray = alternative_dhcpsubnets($objectDN);
#print_r($subarray);
if (count($subarray) != 0){
@@ -402,7 +429,7 @@ function alternative_dhcpobjects($objecttype,$objectDN,$ip){
$alt_dhcp[] = $subarray[$i];
}
}
- }
+ }*/
}
#echo "<br>";print_r($alt_dhcp);
return $alt_dhcp;
@@ -461,8 +488,8 @@ function add_dhcpsubnet ($cn,$dhcpservice,$netmask,$atts){
if ($result = ldap_add($ds, $dhcpsubnetDN, $entrydhcp)){
printf("Subnet <b>%s / %s</b> erfolgreich eingetragen",$cn,$netmask);
+ update_dhcpmtime(array());
return 1;
- update_dhcpmtime();
#if ( check_ip_in_subnet($range1,$cn) && check_ip_in_subnet($range2,$cn)){
# $dhcprange = implode('_',array($range1,$range2));
# if ( $range = new_ip_dhcprange($dhcprange,$dhcpsubnetDN,$auDN) ){
@@ -503,7 +530,7 @@ function delete_dhcpsubnet($subnetDN,$cn){
$results = ldap_mod_add($ds,$auDN,$entry);
if ($results){
merge_ipranges($auDN);
- update_dhcpmtime();
+ update_dhcpmtime(array());
return 1;
}else{
return 0;
@@ -555,7 +582,7 @@ function modify_subnet_dn($subnetDN,$newsubnetDN){
$results = ldap_mod_replace($ds,$auDN,$entry);
if ($results){
merge_ipranges($auDN);
- update_dhcpmtime();
+ update_dhcpmtime(array());
echo "<br>FIPBs erfolgreich angepasst!<br>" ;
return 1;
}else{
diff --git a/ldap-site-mngmt/webinterface/lib/host_management_functions.php b/ldap-site-mngmt/webinterface/lib/host_management_functions.php
index 31f358b8..8534371e 100644
--- a/ldap-site-mngmt/webinterface/lib/host_management_functions.php
+++ b/ldap-site-mngmt/webinterface/lib/host_management_functions.php
@@ -62,7 +62,7 @@ function modify_host_dn($hostDN, $newhostDN){
# Rechner neu anlegen
-function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts){
+function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts,$dhcp){
global $ds, $suffix, $auDN, $assocdom, $ldapError;
@@ -73,7 +73,12 @@ function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts){
$entryhost ["hostname"] = $hostname;
$entryhost ["domainname"] = $assocdom;
if ($hostdesc != ""){$entryhost ["description"] = $hostdesc;}
- if ($mac != ""){$entryhost ["hwaddress"] = $mac;}
+ if ($mac != ""){
+ $entryhost ["hwaddress"] = $mac;
+ if ($dhcp != "none" && $dhcp != ""){
+ $entryhost ["dhcphlpcont"] = $dhcp;
+ }
+ }
foreach (array_keys($atts) as $key){
if ($atts[$key] != ""){
$entryhost[$key] = $atts[$key];
@@ -91,14 +96,25 @@ function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts){
print_r($newip); echo "<br><br>";
if (new_ip_host($newip,$hostDN,$auDN)){
echo "IP erfolgreich eingetragen<br><br>";
+ if ($mac != "" && $dhcp != "none" && $dhcp != ""){
+ $entryfa ["dhcpoptfixed-address"] = "ip";
+ if (ldap_mod_add($ds,$hostDN,$entryfa)){
+ echo "DHCP Fixed-Address erfolgreich auf IP gesetzt<br><br>";
+ }else{
+ echo "Fehler beim Setzen der DHCP Fixed-Address<br><br>";
+ }
+ }
}else{
echo "Fehler beim eintragen der IP<br><br>";
}
}else{
- echo "Falsche IP Syntax! IP nicht eingetragen";
+ echo "Falsche IP Syntax! IP nicht eingetragen<br><br>";
}
}
-
+ echo "Rechner erfolgreich eingetragen";
+ if ($mac != "" && $dhcp != "none" && $dhcp != ""){
+ update_dhcpmtime(array());
+ }
return 1;
}
else{
diff --git a/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php b/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php
index 6fd64737..71ea576f 100644
--- a/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php
+++ b/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php
@@ -195,7 +195,7 @@ function rbs_adjust_host($hostDN, $rbs){
}
# Bei Änderung der TFTP Server IP eines RBS-Objekts entsprechend DHCP Option next-server
-# in den Hostobjekten anpassen
+# in den Hostobjekten anpassen und DHCP modify time in den AUs aktualisieren
function adjust_dhcpnextserver($tftpIP, $rbsDN){
global $ds, $suffix, $ldapError;
@@ -224,15 +224,7 @@ function adjust_dhcpnextserver($tftpIP, $rbsDN){
}
if ( count($host_au) != 0 ){
$host_au = array_unique($host_au);
- $entry ['dhcpmtime'] = time();
- foreach ($host_au as $au){
- $results = ldap_mod_replace($ds,$au,$entry);
- if ($results){
- #echo "<br><b>dhcpMTime</b> erfolgreich aktualisiert!<br>" ;
- }else{
- echo "<br>Fehler beim Aktualisieren der <b>dhcpMTime</b>!<br>" ;
- }
- }
+ update_dhcpmtime($host_au);
}
}
@@ -271,15 +263,7 @@ function adjust_dhcpfilename($initbootfile, $rbsDN, $type){
}
if ( count($host_au) != 0 ){
$host_au = array_unique($host_au);
- $entry ['dhcpmtime'] = time();
- foreach ($host_au as $au){
- $results = ldap_mod_replace($ds,$au,$entry);
- if ($results){
- #echo "<br><b>dhcpMTime</b> erfolgreich aktualisiert!<br>" ;
- }else{
- echo "<br>Fehler beim Aktualisieren der <b>dhcpMTime</b>!<br>" ;
- }
- }
+ update_dhcpmtime($host_au);
}
}