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

Parsing LDIF from ldapsearch encounters two bugs #20

Open
ghost opened this issue Jul 5, 2023 · 0 comments
Open

Parsing LDIF from ldapsearch encounters two bugs #20

ghost opened this issue Jul 5, 2023 · 0 comments

Comments

@ghost
Copy link

ghost commented Jul 5, 2023

Given output from ldapsearch -L ... the first line as being version: 1.

From ldapsearch(1) manual page:

-L: Search results are display in LDAP Data Interchange Format detailed in ldif(5). A single -L restricts the output to LDIFv1.
A second -L disables comments. A third -L disables printing of the LDIF version. The default is to use an extended version of LDIF.

I used -L because without it you get an 'extended version' which includes a line result: 0 success (and one other), which results in a parse failure.

With -L you still get a version: 1 line. This does parse successfully, but leaves the first Entry in Entries as nil, which subsequently causes the AllEntries() method to crash because it tries to dereference a nil pointer.

As a workaround, I either have to use -LLL, or use -L and remove the first line, which is version: 1.

I am using github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3

Thank you for creating this library, it is very useful for me at the moment as I get back to some Go.

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

No branches or pull requests

0 participants