Esempio n. 1
0
function relayhost_save(){
	$main=new main_cf();
	$tpl=new templates();
	$stunnel=new stunnel4();
	$continue=true;
	$main->smtp_sasl_password_maps_enable_2();
	$localport=$stunnel->main_array["postfix_relayhost"]["accept"];
	
	writelogs("Saving [127.0.0.1]:$localport -> {$_GET["username"]}",__FUNCTION__,__FILE__,__LINE__);
	
	$main->main_array["relayhost"]="[127.0.0.1]:$localport";
	$main->save_conf();
	
	$sock=new sockets();
	$sock->SET_INFO("PostfixRelayHost","[127.0.0.1]:$localport");	
	$sock->getFrameWork("cmd.php?postfix-relayhost=yes");
	
	if($_GET["username"]==null){$continue=false;}
	if($_GET["password"]==null){$continue=false;}
		$saslpswd=new smtp_sasl_password_maps();
		if($continue){
			writelogs("UPDATE [127.0.0.1]:$localport",__FUNCTION__,__FILE__,__LINE__);
			if(!$saslpswd->add("[127.0.0.1]:$localport",$_GET["username"],$_GET["password"])){
				echo $tpl->javascript_parse_text("{err_sasl_saveldap}<br>$saslpswd->ldap_infos");
				return;
			}
			
			$sock->SET_INFO("smtp_sender_dependent_authentication",1);
			$sock->getFrameWork("cmd.php?postfix-hash-senderdependent=yes");
			$sock->getFrameWork("cmd.php?postfix-smtp-sasl=yes");
		}else{
			writelogs("Delete [127.0.0.1]:$localport",__FUNCTION__,__FILE__,__LINE__);
			$saslpswd->delete("[127.0.0.1]:$localport");
		}
	
}
Esempio n. 2
0
function SaveISPAddress()
{
    $tpl = new templates();
    $domain = new DomainsTools();
    $page = CurrentPageName();
    $address = $domain->transport_maps_implode($_GET["isp_address"], $_GET["isp_port"]);
    $sasl = new smtp_sasl_password_maps();
    writepostfixlogs("Set ISP server has {$address}", __FUNCTION__, __FILE__);
    $sock = new sockets();
    $sock->SET_INFO("PostfixRelayHost", "{$address}");
    writepostfixlogs("is this server {$address} must use authentication ?", __FUNCTION__, __FILE__);
    if (trim($_GET["isp_username"]) == null) {
        $sasl->delete($address);
        exit;
    }
    if (trim($_GET["isp_password"]) == null) {
        die("password NULL !");
    }
    writepostfixlogs("Enable SMTP Sasl", __FUNCTION__, __FILE__);
    $main = new main_cf();
    $main->smtp_sasl_password_maps_enable();
    if (!$sasl->add($address, trim($_GET["isp_username"]), trim($_GET["isp_password"]))) {
        die($sasl->ldap_infos);
    }
}