Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a $ldap_scope parameter (#921) #939

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"ltb-project/ltb-common": "v0.2.1",
"ltb-project/ltb-common": "dev-main",
"bjeavons/zxcvbn-php": "^1.0",
"twbs/bootstrap": "v5.3.3",
"defuse/php-encryption": "2.4.0",
Expand Down
1 change: 1 addition & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
$ldap_login_attribute = "uid";
$ldap_fullname_attribute = "cn";
$ldap_filter = "(&(objectClass=person)($ldap_login_attribute={login}))";
$ldap_scope = "sub"; # possible values: sub, one, base
$ldap_use_exop_passwd = false;
$ldap_use_ppolicy_control = false;
$ldap_network_timeout = 10;
Expand Down
9 changes: 9 additions & 0 deletions docs/config_ldap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ The filter can be set in ``$ldap_filter``:

.. tip:: The string ``{login}`` is replaced by submitted login.

The scope can be set in ``$ldap_scope``:

.. code-block:: php

$ldap_scope = "sub";

.. tip:: sub is the default value. Possible values are sub, one, or base


Extensions
----------

Expand Down
2 changes: 1 addition & 1 deletion htdocs/change.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/changecustompwdfield.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function set_default_value(&$variable, $defaultValue)

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/changesshkey.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/resetbyquestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/resetbytoken.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/sendsms.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ function get_user_infos($ldapInstance, $ldap_base, $ldap_filter,

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter, $search_attributes);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter, $search_attributes);

$errno = ldap_errno($ldap);
if ($errno) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/sendtoken.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/setattributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
4 changes: 2 additions & 2 deletions htdocs/setquestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down Expand Up @@ -134,7 +134,7 @@
}

# Check objectClass presence and pull back previous answers.
$search = ldap_search($ldap, $userdn, "(objectClass=*)", array("objectClass", $answer_attribute) );
$search = $ldapInstance->search_with_scope($ldap_scope, $userdn, "(objectClass=*)", array("objectClass", $answer_attribute) );

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion rest/v1/adminchangepassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion rest/v1/changepassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if ( $ldap ) {
# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion rest/v1/checkpassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# Search for user
$ldap_filter = str_replace("{login}", $login, $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/encrypt_answers.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

# Search all users
$ldap_filter = str_replace("{login}", "*", $ldap_filter);
$search = ldap_search($ldap, $ldap_base, $ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $ldap_base, $ldap_filter);

if (!$search) {
$errno = ldap_errno($ldap);
Expand Down
2 changes: 1 addition & 1 deletion scripts/multi_ldap_change.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
} else {
$s_ldap_base = $ldap_base;
}
$search = ldap_search($ldap, $s_ldap_base, $s_ldap_filter);
$search = $ldapInstance->search_with_scope($ldap_scope, $s_ldap_base, $s_ldap_filter);

$errno = ldap_errno($ldap);
if ( $errno ) {
Expand Down
Loading