use Net::LDAP::Util qw(ldap_error_text ldap_error_name ldap_error_desc ); $mesg = $ldap->search( .... ); die "Error ",ldap_error_name($mesg) if $mesg->code;
It performs the following operations on the given DN:
OPTIONS is a list of name/value pairs, valid options are:
A Distinguished Name is a sequence of Relative Distinguished Names (RDNs), which themselves are sets of Attributes. For each RDN a hash is constructed with the attribute type names as keys and the attribute values as corresponding values. These hashes are then stored in an array in the order in which they appear in the DN.
For example, the DN 'OU=Sales+CN=J. Smith,DC=example,DC=net' is exploded to:
[
{
'OU' => 'Sales',
'CN' => 'J. Smith'
},
{
'DC' => 'example'
},
{
'DC' => 'net'
}
]
(RFC4514 string) DNs might also contain values, which are the bytes of the
BER encoding of the X.500 AttributeValue rather than some LDAP string syntax.
These values are hex-encoded and prefixed with a #. To distinguish such BER
values, ldap_explode_dn uses references to the actual values,
e.g. '1.3.6.1.4.1.1466.0=#04024869,DC=example,DC=com' is exploded to:
[
{
'1.3.6.1.4.1.1466.0' => ``\004\002Hi''
},
{
'DC' => 'example'
},
{
'DC' => 'com'
}
];
It also performs the following operations on the given DN:
OPTIONS is a list of name/value pairs, valid options are:
Any control characters with an ASCII code < 32 as well as the characters with special meaning in LDAP filters ``*'', ``('', ``)'', and ``\'' the backslash are converted into the representation of a backslash followed by two hex digits representing the hexadecimal value of the character.
Returns the converted list in list mode and the first element in scalar mode.
Converts any sequences of a backslash followed by two hex digits into the corresponding character.
Returns the converted list in list mode and the first element in scalar mode.
The characters ``,'', ``+'', ""``, ''\``, ''<``, ''>``, '';``, ''#``, ''=" with a special meaning in section 2.4 of RFC 4514 are preceded by a backslash. Control characters with an ASCII code < 32 are represented as \hexpair. Finally all leading and trailing spaces are converted to sequences of \20.
Returns the converted list in list mode and the first element in scalar mode.
Any escape sequence starting with a backslash - hexpair or special character - will be transformed back to the corresponding character.
Returns the converted list in list mode and the first element in scalar mode.
For easy cooperation with LDAP queries, the hash keys for the elements used in LDAP search operations are named after the parameters to ``search'' in Net::LDAP.
In extension to RFC 4516, the socket path for URLs with the scheme "ldapi" will be stored in the hash key named "path".
If any element is omitted, the result depends on the setting of the option "defaults".
OPTIONS is a list of key/value pairs with the following keys recognized:
If set to TRUE, default values are returned, with "ldap_url_parse" using the following defaults in extension to RFC 4516.
This is consistent with the behaviour of ``new'' in Net::LDAP.
When set to FALSE, no default values are used.
This leaves all keys in the resulting hash undefined where the corresponding URL element is empty.
To distinguish between an empty base DN and an undefined base DN, "ldap_url_parse" uses the slash between the host:port resp. path part of the URL and the base DN part of the URL. With the slash present, the hash key "base" is set to the empty string, without it, it is left undefined.
Leaving away the "defaults" option entirely is equivalent to setting it to TRUE.
Returns the hash in list mode, or the reference to the hash in scalar mode.
Returns an extended UNIX time or "undef" on error.
Times in years smaller than 1000 will lead to "undef" being returned. This restriction is a direct effect of the year value interpretation rules in Time::Local.
Note: this function depends on Perl's implementation of time and Time::Local. See ``Limits of time_t'' in Time::Local, ``Negative Epoch Values'' in Time::Local, and ``gmtime'' in perlport for restrictions in older versions of Perl.
In extension to UNIX times, TIME may be a floating point number, the decimal part will be used for the resulting generalizedTime.
OPTIONS is a list of key/value pairs. The following keys are recognized:
Returns the generalizedTime string, or "undef" on error.
Times before BC or after year 9999 result in "undef" as they cannot be represented in the generalizedTime format.
Note: this function depends on Perl's implementation of gmtime. See ``Limits of time_t'' in Time::Local, ``Negative Epoch Values'' in Time::Local, and ``gmtime'' in perlport for restrictions in older versions of Perl.
ldap_explode_dn and canonical_dn also
(c) 2002 Norbert Klasen, norbert.klasen@daasi.de, All Rights Reserved.