aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorDominik Schmidt <dev@dominik-schmidt.de>2011-06-23 23:17:10 +0200
committerDominik Schmidt <dev@dominik-schmidt.de>2011-06-23 23:57:17 +0200
commit612f8cb9546a0607defe7a0ff5fd8048bbfdf92c (patch)
tree69e9e4c0d0b0aed95ea6e44fd2269a4d06d642ec /apps/user_ldap
parentc8e57d5460e9b6b94f5730bcc5ca8197c42188ab (diff)
downloadnextcloud-server-612f8cb9546a0607defe7a0ff5fd8048bbfdf92c.tar.gz
nextcloud-server-612f8cb9546a0607defe7a0ff5fd8048bbfdf92c.zip
user_ldap: add port setting
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/appinfo/app.php3
-rw-r--r--apps/user_ldap/settings.php6
-rw-r--r--apps/user_ldap/templates/settings.php3
-rw-r--r--apps/user_ldap/user_ldap.php5
4 files changed, 15 insertions, 2 deletions
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index f7ce4f87a62..67b61989f7f 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 22f817e7ca9..f7aff1b4614 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 5f7ee671ce9..0145736e803 100644
--- a/apps/user_ldap/templates/settings.php
+++ b/apps/user_ldap/templates/settings.php
@@ -6,6 +6,9 @@
<span>Host: *</span><span><input type="text" name="ldap_host" width="200" value="<?php echo $_['ldap_host']; ?>"></span>
</div>
<div>
+ <span>Port: *</span><span><input type="text" name="ldap_port" width="200" value="<?php echo $_['ldap_port']; ?>"></span>
+ </div>
+ <div>
<span>DN:<input type="text" name="ldap_dn" width="200" value="<?php echo $_['ldap_dn']; ?>"></span>
</div>
<div>
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 52f88064292..cd4a92a7b16 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;