1 .TH LDAP_SCHEMA 3 "4 June 2000" "OpenLDAP LDVERSION"
3 .\" Copyright 2000-2002 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
20 LDAPSyntax * ldap_str2syntax(s, code, errp, flags)
28 char * ldap_syntax2str(syn)
30 const LDAPSyntax * syn;
33 const char * ldap_syntax2name(syn)
43 LDAPMatchingRule * ldap_str2matchingrule(s, code, errp, flags)
51 char * ldap_matchingrule2str(mr);
53 const LDAPMatchingRule * mr;
56 const char * ldap_matchingrule2name(mr)
58 LDAPMatchingRule * mr;
61 ldap_matchingrule_free(mr)
63 LDAPMatchingRule * mr;
66 LDAPAttributeType * ldap_str2attributetype(s, code, errp, flags)
74 char * ldap_attributetype2str(at)
76 const LDAPAttributeType * at;
79 const char * ldap_attributetype2name(at)
81 LDAPAttributeType * at;
84 ldap_attributetype_free(at)
86 LDAPAttributeType * at;
89 LDAPObjectClass * ldap_str2objectclass(s, code, errp, flags)
97 char * ldap_objectclass2str(oc)
99 const LDAPObjectClass * oc;
102 const char * ldap_objectclass2name(oc)
104 LDAPObjectClass * oc;
107 ldap_objectclass_free(oc)
109 LDAPObjectClass * oc;
112 char * ldap_scherr2str(code)
116 These routines are used to parse schema definitions in the syntax
117 defined in RFC 2252 into structs and handle these structs. These
118 routines handle four kinds of definitions: syntaxes, matching rules,
119 attribute types and objectclasses. For each definition kind, four
120 routines are provided.
123 takes a definition in RFC 2252 format in argument
125 as a NUL-terminated string and returns, if possible, a pointer to a
126 newly allocated struct of the appropriate kind. The caller is
127 responsible for freeing the struct by calling
129 when not needed any longer. The routine returns NULL if some problem
130 happened. In this case, the integer pointed at by argument
132 will receive an error code (see below the description of
134 for an explanation of the values) and a pointer to a NUL-terminated
135 string will be placed where requested by argument
137 , indicating where in argument
139 the error happened, so it must not be freed by the caller. Argument
141 is a bit mask of parsing options controlling the relaxation of the
142 syntax recognized. The following values are defined:
144 .B LDAP_SCHEMA_ALLOW_NONE
145 strict parsing according to RFC 2252.
147 .B LDAP_SCHEMA_ALLOW_NO_OID
148 permit definitions that do not contain an initial OID.
150 .B LDAP_SCHEMA_ALLOW_QUOTED
151 permit quotes around some items that should not have them.
153 .B LDAP_SCHEMA_ALLOW_DESCR
156 instead of a numeric OID in places where the syntax expect the latter.
158 .B LDAP_SCHEMA_ALLOW_DESCR_PREFIX
159 permit that the initial numeric OID contains a prefix in
163 .B LDAP_SCHEMA_ALLOW_ALL
164 be very liberal, include all options.
166 The structures returned are as follows:
172 typedef struct ldap_schema_extension_item {
173 char *lsei_name; /* Extension name */
174 char **lsei_values; /* Extension values */
175 } LDAPSchemaExtensionItem;
177 typedef struct ldap_syntax {
178 char *syn_oid; /* OID */
179 char **syn_names; /* Names */
180 char *syn_desc; /* Description */
181 LDAPSchemaExtensionItem **syn_extensions; /* Extension */
184 typedef struct ldap_matchingrule {
185 char *mr_oid; /* OID */
186 char **mr_names; /* Names */
187 char *mr_desc; /* Description */
188 int mr_obsolete; /* Is obsolete? */
189 char *mr_syntax_oid; /* Syntax of asserted values */
190 LDAPSchemaExtensionItem **mr_extensions; /* Extensions */
193 typedef struct ldap_attributetype {
194 char *at_oid; /* OID */
195 char **at_names; /* Names */
196 char *at_desc; /* Description */
197 int at_obsolete; /* Is obsolete? */
198 char *at_sup_oid; /* OID of superior type */
199 char *at_equality_oid; /* OID of equality matching rule */
200 char *at_ordering_oid; /* OID of ordering matching rule */
201 char *at_substr_oid; /* OID of substrings matching rule */
202 char *at_syntax_oid; /* OID of syntax of values */
203 int at_syntax_len; /* Suggested minimum maximum length */
204 int at_single_value; /* Is single-valued? */
205 int at_collective; /* Is collective? */
206 int at_no_user_mod; /* Are changes forbidden through LDAP? */
207 int at_usage; /* Usage, see below */
208 LDAPSchemaExtensionItem **at_extensions; /* Extensions */
211 typedef struct ldap_objectclass {
212 char *oc_oid; /* OID */
213 char **oc_names; /* Names */
214 char *oc_desc; /* Description */
215 int oc_obsolete; /* Is obsolete? */
216 char **oc_sup_oids; /* OIDs of superior classes */
217 int oc_kind; /* Kind, see below */
218 char **oc_at_oids_must; /* OIDs of required attribute types */
219 char **oc_at_oids_may; /* OIDs of optional attribute types */
220 LDAPSchemaExtensionItem **oc_extensions; /* Extensions */
226 Some integer fields (those described with a question mark) have a
227 truth value, for these fields the possible values are:
230 The answer to the question is no.
233 The answer to the question is yes.
235 For attribute types, the following usages are possible:
237 .B LDAP_SCHEMA_USER_APPLICATIONS
238 the attribute type is non-operational.
240 .B LDAP_SCHEMA_DIRECTORY_OPERATION
241 the attribute type is operational and is pertinent to the directory
242 itself, i.e. it has the same value on all servers that master the
243 entry containing this attribute type.
245 .B LDAP_SCHEMA_DISTRIBUTED_OPERATION
246 the attribute type is operational and is pertinent to replication,
247 shadowing or other distributed directory aspect. TBC.
249 .B LDAP_SCHEMA_DSA_OPERATION
250 the attribute type is operational and is pertinent to the directory
251 server itself, i.e. it may have different values for the same entry
252 when retrieved from different servers that master the entry.
254 Object classes can be of three kinds:
256 .B LDAP_SCHEMA_ABSTRACT
257 the object class is abstract, i.e. there cannot be entries of this
260 .B LDAP_SCHEMA_STRUCTURAL
261 the object class is structural, i.e. it describes the main role of the
262 entry. On some servers, once the entry is created the set of
263 structural object classes assigned cannot be changed: none of those
264 present can be removed and none other can be added.
266 .B LDAP_SCHEMA_AUXILIARY
267 the object class is auxiliary, i.e. it is intended to go with other,
268 structural, object classes. These can be added or removed at any time
269 if attribute types are added or removed at the same time as needed by
270 the set of object classes resulting from the operation.
274 return a canonical name for the definition.
278 return a string representation in the format described by RFC 2252 of
279 the struct passed in the argument. The string is a newly allocated
280 string that must be freed by the caller. These routines may return
281 NULL if no memory can be allocated for the string.
284 returns a NUL-terminated string with a text description of the error
285 found. This is a pointer to a static area, so it must not be freed by
286 the caller. The argument
288 comes from one of the parsing routines and can adopt the following
291 .B LDAP_SCHERR_OUTOFMEM
294 .B LDAP_SCHERR_UNEXPTOKEN
297 .B LDAP_SCHERR_NOLEFTPAREN
298 Missing opening parenthesis.
300 .B LDAP_SCHERR_NORIGHTPAREN
301 Missing closing parenthesis.
303 .B LDAP_SCHERR_NODIGIT
306 .B LDAP_SCHERR_BADNAME
309 .B LDAP_SCHERR_BADDESC
312 .B LDAP_SCHERR_BADSUP
315 .B LDAP_SCHERR_DUPOPT
319 Unexpected end of data.
325 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
327 is derived from University of Michigan LDAP 3.3 Release.