LDAP:什么是DN(Distinguished Names)

LDAP:什么是DN(Distinguished Names)


DN 与 RDN

在LDAP协议中,DN用于指向一个LDAP对象,DN由一系列RDN(relative distinguished names)组成 ,RDN之间用“逗号”隔开,它是一个键值对,格式为:

attribute=value

下表列出了常见的RDN属性的类型:

String Attribute type
DC Domain Component
CN Common Name
OU Organizational Unit Name
O Organization Name
C

Country Name

UID User Id


以下是一些常见的DN:

CN=Users,DC=lesca,DC=bit

CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=COM

例如:CN=test,OU=developer,DC=domainname,DC=com 

在上面的代码中 cn=test 可能代表一个用户名,ou=developer 代表一个 active directory 中的组织单位。这句话的含义可能就是说明 test 这个对象处在domainname.com 域的 developer 组织单元中。


DN中的保留字符与转义

下表列出了DN中不能使用的保留字符,它们有特殊用途:

Reserved character Description Hex value

space or # character at the beginning of a string

space character at the end of a string
, comma(逗号) 0x2C
+ plus sign 0x2B
" double quote 0x22
\ backslash 0x5C
< left angle bracket 0x3C
> right angle bracket 0x3E
; semicolon 0x3B
LF line feed 0x0A
CR carriage return 0x0D
= equals sign 0x3D
/ forwards slash 0x2F

例如,如果在DN中含有“逗号”需要转义:

CN=Litware,OU=Docs\, Adatum,DC=Fabrikam,DC=COM

又如下面的DN含有“换行符”(CR, 0X0d):

CN=Before\0DAfter,OU=Test,DC=North America,DC=Fabrikam,DC=COM


====================END====================


你可能感兴趣的:(LDAP:什么是DN(Distinguished Names))