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

ldap_2level_query "select2 all" is returning only one result #893

Closed
caclement opened this issue Feb 26, 2020 · 9 comments · Fixed by #912
Closed

ldap_2level_query "select2 all" is returning only one result #893

caclement opened this issue Feb 26, 2020 · 9 comments · Fixed by #912
Labels
Milestone

Comments

@caclement
Copy link

In a dynamic data source, a ldap_2level_query seems to return only one result when "select2 all" is used.

I have a list with a "include_ldap_2level_query" statement in the config file. I am only getting partial results on the second select.

Example : I have 20 students, I want to get the parents for every student. I should have 40 parents but the result only returns 20 parents. It seems there is no difference between "select2 first" and "select2 all" in 6.2.52

I am on RHEL7 and the LDAP source is Microsoft Active Directory.

The bug is the same if I connect with LDAP with STARTTLS.

I have 6.0.1 in a lab and its working fine, I have the full results with the same config fille.

Version

6.2.52

Installation method

rpm

Expected behavior

"select2 all" should return all results from a filter

Actual behavior

"select2 all" return only the first result

Additional information

include_ldap_2level_query
select2 all
scope2 sub
suffix2 OU=PARENTS,OU=PEOPLE,dc=[redacted]
suffix1 OU=STUDENTS,OU=PEOPLE,dc=[redacted]
attrs1 cn
select1 all
filter2 (kids=[attrs1])
timeout1 60
name parent023706
attrs2 mail
bind_dn CN=[redacted]
scope1 sub
port 389
host [redacted]
bind_password [redacted]
filter1 (&(departmentNumber=023)(businessCategory=706))
timeout2 60

@ikedas ikedas added the bug label Feb 27, 2020
@ikedas ikedas added this to the 6.2.56 milestone Feb 27, 2020
@ikedas
Copy link
Member

ikedas commented Feb 27, 2020

Hi @caclement ,
Could you please present some samples of directory tree?

@caclement
Copy link
Author

Hi @ikedas

Do you have a prefered format ?

@ikedas
Copy link
Member

ikedas commented Feb 27, 2020

Nothing in particular. Please choose a format you prefer.

@caclement
Copy link
Author

caclement commented Feb 27, 2020

Hello @ikedas

I hope its clear enough !?

info.domain.com
				Computers
							ADM
								Building{1..n}
							PED
								Building{1..n}
							VDI
								Building{1..n}
				People
							Others
							Students
									All students are in this OU
							Employes
									All employes are in this OU
							Exams
							Kiosk
							Parents	
									All parents are in this OU
							Partners
									All partners are in this OU

More info :

All the students are in a flat container in info.domain.com/People/Students. There is no sub ou after that. Same for the parents.

The rest of the logic is in the user attributes and security groups (since its Active Directory)

@ikedas
Copy link
Member

ikedas commented Feb 29, 2020

Sorry for not explaining enough. Could you please present a set of entries that can reproduce the behavior you reported?

@caclement
Copy link
Author

caclement commented Mar 9, 2020

Hello

Here is 3 ldif file :

children.txt
parent1.txt
parent2.txt

The children is filtered by the level1 query

filter1 (&(departmentNumber=023)(businessCategory=706))

The 2 parents are supposed to get filtered

filter2 (kids=[attrs1])

It should return random1@hotmail.com and random2@hotmail.com

@ikedas
Copy link
Member

ikedas commented Mar 15, 2020

Hi @caclement ,

Could you please apply a change below and check if the problem will be solved? Thanks.

--- a/src/lib/Sympa/DataSource/LDAP.pm
+++ b/src/lib/Sympa/DataSource/LDAP.pm
@@ -149,8 +149,6 @@ sub _load_next {
 
             last if $ldap_select eq 'first';
         }
-
-        last if @retrieved;
     }
 
     return [@retrieved];

@ikedas
Copy link
Member

ikedas commented Mar 23, 2020

The patch was applied for now. Thanks for information!

@caclement
Copy link
Author

@ikedas Sorry for the delay, but I can confirm that the bug is fixed ! Thank you for your good work !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants