public function bind($rdn = null, $password = null)
    {
        $isAnonymous = false;
        if ((null === $rdn) || (null === $password)) {
            if ((null !== $rdn) || (null !== $password)) {
                throw new BindException(
                    'For an anonymous binding, both rdn & passwords have to be null'
                );
            }
            $isAnonymous = true;
        }

        if (! (@ldap_bind($this->connection, $rdn, $password))) {
            $code = @ldap_errno($this->connection);
            throw new BindException(
                sprintf(
                    'Could not bind %s user: Ldap Error Code=%s - %s',
                    $isAnonymous?'anonymous':'privileged',
                    $code,
                    ldap_err2str($code)
                )
            );
        }
    }