From 5f662c7d6f7d7778331855d62f0e372e974faa0f Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 16 Mar 2003 10:25:30 +0000 Subject: [PATCH] fixed nasty bug that always set the username to "" --- lam/lib/ldap.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lam/lib/ldap.php b/lam/lib/ldap.php index ac100828..d22ce0c1 100644 --- a/lam/lib/ldap.php +++ b/lam/lib/ldap.php @@ -88,15 +88,16 @@ class Ldap{ // $base is optional and specifies the root from where to search for entries // if connect succeeds the server handle is returned function connect($user, $passwd) { + // close any prior connection + @$this->close(); // do not allow anonymous bind - if ((!$user)||($user = "")) { + if ((!$user)||($user == "")) { echo _("No username was specified!"); exit; } if ($this->conf->get_SSL() == "True") $this->server = ldap_connect("ldaps://" . $this->conf->get_Host(), $this->conf->get_Port()); else $this->server = ldap_connect("ldap://" . $this->conf->get_Host(), $this->conf->get_Port()); if ($this->server) { - ldap_set_option($this->server, LDAP_OPT_DEBUG_LEVEL, 0); $bind = ldap_bind($this->server, $user, $passwd); if ($bind) { // return server handle