NAME
Net::LDAPapi - Perl5 Module Supporting LDAP API
SYNOPSIS
use Net::LDAPapi;See individual items and Example Programs for Usage
DESCRIPTION
This module allows Perl programmers to access and manipulate an LDAPbased Directory.Versions beginning with 1.40 support both the original "C API" andnew "Perl OO" style interface methods. With version 1.42, I've addednamed arguments.
THE INTIAL CONNECTION
All connections to the LDAP server are started by creating a new"blessed object" in the Net::LDAPapi class. This can be done quiteeasily by the following type of statement.$ld = new Net::LDAPapi($hostname);Where $hostname is the name of your LDAP server. If you are not usingthe standard LDAP port (389), you will also need to supply theportnumber.$ld = new Net::LDAPapi($hostname, 15555);The new method can also be called with named arguments.$ld = new Net::LDAPapi(-host=>$hostname, -port=>15389);Instead of the above mentioned argumens -url can be used in thefollowing form$ld = new Net::LDAPapi(-url=>"ldap://host:port");Setting -debug=>"TRUE" will enable more verbose error messages.Note that with named arguments, the order of the arguments isinsignificant.
CONTROLS
In LDAP v3 controls are an additional piece of data, which can besubmitted with most of the requests to the server and returned backattached to the result. Controls, passed to the call, are separatedin two types. The client side controls, which are not passed to theserver and are of not much use. They are denoted by -cctrls namedparameter. The server side controls, denoted by -sctrls namedparameter are actually passed to the server and may affect itsoperation or returned results. Each entry of the result may havecontrols attached to it as well ( see parse_entry(...) call ).-cctrls and -sctrls must be reference to array of controls.To create control call create_control(...) method. Bellow is anexample of creating valsort control.my $asn = Convert::ASN1->new;$asn->prepare('SEQUENCE { b BOOLEAN }');my $berval = $asn->encode(b=>1); # or 1my $ctrl =$ld->create_control(-oid=>Net::LDAPapi::LDAP_CONTROL_VALSORT,-berval=>$berval,-critical=>Net::LDAPapi::CRITICAL);The control is to be freed by calling free_control($ctrl).If contol is attached to results entry, it can be retrieved bycalling parse_result($entry). If no entry is passed toparse_result(...) then current entry is used. It returns hashwith following keysKey Value-------------------matcheddn stringerrmsg stringreferrals array referenceserverctrls array referenceYou can look into content of the control by using get_contol_XXXfunctions like this:local %parsed = $ld->parse_result($entry);local $serverctrls = $parsed{"serverctrls"};local @sctrls = @$serverctrls;if( scalar(@sctrls) > 0 ) {foreach $ctrl (@sctrls) {print "\nreceived control\n";print "oid = ".$ld->get_control_oid($ctrl)."\n";print "berval = ".$ld->get_control_berval($ctrl)."\n";print "critical = ".$ld->get_control_critical($ctrl)."\n";}}
BINDING
After creating a connection to the LDAP server, you may need tobind to the server prior to performing any LDAP related functions.This can be done with the 'bind' methods.An anonymous bind can be performed without arguments:$status = $ld->bind_s;A simple bind can be performed by specifying the DN and PASSWORD ofthe user you are authenticating as:$status = $ld->bind_s($dn, $password);Note that if $password above was "", you would be doing a referencebind, which would return success even if the password in thedirectory was non-null. Thus if you were using the bind to check apassword entered with one in the directory, you should first checkto see if $password was NULL.To perform SASL bind fill in appropriate parameters callingsasl_params(...) and call$status = $ld->bind_s(-type=>LDAP_AUTH_SASL)Bellow is an example of GSSAPI K5 bind parameters.$ld->sasl_parms(-mech=>"GSSAPI", -realm=>"domain.name.com",-authzid=>"", -secprops=>"",-flags=>LDAP_SASL_QUIET);For all of the above operations, you could compare $status toLDAP_SUCCESS to see if the operation was successful.Additionally, you could use 'bind' rather than 'bind_s' if you wantedto use the Asynchronous LDAP routines. The asynchronous routineswould return a MSGID rather than a status. To find the status of anAsynchronous bind, you would need to first obtain the result with acall to $ld->result. See the entry for result later in the man page,as well as the 'ldapwalk.pl' example for further information onobtaining results from Asynchronous operations.The bind operations can also accept named arguments.$status = $ld->bind_s(-dn=>$dn,-password=>$password,-type=>LDAP_AUTH_SIMPLE);As with all other commands that support named arguments, the order ofthe arguments makes no difference.
GENERATING AN ADD/MODIFY HASH
For the add and modify routines you will need to generatea list of attributes and values.You will do this by creating a HASH table. Each attribute in thehash contains associated values. These values can be one of threethings.- 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 currentlybe an ARRAY REFERENCE.The key inside the HASH REFERENCE must be one of the following for amodify 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 theattributes you are adding are BINARY (ex. "rb" to replace binary).Currently, it is only possible to do one operation per add/modifyoperation, 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 tothis HASH. Something like:$ld->modify_s($modify_dn,\%ldap_modifications);
GETTING/SETTING LDAP INTERNAL VALUES
The following methods exist to obtain internal values within aNet::LDAPapi object:o errno - The last error-number returned by the LDAP library for thisconnection.ex: print "Error Number: " . $ld->errno . "\n";o errstring - The string equivalent of 'errno'.ex: print "Error: " . $ld->errstring . "\n";o ld - Reference to the actual internal LDAP structure. Only useful ifyou needed to obtain this pointer for use in non-OO routines.ex: $ldptr = $ld->ld;o entry - Reference to the current entry. Not typically needed, but methodsupplied, just in case.ex: $entry = $ld->entry;o msgid - Get msgid from an LDAP Result.ex: $msgid = $ld->msgid; # msgid of current resultex: $msgid = $ld->msgid($result) # msgid of $resulto msgtype - Get msgtype from an LDAP Result.ex: $msgtype = $ld->msgtype; # msgtype of current resultex: $msgtype = $ld->msgtype($result) # msgtype of $resultThese methods are only useful for GETTING internal information, not settingit. No methods are currently available for SETTING these internal values.
GETTING AND SETTING LDAP SESSION OPTIONS
The get_option and set_option methods can be used to get and set LDAPsession options.The following LDAP options can be set or gotten with these methods:LDAP_OPT_DEREF - DereferenceLDAP_OPT_SIZELIMIT - Maximum Number of Entries to ReturnLDAP_OPT_TIMELIMIT - Timeout for LDAP OperationsLDAP_OPT_REFERRALS - Follow ReferralsFor both get and set operations, the first argument is the relivantoption. In get, the second argument is a reference to a scalar variablethat will contain the current value of the option. In set, the secondargument is the value at which to set this option.Examples:$ld->set_option(LDAP_OPT_SIZELIMIT,50);$ld->get_option(LDAP_OPT_SIZELIMIT,\$size);When setting LDAP_OPT_REFERRALS, the second argument is either LDAP_OPT_ONor LDAP_OPT_OFF. Other options require a number.Both get_option and set_option return 0 on success and non-zero otherwise.
SSL SUPPORT
When compiled with the Mozilla SDK, this module now supports SSL.I do not have an SSL capable server, but I'm told this works. Thefunctions available are:o ssl - Turn on SSL for this connection.Install I/O routines to make SSL over LDAP possibleo ssl_client_init($certdbpath,$certdbhandle)Initialize the secure parts (called only once)Example:$ld = new Net::LDAPapi("host",LDAPS_PORT);$ld->ssl_client_init($certdbpath,$certdbhandle);$ld->ssl;
SETTING REBIND PROCESS
As of version 1.42, rebinding now works properly.The set_rebind_proc method is used to set a PERL function to supply DN,PASSWORD, and AUTHTYPE for use when the server rebinds (for referals,etc...).Usage should be something like:$rebind_ref = \&my_rebind_proc;$ld->set_rebind_proc($rebind_ref);You can then create the procedure specified. It should return 3 values.Example:sub my_rebind_proc{return($dn,$pass,LDAP_AUTH_SIMPLE);}
EXTENDED OPERATIONS
Extended operations are supported.The extended_operation and extended_operation_s methods are used toinvoke extended operations.Example (WHOAMI):%result = ();if ($ld->extended_operation_s(-oid => "1.3.6.1.4.1.4203.1.11.3", -result => \%result) != LDAP_SUCCESS){$ld->perror("ldap_extended_operation_s");exit -1;}Note that WHOAMI is already natively implemented via whoami and whoami_smethods.
SUPPORTED METHODS
- abandon MSGID SCTRLS CCTRLS
-
This cancels an asynchronous LDAP operation that has not completed. Itreturns an LDAP STATUS code upon completion.Example:$status = ldap_abandon($ld, $msgid); # XXX fix this
- add DN ATTR SCTRLS CCTRLS
-
Begins an an asynchronous LDAP Add operation. It returns a MSGID or undefupon completion.Example:%attributes = ("cn", ["Clayton Donley","Clay Donley"] #Add Multivalue cn"sn", "Donley", #Add sn"telephoneNumber", "+86-10-65551234", #Add telephoneNumber"objectClass", ["person","organizationalPerson"],# Add Multivalue objectClass"jpegphoto", {"b",[$jpegphoto]}, # Add Binary jpegphoto);$entrydn = "cn=Clayton Donley, o=Motorola, c=US";$msgid = $ld->add($entrydn, \%attributes);Note that in most cases, you will need to be bound to the LDAP serveras an administrator in order to add users.
- add_s DN ATTR SCTRLS CCTRLS
-
Synchronous version of the 'add' method. Arguments are identicalto the 'add' method, but this operation returns an LDAP STATUS,not a MSGID.Example:$ld->add_s($entrydn, \%attributes);See the section on creating the modify structure for more informationon populating the ATTRIBUTES field for Add and Modify operations.
- bind DN PASSWORD TYPE SCTRLS CCTRLS
-
Asynchronous method for binding to the LDAP server. It returns aMSGID.Examples:$msgid = $ld->bind;$msgid = $ld->bind("cn=Clayton Donley, o=Motorola, c=US", "abc123");
- bind_s DN PASSWORD TYPE SCTRLS CCTRLS
-
Synchronous method for binding to the LDAP server. It returnsan LDAP STATUS.Examples:$status = $ld->bind_s;$status = $ld->bind_s("cn=Clayton Donley, o=Motorola, c=US", "abc123");
- compare DN ATTR VALUE SCTRLS CCTRLS
-
Asynchronous method for comparing a value with the value containedwithin DN. Returns a MSGID or undef.Example:$msgid = $ld->compare("cn=Clayton Donley, o=Motorola, c=US", \$type, $value);
- compare_s DN ATTR VALUE SCTRLS CCTRLS
-
Synchronous method for comparing a value with the value containedwithin DN. Returns an LDAP_COMPARE_TRUE, LDAP_COMPARE_FALSE or an error code.Example:$status = $ld->compare_s("cn=Clayton Donley, o=Motorola, c=US", \$type, $value);
- count_entries
-
Returns the number of entries in an LDAP result chain.Example:$number = $ld->count_entries;
- count_references MSG
-
Return number of references in a given/current message.Example:$number = $ld->count_references
- delete DN
-
Asynchronous method to delete DN. Returns a MSGID or -1 if error.Example:$msgid = $ld->delete("cn=Clayton Donley, o=Motorola, c=US");
- delete_s DN
-
Synchronous method to delete DN. Returns an LDAP STATUS.Example:$status = $ld->delete_s("cn=Clayton Donley, o=Motorola, c=US");
- dn2ufn DN
-
Converts a Distinguished Name (DN) to a User Friendly Name (UFN).Returns a string with the UFN.Since this operation doesn't require an LDAP object to work, youcould technically access the function directly as 'ldap_dn2ufn' ratherthat the object oriented form.Example:$ufn = $ld->dn2ufn("cn=Clayton Donley, o=Motorola, c=US");
- explode_dn DN NOTYPES
-
Splits the DN into an array comtaining the separate components ofthe DN. Returns an Array. NOTYPES is a 1 to remove attributetypes and 0 to retain attribute types.Can also be accessed directly as 'ldap_explode_dn' if no session isinitialized and you don't want the object oriented form.In OpenLDAP this call is depricated.Example:@components = $ld->explode_dn($dn, 0);
- explode_rdn RDN NOTYPES
-
Same as explode_dn, except that the first argument is aRelative Distinguished Name. NOTYPES is a 1 to remove attributetypes and 0 to retain attribute types. Returns an array witheach component.Can also be accessed directly as 'ldap_explode_rdn' if no session isinitialized and you don't want the object oriented form.In OpenLDAP this call is depricated.Example:@components = $ld->explode_rdn($rdn, 0);
- extended_operation OID BERVAL SCTRLS CCTRLS
-
Asynchronous method for invoking an extended operation.Returns a non-negative MSGID upon success.Examples:$msgid = $ld->extended_operation("1.3.6.1.4.1.4203.1.11.3");
- extended_operation_s OID BERVAL SCTRLS CCTRLS RESULT
-
Synchronous method for invoking an extended operation.Returns LDAP_SUCCESS upon success.Examples:$status = $ld->extended_operation_s(-oid => "1.3.6.1.4.1.4203.1.11.3", \-result => \%result);
- first_attribute
-
Returns pointer to first attribute name found in the current entry.Note that this only returning attribute names (ex: cn, mail, etc...).Returns a string with the attribute name.Returns an empty string when no attributes are available.Example:$attr = $ld->first_attribute;
- first_entry
-
Sets internal pointer to the first entry in a chain of results. Returnsan empty string when no entries are available.Example:$entry = $ld->first_entry;
- first_message
-
Return the first message in a chain of result returned by the searchoperation. LDAP search operations return LDAPMessage, which is a headin chain of messages accessable to the user. Not all all of them areentries though. Type of the message can be obtained by callingmsgtype(...) function.
- get_all_entries RESULT
-
Returns result of the search operation in the following format(HASH)dn -> (HASH)key -> (ARRAY)Example:my $all_entries_ref = $ld->get_all_entries;my %all_entries = %$all_entries_ref;foreach (keys %all_entries) {print "<$_> -> <".$all_entries{$_}.">\n";$entry = $all_entries{$_};local %entry_h = %$entry;foreach $k (keys %entry_h) {$values = $entry_h{$k};print " <$k> ->\n";foreach $val (@$values) {print " <$val>\n";}}}
- get_dn MSG
-
Returns a string containing the DN for the specified message or anempty string if an error occurs. If no message is specified thenthen default entry is used.Example:$dn = $ld->get_dn;
- get_entry_controls MSG
-
Returns an array of controls returned with the given entry. If not MSGis given as a paramater then current message/entry is used.Example:my @sctrls = $ld->get_entry_controls($msg);foreach $ctrl (@sctrls) {print "control oid is ".$self->get_control_oid($ctrl)."\n";}
- get_values ATTR
-
Obtain a list of all values associated with a given attribute.Returns an empty list if none are available.Example:@values = $ld->get_values("cn");This would put all the 'cn' values for $entry into the array @values.
- get_values_len ATTR
-
Retrieves a set of binary values for the specified attribute.Example:@values = $ld->get_values_len("jpegphoto");This would put all the 'jpegphoto' values for $entry into the array @values.These could then be written to a file, or further processed.
- is_ldap_url URL
-
Checks to see if a specified URL is a valid LDAP Url. Returns 0 on falseand 1 on true.Example:$isurl = $ld->is_ldap_url("ldap://x500.my.org/o=Org,c=US");
- listen_for_changes BASEDN SCOPE FILTER ATTRS ATTRSONLY TIMEOUT SIZELIMIT COOKIE
-
Experimental function which implements syncrepl API inrefreshAndPersist mode. All but one arguments are the same as in searchfunction. Argument 'cookie' is the special one here. It must be specifiedand is a file name in which cookie is to be stored. On a subsequentrestart of the seach only the newer results will be returned than thoseindicated by the stored cookie. To refresh all entries, one would have toremove that file.This function is to be used in conjunction with next_changed_entries(...),there you will also find example of its usage.
- msgfree
-
Frees the current LDAP result. Returns the type of message freed.Example:$type = $ld->msgfree;
- msgtype MSG
-
Returns the numeric id of a given message. If no MSG is given as a parameterthen current message is used. Following types are recognized: LDAP_RES_BIND,LDAP_RES_SEARCH_ENTRY, LDAP_RES_SEARCH_REFERENCE, LDAP_RES_SEARCH_RESULT,LDAP_RES_MODIFY, LDAP_RES_ADD, LDAP_RES_DELETE, LDAP_RES_MODDN,LDAP_RES_COMPARE, LDAP_RES_EXTENDED, LDAP_RES_INTERMEDIATE, LDAP_RES_ANY,LDAP_RES_UNSOLICITED.Example:$type = $ld->msgtype
- msgtype2str TYPE
-
Returns string representation of a given numeric message type.Example:print "type = ".$ld->msgtype2str($ld->msgtype)."\n";
- modify DN MOD
-
Asynchronous method to modify an LDAP entry. DN is the DN tomodify and MOD contains a hash-table of attributes and values. Ifmultiple values need to be passed for a specific attribute, areference to an array must be passed.Returns the MSGID of the modify operation.Example:%mods = ("telephoneNumber", "", #remove telephoneNumber"sn", "Test", #set SN to TEST"mail", ["me\@abc123.com","me\@second-home.com"], #set multivalue 'mail'"pager", {"a",["1234567"]}, #Add a Pager Value"jpegphoto", {"rb",[$jpegphoto]}, # Replace Binary jpegphoto);$msgid = $ld->modify($entrydn,\%mods);The above would remove the telephoneNumber attribute from the entryand replace the "sn" attribute with "Test". The value in the "mail"attribute for this entry would be replaced with both addressesspecified in @mail. The "jpegphoto" attribute would be replaced withthe binary data in $jpegphoto.
- modify_s DN MOD
-
Synchronous version of modify method. Returns an LDAP STATUS. See themodify method for notes and examples of populating the MODparameter.Example:$status = $ld->modify_s($entrydn,\%mods);
- modrdn2 DN NEWRDN DELETE
-
No longer available. Use function 'rename'.
- modrdn2_s DN NEWRDN DELETE
-
No longer available. Use function 'rename_s'.
- next_attribute
-
Similar to first_attribute, but obtains next attribute.Returns a string comtaining the attribute name. An empty stringis returned when no further attributes exist.Example:$attr = $ld->next_attribute;
- next_changed_entries MSGID ALL TIMEOUT
-
This function is too be used together with listen_for_changes(...) (see above).It returns an array of Entries, which has just changed. Each element in thisarray is a hash reference with two key value pairs, 'entry' which contains usualentry and 'state' which contain one of the following strings 'present', 'add','modify' or 'delete'.Example:my $msgid = $ld->listen_for_changes('', LDAP_SCOPE_SUBTREE, "(cn=Dm*)", NULL, NULL,NULL, NULL, $cookie);while(1) {while( @entries = $ld->next_changed_entries($msgid, 0, -1) ) {foreach $entry (@entries) {print "entry dn is <".$ld->get_dn($entry->{'entry'})."> ".$entry->{'state'}."\n";}}}
- next_entry
-
Moves internal pointer to the next entry in a chain of search results.Example:$entry = $ld->next_entry;
- next_message
-
Moves internal pointer to the next message in a chain of search results.Example:$msg = $ld->next_message;
- parse_result MSG FREEMSG
-
This function is used to retrieve auxiliary data associated with themessage. The return value is a hashtable containing following kevaluepairs.'errcode' -> numeric'matcheddn' -> string'errmsg' -> string'referrals' -> array reference'serverctrls' -> array referenceThe FREEMSG parameter determines whether the parsed message is freedor not after the extraction. Any non-zero value will make it free themessage. The msgfree() routine can also be used to free the messagelater.
- perror MSG
-
If an error occurs while performing an LDAP function, this procedurewill display it. You can also use the err and errstring methods tomanipulate the error number and error string in other ways.Note that this function does NOT terminate your program. You wouldneed to do any cleanup work on your own.Example:$ld->perror("add_s");
- rename DN NEWRDN NEWSUPER DELETE SCTRLS CCTRLS
-
Asynchronous method to change the name of an entry. NEWSUPER is a newparent (superior entry). If set to NULL then only the RDN is changed.Set DELETE to non-zero if you wish to remove the attribute values from theold name. Returns a MSGID.Example:$msgid = $ld->rename("cn=Clayton Donley, o=Motorola, c=US", \"cn=Clay Donley", NULL, 0);
- rename_s DN NEWRDN NEWSUPER DELETE SCTRLS CCTRLS
-
Synchronous method to change the name of an entry. NEWSUPER is a newparent (superior entry). If set to NULL then only the RDN is changed.Set DELETE to non-zero if you wish to remove the attribute values from theold name. Returns a LDAP STATUS.Example:$status = $ld->rename("cn=Clayton Donley, o=Motorola, c=US", \"cn=Clay Donley", NULL, 0);
- result MSGID ALL TIMEOUT
-
Retrieves the result of an operation initiated using an asynchronous LDAPcall. It calls internally ldap_result function. Returns LDAP message orundef if error. Return value of ldap_result call stored in $ld->{"status"}and is set -1 if something wrong happened, 0 if specified timeout wasexceeded or type of the returned message.MSGID is the MSGID returned by the Asynchronous LDAP call. Set ALL to0 to receive entries as they arrive, or non-zero to receive all entriesbefore returning. Set TIMEOUT to the number of seconds to wait for theresult, or -1 for no timeout.Example:$entry = $ld->result($msgid, 0, 1);print "msgtype = ".$ld->msgtype2str($ld->{"status"})."\n";
- result_entry
-
This function is a shortcut for moving pointer along the chain of entriesin the result. It is used instead of first_entry and next_entry functions.Examplewhile( $entry = $ld->result_entry ) {print "dn = ".$ld->get_dn($entry)."\n";}
- result_message
-
This function is a shortcut for moving pointer along the chain of messagesin the result. It is used instead of first_message and next_message functions.Examplewhile( $msg = $ld->result_message ) {$msgtype = $self->msgtype($msg);}
- search BASE SCOPE FILTER ATTRS ATTRSONLY
-
Begins an asynchronous LDAP search. Returns a MSGID or -1 if anerror occurs. BASE is the base object for the search operation.FILTER is a string containing an LDAP search filter. ATTRS is areference to an array containing the attributes to return. Anempty array would return all attributes. ATTRSONLY set to non-zerowill only obtain the attribute types without values.SCOPE is one of the following:LDAP_SCOPE_BASELDAP_SCOPE_ONELEVELLDAP_SCOPE_SUBTREEExample:@attrs = ("cn","sn"); # Return specific attributes@attrs = (); # Return all Attributes$msgid = $ld->search("o=Motorola, c=US", LDAP_SCOPE_SUBTREE, \"(sn=Donley), \@attrs, 0);
- search_s BASE SCOPE FILTER ATTRS ATTRSONLY (rewrite XXX)
-
Performs a synchronous LDAP search. Returns an LDAP STATUS. BASEis the base object for the search operation. FILTER is a stringcontaining an LDAP search filter. ATTRS is a reference to an arraycontaining the attributes to return. An empty array would return allattributes. ATTRSONLY set to non-zero will only obtain the attributetypes without values.SCOPE is one of the following:LDAP_SCOPE_BASELDAP_SCOPE_ONELEVELLDAP_SCOPE_SUBTREEExample:@attrs = ("cn","sn"); # Return specific attributes@attrs = (); # Return all attributes$status = $ld->search_s("o=Motorola, c=US",LDAP_SCOPE_SUBTREE, \"(sn=Donley)",\@attrs,0);
- search_st BASE SCOPE FILTER ATTRS ATTRSONLY TIMEOUT (rewrite/remove XXX)
-
Performs a synchronous LDAP search with a TIMEOUT. See search_sfor a description of parameters. Returns an LDAP STATUS. Results areput into RESULTS. TIMEOUT is a number of seconds to wait before givingup, or -1 for no timeout.Example:$status = $ld->search_st("o=Motorola, c=US",LDAP_SCOPE_SUBTREE, \"(sn=Donley),[],0,3);
- unbind SCTRLS CCTRLS
-
Unbind LDAP connection with specified SESSION handler.Example:$ld->unbind;
- url_parse URL
-
Parses an LDAP URL into separate components. Returns a HASH referencewith the following keys, if they exist in the URL:host - LDAP Hostport - LDAP Portdn - LDAP Base DNattr - LDAP Attributes to Return (ARRAY Reference)filter - LDAP Search Filterscope - LDAP Search Scopeoptions - Mozilla key specifying LDAP over SSLExample:$urlref = $ld->url_parse("ldap://ldap.my.org/o=My,c=US");
- url_search URL ATTRSONLY
-
Perform an asynchronous search using an LDAP URL. URL is the LDAPURL to search on. ATTRSONLY determines whether we are returningthe values for each attribute (0) or only returning the attributenames (1). Results are retrieved and parsed identically to a callto the search method.Returns a non-negative MSGID upon success.Example:$msgid = $ld->url_search($my_ldap_url, 0);
- url_search_s URL ATTRSONLY
-
Synchronous version of the url_search method. Results are retrievedand parsed identically to a call to the search_s method.Returns LDAP_SUCCESS upon success.Example:$status = $ld->url_search_s($my_ldap_url, 0);
- url_search_st URL ATTRSONLY TIMEOUT
-
Similar to the url_search_s method, except that it allows a timeoutto be specified. The timeout is specified as seconds. A timeout of0 specifies an unlimited timeout. Results are retrieved and parsedidentically to a call to the search_st method.Returns LDAP_SUCCESS upon success.Example:$status = $ld->url_search_s($my_ldap_url,0,2);
- whoami SCTRLS CCTRLS
-
Asynchronous method for invoking an LDAP whoami extended operation.Returns a non-negative MSGID upon success.Examples:$msgid = $ld->whoami();
- whoami_s AUTHZID SCTRLS CCTRLS
-
Synchronous method for invoking an LDAP whoami extended operation.Returns LDAP_SUCCESS upon success.Examples:$status = $ld->whoami_s(\$authzid);
AUTHOR
Clayton Donley, [email protected] http://miso.wwa.com/~donley/