You are here

public static function SimpleLdap::ldap_bind in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 SimpleLdap.class.php \SimpleLdap::ldap_bind()

Wrapper function for ldap_bind().

Parameters

resource $link_identifier: An LDAP link identifier.

string $bind_rdn: The RDN to bind with. If not specified, and anonymous bind is attempted.

string $bind_password: The password to use during the bind.

Return value

boolean Returns TRUE on success or FALSE on failure.

1 call to SimpleLdap::ldap_bind()
SimpleLdapServer::bind in ./SimpleLdapServer.class.php
Connect and bind to the LDAP server.

File

./SimpleLdap.class.php, line 328
Class defining base Simple LDAP functionallity.

Class

SimpleLdap
Simple LDAP class.

Code

public static function ldap_bind($link_identifier, $bind_rdn = NULL, $bind_password = NULL) {

  // Devel debugging.
  if (variable_get('simple_ldap_devel', FALSE)) {
    dpm(__FUNCTION__);
    dpm(array(
      '$bind_rdn' => $bind_rdn,
      '$bind_password' => $bind_password,
    ));
  }

  // Wrapped function call.
  $return = @ldap_bind($link_identifier, $bind_rdn, $bind_password);

  // Debugging.
  if (variable_get('simple_ldap_debug', FALSE)) {
    $message = __FUNCTION__ . '($link_identifier = @link_identifier, $bind_rdn = @bind_rdn, $bind_password = @bind_password) returns @return';
    $variables = array(
      '@link_identifier' => print_r($link_identifier, TRUE),
      '@bind_rdn' => print_r($bind_rdn, TRUE),
      '@bind_password' => print_r($bind_password, TRUE),
      '@return' => print_r($return, TRUE),
    );
    watchdog('simple_ldap', $message, $variables, WATCHDOG_DEBUG);
  }
  return $return;
}