版权信息:本文档版权由LDAPChina所有,可随意传播、打印及用于任何用途,必须
保留本文档的所有版权信息及版本信息,同时不可对本文档的任何部分进行任何修改。
版本信息
日期版本描述作者
2004-03-02 v1.0 最初版本 LDAPChina LDAPChina保留随时对本文档的任何部分作出修改,而不事先通知使用者的权利。
The LDAP Data Interchange Format (LDIF) - Technical Specification
LDAP数据交换格式(LDIF)- 技术规范本备忘录的状态(Status of this Memo)
本文档定义了一个用于Internet通讯的Internet标准跟踪协议,为了发展的需要讨论和
建议。对于这个协议的状况和地位请参照Internet官方协议标准("Internet Official Protocol Standards"(STD 1))的当前版。这个备忘录的传播是不受限制的。
版权提示(Copyright Notice)
版权Internet组织(The Internet Society (2000))。所有权利保留。
目录
The LDAP Data Interchange Format (LDIF) - Technical Specification LDAP数据交换格式(LDIF)- 技术规范 (2)
本备忘录的状态(Status of this Memo) (2)
版权提示(Copyright Notice) (2)
摘要(Abstract) (4)
背景和用途(Background and Intended Usage) (4)
LDAP数据交换格式定义(Definition of the LDAP Data Interchange Format) (4)
LDIF范例(Examples of LDAP Data Interchange Format) (10)
范例1:仅有两个条目的简单LDAP文件(Example 1: An simple LDAP file with two
entries) (10)
范例2:包含被拆分属性值的条目的文件(Example 2: A file containing an entry with
a folded attribute value) (10)
范例3:包含base-64编码值的文件(Eample 3: A file containing a base-64-encoded
value) (11)
范例4:包含一个UTF-8编码属性值和语言标签的条目的文件。注释声明了UTF-8
编码属性和dn的内容(Example 4: A file containing an entries with UTF-8-encoded
attribute values, including language tags.  Comments indicate the contents of UTF-8-encoded attributes and distinguished names) (11)
范例5:包含一个外部文件参照的文件(Example 5: A file containing a reference to an
external file) (13)
范例6:包含一系列变更记录和注释的文件(Example 6: A file containing a series of
change records and comments) (13)
范例7:包含一个带有control的变更记录的LDIF文件(Example 7: An LDIF file
containing a change record with a control) (15)
安全考虑(Security Considerations) (15)
感谢(Acknowledgements) (15)
参考书目(References) (16)
作者地址(Authors' Addresses) (16)
完整的版权声明(Full Copyright Statement) (16)
摘要(Abstract)
本文档描述了一种文件格式,该文件格式描述目录信息或描述目录信息的修改。该文件格式称为LDIF(LDAP Data Interchange Format),即LDAP数据交换格式,它一般用于在LDAP目录服务器之间导入、导出目录信息,或者描述应用到目录的一系列修改。
背景和用途(Background and Intended Usage)
交换格式描述了多种情况。例如,某人希望把目录服务器中的内容导出到一个文件中,然后拿到其他的机器上导入另一台目录服务器。
另外,通过使用一种定义完好的交换格式,在原有系统上开发导入工具将是非常便利的。用awk或perl编写的一套相当简单的工具可以将人员信息数据库转换成LDIF文件。这个文件随后可以被导入到其他的目录服务器中,无论这个目录服务器使用的是那种内部数据库。
LDIF格式最初在密歇根大学实现的LDAP服务器中被开发并使用。最一开始LDIF用于描述目录的条目。后来,这种格式被扩展,并允许表达目录条目的改变。
应用程序/目录的MIME(多用途的网际邮件扩充协议)内容类型(content-type)的关系:
应用程序/目录的MIME内容类型(参考文档[1])是一种转换目录信息的通用构架和格式,它不依赖于任何一种特定的目录服务。LDIF格式是一种更简单的格式,可以更易于创建,也可以被当作注释使用,来描述一系列应用于目录的更改。
本文档使用的关键字"MUST","MUST NOT","MAY","SHOULD"和"SHOULD NOT"与参考文档[7]中所描述的含意相同。
LDAP数据交换格式定义(Definition of the LDAP Data Interchange Format)
LDIF格式用于传送目录信息,或者描述一组目录条目的修改,LDIF文件由一系列被行分隔符分开的记录组成。一条记录由一个描述目录条目的行的序列或者由一个描述一组目录条目变化的行的序列组成。一个LDIF文件指定一组目录条目,或者一组应用于目录条目的更改,但二者不能兼顾。
修改目录条目的操作(添加、删除、修改及修改RDN)和下面描述的修改记录的类型
(”add”,”delete”,” modify”及”modrdn”或”moddn”)是一一对应的。这种对应关系是有意安排的,它允许将LDIF更改记录直接翻译成协议操作。
下列定义使用RFC2234(参考文档[4])中定义的扩展Backus-Naur形式。
ldif-file = ldif-content / ldif-changes
ldif-content            =version-spec 1*(1*SEP ldif-attrval-record)
ldif-changes            =version-spec 1*(1*SEP ldif-change-record)
ldif-attrval-record      =dn-spec SEP 1*attrval-spec
ldif-change-record      =dn-spec SEP *control changerecord
version-spec            ="version:" FILL version-number
version-number          =1*DIGIT
; version-number MUST be "1" for the
; LDIF format described in this document.
dn-spec                  ="dn:" (FILL distinguishedName /
":" FILL base64-distinguishedName)
distinguishedName        =SAFE-STRING
; a distinguished name, as defined in [3]
base64-distinguishedName = BASE64-UTF8-STRING
; a distinguishedName which has been base64
; encoded (see note 10, below)
rdn = SAFE-STRING
; a relative distinguished name, defined as
; <name-component> in [3]
base64-rdn = BASE64-UTF8-STRING
; an rdn which has been base64 encoded (see
; note 10, below)
control = "control:" FILL ldap-oid ; controlType
0*1(1*SPACE ("true" / "false")) ; criticality
0*1(value-spec)                ; controlValue
SEP
; (See note 9, below)
ldap-oid                =1*DIGIT 0*1("." 1*DIGIT)
; An LDAPOID, as defined in [4]
attrval-spec = AttributeDescription value-spec SEP
value-spec              =":" (    FILL 0*1(SAFE-STRING) /
":" FILL (BASE64-STRING) /
"<" FILL url)
; See notes 7 and 8, below
url = <a Uniform Resource Locator,
as defined in [6]>
; (See Note 6, below)
AttributeDescription    =AttributeType [";" options]
delete in;
Definition taken from [4]
AttributeType = ldap-oid / (ALPHA *(attr-type-chars))
options                  =option / (option ";" options)
option                  =1*opt-char
attr-type-chars = ALPHA / DIGIT / "-"
opt-char = attr-type-chars
changerecord = "changetype:" FILL
(change-add / change-delete /
change-modify / change-moddn)
change-add = "add" SEP 1*attrval-spec change-delete = "delete" SEP
change-moddn            =("modrdn" / "moddn") SEP
"newrdn:" ( FILL rdn /
":" FILL base64-rdn) SEP
"deleteoldrdn:" FILL ("0" / "1") SEP
0*1("newsuperior:"
(    FILL distinguishedName /
":" FILL base64-distinguishedName) SEP)