x500::dn(3) [suse man page]
DN(3) User Contributed Perl Documentation DN(3) NAME
X500::DN - handle X.500 DNs (Distinguished Names), parse and format them SYNOPSIS
use X500::DN; my $dn = X500::DN->ParseRFC2253 ('cn=John Doe, o=Acme\, Inc., c=US') or die; print $dn->getRFC2253String(), " "; $dn = new X500::DN (new X500::RDN ('c'=>'US'), new X500::RDN ('cn'=>'John Doe')); my $rdn0 = $dn->getRDN (0); my $c = $rdn0->getAttributeValue ('c'); NOTE
The RFC 2253 syntax is explicitely backwards in relation to the ASN.1 SEQUENCE. So the RFC 2253 string "cn=John Doe, c=US" has the same meaning as the X.500 string "c=US, cn=John Doe". The X500::DN objects keep the RDNs in X.500 order! DESCRIPTION
This module handles X.500 DNs (Distinguished Names). Currently, it parses DN strings formatted according to RFC 2253 syntax into an internal format and produces RFC 2253 formatted string from it. Methods o $object = new X500::DN (rdn, rdn, ...); Creates a DN object from zero or more arguments of type X500::RDN. o $object = X500::DN->ParseRFC2253 ('cn=John Doe, o=Acme\, Inc., c=US'); Creates a DN object from an RFC 2253 formatted DN string notation. o $object->getRFC2253String(); Returns the DN as a string formatted according to RFC 2253 syntax. o $object->getOpenSSLString(); Returns the DN as a string formatted suitable for "openssl req -subj" and "openssl ca -subj". o $object->getX500String(); Returns the DN as a string formatted according to X.500 syntax. NOTE: This is a hack, there is no definition for a X.500 string syntax! o $object->hasMultivaluedRDNs(); Returns whether the DN contains multi-valued RDNs. o $object->getRDN (num); Returns the DN's RDN at position num as an X500::RDN object. num starts with 0, which will return the first RDN in ASN.1 SEQUENCE order. o $object->getRDNs(); Returns the DN's RDNs, a list of objects of type X500::RDN, in ASN.1 SEQUENCE order. EXPORT None. BUGS
o Due to Parse::RecDescent's greedyness, white space after attribute values gets into the parsed value. It might be possible to work around this. AUTHOR
Robert Joop <yaph-070708@timesink.de> COPYRIGHT
Copyright 2002 Robert Joop. All Rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
X500::RDN, perl. HISTORY
Early 2002: First idea, discussed on comp.lang.perl.moderated April 2002: First public release, 0.15 perl v5.12.1 2007-07-08 DN(3)
Check Out this Related Man Page
Net::LDAP::Util(3) User Contributed Perl Documentation Net::LDAP::Util(3) NAME
Net::LDAP::Util - Utility functions SYNOPSIS
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; DESCRIPTION
Net::LDAP::Util is a collection of utility functions for use with the Net::LDAP modules. FUNCTIONS
ldap_error_name ( ERR ) Returns the name corresponding with ERR. ERR can either be an LDAP error number, or a "Net::LDAP::Message" object containing an error code. If the error is not known the a string in the form "LDAP error code %d(0x%02X)" is returned. ldap_error_text ( ERR ) Returns the text from the POD description for the given error. ERR can either be an LDAP error code, or a "Net::LDAP::Message" object containing an LDAP error code. If the error code given is unknown then "undef" is returned. ldap_error_desc ( ERR ) Returns a short text description of the error. ERR can either be an LDAP error code or a "Net::LDAP::Message" object containing an LDAP error code. canonical_dn ( DN [ , OPTIONS ] ) Returns the given DN in a canonical form. Returns undef if DN is not a valid Distinguished Name. (Note: The empty string "" is a valid DN.) DN can either be a string or reference to an array of hashes as returned by ldap_explode_dn, which is useful when constructing a DN. It performs the following operations on the given DN: o Removes the leading 'OID.' characters if the type is an OID instead of a name. o Escapes all RFC 4514 special characters (",", "+", """, "", "<", ">", ";", "#", "=", " "), slashes ("/"), and any other character where the ASCII code is < 32 as hexpair. o Converts all leading and trailing spaces in values to be 20. o If an RDN contains multiple parts, the parts are re-ordered so that the attribute type names are in alphabetical order. OPTIONS is a list of name/value pairs, valid options are: casefold Controls case folding of attribute type names. Attribute values are not affected by this option. The default is to uppercase. Valid values are: lower Lowercase attribute type names. upper Uppercase attribute type names. This is the default. none Do not change attribute type names. mbcescape If TRUE, characters that are encoded as a multi-octet UTF-8 sequence will be escaped as (hexpair){2,*}. reverse If TRUE, the RDN sequence is reversed. separator Separator to use between RDNs. Defaults to comma (','). ldap_explode_dn ( DN [ , OPTIONS ] ) Explodes the given DN into an array of hashes and returns a reference to this array. Returns undef if DN is not a valid Distinguished Name. 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' => "