summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/util.inc.php4
-rw-r--r--modules/sysconfig/addmodule_adauth.inc.php12
-rw-r--r--modules/sysconfig/addmodule_ldapauth.inc.php11
-rw-r--r--templates/sysconfig/ad-checkconnection.html1
-rw-r--r--templates/sysconfig/ad-checkcredentials.html5
-rw-r--r--templates/sysconfig/ldap-checkconnection.html1
-rw-r--r--templates/sysconfig/ldap-checkcredentials.html16
7 files changed, 35 insertions, 15 deletions
diff --git a/inc/util.inc.php b/inc/util.inc.php
index 4378a084..06eebfa4 100644
--- a/inc/util.inc.php
+++ b/inc/util.inc.php
@@ -285,5 +285,9 @@ SADFACE;
@unlink($file);
exit(0);
}
+
+ public static function normalizeDn($dn) {
+ return preg_replace('/[,;]\s*/', ',', $dn);
+ }
}
diff --git a/modules/sysconfig/addmodule_adauth.inc.php b/modules/sysconfig/addmodule_adauth.inc.php
index 1b04eab0..251ee5d6 100644
--- a/modules/sysconfig/addmodule_adauth.inc.php
+++ b/modules/sysconfig/addmodule_adauth.inc.php
@@ -80,8 +80,8 @@ class AdAuth_CheckConnection extends AddModule_Base
'edit' => Request::post('edit'),
'title' => Request::post('title'),
'server' => $this->server,
- 'searchbase' => Request::post('searchbase'),
- 'binddn' => Request::post('binddn'),
+ 'searchbase' => Util::normalizeDn(Request::post('searchbase')),
+ 'binddn' => Util::normalizeDn(Request::post('binddn')),
'bindpw' => Request::post('bindpw'),
'home' => Request::post('home'),
'ssl' => Request::post('ssl'),
@@ -206,6 +206,14 @@ class AdAuth_Finish extends AddModule_Base
if ($i === false)
$i = -1;
$searchbase = mb_substr($binddn, $i + 1);
+ } else {
+ $somedn = Request::post('somedn', false);
+ if (!empty($somedn)) {
+ $i = stripos($somedn, $searchbase);
+ if ($i !== false) {
+ $searchbase = substr($somedn, $i, strlen($searchbase));
+ }
+ }
}
$title = Request::post('title');
if (empty($title))
diff --git a/modules/sysconfig/addmodule_ldapauth.inc.php b/modules/sysconfig/addmodule_ldapauth.inc.php
index d00ff41c..44dbcca1 100644
--- a/modules/sysconfig/addmodule_ldapauth.inc.php
+++ b/modules/sysconfig/addmodule_ldapauth.inc.php
@@ -80,8 +80,8 @@ class LdapAuth_CheckConnection extends AddModule_Base
'edit' => Request::post('edit'),
'title' => Request::post('title'),
'server' => $this->server,
- 'searchbase' => Request::post('searchbase'),
- 'binddn' => Request::post('binddn'),
+ 'searchbase' => Util::normalizeDn(Request::post('searchbase')),
+ 'binddn' => Util::normalizeDn(Request::post('binddn')),
'bindpw' => Request::post('bindpw'),
'home' => Request::post('home'),
'ssl' => Request::post('ssl'),
@@ -177,6 +177,13 @@ class LdapAuth_Finish extends AddModule_Base
$module = ConfigModule::getInstance('LdapAuth');
else
$module = $this->edit;
+ $somedn = Request::post('somedn', false);
+ if (!empty($somedn)) {
+ $i = stripos($somedn, $searchbase);
+ if ($i !== false) {
+ $searchbase = substr($somedn, $i, strlen($searchbase));
+ }
+ }
$ssl = Request::post('ssl', 'off') === 'on';
$module->setData('server', Request::post('server'));
$module->setData('searchbase', $searchbase);
diff --git a/templates/sysconfig/ad-checkconnection.html b/templates/sysconfig/ad-checkconnection.html
index f5fcb2a8..0c7cd77f 100644
--- a/templates/sysconfig/ad-checkconnection.html
+++ b/templates/sysconfig/ad-checkconnection.html
@@ -9,6 +9,7 @@
<div class="pull-left">
<form role="form" method="post" action="?do=SysConfig&amp;action=addmodule&amp;step=AdAuth_Start">
<input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="edit" value="{{edit}}">
<input name="title" value="{{title}}" type="hidden">
<input name="server" value="{{server}}" type="hidden">
<input name="searchbase" value="{{searchbase}}" type="hidden">
diff --git a/templates/sysconfig/ad-checkcredentials.html b/templates/sysconfig/ad-checkcredentials.html
index 9378adad..dbd09d58 100644
--- a/templates/sysconfig/ad-checkcredentials.html
+++ b/templates/sysconfig/ad-checkcredentials.html
@@ -11,6 +11,7 @@
<div class="pull-left">
<form role="form" method="post" action="?do=SysConfig&amp;action=addmodule&amp;step=AdAuth_Start">
<input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="edit" value="{{edit}}">
<input name="title" value="{{title}}" type="hidden">
<input name="server" value="{{server}}" type="hidden">
<input name="searchbase" value="{{searchbase}}" type="hidden">
@@ -30,6 +31,7 @@
<input name="title" value="{{title}}" type="hidden">
<input name="server" value="{{server}}" type="hidden">
<input name="searchbase" value="{{searchbase}}" type="hidden">
+ <input id="setbase" name="somedn" value="" type="hidden">
<input id="setdn" name="binddn" value="{{binddn}}" type="hidden">
<input name="bindpw" value="{{bindpw}}" type="hidden">
<input name="home" value="{{home}}" type="hidden">
@@ -47,6 +49,9 @@
if (!task || !task.statusCode)
return;
if (task.statusCode === 'TASK_FINISHED') {
+ if (task.data && task.data.dn) {
+ $('#setbase').val(task.data.dn);
+ }
$('#nextbutton').html('Weiter &raquo;').show();
}
if (task.statusCode === 'TASK_ERROR' || task.statusCode === 'PARENT_FAILED') {
diff --git a/templates/sysconfig/ldap-checkconnection.html b/templates/sysconfig/ldap-checkconnection.html
index 39408526..b661a263 100644
--- a/templates/sysconfig/ldap-checkconnection.html
+++ b/templates/sysconfig/ldap-checkconnection.html
@@ -9,6 +9,7 @@
<div class="pull-left">
<form role="form" method="post" action="?do=SysConfig&amp;action=addmodule&amp;step=LdapAuth_Start">
<input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="edit" value="{{edit}}">
<input name="title" value="{{title}}" type="hidden">
<input name="server" value="{{server}}" type="hidden">
<input name="searchbase" value="{{searchbase}}" type="hidden">
diff --git a/templates/sysconfig/ldap-checkcredentials.html b/templates/sysconfig/ldap-checkcredentials.html
index f089c4ab..77736c9c 100644
--- a/templates/sysconfig/ldap-checkcredentials.html
+++ b/templates/sysconfig/ldap-checkcredentials.html
@@ -3,7 +3,6 @@
</p>
<div id="zeug">
- <div data-tm-id="{{self-search}}" data-tm-log="messages" data-tm-callback="selfCb">LDAP Self-Query</div>
<div data-tm-id="{{tm-search}}" data-tm-log="messages" data-tm-callback="ldapCb">LDAP Test-Query</div>
</div>
<i>{{lang_onProblemSearchBase}}</i>
@@ -11,6 +10,7 @@
<div class="pull-left">
<form role="form" method="post" action="?do=SysConfig&amp;action=addmodule&amp;step=LdapAuth_Start">
<input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="edit" value="{{edit}}">
<input name="title" value="{{title}}" type="hidden">
<input name="server" value="{{server}}" type="hidden">
<input name="searchbase" value="{{searchbase}}" type="hidden">
@@ -30,6 +30,7 @@
<input name="title" value="{{title}}" type="hidden">
<input name="server" value="{{server}}" type="hidden">
<input name="searchbase" value="{{searchbase}}" type="hidden">
+ <input id="setbase" name="somedn" value="" type="hidden">
<input id="setdn" name="binddn" value="{{binddn}}" type="hidden">
<input name="bindpw" value="{{bindpw}}" type="hidden">
<input name="home" value="{{home}}" type="hidden">
@@ -47,6 +48,9 @@
if (!task || !task.statusCode)
return;
if (task.statusCode === 'TASK_FINISHED') {
+ if (task.data && task.data.dn) {
+ $('#setbase').val(task.data.dn);
+ }
$('#nextbutton').html('Weiter &raquo;').show();
}
if (task.statusCode === 'TASK_ERROR' || task.statusCode === 'PARENT_FAILED') {
@@ -56,14 +60,4 @@
$('#nextbutton').show();
}
}
- function selfCb(task)
- {
- if (!task || !task.statusCode)
- return;
- if (task.statusCode === 'TASK_FINISHED' && task.data && task.data.dn) {
- $('#setdn').val(task.data.dn);
- } else {
- $('#nextbutton').html('Trotzdem weiter &raquo;');
- }
- }
</script>