Re: Getting the distinguished name when using Auth with the LDAP container
| From: | Jan Wagner | Date: | Fri, 05 May 2006 07:04:11 +0000 |
| Subject: | Re: Getting the distinguished name when using Auth with the LDAP container | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23948@lists.php.net to get a copy of this message | ||
> > as my first mail bounced, I took time to check on that and dn is not
> > returned. So one would have to change fetchData, to actually save
> > $user_dn in AuthData if 'dn' is in attributes.
>
> Yeah, that's the problem. You cannot fetch the DN with getAuthData().
>
> > What do the other authors say?
>
> Do you know if the Auth developers are subscribed to this list or should
> I post and subscribe to the PEAR developers list?
Hi,
I am the original author of the container. I guess the others are around
here, too. I have prepared a patch against the current CVS version
(which seems to be broken, parse errors ...). The relevant part should
apply cleanly to the current release.
--- Container/LDAP.php 27 Mar 2006 05:39:28 -0000 1.32
+++ Container/LDAP.php 5 May 2006 06:59:00 -0000
@@ -564,6 +564,12 @@
$entry_id = @ldap_first_entry($this->conn_id, $result_id);
$user_dn = @ldap_get_dn($this->conn_id, $entry_id);
+ // as the dn is not fetched as an attribute, we save it anyway
+ if (is_array($attributes) && in_array('dn', $attributes)) {
+ $this->_debug('Saving DN to AuthData', __LINE__);
+ $this->_auth_obj->setAuthData('dn', $user_dn);
+ }
+
// fetch attributes
if ($attributes = @ldap_get_attributes($this->conn_id, $entry_id)) {
I will apply this patch to CVS if none of the others reject this change.
Cheers Jan