API(3)

NAME
  Mozilla::LDAP::API - Perl methods for LDAP C API calls

SYNOPSIS
  use Mozilla::LDAP::API;
       or
  use Mozilla::LDAP::API qw(:api :ssl :constant);
       or
  use Mozilla::LDAP::API qw(:api :ssl :apiv3 :constant);

DESCRIPTION
This package offers a direct interface to the LDAP C API calls from Perl. It is used internally by the other Mozilla::LDAP modules. It is highly suggested that you use the object oriented interface in Mozilla::LDAP::Conn and Mozilla::LDAP::Entry unless you need to use asynchronous calls or other functionality not available in the OO interface.

THIS DOCUMENT
This document has a number of known errors that will be corrected in the next revision. Since it is not expected that users will need to use this interface frequently, priority was placed on other documents. You can find examples of how to actually use the API calls under the test_api directory.

CREATING AN ADD/MODIFY HASH
For the add and modify routines you will need to generate a list of attributes and values.

You will do this by creating a HASH table. Each attribute in the hash contains associated values. These values can be one of three things.

  - SCALAR VALUE    (ex. "Clayton Donley")
  - ARRAY REFERENCE (ex. ["Clayton Donley","Clay Donley"])
  - HASH REFERENCE  (ex. {"r",["Clayton Donley"]}
       note:  the value inside the HASH REFERENCE must currently
               be an ARRAY REFERENCE.
The key inside the HASH REFERENCE must be one of the following for a modify operation:
  - "a" for LDAP_MOD_ADD (Add these values to the attribute)
  - "r" for LDAP_MOD_REPLACE (Replace these values in the attribute)
  - "d" for LDAP_MOD_DELETE (Delete these values from the attribute)

Additionally, in add and modify operations, you may specify "b" if the attributes you are adding are BINARY (ex. "rb" to replace binary).

Currently, it is only possible to do one operation per add/modify operation, meaning you can't do something like:

   {"d",["Clayton"],"a",["Clay"]}   <-- WRONG!
Using any combination of the above value types, you can do things like:

%ldap_modifications = (
   "cn", "Clayton Donley", # Replace 'cn' values
   "givenname", ["Clayton","Clay"], # Replace 'givenname' values
   "mail", {"a",["donley\@cig.mcel.mot.com"], #Add 'mail' values
   "jpegphoto", {"rb",[$jpegphotodata]}, # Replace Binary jpegPhoto );

Then remember to call the add or modify operations with a REFERENCE to this HASH.

API Methods
The following are the available API methods for Mozilla::LDAP::API. Many of these items have bad examples and OUTPUT information. Other information should be correct. DESCRIPTION:

Abandon an asynchronous LDAP operation

INPUT:
  ld - LDAP Session Handle
  msgid - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_abandon($ld,$msgid);
DESCRIPTION:

Abandon an asynchronous LDAP operation w/ Controls

INPUT:
  ld - LDAP Session Handle
  msgid - Integer
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_abandon_ext($ld,$msgid,$serverctrls,$clientctrls);
DESCRIPTION:

Asynchronously add a LDAP entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  attrs - LDAP Add/Modify Hash

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_add($ld,$dn,$attrs);
DESCRIPTION:

Asynchronously add a LDAP entry w/ Controls

INPUT:
  ld - LDAP Session Handle
  dn - String
  attrs - LDAP Add/Modify Hash
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  msgidp - Integer

OUTPUT:
  status - Integer
  msgidp - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_add_ext($ld,$dn,$attrs,$serverctrls,$clientctrls,$msgidp);
DESCRIPTION:

Synchronously add a LDAP entry w/ Controls

INPUT:
  ld - LDAP Session Handle
  dn - String
  attrs - LDAP Add/Modify Hash
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_add_ext_s($ld,$dn,$attrs,$serverctrls,$clientctrls);
DESCRIPTION:

Synchronously add a LDAP entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  attrs - LDAP Add/Modify Hash

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_add_s($ld,$dn,$attrs);
DESCRIPTION:

Free a BER element pointer

INPUT:
  ber - BER Element Pointer
  freebuf - Integer

OUTPUT:
  status - NONE

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_ber_free($ber,$freebuf);
DESCRIPTION:

Asynchronously bind to the LDAP server

INPUT:
  ld - LDAP Session Handle
  dn - String
  passwd - String
  authmethod - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_bind($ld,$dn,$passwd,$authmethod);
DESCRIPTION:

Synchronously bind to a LDAP server

INPUT:
  ld - LDAP Session Handle
  dn - String
  passwd - String
  authmethod - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_bind_s($ld,$dn,$passwd,$authmethod);
DESCRIPTION:

Asynchronously compare an attribute/value pair and an entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  attr - String
  value - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_compare($ld,$dn,$attr,$value);
DESCRIPTION:

Asynchronously compare an attribute/value pair and an entry w/ Controls

INPUT:
  ld - LDAP Session Handle
  dn - String
  attr - String
  bvalue - Binary String
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  msgidp - Integer

OUTPUT:
  status - Integer
  msgidp - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_compare_ext($ld,$dn,$attr,$bvalue,$serverctrls,$clientctrls,$msgidp);
DESCRIPTION:

Synchronously compare an attribute/value pair to an entry w/ Controls

INPUT:
  ld - LDAP Session Handle
  dn - String
  attr - String
  bvalue - Binary String
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_compare_ext_s($ld,$dn,$attr,$bvalue,$serverctrls,$clientctrls);
DESCRIPTION:

Synchronously compare an attribute/value pair to an entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  attr - String
  value - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_compare_s($ld,$dn,$attr,$value);
DESCRIPTION:

Free a LDAP control pointer

INPUT:
  ctrl - LDAP Control Pointer

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_control_free($ctrl);
DESCRIPTION:

Count the number of LDAP controls in a LDAP Control List

INPUT:
  ctrls - LDAP Control List Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_controls_count($ctrls);
DESCRIPTION:

Free a list of LDAP controls

INPUT:
  ctrls - LDAP Control List Pointer

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_controls_free($ctrls);
DESCRIPTION:

Count the number of LDAP entries returned

INPUT:
  ld - LDAP Session Handle
  result - LDAP Message Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $count = ldap_count_entries($ld,$result);
DESCRIPTION:

Count the number of LDAP messages returned

INPUT:
  ld - LDAP Session Handle
  result - LDAP Message Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_count_messages($ld,$result);
DESCRIPTION:

Count the number of LDAP references returned

INPUT:
  ld - LDAP Session Handle
  result - LDAP Message Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_count_references($ld,$result);
DESCRIPTION:

Create a LDAP search filter

INPUT:
  buf - String
  buflen - Integer
  pattern - String
  prefix - String
  suffix - String
  attr - String
  value - String
  valwords - List Reference

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_create_filter($buf,$buflen,$pattern,$prefix,$suffix,$attr,$value,$valwords);
DESCRIPTION:

Create a persistent search control

INPUT:
  ld - LDAP Session Handle
  changetypes - Integer
  changesonly - Integer
  return_echg_ctrls - Integer
  ctrl_iscritical - Integer
  ctrlp - LDAP Control List Pointer

OUTPUT:
  status - Integer
  ctrlp - LDAP Control List Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_create_persistentsearch_control($ld,$changetypes,$changesonly,$return_echg_ctrls,$ctrl_iscritical,$ctrlp);
DESCRIPTION:

Create a LDAP sort control

INPUT:
  ld - LDAP Session Handle
  sortKeyList - Sort Key Pointer
  ctrl_iscritical - Integer
  ctrlp - LDAP Control List Pointer

OUTPUT:
  status - Integer
  ctrlp - LDAP Control List Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_create_sort_control($ld,$sortKeyList,$ctrl_iscritical,$ctrlp);
DESCRIPTION:

Create a list of keys to be used by a sort control

INPUT:
  sortKeyList - Sort Key Pointer
  string_rep - String

OUTPUT:
  status - Integer
  sortKeyList - Sort Key Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_create_sort_keylist($sortKeyList,$string_rep);
DESCRIPTION:

Create a LDAP virtual list control

INPUT:
  ld - LDAP Session Handle
  ctrlp - LDAP Control List Pointer

OUTPUT:
  status - Integer
  ctrlp - LDAP Control List Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_create_virtuallist_control($ld,$ldvlistp,$ctrlp);
DESCRIPTION:

Asynchronously delete a LDAP entry

INPUT:
  ld - LDAP Session Handle
  dn - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_delete($ld,$dn);
DESCRIPTION:

Asynchronously delete a LDAP entry w/ Controls

INPUT:
  ld - LDAP Session Handle
  dn - String
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  msgidp - Integer

OUTPUT:
  status - Integer
  msgidp - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_delete_ext($ld,$dn,$serverctrls,$clientctrls,$msgidp);
DESCRIPTION:

Synchronously delete a LDAP entry w/ Controls

INPUT:
  ld - LDAP Session Handle
  dn - String
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_delete_ext_s($ld,$dn,$serverctrls,$clientctrls);
DESCRIPTION:

Synchronously delete a LDAP entry

INPUT:
  ld - LDAP Session Handle
  dn - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_delete_s($ld,$dn);
DESCRIPTION:

Change a DN to a "Friendly" name

INPUT:
  dn - String

OUTPUT:
  status - String

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_dn2ufn($dn);
DESCRIPTION:

Return the string value of a LDAP error code

INPUT:
  err - Integer

OUTPUT:
  status - String

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_err2string($err);
DESCRIPTION:

Split a given DN into its components. Setting 'notypes' to 1 returns the components without their type names.

INPUT:
  dn - String
  notypes - Integer

OUTPUT:
  status - NONE

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_explode_dn($dn,$notypes);
DESCRIPTION:

Split a Relative DN into its components

INPUT:
  dn - String
  notypes - Integer

OUTPUT:
  status - NONE

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_explode_rdn($dn,$notypes);
DESCRIPTION:

Perform an asynchronous extended operation

INPUT:
  ld - LDAP Session Handle
  requestoid - String
  requestdata - Binary String
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  msgidp - Integer

OUTPUT:
  status - Integer
  msgidp - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_extended_operation($ld,$requestoid,$requestdata,$serverctrls,$clientctrls,$msgidp);
DESCRIPTION:

Perform a synchronous extended operation

INPUT:
  ld - LDAP Session Handle
  requestoid - String
  requestdata - Binary String
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  retoidp - String

OUTPUT:
  status - Integer
  retoidp - Return OID
  retdatap - Return Data

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_extended_operation_s($ld,$requestoid,$requestdata,$serverctrls,$clientctrls,$retoidp,$retdatap);
DESCRIPTION:

Return the first attribute returned for a LDAP entry

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer
  ber - Ber Element Pointer

OUTPUT:
  status - String
  ber - Ber Element Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_first_attribute($ld,$entry,$ber);
DESCRIPTION:

Return the first entry in a LDAP result chain

INPUT:
  ld - LDAP Session Handle
  chain - LDAP Message Pointer

OUTPUT:
  status - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_first_entry($ld,$chain);
DESCRIPTION:

Return the first message in a LDAP result

INPUT:
  ld - LDAP Session Handle
  res - LDAP Message Pointer

OUTPUT:
  status - LDAP Message Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_first_message($ld,$res);
DESCRIPTION:

Return the first reference in a LDAP result

INPUT:
  ld - LDAP Session Handle
  res - LDAP Message Pointer

OUTPUT:
  status - LDAP Message Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_first_reference($ld,$res);
DESCRIPTION:

Free a LDAP friendly map pointer

INPUT:
  map - Friendly Map Pointer

OUTPUT:
  status - NONE

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_free_friendlymap($map);
DESCRIPTION:

Free a LDAP sort key pointer

INPUT:
  sortKeyList - Sort Key Pointer

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_free_sort_keylist($sortKeyList);
DESCRIPTION:

Free a LDAP URL description hash reference

INPUT:
  ludp - URL Description Hash Reference

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_free_urldesc($ludp);
DESCRIPTION:

Create a LDAP friendly name map

INPUT:
  filename - String
  name - String
  map - Friendly Map Pointer

OUTPUT:
  status - String

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_friendly_name($filename,$name,$map);
DESCRIPTION:

Return the distinguished name for an entry

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer

OUTPUT:
  status - String

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_get_dn($ld,$entry);
DESCRIPTION:

Return the controls for a LDAP entry

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer
  serverctrlsp - LDAP Control List Pointer

OUTPUT:
  status - Integer
  serverctrlsp - LDAP Control List Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_get_entry_controls($ld,$entry,$serverctrlsp);
DESCRIPTION:

Free a LDAP filter

INPUT:
  lfdp - LDAP Filter Description Pointer

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_getfilter_free($lfdp);
DESCRIPTION:

Get the first generated filter

INPUT:
  lfdp - LDAP Filter Description Pointer
  tagpat - String

OUTPUT:
  status - LDAP Filter Information Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_getfirstfilter($lfdp,$tagpat,$value);
DESCRIPTION:

Get values for an entry

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer
  target - String
  type - String

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_get_lang_values($ld,$entry,$target,$type);
DESCRIPTION:

Get binary values for an entry

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer
  target - String
  type - String

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_get_lang_values_len($ld,$entry,$target,$type);
DESCRIPTION:

INPUT:
  ld - LDAP Session Handle
  m - String Reference (or undef)
  s - String Reference (or undef)

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_get_lderrno($ld,\$m,\$s);
DESCRIPTION:

Get the next generated LDAP filter

INPUT:
  lfdp - LDAP Filter Information Pointer

OUTPUT:
  status - LDAP Filter Information Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_getnextfilter($lfdp);
DESCRIPTION:

Get an option for a LDAP session

INPUT:
  ld - LDAP Session Handle
  option - Integer
  optdata - Integer

OUTPUT:
  status - Integer
  optdata - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_get_option($ld,$option,$optdata);
DESCRIPTION:

Get the values for a LDAP entry and attribute

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer
  target - String

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_get_values($ld,$entry,$target);
DESCRIPTION:

Get the binary values for a LDAP entry and attribute

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer
  target - String

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_get_values_len($ld,$entry,$target);
DESCRIPTION:

Initialize a LDAP session

INPUT:
  host - String
  port - Integer

OUTPUT:
  status - LDAP Session Handle

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_init($host,$port);
DESCRIPTION:

Initialize the LDAP filter generation routines to a filename

INPUT:
  fname - Filename String

OUTPUT:
  status - LDAP Filter Description Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_init_getfilter($fname);
DESCRIPTION:

Initialize the LDAP filter generation routines to a buffer

INPUT:
  buf - String
  buflen - Integer

OUTPUT:
  status - LDAP Filter Description Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_init_getfilter_buf($buf,$buflen);
DESCRIPTION:

Return 1 if an the argument is a valid LDAP URL

INPUT:
  url - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_is_ldap_url($url);
DESCRIPTION:

Destroy a memory cache

INPUT:
  cache - LDAP Memory Cache Pointer

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_memcache_destroy($cache);
DESCRIPTION:

Flush a specific DN from the memory cache

INPUT:
  cache - LDAP Memory Cache Pointer
  dn - String
  scope - Integer

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_memcache_flush($cache,$dn,$scope);
DESCRIPTION:

Get the memory cache for a LDAP session

INPUT:
  ld - LDAP Session Handle
  cachep - LDAP Memory Cache Pointer

OUTPUT:
  status - Integer
  cachep - LDAP Memory Cache Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_memcache_get($ld,$cachep);
DESCRIPTION:

Initialize a LDAP memory cache

INPUT:
  ttl - Integer
  size - Integer
  baseDNs - List Reference
  cachep - LDAP Memory Cache Pointer

OUTPUT:
  status - Integer
  cachep - LDAP Memory Cache Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_memcache_init($ttl,$size,$baseDNs,$cachep);
DESCRIPTION:

Set the LDAP memory cache for the session

INPUT:
  ld - LDAP Session Handle
  cache - LDAP Memory Cache Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_memcache_set($ld,$cache);
DESCRIPTION:

Update the specified memory cache

INPUT:
  cache - LDAP Memory Cache Pointer

OUTPUT:
  status - NONE

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_memcache_update($cache);
DESCRIPTION:

Free memory allocated by the LDAP C API

INPUT:
  p - Pointer

OUTPUT:
  status - NONE

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_memfree($p);
DESCRIPTION:

Asynchronously modify a LDAP entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  mods - LDAP Add/Modify Hash

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_modify($ld,$dn,$mods);
DESCRIPTION:

Asynchronously modify a LDAP entry w/ Controls

INPUT:
  ld - LDAP Session Handle
  dn - String
  mods - LDAP Add/Modify Hash
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  msgidp - Integer

OUTPUT:
  status - Integer
  msgidp - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_modify_ext($ld,$dn,$mods,$serverctrls,$clientctrls,$msgidp);
DESCRIPTION:

Synchronously modify a LDAP entry w/ Controls

INPUT:
  ld - LDAP Session Handle
  dn - String
  mods - LDAP Add/Modify Hash
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_modify_ext_s($ld,$dn,$mods,$serverctrls,$clientctrls);
DESCRIPTION:

Synchronously modify a LDAP entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  mods - LDAP Add/Modify Hash

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_modify_s($ld,$dn,$mods);
DESCRIPTION:

Asynchronously modify the relative distinguished name of an entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  newrdn - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_modrdn($ld,$dn,$newrdn);
DESCRIPTION:

Synchronously modify the relative distinguished name of an entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  newrdn - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_modrdn_s($ld,$dn,$newrdn);
DESCRIPTION:

Asynchronously modify the relative distinguished name of an entry.

INPUT:
  ld - LDAP Session Handle
  dn - String
  newrdn - String
  deleteoldrdn - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_modrdn2($ld,$dn,$newrdn,$deleteoldrdn);
DESCRIPTION:

Synchronously modify the relative distinguished name of an entry.

INPUT:
  ld - LDAP Session Handle
  dn - String
  newrdn - String
  deleteoldrdn - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_modrdn2_s($ld,$dn,$newrdn,$deleteoldrdn);
DESCRIPTION:

Free memory allocated by a LDAP Message

INPUT:
  lm - LDAP Message Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_msgfree($lm);
DESCRIPTION:

Get the message id number from a LDAP message

INPUT:
  lm - LDAP Message Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_msgid($lm);
DESCRIPTION:

Get the message type of a LDAP message

INPUT:
  lm - LDAP Message Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_msgtype($lm);
DESCRIPTION:

Sort entries by multiple keys

INPUT:
  ld - LDAP Session Handle
  chain - LDAP Message Pointer
  attr - List Reference

OUTPUT:
  status - Integer
  chain - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_multisort_entries($ld,$chain,$attr);
DESCRIPTION:

Get the next attribute for a LDAP entry

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer
  ber - Ber Element Pointer

OUTPUT:
  status - String
  ber - BER Element Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_next_attribute($ld,$entry,$ber);
DESCRIPTION:

Get the next entry in the result chain

INPUT:
  ld - LDAP Session Handle
  entry - LDAP Message Pointer

OUTPUT:
  status - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_next_entry($ld,$entry);
DESCRIPTION:

Get the next message in the result chain

INPUT:
  ld - LDAP Session Handle
  msg - LDAP Message Pointer

OUTPUT:
  status - LDAP Message Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_next_message($ld,$msg);
DESCRIPTION:

Get the next reference in the result chain

INPUT:
  ld - LDAP Session Handle
  ref - LDAP Message Pointer

OUTPUT:
  status - LDAP Message Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_next_reference($ld,$ref);
DESCRIPTION:

Parse a LDAP entry change control

INPUT:
  ld - LDAP Session Handle
  ctrls - LDAP Control List Pointer
  chgtypep - Integer
  prevdnp - String
  chgnumpresentp - Integer
  chgnump - Integer

OUTPUT:
  status - Integer
  chgtypep - Integer
  prevdnp - String
  chgnumpresentp - Integer
  chgnump - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_parse_entrychange_control($ld,$ctrls,$chgtypep,$prevdnp,$chgnumpresentp,$chgnump);
DESCRIPTION:

Parse a LDAP extended result

INPUT:
  ld - LDAP Session Handle
  res - LDAP Message Pointer
  retoidp - String
  freeit - Integer

OUTPUT:
  status - Integer
  retoidp - String
  retdatap - Binary List Reference

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_parse_extended_result($ld,$res,$retoidp,$retdatap,$freeit);
DESCRIPTION:

Parse a LDAP Reference

INPUT:
  ld - LDAP Session Handle
  ref - LDAP Message Pointer
  referalsp - List Reference
  serverctrlsp - LDAP Control List Pointer
  freeit - Integer

OUTPUT:
  status - Integer
  referalsp - List Reference
  serverctrlsp - LDAP Control List Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_parse_reference($ld,$ref,$referalsp,$serverctrlsp,$freeit);
DESCRIPTION:

Parse a LDAP result

INPUT:
  ld - LDAP Session Handle
  res - LDAP Message Pointer
  errcodep - Integer
  matcheddnp - String
  errmsgp - String
  referralsp - List Reference
  serverctrlsp - LDAP Control List Pointer
  freeit - Integer

OUTPUT:
  status - Integer
  errcodep - Integer
  matcheddnp - String
  errmsgp - String
  referralsp - List Reference
  serverctrlsp - LDAP Control List Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_parse_result($ld,$res,$errcodep,$matcheddnp,$errmsgp,$referralsp,$serverctrlsp,$freeit);
DESCRIPTION:

Parse the results of an SASL bind operation

INPUT:
  ld - LDAP Session Handle
  res - LDAP Message Pointer
  freeit - Integer

OUTPUT:
  status - Integer
  servercredp -

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_parse_sasl_bind_result($ld,$res,$servercredp,$freeit);
DESCRIPTION:

Parse a LDAP sort control

INPUT:
  ld - LDAP Session Handle
  ctrls - LDAP Control List Pointer
  result - LDAP Message Pointer
  attribute - String

OUTPUT:
  status - Integer
  result - LDAP Message Pointer
  attribute - String

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_parse_sort_control($ld,$ctrls,$result,$attribute);
DESCRIPTION:

Parse a LDAP virtual list control

INPUT:
  ld - LDAP Session Handle
  ctrls - LDAP Control List Pointer
  target_posp - Integer
  list_sizep - Integer
  errcodep - Integer

OUTPUT:
  status - Integer
  target_posp - Integer
  list_sizep - Integer
  errcodep - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_parse_virtuallist_control($ld,$ctrls,$target_posp,$list_sizep,$errcodep);
DESCRIPTION:

Print a LDAP error message

INPUT:
  ld - LDAP Session Handle
  s - String

OUTPUT:
  status - NONE

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_perror($ld,$s);
DESCRIPTION:

Asynchronously rename a LDAP entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  newrdn - String
  newparent - String
  deleteoldrdn - Integer
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  msgidp - Integer

OUTPUT:
  status - Integer
  msgidp - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_rename($ld,$dn,$newrdn,$newparent,$deleteoldrdn,$serverctrls,$clientctrls,$msgidp);
DESCRIPTION:

Synchronously rename a LDAP entry

INPUT:
  ld - LDAP Session Handle
  dn - String
  newrdn - String
  newparent - String
  deleteoldrdn - Integer
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer

OUTPUT:
  status - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_rename_s($ld,$dn,$newrdn,$newparent,$deleteoldrdn,$serverctrls,$clientctrls);
DESCRIPTION:

Get the result for an asynchronous LDAP operation

INPUT:
  ld - LDAP Session Handle
  msgid - Integer
  all - Integer
  timeout - Time in Seconds
  result - LDAP Message Pointer

OUTPUT:
  status - Integer
  result - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_result($ld,$msgid,$all,$timeout,$result);
DESCRIPTION:

Get the error number for a given result

INPUT:
  ld - LDAP Session Handle
  r - LDAP Message Pointer
  freeit - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_result2error($ld,$r,$freeit);
DESCRIPTION:

Asynchronously bind to the LDAP server using a SASL mechanism

INPUT:
  ld - LDAP Session Handle
  dn - String
  mechanism - String
  cred - Binary String
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  msgidp - Integer

OUTPUT:
  status - Integer
  msgidp - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_sasl_bind($ld,$dn,$mechanism,$cred,$serverctrls,$clientctrls,$msgidp);
DESCRIPTION:

Synchronously bind to a LDAP server using a SASL mechanism

INPUT:
  ld - LDAP Session Handle
  dn - String
  mechanism - String
  cred - Binary String
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer

OUTPUT:
  status - Integer
  servercredp -

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_sasl_bind_s($ld,$dn,$mechanism,$cred,$serverctrls,$clientctrls,$servercredp);
DESCRIPTION:

Asynchronously search the LDAP server

INPUT:
  ld - LDAP Session Handle
  base - String
  scope - Integer
  filter - String
  attrs - List Reference
  attrsonly - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_search($ld,$base,$scope,$filter,$attrs,$attrsonly);
DESCRIPTION:

Asynchronously search the LDAP server w/ Controls

INPUT:
  ld - LDAP Session Handle
  base - String
  scope - Integer
  filter - String
  attrs - List Reference
  attrsonly - Integer
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  timeoutp - Time in Seconds
  sizelimit - Integer
  msgidp - Integer

OUTPUT:
  status - Integer
  msgidp - Integer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_search_ext($ld,$base,$scope,$filter,$attrs,$attrsonly,$serverctrls,$clientctrls,$timeoutp,$sizelimit,$msgidp);
DESCRIPTION:

Synchronously search the LDAP server w/ Controls

INPUT:
  ld - LDAP Session Handle
  base - String
  scope - Integer
  filter - String
  attrs - List Reference
  attrsonly - Integer
  serverctrls - LDAP Control List Pointer
  clientctrls - LDAP Control List Pointer
  timeoutp - Time in Seconds
  sizelimit - Integer
  res - LDAP Message Pointer

OUTPUT:
  status - Integer
  res - LDAP Message Pointer

AVAILABILITY: V3

EXAMPLE:

  $status = ldap_search_ext_s($ld,$base,$scope,$filter,$attrs,$attrsonly,$serverctrls,$clientctrls,$timeoutp,$sizelimit,$res);
DESCRIPTION:

Synchronously search the LDAP server

INPUT:
  ld - LDAP Session Handle
  base - String
  scope - Integer
  filter - String
  attrs - List Reference
  attrsonly - Integer
  res - LDAP Message Pointer

OUTPUT:
  status - Integer
  res - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_search_s($ld,$base,$scope,$filter,$attrs,$attrsonly,$res);
DESCRIPTION:

Synchronously search the LDAP server w/ Timeout

INPUT:
  ld - LDAP Session Handle
  base - String
  scope - Integer
  filter - String
  attrs - List Reference
  attrsonly - Integer
  timeout - Time in Seconds
  res - LDAP Message Pointer

OUTPUT:
  status - Integer
  res - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_search_st($ld,$base,$scope,$filter,$attrs,$attrsonly,$timeout,$res);
DESCRIPTION:

Add a prefix and suffix for filter generation

INPUT:
  lfdp - LDAP Filter Description Pointer
  prefix - String
  suffix - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_set_filter_additions($lfdp,$prefix,$suffix);
DESCRIPTION:

Set the LDAP error structure

INPUT:
  ld - LDAP Session Handle
  e - Integer
  m - String
  s - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_set_lderrno($ld,$e,$m,$s);
DESCRIPTION:

Set a LDAP session option

INPUT:
  ld - LDAP Session Handle
  option - Integer
  optdata - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_set_option($ld,$option,$optdata);
DESCRIPTION:

Set the LDAP rebind process

INPUT:
  ld - LDAP Session Handle

OUTPUT:
  status - NONE

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_set_rebind_proc($ld,$rebindproc);
DESCRIPTION:

Asynchronously bind to the LDAP server using simple authentication

INPUT:
  ld - LDAP Session Handle
  who - String
  passwd - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_simple_bind($ld,$who,$passwd);
DESCRIPTION:

Synchronously bind to the LDAP server using simple authentication

INPUT:
  ld - LDAP Session Handle
  who - String
  passwd - String

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_simple_bind_s($ld,$who,$passwd);
DESCRIPTION:

Sort the results of a LDAP search

INPUT:
  ld - LDAP Session Handle
  chain - LDAP Message Pointer
  attr - String

OUTPUT:
  status - Integer
  chain - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_sort_entries($ld,$chain,$attr);
DESCRIPTION:

Asynchronously unbind from the LDAP server

INPUT:
  ld - LDAP Session Handle

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_unbind($ld);
DESCRIPTION:

Synchronously unbind from a LDAP server

INPUT:
  ld - LDAP Session Handle

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_unbind_s($ld);
DESCRIPTION:

Parse a LDAP URL, returning a HASH of its components

INPUT:
  url - String

OUTPUT:
  status -

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_url_parse($url);
DESCRIPTION:

Asynchronously search using a LDAP URL

INPUT:
  ld - LDAP Session Handle
  url - String
  attrsonly - Integer

OUTPUT:
  status - Integer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_url_search($ld,$url,$attrsonly);
DESCRIPTION:

Synchronously search using a LDAP URL

INPUT:
  ld - LDAP Session Handle
  url - String
  attrsonly - Integer
  res - LDAP Message Pointer

OUTPUT:
  status - Integer
  res - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_url_search_s($ld,$url,$attrsonly,$res);
DESCRIPTION:

Synchronously search using a LDAP URL w/ timeout

INPUT:
  ld - LDAP Session Handle
  url - String
  attrsonly - Integer
  timeout - Time in Seconds
  res - LDAP Message Pointer

OUTPUT:
  status - Integer
  res - LDAP Message Pointer

AVAILABILITY: V2/V3

EXAMPLE:

  $status = ldap_url_search_st($ld,$url,$attrsonly,$timeout,$res);

CREDITS
Most of the Perl API module was written by Clayton Donley to interface with C API routines from Netscape Communications Corp., Inc.

BUGS
Documentation needs much work. LDAPv3 calls not tested or supported in this version. NT can not use Perl Rebind processes, must use 'ldap_set_default_rebindproc'. Possible memory leak in ldap_search* is being investigated.

SEE ALSO
the Mozilla::LDAP::Conn manpage, the Mozilla::LDAP::Entry manpage, and the Perl manpage