Beispiel #1
0
function SimpleShareAddCompToPath()
{
    $uid = $_GET["add-uid"];
    $samba = new samba();
    $keypath = $samba->GetShareName(base64_decode($_GET["path"]));
    $hosts = explode(" ", $samba->main_array[$keypath]["hosts allow"]);
    if (is_array($hosts)) {
        while (list($index, $host) = each($hosts)) {
            if ($host == null) {
                continue;
            }
            $hote[$host] = $host;
        }
    }
    $comp = new computers($uid);
    $pdns = new pdns();
    $array = $pdns->IpToHosts($comp->ComputerIP);
    if (is_array($array)) {
        while (list($index, $val) = each($array)) {
            $hote[$val] = $val;
        }
    } else {
        $hote[$comp->ComputerIP] = $comp->ComputerIP;
    }
    $hote[$comp->ComputerRealName] = $comp->ComputerRealName;
    if (is_array($hote)) {
        while (list($index, $host) = each($hote)) {
            if (strpos($host, '$') > 0) {
                continue;
            }
            $final[] = $host;
        }
    }
    if (count($final) > 0) {
        $samba->main_array[$keypath]["hosts allow"] = @implode(" ", $final);
        $samba->main_array[$keypath]["hosts deny"] = "0.0.0.0/0";
        $samba->main_array[$keypath]["public"] = "yes";
        $samba->main_array[$keypath]["force user"] = "******";
        $samba->main_array[$keypath]["guest ok"] = "yes";
        $samba->main_array[$keypath]["read only"] = "no";
        $samba->main_array[$keypath]["browseable"] = "yes";
        $samba->main_array["global"]["guest account"] = "nobody";
        $samba->main_array["global"]["map to guest"] = "Bad Password";
        unset($samba->main_array[$keypath]["write list"]);
        unset($samba->main_array[$keypath]["valid users"]);
        unset($samba->main_array[$keypath]["read list"]);
    } else {
        unset($samba->main_array[$keypath]["force user"]);
        unset($samba->main_array[$keypath]["public"]);
        unset($samba->main_array[$keypath]["guest ok"]);
        unset($samba->main_array[$keypath]["read only"]);
        unset($samba->main_array[$keypath]["hosts deny"]);
        unset($samba->main_array[$keypath]["hosts allow"]);
    }
    $samba->SaveToLdap();
}
Beispiel #2
0
<?php
	include_once('ressources/class.computers.inc');
	include_once('ressources/class.pdns.inc');
	
	
	$ip=$argv[1];
	
	
	$pdns=new pdns();
	
	print_r($pdns->IpToHosts($ip));
	
	echo "gethostbyaddr():". gethostbyaddr($ip)."\n";
	
	
	
	
	
	
	
	
?>