Decoded Output
Download<?php
include "autoload.php";
require_once "mod.mo_ldap_authentication.php";
require_once "class-mo-ldap-auth-response.php";
require_once "helpers/mo-ldap-helper.php";
class Mo_ldap_authentication_ext
{
protected $ldapconn;
public $version;
public function __construct()
{
$wK = ee("Addon")->get("mo_ldap_authentication");
$this->version = $wK->getVersion();
$this->ldapconn = $this->mo_ldap_get_connection();
}
public function moLdapInit()
{
}
public function mo_ldap_login()
{
$B2 = ee()->db->query("SELECT username FROM exp_members WHERE member_id=1 AND role_id=1");
$dy = $B2->result()[0]->username;
$w3 = (string) ee()->input->post("username", TRUE);
$qj = (string) ee()->input->post("password", TRUE);
if (!($dy == $w3)) {
goto o9;
}
return;
o9:
$DY = mo_ldap_get_db_value("mo_ldap_enable_ldap_login");
if (!($DY == 1)) {
goto Y5;
}
$this->EE = get_instance();
$Ud = $this->ldap_login($w3, $qj);
if ($Ud->statusMessage == "LDAP_USER_BIND_SUCCESS") {
goto lR;
}
if ($Ud->statusMessage == "LDAP_USER_BIND_ERROR" || $Ud->statusMessage == "LDAP_USER_NOT_EXIST") {
goto WA;
}
if ($Ud->statusMessage == "LDAP_ERROR") {
goto ZO;
}
if ($Ud->statusMessage == "OPENSSL_ERROR") {
goto BC;
}
if ($Ud->statusMessage == "LDAP_PING_ERROR") {
goto IY;
}
ee()->session->set_flashdata("message", "<strong>ERROR</strong>: Unknown error occurred during authentication. Please contact your administrator.");
ee()->functions->redirect(BASE . AMP . "C=login");
goto dD;
lR:
$Bd = $this->mo_ldap_get_role_mapping($w3);
$B2 = ee()->db->query("SELECT member_id FROM exp_members WHERE username ='" . $w3 . "' OR email = '" . $w3 . "'");
$ig = $B2->num_rows == 0 ? false : true;
if ($ig) {
goto hv;
}
$Kj = $Ud->profileAttributesList;
$rR = !empty($Kj["mail"]) ? $Kj["mail"] : '';
$Vr = $this->mo_ldap_create_user($w3, $rR, $Bd);
goto UX;
hv:
foreach ($B2->result() as $fU) {
B7:
}
sB:
$Vr = $B2->result_object[0]->member_id;
$F_ = mo_ldap_get_db_value("mo_ldap_default_role");
$Ao = mo_ldap_get_db_value("mo_ldap_override_roles");
if (!empty($Ao)) {
goto PB;
}
if (!empty($Bd)) {
goto Af;
}
$Gl = !empty($F_) ? $F_ : 1;
goto d7;
Af:
$B2 = ee()->db->query("SELECT role_id FROM exp_roles WHERE name = '{$Bd[0]}'");
$Gl = $B2->result()[0]->role_id;
d7:
$B2 = ee()->db->query("UPDATE exp_members SET role_id= " . $Gl . " WHERE member_id = " . $Vr);
PB:
$this->EE->session->create_new_session($Vr);
$this->EE->extensions->call("login_authenticate_start");
UX:
goto dD;
WA:
ee()->session->set_flashdata("message", "<strong>ERROR</strong>: Invalid username or password entered.");
ee()->functions->redirect(BASE . AMP . "C=login");
goto dD;
ZO:
ee()->session->set_flashdata("message", "<strong>ERROR</strong>: <a target='_blank' rel='noopener' href='http://php.net/manual/en/ldap.installation.php'>PHP LDAP extension</a> is not installed or disabled. Please enable it.");
ee()->functions->redirect(BASE . AMP . "C=login");
goto dD;
BC:
ee()->session->set_flashdata("message", "<strong>ERROR</strong>: <a target='_blank' rel='noopener' href='http://php.net/manual/en/openssl.installation.php'>PHP OpenSSL extension</a> is not installed or disabled.");
ee()->functions->redirect(BASE . AMP . "C=login");
goto dD;
IY:
ee()->session->set_flashdata("message", "<strong>ERROR</strong>:LDAP server is not reachable. Fallback to local ExpressionEngine authentication is not supported.");
ee()->functions->redirect(BASE . AMP . "C=login");
dD:
Y5:
}
function mo_ldap_get_role_mapping($w3)
{
$tC = 0;
$gw = 0;
$gI = mo_ldap_get_db_value("mo_ldap_group_based_role_mapping_count");
if (!is_numeric($gI)) {
goto Rk;
}
$gw = intval($gI);
Rk:
$oV = array();
$R7 = array();
$oV = unserialize(mo_ldap_get_db_value("mo_ldap_group_based_role_mapping_roles"));
$Xj = mo_ldap_get_db_value("mo_ldap_enable_role_mapping");
$R7 = unserialize(mo_ldap_get_db_value("mo_ldap_group_based_role_mapping_groups"));
$gC = 0;
if (!$Xj) {
goto Ey;
}
$wU = $this->get_member_of_attribute($w3);
$Bd = array();
$n2 = 1;
bj:
if (!($n2 <= $gw)) {
goto fr;
}
$LG = $R7[$n2 - 1];
$Nd = trim(preg_quote($LG, "/"));
$Ge = preg_grep("/^" . $Nd . ".*/", $wU);
if (!(count($Ge) > 0)) {
goto gS;
}
array_push($Bd, $oV[$n2 - 1]);
return $Bd;
gS:
TB:
$n2++;
goto bj;
fr:
Ey:
return $Bd;
}
function mo_ldap_create_user($w3, $rR, $Bd)
{
$this->EE = get_instance();
if (!empty($Bd)) {
goto S1;
}
$F_ = mo_ldap_get_db_value("mo_ldap_default_role");
$Gl = !empty($F_) ? $F_ : 1;
goto db;
S1:
$B2 = ee()->db->query("SELECT role_id FROM exp_roles WHERE name = '{$Bd[0]}'");
$Gl = $B2->result()[0]->role_id;
db:
$tb = $this->generateRandomAlphanumericValue(8);
$rR = $w3;
$jx = ee()->auth->hash_password($tb);
$YL = array();
$YL["username"] = $w3;
$YL["screen_name"] = $w3;
$YL["password"] = $jx["password"];
$YL["salt"] = $jx["salt"];
$YL["unique_id"] = ee("Encrypt")->generateKey();
$YL["email"] = $rR;
$YL["language"] = "english";
$YL[$this->memberId] = $Gl;
$YL["crypt_key"] = ee("Encrypt")->generateKey();
$YL["join_date"] = ee()->localize->now;
$Hw = FALSE;
if (!ee()->extensions->active_hook("member_create_start")) {
goto wu;
}
list($Sh, $Hw) = ee()->extensions->call("member_create_start", $YL, $Hw);
wu:
$B2 = ee()->db->query("INSERT INTO exp_members (role_id, username, screen_name, password, salt, unique_id, crypt_key, email, join_date, language ) VALUES ('" . $Gl . "', '" . $w3 . "', '" . $w3 . "', '" . $jx["password"] . "', '" . $jx["salt"] . "', '" . ee("Encrypt")->generateKey() . "', '" . ee("Encrypt")->generateKey() . "', '" . $rR . "', '" . ee()->localize->now . "', 'english')");
$B2 = ee()->db->query("SELECT member_id FROM exp_members WHERE username ='" . $w3 . "' OR email = '" . $w3 . "'");
$dN = $B2->result()[0]->member_id;
if ($Hw) {
goto j6;
}
ee()->db->replace("member_data", array("member_id" => $dN));
goto nK;
j6:
ee()->db->insert("member_data", array_merge(array("member_id" => $dN), $Hw));
nK:
if (!ee()->extensions->active_hook("member_create_end")) {
goto KI;
}
ee()->extensions->call("member_create_end", $dN, $YL, $Hw);
KI:
$Vr = $dN;
$this->EE->session->create_new_session($Vr);
$this->EE->extensions->call("login_authenticate_start");
return $Vr;
}
function ldap_login($w3, $qj)
{
$Gg = new Mo_ldap_authentication();
if ($this->is_extension_installed("ldap")) {
goto Pa;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "LDAP_ERROR";
$Ud->userDn = '';
return $Ud;
Pa:
$Xe = $this->mo_ldap_get_connection();
if (mo_ldap_verifyLicenseKey(mo_ldap_get_db_value("mo_ldap_customer_email"), mo_ldap_get_db_value("mo_ldap_customer_password"), mo_ldap_get_db_value("mo_ldap_customer_license_key"))) {
goto dg;
}
$Xe = false;
dg:
if ($Xe) {
goto Bn;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "ERROR";
$Ud->userDn = '';
return $Ud;
goto ak;
Bn:
$hA = $Gg->mo_ldap_decrypt(mo_ldap_get_db_value("mo_ldap_search_filter"));
$XV = mo_ldap_get_db_value("mo_ldap_search_base");
$Qp = explode(";", $XV);
$ih = mo_ldap_get_db_value("mo_ldap_admin_username");
$k3 = mo_ldap_get_db_value("mo_ldap_admin_password");
$Tt = $Gg->mo_ldap_decrypt($k3);
$FV = "mail";
$Zp = array();
if (!(isset($FV) && !empty($FV))) {
goto CQ;
}
array_push($Zp, $FV);
CQ:
$hA = str_replace("?", $w3, $hA);
$M7 = null;
$Ux = null;
$iZ = null;
@ldap_bind($Xe, $ih, $Tt);
$sO = ldap_errno($Xe);
$lJ = ldap_error($Xe);
if ($sO == -1) {
goto rF;
}
if (strtolower($lJ) != "success") {
goto Ow;
}
goto vK;
rF:
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "LDAP_PING_ERROR";
$Ud->userDn = '';
return $Ud;
return;
goto vK;
Ow:
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "LDAP_BIND_ERROR";
$Ud->userDn = '';
return $Ud;
vK:
$n2 = 0;
dB:
if (!($n2 < sizeof($Qp))) {
goto jU;
}
if (ldap_search($Xe, $Qp[$n2], $hA, $Zp)) {
goto uv;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "LDAP_USER_SEARCH_ERROR";
$Ud->userDn = '';
goto eV;
uv:
$M7 = ldap_search($Xe, $Qp[$n2], $hA, $Zp);
eV:
$iZ = ldap_first_entry($Xe, $M7);
$Ux = ldap_get_entries($Xe, $M7);
if ($iZ) {
goto lQ;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "LDAP_USER_NOT_EXIST";
$Ud->userDn = '';
goto Vd;
lQ:
$Y7 = ldap_get_dn($Xe, $iZ);
goto jU;
Vd:
Oz:
$n2++;
goto dB;
jU:
if (!($n2 == sizeof($Qp))) {
goto Kh;
}
return $Ud;
Kh:
$yg = $this->mo_ldap_authenticate($Y7, $qj);
if (!($yg->statusMessage == "LDAP_USER_BIND_SUCCESS")) {
goto Ds;
}
$kZ = array();
$Kj = array();
unset($Zp[0]);
$yg->attributeList = $kZ;
if (!(!empty($FV) && isset($Ux[0][$FV][0]))) {
goto ox;
}
$Kj["mail"] = $Ux[0][$FV][0];
ox:
$yg->profileAttributesList = $Kj;
Ds:
return $yg;
ak:
}
function mo_ldap_get_connection()
{
$LY = mo_ldap_get_db_value("mo_ldap_full_server_url");
$Xe = ldap_connect($LY);
ldap_set_option($Xe, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($Xe, LDAP_OPT_REFERRALS, 0);
return $Xe;
}
function mo_ldap_authenticate($Y7, $qj)
{
$Xe = $this->mo_ldap_get_connection();
@ldap_bind($Xe, $Y7, $qj);
$sO = ldap_errno($Xe);
$lJ = ldap_error($Xe);
if ($sO == -1) {
goto SN;
}
if (strtolower($lJ) != "success") {
goto EP;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = true;
$Ud->statusMessage = "LDAP_USER_BIND_SUCCESS";
$Ud->userDn = $Y7;
return $Ud;
goto NY;
SN:
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "LDAP_PING_ERROR";
$Ud->userDn = '';
return $Ud;
goto NY;
EP:
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "LDAP_USER_BIND_ERROR";
$Ud->userDn = '';
return $Ud;
NY:
}
public function generateRandomAlphanumericValue($LB)
{
$hm = "abcdef0123456789";
$jM = strlen($hm);
$AZ = '';
$n2 = 0;
g4:
if (!($n2 < $LB)) {
goto IS;
}
$AZ .= substr($hm, rand(0, 15), 1);
NL:
$n2++;
goto g4;
IS:
return "a" . $AZ;
}
public static function is_extension_installed($UI)
{
return in_array($UI, get_loaded_extensions());
}
function get_member_of_attribute($w3)
{
$lp = "memberof";
$Zp = array($lp);
$Y7 = '';
$ju = $this->check_authenticated_bind(true);
if ($ju->statusCode == "LDAP_BIND_SUCCESSFUL") {
goto yz;
}
return array("count" => 0);
goto Vr;
yz:
$vF = $this->fetch_ldap_user_dn($w3);
if (!($vF->statusCode == "FETCH_DN_SUCCESS")) {
goto ll;
}
$Y7 = $vF->userDn;
ll:
$id = $this->fetch_user_profile_attributes($w3, $Zp);
if (!($id->statusCode == "PROFILE_FETCH_SUCCESS")) {
goto Zp;
}
$Bv = $id->extraProfileAttributesList;
if (!($Bv["count"] > 0)) {
goto So;
}
if (!isset($Bv[0][$lp])) {
goto iq;
}
return $Bv[0][$lp];
iq:
So:
Zp:
return array("count" => 0);
Vr:
}
function check_authenticated_bind($bD = false, $I7 = null, $qj = null)
{
$Ii = new MoLdapAuthResponse();
$Gg = new Mo_ldap_authentication();
if (!$bD) {
goto rf;
}
$I7 = !empty(mo_ldap_get_db_value("mo_ldap_admin_username")) ? mo_ldap_get_db_value("mo_ldap_admin_username") : '';
$qj = !empty(mo_ldap_get_db_value("mo_ldap_admin_password")) ? $Gg->mo_ldap_decrypt(mo_ldap_get_db_value("mo_ldap_admin_password")) : '';
rf:
$me = $this->ldapconn;
if (!($me == null)) {
goto ww;
}
$me = $this->mo_ldap_get_connection();
ww:
if ($me) {
goto nY;
}
$Ii->statusCode = "LDAP_CONNECTION_ERROR";
$rs = add_query_arg(array("tab" => "troubleshooting"), $_SERVER["REQUEST_URI"]);
$Ii->statusMessage = "Cannot connect to LDAP Server. Make sure you have entered correct LDAP server hostname or IP address. <br>If there is a firewall, please open the firewall to allow incoming requests to your LDAP server from your WordPress site IP address and below specified port number. <br>You can also check our <a href=" . $rs . ">Troubleshooting</a> steps. If you still face the same issue then contact us using the support form.";
goto t1;
nY:
$tt = @ldap_bind($me, $I7, $qj);
$sO = ldap_errno($me);
$lJ = ldap_error($me);
if ($sO == -1) {
goto fg;
}
if (strtolower($lJ) != "success") {
goto AK;
}
$this->ldapconn = $me;
$Ii->statusCode = "LDAP_BIND_SUCCESSFUL";
goto Y7;
AK:
$Ii->statusCode = "LDAP_BIND_ERROR";
$Ii->statusMessage = "Connection to your LDAP server is successful but unable to make authenticated bind to LDAP server. Make sure you have provided correct username or password.";
Y7:
goto Xj;
fg:
$Ii->statusCode = "LDAP_CONNECTION_ERROR";
$Ii->statusMessage = "Cannot connect to LDAP Server. Make sure you have entered correct LDAP server hostname or IP address. <br>If there is a firewall, please open the firewall to allow incoming requests to your LDAP server from your WordPress site IP address and below specified port number.";
Xj:
t1:
return $Ii;
}
function fetch_ldap_user_dn($w3)
{
$ia = new MoLdapAuthResponse();
$Gg = new Mo_ldap_authentication();
$hA = !empty(mo_ldap_get_db_value("mo_ldap_search_filter")) ? $Gg->mo_ldap_decrypt(mo_ldap_get_db_value("mo_ldap_search_filter")) : '';
$XV = !empty(mo_ldap_get_db_value("mo_ldap_search_base")) ? mo_ldap_get_db_value("mo_ldap_search_base") : '';
$hA = str_replace("?", $w3, $hA);
$Qp = explode(";", $XV);
$M7 = null;
$Ux = null;
$iZ = null;
$n2 = 0;
Fy:
if (!($n2 < sizeof($Qp))) {
goto XH;
}
if (ldap_search($this->ldapconn, $Qp[$n2], $hA)) {
goto VM;
}
$ia->statusCode = "LDAP_USER_SEARCH_ERROR";
$ia->statusMessage = "Error while searching user in LDAP server.";
return $ia;
goto hM;
VM:
$M7 = ldap_search($this->ldapconn, $Qp[$n2], $hA);
hM:
$iZ = ldap_first_entry($this->ldapconn, $M7);
$Ux = ldap_get_entries($this->ldapconn, $M7);
if (!$iZ) {
goto GY;
}
goto XH;
GY:
FQ:
$n2++;
goto Fy;
XH:
if ($iZ) {
goto KP;
}
$ia->statusCode = "LDAP_USER_NOT_EXIST";
$ia->statusMessage = "User does not exist in LDAP server";
return $ia;
goto lY;
KP:
$Y7 = ldap_get_dn($this->ldapconn, $iZ);
$ia->statusCode = "FETCH_DN_SUCCESS";
$ia->userDn = $Y7;
return $ia;
lY:
}
function fetch_user_profile_attributes($w3, $Lo = null, $m2 = null, $J2 = null, $MN = false)
{
$pf = new MoLdapAuthResponse();
$Gg = new Mo_ldap_authentication();
$hA = !empty(mo_ldap_get_db_value("mo_ldap_search_filter")) ? $Gg->mo_ldap_decrypt(mo_ldap_get_db_value("mo_ldap_search_filter")) : '';
$hA = str_replace("?", $w3, $hA);
if (!isset($m2)) {
goto L1;
}
$hA = $m2;
L1:
$XV = !empty(mo_ldap_get_db_value("mo_ldap_search_base")) ? mo_ldap_get_db_value("mo_ldap_search_base") : '';
$z0 = "/member:1.2.840.113556.1.4.1941:/";
if (preg_match($z0, $hA)) {
goto eK;
}
$Qg = false;
goto Dw;
eK:
$Qg = true;
Dw:
$w5 = null;
if ($Lo == null && $MN == false) {
goto me;
}
if (is_array($Lo)) {
goto ZV;
}
if (!($MN == true)) {
goto p2;
}
$w5 = array("*");
p2:
goto N2;
ZV:
$w5 = $Lo;
N2:
goto UM;
me:
$Zp = array();
$w5 = $Zp;
UM:
if ($J2 == null) {
goto ax;
}
$Qp = explode(";", $J2);
goto sw;
ax:
$Qp = explode(";", $XV);
sw:
$M7 = null;
$Ux = null;
$iZ = null;
$b8 = null;
$n2 = 0;
Sf:
if (!($n2 < sizeof($Qp))) {
goto Au;
}
if (ldap_search($this->ldapconn, $Qp[$n2], $hA, $w5)) {
goto os;
}
$pf->statusCode = "LDAP_USER_SEARCH_ERROR";
$pf->statusMessage = "Error while searching user in LDAP server.";
return $pf;
goto AN;
os:
$M7 = ldap_search($this->ldapconn, $Qp[$n2], $hA, $w5);
AN:
$iZ = ldap_first_entry($this->ldapconn, $M7);
if ($Qg) {
goto TY;
}
$Ux = ldap_get_entries($this->ldapconn, $M7);
if (!$iZ) {
goto qm;
}
goto Au;
qm:
goto A_;
TY:
$Rk = ldap_get_entries($this->ldapconn, $M7);
$Ux = $this->mo_ldap_merge_entries($Ux, $Rk);
A_:
if (!($Qg == true && $iZ == true)) {
goto Xa;
}
$b8 = $iZ;
Xa:
HO:
$n2++;
goto Sf;
Au:
if ($iZ == true && $Qg == false) {
goto Qd;
}
if ($b8) {
goto Yg;
}
$pf->statusCode = "LDAP_USER_NOT_EXIST";
$pf->statusMessage = "User does not exist in LDAP server";
return $pf;
goto Ut;
Yg:
$Y7 = ldap_get_dn($this->ldapconn, $b8);
$pf->userDn = $Y7;
Ut:
goto s3;
Qd:
$Y7 = ldap_get_dn($this->ldapconn, $iZ);
$pf->userDn = $Y7;
s3:
$pf->statusCode = "PROFILE_FETCH_SUCCESS";
if ($Lo == null && $MN == false) {
goto lJ;
}
$pf->extraProfileAttributesList = $Ux;
return $pf;
goto N_;
lJ:
foreach ($w5 as $LU) {
if (isset($Ux[0][strtolower($LU)]["count"]) && $Ux[0][strtolower($LU)]["count"] > 1) {
goto um;
}
$kZ["mo_ldap_local_custom_attribute_" . $LU] = $Ux[0][strtolower($LU)][0];
goto TH;
um:
$D_ = array();
$n2 = 0;
bP:
if (!($n2 < $Ux[0][strtolower($LU)]["count"])) {
goto Sj;
}
array_push($D_, $Ux[0][strtolower($LU)][$n2]);
p9:
$n2++;
goto bP;
Sj:
$kZ["mo_ldap_local_custom_attribute_" . $LU] = $D_;
TH:
mA:
}
vm:
$pf->extraProfileAttributesList = $kZ;
N_:
return $pf;
}
}
?>
Did this file decode correctly?
How would you describe this file?
Thank you for your feedback! This will help us detect malicious PHP files more accurately in the future.
Function Calls
None
Variables
None
Stats
| MD5 | f5dd6daf81bb2d71 |
|---|---|
| Eval Count | 0 |
| Decode Time | 70 ms |
Original Code
<?php
include "\x61\165\x74\157\154\157\x61\x64\56\160\150\x70";
require_once "\x6d\x6f\x64\56\155\x6f\137\154\144\x61\x70\x5f\141\165\164\x68\145\x6e\164\x69\143\141\164\x69\x6f\156\x2e\x70\150\160";
require_once "\143\x6c\141\x73\163\55\x6d\157\x2d\x6c\144\x61\x70\55\141\165\164\150\55\162\x65\x73\x70\157\156\x73\x65\56\x70\x68\x70";
require_once "\x68\145\x6c\x70\x65\162\163\57\x6d\157\55\154\x64\x61\x70\55\x68\x65\x6c\160\x65\x72\x2e\160\x68\160";
class Mo_ldap_authentication_ext
{
protected $ldapconn;
public $version;
public function __construct()
{
$wK = ee("\101\144\144\x6f\x6e")->get("\155\x6f\x5f\154\x64\141\160\x5f\141\x75\x74\x68\x65\156\x74\x69\143\x61\164\151\157\x6e");
$this->version = $wK->getVersion();
$this->ldapconn = $this->mo_ldap_get_connection();
}
public function moLdapInit()
{
}
public function mo_ldap_login()
{
$B2 = ee()->db->query("\x53\x45\114\x45\x43\x54\x20\x75\x73\x65\162\156\x61\x6d\x65\40\x46\x52\117\115\x20\x65\x78\160\x5f\x6d\145\155\142\x65\x72\x73\x20\x57\110\x45\122\105\x20\155\145\x6d\142\x65\162\x5f\x69\144\75\61\x20\101\x4e\104\40\x72\157\x6c\x65\x5f\151\x64\75\61");
$dy = $B2->result()[0]->username;
$w3 = (string) ee()->input->post("\x75\163\x65\162\x6e\x61\155\x65", TRUE);
$qj = (string) ee()->input->post("\160\x61\x73\163\167\157\162\x64", TRUE);
if (!($dy == $w3)) {
goto o9;
}
return;
o9:
$DY = mo_ldap_get_db_value("\x6d\x6f\x5f\x6c\x64\141\160\x5f\145\156\141\x62\154\x65\x5f\154\144\141\x70\137\x6c\157\147\151\156");
if (!($DY == 1)) {
goto Y5;
}
$this->EE = get_instance();
$Ud = $this->ldap_login($w3, $qj);
if ($Ud->statusMessage == "\x4c\104\101\120\x5f\x55\123\105\122\x5f\x42\x49\x4e\104\137\x53\x55\x43\x43\x45\123\x53") {
goto lR;
}
if ($Ud->statusMessage == "\x4c\104\101\x50\x5f\125\123\x45\x52\137\102\x49\x4e\x44\137\x45\x52\x52\117\122" || $Ud->statusMessage == "\x4c\104\101\x50\137\125\x53\105\x52\x5f\x4e\117\124\137\105\130\111\x53\x54") {
goto WA;
}
if ($Ud->statusMessage == "\x4c\104\x41\x50\x5f\105\122\122\117\x52") {
goto ZO;
}
if ($Ud->statusMessage == "\x4f\120\x45\x4e\x53\x53\x4c\x5f\105\122\122\x4f\122") {
goto BC;
}
if ($Ud->statusMessage == "\x4c\104\x41\120\137\120\111\116\107\137\x45\x52\122\x4f\122") {
goto IY;
}
ee()->session->set_flashdata("\x6d\x65\163\163\141\x67\145", "\74\163\x74\x72\157\156\147\x3e\x45\122\x52\x4f\x52\x3c\57\163\x74\x72\157\x6e\x67\x3e\72\40\125\x6e\x6b\156\x6f\x77\x6e\x20\x65\x72\x72\x6f\x72\x20\x6f\x63\x63\x75\x72\x72\x65\144\x20\144\x75\x72\151\x6e\x67\x20\141\x75\164\150\145\156\x74\x69\143\141\x74\151\157\156\56\40\120\154\145\x61\163\x65\40\143\157\156\x74\141\143\x74\x20\x79\157\x75\x72\x20\141\x64\x6d\151\x6e\x69\x73\x74\x72\141\x74\x6f\162\x2e");
ee()->functions->redirect(BASE . AMP . "\103\x3d\x6c\x6f\147\x69\x6e");
goto dD;
lR:
$Bd = $this->mo_ldap_get_role_mapping($w3);
$B2 = ee()->db->query("\x53\x45\x4c\x45\103\x54\40\x6d\x65\x6d\x62\145\x72\137\x69\144\x20\106\122\117\115\40\x65\x78\160\137\x6d\145\155\142\x65\162\x73\x20\x57\x48\105\122\105\x20\x75\163\145\x72\156\x61\155\x65\x20\x3d\x27" . $w3 . "\x27\x20\117\x52\40\x65\155\141\x69\x6c\40\x3d\x20\47" . $w3 . "\47");
$ig = $B2->num_rows == 0 ? false : true;
if ($ig) {
goto hv;
}
$Kj = $Ud->profileAttributesList;
$rR = !empty($Kj["\x6d\141\x69\154"]) ? $Kj["\x6d\141\x69\x6c"] : '';
$Vr = $this->mo_ldap_create_user($w3, $rR, $Bd);
goto UX;
hv:
foreach ($B2->result() as $fU) {
B7:
}
sB:
$Vr = $B2->result_object[0]->member_id;
$F_ = mo_ldap_get_db_value("\x6d\x6f\137\154\x64\x61\x70\x5f\x64\x65\146\x61\165\x6c\x74\137\162\157\154\145");
$Ao = mo_ldap_get_db_value("\x6d\157\137\x6c\x64\141\160\x5f\157\166\145\x72\x72\x69\144\145\137\162\157\x6c\145\x73");
if (!empty($Ao)) {
goto PB;
}
if (!empty($Bd)) {
goto Af;
}
$Gl = !empty($F_) ? $F_ : 1;
goto d7;
Af:
$B2 = ee()->db->query("\123\105\x4c\105\103\124\x20\162\157\154\145\137\151\144\40\106\x52\x4f\x4d\40\145\170\x70\137\162\x6f\x6c\x65\163\x20\x57\110\105\x52\105\40\156\x61\155\x65\x20\75\x20\x27{$Bd[0]}\47");
$Gl = $B2->result()[0]->role_id;
d7:
$B2 = ee()->db->query("\125\x50\x44\101\x54\x45\x20\145\x78\x70\x5f\x6d\x65\155\142\145\x72\163\40\123\x45\124\x20\162\157\154\x65\137\x69\x64\x3d\40" . $Gl . "\x20\x57\x48\105\x52\x45\x20\x6d\145\x6d\x62\x65\162\137\x69\144\x20\75\x20" . $Vr);
PB:
$this->EE->session->create_new_session($Vr);
$this->EE->extensions->call("\154\x6f\x67\151\x6e\137\141\x75\x74\x68\145\x6e\x74\151\x63\x61\x74\x65\x5f\163\164\x61\162\164");
UX:
goto dD;
WA:
ee()->session->set_flashdata("\155\145\163\163\141\147\x65", "\x3c\x73\x74\x72\x6f\x6e\147\76\x45\x52\x52\x4f\122\x3c\x2f\163\x74\x72\x6f\156\x67\x3e\72\40\111\x6e\166\141\x6c\151\144\40\x75\x73\145\x72\156\x61\155\x65\40\157\162\40\x70\141\163\163\167\157\162\x64\40\x65\156\164\x65\162\x65\144\56");
ee()->functions->redirect(BASE . AMP . "\103\75\x6c\157\x67\x69\x6e");
goto dD;
ZO:
ee()->session->set_flashdata("\x6d\x65\163\x73\x61\147\x65", "\74\x73\x74\x72\157\x6e\147\76\x45\122\122\117\x52\74\57\x73\164\162\157\x6e\147\76\72\40\74\x61\40\x74\141\x72\x67\145\164\x3d\x27\x5f\x62\x6c\141\x6e\x6b\x27\40\x72\x65\154\x3d\47\x6e\x6f\x6f\160\x65\156\145\162\47\x20\x68\x72\145\146\x3d\47\x68\164\x74\x70\72\57\57\x70\x68\x70\x2e\156\x65\164\57\x6d\x61\156\x75\x61\154\x2f\x65\x6e\57\x6c\x64\141\160\x2e\x69\156\x73\x74\x61\154\154\x61\x74\x69\x6f\156\56\x70\x68\160\x27\76\x50\110\x50\40\114\x44\x41\120\x20\145\170\x74\x65\156\163\151\157\156\x3c\57\x61\x3e\40\x69\x73\40\156\x6f\x74\x20\x69\156\163\x74\141\154\154\x65\144\40\157\x72\40\144\151\x73\141\x62\x6c\145\x64\56\x20\120\154\145\141\163\145\x20\145\x6e\141\142\154\145\40\151\164\56");
ee()->functions->redirect(BASE . AMP . "\103\75\x6c\x6f\147\x69\x6e");
goto dD;
BC:
ee()->session->set_flashdata("\155\145\x73\163\141\x67\145", "\x3c\163\164\162\x6f\x6e\147\76\105\x52\122\117\122\74\x2f\163\x74\x72\x6f\156\147\76\x3a\x20\74\x61\x20\164\x61\x72\147\x65\x74\75\47\x5f\x62\154\141\156\x6b\x27\x20\x72\x65\154\75\47\156\x6f\x6f\x70\145\156\145\162\47\40\150\162\145\x66\75\x27\150\164\x74\160\72\57\x2f\160\x68\x70\56\156\x65\164\x2f\x6d\141\156\x75\x61\154\57\x65\x6e\x2f\x6f\x70\x65\x6e\x73\x73\154\56\151\x6e\x73\164\x61\154\154\x61\x74\151\x6f\156\x2e\x70\150\160\47\76\x50\x48\x50\x20\x4f\x70\145\156\123\123\114\x20\x65\170\164\145\156\163\151\x6f\156\x3c\57\x61\x3e\x20\151\x73\x20\x6e\x6f\164\40\x69\x6e\163\x74\x61\x6c\154\x65\144\x20\x6f\x72\x20\144\151\x73\141\142\x6c\145\144\56");
ee()->functions->redirect(BASE . AMP . "\x43\75\154\157\147\x69\x6e");
goto dD;
IY:
ee()->session->set_flashdata("\155\x65\x73\163\x61\x67\x65", "\74\163\x74\x72\157\x6e\x67\76\x45\x52\122\117\x52\74\x2f\x73\x74\162\157\x6e\147\76\72\x4c\104\x41\x50\x20\x73\145\x72\166\145\162\40\151\x73\40\156\x6f\x74\x20\x72\145\141\x63\x68\x61\x62\154\145\56\40\106\x61\x6c\154\142\141\x63\x6b\40\x74\x6f\40\154\157\143\141\x6c\40\x45\170\160\162\x65\163\x73\151\157\x6e\x45\x6e\147\x69\156\x65\40\141\x75\164\x68\x65\x6e\x74\x69\143\x61\164\x69\x6f\x6e\x20\151\163\40\x6e\x6f\x74\x20\x73\x75\x70\160\x6f\162\x74\145\x64\56");
ee()->functions->redirect(BASE . AMP . "\103\x3d\x6c\157\147\151\156");
dD:
Y5:
}
function mo_ldap_get_role_mapping($w3)
{
$tC = 0;
$gw = 0;
$gI = mo_ldap_get_db_value("\155\x6f\137\x6c\x64\x61\x70\x5f\147\162\x6f\x75\160\x5f\x62\x61\163\145\144\137\162\157\154\x65\x5f\155\x61\160\160\151\x6e\147\x5f\x63\x6f\x75\156\164");
if (!is_numeric($gI)) {
goto Rk;
}
$gw = intval($gI);
Rk:
$oV = array();
$R7 = array();
$oV = unserialize(mo_ldap_get_db_value("\155\x6f\x5f\x6c\x64\x61\x70\x5f\x67\162\157\x75\x70\x5f\x62\141\x73\145\144\137\162\157\154\x65\137\x6d\x61\x70\160\x69\156\x67\137\162\x6f\154\145\163"));
$Xj = mo_ldap_get_db_value("\x6d\157\137\154\x64\x61\x70\x5f\x65\156\141\x62\x6c\x65\x5f\x72\x6f\x6c\145\x5f\155\141\160\160\x69\x6e\x67");
$R7 = unserialize(mo_ldap_get_db_value("\155\157\137\154\x64\x61\x70\137\x67\x72\157\165\x70\137\x62\x61\163\145\144\x5f\x72\x6f\154\145\x5f\155\141\160\160\x69\x6e\147\137\147\x72\x6f\165\160\x73"));
$gC = 0;
if (!$Xj) {
goto Ey;
}
$wU = $this->get_member_of_attribute($w3);
$Bd = array();
$n2 = 1;
bj:
if (!($n2 <= $gw)) {
goto fr;
}
$LG = $R7[$n2 - 1];
$Nd = trim(preg_quote($LG, "\57"));
$Ge = preg_grep("\57\136" . $Nd . "\56\52\57", $wU);
if (!(count($Ge) > 0)) {
goto gS;
}
array_push($Bd, $oV[$n2 - 1]);
return $Bd;
gS:
TB:
$n2++;
goto bj;
fr:
Ey:
return $Bd;
}
function mo_ldap_create_user($w3, $rR, $Bd)
{
$this->EE = get_instance();
if (!empty($Bd)) {
goto S1;
}
$F_ = mo_ldap_get_db_value("\x6d\x6f\137\154\x64\141\160\x5f\144\145\x66\x61\165\x6c\x74\x5f\x72\157\x6c\x65");
$Gl = !empty($F_) ? $F_ : 1;
goto db;
S1:
$B2 = ee()->db->query("\x53\x45\114\105\x43\124\x20\x72\157\154\x65\137\151\144\40\x46\x52\117\115\x20\x65\170\160\x5f\x72\x6f\x6c\145\x73\40\x57\x48\105\122\x45\40\x6e\x61\155\x65\40\x3d\40\x27{$Bd[0]}\x27");
$Gl = $B2->result()[0]->role_id;
db:
$tb = $this->generateRandomAlphanumericValue(8);
$rR = $w3;
$jx = ee()->auth->hash_password($tb);
$YL = array();
$YL["\x75\x73\145\162\x6e\x61\155\145"] = $w3;
$YL["\x73\x63\x72\145\145\x6e\137\x6e\x61\x6d\145"] = $w3;
$YL["\160\x61\x73\x73\x77\x6f\162\x64"] = $jx["\160\141\163\163\167\x6f\x72\x64"];
$YL["\x73\x61\154\x74"] = $jx["\163\x61\x6c\x74"];
$YL["\x75\156\151\161\x75\x65\x5f\151\144"] = ee("\105\156\143\162\171\160\x74")->generateKey();
$YL["\x65\x6d\141\x69\154"] = $rR;
$YL["\x6c\141\x6e\x67\x75\141\x67\145"] = "\145\156\147\154\151\x73\150";
$YL[$this->memberId] = $Gl;
$YL["\x63\x72\x79\160\164\137\153\145\x79"] = ee("\x45\156\x63\162\171\160\164")->generateKey();
$YL["\x6a\157\x69\156\137\x64\141\x74\x65"] = ee()->localize->now;
$Hw = FALSE;
if (!ee()->extensions->active_hook("\x6d\x65\155\142\x65\x72\x5f\x63\162\145\141\164\x65\x5f\163\164\x61\162\x74")) {
goto wu;
}
list($Sh, $Hw) = ee()->extensions->call("\x6d\x65\155\x62\145\x72\137\143\162\x65\x61\164\x65\x5f\163\164\141\x72\164", $YL, $Hw);
wu:
$B2 = ee()->db->query("\111\x4e\x53\x45\122\x54\x20\111\116\x54\x4f\x20\x65\x78\160\x5f\155\x65\155\142\145\162\x73\x20\50\162\x6f\x6c\x65\x5f\x69\x64\x2c\40\x75\x73\145\x72\156\x61\155\x65\54\40\163\143\x72\145\145\x6e\x5f\156\141\155\x65\x2c\40\x70\141\x73\163\x77\x6f\x72\144\x2c\40\163\x61\154\x74\54\40\165\x6e\x69\x71\165\x65\137\151\x64\54\x20\143\x72\x79\160\164\137\153\x65\x79\54\40\x65\x6d\141\151\154\54\x20\152\x6f\151\156\137\144\141\164\145\54\x20\154\x61\156\147\x75\x61\x67\x65\40\x29\x20\126\101\x4c\125\105\123\x20\x28\x27" . $Gl . "\47\x2c\40\x27" . $w3 . "\x27\54\40\x27" . $w3 . "\x27\x2c\x20\x27" . $jx["\x70\x61\163\163\x77\x6f\x72\x64"] . "\x27\x2c\40\47" . $jx["\163\141\x6c\164"] . "\47\x2c\x20\x27" . ee("\x45\156\x63\x72\171\x70\164")->generateKey() . "\x27\54\x20\47" . ee("\x45\x6e\143\162\171\x70\x74")->generateKey() . "\47\54\40\x27" . $rR . "\x27\54\40\x27" . ee()->localize->now . "\47\54\x20\x27\145\156\x67\x6c\x69\x73\x68\47\x29");
$B2 = ee()->db->query("\123\105\x4c\105\103\x54\x20\155\x65\155\142\145\x72\x5f\x69\x64\40\106\x52\117\x4d\40\x65\x78\160\137\155\x65\x6d\x62\145\x72\163\40\x57\110\105\122\105\x20\165\x73\145\x72\x6e\141\155\145\x20\x3d\47" . $w3 . "\x27\40\x4f\x52\40\145\x6d\x61\151\154\40\75\40\x27" . $w3 . "\47");
$dN = $B2->result()[0]->member_id;
if ($Hw) {
goto j6;
}
ee()->db->replace("\155\x65\x6d\142\x65\x72\137\144\x61\x74\141", array("\155\145\155\142\145\162\x5f\151\144" => $dN));
goto nK;
j6:
ee()->db->insert("\x6d\x65\155\142\x65\162\137\144\x61\164\x61", array_merge(array("\x6d\x65\x6d\142\x65\162\137\151\144" => $dN), $Hw));
nK:
if (!ee()->extensions->active_hook("\x6d\x65\155\x62\145\162\137\143\x72\x65\x61\164\145\137\x65\x6e\144")) {
goto KI;
}
ee()->extensions->call("\x6d\x65\x6d\142\x65\162\x5f\143\162\x65\x61\x74\145\x5f\145\x6e\144", $dN, $YL, $Hw);
KI:
$Vr = $dN;
$this->EE->session->create_new_session($Vr);
$this->EE->extensions->call("\x6c\x6f\x67\151\x6e\137\141\x75\164\150\x65\156\164\151\x63\x61\164\145\x5f\163\164\141\162\164");
return $Vr;
}
function ldap_login($w3, $qj)
{
$Gg = new Mo_ldap_authentication();
if ($this->is_extension_installed("\x6c\x64\x61\x70")) {
goto Pa;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "\114\104\x41\x50\x5f\105\122\x52\x4f\122";
$Ud->userDn = '';
return $Ud;
Pa:
$Xe = $this->mo_ldap_get_connection();
if (mo_ldap_verifyLicenseKey(mo_ldap_get_db_value("\155\x6f\137\x6c\x64\141\160\x5f\x63\165\x73\164\157\155\145\162\137\x65\x6d\141\x69\154"), mo_ldap_get_db_value("\155\157\137\154\144\141\x70\x5f\x63\165\163\x74\x6f\x6d\x65\162\137\160\x61\163\163\167\x6f\x72\144"), mo_ldap_get_db_value("\x6d\157\x5f\154\144\x61\x70\x5f\x63\165\163\164\157\x6d\145\x72\x5f\154\151\143\x65\x6e\163\x65\x5f\x6b\x65\171"))) {
goto dg;
}
$Xe = false;
dg:
if ($Xe) {
goto Bn;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "\x45\x52\x52\117\x52";
$Ud->userDn = '';
return $Ud;
goto ak;
Bn:
$hA = $Gg->mo_ldap_decrypt(mo_ldap_get_db_value("\x6d\157\137\x6c\144\x61\160\137\163\145\141\162\143\150\137\x66\x69\154\x74\145\x72"));
$XV = mo_ldap_get_db_value("\155\157\x5f\154\x64\141\160\x5f\x73\145\x61\162\x63\150\137\142\141\x73\145");
$Qp = explode("\x3b", $XV);
$ih = mo_ldap_get_db_value("\155\x6f\137\154\x64\141\160\x5f\141\x64\x6d\151\x6e\x5f\165\x73\145\162\156\x61\x6d\x65");
$k3 = mo_ldap_get_db_value("\155\157\137\x6c\x64\141\x70\137\x61\144\x6d\151\x6e\137\x70\x61\x73\163\167\157\x72\144");
$Tt = $Gg->mo_ldap_decrypt($k3);
$FV = "\x6d\141\x69\154";
$Zp = array();
if (!(isset($FV) && !empty($FV))) {
goto CQ;
}
array_push($Zp, $FV);
CQ:
$hA = str_replace("\77", $w3, $hA);
$M7 = null;
$Ux = null;
$iZ = null;
@ldap_bind($Xe, $ih, $Tt);
$sO = ldap_errno($Xe);
$lJ = ldap_error($Xe);
if ($sO == -1) {
goto rF;
}
if (strtolower($lJ) != "\x73\165\143\143\x65\163\x73") {
goto Ow;
}
goto vK;
rF:
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "\x4c\x44\101\120\137\120\111\116\107\137\105\x52\122\x4f\x52";
$Ud->userDn = '';
return $Ud;
return;
goto vK;
Ow:
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "\x4c\x44\x41\120\137\102\111\116\104\x5f\105\x52\122\117\x52";
$Ud->userDn = '';
return $Ud;
vK:
$n2 = 0;
dB:
if (!($n2 < sizeof($Qp))) {
goto jU;
}
if (ldap_search($Xe, $Qp[$n2], $hA, $Zp)) {
goto uv;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "\x4c\x44\x41\x50\137\x55\123\105\x52\x5f\x53\105\101\122\103\110\137\105\x52\122\x4f\122";
$Ud->userDn = '';
goto eV;
uv:
$M7 = ldap_search($Xe, $Qp[$n2], $hA, $Zp);
eV:
$iZ = ldap_first_entry($Xe, $M7);
$Ux = ldap_get_entries($Xe, $M7);
if ($iZ) {
goto lQ;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "\x4c\x44\x41\x50\137\x55\123\105\122\137\116\117\124\x5f\105\130\x49\123\x54";
$Ud->userDn = '';
goto Vd;
lQ:
$Y7 = ldap_get_dn($Xe, $iZ);
goto jU;
Vd:
Oz:
$n2++;
goto dB;
jU:
if (!($n2 == sizeof($Qp))) {
goto Kh;
}
return $Ud;
Kh:
$yg = $this->mo_ldap_authenticate($Y7, $qj);
if (!($yg->statusMessage == "\x4c\x44\101\x50\137\125\x53\105\122\x5f\x42\x49\116\104\137\123\125\103\103\x45\x53\123")) {
goto Ds;
}
$kZ = array();
$Kj = array();
unset($Zp[0]);
$yg->attributeList = $kZ;
if (!(!empty($FV) && isset($Ux[0][$FV][0]))) {
goto ox;
}
$Kj["\x6d\x61\x69\154"] = $Ux[0][$FV][0];
ox:
$yg->profileAttributesList = $Kj;
Ds:
return $yg;
ak:
}
function mo_ldap_get_connection()
{
$LY = mo_ldap_get_db_value("\155\157\137\x6c\144\x61\x70\x5f\x66\165\154\154\x5f\163\x65\x72\x76\x65\x72\137\165\x72\x6c");
$Xe = ldap_connect($LY);
ldap_set_option($Xe, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($Xe, LDAP_OPT_REFERRALS, 0);
return $Xe;
}
function mo_ldap_authenticate($Y7, $qj)
{
$Xe = $this->mo_ldap_get_connection();
@ldap_bind($Xe, $Y7, $qj);
$sO = ldap_errno($Xe);
$lJ = ldap_error($Xe);
if ($sO == -1) {
goto SN;
}
if (strtolower($lJ) != "\163\x75\143\143\x65\163\x73") {
goto EP;
}
$Ud = new MoLdapAuthResponse();
$Ud->status = true;
$Ud->statusMessage = "\114\x44\x41\120\x5f\125\123\105\122\x5f\x42\111\x4e\x44\x5f\x53\125\103\x43\x45\x53\123";
$Ud->userDn = $Y7;
return $Ud;
goto NY;
SN:
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "\x4c\104\x41\x50\137\x50\111\116\107\137\105\122\122\x4f\x52";
$Ud->userDn = '';
return $Ud;
goto NY;
EP:
$Ud = new MoLdapAuthResponse();
$Ud->status = false;
$Ud->statusMessage = "\114\x44\101\x50\x5f\125\x53\x45\x52\137\x42\x49\x4e\x44\x5f\105\x52\x52\x4f\122";
$Ud->userDn = '';
return $Ud;
NY:
}
public function generateRandomAlphanumericValue($LB)
{
$hm = "\x61\x62\x63\144\x65\x66\60\61\62\63\64\65\x36\67\x38\x39";
$jM = strlen($hm);
$AZ = '';
$n2 = 0;
g4:
if (!($n2 < $LB)) {
goto IS;
}
$AZ .= substr($hm, rand(0, 15), 1);
NL:
$n2++;
goto g4;
IS:
return "\141" . $AZ;
}
public static function is_extension_installed($UI)
{
return in_array($UI, get_loaded_extensions());
}
function get_member_of_attribute($w3)
{
$lp = "\x6d\145\155\142\x65\162\157\146";
$Zp = array($lp);
$Y7 = '';
$ju = $this->check_authenticated_bind(true);
if ($ju->statusCode == "\114\x44\x41\120\x5f\x42\x49\x4e\x44\x5f\x53\x55\103\103\105\x53\x53\x46\125\x4c") {
goto yz;
}
return array("\143\157\165\x6e\x74" => 0);
goto Vr;
yz:
$vF = $this->fetch_ldap_user_dn($w3);
if (!($vF->statusCode == "\x46\x45\124\103\x48\x5f\x44\116\x5f\x53\x55\103\103\105\x53\123")) {
goto ll;
}
$Y7 = $vF->userDn;
ll:
$id = $this->fetch_user_profile_attributes($w3, $Zp);
if (!($id->statusCode == "\x50\x52\117\106\111\114\x45\x5f\x46\105\124\x43\x48\137\x53\125\x43\x43\x45\123\x53")) {
goto Zp;
}
$Bv = $id->extraProfileAttributesList;
if (!($Bv["\143\157\x75\x6e\x74"] > 0)) {
goto So;
}
if (!isset($Bv[0][$lp])) {
goto iq;
}
return $Bv[0][$lp];
iq:
So:
Zp:
return array("\x63\x6f\165\x6e\x74" => 0);
Vr:
}
function check_authenticated_bind($bD = false, $I7 = null, $qj = null)
{
$Ii = new MoLdapAuthResponse();
$Gg = new Mo_ldap_authentication();
if (!$bD) {
goto rf;
}
$I7 = !empty(mo_ldap_get_db_value("\155\157\x5f\x6c\x64\x61\x70\137\141\144\155\151\156\137\165\x73\145\162\x6e\141\155\x65")) ? mo_ldap_get_db_value("\x6d\x6f\137\154\144\141\160\137\141\144\155\151\156\x5f\x75\x73\x65\x72\x6e\x61\155\145") : '';
$qj = !empty(mo_ldap_get_db_value("\x6d\x6f\137\154\144\141\x70\x5f\141\144\155\151\x6e\x5f\160\x61\163\x73\x77\x6f\162\144")) ? $Gg->mo_ldap_decrypt(mo_ldap_get_db_value("\x6d\157\137\x6c\x64\141\x70\137\x61\x64\x6d\151\156\137\160\141\163\163\x77\157\162\144")) : '';
rf:
$me = $this->ldapconn;
if (!($me == null)) {
goto ww;
}
$me = $this->mo_ldap_get_connection();
ww:
if ($me) {
goto nY;
}
$Ii->statusCode = "\114\x44\x41\x50\x5f\x43\117\x4e\116\x45\x43\124\111\x4f\116\137\105\122\x52\117\122";
$rs = add_query_arg(array("\164\x61\x62" => "\164\162\157\165\x62\x6c\145\x73\150\157\157\164\x69\156\x67"), $_SERVER["\122\x45\x51\x55\105\123\x54\x5f\x55\x52\111"]);
$Ii->statusMessage = "\103\x61\x6e\156\157\x74\40\x63\x6f\x6e\156\x65\x63\164\40\x74\157\40\x4c\104\101\120\x20\123\x65\162\166\x65\x72\56\40\115\x61\x6b\145\40\x73\165\x72\145\40\x79\x6f\x75\40\x68\x61\x76\145\40\x65\156\x74\x65\162\x65\144\x20\143\157\162\162\145\x63\x74\40\x4c\104\101\120\x20\163\x65\x72\x76\145\162\40\x68\157\x73\164\x6e\x61\x6d\145\40\x6f\162\x20\111\x50\x20\x61\x64\144\x72\x65\163\x73\x2e\40\74\x62\x72\76\111\146\40\x74\x68\x65\x72\145\x20\151\x73\x20\x61\40\146\151\x72\x65\167\x61\x6c\x6c\54\x20\x70\154\x65\x61\x73\x65\40\x6f\160\145\156\40\164\x68\145\x20\x66\x69\162\x65\167\141\x6c\x6c\40\164\157\x20\x61\154\x6c\x6f\167\40\x69\x6e\143\x6f\155\151\156\147\40\162\x65\x71\x75\x65\x73\164\x73\x20\164\157\x20\x79\157\165\x72\40\x4c\x44\x41\120\x20\x73\x65\162\166\x65\x72\40\x66\x72\x6f\155\40\171\157\165\x72\40\x57\157\162\x64\x50\x72\145\163\x73\x20\163\151\164\x65\40\x49\120\40\x61\144\144\162\x65\163\x73\x20\x61\156\144\x20\142\145\154\x6f\167\40\x73\x70\x65\143\151\x66\x69\x65\144\40\x70\157\162\164\x20\x6e\x75\x6d\142\145\162\x2e\40\x3c\142\162\x3e\x59\157\165\40\x63\x61\x6e\40\141\154\x73\x6f\40\143\150\145\x63\153\40\x6f\165\x72\x20\74\x61\40\x68\162\x65\146\x3d" . $rs . "\x3e\124\x72\x6f\x75\x62\x6c\x65\163\150\157\x6f\x74\x69\x6e\x67\x3c\x2f\x61\76\40\163\164\145\x70\163\56\x20\111\146\40\x79\157\165\40\x73\164\x69\x6c\x6c\x20\x66\141\143\x65\40\164\150\x65\40\x73\141\x6d\145\40\151\163\163\x75\x65\x20\x74\150\145\x6e\x20\x63\x6f\156\x74\x61\x63\x74\x20\x75\163\x20\x75\163\151\156\147\40\x74\x68\145\x20\x73\165\x70\x70\x6f\x72\x74\40\146\157\x72\155\x2e";
goto t1;
nY:
$tt = @ldap_bind($me, $I7, $qj);
$sO = ldap_errno($me);
$lJ = ldap_error($me);
if ($sO == -1) {
goto fg;
}
if (strtolower($lJ) != "\x73\x75\x63\x63\145\163\163") {
goto AK;
}
$this->ldapconn = $me;
$Ii->statusCode = "\x4c\x44\101\120\137\102\111\x4e\x44\137\x53\x55\103\x43\x45\123\123\x46\125\x4c";
goto Y7;
AK:
$Ii->statusCode = "\114\104\101\x50\x5f\102\111\x4e\104\137\105\x52\122\x4f\122";
$Ii->statusMessage = "\103\157\x6e\x6e\145\143\164\151\157\x6e\40\164\x6f\x20\171\x6f\x75\162\40\x4c\104\x41\x50\40\163\145\162\x76\145\162\40\x69\x73\x20\163\165\x63\143\x65\163\163\146\165\154\40\x62\165\164\40\165\x6e\141\x62\x6c\x65\x20\164\157\40\x6d\x61\x6b\145\x20\141\x75\164\x68\145\x6e\164\x69\x63\x61\x74\145\x64\40\142\151\x6e\x64\40\164\157\40\114\x44\101\120\x20\163\145\162\166\x65\162\x2e\40\x4d\141\x6b\x65\x20\163\x75\x72\145\x20\171\x6f\165\40\x68\x61\x76\x65\40\x70\162\157\166\151\144\x65\x64\40\x63\157\x72\x72\145\x63\x74\40\x75\x73\145\x72\x6e\x61\155\x65\x20\157\162\x20\160\x61\163\163\x77\x6f\x72\144\56";
Y7:
goto Xj;
fg:
$Ii->statusCode = "\x4c\x44\x41\120\137\x43\x4f\x4e\116\105\103\x54\x49\x4f\116\137\x45\122\x52\117\x52";
$Ii->statusMessage = "\103\141\x6e\x6e\x6f\x74\40\x63\x6f\x6e\x6e\145\x63\164\40\164\157\x20\114\104\x41\120\40\123\x65\162\x76\145\x72\x2e\x20\x4d\x61\153\x65\x20\x73\x75\162\145\x20\x79\157\165\40\x68\x61\166\x65\x20\x65\x6e\164\145\x72\145\144\40\143\x6f\x72\162\x65\143\164\x20\114\104\x41\120\40\163\145\x72\166\x65\x72\40\x68\157\163\x74\156\141\x6d\x65\x20\x6f\162\x20\111\x50\x20\x61\x64\144\x72\x65\163\x73\56\40\x3c\142\162\76\111\x66\x20\164\x68\x65\x72\x65\40\151\163\40\x61\40\146\x69\x72\145\x77\141\x6c\x6c\x2c\40\160\154\145\x61\163\145\x20\x6f\160\145\156\x20\x74\150\145\40\146\x69\x72\x65\x77\x61\x6c\154\x20\164\157\40\141\x6c\x6c\x6f\x77\40\151\156\x63\157\155\x69\156\x67\x20\x72\x65\x71\165\x65\163\x74\163\x20\164\x6f\x20\171\157\165\x72\40\x4c\104\101\120\40\x73\x65\162\x76\145\x72\40\146\162\x6f\155\x20\171\x6f\x75\x72\x20\x57\157\x72\x64\x50\162\x65\x73\163\x20\x73\151\164\145\40\111\x50\x20\x61\144\x64\x72\x65\163\163\x20\141\156\144\x20\142\145\x6c\157\167\x20\163\160\x65\143\x69\x66\151\x65\x64\x20\160\x6f\162\164\40\x6e\x75\155\x62\145\x72\56";
Xj:
t1:
return $Ii;
}
function fetch_ldap_user_dn($w3)
{
$ia = new MoLdapAuthResponse();
$Gg = new Mo_ldap_authentication();
$hA = !empty(mo_ldap_get_db_value("\x6d\157\137\x6c\144\x61\x70\137\163\x65\141\x72\143\150\x5f\146\151\x6c\164\x65\162")) ? $Gg->mo_ldap_decrypt(mo_ldap_get_db_value("\155\157\x5f\154\x64\x61\160\x5f\163\145\x61\162\x63\150\137\146\151\x6c\x74\145\162")) : '';
$XV = !empty(mo_ldap_get_db_value("\x6d\x6f\137\x6c\144\x61\160\x5f\163\x65\141\162\143\150\x5f\142\x61\x73\x65")) ? mo_ldap_get_db_value("\x6d\157\137\154\144\x61\160\137\163\x65\x61\x72\x63\150\137\x62\141\163\145") : '';
$hA = str_replace("\77", $w3, $hA);
$Qp = explode("\73", $XV);
$M7 = null;
$Ux = null;
$iZ = null;
$n2 = 0;
Fy:
if (!($n2 < sizeof($Qp))) {
goto XH;
}
if (ldap_search($this->ldapconn, $Qp[$n2], $hA)) {
goto VM;
}
$ia->statusCode = "\114\104\x41\x50\137\x55\123\105\122\x5f\x53\105\x41\122\103\x48\x5f\105\122\x52\117\x52";
$ia->statusMessage = "\x45\162\162\157\162\40\167\x68\x69\x6c\x65\x20\x73\145\x61\x72\x63\150\x69\156\147\40\165\163\x65\x72\x20\x69\156\x20\x4c\x44\101\x50\x20\163\145\x72\166\145\162\56";
return $ia;
goto hM;
VM:
$M7 = ldap_search($this->ldapconn, $Qp[$n2], $hA);
hM:
$iZ = ldap_first_entry($this->ldapconn, $M7);
$Ux = ldap_get_entries($this->ldapconn, $M7);
if (!$iZ) {
goto GY;
}
goto XH;
GY:
FQ:
$n2++;
goto Fy;
XH:
if ($iZ) {
goto KP;
}
$ia->statusCode = "\114\104\101\120\x5f\x55\x53\x45\x52\x5f\x4e\117\124\x5f\x45\x58\x49\x53\x54";
$ia->statusMessage = "\125\163\145\162\x20\x64\x6f\145\x73\40\x6e\x6f\164\x20\145\x78\151\x73\x74\x20\151\x6e\40\x4c\x44\101\x50\x20\163\x65\162\x76\x65\162";
return $ia;
goto lY;
KP:
$Y7 = ldap_get_dn($this->ldapconn, $iZ);
$ia->statusCode = "\106\105\124\x43\x48\137\x44\116\137\123\x55\103\x43\105\x53\123";
$ia->userDn = $Y7;
return $ia;
lY:
}
function fetch_user_profile_attributes($w3, $Lo = null, $m2 = null, $J2 = null, $MN = false)
{
$pf = new MoLdapAuthResponse();
$Gg = new Mo_ldap_authentication();
$hA = !empty(mo_ldap_get_db_value("\x6d\157\x5f\154\144\x61\160\x5f\163\x65\141\162\x63\150\137\x66\x69\154\x74\145\162")) ? $Gg->mo_ldap_decrypt(mo_ldap_get_db_value("\155\157\x5f\154\144\x61\160\137\x73\x65\x61\x72\x63\x68\x5f\146\151\154\x74\145\162")) : '';
$hA = str_replace("\77", $w3, $hA);
if (!isset($m2)) {
goto L1;
}
$hA = $m2;
L1:
$XV = !empty(mo_ldap_get_db_value("\155\x6f\137\x6c\x64\141\x70\137\x73\145\x61\162\x63\150\137\142\x61\x73\145")) ? mo_ldap_get_db_value("\x6d\157\137\154\x64\141\160\137\x73\x65\x61\162\x63\x68\x5f\x62\x61\163\145") : '';
$z0 = "\57\155\x65\155\142\x65\x72\x3a\x31\x2e\x32\56\x38\x34\x30\56\61\61\x33\65\x35\66\x2e\61\x2e\x34\56\x31\71\x34\x31\x3a\57";
if (preg_match($z0, $hA)) {
goto eK;
}
$Qg = false;
goto Dw;
eK:
$Qg = true;
Dw:
$w5 = null;
if ($Lo == null && $MN == false) {
goto me;
}
if (is_array($Lo)) {
goto ZV;
}
if (!($MN == true)) {
goto p2;
}
$w5 = array("\52");
p2:
goto N2;
ZV:
$w5 = $Lo;
N2:
goto UM;
me:
$Zp = array();
$w5 = $Zp;
UM:
if ($J2 == null) {
goto ax;
}
$Qp = explode("\x3b", $J2);
goto sw;
ax:
$Qp = explode("\73", $XV);
sw:
$M7 = null;
$Ux = null;
$iZ = null;
$b8 = null;
$n2 = 0;
Sf:
if (!($n2 < sizeof($Qp))) {
goto Au;
}
if (ldap_search($this->ldapconn, $Qp[$n2], $hA, $w5)) {
goto os;
}
$pf->statusCode = "\114\104\101\x50\x5f\125\123\x45\122\137\123\x45\x41\x52\x43\110\x5f\105\122\x52\117\122";
$pf->statusMessage = "\x45\x72\162\x6f\162\x20\167\150\151\154\145\40\163\145\x61\162\x63\x68\x69\156\x67\40\165\163\x65\x72\x20\151\156\40\114\104\x41\120\40\163\145\162\166\x65\x72\x2e";
return $pf;
goto AN;
os:
$M7 = ldap_search($this->ldapconn, $Qp[$n2], $hA, $w5);
AN:
$iZ = ldap_first_entry($this->ldapconn, $M7);
if ($Qg) {
goto TY;
}
$Ux = ldap_get_entries($this->ldapconn, $M7);
if (!$iZ) {
goto qm;
}
goto Au;
qm:
goto A_;
TY:
$Rk = ldap_get_entries($this->ldapconn, $M7);
$Ux = $this->mo_ldap_merge_entries($Ux, $Rk);
A_:
if (!($Qg == true && $iZ == true)) {
goto Xa;
}
$b8 = $iZ;
Xa:
HO:
$n2++;
goto Sf;
Au:
if ($iZ == true && $Qg == false) {
goto Qd;
}
if ($b8) {
goto Yg;
}
$pf->statusCode = "\x4c\x44\101\120\x5f\x55\x53\105\x52\137\x4e\117\x54\137\x45\x58\x49\x53\x54";
$pf->statusMessage = "\125\163\x65\162\x20\x64\157\x65\x73\40\x6e\157\164\40\145\x78\x69\163\164\40\x69\156\x20\x4c\104\101\x50\x20\x73\145\x72\x76\x65\162";
return $pf;
goto Ut;
Yg:
$Y7 = ldap_get_dn($this->ldapconn, $b8);
$pf->userDn = $Y7;
Ut:
goto s3;
Qd:
$Y7 = ldap_get_dn($this->ldapconn, $iZ);
$pf->userDn = $Y7;
s3:
$pf->statusCode = "\x50\x52\x4f\106\111\114\105\137\x46\105\x54\103\110\137\x53\125\x43\x43\105\x53\x53";
if ($Lo == null && $MN == false) {
goto lJ;
}
$pf->extraProfileAttributesList = $Ux;
return $pf;
goto N_;
lJ:
foreach ($w5 as $LU) {
if (isset($Ux[0][strtolower($LU)]["\143\157\165\156\x74"]) && $Ux[0][strtolower($LU)]["\143\x6f\165\156\x74"] > 1) {
goto um;
}
$kZ["\155\x6f\x5f\x6c\144\x61\x70\x5f\x6c\157\143\141\x6c\137\x63\x75\163\x74\x6f\x6d\137\x61\164\x74\162\151\x62\165\x74\145\x5f" . $LU] = $Ux[0][strtolower($LU)][0];
goto TH;
um:
$D_ = array();
$n2 = 0;
bP:
if (!($n2 < $Ux[0][strtolower($LU)]["\143\157\x75\x6e\164"])) {
goto Sj;
}
array_push($D_, $Ux[0][strtolower($LU)][$n2]);
p9:
$n2++;
goto bP;
Sj:
$kZ["\155\x6f\x5f\154\144\x61\160\x5f\x6c\157\143\x61\x6c\x5f\143\165\x73\164\x6f\155\x5f\141\164\164\162\x69\x62\x75\164\x65\137" . $LU] = $D_;
TH:
mA:
}
vm:
$pf->extraProfileAttributesList = $kZ;
N_:
return $pf;
}
}