예제 #1
0
function MultiplesInstances($hostname = null, $ou = null)
{
    echo "{$GLOBALS["deflog_start"]} milter-greylist: MultiplesInstances() `{$hostname}` and ou `{$ou}`\n";
    if ($ou == null && $hostname == null) {
        MultiplesInstancesFound();
        return;
    }
    if ($hostname == null) {
        echo __FUNCTION__ . " unable to get hostname name\n";
        return;
    }
    $mg = new milter_greylist(false, $hostname, $ou);
    $datas = $mg->BuildConfig();
    @mkdir("/etc/milter-greylist/{$hostname}", 0666, true);
    @mkdir("/var/spool/{$hostname}/run/milter-greylist", 0666, true);
    $tbl = explode("\n", $datas);
    while (list($num, $ligne) = each($tbl)) {
        $ligne = trim($ligne);
        if ($ligne == null) {
            continue;
        }
        $newf[] = $ligne;
    }
    $newf[] = "";
    echo "{$GLOBALS["deflog_start"]} milter-greylist {$hostname}: writing /etc/milter-greylist/{$hostname}/greylist.conf\n";
    $datas = @implode("\n", $newf);
    @file_put_contents("/etc/milter-greylist/{$hostname}/greylist.conf", $datas);
    echo "{$GLOBALS["deflog_start"]} milter-greylist {$hostname}: or={$ou} START_ONLY={$GLOBALS["START_ONLY"]},STOP_ONLY={$GLOBALS["STOP_ONLY"]}\n";
    if ($GLOBALS["STOP_ONLY"] == 1) {
        MultiplesInstances_stop($hostname, $ou);
    }
    if ($GLOBALS["START_ONLY"] == 1) {
        MultiplesInstances_start($hostname, $ou);
    }
}
예제 #2
0
function MultiplesInstances($hostname=null,$ou=null){
	
	if(($ou==null) && ($hostname==null)){MultiplesInstancesFound();return;}
	if($ou==null){echo __FUNCTION__." unable to get ou name\n";return;}
	if($hostname==null){echo __FUNCTION__." unable to get hostname name\n";return;}	
	$mg=new milter_greylist(false,$hostname,$ou);
	$datas=$mg->BuildConfig();
	@mkdir("/etc/milter-greylist/$hostname",0666,true);
	@mkdir("/var/spool/$hostname/run/milter-greylist",0666,true);
	
		$tbl=explode("\n",$datas);
		while (list ($num, $ligne) = each ($tbl) ){
			$ligne=trim($ligne);
			if($ligne==null){continue;}
			$newf[]=$ligne;
		}
		$newf[]="";
		echo "Starting......: writing $conf_path\n";
		$datas=@implode("\n",$newf);	
	
	@file_put_contents("/etc/milter-greylist/$hostname/greylist.conf",$datas);
	echo "Starting......: milter-greylist $hostname or=$ou START_ONLY={$GLOBALS["START_ONLY"]},STOP_ONLY={$GLOBALS["STOP_ONLY"]}\n";
	if($GLOBALS["STOP_ONLY"]==1){MultiplesInstances_stop($hostname,$ou);}
	if($GLOBALS["START_ONLY"]==1){MultiplesInstances_start($hostname,$ou);}

}