⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schema.sdf

📁 ldap服务器源码
💻 SDF
📖 第 1 页 / 共 2 页
字号:
# $OpenLDAP: pkg/openldap-guide/admin/schema.sdf,v 1.39.2.3 2007/01/02 21:43:43 kurt Exp $# Copyright 1999-2007 The OpenLDAP Foundation, All Rights Reserved.# COPYING RESTRICTIONS APPLY, see COPYRIGHT.H1: Schema SpecificationThis chapter describes how to extend the user schema used by{{slapd}}(8).  The chapter assumes the reader is familar with the{{TERM:LDAP}}/{{TERM:X.500}} information model.The first section, {{SECT:Distributed Schema Files}} details optionalschema definitions provided in the distribution and where to obtainother definitions.The second section, {{SECT:Extending Schema}}, details how to definenew schema items.!if 0The third section, {{SECT:Transferring Schema}} details how you canexport schema definitions from an LDAPv3 server and transform itto {{slapd.conf}}(5) format.!endifThis chapter does not discuss how to extend system schema used by{{slapd}}(8) as this requires source code modification.  Systemschema includes all operational attribute types or any object classwhich allows or requires an operational attribute (directly orindirectly).H2: Distributed Schema FilesOpenLDAP is distributed with a set of schema specifications foryour use.  Each set is defined in a file suitable for inclusion(using the {{EX:include}} directive) in your {{slapd.conf}}(5)file.  These schema files are normally installed in the{{F:/usr/local/etc/openldap/schema}} directory.!block table; colaligns="LR"; coltags="F,N"; align=Center; \	title="Table 8.1: Provided Schema Specifications"File			Descriptioncore.schema		OpenLDAP {{core}} (required)cosine.schema		Cosine and Internet X.500 (useful)inetorgperson.schema	InetOrgPerson (useful)misc.schema		Assorted (experimental)nis.schema		Network Information Services (FYI)openldap.schema		OpenLDAP Project (experimental)!endblockTo use any of these schema files, you only need to include thedesired file in the global definitions portion of your{{slapd.conf}}(5) file.  For example:>	# include schema>	include /usr/local/etc/openldap/schema/core.schema>	include /usr/local/etc/openldap/schema/cosine.schema>	include /usr/local/etc/openldap/schema/inetorgperson.schemaAdditional files may be available.  Please consult the OpenLDAPFAQ ({{URL:http://www.openldap.org/faq/}}).Note: You should not modify any of the schema items definedin provided files.H2: Extending SchemaSchema used by {{slapd}}(8) may be extended to support additionalsyntaxes, matching rules, attribute types, and object classes.  Thischapter details how to add user application attribute types andobject classes using the syntaxes and matching rules already supportedby slapd.  slapd can also be extended to support additional syntaxes,matching rules and system schema, but this requires some programmingand hence is not discussed here.There are five steps to defining new schema:^	obtain Object Identifer+	choose a name prefix+	create local schema file+	define custom attribute types (if necessary)+	define custom object classesH3: Object IdentifiersEach schema element is identified by a globally unique {{TERM[expand]OID}}(OID).  OIDs are also used to identify other objects.  They arecommonly found in protocols described by {{TERM:ASN.1}}.  Inparticular, they are heavily used by the {{TERM[expand]SNMP}} (SNMP).As OIDs are hierarchical, your organization can obtain one OID andbranch it as needed.  For example, if your organization were assignedOID {{EX:1.1}}, you could branch the tree as follows:!block table; colaligns="LR"; coltags="EX,N"; align=Center; \	title="Table 8.2: Example OID hierarchy"OID		Assignment1.1		Organization's OID1.1.1		SNMP Elements1.1.2		LDAP Elements1.1.2.1		AttributeTypes1.1.2.1.1	myAttribute1.1.2.2		ObjectClasses1.1.2.2.1	myObjectClass!endblockYou are, of course, free to design a hierarchy suitable to yourorganizational needs under your organization's OID.  No matter whathierarchy you choose, you should maintain a registry of assignmentsyou make.  This can be a simple flat file or something moresophisticated such as the {{OpenLDAP OID Registry}}({{URL:http://www.openldap.org/faq/index.cgi?file=197}}).For more information about Object Identifers (and a listing service)see {{URL:http://www.alvestrand.no/harald/objectid/}}..{{Under no circumstances should you hijack OID namespace!}}To obtain a registered OID at {{no cost}}, apply for an OID underthe {{ORG[expand]IANA}} (IANA) maintained {{Private Enterprise}}arc.  Any private enterprise (organization) may request an OID tobe assigned under this arc.  Just fill out the {{ORG:IANA}} format {{URL: http://www.iana.org/cgi-bin/enterprise.pl}} and yourofficial OID will be sent to you usually within a few days.  Yourbase OID will be something like {{EX:1.3.6.1.4.1.X}} where {{EX:X}}is an integer.Note: Don't let the "MIB/SNMP" statement on the IANA page confuseyou.  OIDs obtained using this form may be used for any purposeincluding identifying LDAP schema elements.Alternatively, OID name space may be available from a nationalauthority (e.g., {{ORG:ANSI}}, {{ORG:BSI}}).H3: Name PrefixIn addition to assigning a unique object identifier to each schemaelement, you should provide a least one textual name for eachelement.  The name should be both descriptive and not likely toclash with names of other schema elements.  In particular, any nameyou choose should not clash with present or future Standard Tracknames.To reduce (but not eliminate) the potential for name clashes, theconvention is to prefix names of non-Standard Track with a fewletters to localize the changes to your organization.  The smallerthe organization, the longer your prefix should be.In the examples below, we have chosen a short prefix '{{EX:my}}'(to save space).  Such a short prefix would only be suitable for avery large, global organization.  In general, we recommend somethinglike '{{EX:deFirm}}' (German company) or '{{EX:comExample}}' (elementsassociated with organization associated with {{EX:example.com}}).H3: Local schema fileThe {{EX:objectclass}} and {{EX:attributeTypes}} configuration filedirectives can be used to define schema rules on entries in thedirectory.  It is customary to create a file to contain definitionsof your custom schema items.  We recommend you create a file{{F:local.schema}} in {{F:/usr/local/etc/openldap/schema/local.schema}}and then include this file in your {{slapd.conf}}(5) file immediatelyafter other schema {{EX:include}} directives.>	# include schema>	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.schemaH3: Attribute Type SpecificationThe {{attributetype}} directive is used to define a new attributetype.  The directive uses the same Attribute Type Description(as defined in {{REF:RFC2252}}) used by the attributeTypesattribute found in the subschema subentry, e.g.:E:	attributetype <{{REF:RFC2252}} Attribute Type Description>where Attribute Type Description is defined by the following{{TERM:BNF}}:>      AttributeTypeDescription = "(" whsp>            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>where whsp is a space ('{{EX: }}'), numericoid is a globally uniqueOID in dotted-decimal form (e.g. {{EX:1.1.0}}), qdescrs is one ormore names, woid is either the name or OID optionally followedby a length specifier (e.g {{EX:{10}}}).For example, the attribute types {{EX:name}} and {{EX:cn}} are definedin {{F:core.schema}} as:>	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 )Notice that each defines the attribute's OID, provides a short name,and a brief description.  Each name is an alias for the OID.{{slapd}}(8) returns the first listed name when returning results.The first attribute, {{EX:name}}, holds values of {{EX:directoryString}}(UTF-8 encoded Unicode) syntax.  The syntax is specified by OID(1.3.6.1.4.1.1466.115.121.1.15 identifies the directoryStringsyntax).  A length recommendation of 32768 is specified.  Serversshould support values of this length, but may support longer valuesThe field does NOT specify a size constraint, so is ignored onservers (such as slapd) which don't impose such size limits.  Inaddition, the equality and substring matching uses case ignorerules.  Below are tables listing commonly used syntax andmatching rules (OpenLDAP supports these and many more).!block table; align=Center; coltags="EX,EX,N"; \	title="Table 8.3: Commonly Used Syntaxes"Name			OID				Descriptionboolean			1.3.6.1.4.1.1466.115.121.1.7	boolean valuedirectoryString		1.3.6.1.4.1.1466.115.121.1.15	Unicode (UTF-8) stringdistinguishedName	1.3.6.1.4.1.1466.115.121.1.12	LDAP DNinteger			1.3.6.1.4.1.1466.115.121.1.27	integernumericString		1.3.6.1.4.1.1466.115.121.1.36	numeric stringOID			1.3.6.1.4.1.1466.115.121.1.38	object identifieroctetString		1.3.6.1.4.1.1466.115.121.1.40	arbitary octets!endblock

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -