X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=ldapauth%2Fldapauth.php;h=60273c3b824d29398e10471f4e403d923368ee2f;hb=5360f08f4295f2306d815a7659fbdff94fda01a3;hp=55c855af99e839ccd3da4fd76e7b29cc7c8b8dce;hpb=ad1afc33d02f94454289a1f7f703aa0d3bcbc1ea;p=friendica-addons.git diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php old mode 100755 new mode 100644 index 55c855af..60273c3b --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -47,7 +47,7 @@ * // attribute to get email - optional - default : 'mail' * $a->config['ldapauth']['ldap_autocreateaccount_emailattribute'] = 'mail'; * // attribute to get nickname - optional - default : 'givenName' - * $a->config['ldapauth']['ldap_autocreateaccount_nameattribute'] = 'givenName'; + * $a->config['ldapauth']['ldap_autocreateaccount_nameattribute'] = 'cn'; * * ...etc. */ @@ -90,23 +90,29 @@ function ldapauth_authenticate($username,$password) { if(! ((strlen($password)) && (function_exists('ldap_connect')) - && (strlen($ldap_server)))) + && (strlen($ldap_server)))) { + logger("ldapauth: not configured or missing php-ldap module"); return false; + } $connect = @ldap_connect($ldap_server); - if(! $connect) + if($connect === false) { + logger("ldapauth: could not connect to $ldap_server"); return false; + } @ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION,3); @ldap_set_option($connect, LDAP_OPT_REFERRALS, 0); if((@ldap_bind($connect,$ldap_binddn,$ldap_bindpw)) === false) { + logger("ldapauth: could not bind $ldap_server as $ldap_binddn"); return false; } $res = @ldap_search($connect,$ldap_searchdn, $ldap_userattr . '=' . $username); if(! $res) { + logger("ldapauth: $ldap_userattr=$username,$ldap_searchdn not found"); return false; }