Update weave_storage.diff

pull/3/head
abeudin 11 years ago
parent ba77d4d3bd
commit 88dfa580b6

@ -1,33 +1,44 @@
722a723,752 --- weave_storage.php 2013-12-16 13:44:24.252240725 +0000
> $mail = $auth_user; +++ weave_storage.php.new 2013-12-16 13:43:15.480260767 +0000
> $dn = "ou=users,dc=yunohost,dc=org"; @@ -720,6 +720,36 @@
> $filter = "(&(objectclass=inetOrgPerson)(mail=".$mail."))";
> $justthese = array("uid"); function create_user($username, $password)
> // connect to ldap server {
> $ldapconn = ldap_connect("localhost") + $mail = $auth_user
> or die("Could not connect to LDAP server."); + $dn = "ou=users,dc=yunohost,dc=org";
> + $filter = "(&(objectclass=inetOrgPerson)(mail=".$mail."))";
> ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); + $justthese = array("uid");
> ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0); + // connect to ldap server
> + $ldapconn = ldap_connect("localhost")
> if ($ldapconn) { + or die("Could not connect to LDAP server.");
> $ldapbind = @ldap_bind($ldapconn); +
> if (! $ldapbind) { + ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
> log_error("create_user:" . $exception->getMessage()); + ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
> error_log("create_user:" . $exception->getMessage()); +
> return 0; + if ($ldapconn) {
> } + $ldapbind = @ldap_bind($ldapconn);
> else { + if (! $ldapbind) {
> $sr = ldap_search($ldapconn, $dn, $filter, $justthese); + log_error("create_user:" . $exception->getMessage());
> $info = ldap_get_entries($ldapconn, $sr); + error_log("create_user:" . $exception->getMessage());
> if ( ! $info["count"]) { + return 0;
> log_error("create_user:" . $exception->getMessage()); + }
> error_log("create_user:" . $exception->getMessage()); + else {
> return 0; + $sr = ldap_search($ldapconn, $dn, $filter, $justthese);
> } + $info = ldap_get_entries($ldapconn, $sr);
> } + if ( ! $info["count"]) {
> @ldap_unbind($ldapconn); + log_error("create_user:" . $exception->getMessage());
> } + error_log("create_user:" . $exception->getMessage());
> + return 0;
816d845 + }
< + }
+ @ldap_unbind($ldapconn);
+ }
+
log_error("Create User - Username: ".$username."|".$password);
try
@@ -813,4 +843,3 @@
?>
-

Loading…
Cancel
Save