From 066b35bd070d22f59e5f3fd5be29614d34517721 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Fri, 10 Mar 2017 00:32:24 +0100 Subject: main/lua-ldap: fix segfault, iteration error and run tests --- main/lua-ldap/fix-open_simple-segfault.patch | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 main/lua-ldap/fix-open_simple-segfault.patch (limited to 'main/lua-ldap/fix-open_simple-segfault.patch') diff --git a/main/lua-ldap/fix-open_simple-segfault.patch b/main/lua-ldap/fix-open_simple-segfault.patch new file mode 100644 index 0000000000..ecd9d629d9 --- /dev/null +++ b/main/lua-ldap/fix-open_simple-segfault.patch @@ -0,0 +1,31 @@ +From: Jakub Jirutka +Date: Fri, 10 Mar 2017 00:28:52 +0100 +Subject: [PATCH] Fix segfault in lualdap_open_simple() + +--- a/src/lualdap.c ++++ b/src/lualdap.c +@@ -1011,7 +1011,7 @@ + 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 +- struct berval cred = { 0, NULL }; ++ struct berval *cred = NULL; + char *host_with_schema = NULL; + #endif + int err; +@@ -1045,12 +1045,9 @@ + } + /* Bind to a server */ + #if defined(LDAP_API_FEATURE_X_OPENLDAP) && LDAP_API_FEATURE_X_OPENLDAP >= 20300 +- cred.bv_len = strlen(password); +- cred.bv_val = malloc(cred.bv_len+1); +- strcpy(cred.bv_val, password); +- err = ldap_sasl_bind_s (conn->ld, who, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL); +- free(cred.bv_val); +- memset(&cred, 0, sizeof(cred)); ++ cred = ber_bvstrdup(password); ++ err = ldap_sasl_bind_s (conn->ld, who, LDAP_SASL_SIMPLE, cred, NULL, NULL, NULL); ++ ber_bvfree(cred); + #else + err = ldap_bind_s (conn->ld, who, password, LDAP_AUTH_SIMPLE); + #endif -- cgit v1.2.3