\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[a4paper,scale=0.85]{geometry}

%%  Latex generated from POD in document /usr/lib/perl5/site_perl/5.8.3/Net/LDAP.pod
%%  Using the perl module Pod::LaTeX
%%  Converted on Thu May 27 18:41:45 2004


\usepackage{makeidx}
%\makeindex


\begin{document}

%\tableofcontents

%\clearpage
\section{NAME\label{NAME}\index{NAME}}


Net::LDAP - Lightweight Directory Access Protocol

\section{SYNOPSIS\label{SYNOPSIS}\index{SYNOPSIS}}
\begin{verbatim}
 use Net::LDAP;
\end{verbatim}
\begin{verbatim}
 $ldap = Net::LDAP->new( 'ldap.bigfoot.com' ) or die "$@";
\end{verbatim}
\begin{verbatim}
 $mesg = $ldap->bind ;    # an anonymous bind
\end{verbatim}
\begin{verbatim}
 $mesg = $ldap->search( # perform a search
                        base   => "c=US",
                        filter => "(&(sn=Barr) (o=Texas Instruments))"
                      );
\end{verbatim}
\begin{verbatim}
 $mesg->code && die $mesg->error;
\end{verbatim}
\begin{verbatim}
 foreach $entry ($mesg->all_entries) { $entry->dump; }
\end{verbatim}
\begin{verbatim}
 $mesg = $ldap->unbind;   # take down session
\end{verbatim}
\begin{verbatim}
 $ldap = Net::LDAP->new( 'ldap.umich.edu' );
\end{verbatim}
\begin{verbatim}
 # bind to a directory with dn and password
 $mesg = $ldap->bind( 'cn=root, o=University of Michigan, c=us',
                      password => 'secret'
                    );
\end{verbatim}
\begin{verbatim}
 $result = $ldap->add( 'cn=Barbara Jensen, o=University of Michigan, c=US',
                       attr => [
                         'cn'   => ['Barbara Jensen', 'Barbs Jensen'],
                         'sn'   => 'Jensen',
                         'mail' => 'b.jensen@umich.edu',
                         'objectclass' => ['top', 'person',
                                           'organizationalPerson',
                                           'inetOrgPerson' ],
                       ]
                     );
\end{verbatim}
\begin{verbatim}
 $result->code && warn "failed to add entry: ", $result->error ;
 $mesg = $ldap->unbind;  # take down session
\end{verbatim}
\section{DESCRIPTION\label{DESCRIPTION}\index{DESCRIPTION}}


\textbf{Net::LDAP} is a collection of modules that implements a LDAP
services API for Perl programs. The module may be used to search
directories or perform maintenance functions such as adding, deleting
or modifying entries.



This document assumes that the reader has some knowledge of the LDAP
protocol.

\section{CONSTRUCTOR\label{CONSTRUCTOR}\index{CONSTRUCTOR}}
\begin{description}

\item[new ( HOST, OPTIONS )] \mbox{}

Creates a new \textbf{Net::LDAP} object and opens a connection to the named host.



\texttt{HOST} may be a host name or an IP number. TCP port may be specified
after the host name followed by a colon (such as localhost:10389). The
default TCP port for LDAP is 389.



You can also specify a URI, such as 'ldaps://127.0.0.1:666' or
'ldapi://\%2fvar\%2flib\%2fldap\_sock'. Note that '\%2f's in the LDAPI
socket path will be translated into '/'. This is to support LDAP query
options like base, search etc. although the query part of the URI will
be ignored in this context. If port was not specified in the URI, the
default is either 389 or 636 for 'LDAP' and 'LDAPS' schemes
respectively.



\texttt{HOST} may also be a reference to an array of hosts, host-port pairs
or URIs to try. Each will be tried in order until a connection is
made. Only when all have failed will the result of \texttt{undef} be
returned.

\begin{description}

\item[port =$>$ N] \mbox{}

Port to connect to on the remote server. May be overridden by \texttt{HOST}.


\item[timeout =$>$ N] \mbox{}

Timeout passed to \emph{IO::Socket} when connecting the remote server.
(Default: 120)


\item[multihomed =$>$ N] \mbox{}

Will be passed to \emph{IO::Socket} as the \texttt{MultiHomed} parameter
when connecting to the remote server


\item[debug =$>$ N] \mbox{}

Set the debug level. See the \textsf{debug} method for details.


\item[async =$>$ 1] \mbox{}

Perform all operations asynchronously.


\item[onerror =$>$ 'die' $|$ 'warn' $|$ undef] \textbf{$|$ sub \{ ... \}}

In synchronous mode, change what happens when an error is detected.

\begin{description}

\item['die'] \mbox{}

Net::LDAP will croak whenever an error is detected.


\item['warn'] \mbox{}

Net::LDAP will warn whenever an error is detected.


\item[undef] \mbox{}

Net::LDAP will warn whenever an error is detected and \texttt{-w} is in
effect. The method that was called will return \texttt{undef}.


\item[sub \{ ... \}] \mbox{}

The given sub will be called in a scalar context with a single
argument, the result message. The value returned will be the return
value for the method that was called.

\end{description}

\item[version =$>$ N] \mbox{}

Set the protocol version being used (default is LDAPv3). This is
useful if you want to talk to an old server and therefore have to use
LDAPv2.

\end{description}


Example

\begin{verbatim}
  $ldap = Net::LDAP->new( 'remote.host', async => 1 );
\end{verbatim}


LDAPS connections have some extra valid options, see the
\textsf{start\_tls$|$start\_tls} method for details. Note the default value for
'sslversion' for LDAPS is 'sslv2/3', and the default port for LDAPS
is 636.



For LDAPI connections, HOST is actually the location of a UNIX domain
socket to connect to. The default location is '/var/lib/ldapi'.

\end{description}
\section{METHODS\label{METHODS}\index{METHODS}}


Each of the following methods take as arguments some number of fixed
parameters followed by options, these options are passed in a named
fashion, for example

\begin{verbatim}
  $mesg = $ldap->bind( "cn=me,o=example", password => "mypasswd");
\end{verbatim}


The return value from these methods is an object derived from the
\emph{Net::LDAP::Message} class. The methods of this class allow
you to examine the status of the request.

\begin{description}

\item[abandon ( ID, OPTIONS )] \mbox{}

Abandon a previously issued request. \texttt{ID} may be a number or an
object which is a sub-class of \emph{Net::LDAP::Message}, returned from a
previous method call.

\begin{description}

\item[control =$>$ CONTROL] \mbox{}
\item[control =$>$ [ CONTROL, ... ]] \mbox{}

See \textsf{CONTROLS} below


\item[callback =$>$ CALLBACK] \mbox{}

See \textsf{CALLBACKS} below

\end{description}


\textbf{Example}

\begin{verbatim}
  $res = $ldap->search( @search_args );
\end{verbatim}
\begin{verbatim}
  $mesg = $ldap->abandon( $res ); # This could be written as $res->abandon
\end{verbatim}

\item[add ( DN, OPTIONS )] \mbox{}

Add a new entry to the directory. \texttt{DN} can be either a
\emph{Net::LDAP::Entry} object or a string.

\begin{description}

\item[attrs =$>$ [ ATTR =$>$ VALUE, ... ]] \mbox{}

\texttt{VALUE} should be a string if only a single value is wanted, or a
reference to an array of strings if multiple values are wanted.



This argument is not used if \texttt{DN} is a \emph{Net::LDAP::Entry} object.


\item[control =$>$ CONTROL] \mbox{}
\item[control =$>$ [ CONTROL, ... ]] \mbox{}

See \textsf{CONTROLS} below


\item[callback =$>$ CALLBACK] \mbox{}

See \textsf{CALLBACKS} below

\end{description}


\textbf{Example}

\begin{verbatim}
  # $entry is an object of class Net::LDAP::Entry
  $mesg = $ldap->add( $entry );
\end{verbatim}
\begin{verbatim}
  $mesg = $ldap->add( $dn,
                      attrs => [
                        name  => 'Graham Barr',
                        attr  => 'value1',
                        attr  => 'value2',
                        multi => [qw(value1 value2)]
                      ]
                    );
\end{verbatim}

\item[bind ( DN, OPTIONS )] \mbox{}

Bind (log in) to the server. \texttt{DN} is the DN to bind with. An
anonymous bind may be done by calling bind without any arguments.

\begin{description}

\item[control =$>$ CONTROL] \mbox{}
\item[control =$>$ [ CONTROL, ... ]] \mbox{}

See \textsf{CONTROLS} below


\item[callback =$>$ CALLBACK] \mbox{}

See \textsf{CALLBACKS} below


\item[noauth $|$ anonymous =$>$ 1] \mbox{}

Bind without any password. The value passed with this option is ignored.


\item[password =$>$ PASSWORD] \mbox{}

Bind with the given password.


\item[sasl =$>$ SASLOBJ] \mbox{}

Bind using a SASL mechanism. The argument given should be a sub-class
of \emph{Authen::SASL}.

\end{description}


\textbf{Example}

\begin{verbatim}
  $mesg = $ldap->bind; # Anonymous bind
\end{verbatim}
\begin{verbatim}
  $mesg = $ldap->bind( $dn, password => $password );
\end{verbatim}
\begin{verbatim}
  # $sasl is an object of class Authen::SASL
  $mesg = $ldap->bind( $dn, sasl => $sasl, version => 3 );
\end{verbatim}

\item[compare ( DN, OPTIONS )] \mbox{}

Compare values in an attribute in the entry given by \texttt{DN} on the
server. \texttt{DN} may be a string or a \emph{Net::LDAP::Entry} object.

\begin{description}

\item[attr =$>$ ATTR] \mbox{}

The name of the attribute to compare.


\item[value =$>$ VALUE] \mbox{}

The value to compare with.


\item[control =$>$ CONTROL] \mbox{}
\item[control =$>$ [ CONTROL, ... ]] \mbox{}

See \textsf{CONTROLS} below.


\item[callback =$>$ CALLBACK] \mbox{}

See \textsf{CALLBACKS} below.

\end{description}


\textbf{Example}

\begin{verbatim}
  $mesg = $ldap->compare( $dn,
                          attr  => 'cn',
                          value => 'Graham Barr'
                        );
\end{verbatim}

\item[delete ( DN, OPTIONS )] \mbox{}

Delete the entry given by \texttt{DN} from the server. \texttt{DN} may be a string
or a \emph{Net::LDAP::Entry} object.

\begin{description}

\item[control =$>$ CONTROL] \mbox{}
\item[control =$>$ [ CONTROL, ... ]] \mbox{}

See \textsf{CONTROLS} below.


\item[callback =$>$ CALLBACK] \mbox{}

See \textsf{CALLBACKS} below.

\end{description}


\textbf{Example}

\begin{verbatim}
 $mesg = $ldap->delete( $dn );
\end{verbatim}

\item[moddn ( DN, OPTIONS )] \mbox{}

Rename the entry given by \texttt{DN} on the server. \texttt{DN} may be a string
or a \emph{Net::LDAP::Entry} object.

\begin{description}

\item[newrdn =$>$ RDN] \mbox{}

This value should be a new RDN to assign to \texttt{DN}.


\item[deleteoldrdn =$>$ 1] \mbox{}

This option should be passwd if the existing RDN is to be deleted.


\item[newsuperior =$>$ NEWDN] \mbox{}

If given this value should be the DN of the new superior for \texttt{DN}.


\item[control =$>$ CONTROL] \mbox{}
\item[control =$>$ [ CONTROL, ... ]] \mbox{}

See \textsf{CONTROLS} below.


\item[callback =$>$ CALLBACK] \mbox{}

See \textsf{CALLBACKS} below.

\end{description}


\textbf{Example}

\begin{verbatim}
 $mesg = $ldap->moddn( $dn, newrdn => 'cn=Graham Barr' );
\end{verbatim}

\item[modify ( DN, OPTIONS )] \mbox{}

Modify the contents of the entry given by \texttt{DN} on the server. \texttt{DN}
may be a string or a \emph{Net::LDAP::Entry} object.

\begin{description}

\item[add =$>$ \{ ATTR =$>$ VALUE, ... \}] \mbox{}

Add more attributes or values to the entry. \texttt{VALUE} should be a
string if only a single value is wanted in the attribute, or a
reference to an array of strings if multiple values are wanted.


\item[delete =$>$ [ ATTR, ... ]] \mbox{}

Delete complete attributes from the entry.


\item[delete =$>$ \{ ATTR =$>$ VALUE, ... \}] \mbox{}

Delete individual values from an attribute. \texttt{VALUE} should be a
string if only a single value is being deleted from the attribute, or
a reference to an array of strings if multiple values are being
deleted.


\item[replace =$>$ \{ ATTR =$>$ VALUE, ... \}] \mbox{}

Replace any existing values in each given attribute with
\texttt{VALUE}. \texttt{VALUE} should be a string if only a single value is wanted
in the attribute, or a reference to an array of strings if multiple
values are wanted. A reference to an empty array will remove the
entire attribute.


\item[changes =$>$ [ OP =$>$ [ ATTR =$>$ VALUE] \textbf{], ... ]}

This is an alternative to \textbf{add}, \textbf{delete} and \textbf{replace} where the
whole operation can be given in a single argument. \texttt{OP} should be
\textbf{add}, \textbf{delete} or \textbf{replace}. \texttt{VALUE} should be either a string or a
reference to an array of strings, as before.



Use this form if you want to control the order in which the operations
will be performed.


\item[control =$>$ CONTROL] \mbox{}
\item[control =$>$ [ CONTROL, ... ]] \mbox{}

See \textsf{CONTROLS} below.


\item[callback =$>$ CALLBACK] \mbox{}

See \textsf{CALLBACKS} below.

\end{description}


\textbf{Example}

\begin{verbatim}
 $mesg = $ldap->modify( $dn, add => { sn => 'Barr' } );
\end{verbatim}
\begin{verbatim}
 $mesg = $ldap->modify( $dn, delete => [qw(faxNumber)] );
\end{verbatim}
\begin{verbatim}
 $mesg = $ldap->modify( $dn, delete => { 'telephoneNumber' => '911' } );
\end{verbatim}
\begin{verbatim}
 $mesg = $ldap->modify( $dn, replace => { 'mail' => 'gbarr@pobox.com' } );
\end{verbatim}
\begin{verbatim}
 $mesg = $ldap->modify( $dn,
                        changes => [
                            # add sn=Barr
                          add     => [ sn => 'Barr' ],
                            # delete all fax numbers
                          delete  => [ faxNumber => []],
                            # delete phone number 911
                          delete  => [ telephoneNumber => ['911']],
                            # change email address
                          replace => [ mail => 'gbarr@pobox.com']
                        ]
                      );
\end{verbatim}

\item[search ( OPTIONS )] \mbox{}

Search the directory using a given filter.  This can be used to read
attributes from a single entry, from entries immediately below a
particular entry, or a whole subtree of entries.



The result is an object of class \emph{Net::LDAP::Search}.

\begin{description}

\item[base =$>$ DN] \mbox{}

The DN that is the base object entry relative to which the search is
to be performed.


\item[scope =$>$ 'base' $|$ 'one' $|$ 'sub'] \mbox{}

By default the search is performed on the whole tree below
the specified base object. This maybe changed by specifying a \texttt{scope}
parameter with one of the following values:

\begin{description}

\item[base] \mbox{}

Search only the base object.


\item[one] \mbox{}

Search the entries immediately below the base object.


\item[sub] \mbox{}

Search the whole tree below (and including) the base object. This is
the default.

\end{description}

\item[deref =$>$ 'never' $|$ 'search' $|$ 'find'] \textbf{$|$ 'always'}

By default aliases are dereferenced to locate the base object for the
search, but not when searching subordinates of the base object. This
may be changed by specifying a \texttt{deref} parameter with one of the
following values:

\begin{description}

\item[never] \mbox{}

Do not dereference aliases in searching or in locating the base object
of the search.


\item[search] \mbox{}

Dereference aliases in subordinates of the base object in searching,
but not in locating the base object of the search.


\item[find] \mbox{}

Dereference aliases in locating the base object of the search, but not
when searching subordinates of the base object. This is the default.


\item[always] \mbox{}

Dereference aliases both in searching and in locating the base object
of the search.

\end{description}

\item[sizelimit =$>$ N] \mbox{}

A sizelimit that restricts the maximum number of entries to be returned
as a result of the search. A value of 0, and the default, means that
no restriction is requested.  Servers may enforce a maximum number of
entries to return.


\item[timelimit =$>$ N] \mbox{}

A timelimit that restricts the maximum time (in seconds) allowed for a
search. A value of 0 (the default), means that no timelimit will be
requested.


\item[typesonly =$>$ 1] \mbox{}

Only attribute types (no values) should be returned. Normally
attribute types and values are returned.


\item[filter =$>$ FILTER] \mbox{}

A filter that defines the conditions an entry in the directory must meet
in order for it to be returned by the search. This may be a string or a
\emph{Net::LDAP::Filter} object. Values inside filters may need to be escaped
to avoid security problems; see \emph{Net::LDAP::Filter} for a definition of
the filter format, including the escaping rules.


\item[attrs =$>$ [ ATTR, ... ]] \mbox{}

A list of attributes to be returned for each entry that matches the
search filter.



If not specified, then the server will return the attributes that are
specified as accessible by default given your bind credentials.



Certain additional attributes such as "createTimestamp" and other
operational attributes may also be available for the asking:

\begin{verbatim}
  $mesg = $ldap->search( ... ,
                         attrs => ['createTimestamp']
                       );
\end{verbatim}


To retrieve the default attributes and additional ones, use '*'.

\begin{verbatim}
  $mesg = $ldap->search( ... ,
                         attrs => ['*', 'createTimestamp']
                       );
\end{verbatim}


To retrieve no attributes (the server only returns the DNs of matching
entries), use '1.1':

\begin{verbatim}
  $mesg = $ldap->search( ... ,
                         attrs => ['1.1']
                       );
\end{verbatim}

\item[control =$>$ CONTROL] \mbox{}
\item[control =$>$ [ CONTROL, ... ]] \mbox{}

See \textsf{CONTROLS} below.


\item[callback =$>$ CALLBACK] \mbox{}

See \textsf{CALLBACKS} below.

\end{description}


\textbf{Example}

\begin{verbatim}
 $mesg = $ldap->search(
                        base   => $base_dn,
                        scope  => 'sub',
                        filter => '(|(objectclass=rfc822mailgroup)(sn=jones))'
                      );
\end{verbatim}
\begin{verbatim}
 Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries );
\end{verbatim}

\item[start\_tls ( OPTIONS )] \mbox{}

Calling this method will convert the existing connection to using
Transport Layer Security (TLS), which provides an encrypted
connection. This is \textit{only} possible if the connection uses LDAPv3,
and requires that the server advertizes support for
LDAP\_EXTENSION\_START\_TLS. Use
\textsf{supported\_extension} in \emph{Net::LDAP::RootDSE} to check this.

\begin{description}

\item[verify =$>$ 'none' $|$ 'optional' $|$ 'require'] \mbox{}

How to verify the server's certificate:

\begin{description}

\item[none] \mbox{}

The server may provide a certificate but it will not be checked - this
may mean you are be connected to the wrong server


\item[optional] \mbox{}

Verify only when the server offers a certificate


\item[require] \mbox{}

The server must provide a certificate, and it must be valid.

\end{description}


If you set verify to optional or require, you must also set either
cafile or capath. The most secure option is \textbf{require}.


\item[sslversion =$>$ 'sslv2' $|$ 'sslv3' $|$] \textbf{'sslv2/3' $|$ 'tlsv1'}

This defines the version of the SSL/TLS protocol to use. Defaults to
\textbf{'tlsv1'}.


\item[ciphers =$>$ CIPHERS] \mbox{}

Specify which subset of cipher suites are permissible for this
connection, using the standard OpenSSL string format. The default
value is \textbf{'ALL'}, which permits all ciphers, even those that don't
encrypt.


\item[clientcert =$>$ '/path/to/cert.pem'] \mbox{}
\item[clientkey =$>$ '/path/to/key.pem'] \mbox{}
\item[keydecrypt =$>$ sub \{ ... \}] \mbox{}

If you want to use the client to offer a certificate to the server for
SSL authentication (which is not the same as for the LDAP Bind
operation) then set clientcert to the user's certificate file, and
clientkey to the user's private key file. These files must be in PEM
format.



If the private key is encrypted (highly recommended) then keydecrypt
should be a subroutine that returns the decrypting key. For example:

\begin{verbatim}
 $ldap = Net::LDAP->new( 'myhost.example.com', version => 3 );
 $mesg = $ldap->start_tls(
                           verify => 'require',
                           clientcert => 'mycert.pem',
                           clientkey => 'mykey.pem',
                           keydecrypt => sub { 'secret'; },
                           capath => '/usr/local/cacerts/'
                         );
\end{verbatim}

\item[capath =$>$ '/path/to/servercerts/'] \mbox{}
\item[cafile =$>$ '/path/to/servercert.pem'] \mbox{}

When verifying the server's certificate, either set capath to the
pathname of the directory containing CA certificates, or set cafile to
the filename containing the certificate of the CA who signed the
server's certificate. These certificates must all be in PEM format.



The directory in 'capath' must contain certificates named using the
hash value of the certificates' subject names. To generate these
names, use OpenSSL like this in Unix:

\begin{verbatim}
    ln -s cacert.pem `openssl x509 -hash -noout < cacert.pem`.0
\end{verbatim}


(assuming that the certificate of the CA is in cacert.pem.)

\end{description}

\item[unbind ( )] \mbox{}

The unbind method does not take any parameters and will unbind you
from the server. Some servers may allow you to re-bind or perform
other operations after unbinding. If you wish to switch to another set
of credentials while continuing to use the same connection, re-binding
with another DN and password, without unbind-ing, will generally work.



\textbf{Example}

\begin{verbatim}
 $mesg = $ldap->unbind;
\end{verbatim}
\end{description}


The following methods are for convenience, and do not return
\texttt{Net::LDAP::Message} objects.

\begin{description}

\item[async ( VALUE )] \mbox{}

If \texttt{VALUE} is given the async mode will be set. The previous value
will be returned. The value is \textit{true} if LDAP operations are being
performed asynchronously.


\item[certificate ( )] \mbox{}

Returns an X509\_Certificate object containing the server's
certificate. See the IO::Socket::SSL documentation for information
about this class.



For example, to get the subject name (in a peculiar OpenSSL-specific
format, different from RFC 1779 and RFC 2253) from the server's
certificate, do this:

\begin{verbatim}
    print "Subject DN: " . $ldaps->certificate->subject_name . "\n";
\end{verbatim}

\item[cipher ( )] \mbox{}

Returns the cipher mode being used by the connection, in the string
format used by OpenSSL.


\item[debug ( VALUE )] \mbox{}

If \texttt{VALUE} is given the debug bit-value will be set. The previous
value will be returned. Debug output will be sent to \texttt{STDERR}. The
bits of this value are:

\begin{verbatim}
 1   Show outgoing packets (using asn_hexdump).
 2   Show incoming packets (using asn_hexdump).
 4   Show outgoing packets (using asn_dump).
 8   Show incoming packets (using asn_dump).
\end{verbatim}


The default value is 0.


\item[disconnect ( )] \mbox{}

Disconnect from the server


\item[root\_dse ( OPTIONS )] \mbox{}

The root\_dse method retrieves cached information from the server's
rootDSE.

\begin{description}

\item[attrs =$>$ [ ATTR, ... ]] \mbox{}

A reference to a list of attributes to be returned.
If not specified, then the following attributes will be requested

\begin{verbatim}
  subschemaSubentry
  namingContexts
  altServer
  supportedExtension
  supportedControl
  supportedSASLMechanisms
  supportedLDAPVersion
\end{verbatim}
\end{description}


The result is an object of class \emph{Net::LDAP::RootDSE}.



\textbf{Example}

\begin{verbatim}
 my $root = $ldap->root_dse;
 # get naming Context
 $root->get_value( 'namingContext', asref => 1 );
 # get supported LDAP versions
 $root->supported_version;
\end{verbatim}


As the root DSE may change in certain circumstances - for instance
when you change the connection using start\_tls - you should always use
the root\_dse method to return the most up-to-date copy of the root
DSE.


\item[schema ( OPTIONS )] \mbox{}

Read schema information from the server.



The result is an object of class \emph{Net::LDAP::Schema}.
Read this documentation for further information about methods that
can be performed with this object.

\begin{description}

\item[dn =$>$ DN] \mbox{}

If a DN is supplied, it will become the base object entry from 
which the search for schema information will be conducted.  If
no DN is supplied the base object entry will be determined from
the rootDSE entry.

\end{description}


\textbf{Example}

\begin{verbatim}
 my $schema = $ldap->schema;
 # get objectClasses
 @ocs = $schema->all_objectclasses;
 # Get the attributes
 @atts = $schema->all_attributes;
\end{verbatim}

\item[socket ( )] \mbox{}

Returns the underlying \texttt{IO::Socket} object being used.


\item[sync ( MESG )] \mbox{}

Wait for a given \texttt{MESG} request to be completed by the server. If no
\texttt{MESG} is given, then wait for all outstanding requests to be completed.



Returns an error code defined in \emph{Net::LDAP::Constant}.


\item[version ( )] \mbox{}

Returns the version of the LDAP protocol that is being used.

\end{description}
\section{CONTROLS\label{CONTROLS}\index{CONTROLS}}


Many of the methods described above accept a control option.
This allows the user to pass controls to the server as described
in LDAPv3.



A control is a reference to a HASH and should contain the three
elements below. If any of the controls are blessed then the
method \texttt{to\_asn} will be called which should return a reference
to a HASH containing the three elements described below.

\begin{description}

\item[type =$>$ OID] \mbox{}

This element must be present and is the name of the type of control
being requested.


\item[critical =$>$ FLAG] \mbox{}

critical is optional and should be a boolean value, if it is not specified
then it is assumed to be \textit{false}.


\item[value =$>$ VALUE] \mbox{}

If the control being requested requires a value then this element should
hold the value for the server.

\end{description}
\section{CALLBACKS\label{CALLBACKS}\index{CALLBACKS}}


Most of the above commands accept a callback option. This option
should be a reference to a subroutine. This subroutine will be called
for each packet received from the server as a response to the request
sent.



When the subroutine is called the first argument will be the
\emph{Net::LDAP::Message} object which was returned from the method.



If the request is a search then multiple packets can be received from
the server. Each entry is received as a separate packet. For each of these
the subroutine will be called with a \emph{Net::LDAP::Entry} object as the second
argument.



During a search the server may also send a list of references. When such
a list is received then the subroutine will be called with a
\emph{Net::LDAP::Reference} object as the second argument.

\section{LDAP ERROR CODES\label{LDAP_ERROR_CODES}\index{LDAP ERROR CODES}}


\textbf{Net::LDAP} also exports constants for the error codes that can be received
from the server, see \emph{Net::LDAP::Constant}.

\section{SEE ALSO\label{SEE_ALSO}\index{SEE ALSO}}


\emph{Net::LDAP::Constant},
\emph{Net::LDAP::Control},
\emph{Net::LDAP::Entry},
\emph{Net::LDAP::Filter},
\emph{Net::LDAP::Message},
\emph{Net::LDAP::Reference},
\emph{Net::LDAP::Search},
\emph{Net::LDAP::RFC}



The homepage for the perl-ldap modules can be found at 
http://perl-ldap.sourceforge.net/

\section{ACKNOWLEDGEMENTS\label{ACKNOWLEDGEMENTS}\index{ACKNOWLEDGEMENTS}}


This document is based on a document originally written by Russell Fulton
$<$r.fulton@auckland.ac.nz$>$.



Chris Ridd $<$chris.ridd@isode.com$>$ for the many hours spent
testing and contribution of the ldap* command line utilities.

\section{MAILING LIST\label{MAILING_LIST}\index{MAILING LIST}}


A discussion mailing list is hosted by sourceforge at
$<$perl-ldap@perl.org$>$ No subscription is necessary!

\section{BUGS\label{BUGS}\index{BUGS}}


We hope you do not find any, but if you do please report them to
the mailing list.



If you have a patch, please send it as an attachment to the mailing
list.

\section{AUTHOR\label{AUTHOR}\index{AUTHOR}}


Graham Barr $<$gbarr@pobox.com$>$

\section{COPYRIGHT\label{COPYRIGHT}\index{COPYRIGHT}}


Copyright (c) 1997-2003 Graham Barr. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same
terms as Perl itself.



\textit{\$Id: LDAP.pod,v 1.35 2003/11/10 18:31:04 chrisridd Exp \$}

\printindex

\end{document}
