aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ldap/fix-open_simple-segfault.patch
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-03-10 00:32:24 +0100
committerJakub Jirutka <jakub@jirutka.cz>2017-03-10 00:33:18 +0100
commit066b35bd070d22f59e5f3fd5be29614d34517721 (patch)
tree26a2e5056b484382130074ce02d8c83288da42da /main/lua-ldap/fix-open_simple-segfault.patch
parent23980ddbd76a735adb0f6f8f66b4a80d72df363a (diff)
main/lua-ldap: fix segfault, iteration error and run tests
Diffstat (limited to 'main/lua-ldap/fix-open_simple-segfault.patch')
-rw-r--r--main/lua-ldap/fix-open_simple-segfault.patch31
1 files changed, 31 insertions, 0 deletions
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 00000000000..ecd9d629d97
--- /dev/null
+++ b/main/lua-ldap/fix-open_simple-segfault.patch
@@ -0,0 +1,31 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+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