Comments (8)
I don't see duplicate entries being returned when I use the ldapsearch
command, but I do notice this at the bottom of the output:
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1
Could the numResponses: 2
be relevant? Perhaps multiple servers are responding and the client is supposed to know how to uniquify or merge? I don't know much about LDAP.
from ldap.
I think above theory about numResponses: 2
is wrong because I did a search that returned a lot more results and got:
# search result
search: 2
result: 0 Success
# numResponses: 661
# numEntries: 660
So it's not getting twice as many responses as entries. There's just one extra response, which I am guessing is for a header or something.
from ldap.
This is still true even after changing the code to use NeverDerefAliases
:
search_request := ldap.NewSearchRequest(
base_dn,
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
filter[0],
attributes,
nil)
from ldap.
Also and I don't know if this is a related issue or completely separate, it is not finding records that I definitely know to be there.
TestSearch: (&(objectClass=user)(cn=Marc*)) -> num of entries = 2
0 - entry: &{DN:CN=Marcus H.,OU=Portland,... Attributes:[0xc208191110 0xc208191140]}
1 - entry: &{DN:CN=Marcus H.,OU=Portland,... Attributes:[0xc2081911a0 0xc2081911d0]}
2015-01-12T09:01:19.503034381-08:00 POST /users/marca/tokens 500 in 13.973487ms
My own name starts with "Marc" and it doesn't show up here, but it shows up with the ldapsearch
command:
$ ldapsearch -H ldap://ldapserver.corp.mycompany.com -x -b "OU=MyCompany,DC=corp,DC=mycompany,DC=com" -D "me" -W '(&(objectClass=user)(cn=Marc*))' name
...
# Marc A. ...
dn: CN=Marc A., ...
name: Marc A.
# Marcus H. ...
dn: CN=Marcus H., ...
name: Marcus H.
# search result
search: 2
result: 0 Success
# numResponses: 3
# numEntries: 2
from ldap.
I turned on the Debug
flag for the connection and it looks like at a fairly low level it is processing the same data twice.
Receiving message 2
Receiving message 2
2: got response 0xc2082bb400
LDAP Response: (Universal, Constructed, Sequence and Sequence of) Len=186 "<nil>"
Message ID: (Universal, Primative, Integer) Len=1 "2"
Search Result Entry: (Application, Constructed, 0x04) Len=180 "<nil>"
Object Name: (Universal, Primative, Octet String) Len=61 "CN=Marcus H...."
Attributes: (Universal, Constructed, Sequence and Sequence of) Len=115 "<nil>"
Attribute: (Universal, Constructed, Sequence and Sequence of) Len=84 "<nil>"
Attribute Name: (Universal, Primative, Octet String) Len=17 "distinguishedName"
Attribute Values: (Universal, Constructed, Set and Set OF) Len=63 "<nil>"
Attribute Value: (Universal, Primative, Octet String) Len=61 "CN=Marcus H...
Attribute: (Universal, Constructed, Sequence and Sequence of) Len=27 "<nil>"
Attribute Name: (Universal, Primative, Octet String) Len=14 "sAMAccountName"
Attribute Values: (Universal, Constructed, Set and Set OF) Len=9 "<nil>"
Attribute Value: (Universal, Primative, Octet String) Len=7 "marcush"
2: waiting for response
2: got response 0xc2082bb400
LDAP Response: (Universal, Constructed, Sequence and Sequence of) Len=186 "<nil>"
Message ID: (Universal, Primative, Integer) Len=1 "2"
Search Result Entry: (Application, Constructed, 0x04) Len=180 "<nil>"
Object Name: (Universal, Primative, Octet String) Len=61 "CN=Marcus H...."
Attributes: (Universal, Constructed, Sequence and Sequence of) Len=115 "<nil>"
Attribute: (Universal, Constructed, Sequence and Sequence of) Len=84 "<nil>"
Attribute Name: (Universal, Primative, Octet String) Len=17 "distinguishedName"
Attribute Values: (Universal, Constructed, Set and Set OF) Len=63 "<nil>"
Attribute Value: (Universal, Primative, Octet String) Len=61 "CN=Marcus H...."
Attribute: (Universal, Constructed, Sequence and Sequence of) Len=27 "<nil>"
Attribute Name: (Universal, Primative, Octet String) Len=14 "sAMAccountName"
Attribute Values: (Universal, Constructed, Set and Set OF) Len=9 "<nil>"
Attribute Value: (Universal, Primative, Octet String) Len=7 "marcush"
from ldap.
FWIW, https://github.com/mavricknz/ldap doesn't seem to have this problem.
from ldap.
I encountered the same issue. I tracked it down to a bug in conn.go. Mutations to message_packet
are seen by the goroutine, so the two goroutines race and messages are dropped or duplicated.
Not using the goroutine (and using the commented out line) worked for me, or to continue using the goroutine you just need to make another variable or pass it as a parameter:
go func(message_packet *messagePacket) {
chanResult <- message_packet.Packet
}(message_packet)
from ldap.
@ejona86 same thing here. With the goroutine, nothing. Using the commented out line instead, I get results.
from ldap.
Related Issues (9)
- Invalid filter packets created for basic search
- "Message Result chan not found" on the 128th request HOT 1
- conn.go's bug
- LDAP SASL bind (SCRAM SHA1) and dealing with binary/BER attribute values
- SCRAM-SHA-1(-PLUS) + SCRAM-SHA-256(-PLUS) + SCRAM-SHA-512(-PLUS) + SCRAM-SHA3-512(-PLUS) supports
- go get fails for go1.2rc2
- I want to set up a website and user can change ldap password on it
- panic: runtime error: send on closed channel HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ldap.