From 3c87d9ed70e30437261cf4c6539c96688a1b14d3 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 16 Dec 2013 13:46:25 +0000 Subject: [PATCH] add ldap check --- conf/weave_storage.diff | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 conf/weave_storage.diff diff --git a/conf/weave_storage.diff b/conf/weave_storage.diff new file mode 100644 index 0000000..893f2e0 --- /dev/null +++ b/conf/weave_storage.diff @@ -0,0 +1,33 @@ +722a723,752 +> $mail = +> $dn = "ou=users,dc=yunohost,dc=org"; +> $filter = "(&(objectclass=inetOrgPerson)(mail=".$mail."))"; +> $justthese = array("uid"); +> // connect to ldap server +> $ldapconn = ldap_connect("localhost") +> or die("Could not connect to LDAP server."); +> +> ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); +> ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0); +> +> if ($ldapconn) { +> $ldapbind = @ldap_bind($ldapconn); +> if (! $ldapbind) { +> log_error("create_user:" . $exception->getMessage()); +> error_log("create_user:" . $exception->getMessage()); +> return 0; +> } +> else { +> $sr = ldap_search($ldapconn, $dn, $filter, $justthese); +> $info = ldap_get_entries($ldapconn, $sr); +> if ( ! $info["count"]) { +> log_error("create_user:" . $exception->getMessage()); +> error_log("create_user:" . $exception->getMessage()); +> return 0; +> } +> } +> @ldap_unbind($ldapconn); +> } +> +816d845 +<