summarylogtreecommitdiffstats
path: root/allow-uri.patch
diff options
context:
space:
mode:
Diffstat (limited to 'allow-uri.patch')
-rw-r--r--allow-uri.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/allow-uri.patch b/allow-uri.patch
new file mode 100644
index 000000000000..3721f22c424b
--- /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;