1 .TH LDAP_SCHEMA 3 "RELEASEDATE" "OpenLDAP LDVERSION"
3 .\" Copyright 2000-2004 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply. See COPYRIGHT/LICENSE.
6 ldap_str2syntax, ldap_syntax2str, ldap_syntax2name, ldap_syntax_free,
7 ldap_str2matchingrule, ldap_matchingrule2str, ldap_matchingrule2name,
8 ldap_matchingrule_free,
9 ldap_str2attributetype, ldap_attributetype2str,
10 ldap_attributetype2name, ldap_attributetype_free,
11 ldap_str2objectclass, ldap_objectclass2str, ldap_objectclass2name,
12 ldap_objectclass_free,
13 ldap_scherr2str \- Schema definition handling routines
15 OpenLDAP LDAP (libldap, -lldap)
20 #include <ldap_schema.h>
23 LDAPSyntax * ldap_str2syntax(s, code, errp, flags)
31 char * ldap_syntax2str(syn)
33 const LDAPSyntax * syn;
36 const char * ldap_syntax2name(syn)
46 LDAPMatchingRule * ldap_str2matchingrule(s, code, errp, flags)
54 char * ldap_matchingrule2str(mr);
56 const LDAPMatchingRule * mr;
59 const char * ldap_matchingrule2name(mr)
61 LDAPMatchingRule * mr;
64 ldap_matchingrule_free(mr)
66 LDAPMatchingRule * mr;
69 LDAPAttributeType * ldap_str2attributetype(s, code, errp, flags)
77 char * ldap_attributetype2str(at)
79 const LDAPAttributeType * at;
82 const char * ldap_attributetype2name(at)
84 LDAPAttributeType * at;
87 ldap_attributetype_free(at)
89 LDAPAttributeType * at;
92 LDAPObjectClass * ldap_str2objectclass(s, code, errp, flags)
100 char * ldap_objectclass2str(oc)
102 const LDAPObjectClass * oc;
105 const char * ldap_objectclass2name(oc)
107 LDAPObjectClass * oc;
110 ldap_objectclass_free(oc)
112 LDAPObjectClass * oc;
115 char * ldap_scherr2str(code)
119 These routines are used to parse schema definitions in the syntax
120 defined in RFC 2252 into structs and handle these structs. These
121 routines handle four kinds of definitions: syntaxes, matching rules,
122 attribute types and objectclasses. For each definition kind, four
123 routines are provided.
126 takes a definition in RFC 2252 format in argument
128 as a NUL-terminated string and returns, if possible, a pointer to a
129 newly allocated struct of the appropriate kind. The caller is
130 responsible for freeing the struct by calling
132 when not needed any longer. The routine returns NULL if some problem
133 happened. In this case, the integer pointed at by argument
135 will receive an error code (see below the description of
137 for an explanation of the values) and a pointer to a NUL-terminated
138 string will be placed where requested by argument
140 , indicating where in argument
142 the error happened, so it must not be freed by the caller. Argument
144 is a bit mask of parsing options controlling the relaxation of the
145 syntax recognized. The following values are defined:
147 .B LDAP_SCHEMA_ALLOW_NONE
148 strict parsing according to RFC 2252.
150 .B LDAP_SCHEMA_ALLOW_NO_OID
151 permit definitions that do not contain an initial OID.
153 .B LDAP_SCHEMA_ALLOW_QUOTED
154 permit quotes around some items that should not have them.
156 .B LDAP_SCHEMA_ALLOW_DESCR
159 instead of a numeric OID in places where the syntax expect the latter.
161 .B LDAP_SCHEMA_ALLOW_DESCR_PREFIX
162 permit that the initial numeric OID contains a prefix in
166 .B LDAP_SCHEMA_ALLOW_ALL
167 be very liberal, include all options.
169 The structures returned are as follows:
175 typedef struct ldap_schema_extension_item {
176 char *lsei_name; /* Extension name */
177 char **lsei_values; /* Extension values */
178 } LDAPSchemaExtensionItem;
180 typedef struct ldap_syntax {
181 char *syn_oid; /* OID */
182 char **syn_names; /* Names */
183 char *syn_desc; /* Description */
184 LDAPSchemaExtensionItem **syn_extensions; /* Extension */
187 typedef struct ldap_matchingrule {
188 char *mr_oid; /* OID */
189 char **mr_names; /* Names */
190 char *mr_desc; /* Description */
191 int mr_obsolete; /* Is obsolete? */
192 char *mr_syntax_oid; /* Syntax of asserted values */
193 LDAPSchemaExtensionItem **mr_extensions; /* Extensions */
196 typedef struct ldap_attributetype {
197 char *at_oid; /* OID */
198 char **at_names; /* Names */
199 char *at_desc; /* Description */
200 int at_obsolete; /* Is obsolete? */
201 char *at_sup_oid; /* OID of superior type */
202 char *at_equality_oid; /* OID of equality matching rule */
203 char *at_ordering_oid; /* OID of ordering matching rule */
204 char *at_substr_oid; /* OID of substrings matching rule */
205 char *at_syntax_oid; /* OID of syntax of values */
206 int at_syntax_len; /* Suggested minimum maximum length */
207 int at_single_value; /* Is single-valued? */
208 int at_collective; /* Is collective? */
209 int at_no_user_mod; /* Are changes forbidden through LDAP? */
210 int at_usage; /* Usage, see below */
211 LDAPSchemaExtensionItem **at_extensions; /* Extensions */
214 typedef struct ldap_objectclass {
215 char *oc_oid; /* OID */
216 char **oc_names; /* Names */
217 char *oc_desc; /* Description */
218 int oc_obsolete; /* Is obsolete? */
219 char **oc_sup_oids; /* OIDs of superior classes */
220 int oc_kind; /* Kind, see below */
221 char **oc_at_oids_must; /* OIDs of required attribute types */
222 char **oc_at_oids_may; /* OIDs of optional attribute types */
223 LDAPSchemaExtensionItem **oc_extensions; /* Extensions */
229 Some integer fields (those described with a question mark) have a
230 truth value, for these fields the possible values are:
233 The answer to the question is no.
236 The answer to the question is yes.
238 For attribute types, the following usages are possible:
240 .B LDAP_SCHEMA_USER_APPLICATIONS
241 the attribute type is non-operational.
243 .B LDAP_SCHEMA_DIRECTORY_OPERATION
244 the attribute type is operational and is pertinent to the directory
245 itself, i.e. it has the same value on all servers that master the
246 entry containing this attribute type.
248 .B LDAP_SCHEMA_DISTRIBUTED_OPERATION
249 the attribute type is operational and is pertinent to replication,
250 shadowing or other distributed directory aspect. TBC.
252 .B LDAP_SCHEMA_DSA_OPERATION
253 the attribute type is operational and is pertinent to the directory
254 server itself, i.e. it may have different values for the same entry
255 when retrieved from different servers that master the entry.
257 Object classes can be of three kinds:
259 .B LDAP_SCHEMA_ABSTRACT
260 the object class is abstract, i.e. there cannot be entries of this
263 .B LDAP_SCHEMA_STRUCTURAL
264 the object class is structural, i.e. it describes the main role of the
265 entry. On some servers, once the entry is created the set of
266 structural object classes assigned cannot be changed: none of those
267 present can be removed and none other can be added.
269 .B LDAP_SCHEMA_AUXILIARY
270 the object class is auxiliary, i.e. it is intended to go with other,
271 structural, object classes. These can be added or removed at any time
272 if attribute types are added or removed at the same time as needed by
273 the set of object classes resulting from the operation.
277 return a canonical name for the definition.
281 return a string representation in the format described by RFC 2252 of
282 the struct passed in the argument. The string is a newly allocated
283 string that must be freed by the caller. These routines may return
284 NULL if no memory can be allocated for the string.
287 returns a NUL-terminated string with a text description of the error
288 found. This is a pointer to a static area, so it must not be freed by
289 the caller. The argument
291 comes from one of the parsing routines and can adopt the following
294 .B LDAP_SCHERR_OUTOFMEM
297 .B LDAP_SCHERR_UNEXPTOKEN
300 .B LDAP_SCHERR_NOLEFTPAREN
301 Missing opening parenthesis.
303 .B LDAP_SCHERR_NORIGHTPAREN
304 Missing closing parenthesis.
306 .B LDAP_SCHERR_NODIGIT
309 .B LDAP_SCHERR_BADNAME
312 .B LDAP_SCHERR_BADDESC
315 .B LDAP_SCHERR_BADSUP
318 .B LDAP_SCHERR_DUPOPT
322 Unexpected end of data.
328 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
330 is derived from University of Michigan LDAP 3.3 Release.