Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

x500::dn(3pm) [debian man page]

DN(3pm) 						User Contributed Perl Documentation						   DN(3pm)

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.10.0 2007-07-08 DN(3pm)

Check Out this Related Man Page

LDAP_GET_DN(3)						     Library Functions Manual						    LDAP_GET_DN(3)

NAME
ldap_get_dn, ldap_explode_dn, ldap_explode_rdn, ldap_dn2ufn - LDAP DN handling routines SYNOPSIS
#include <ldap.h> char *ldap_get_dn(ld, entry) LDAP *ld; LDAPMessage *entry; char **ldap_explode_dn(dn, notypes) char *dn; int notypes; char **ldap_explode_rdn(rdn, notypes) char *rdn; int notypes; char *ldap_dn2ufn(dn) char *dn; DESCRIPTION
These routines allow LDAP entry names (Distinguished Names, or DNs) to be obtained, parsed, converted to a user-friendly form, and tested. A DN has the form described in RFC 2253 "Lightweight Directory Access Protocol (v3): UTF-8 String Representation of Distinguished Names". The ldap_get_dn() routine takes an entry as returned by ldap_first_entry(3) or ldap_next_entry(3) and returns a copy of the entry's DN. Space for the DN will be obtained dynamically and should be freed by the caller using ldap_memfree(3). The ldap_explode_dn() routine takes a DN as returned by ldap_get_dn() and breaks it up into its component parts. Each part is known as a Relative Distinguished Name, or RDN. ldap_explode_dn() returns a NULL-terminated array, each component of which contains an RDN from the DN. The notypes parameter is used to request that only the RDN values be returned, not their types. For example, the DN "cn=Bob, c=US" would return as either { "cn=Bob", "c=US", NULL } or { "Bob", "US", NULL }, depending on whether notypes was 0 or 1, respectively. The result can be freed by calling ldap_value_free(3). Similarly, the ldap_explode_rdn() routine takes an RDN as returned by ldap_explode_dn(dn,0) and breaks it up into its "type=value" compo- nent parts (or just "value", if the notypes parameter is set). The result can be freed by calling ldap_value_free(3). ldap_dn2ufn() is used to turn a DN as returned by ldap_get_dn() into a more user-friendly form, stripping off type names. See RFC 1781 "Using the Directory to Achieve User Friendly Naming" for more details on the UFN format. The space for the UFN returned is obtained dynamically and the user is responsible for freeing it via a call to ldap_memfree(3). ERRORS
If an error occurs in ldap_get_dn(), NULL is returned and the ld_errno field in the ld parameter is set to indicate the error. See ldap_error(3) for a description of possible error codes. ldap_explode_dn(), ldap_explode_rdn(), and ldap_dn2ufn() will return NULL with errno(3) set appropriately in case of trouble. NOTES
These routines dyanamically allocate memory that the caller must free. SEE ALSO
ldap(3), ldap_error(3), ldap_first_entry(3), ldap_memfree(3), ldap_value_free(3) ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan LDAP 3.3 Release. OpenLDAP 2.0.27-Release 21 July 2000 LDAP_GET_DN(3)
Man Page