本文整理汇总了PHP中sockets::SQUID_IS_EXTERNAL_LDAP方法的典型用法代码示例。如果您正苦于以下问题:PHP sockets::SQUID_IS_EXTERNAL_LDAP方法的具体用法?PHP sockets::SQUID_IS_EXTERNAL_LDAP怎么用?PHP sockets::SQUID_IS_EXTERNAL_LDAP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sockets
的用法示例。
在下文中一共展示了sockets::SQUID_IS_EXTERNAL_LDAP方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseTemplate_unlock_checkcred
function parseTemplate_unlock_checkcred()
{
include_once dirname(__FILE__) . "/ressources/class.sockets.inc";
include_once dirname(__FILE__) . "/ressources/class.mysql.squid.builder.php";
include_once dirname(__FILE__) . "/ressources/class.tcpip.inc";
include_once dirname(__FILE__) . "/ressources/class.user.inc";
include_once dirname(__FILE__) . "/ressources/class.templates.inc";
include_once dirname(__FILE__) . "/ressources/class.users.menus.inc";
include_once dirname(__FILE__) . "/ressources/class.external.ad.inc";
include_once dirname(__FILE__) . "/ressources/class.ldap-extern.inc";
include "ressources/settings.inc";
$sock = new sockets();
$UfdbGuardHTTPAllowNoCreds = intval($sock->GET_INFO("UfdbGuardHTTPAllowNoCreds"));
if ($UfdbGuardHTTPAllowNoCreds == 1) {
return true;
}
if ($_POST["nocreds"] == 1) {
return true;
}
$username = $_POST["username"];
$password = trim($_POST["password"]);
if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
$ldap_extern = new ldap_extern();
if ($ldap_extern->checkcredentials($username, $password)) {
return true;
}
}
if (trim(strtolower($username)) == trim(strtolower($_GLOBAL["ldap_admin"]))) {
if ($password == trim($_GLOBAL["ldap_password"])) {
return true;
}
}
$ldap = new clladp();
if ($ldap->IsKerbAuth()) {
$external_ad_search = new external_ad_search();
if ($external_ad_search->CheckUserAuth($username, $password)) {
return true;
}
}
$q = new mysql();
$sql = "SELECT `username`,`value`,id FROM radcheck WHERE `username`='{$username}' AND `attribute`='Cleartext-Password' LIMIT 0,1";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!is_numeric($ligne["id"])) {
$ligne["id"] = 0;
}
if (!$q->ok) {
writelogs("{$username}:: {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
}
if ($ligne["id"] > 0) {
if ($ligne["value"] == $password) {
return true;
}
}
$u = new user($username);
if (trim($u->uidNumber) != null) {
if (trim($password) == trim($u->password)) {
return true;
}
}
return false;
}
示例2: proxy_status
//.........这里部分代码省略.........
}
}
}
}
$GoToCategoriesServiceA = "GoToCategoriesServiceA()";
$GotoAdConnection = "GotoAdConnection()";
$LoadMainDashProxy = "LoadMainDashProxy()";
$GoToServices = "GoToServices()";
$GoToUfdb = "GoToUfdb()";
$GoToCaches = "GoToCaches()";
$GoToCaches_underline = "underline";
if (!$users->AsDansGuardianAdministrator) {
$GoToCategoriesServiceA = "blur()";
$GoToUfdb = "blur()";
}
if (!$users->AsSquidAdministrator) {
$GotoAdConnection = "blur()";
$LoadMainDashProxy = "blur()";
$GoToServices = "blur()";
$GoToCaches = "blur()";
$GoToCaches_underline = "none";
}
if ($SQUIDEnable == 1) {
$catz = new mysql_catz();
if ($catz->UfdbCatEnabled == 1) {
$categories = $catz->ufdbcat("google.com");
if (!$catz->ok) {
$icon = "disks-128-warn.png";
$err[] = proxy_status_warning("{APP_UFDBCAT}: {connection_error}", $catz->mysql_error, $GoToCategoriesServiceA);
}
}
}
if ($SQUIDEnable == 1) {
if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
$tests = CHECK_SQUID_EXTERNAL_LDAP();
if ($tests != null) {
$err[] = proxy_status_warning("{$tests}", "{$tests}", "GotoOpenldap()");
}
}
}
if ($BasicAuthenticatorEmergency == 1) {
$jsOn = "Loadjs('squid.urgency.php?justbutton=yes');";
if (!$users->AsSquidAdministrator) {
$jsOn = "blur()";
}
$icon = "disks-128-warn.png";
$err[] = proxy_status_warning("{authentication_emergency_mode}", "{authentication_emergency_mode_explain}", $jsOn);
}
if ($SQUIDEnable == 1) {
if ($EnableKerbAuth == 1) {
if ($ActiveDirectoryEmergency == 1) {
$jsOn = "Loadjs('squid.urgency.php?activedirectory=yes');";
if (!$users->AsSquidAdministrator) {
$jsOn = "blur()";
}
$icon = "disks-128-warn.png";
$err[] = proxy_status_warning("{activedirectory_emergency_mode}", "{activedirectory_emergency_mode_explain}", $jsOn);
}
if (!$users->CORP_LICENSE) {
$Days = 86400 * 30;
$DayToLeft = 30;
if (is_file("/usr/share/artica-postfix/ressources/class.pinglic.inc")) {
include_once "/usr/share/artica-postfix/ressources/class.pinglic.inc";
$EndTime = $GLOBALS['ADLINK_TIME'] + $Days;
$seconds_diff = $EndTime - time();
$DayToLeft = floor($seconds_diff / 3600 / 24);
示例3: CHECK_SQUID_EXTERNAL_LDAP
function CHECK_SQUID_EXTERNAL_LDAP()
{
$sock = new sockets();
if (!$sock->SQUID_IS_EXTERNAL_LDAP()) {
return;
}
$unix = new unix();
$filetime = "/etc/artica-postfix/pids/" . md5(__FILE__ . __FUNCTION__);
$TimeExec = $unix->file_time_min($filetime);
$EXTERNAL_LDAP_AUTH_PARAMS = unserialize(base64_decode($sock->GET_INFO("SquidExternalAuth")));
$ldap_server = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_server"];
$ldap_port = intval($EXTERNAL_LDAP_AUTH_PARAMS["ldap_port"]);
if ($ldap_port == 0) {
$ldap_port = 389;
}
$ldap_suffix = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_suffix"];
$CONNECTION = @ldap_connect($ldap_server, $ldap_port);
if (!$CONNECTION) {
if ($TimeExec > 30) {
@unlink($filetime);
squid_admin_mysql(0, "Connection to LDAP server failed {$ldap_server}:{$ldap_port}", null, __FILE__, __LINE__);
@file_put_contents($filetime, time());
}
return;
}
@ldap_set_option($CONNECTION, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($CONNECTION, LDAP_OPT_REFERRALS, 0);
@ldap_set_option($CONNECTION, LDAP_OPT_PROTOCOL_VERSION, 3);
// on passe le LDAP en version 3, necessaire pour travailler avec le AD
@ldap_set_option($CONNECTION, LDAP_OPT_REFERRALS, 0);
$userdn = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_user"];
$ldap_password = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_password"];
$BIND = @ldap_bind($CONNECTION, $userdn, $ldap_password);
if (!$BIND) {
$error = @ldap_err2str(@ldap_errno($CONNECTION));
if (@ldap_get_option($CONNECTION, LDAP_OPT_DIAGNOSTIC_MESSAGE, $extended_error)) {
$error = $error . " {$extended_error}";
}
@ldap_close($CONNECTION);
if ($TimeExec > 30) {
@unlink($filetime);
squid_admin_mysql(0, "Authenticate to LDAP server {$ldap_server}:{$ldap_port} failed {$error}", $error, __FILE__, __LINE__);
@file_put_contents($filetime, time());
}
return;
}
@unlink($filetime);
@ldap_close($CONNECTION);
}
示例4: rule_popup
function rule_popup()
{
$dans = new dansguardian_rules();
$md5 = $_GET["rule-popup"];
$tpl = new templates();
$page = CurrentPageName();
$fields_size = 22;
$q = new mysql_squid_builder();
$sock = new sockets();
$t = time();
$bt = "{add}";
if ($md5 != null) {
$bt = "{apply}";
}
$Timez[0] = "{default}";
$Timez[5] = "5 {minutes}";
$Timez[10] = "10 {minutes}";
$Timez[15] = "15 {minutes}";
$Timez[30] = "30 {minutes}";
$Timez[60] = "1 {hour}";
$Timez[120] = "2 {hours}";
$Timez[240] = "4 {hours}";
$Timez[720] = "12 {hours}";
$Timez[2880] = "2 {days}";
$cats = $dans->LoadBlackListes();
while (list($num, $ligne) = each($cats)) {
$newcat[$num] = $num;
}
$newcat[null] = "{all_categories}";
$newcat["safebrowsing"] = "Google Safe Browsing";
$newcat["blacklist"] = "{blacklist}";
$newcat["generic"] = "{generic}";
if (!$q->FIELD_EXISTS("ufdb_page_rules", "ticket")) {
$q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `ticket` smallint(1) NOT NULL DEFAULT 0, ADD INDEX ( `ticket` )");
}
if (!$q->FIELD_EXISTS("ufdb_page_rules", "ticket")) {
$q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `ticket` smallint(1) NOT NULL DEFAULT 0, ADD INDEX ( `ticket` )");
}
if (!$q->FIELD_EXISTS("ufdb_page_rules", "webruleid")) {
$q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `webruleid` INT(10) NOT NULL NOT NULL DEFAULT 0, ADD INDEX ( `webruleid` )");
}
$sql = "SELECT ID,groupname FROM webfilter_rules WHERE enabled=1";
$results = $q->QUERY_SQL($sql);
$RULES["0"] = "{all_rules}";
$btname = "{add}";
$t = time();
while ($ligne = mysql_fetch_assoc($results)) {
$RULES[$ligne["ID"]] = "{$ligne["groupname"]}";
}
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM ufdb_page_rules WHERE zmd5='{$md5}'"));
$group_legend = "{active_directory_group}";
if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
$group_legend = "{ldap_group}";
}
if (!$q->ok) {
echo FATAL_ERROR_SHOW_128($q->mysql_error);
return;
}
$html[] = "<div style='width:98%' class=form>";
$html[] = "<table style='width:100%'>";
$html[] = Field_list_table("webruleid-{$t}", "{rule}", $ligne["webruleid"], $fields_size, $RULES, null, 450);
$html[] = Field_list_table("category-{$t}", "{category}", $ligne["category"], $fields_size, $newcat, null, 450);
$html[] = Field_list_table("maxtime-{$t}", "{unlock_during}", $ligne["maxtime"], $fields_size, $Timez, null, 450);
$html[] = Field_text_table("adgroup-{$t}", "{$group_legend}", $ligne["adgroup"], $fields_size, null, 450);
if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
$html[] = Field_button_table_autonome("{browse}", "Loadjs('browse-extldap-groups.php?MainFunction=FdapGroup{$t}')");
}
$html[] = Field_text_table("username-{$t}", "{username}", $ligne["username"], $fields_size, null, 450);
$html[] = Field_checkbox_table("deny-{$t}", "{deny_unlock}", $ligne["deny"], $fields_size, null, "UnCheckAllow{$t}()");
$html[] = Field_checkbox_table("allow-{$t}", "{allow_unlock}", $ligne["allow"], $fields_size, null, "UnCheckDeny{$t}()");
$html[] = Field_checkbox_table("ticket-{$t}", "{submit_ticket}", $ligne["ticket"], $fields_size, null, "UnTicket{$t}()");
$html[] = Field_checkbox_table("noauth-{$t}", "{not_authenticate}", $ligne["noauth"], $fields_size);
$html[] = Field_list_table("addTocat-{$t}", "{automatically_add_to}", $ligne["addTocat"], $fields_size, $newcat, null, 450);
$html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
$html[] = "</table>";
$html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\t\$('#UFDB_PAGE_RULE').flexReload();\n\t\n\t}\n\t\n\tfunction UnCheckAllow{$t}(){\n\t\tif(document.getElementById('deny-{$t}').checked){\n\t\t\tdocument.getElementById('allow-{$t}').checked=false;\n\t\t}else{\n\t\t\tdocument.getElementById('allow-{$t}').checked=true;\n\t\t\n\t\t}\n\t\n\t}\n\t\n\tfunction UnCheckDeny{$t}(){\n\t\tif(document.getElementById('allow-{$t}').checked){\n\t\t\tdocument.getElementById('deny-{$t}').checked=false;\n\t\t}else{\n\t\t\tdocument.getElementById('deny-{$t}').checked=true;\n\t\t}\n\t}\n\t\n\tfunction UnTicket{$t}(){\n\t\tif(document.getElementById('ticket-{$t}').checked){\n\t\t\tdocument.getElementById('deny-{$t}').checked=true;\n\t\t\tdocument.getElementById('allow-{$t}').checked=false;\n\t\t\tdocument.getElementById('noauth-{$t}').checked=true;\n\t\t\tdocument.getElementById('deny-{$t}').disabled=true;\n\t\t\tdocument.getElementById('allow-{$t}').disabled=true;\n\t\t\tdocument.getElementById('noauth-{$t}').disabled=true;\n\t\t\tdocument.getElementById('maxtime-{$t}').disabled=true;\n\t\t\tdocument.getElementById('addTocat-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('deny-{$t}').disabled=false;\n\t\t\tdocument.getElementById('allow-{$t}').disabled=false;\n\t\t\tdocument.getElementById('noauth-{$t}').disabled=false;\n\t\t\tdocument.getElementById('maxtime-{$t}').disabled=false;\n\t\t\tdocument.getElementById('addTocat-{$t}').disabled=false;\n\t\t\t}\n\t\t\n\t}\n\t\n\tfunction FdapGroup{$t}(DN){\n\t\tdocument.getElementById('adgroup-{$t}').value='EXTLDAP:'+DN;\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('rule','{$md5}');\n\t\tXHR.appendData('category',document.getElementById('category-{$t}').value);\n\t\tXHR.appendData('adgroup',document.getElementById('adgroup-{$t}').value);\n\t\tXHR.appendData('username',document.getElementById('username-{$t}').value);\n\t\tXHR.appendData('addTocat',document.getElementById('addTocat-{$t}').value);\n\t\tXHR.appendData('maxtime',document.getElementById('maxtime-{$t}').value);\n\t\tXHR.appendData('webruleid',document.getElementById('webruleid-{$t}').value);\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tif(document.getElementById('deny-{$t}').checked){\n\t\t\tXHR.appendData('deny','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('deny','0');\t\n\t\t\n\t\t}\n\t\tif(document.getElementById('allow-{$t}').checked){\n\t\t\tXHR.appendData('allow','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('allow','0');\t\n\t\t\n\t\t}\t\n\n\t\tif(document.getElementById('noauth-{$t}').checked){\n\t\t\tXHR.appendData('noauth','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('noauth','0');\t\n\t\t\n\t\t}\n\n\t\tif(document.getElementById('ticket-{$t}').checked){\n\t\t\tXHR.appendData('ticket','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('ticket','0');\t\n\t\t\n\t\t}\t\t\t\n\t\t\n\t\t\n\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t\n\tUnCheckAllow{$t}();\n\tUnTicket{$t}();\n\t</script>\n\t\t\n\t";
echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
示例5: build
function build()
{
if (!is_dir("/usr/share/phpldapadmin/config")) {
echo "slapd: [INFO] phpldapadmin not detected\n";
}
writelogs("Starting building phpldapadmin", __FUNCTION__, __FILE__, __LINE__);
$ldap = new clladp();
$sock = new sockets();
$EnableSambaActiveDirectory = $sock->GET_INFO("EnableSambaActiveDirectory");
$EnableParamsInPhpldapAdmin = $sock->GET_INFO("EnableParamsInPhpldapAdmin");
if (!is_numeric($EnableParamsInPhpldapAdmin)) {
$EnableParamsInPhpldapAdmin = 0;
}
$EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
if (!is_numeric("{$EnableKerbAuth}")) {
$EnableKerbAuth = 0;
}
$suffix = trim(@file_get_contents("/etc/artica-postfix/ldap_settings/suffix"));
$EnableOpenLdapProxy = $sock->GET_INFO("EnableOpenLdapProxy");
$OpenLdapProxySuffix = $sock->GET_INFO("OpenLdapProxySuffix");
if ($OpenLdapProxySuffix == null) {
$OpenLdapProxySuffix = "dc=meta";
}
if (!is_numeric($EnableOpenLdapProxy)) {
$EnableOpenLdapProxy = 0;
}
$f[] = "<?php";
$f[] = "\$session[\"blowfish\"]=\"5ebe2294ecd0e0f08eab7690d2a6ee69\";";
$f[] = "\$config->custom->appearance[\"tree\"] = \"AJAXTree\";";
$f[] = "\$config->custom->appearance[\"friendly_attrs\"] = array(";
$f[] = "\t\"facsimileTelephoneNumber\" => \"Fax\",";
$f[] = "\t\"gid\" => \"Group\",";
$f[] = "\t\"mail\" => \"Email\",";
$f[] = "\t\"telephoneNumber\" => \"Telephone\",";
$f[] = "\t\"uid\" => \"User Name\",";
$f[] = "\t\"userPassword\" => \"Password\"";
$f[] = ");";
$f[] = "";
$f[] = "";
$f[] = "\$servers = new Datastore();";
$f[] = "\$servers->newServer(\"ldap_pla\");";
$f[] = "\$servers->setValue(\"server\",\"name\",\"Local LDAP Server\");";
$f[] = "\$servers->setValue(\"server\",\"host\",\"{$ldap->ldap_host}\");";
$f[] = "\$servers->setValue(\"server\",\"port\",{$ldap->ldap_port});";
$f[] = "\$servers->setValue(\"server\",\"base\",array(\"{$suffix}\"));";
$f[] = "\$servers->setValue(\"login\",\"auth_type\",\"session\");";
$f[] = "\$servers->setValue(\"login\",\"bind_id\",\"cn={$ldap->ldap_admin},{$suffix}\");";
$f[] = "\$servers->setValue(\"login\",\"bind_pass\",\"\");";
$f[] = "\$servers->setValue(\"server\",\"tls\",false);";
$f[] = "";
if ($EnableOpenLdapProxy == 1) {
echo "slapd: [INFO] phpldapadmin adding LDAP-META Server settings\n";
$f[] = "\$servers->newServer(\"ldap_pla\");";
$f[] = "\$servers->setValue(\"server\",\"name\",\"Local LDAP-META Server\");";
$f[] = "\$servers->setValue(\"server\",\"host\",\"{$ldap->ldap_host}\");";
$f[] = "\$servers->setValue(\"server\",\"port\",{$ldap->ldap_port});";
$f[] = "\$servers->setValue(\"server\",\"base\",array(\"{$OpenLdapProxySuffix}\"));";
$f[] = "\$servers->setValue(\"login\",\"auth_type\",\"session\");";
$f[] = "\$servers->setValue(\"login\",\"bind_id\",\"cn={$ldap->ldap_admin},{$OpenLdapProxySuffix}\");";
$f[] = "\$servers->setValue(\"login\",\"bind_pass\",\"\");";
$f[] = "\$servers->setValue(\"server\",\"tls\",false);";
$f[] = "";
}
if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
$EXTERNAL_LDAP_AUTH_PARAMS = unserialize(base64_decode($sock->GET_INFO("SquidExternalAuth")));
$ldap_server = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_server"];
$ldap_port = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_port"];
$userdn = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_user"];
$ldap_password = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_password"];
$ldap_suffix = $EXTERNAL_LDAP_AUTH_PARAMS["ldap_suffix"];
echo "slapd: [INFO] phpldapadmin adding LDAP Server for proy settings\n";
$f[] = "\$servers->newServer(\"ldap_pla\");";
$f[] = "\$servers->setValue(\"server\",\"name\",\"Remote {$ldap_server}\");";
$f[] = "\$servers->setValue(\"server\",\"host\",\"{$ldap_server}\");";
$f[] = "\$servers->setValue(\"server\",\"port\",{$ldap_port});";
$f[] = "\$servers->setValue(\"server\",\"base\",array(\"{$ldap_suffix}\"));";
$f[] = "\$servers->setValue(\"login\",\"auth_type\",\"session\");";
$f[] = "\$servers->setValue(\"login\",\"bind_id\",\"{$userdn}\");";
$f[] = "\$servers->setValue(\"login\",\"bind_pass\",\"\");";
$f[] = "\$servers->setValue(\"server\",\"tls\",false);";
$f[] = "";
}
if ($EnableKerbAuth == 1) {
$ad = new ActiveDirectory();
$f[] = "\$servers->newServer(\"ldap_pla\");";
$f[] = "\$servers->setValue(\"server\",\"name\",\"ActiveDirectory {$ad->ldap_host}\");";
$f[] = "\$servers->setValue(\"server\",\"host\",\"{$ad->ldap_host}\");";
$f[] = "\$servers->setValue(\"server\",\"port\",{$ad->ldap_port});";
$f[] = "\$servers->setValue(\"server\",\"base\",array(\"{$ad->suffix}\"));";
$f[] = "\$servers->setValue(\"login\",\"auth_type\",\"session\");";
$f[] = "\$servers->setValue(\"login\",\"bind_id\",\"{$ad->ldap_dn_user}\");";
$f[] = "\$servers->setValue(\"login\",\"bind_pass\",\"\");";
$f[] = "\$servers->setValue(\"server\",\"tls\",false);";
$f[] = "";
}
if ($EnableSambaActiveDirectory == 1) {
$array = unserialize(base64_decode($sock->getFrameWork("cmd.php?net-ads-info=yes")));
$ActiveDirectoryCredentials["suffix"] = $array["Bind Path"];
$ActiveDirectoryCredentials["host"] = $array["LDAP server"];
if ($ActiveDirectoryCredentials["host"] != null) {
//.........这里部分代码省略.........