コード例 #1
0
# Dateiname und evtl. Pfad des Templates für die Webseite
$webseite = "dns_error_hosts.dwt";
include 'dns_header.inc.php';
$mnr = 2;
###################################################################################
# Menuleisten erstellen
createMainMenu($rollen, $mainnr);
createDNSMenu($rollen, $mnr);
###################################################################################
$template->assign(array("DN" => "", "HOSTNAME" => "Alle Clients haben korrekte DNS Einträge", "DOMAINNAME" => "", "HWADDRESS" => "", "IPADDRESS" => "", "HOSTAU" => ""));
$attributes = array("dn", "hostname", "domainname", "hwaddress", "ipaddress");
$host_array = get_dnshosts_subtree($attributes);
#print_r($host_array);
$template->define_dynamic("Rechner", "Webseite");
foreach ($host_array as $host) {
    $hostip = explode('_', $host['ipaddress']);
    $host_audn = get_audn_of_objectdn($host['dn']);
    $host_au = get_rdn_value($host_audn);
    $dns_check = "";
    $dns_check = check_ip_zone($hostip[0], $host['domainname'], $host['hostname'], $host_au);
    if ($dns_check) {
        $hostname = $host['hostname'] . "<br><code class='red_font_object_fin'>{$dns_check}</code>";
        $ip = $hostip[0];
        $dnszone = $host['domainname'];
        $mac = $host['hwaddress'];
        $template->assign(array("DN" => $host['dn'], "HOSTNAME" => $hostname, "DOMAINNAME" => $dnszone, "HWADDRESS" => $mac, "IPADDRESS" => $ip, "HOSTAU" => $host_au, "AUDN" => $auDN));
        $template->parse("RECHNER_LIST", ".Rechner");
    }
}
###################################################################################
include "dns_footer.inc.php";
コード例 #2
0
<?php

include '../standard_header.inc.php';
$syntax = new Syntaxcheck();
$dhcpservice = $_POST['dhcpsrv'];
$olddhcpservice = $_POST['olddhcpsrv'];
$subnetDN = $_POST['subnetdn'];
$subnetaudn = get_audn_of_objectdn($subnetDN);
$dhcpchange = 0;
$seconds = 200;
$url = "dhcpsubnets.php?mnr=0";
echo "\n<html>\n<head>\n\t<title>Computers Management</title>\n\t<link rel='stylesheet' href='../styles.css' type='text/css'>\n</head>\n<body>\n<table border='0' cellpadding='30' cellspacing='0'> \n<tr><td>";
#####################################
# DHCP Dienstzuordnung ändern
print_r($olddhcpservice);
echo "<br><br>";
print_r($dhcpservice);
echo "<br><br>";
print_r($subnetDN);
/*for ( $i=0; $i < count($subnetDN); $i++) {

if ( $dhcpservice[$i] != $olddhcpservice[$i] ){
   
   if ( $olddhcpservice[$i] == "no" ){
   	$entrysv ['dhcphlpcont'] = $DHCP_SERVICE;
   	if(ldap_mod_add($ds,$subnetDN[$i],$entrysv)){
   		$mesg = "Subnetz erfolgreich im DHCP Dienst eingetragen<br><br>";
   		$dhcpchange = 1;
   	}else{
   		$mesg = "Fehler beim eintragen des Subnetzes im DHCP Dienst.<br><br>";
   	}
コード例 #3
0
<?php

include '../standard_header.inc.php';
$dhcpDN = $_POST['dhcpdn'];
$dhcpaudn = get_audn_of_objectdn($dhcpDN);
$changedhcpdn = $_POST['altdhcpsrv'];
#$maxlease = $_POST['dhcpoptmax-lease-time'];
#$defaultlease = $_POST['dhcpoptdefault-lease-time'];
#$oldmaxlease = $_POST['oldmax-lease-time'];
#$olddefaultlease = $_POST['olddefault-lease-time'];
$pcl = $_POST['pcl'];
$oldpcl = $_POST['oldpcl'];
$adddhcpoptdefinition = $_POST['adddhcpoptdefinition'];
#$dhcpoptdefinition = $_POST['dhcpoptdefinition'];
#$olddhcpoptdefinition = $_POST['olddhcpoptdefinition'];
# sonstige Attribute
$attribs = $_POST['attribs'];
if (count($attribs) != 0) {
    foreach (array_keys($attribs) as $key) {
        $atts[$key] = htmlentities($attribs[$key]);
    }
}
$oldattribs = $_POST['oldattribs'];
if (count($oldattribs) != 0) {
    foreach (array_keys($oldattribs) as $key) {
        $oldatts[$key] = htmlentities($oldattribs[$key]);
    }
}
#
#$atts['dhcpoptmax-lease-time'] = htmlentities($maxlease);
#$oldatts['dhcpoptmax-lease-time'] = htmlentities($oldmaxlease);
コード例 #4
0
function delete_dhcpsubnet($subnetDN, $cn, $dhcpsrv)
{
    global $ds, $suffix, $ldapError;
    $subnetaudn = get_audn_of_objectdn($subnetDN);
    delete_ip_dhcprange($subnetDN, $subnetaudn);
    if (dive_into_tree_del($subnetDN, "")) {
        del_dhcpsubnet_pools($subnetDN);
        $oldsubnetip = implode("_", array($cn, $cn));
        $entry['FreeIPBlock'] = $oldsubnetip;
        $results = ldap_mod_add($ds, $subnetaudn, $entry);
        if ($results) {
            merge_ipranges($subnetaudn);
            if ($dhcpsrv) {
                update_dhcpmtime($subnetaudn);
            }
            return 1;
        } else {
            return 0;
        }
    } else {
        return 0;
    }
}
コード例 #5
0
 $fs = explode('.', $range1);
 $fe = explode('.', $range2);
 if ($fs[0] == $fe[0] && $fs[1] == $fe[1] && $fs[2] == $fe[2]) {
     if ($fs[3] <= $fe[3]) {
         # DHCP Subnet DN finden
         $subnet = implode(".", array($fs[0], $fs[1], $fs[2], "0"));
         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) {
             $subnetdn = $result[0]['dn'];
             $subnetau = get_audn_of_objectdn($subnetdn);
             $subnet_data = get_node_data($subnetdn, array("dhcpoptdomain-name"));
             if ($subnet_data['dhcpoptdomain-name'] != $assocdom) {
                 $poolopt_domain = $assocdom;
                 echo "Pool spezifische Option <b>domain-name</b> auf <b>" . $assocdom . "</b> gesetzt<br>";
             }
             # Range zusammenstellen
             $range = implode("_", array($range1, $range2));
             # Freie IP Bereiche testen
             $ipmatch = 0;
             $fipb_array = get_freeipblocks_au($auDN);
             #echo "<br>FIPB: <br>";print_r($fipb_array);echo "<br>";
             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);