lua-ldap for EL8
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.4 KiB

From 847bbf5dbd8053ce21c90dd808ed98ff4b6e742a Mon Sep 17 00:00:00 2001
From: Dan Callaghan <>
Date: Mon, 30 Jun 2014 11:27:56 +1000
Subject: [PATCH 2/2] script to run test.lua against a dummy slapd
diff --git a/lualdap/Makefile b/lualdap/Makefile
index 6a4f06d..101a07f 100755
--- a/lualdap/Makefile
+++ b/lualdap/Makefile
@@ -26,3 +26,6 @@ install: src/$(LIBNAME)
rm -f $(OBJS) src/$(LIBNAME)
+ LUA_CPATH="src/?.so.$V" tests/
diff --git a/lualdap/tests/ b/lualdap/tests/
new file mode 100755
index 0000000..22ac84b
--- /dev/null
+++ b/lualdap/tests/
@@ -0,0 +1,73 @@
+set -ex
+d=$(readlink -f "$(dirname $0)")
+rm -rf "$d/slapd-config" "$d/slapd-data"
+mkdir "$d/slapd-config" "$d/slapd-data"
+# populate slapd config
+slapadd -F "$d/slapd-config" -n0 <<EOF
+dn: cn=config
+objectClass: olcGlobal
+cn: config
+olcPidFile: $d/
+dn: cn=schema,cn=config
+objectClass: olcSchemaConfig
+cn: schema
+include: file:///etc/openldap/schema/core.ldif
+include: file:///etc/openldap/schema/cosine.ldif
+include: file:///etc/openldap/schema/inetorgperson.ldif
+include: file:///etc/openldap/schema/nis.ldif
+dn: olcDatabase=config,cn=config
+objectClass: olcDatabaseConfig
+olcDatabase: config
+olcAccess: to * by * none
+dn: olcDatabase=bdb,cn=config
+objectClass: olcDatabaseConfig
+objectClass: olcBdbConfig
+olcDatabase: bdb
+olcSuffix: dc=example,dc=invalid
+olcDbDirectory: $d/slapd-data
+olcDbIndex: objectClass eq
+olcAccess: to * by * write
+#olcAccess: to * by users write
+# populate slapd data
+slapadd -F "$d/slapd-config" -n1 <<EOF
+dn: dc=example,dc=invalid
+objectClass: top
+objectClass: domain
+#dn: ou=users,dc=example,dc=invalid
+#objectClass: top
+#objectClass: organizationalUnit
+#ou: users
+dn: uid=ldapuser,dc=example,dc=invalid
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+objectClass: posixAccount
+cn: My LDAP User
+givenName: My
+sn: LDAP User
+uid: ldapuser
+uidNumber: 15549
+gidNumber: 15549
+homeDirectory: /home/lol
+mail: ldapuser@example.invalid
+userPassword: $(slappasswd -s "$password")
+slapd -F "$d/slapd-config" -h ldap://localhost:3899/
+trap 'kill -TERM $(cat "$d/")' EXIT
+lua tests/test.lua localhost:3899 dc=example,dc=invalid uid=ldapuser,dc=example,dc=invalid "$password"