Browse files

* Tagged for new release

* Added a LDAP::reBind() method.


git-svn-id: http://svn.php.net/repository/pear/packages/Net_LDAP/trunk@150680 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 0290b76 commit 1e4dd0f97504273085ec6b8174f2a8aec0c88683 Tarjei Huse committed Feb 7, 2004
Showing with 66 additions and 25 deletions.
  1. +28 −0 LDAP.php
  2. +12 −7 doc/utf8.txt
  3. +26 −18 package.xml
View
28 LDAP.php
@@ -173,6 +173,33 @@ function bind($config = array())
}
/**
+ * ReBind to the ldap-server using another dn and password
+ *
+ * The function may be used if you do not create the object using Net_LDAP::connect.
+ *
+ * @access public
+ * @param string $dn - the DN to bind as.
+ * string $password - the bassword to use.
+ * @return mixed Net_LDAP_Error or true
+ * @see $_config
+ */
+
+ function reBind ($dn = null, $password = null)
+ {
+
+ if ($dn && $password ) {
+ $bind = @ldap_bind($this->_link, $dn, $password);
+ } else {
+ $bind = @ldap_bind($this->_link);
+ }
+
+ if (!$bind) {
+ return $this->raiseError("Bind failed " . @ldap_error($this->_link), @ldap_errno($this->_link));
+ }
+ return true;
+ }
+
+ /**
* Starts an encrypted session
*
* @access public
@@ -583,6 +610,7 @@ function dnExists($dn)
}
return false;
}
+
/**
* Get a specific entry based on the dn
View
19 doc/utf8.txt
@@ -6,10 +6,15 @@ so here's the simple way to salvation:
Net_LDAP will check internally if utf8 is needed.
Code:
-$attrs = $ldap->utf8Encode( $attrs ); // now the attributes have been encoded.
-$entry->add ($attrs) ; // add attributes to the entry.
-
-$attrs = $entry->attributes();
-$attrs = $ldap->utf8Decode($attrs); // the other way around
-
-Thanks to Jan for the code.
+ // $attr is some text a user entered with funny characters in it.
+ // If $attr should not be utfized (f.x. userPassword) then utf8Encode
+ // will not encode the attribute.
+ $attr = $ldap->utf8Encode($attr);
+ // now insert the correctly encoded attribute into the directory.
+ $entry->modify($attr);
+
+ // later when you access the attributes of that user, decode the ones
+ // that have to be decoded.
+ $attr = $ldap->utf8Decode( $entry->attributes() );
+
+Thanks to Jan for the code.
View
44 package.xml
@@ -30,24 +30,13 @@
</maintainer>
</maintainers>
<release>
- <version>0.6.3</version>
+ <version>0.6.4</version>
<state>beta</state>
- <date>2003-11-12</date>
+ <date>2004-02-07</date>
<notes>
- It seems that 0.6.2 was out too fast. So this is mainly a bugfix release:
-
- - Removed remaining Net_LDAP::UTF8Encode and Net_LDAP::UTF8Decode calls in Net_LDAP_Entry,
- which stopped attributes() and get_entry() from working
- - The UTF8 functions somehow got outside the Net_LDAP class ... FIXED.
- - The usuage example of the last release was wrong. We decided to move UTF8 handling into Net_LDAP.
- Handling should be done this way:
-
- $attr = $ldap->utf8Encode($attr);
- $entry->modify($attr);
- $attr = $ldap->utf8Decode( $entry->attributes() );
-
- - This means Net_LDAP_Util is useless right now, but will be extended in the future.
- - Jan did a complete overhaul of the phpdoc stuff. Everything seems to be fine now with phpDocumentor.
+ - Added a new LDAP::reBind method. Usefull for first searching for uid=username and then binding as that dn.
+ - Fixed bug #289 and #290.
+ Todo: Rewrite entry.php :-)
</notes>
<filelist>
<dir name="/" baseinstalldir="Net">
@@ -68,7 +57,7 @@
<file name="STATUS"/>
<file name="Schema.txt"/>
<file name="RootDSE.txt"/>
- <file name="Utf8.txt" />
+ <file name="utf8.txt" />
</dir>
</filelist>
</release>
@@ -144,7 +133,26 @@
Also, as usual some bugfixes has been made, amongst them some from Piero Calucci.
</notes>
-
+
+ <version>0.6.3</version>
+ <state>beta</state>
+ <date>2003-11-12</date>
+ <notes>
+ It seems that 0.6.2 was out too fast. So this is mainly a bugfix release:
+
+ - Removed remaining Net_LDAP::UTF8Encode and Net_LDAP::UTF8Decode calls in Net_LDAP_Entry,
+ which stopped attributes() and get_entry() from working
+ - The UTF8 functions somehow got outside the Net_LDAP class ... FIXED.
+ - The usuage example of the last release was wrong. We decided to move UTF8 handling into Net_LDAP.
+ Handling should be done this way:
+
+ $attr = $ldap->utf8Encode($attr);
+ $entry->modify($attr);
+ $attr = $ldap->utf8Decode( $entry->attributes() );
+
+ - This means Net_LDAP_Util is useless right now, but will be extended in the future.
+ - Jan did a complete overhaul of the phpdoc stuff. Everything seems to be fine now with phpDocumentor.
+ </notes>
</release>
</changelog>
</package>

0 comments on commit 1e4dd0f

Please sign in to comment.