From 88dfa580b6fb0a983b135664886abb23c73a0406 Mon Sep 17 00:00:00 2001 From: abeudin Date: Mon, 16 Dec 2013 15:10:27 +0100 Subject: [PATCH] Update weave_storage.diff --- conf/weave_storage.diff | 77 +++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/conf/weave_storage.diff b/conf/weave_storage.diff index 810612e..958c1a9 100644 --- a/conf/weave_storage.diff +++ b/conf/weave_storage.diff @@ -1,33 +1,44 @@ -722a723,752 -> $mail = $auth_user; -> $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 -< +--- weave_storage.php 2013-12-16 13:44:24.252240725 +0000 ++++ weave_storage.php.new 2013-12-16 13:43:15.480260767 +0000 +@@ -720,6 +720,36 @@ + + function create_user($username, $password) + { ++ $mail = $auth_user ++ $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); ++ } ++ + log_error("Create User - Username: ".$username."|".$password); + + try +@@ -813,4 +843,3 @@ + + + ?> +-