mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-17 13:30:38 +02:00
Merge pull request #116 from cryol/master
LDAP filter + logout button fix
This commit is contained in:
File diff suppressed because one or more lines are too long
20
src/main.php
20
src/main.php
@@ -410,7 +410,6 @@ f00bar;
|
|||||||
$ret = $this->config;
|
$ret = $this->config;
|
||||||
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
|
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
|
||||||
$ret['isDocroot'] = ( $this->getRootDir() == $this->getScriptRoot() ) ? true : false;
|
$ret['isDocroot'] = ( $this->getRootDir() == $this->getScriptRoot() ) ? true : false;
|
||||||
unset( $ret['auth'] );
|
|
||||||
unset( $ret['auth_source'] );
|
unset( $ret['auth_source'] );
|
||||||
$this->jsonResponse( $ret );
|
$this->jsonResponse( $ret );
|
||||||
}
|
}
|
||||||
@@ -1043,7 +1042,13 @@ f00bar;
|
|||||||
break;
|
break;
|
||||||
case "ldap":
|
case "ldap":
|
||||||
$authenticated = false;
|
$authenticated = false;
|
||||||
list( $ldap_server, $rootdn ) = explode( ";", $srcopt );
|
$ldapopts = explode( ";", $srcopt );
|
||||||
|
if( count( $ldapopts ) === 3 ) {
|
||||||
|
list( $ldap_server, $rootdn, $ufilter ) = explode( ";", $srcopt );
|
||||||
|
} else {
|
||||||
|
list( $ldap_server, $rootdn ) = explode( ";", $srcopt );
|
||||||
|
$ufilter = false;
|
||||||
|
}
|
||||||
$u = "uid=" . $user . "," . $rootdn;
|
$u = "uid=" . $user . "," . $rootdn;
|
||||||
if( ! $ds = ldap_connect( $ldap_server ) ) {
|
if( ! $ds = ldap_connect( $ldap_server ) ) {
|
||||||
trigger_error( "Could not reach the ldap server.", E_USER_ERROR );
|
trigger_error( "Could not reach the ldap server.", E_USER_ERROR );
|
||||||
@@ -1053,7 +1058,16 @@ f00bar;
|
|||||||
if( $ds ) {
|
if( $ds ) {
|
||||||
$ldbind = @ldap_bind( $ds, $u, $pass );
|
$ldbind = @ldap_bind( $ds, $u, $pass );
|
||||||
if( $ldbind ) {
|
if( $ldbind ) {
|
||||||
$authenticated = true;
|
if( $ufilter ) {
|
||||||
|
if( ldap_count_entries( $ds, ldap_search( $ds, $rootdn, $ufilter ) ) > 0 ){
|
||||||
|
$authenticated = true;
|
||||||
|
} else {
|
||||||
|
trigger_error( "User not allowed.", E_USER_ERROR );
|
||||||
|
$authenticated = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$authenticated = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
trigger_error( ldap_error( $ds ), E_USER_ERROR );
|
trigger_error( ldap_error( $ds ), E_USER_ERROR );
|
||||||
$authenticated = false;
|
$authenticated = false;
|
||||||
|
Reference in New Issue
Block a user