optionally alllow anonymous login

This commit is contained in:
Roland Gruber 2009-03-07 18:15:27 +00:00
parent e107104da7
commit b22545c8b8
1 changed files with 3 additions and 2 deletions

View File

@ -84,13 +84,14 @@ class Ldap{
*
* @param string $user user name
* @param string $passwd password
* @param boolean $allowAnonymous specifies if anonymous binds are allowed
* @return mixed if connect succeeds the server handle is returned, else false
*/
function connect($user, $passwd) {
function connect($user, $passwd, $allowAnonymous=false) {
// close any prior connection
@$this->close();
// do not allow anonymous bind
if ((!$user)||($user == "")||(!$passwd)) {
if (!$allowAnonymous && ((!$user)||($user == "")||(!$passwd))) {
return false;
}
// save password und username encrypted