note 103034 added to function.ldap-bind

From: Date: Tue, 22 Mar 2011 01:31:10 +0000
Subject: note 103034 added to function.ldap-bind
Groups: php.notes 
Request: Send a blank email to php-notes+get-178065@lists.php.net to get a copy of this message
Interesting point, if you can't bind to active directory with the error "49: Invalid Credentials", you can get the extended error output from the ldap_get_option function, using the option: LDAP_OPT_DIAGNOSTIC_MESSAGE. Unfortunately php hasn't defined this by default, but it's value is 0x0032. This is useful if a user must change their password at first login (Data: 773), or if their account has expired on the network (Data: 532). <?php define(LDAP_OPT_DIAGNOSTIC_MESSAGE, 0x0032) $handle = ldap_connect('ldap://active.directory.server/'); $bind = ldap_bind($handle, 'user', 'expiredpass'); if ($bind) { if (ldap_get_option($handle, LDAP_OPT_DIAGNOSTIC_MESSAGE, $extended_error)) { echo "Error Binding to LDAP: $extended_error"; } else { echo "Error Binding to LDAP: No additional information is available."; } } ?> Or something to that effect.. It took me a while to work this one out, so i figured i'd share my results.. ---- Server IP: 117.104.162.229 Probable Submitter: 203.206.197.153 (proxied: 203.206.197.153) ---- Manual Page -- http://www.php.net/manual/en/function.ldap-bind.php Edit -- https://master.php.net/note/edit/103034 Del: integrated -- https://master.php.net/note/delete/103034/integrated Del: useless -- https://master.php.net/note/delete/103034/useless Del: bad code -- https://master.php.net/note/delete/103034/bad+code Del: spam -- https://master.php.net/note/delete/103034/spam Del: non-english -- https://master.php.net/note/delete/103034/non-english Del: in docs -- https://master.php.net/note/delete/103034/in+docs Del: other reasons-- https://master.php.net/note/delete/103034 Reject -- https://master.php.net/note/reject/103034 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178065) next »