Skip to content

lualdap doesn't work  #3

Description

@evanchaoli

I'm trying to use lualdap, but it doesn't work for me. My code is as below:

require 'lualdap'

ld = lualdap.open_simple("my-ldap-server", "user", "pass")
if ld == nil then
  print("LDAP not connected!")
  return 1
end

for dn, attribs in ld:search { base = "dc=mycompany,dc=com" } do
  print (string.format ("\t[%s]\n", dn))
  for name, values in pairs (attribs) do
    io.write ("["..name.."] : ")
    if type (values) == "string" then
      io.write (values)
    elseif type (values) == "table" then
      local n = table.getn(values)
      for i = 1, (n-1) do
        io.write (values[i]..",")
      end
      io.write (values[n])
    end
    io.write ("\n")
  end
end
ld:close()
print("Done!!")

In the meantime, if I use ldapsearch to do same search:

$ ldapsearch -D user -w pass -h my-ldap-server -b 'dc=mycompany,dc=com'

the ldapsearch command works, returning LDAP records.

Why's wrong with my code?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions