当前位置: 首页>>代码示例>>PHP>>正文


PHP unix::LOCATE_NET_BIN_PATH方法代码示例

本文整理汇总了PHP中unix::LOCATE_NET_BIN_PATH方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::LOCATE_NET_BIN_PATH方法的具体用法?PHP unix::LOCATE_NET_BIN_PATH怎么用?PHP unix::LOCATE_NET_BIN_PATH使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unix的用法示例。


在下文中一共展示了unix::LOCATE_NET_BIN_PATH方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNetInfos

function getNetInfos()
{
    $unix = new unix();
    $netbin = $unix->LOCATE_NET_BIN_PATH();
    exec("{$netbin} ads info {$GLOBALS["AUTHCMD"]} 2>&1", $results);
    while (list($index, $line) = each($results)) {
        if (preg_match("#LDAP server:(.+)#", $line, $re)) {
            $GLOBALS["LDAP_HOST"] = trim($re[1]);
            continue;
        }
        if (preg_match("#Bind Path:(.+)#", $line, $re)) {
            $GLOBALS["LDAP_SUFFIX"] = trim($re[1]);
            continue;
        }
        if (preg_match("#LDAP port.+?([0-9]+)#", $line, $re)) {
            $GLOBALS["LDAP_PORT"] = trim($re[1]);
            continue;
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:20,代码来源:exec.squid.ad.import.php

示例2: activedirectory_ping

function activedirectory_ping(){
	$sock=new sockets();
	$unix=new unix();
	$filetime="/etc/artica-postfix/pids/".basename(__FILE__).".".__FUNCTION__.".time";
	$EnableSambaActiveDirectory=$sock->GET_INFO("EnableSambaActiveDirectory");
	if(!is_numeric($EnableSambaActiveDirectory)){return;}
	if($EnableSambaActiveDirectory<>1){return;}
	$ping_dc=false;
	$time=$unix->file_time_min($filetime);
	if($time<120){
		if(!$GLOBALS["VERBOSE"]){return;}
		echo "$filetime ({$time}Mn)\n";
	}
	
	$kinit=$unix->find_program("kinit");
	$echo=$unix->find_program("echo");
	$net=$unix->LOCATE_NET_BIN_PATH();
	$wbinfo=$unix->find_program("wbinfo");
	$config=unserialize(base64_decode($sock->GET_INFO("SambaAdInfos")));
	$domain=strtoupper($config["ADDOMAIN"]);
	$domain_lower=strtolower($config["ADDOMAIN"]);

	$ADSERVER_IP=$config["ADSERVER_IP"];	
	$ad_server=strtolower($config["ADSERVER"]);
	$kinitpassword=$config["PASSWORD"];
	$kinitpassword=$unix->shellEscapeChars($kinitpassword);
	
	$clock_explain="The clock on you system (Linux/UNIX) is too far off from the correct time.\nYour machine needs to be within 5 minutes of the Kerberos servers in order to get any tickets.\nYou will need to run ntp, or a similar service to keep your clock within the five minute window";
	
	
	$cmd="$echo $kinitpassword|$kinit {$config["ADADMIN"]}@$domain 2>&1";
	echo "$cmd\n";
	exec("$cmd",$kinit_results);
	while (list ($num, $ligne) = each ($kinit_results) ){
		if(preg_match("#Clock skew too great while getting initial credentials#", $ligne)){$unix->send_email_events("Active Directory connection clock issue", "kinit program claim\n$ligne\n$clock_explain", "system");}
		if($GLOBALS["VERBOSE"]){echo "kinit: $ligne\n";}
	}	
	

	exec("$wbinfo --ping-dc 2>&1",$ping_dc_results);
	
	while (list ($num, $ligne) = each ($ping_dc_results) ){
		if($GLOBALS["VERBOSE"]){echo "ping-dc: $ligne\n";}
		if(preg_match("#succeeded#", $ligne)){$ping_dc=true;}
	}
	
	@unlink($filetime);
	@file_put_contents($filetime, time());
	
	
}
开发者ID:rsd,项目名称:artica-1.5,代码行数:51,代码来源:exec.samba.php

示例3: disconnect

function disconnect()
{
    $unix = new unix();
    $user = new settings_inc();
    $netbin = $unix->LOCATE_NET_BIN_PATH();
    $kdestroy = $unix->find_program("kdestroy");
    $sock = new sockets();
    $nohup = $unix->find_program("nohup");
    $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
    if (!isset($array["USE_AUTORID"])) {
        $array["USE_AUTORID"] = 1;
    }
    if (!is_numeric($array["USE_AUTORID"])) {
        $array["USE_AUTORID"] = 1;
    }
    $domainUp = strtoupper($array["WINDOWS_DNS_SUFFIX"]);
    $domain_lower = strtolower($array["WINDOWS_DNS_SUFFIX"]);
    $adminpassword = $array["WINDOWS_SERVER_PASS"];
    $adminpassword = $unix->shellEscapeChars($adminpassword);
    $adminpassword = str_replace("'", "", $adminpassword);
    $adminname = $array["WINDOWS_SERVER_ADMIN"];
    $ad_server = $array["WINDOWS_SERVER_NETBIOSNAME"];
    $kdb5_util = $unix->find_program("kdb5_util");
    $function = __FUNCTION__;
    if (!is_file($netbin)) {
        progress_logs(100, "{join_activedirectory_domain}", " net, no such binary");
        return;
    }
    if (!$user->SAMBA_INSTALLED) {
        progress_logs(100, "{join_activedirectory_domain}", " Samba, no such software");
        return;
    }
    build_progress_disconnect("Flush Keytab...", 5);
    exec("{$netbin} ads keytab flush 2>&1", $results);
    build_progress_disconnect("Leave Active Directory...", 10);
    exec("{$netbin} ads leave -U {$adminname}%{$adminpassword} 2>&1", $results);
    build_progress_disconnect("Destroy Kerberos ticket", 10);
    exec("{$kdestroy} 2>&1", $results);
    build_progress_disconnect("Destroy Kerberos ticket", 15);
    system("{$kdb5_util} -r {$domainUp}  -P {$adminpassword} destroy -f");
    build_progress_disconnect("Destroy Kerberos ticket", 20);
    @unlink("/etc/squid3/PROXY.keytab");
    squid_admin_mysql(0, "Active directory disconnected", "An order as been sent to disconnect Active Directory", __FILE__, __LINE__);
    build_progress_disconnect("Stamp to not use Active Directory", 50);
    $sock->SET_INFO("EnableKerbAuth", 0);
    @unlink("/etc/cron.d/artica-ads-watchdog");
    @unlink("/etc/cron.daily/msktutil");
    build_progress_disconnect("Remove the system from Active Directory", 70);
    exec("/usr/share/artica-postfix/bin/artica-install --nsswitch 2>&1", $results);
    build_progress_disconnect("Restarting SMB Engine", 70);
    exec("/etc/init.d/artica-postfix restart samba 2>&1", $results);
    while (list($num, $ligne) = each($results)) {
        echo "Leave......: {$ligne}\n";
        progress_logs(90, "{join_activedirectory_domain}", "Leave......: {$ligne}");
    }
    build_progress_disconnect("{reconfiguring_proxy_service}", 80);
    $php5 = $unix->LOCATE_PHP5_BIN();
    system("{$php5} /usr/share/artica-postfix/exec.squid.php --build --force");
    build_progress_disconnect("{done}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:60,代码来源:exec.kerbauth.php

示例4: disconnect

function disconnect()
{
    $unix = new unix();
    $user = new settings_inc();
    $netbin = $unix->LOCATE_NET_BIN_PATH();
    $kdestroy = $unix->find_program("kdestroy");
    $sock = new sockets();
    $nohup = $unix->find_program("nohup");
    $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
    if (!isset($array["USE_AUTORID"])) {
        $array["USE_AUTORID"] = 1;
    }
    if (!is_numeric($array["USE_AUTORID"])) {
        $array["USE_AUTORID"] = 1;
    }
    $domainUp = strtoupper($array["WINDOWS_DNS_SUFFIX"]);
    $domain_lower = strtolower($array["WINDOWS_DNS_SUFFIX"]);
    $adminpassword = $array["WINDOWS_SERVER_PASS"];
    $adminpassword = $unix->shellEscapeChars($adminpassword);
    $adminpassword = str_replace("'", "", $adminpassword);
    $adminname = $array["WINDOWS_SERVER_ADMIN"];
    $ad_server = $array["WINDOWS_SERVER_NETBIOSNAME"];
    $function = __FUNCTION__;
    if (!is_file($netbin)) {
        progress_logs(100, "{join_activedirectory_domain}", " net, no such binary");
        return;
    }
    if (!$user->SAMBA_INSTALLED) {
        progress_logs(100, "{join_activedirectory_domain}", " Samba, no such software");
        return;
    }
    exec("{$netbin} ads keytab flush 2>&1", $results);
    exec("{$netbin} ads leave -U {$adminname}%{$adminpassword} 2>&1", $results);
    exec("{$kdestroy} 2>&1", $results);
    squid_admin_mysql(0, "Active directory disconnected", "An order as been sent to disconnect Active Directory", __FILE__, __LINE__);
    $unix->send_email_events("Active directory disconnected", "An order as been sent to disconnect Active Directory", "activedirectory");
    $sock->SET_INFO("EnableKerbAuth", 0);
    exec("/usr/share/artica-postfix/bin/artica-install --nsswitch 2>&1", $results);
    exec("/etc/init.d/artica-postfix restart samba 2>&1", $results);
    while (list($num, $ligne) = each($results)) {
        progress_logs(90, "{join_activedirectory_domain}", "Leave......: {$ligne}");
    }
    $php5 = $unix->LOCATE_PHP5_BIN();
    shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.squid.php --build --force >/dev/null 2>&1 &");
    progress_logs(100, "{join_activedirectory_domain}", "Leave......: {$ligne}");
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:46,代码来源:exec.kerbauth.php

示例5: JOIN_ACTIVEDIRECTORY

function JOIN_ACTIVEDIRECTORY()
{
    $unix = new unix();
    $function = __FUNCTION__;
    $user = new settings_inc();
    $netbin = $unix->LOCATE_NET_BIN_PATH();
    if (!is_file($netbin)) {
        echo "Starting......: " . date("H:i:s") . "  {$function}, net, no such binary\n";
        return;
    }
    if (!$user->SAMBA_INSTALLED) {
        echo "Starting......: " . date("H:i:s") . "  {$function}, Samba, no such software\n";
        return;
    }
    $NetADSINFOS = $unix->SAMBA_GetNetAdsInfos();
    $KDC_SERVER = $NetADSINFOS["KDC server"];
    $sock = new sockets();
    $array = unserialize(base64_decode($sock->GET_INFO("SambaAdInfos")));
    run_msktutils();
    $domainUp = strtoupper($array["ADDOMAIN"]);
    $domain_lower = strtolower($array["ADDOMAIN"]);
    $adminpassword = $array["PASSWORD"];
    $adminpassword = $unix->shellEscapeChars($adminpassword);
    $adminname = $array["ADADMIN"];
    $ad_server = $array["ADSERVER"];
    $workgroup = $array["WORKGROUP"];
    $ipaddr = trim($array["ADSERVER_IP"]);
    if ($GLOBALS["VERBOSE"]) {
        echo "{$function}, Using Password: {$adminpassword}";
    }
    if (function_exists("WriteToSyslogMail")) {
        WriteToSyslogMail("Trying to relink this server with Active Directory {$ad_server}.{$domain_lower} server", basename(__FILE__));
    }
    echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname}]: Kdc server ads : {$KDC_SERVER}\n";
    if ($KDC_SERVER == null) {
        $cmd = "{$netbin} ads join -W {$ad_server}.{$domain_lower} -S {$ad_server} -U {$adminname}%{$adminpassword} 2>&1";
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . "  {$function}, {$cmd}\n";
        }
        exec("{$cmd}", $results);
        while (list($index, $line) = each($results)) {
            echo "Starting......: " . date("H:i:s") . "  {$function}, ads join [{$adminname}]: {$line}\n";
        }
        $NetADSINFOS = $unix->SAMBA_GetNetAdsInfos();
        $KDC_SERVER = $NetADSINFOS["KDC server"];
    }
    if ($KDC_SERVER == null) {
        echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname}]: unable to join the domain {$domain_lower}\n";
    }
    echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname}]: setauthuser..\n";
    $cmd = "{$netbin} setauthuser -U {$adminname}%{$adminpassword}";
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . "  {$function}, {$cmd}\n";
    }
    shell_exec($cmd);
    if ($ipaddr == null) {
        $JOINEDRES = false;
        echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname} 0]: join for {$workgroup} (without IP addr)\n";
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . "  {$function},[{$adminname} 0]: {$cmd}\n";
        }
        $cmd = "{$netbin} join -U {$adminname}%{$adminpassword} {$workgroup} 2>&1";
        exec($cmd, $A1);
        while (list($index, $line) = each($A1)) {
            if (preg_match("#Joined#", $line)) {
                echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname} 0]: join for {$workgroup} (without IP addr) success\n";
                $JOINEDRES = true;
                break;
            }
            if (function_exists("WriteToSyslogMail")) {
                WriteToSyslogMail("Starting......: " . date("H:i:s") . "  Samba, {$line}", basename(__FILE__));
            }
        }
        if (!$JOINEDRES) {
            echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname} 0]: join as netrpc.. (without IP addr)\n";
            $cmd = "{$netbin} rpc join -U {$adminname}%{$adminpassword} {$workgroup} 2>&1";
            exec($cmd, $A2);
            if ($GLOBALS["VERBOSE"]) {
                echo "Starting......: " . date("H:i:s") . "  {$function}, {$cmd}\n";
            }
            while (list($index, $line) = each($A2)) {
                if (preg_match("#Joined#", $line)) {
                    echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname} 0]: join for {$workgroup} (without IP addr) success\n";
                    $JOINEDRES = true;
                    break;
                }
                if (function_exists("WriteToSyslogMail")) {
                    WriteToSyslogMail("Starting......: " . date("H:i:s") . "  Samba, {$line}", basename(__FILE__));
                }
            }
        }
    }
    if ($ipaddr != null) {
        if (!$GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . "  {$function}, [{$adminname} 1]: ads '{$netbin} ads join -I {$ipaddr} -U {$adminname}%**** {$workgroup}'\n";
        }
        //$cmd="$netbin ads join -S $ad_server.$domain_lower -I $ipaddr -U $adminname%$adminpassword 2>&1";
        $cmd = "{$netbin} ads join -I {$ipaddr} -U {$adminname}%{$adminpassword} {$workgroup} 2>&1";
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . "  {$function},[{$adminname} 1]: {$cmd}\n";
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.samba.php

示例6: GetNetAdsInfos

function GetNetAdsInfos()
{
    $unix = new unix();
    @mkdir("/etc/squid3", 0755, true);
    if (is_file("/etc/squid3/NET_ADS_INFOS")) {
        $array = unserialize(@file_get_contents("/etc/squid3/NET_ADS_INFOS"));
        if (count($array) > 5) {
            echo "<articadatascgi>" . base64_encode(serialize($array)) . "</articadatascgi>";
            return;
        }
    }
    $net = $unix->LOCATE_NET_BIN_PATH();
    if (!is_file($net)) {
        return array();
    }
    exec("{$net} ads info 2>&1", $results);
    while (list($index, $line) = each($results)) {
        if (preg_match("#^(.+?):(.+)#", trim($line), $re)) {
            $array[trim($re[1])] = trim($re[2]);
        }
    }
    if (!isset($array["KDC server"])) {
        $array["KDC server"] = null;
    }
    @file_put_contents("/etc/squid3/NET_ADS_INFOS", serialize($array));
    echo "<articadatascgi>" . base64_encode(serialize($array)) . "</articadatascgi>";
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:27,代码来源:samba.php


注:本文中的unix::LOCATE_NET_BIN_PATH方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。