summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/dhcp
diff options
context:
space:
mode:
authorTarik Gasmi2007-09-18 17:18:38 +0200
committerTarik Gasmi2007-09-18 17:18:38 +0200
commit12183ece8e4cb1bb81072a72f696572c8b3a07ee (patch)
tree1e7b274e6a4229d4d1819d4feaabe272b1037a62 /ldap-site-mngmt/webinterface/dhcp
parentAdded theme.conf for openslx theme for pxe. Only labels should be added autom... (diff)
downloadcore-12183ece8e4cb1bb81072a72f696572c8b3a07ee.tar.gz
core-12183ece8e4cb1bb81072a72f696572c8b3a07ee.tar.xz
core-12183ece8e4cb1bb81072a72f696572c8b3a07ee.zip
ldap-site-mngmt: actualized WebIF and DHCPConfig Generationscript
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1340 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'ldap-site-mngmt/webinterface/dhcp')
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt73
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcppool.php125
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php88
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php55
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcpservice.php2
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php35
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt38
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php2
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php2
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt26
10 files changed, 252 insertions, 194 deletions
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt
index 0d6a8684..8c9aefdc 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt
@@ -3,67 +3,10 @@
<td colspan='2'><h3>Dynamische DHCP Pools </h3></td>
</tr>
- <tr><td>
- <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'>
-
- <form action='dhcppools_change.php' method='post'>
-
- <tr>
- <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Subnetz</b></td>
- <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Ranges (innerhalb Subnetz)</b></td>
- <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Unknown Clients</b></td>
- </tr>
-
- <!-- BEGIN DYNAMIC BLOCK: Dhcppools -->
- <tr height='50' valign='top'>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>{SUBNET}/24</b><br><br>
- <input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'>
- Pool l&ouml;schen (H&auml;kchen setzen)</td>
-
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
- <!-- BEGIN DYNAMIC BLOCK: Dhcpranges -->
- <input type='Text' name='range1[]' value='{RANGE1}' size='15' maxlength='15' class='medium_form_field'>
- &nbsp;&nbsp; - &nbsp;&nbsp;
- <input type='Text' name='range2[]' value='{RANGE2}' size='15' maxlength='15' class='medium_form_field'>
- <input type='hidden' name='oldrange1[]' value='{RANGE1}'>
- <input type='hidden' name='oldrange2[]' value='{RANGE2}'><br>
- <input type='hidden' name='rangepooldn[]' value='{RPOOLDN}'>
- <!-- END DYNAMIC BLOCK: Dhcpranges -->
-
- <input type='Text' name='addrange1[]' value='' size='15' maxlength='15' class='medium_form_field'>
- &nbsp;&nbsp; - &nbsp;&nbsp;
- <input type='Text' name='addrange2[]' value='' size='15' maxlength='15' class='medium_form_field'>
- </td>
-
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
- <select name='unknownclients[]' size='3' class='small_form_selectbox'>
- {UCSELECT}
- </select>
- <input type='hidden' name='olduc[]' value='{UCNOW}'> &nbsp;
- </td>
- </tr>
- <!--<tr>
- <td colspan='3' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'>
- Pool l&ouml;schen (H&auml;kchen setzen)</td>
- </tr>-->
-
- <input type='hidden' name='pooldn[]' value='{POOLDN}'>
- <input type='hidden' name='subnet[]' value='{SUBNET}'>
- <!-- END DYNAMIC BLOCK: Dhcppools -->
-
- <input type='hidden' name='mnr' value='{MNR}'>
-
- </table></td>
- </tr>
- <tr>
- <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'>
- </form></td>
- </tr>
-
- <tr>
- <td height='50'></td>
- </tr>
-
+ <!-- BEGIN DYNAMIC BLOCK: Poolform -->
+ {POOLFORMULAR}
+ <!-- END DYNAMIC BLOCK: Poolform -->
+
<tr>
<td colspan='2'><h4>Dynamischen DHCP Pool hinzuf&uuml;gen </h4></td>
</tr>
@@ -73,18 +16,18 @@
<form action='dhcppool_add.php' method='post'>
<tr valign='bottom'>
- <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Range (innerhalb eines Subnetzes)</b><br>
+ <td width='50%' class='tab_h'><b>IP Range (innerhalb eines Subnetzes)</b><br>
weitere Ranges k&ouml;nnen sp&auml;ter hinzugef&uuml;gt werden</td>
- <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Unknown Clients</b></td>
+ <td width='50%' class='tab_h'><b>Unknown Clients</b></td>
</tr>
<tr height='50' valign='top'>
- <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>
+ <td class='tab_d'>
<input type='Text' name='addrange1' value='' size='15' maxlength='15' class='medium_form_field'>
&nbsp;&nbsp; - &nbsp;&nbsp;
<input type='Text' name='addrange2' value='' size='15' maxlength='15' class='medium_form_field'>
</td>
- <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>
+ <td class='tab_d'>
<select name='unknownclients' size='3' class='small_form_selectbox'>
<option selected value='deny'> DENY </option>
<option value='allow'> ALLOW </option>
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppool.php b/ldap-site-mngmt/webinterface/dhcp/dhcppool.php
index dd648f49..2d7da0ff 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcppool.php
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool.php
@@ -3,7 +3,7 @@ include('../standard_header.inc.php');
# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt.
$titel = "DHCP Service Management";
-# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc.
+# 2. Nummern der zugehörigen Menus.
$mainnr = 5;
$mnr = 3;
$sbmnr = -1;
@@ -11,7 +11,6 @@ $sbmnr = -1;
$webseite = "dhcppool.dwt";
include("../class.FastTemplate.php");
-
include('dhcp_header.inc.php');
@@ -28,36 +27,119 @@ include("ip_blocks.inc.php");
###################################################################################
-$template->assign(array("POOLDN" => "",
+$template->define_dynamic("Poolform", "Webseite");
+$template->assign(array("POOLFORMULAR" => "",
+ #"POOLDN" => "",
"CN" => "",
"SUBNETDN" => "",
- "SUBNET" => "",
- "RANGE1" => "",
- "RANGE2" => "",
+ #"SUBNET" => "",
+ #"RANGE1" => "",
+ #"RANGE2" => "",
"DESCRIPTION" => "",
"STATEMENTS" => "",
- "ALLOW" => "",
- "DENY" => "",
- "IGNORE" => "",
"DEFAULTLEASE" => "",
"MAXLEASE" => "",
"MNR" => $mnr));
-# DHCP Subnet Daten
-#$dhcppoolDN = $_GET['dn'];
+# DHCP Pools Daten holen
$attributes = array("dn","cn","dhcphlpcont","dhcprange","description","dhcpstatements","dhcpoptallow",
"dhcpoptdefault-lease-time","dhcpoptdeny","dhcpoptignore","dhcpoptmax-lease-time",
"dhcpoptgeneric");
$pools = get_dhcppools($auDN, $attributes);
#print_r($pools);
+
+if (count($pools) != 0){
+
+
+
+$poolform = "
+ <tr><td>
+ <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'>
+
+ <form action='dhcppools_change.php' method='post'>
+
+ <tr>
+ <td width='30%' class='tab_h'><b>Subnetz</b></td>
+ <td width='50%' class='tab_h'><b>IP Ranges (innerhalb Subnetz)</b></td>
+ <td width='20%' class='tab_h'><b>Unknown Clients</b></td>
+ </tr>
+
+ <!-- BEGIN DYNAMIC BLOCK: Dhcppools -->
+
+ <tr height='50' valign='top'>
+ <td class='tab_d'><b>{SUBNET}/24</b><br><br>
+ <input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'>
+ Pool l&ouml;schen (H&auml;kchen setzen)</td>
+
+ <td class='tab_d'>
+
+ <!-- BEGIN DYNAMIC BLOCK: Dhcpranges -->
+
+ <input type='Text' name='range1[]' value='{RANGE1}' size='15' maxlength='15' class='medium_form_field'>
+ &nbsp;&nbsp; - &nbsp;&nbsp;
+ <input type='Text' name='range2[]' value='{RANGE2}' size='15' maxlength='15' class='medium_form_field'>
+ <input type='hidden' name='oldrange1[]' value='{RANGE1}'>
+ <input type='hidden' name='oldrange2[]' value='{RANGE2}'><br>
+ <input type='hidden' name='rangepooldn[]' value='{RPOOLDN}'>
+
+ <!-- END DYNAMIC BLOCK: Dhcpranges -->
+
+ <input type='Text' name='addrange1[]' value='' size='15' maxlength='15' class='medium_form_field'>
+ &nbsp;&nbsp; - &nbsp;&nbsp;
+ <input type='Text' name='addrange2[]' value='' size='15' maxlength='15' class='medium_form_field'>
+ </td>
+
+ <td class='tab_d'>
+ <select name='unknownclients[]' size='3' class='small_form_selectbox'>
+ {UCSELECT}
+ </select>
+ <input type='hidden' name='olduc[]' value='{UCNOW}'> &nbsp;
+ </td>
+ </tr>
+ <!--<tr>
+ <td colspan='3' class='tab_d'><input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'>
+ Pool l&ouml;schen (H&auml;kchen setzen)</td>
+ </tr>-->
+
+ <input type='hidden' name='pooldn[]' value='{POOLDN}'>
+ <input type='hidden' name='subnet[]' value='{SUBNET}'>
+ <input type='hidden' name='subnetau[]' value='{SUBNETAU}'>
+
+ <!-- END DYNAMIC BLOCK: Dhcppools -->
+
+ <input type='hidden' name='mnr' value='{MNR}'>
+
+ </table></td>
+ </tr>
+ <tr>
+ <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'>
+ </form></td>
+ </tr>
+
+ <tr>
+ <td height='50'></td>
+ </tr>";
+
+$template->assign(array("POOLFORMULAR" => $poolform));
+$template->parse("POOLFORM_LIST", "Poolform");
+#$template->clear_dynamic("Poolform");
+#$template->clear_parse("POOLFORM_LIST");
+
$template->define_dynamic("Dhcppools", "Webseite");
$template->define_dynamic("Dhcpranges", "Webseite");
-
+# Für jeden Pool ...
foreach ($pools as $pool){
-
+
+ # DHCP Subnet des Pools
+ $subnet = ldap_explode_dn($pool['dhcphlpcont'],1);
+ $subnetdnexp = ldap_explode_dn( $pool['dhcphlpcont'], 0);
+ $subnetauexp = array_slice($subnetdnexp, 3);
+ $subnetau = implode(',',$subnetauexp);
+
+
$template->clear_parse("DHCPRANGES_LIST");
- # DHCP Range
+ # DHCP Ranges
if (count($pool['dhcprange']) != 0){
#$template->define_dynamic("Dhcpranges", "Webseite");
if (count($pool['dhcprange']) > 1){
@@ -81,10 +163,7 @@ foreach ($pools as $pool){
}
}
- # DHCP Subnet
- $subnet = ldap_explode_dn($pool['dhcphlpcont'],1);
-
-
+ # Unknown-Clients
if ($pool['dhcpoptallow'] == "unknown-clients"){
$unknownclients = "allow";
$ucselectbox = "<option selected value='allow'> ALLOW </option>
@@ -102,28 +181,24 @@ foreach ($pools as $pool){
$ucselectbox = "<option selected value='deny'> DENY </option>
<option value='allow'> ALLOW </option>
<option value='ignore'> IGNORE </option>";
- }
-
+ }
$template->assign(array("POOLDN" => $pool['dn'],
"CN" => $pool['cn'],
"SUBNETDN" => $pool['dhcphlpcont'],
"SUBNET" => $subnet[0],
+ "SUBNETAU" => $subnetau,
"DESCRIPTION" => $pool['description'],
"STATEMENTS" => $pool['dhcpstatements'],
"UCSELECT" => $ucselectbox,
"UCNOW" => $unknownclients,
- "ALLOW" => $pool['dhcpoptallow'],
- "DENY" => $pool['dhcpoptdeny'],
- "IGNORE" => $pool['dhcpoptignore'],
"DEFAULTLEASE" => $pool['dhcpoptdefault-lease-time'],
"MAXLEASE" => $pool['dhcpoptmax-lease-time'],
"MNR" => $mnr));
$template->parse("DHCPPOOLS_LIST", ".Dhcppools");
- #$template->clear_dynamic("Dhcppools");
-
}
+}
###################################################################################
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php b/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php
index c6cef33a..416654e2 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php
@@ -8,7 +8,7 @@ $range2 = $_POST['addrange2'];
$unknownclients = $_POST['unknownclients'];
$mnr = $_POST['mnr'];
-$seconds = 200;
+$seconds = 2;
$url = "dhcppool.php?mnr=".$mnr;
echo "
@@ -28,57 +28,63 @@ if ($syntax->check_ip_syntax($range1) && $syntax->check_ip_syntax($range2)){
$fe = explode('.',$range2);
if ( $fs[0] == $fe[0] && $fs[1] == $fe[1] && $fs[2] == $fe[2] ) {
if ( $fs[3] <= $fe[3] ){
- # Range zusammenstellen
- $range = implode("_", array($range1,$range2));
- # Freie IP Bereiche testen
- $fipb_array = get_freeipblocks_au($auDN);
- for ($i=0; $i < count($fipb_array); $i++){
- if ( split_iprange($range,$fipb_array[$i]) != 0 ){
- $ipranges = split_iprange($range,$fipb_array[$i]);
- array_splice($fipb_array, $i, 1, $ipranges);
- break;
- }
+ # DHCP Subnet DN finden
+ $subnet = implode(".", array($fs[0],$fs[1],$fs[2],"0"));
+ print_r($subnet);echo"<br><br>";
+ if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=dhcpSubnet)(cn=$subnet))", array("dn","dhcphlpcont"), "", "sub", 0, 0))) {
+ # redirect(5, "", $ldapError, FALSE);
+ echo "no search";
+ die;
}
- if ($i < count($fipb_array) ){
- foreach ( $fipb_array as $item ){
- $entry ['FreeIPBlock'][] = $item;
- }
- $results = ldap_mod_replace($ds,$auDN,$entry);
- if ($results){
- echo "<br>Neue FIPBs erfolgreich eingetragen!<br>";
-
- # DHCP Subnet DN finden
- $subnet = implode(".", array($fs[0],$fs[1],$fs[2],"0"));
- print_r($subnet);echo"<br><br>";
- if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=dhcpSubnet)(cn=$subnet))", array("dn","dhcphlpcont"), "", "sub", 0, 0))) {
- # redirect(5, "", $ldapError, FALSE);
- echo "no search";
- die;
- }
- $result = ldapArraySauber($result);
- print_r($result);echo "<br><br>";
- if (count($result[0]) != 0){
- $result = add_dhcppool($result[0]['dn'],$range,$unknownclients,$result[0]['dhcphlpcont']);
+ $result = ldapArraySauber($result);
+ #print_r($result);echo "<br><br>";
+ if (count($result[0]) != 0){
+
+ $subnetdn = $result[0]['dn'];
+ $subnetdnexp = ldap_explode_dn( $subnetdn, 0);
+ $subnetauexp = array_slice($subnetdnexp, 3);
+ $subnetau = implode(',',$subnetauexp);
+
+ # Range zusammenstellen
+ $range = implode("_", array($range1,$range2));
+
+ # Freie IP Bereiche testen
+ $fipb_array = get_freeipblocks_au($auDN);
+ for ($i=0; $i < count($fipb_array); $i++){
+ if ( split_iprange($range,$fipb_array[$i]) != 0 ){
+ $ipranges = split_iprange($range,$fipb_array[$i]);
+ array_splice($fipb_array, $i, 1, $ipranges);
+ break;
+ }
+ }
+ if ($i < count($fipb_array) ){
+ foreach ( $fipb_array as $item ){
+ $entry ['FreeIPBlock'][] = $item;
+ }
+ $results = ldap_mod_replace($ds,$auDN,$entry);
+ if ($results){
+ echo "<br>Neue FIPBs erfolgreich eingetragen!<br>";
+ $result = add_dhcppool($subnetdn,$range,$unknownclients,$result[0]['dhcphlpcont']);
if ($result){
echo "<br>Dynamischer DHCP Pool erfolgreich eingetragen!<br>" ;
- update_dhcpmtime();
+ update_dhcpmtime(array($subnetau));
}else{
echo "<br>Fehler beim eintragen des dynamischen DHCP Pools!<br>";
# Range wieder in FIPBs aufnehmen.
$entry2 ['FreeIPBlock'] = $range;
ldap_mod_add($ds,$auDN,$entry2);
merge_ipranges($auDN);
- }
- }else{
- echo "DHCP Subnet nicht im System vorhanden!<br>";
- }
- }else{
- echo "<br>Fehler beim eintragen der FIPBs!<br>";
- }
+ }
+ }else{
+ echo "<br>Fehler beim eintragen der FIPBs!<br>";
+ }
+ }else{
+ printf("<br>IP Range %s ist nicht im verfuegbaren Bereich!<br>", $range );
+ }
}else{
- printf("<br>IP Range %s ist nicht im verfuegbaren Bereich!<br>", $range );
- }
+ echo "DHCP Subnet nicht im System vorhanden!<br>";
+ }
}else{
echo "erster Range Wert gr&ouml;sser als zweiter Range Wert<br>";
}
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php
index b0ed4210..375cc01a 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php
@@ -5,6 +5,7 @@ $syntax = new Syntaxcheck;
$pooldn = $_POST['pooldn'];
$subnet = $_POST['subnet'];
+$subnetau = $_POST['subnetau'];
$delpool = $_POST['delpool'];
$poolranges = array();
foreach ($pooldn as $dn){
@@ -20,8 +21,14 @@ $addrange2 = $_POST['addrange2'];
$uc = $_POST['unknownclients'];
$olduc = $_POST['olduc'];
+# Array to fill with AUs to update dhcpMTime
+$au_to_update = array();
+
+$mnr = $_POST['mnr'];
+
#print_r($pooldn); echo "<br>";
#print_r($subnet); echo "<br>";
+#print_r($subnetau); echo "<br>";
#print_r($delpool); echo "<br><br>";
#print_r($oldrange1); echo "<br>";
#print_r($oldrange2); echo "<br>";
@@ -33,9 +40,7 @@ $olduc = $_POST['olduc'];
#print_r($olduc); echo "<br><br>";
#print_r($uc); echo "<br><br>";
-$mnr = $_POST['mnr'];
-
-$seconds = 2000;
+$seconds = 200;
$url = "dhcppool.php?mnr=".$mnr;
echo "
@@ -48,9 +53,9 @@ echo "
<table border='0' cellpadding='30' cellspacing='0'>
<tr><td>";
-
+#########################################################################################
+# Pools löschen, entsprechende Arrays ($pooldn, $uc, ...) zur weiteren Verarbeitung anpassen
for ($i=0;$i<count($delpool);$i++){
- # Löschen und Arrays $pooldn, $uc, ... und $rpooldn anpassen zur weiteren Verarbeitung
$key = array_keys ( $pooldn, $delpool[$i] );
$key_r = array_keys ( $rangepooldn, $delpool[$i] );
@@ -71,6 +76,8 @@ for ($i=0;$i<count($delpool);$i++){
$delete = ldap_delete($ds,$delpool[$i]);
if ($delete){
+ # Subnet-AU auf DHCP-Modify setzen
+ $au_to_update [] = $subnetau[$i];
# Arrays von gelöschten Pools für weitere Verarbeitung bereinigen
foreach ( $key as $nr ){
array_splice ( &$pooldn, $nr, 1 );
@@ -98,22 +105,25 @@ for ($i=0;$i<count($delpool);$i++){
}
}
-
+#########################################################################################
+# Änderungen in bestehenden Pools (unknown-clients) und Ranges hinzufügen
for ($i=0;$i<count($pooldn);$i++){
$entrydel = array();
$entryadd = array();
# DENY, ALLOW, IGNORE Unknown-clients verarbeiten
if ( $uc[$i] != $olduc[$i] ){
- printf("Unknown-Clients f&uuml;r Pool %s &auml;ndern<br>", $pooldn[$i]);
$dhcpoptdel = "dhcpopt".$olduc[$i];
$entrydel [$dhcpoptdel] = array();
- print_r($entrydel); echo "<br>";
+ #print_r($entrydel); echo "<br>";
ldap_mod_del($ds,$pooldn[$i],$entrydel);
$dhcpoptadd = "dhcpopt".$uc[$i];
$entryadd [$dhcpoptadd] = "unknown-clients";
- print_r($entryadd); echo "<br><br>";
+ #print_r($entryadd); echo "<br><br>";
ldap_mod_add($ds,$pooldn[$i],$entryadd);
+ printf("Pool %s:<br>DHCP Option <b>unknown-clients</b> von <b>%s</b> auf <b>%s</b> ge&auml;ndert<br><br>",$pooldn[$i],$olduc[$i],$uc[$i]);
+ # Subnet-AU auf DHCP-Modify setzen
+ $au_to_update [] = $subnetau[$i];
}
# Ranges hinzufügen
if ( $addrange1[$i] != "" && $addrange2[$i] != "" ){
@@ -128,6 +138,8 @@ for ($i=0;$i<count($pooldn);$i++){
$newrange = implode("_", array($addrange1[$i],$addrange2[$i]));
$result = add_dhcprange($newrange,$pooldn[$i]);
if ($result){
+ # Subnet-AU auf DHCP-Modify setzen
+ $au_to_update [] = $subnetau[$i];
printf("Neue dynamische IP Range %s - %s erfolgreich in Subnetz %s0 eingetragen!<br>",$addrange1[$i],$addrange2[$i],$net);
}else{
echo "<br>Fehler beim eintragen des dynamischen DHCP Pools!<br>";
@@ -143,7 +155,9 @@ for ($i=0;$i<count($pooldn);$i++){
}
-# bereits angelegte Ranges verarbeiten (löschen, verkleinern, vergrößern)
+#########################################################################################
+# In Pools bereits angelegte Ranges verarbeiten (löschen, verkleinern, vergrößern)
+# vorzunehmende Änderungen in Arrays ($mod_dhcpranges, $new_fibs) speichern
$fipbs = get_freeipblocks_au($auDN);
$new_fipbs ['freeipblock'] = $fipbs;
$mod_dhcpranges = array();
@@ -161,6 +175,8 @@ for ($i=0;$i<count($rangepooldn);$i++){
array_splice ( &$mod_dhcpranges[$rangepooldn[$i]], $range_key, 1 );
array_splice ( &$poolranges[$rangepooldn[$i]], $range_key, 1 );
$new_fipbs ['freeipblock'][] = $oldrange;
+ # Subnet-AU auf DHCP-Modify setzen
+ $au_to_update [] = $subnetau[$i];
}
elseif ( $oldrange1[$i] != "" && $oldrange2[$i] != "" && $range1[$i] != "" && $range2[$i] != "" ){
$or1 = ip2long($oldrange1[$i]);
@@ -179,6 +195,8 @@ for ($i=0;$i<count($rangepooldn);$i++){
#print_r($range_key); echo "<br>";
$poolranges [$rangepooldn[$i]][$range_key] = $range;
$mod_dhcpranges [$rangepooldn[$i]][$range_key] = $range;
+ # Subnet-AU auf DHCP-Modify setzen
+ $au_to_update [] = $subnetau[$i];
foreach ($diffrange as $dr){
$new_fipbs ['freeipblock'][] = $dr;
@@ -206,7 +224,9 @@ for ($i=0;$i<count($rangepooldn);$i++){
}
if ( $test ){
$poolranges [$rangepooldn[$i]][] = $ar;
- $mod_dhcpranges [$rangepooldn[$i]][] = $ar;
+ $mod_dhcpranges [$rangepooldn[$i]][] = $ar;
+ # Subnet-AU auf DHCP-Modify setzen
+ $au_to_update [] = $subnetau[$i];
}
}
}else{
@@ -222,9 +242,11 @@ for ($i=0;$i<count($rangepooldn);$i++){
#}
}
}
-
#print_r($mod_dhcpranges); echo "<br>";
#print_r($new_fipbs); echo "<br><br>";
+
+#########################################################################################
+# In Arrays $dhcp_modranges und $new_fipbs gespeicherte Änderungen im LDAP schreiben
$keys = array_keys($mod_dhcpranges);
foreach ($keys as $pdn){
#print_r($pdn); echo "<br>";
@@ -265,8 +287,13 @@ if ( count($diff) != 0 || count($revdiff) != 0 ){
printf("Fehler beim Anpassen der FIPBs");
}
}
-# DHCP Modify Timestamp festhalten
-update_dhcpmtime();
+
+#########################################################################################
+# DHCP Modify Timestamps in betreffenden AUs aktualisieren
+#echo "<br>Subnet-AU: ";print_r ($au_to_update); echo "<br>";
+update_dhcpmtime($au_to_update);
+
+
$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zur&uuml;ckgeleitet. <br>
Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>";
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php
index 388f01ff..8ca55023 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php
@@ -65,7 +65,7 @@ $attributes = array("dn","cn","dhcpprimarydn","dhcpsecondarydn","description","d
$dhcpsv_data = get_node_data($dhcpserviceDN, $attributes);
#print_r($dhcpsv_data);
-# RBS Anbieten
+# DHCP Service Anbieten
# momentanes Offer
# todo: falls dhcpofferDN leer dann standardwert AU teilbaum
$offerexp = ldap_explode_dn($dhcpsv_data['dhcpofferdn'], 1);
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php
index 4b17dec9..687a5bbd 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php
@@ -98,30 +98,43 @@ if ( $oldcn != "" && $cn == "" ){
if ( $dhcpoffer != "none" ){
- if ( $dhcpoffer != "off" && $dhcpoffer == $olddhcpoffer ){
+ if ( ($dhcpoffer != "off" && $dhcpoffer == $olddhcpoffer) || ($dhcpoffer == "off" && $olddhcpoffer == "") ){
$mesg = "Sie haben die gleiche Abteilung ausgew&auml;hlt<br>
Keine &Auml;nderung!";
}
if ( $dhcpoffer != "off" && $dhcpoffer != $olddhcpoffer ){
$entryoffer ['dhcpofferdn'] = $dhcpoffer;
- if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){
- $mesg = "DHCP Service Offer erfolgreich ge&auml;ndert<br><br>";
+ if ($olddhcpoffer == ""){
+ # Offer anlegen
+ if(ldap_mod_add($ds,$dhcpDN,$entryoffer)){
+ $mesg = "DHCP Service Offer erfolgreich angelegt<br><br>";
+ }
+ else{
+ $mesg = "Fehler beim &auml;ndern des DHCP Service Offers!<br><br>";
+ }
}
else{
- $mesg = "Fehler beim &auml;ndern des DHCP Service Offers!<br><br>";
+ # Offer ändern
+ if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){
+ $mesg = "DHCP Service Offer erfolgreich ge&auml;ndert<br><br>";
+ }
+ else{
+ $mesg = "Fehler beim &auml;ndern des DHCP Service Offers!<br><br>";
+ }
}
}
- /*if ( $dhcpoffer == "off" && $olddhcpoffer != "" ){
+ if ( $dhcpoffer == "off" && $olddhcpoffer != "" ){
$entryoffer ['dhcpofferdn'] = array();
if(ldap_mod_del($ds,$dhcpDN,$entryoffer)){
- $mesg = "DHCP Service Offer erfolgreich ge&auml;ndert<br><br>";
+ $mesg = "DHCP Service Offer erfolgreich gel&ouml;scht<br><br>";
+ cleanup_del_dhcpservice ($dhcpDN);
}
else{
$mesg = "Fehler beim &auml;ndern des DHCP Service Offers!<br><br>";
}
- }*/
+ }
}
@@ -133,7 +146,7 @@ if ( $adddhcpoptdefinition != "" ){
$entryadd['optiondefinition'] = $adddhcpoptdefinition;
if(ldap_mod_add($ds,$dhcpDN,$entryadd)){
$mesg = "Selbst-definierte DHCP Option erfolgreich eingetragen<br><br>";
- update_dhcpmtime();
+ update_dhcpmtime(array());
}else{
$mesg = "Fehler beim eintragen Selbst-definierte DHCP Option<br><br>";
}
@@ -176,7 +189,7 @@ if (count($entryadd) != 0 ){
}
if(ldap_mod_add($ds,$dhcpDN,$entryadd)){
$mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>";
- update_dhcpmtime();
+ update_dhcpmtime(array());
}else{
$mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>";
}
@@ -188,7 +201,7 @@ if (count($entrymod) != 0 ){
}
if(ldap_mod_replace($ds,$dhcpDN,$entrymod)){
$mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>";
- update_dhcpmtime();
+ update_dhcpmtime(array());
}else{
$mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>";
}
@@ -200,7 +213,7 @@ if (count($entrydel) != 0 ){
}
if(ldap_mod_del($ds,$dhcpDN,$entrydel)){
$mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>";
- update_dhcpmtime();
+ update_dhcpmtime(array());
}else{
$mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>";
}
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt
index 0f16f966..9160219c 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt
@@ -5,7 +5,7 @@
</tr>
<tr>
- <td colspan='2'><h3>DHCP Subnet &nbsp;<code class='font_object'> {CN} </code> </h3></td>
+ <td colspan='2'><h3>DHCP Subnet &nbsp;<code class='font_object'> {CN} / {NETMASK} </code> </h3></td>
</tr>
<tr><td>
<table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'>
@@ -17,7 +17,7 @@
<td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td>
</tr>
- <tr height='50'>
+ <!-- <tr height='50'>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Subnet (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) &nbsp;</td>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
<input type='Text' name='cn' value='{CN}' size='15' maxlength='15' class='medium_form_field'>
@@ -30,7 +30,7 @@
<input type='Text' name='netmask' value='{NETMASK}' size='15' maxlength='15' class='medium_form_field'>
<input type='hidden' name='oldnetmask' value='{NETMASK}'> &nbsp;
</td>
- </tr>
+ </tr> -->
<tr valign='top'>
<td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Eingebunden in DHCP Dienst: <b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{DHCPSVNOW}&nbsp;
@@ -107,17 +107,17 @@
</tr>
<tr>
- <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Default Lease Time:</b></td>
+ <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Routers:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>
- <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='30' class='medium_form_field'>
- <input type='hidden' name='oldattribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}'> &nbsp;
+ <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'>
+ <input type='hidden' name='oldattribs[dhcpoptrouters]' value='{ROUTERS}'> &nbsp;
</td>
</tr>
<tr>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
- <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='30' class='medium_form_field'>
- <input type='hidden' name='oldattribs[dhcpoptmax-lease-time]' value='{MAXLEASE}'> &nbsp;
+ <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Broadcast Address:</b></td>
+ <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>
+ <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'>
+ <input type='hidden' name='oldattribs[dhcpoptbroadcast-address]' value='{BROADCAST}'> &nbsp;
</td>
</tr>
<tr>
@@ -135,26 +135,26 @@
</td>
</tr>
<tr>
- <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Routers:</b></td>
+ <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Default Lease Time:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>
- <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'>
- <input type='hidden' name='oldattribs[dhcpoptrouters]' value='{ROUTERS}'> &nbsp;
+ <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='30' class='medium_form_field'>
+ <input type='hidden' name='oldattribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}'> &nbsp;
</td>
</tr>
<tr>
- <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Broadcast Address:</b></td>
- <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>
- <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'>
- <input type='hidden' name='oldattribs[dhcpoptbroadcast-address]' value='{BROADCAST}'> &nbsp;
+ <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td>
+ <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
+ <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='30' class='medium_form_field'>
+ <input type='hidden' name='oldattribs[dhcpoptmax-lease-time]' value='{MAXLEASE}'> &nbsp;
</td>
</tr>
- <tr>
+ <!-- <tr>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NTP Servers:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
<input type='Text' name='attribs[dhcpoptntp-servers]' value='{NTPSERVERS}' size='40' class='medium_form_field'>
<input type='hidden' name='oldattribs[dhcpoptntp-servers]' value='{NTPSERVERS}'> &nbsp;
</td>
- </tr>
+ </tr> -->
<tr>
<td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Allow:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php
index ded54e2c..875f464b 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php
@@ -283,7 +283,7 @@ if (count($entrydel) != 0 ){
}
-update_dhcpmtime();
+update_dhcpmtime(array());
$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zur&uuml;ckgeleitet. <br>
Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>";
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php
index 5bbe10d0..28c8277b 100644
--- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php
@@ -21,7 +21,7 @@ echo "
if ( $subnetDN != ""){
if( delete_dhcpsubnet($subnetDN,$cn)){
$mesg = "Subnet <b>".$cn."</b> erfolgreich gel&ouml;scht!<br><br>";
- update_dhcpmtime();
+ update_dhcpmtime(array());
}else{
$mesg = "Fehler beim l&ouml;schen des Subnets <b>".$cn."</b> !<br><br>";
}
diff --git a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt
index 7cf7f42c..61d052b1 100644
--- a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt
+++ b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt
@@ -77,21 +77,15 @@
</tr>
<tr height='50'>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default Lease Time:</b></td>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
- <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='40' class='medium_form_field'>
- </td>
- </tr>
- <tr height='50'>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td>
+ <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Routers:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
- <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='40' class='medium_form_field'>
+ <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'>
</td>
</tr>
<tr height='50'>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DDNS Update Style:</b></td>
+ <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Broadcast Address:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
- <input type='Text' name='attribs[dhcpoptddns-update-style]' value='{DDNSUPDATE}' size='40' class='medium_form_field'>
+ <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'>
</td>
</tr>
<tr height='50'>
@@ -107,15 +101,15 @@
</td>
</tr>
<tr height='50'>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Routers:</b></td>
+ <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default Lease Time:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
- <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'>
+ <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='40' class='medium_form_field'>
</td>
</tr>
<tr height='50'>
- <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Broadcast Address:</b></td>
+ <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
- <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'>
+ <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='40' class='medium_form_field'>
</td>
</tr>
<!-- <tr height='50'>
@@ -129,13 +123,13 @@
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
<input type='Text' name='attribs[dhcpoptfilename]' value='{FILENAME}' size='40' class='medium_form_field'>
</td>
- </tr> -->
+ </tr>
<tr height='50'>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NTP Servers:</b></td>
<td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>
<input type='Text' name='attribs[dhcpoptntp-servers]' value='{NTPSERVERS}' size='40' class='medium_form_field'>
</td>
- </tr>
+ </tr>-->
<input type='hidden' name='mnr' value='{MNR}'>
<input type='hidden' name='sbmnr' value='{SBMNR}'>