Skip to content

Parsing LDIF from ldapsearch encounters two bugs #20

Open
@ghost

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions