分类: LINUX
2013-03-29 11:20:53
原文地址:openldap之schema详解 作者:cctv_ming
OID | Assignment |
1.1 | Organization's OID |
1.1.1 | SNMP Elements |
1.1.2 | LDAP Elements |
1.1.2.1 | AttributeTypes |
1.1.2.1.1 | myAttribute |
1.1.2.2 | ObjectClasses |
1.1.2.2.1 | myObjectClass |
# include schema(译者:ubuntu中的ldap安装位置稍有不一样,不可完全按照这个例子粘贴。)
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
# include local schema
include /usr/local/etc/openldap/schema/local.schema
AttributeTypeDescription = "(" whspwhsp是空格的意思(' ')。numericoid 是全局唯一的 OID,是带.的十进制形式 (e.g. 1.1.0), qdescrs有一个或几个意思, woid 可以使名称或者是 OID 可选择的一定长度的后缀(e.g {10})。
numericoid whsp ; AttributeType identifier
[ "NAME" qdescrs ] ; name used in AttributeType
[ "DESC" qdstring ] ; description
[ "OBSOLETE" whsp ]
[ "SUP" woid ] ; derived from this other
; AttributeType
[ "EQUALITY" woid ; Matching Rule name
[ "ORDERING" woid ; Matching Rule name
[ "SUBSTR" woid ] ; Matching Rule name
[ "SYNTAX" whsp noidlen whsp ] ; Syntax OID
[ "SINGLE-VALUE" whsp ] ; default multi-valued
[ "COLLECTIVE" whsp ] ; default not collective
[ "NO-USER-MODIFICATION" whsp ]; default user modifiable
[ "USAGE" whsp AttributeUsage ]; default userApplications
whsp ")"
AttributeUsage =
"userApplications" /
"directoryOperation" /
"distributedOperation" / ; DSA-shared
"dSAOperation" ; DSA-specific, value depends on server
attributeType ( 2.5.4.41 NAME 'name'
DESC 'name(s) associated with the object'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )
attributeType ( 2.5.4.3 NAME ( 'cn' 'commonName' )
DESC 'common name(s) assciated with the object'
SUP name )
Name | OID | Description |
boolean | 1.3.6.1.4.1.1466.115.121.1.7 | boolean value |
directoryString | 1.3.6.1.4.1.1466.115.121.1.15 | Unicode (UTF-8) string |
distinguishedName | 1.3.6.1.4.1.1466.115.121.1.12 | LDAP DN |
integer | 1.3.6.1.4.1.1466.115.121.1.27 | integer |
numericString | 1.3.6.1.4.1.1466.115.121.1.36 | numeric string |
OID | 1.3.6.1.4.1.1466.115.121.1.38 | object identifier |
octetString | 1.3.6.1.4.1.1466.115.121.1.40 | arbitary octets |
Name | Type | Description |
booleanMatch | equality | boolean |
caseIgnoreMatch | equality | case insensitive, space insensitive |
caseIgnoreOrderingMatch | ordering | case insensitive, space insensitive |
caseIgnoreSubstringsMatch | substrings | case insensitive, space insensitive |
caseExactMatch | equality | case sensitive, space insensitive |
caseExactOrderingMatch | ordering | case sensitive, space insensitive |
caseExactSubstringsMatch | substrings | case sensitive, space insensitive |
distinguishedNameMatch | equality | distinguished name |
integerMatch | equality | integer |
integerOrderingMatch | ordering | integer |
numericStringMatch | equality | numerical |
numericStringOrderingMatch | ordering | numerical |
numericStringSubstringsMatch | substrings | numerical |
octetStringMatch | equality | octet string |
octetStringOrderingStringMatch | ordering | octet string |
octetStringSubstringsStringMatch | ordering | octet string |
objectIdentiferMatch | equality | object identifier |
attributetype ( 1.1.2.1.1 NAME 'myUniqueName'但是,如果我们要使name属性包含一个断言,这个属性可以被定义为name的子属性。
DESC 'unique name with my organization'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.1.2.1.1 NAME 'myUniqueName'(2)myPhoto
DESC 'unique name with my organization'
SUP name )
attributetype ( 1.1.2.1.2 NAME 'myPhoto'在这,语法中并没有置顶photo的格式(format),这里假设访问属性的应用可以对其值进行处理。
DESC 'a photo (application defined format)'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
SINGLE-VALUE )
attributetype ( 1.1.2.1.3 NAME 'myPhotoURI'
DESC 'URI and optional label referring to a photo'
SUP labeledURI )
objectclass < Object Class Description>Object Class Description由下面的BNF定义:
ObjectClassDescription = "(" whsp(1)myPhotoObject
numericoid whsp ; ObjectClass identifier
[ "NAME" qdescrs ]
[ "DESC" qdstring ]
[ "OBSOLETE" whsp ]
[ "SUP" oids ] ; Superior ObjectClasses
[ ( "ABSTRACT" / "STRUCTURAL" / "AUXILIARY" ) whsp ]
; default structural
[ "MUST" oids ] ; AttributeTypes
[ "MAY" oids ] ; AttributeTypes
whsp ")"
objectclass ( 1.1.2.2.1 NAME 'myPhotoObject'
DESC 'mixin myPhoto'
AUXILIARY
MAY myPhoto )
objectclass ( 1.1.2.2.2 NAME 'myPerson'对象类集成了inetOrgPerson 的required/allowed属性类型。但是需要 (requires) myUniqueName,givenName和allows myPhoto。
DESC 'my person'
SUP inetOrgPerson
MUST ( myUniqueName $ givenName )
MAY myPhoto )
objectIdentifier{ | [: ] }
objectIdentifier myOID 1.1
objectIdentifier mySNMP myOID:1
objectIdentifier myLDAP myOID:2
objectIdentifier myAttributeType myLDAP:1
objectIdentifier myObjectClass myLDAP:2
attributetype ( myAttributeType:3 NAME 'myPhotoURI'
DESC 'URI and optional label referring to a photo'
SUP labeledURI )
objectclass ( myObjectClass:1 NAME 'myPhotoObject'
DESC 'mixin myPhoto'
AUXILIARY
MAY myPhoto )