commit ddc7daf14508bf341f70a0c4b6c43e3270c91055 Author: Yves G Date: Thu Sep 14 11:47:50 2017 +0200 init diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..121d283 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = lua-lualdap-git + pkgdesc = lua binding to openldap + pkgver = master + pkgrel = 1 + url = https://github.com/lualdap/lualdap + arch = i686 + arch = x86_64 + license = MIT + makedepends = git + depends = openldap>=2.1 + depends = lua + provides = lua-lualdap + source = git+https://github.com/lualdap/lualdap.git + source = allow-uri.patch + sha1sums = SKIP + sha1sums = a5185d05bf737707937bf3f7177afb33160ff5ec + +pkgname = lua-lualdap-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..ada99ca --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,38 @@ +# Maintainer: Yves G. + +pkgname=lua-lualdap-git +pkgver=master +pkgrel=1 +pkgdesc="lua binding to openldap" +arch=('i686' 'x86_64') +url="https://github.com/lualdap/lualdap" +# see also https://github.com/luaforge/lualdap/network +license=('MIT') +provides=('lua-lualdap') +depends=('openldap>=2.1' 'lua') +makedepends=('git') +source=("git+https://github.com/lualdap/lualdap.git" + "allow-uri.patch") +sha1sums=('SKIP' + 'a5185d05bf737707937bf3f7177afb33160ff5ec') +_luaBin=lua + +pkgver() { + cd "${srcdir}/lualdap" + git describe --long --tags | sed -r 's/[vV]*(.*)-([^-]*)-(g[^-]+)/\1.r\2.\3/' +} + +build() { + cd "${srcdir}/lualdap" + git apply "${srcdir}/allow-uri.patch" + make +} + +package() { + cd "${srcdir}/lualdap" + mkdir -p "${pkgdir}/usr/lib/lua/$($_luaBin -v 2>&1 | grep -Eo '\<[5-9]\..')" + mkdir -p "${pkgdir}/usr/share/doc/${pkgname}" + make install DESTDIR="${pkgdir}" + cp -r doc/us "${pkgdir}/usr/share/doc/${pkgname}/html" + cp README.md CONTRIBUTORS.md LICENSE.md "${pkgdir}/usr/share/doc/${pkgname}/" +} diff --git a/allow-uri.patch b/allow-uri.patch new file mode 100644 index 0000000..3721f22 --- /dev/null +++ b/allow-uri.patch @@ -0,0 +1,23 @@ +diff --git a/src/lualdap.c b/src/lualdap.c +index 9f5f64b..06bdd9e 100644 +--- a/src/lualdap.c ++++ b/src/lualdap.c +@@ -1019,9 +1019,15 @@ static int lualdap_open_simple (lua_State *L) { + lualdap_setmeta (L, LUALDAP_CONNECTION_METATABLE); + conn->version = 0; + #if defined(LDAP_API_FEATURE_X_OPENLDAP) && LDAP_API_FEATURE_X_OPENLDAP >= 20300 +- host_with_schema = malloc(strlen(host) + 8); +- strcpy(host_with_schema, "ldap://"); +- strcat(host_with_schema, host); ++ host_with_schema = (char*) host; ++ if (strlen(host_with_schema)<8 || strncmp(host_with_schema, "ldap", 4)!=0 ++ || ( strncmp(host_with_schema+4, "://", 3)!=0 ++ && strncmp(host_with_schema+5, "://", 3)!=0) ++ ) { ++ host_with_schema = malloc(strlen(host) + 8); ++ strcpy(host_with_schema, "ldap://"); ++ strcat(host_with_schema, host); ++ } + err = ldap_initialize(&conn->ld, host_with_schema); + free(host_with_schema); + host_with_schema = NULL;