fix-anonymous-bind.patch 1016 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 12 Mar 2017 15:16:19 +0100
Subject: [PATCH] Fix anonymous bind

Empty string should work for both ancient and the current OpenLDAP API
(but I've tested only the current).

Upstream-Issue: https://github.com/bdellegrazie/lualdap/pull/1
---
 src/lualdap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lualdap.c b/src/lualdap.c
index 5bc1bb9..6063a97 100644
--- a/src/lualdap.c
+++ b/src/lualdap.c
@@ -1003,7 +1003,7 @@ static int lualdap_initialize (lua_State *L) {
 static int lualdap_open_simple (lua_State *L) {
 	ldap_pchar_t host = (ldap_pchar_t) luaL_checkstring (L, 1);
 	ldap_pchar_t who = (ldap_pchar_t) luaL_optstring (L, 2, NULL);
-	const char *password = luaL_optstring (L, 3, NULL);
+	const char *password = luaL_optstring (L, 3, "");
 	int use_tls = lua_toboolean (L, 4);
 	conn_data *conn = (conn_data *)lua_newuserdata (L, sizeof(conn_data));
 #if defined(LDAP_API_FEATURE_X_OPENLDAP) && LDAP_API_FEATURE_X_OPENLDAP >= 20300