diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index f7ce4f87a6..67b61989f7 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -23,6 +23,9 @@ require_once('apps/user_ldap/user_ldap.php'); +// define LDAP_DEFAULT_PORT +define("OC_USER_BACKEND_LDAP_DEFAULT_PORT", 389); + // register user backend OC_USER::useBackend( "LDAP" ); diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index 22f817e7ca..f7aff1b461 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -29,7 +29,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )) 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){ if(isset($_POST[$param])){ @@ -45,4 +45,8 @@ foreach($params as $param){ $value = OC_APPCONFIG::getValue('user_ldap', $param,''); $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(); diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 5f7ee671ce..0145736e80 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -5,6 +5,9 @@
Host: *
+
+ Port: * +
DN:
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 52f8806429..cd4a92a7b1 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -25,15 +25,18 @@ require_once('User/backend.php'); class OC_USER_LDAP extends OC_USER_BACKEND { + + public function checkPassword( $uid, $password ) { $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_password = OC_APPCONFIG::getValue('user_ldap', 'ldap_password',''); $ldap_base = OC_APPCONFIG::getValue('user_ldap', 'ldap_base',''); $ldap_filter = OC_APPCONFIG::getValue('user_ldap', 'ldap_filter',''); // connect to server - $ds = ldap_connect( $ldap_host ); + $ds = ldap_connect( $ldap_host, $ldap_port ); if( !$ds ) return false;