user_ldap: add port setting
This commit is contained in:
parent
c8e57d5460
commit
612f8cb954
|
@ -23,6 +23,9 @@
|
||||||
|
|
||||||
require_once('apps/user_ldap/user_ldap.php');
|
require_once('apps/user_ldap/user_ldap.php');
|
||||||
|
|
||||||
|
// define LDAP_DEFAULT_PORT
|
||||||
|
define("OC_USER_BACKEND_LDAP_DEFAULT_PORT", 389);
|
||||||
|
|
||||||
// register user backend
|
// register user backend
|
||||||
OC_USER::useBackend( "LDAP" );
|
OC_USER::useBackend( "LDAP" );
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' ))
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = array('ldap_host', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter');
|
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter');
|
||||||
|
|
||||||
foreach($params as $param){
|
foreach($params as $param){
|
||||||
if(isset($_POST[$param])){
|
if(isset($_POST[$param])){
|
||||||
|
@ -45,4 +45,8 @@ foreach($params as $param){
|
||||||
$value = OC_APPCONFIG::getValue('user_ldap', $param,'');
|
$value = OC_APPCONFIG::getValue('user_ldap', $param,'');
|
||||||
$tmpl->assign($param, $value);
|
$tmpl->assign($param, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ldap_port has a default value
|
||||||
|
$tmpl->assign( 'ldap_port', OC_APPCONFIG::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT));
|
||||||
|
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
<div>
|
<div>
|
||||||
<span>Host: *</span><span><input type="text" name="ldap_host" width="200" value="<?php echo $_['ldap_host']; ?>"></span>
|
<span>Host: *</span><span><input type="text" name="ldap_host" width="200" value="<?php echo $_['ldap_host']; ?>"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Port: *</span><span><input type="text" name="ldap_port" width="200" value="<?php echo $_['ldap_port']; ?>"></span>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>DN:<input type="text" name="ldap_dn" width="200" value="<?php echo $_['ldap_dn']; ?>"></span>
|
<span>DN:<input type="text" name="ldap_dn" width="200" value="<?php echo $_['ldap_dn']; ?>"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,15 +25,18 @@ require_once('User/backend.php');
|
||||||
|
|
||||||
class OC_USER_LDAP extends OC_USER_BACKEND {
|
class OC_USER_LDAP extends OC_USER_BACKEND {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function checkPassword( $uid, $password ) {
|
public function checkPassword( $uid, $password ) {
|
||||||
$ldap_host = OC_APPCONFIG::getValue('user_ldap', 'ldap_host','');
|
$ldap_host = OC_APPCONFIG::getValue('user_ldap', 'ldap_host','');
|
||||||
|
$ldap_port = OC_APPCONFIG::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT);
|
||||||
$ldap_dn = OC_APPCONFIG::getValue('user_ldap', 'ldap_dn','');
|
$ldap_dn = OC_APPCONFIG::getValue('user_ldap', 'ldap_dn','');
|
||||||
$ldap_password = OC_APPCONFIG::getValue('user_ldap', 'ldap_password','');
|
$ldap_password = OC_APPCONFIG::getValue('user_ldap', 'ldap_password','');
|
||||||
$ldap_base = OC_APPCONFIG::getValue('user_ldap', 'ldap_base','');
|
$ldap_base = OC_APPCONFIG::getValue('user_ldap', 'ldap_base','');
|
||||||
$ldap_filter = OC_APPCONFIG::getValue('user_ldap', 'ldap_filter','');
|
$ldap_filter = OC_APPCONFIG::getValue('user_ldap', 'ldap_filter','');
|
||||||
|
|
||||||
// connect to server
|
// connect to server
|
||||||
$ds = ldap_connect( $ldap_host );
|
$ds = ldap_connect( $ldap_host, $ldap_port );
|
||||||
if( !$ds )
|
if( !$ds )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue