1 .TH LDAP_SCHEMA 3 "2008/07/16" "OpenLDAP 2.4.11"
2 .\" $OpenLDAP: pkg/ldap/doc/man/man3/ldap_schema.3,v 1.15.2.4 2008/02/11 23:26:39 kurt Exp $
3 .\" Copyright 2000-2008 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply. See COPYRIGHT/LICENSE.
6 ldap_str2syntax, ldap_syntax2str, ldap_syntax2name, ldap_syntax_free, ldap_str2matchingrule, ldap_matchingrule2str, ldap_matchingrule2name, ldap_matchingrule_free, ldap_str2attributetype, ldap_attributetype2str, ldap_attributetype2name, ldap_attributetype_free, ldap_str2objectclass, ldap_objectclass2str, ldap_objectclass2name, ldap_objectclass_free, ldap_scherr2str \- Schema definition handling routines
8 OpenLDAP LDAP (libldap, -lldap)
13 #include <ldap_schema.h>
16 LDAPSyntax * ldap_str2syntax(s, code, errp, flags)
24 char * ldap_syntax2str(syn)
26 const LDAPSyntax * syn;
29 const char * ldap_syntax2name(syn)
39 LDAPMatchingRule * ldap_str2matchingrule(s, code, errp, flags)
47 char * ldap_matchingrule2str(mr);
49 const LDAPMatchingRule * mr;
52 const char * ldap_matchingrule2name(mr)
54 LDAPMatchingRule * mr;
57 ldap_matchingrule_free(mr)
59 LDAPMatchingRule * mr;
62 LDAPAttributeType * ldap_str2attributetype(s, code, errp, flags)
70 char * ldap_attributetype2str(at)
72 const LDAPAttributeType * at;
75 const char * ldap_attributetype2name(at)
77 LDAPAttributeType * at;
80 ldap_attributetype_free(at)
82 LDAPAttributeType * at;
85 LDAPObjectClass * ldap_str2objectclass(s, code, errp, flags)
93 char * ldap_objectclass2str(oc)
95 const LDAPObjectClass * oc;
98 const char * ldap_objectclass2name(oc)
100 LDAPObjectClass * oc;
103 ldap_objectclass_free(oc)
105 LDAPObjectClass * oc;
108 char * ldap_scherr2str(code)
112 These routines are used to parse schema definitions in the syntax
113 defined in RFC 4512 into structs and handle these structs. These
114 routines handle four kinds of definitions: syntaxes, matching rules,
115 attribute types and object classes. For each definition kind, four
116 routines are provided.
119 takes a definition in RFC 4512 format in argument
121 as a NUL-terminated string and returns, if possible, a pointer to a
122 newly allocated struct of the appropriate kind. The caller is
123 responsible for freeing the struct by calling
125 when not needed any longer. The routine returns NULL if some problem
126 happened. In this case, the integer pointed at by argument
128 will receive an error code (see below the description of
130 for an explanation of the values) and a pointer to a NUL-terminated
131 string will be placed where requested by argument
133 , indicating where in argument
135 the error happened, so it must not be freed by the caller. Argument
137 is a bit mask of parsing options controlling the relaxation of the
138 syntax recognized. The following values are defined:
140 .B LDAP_SCHEMA_ALLOW_NONE
141 strict parsing according to RFC 4512.
143 .B LDAP_SCHEMA_ALLOW_NO_OID
144 permit definitions that do not contain an initial OID.
146 .B LDAP_SCHEMA_ALLOW_QUOTED
147 permit quotes around some items that should not have them.
149 .B LDAP_SCHEMA_ALLOW_DESCR
152 instead of a numeric OID in places where the syntax expect the latter.
154 .B LDAP_SCHEMA_ALLOW_DESCR_PREFIX
155 permit that the initial numeric OID contains a prefix in
159 .B LDAP_SCHEMA_ALLOW_ALL
160 be very liberal, include all options.
162 The structures returned are as follows:
168 typedef struct ldap_schema_extension_item {
169 char *lsei_name; /* Extension name */
170 char **lsei_values; /* Extension values */
171 } LDAPSchemaExtensionItem;
173 typedef struct ldap_syntax {
174 char *syn_oid; /* OID */
175 char **syn_names; /* Names */
176 char *syn_desc; /* Description */
177 LDAPSchemaExtensionItem **syn_extensions; /* Extension */
180 typedef struct ldap_matchingrule {
181 char *mr_oid; /* OID */
182 char **mr_names; /* Names */
183 char *mr_desc; /* Description */
184 int mr_obsolete; /* Is obsolete? */
185 char *mr_syntax_oid; /* Syntax of asserted values */
186 LDAPSchemaExtensionItem **mr_extensions; /* Extensions */
189 typedef struct ldap_attributetype {
190 char *at_oid; /* OID */
191 char **at_names; /* Names */
192 char *at_desc; /* Description */
193 int at_obsolete; /* Is obsolete? */
194 char *at_sup_oid; /* OID of superior type */
195 char *at_equality_oid; /* OID of equality matching rule */
196 char *at_ordering_oid; /* OID of ordering matching rule */
197 char *at_substr_oid; /* OID of substrings matching rule */
198 char *at_syntax_oid; /* OID of syntax of values */
199 int at_syntax_len; /* Suggested minimum maximum length */
200 int at_single_value; /* Is single-valued? */
201 int at_collective; /* Is collective? */
202 int at_no_user_mod; /* Are changes forbidden through LDAP? */
203 int at_usage; /* Usage, see below */
204 LDAPSchemaExtensionItem **at_extensions; /* Extensions */
207 typedef struct ldap_objectclass {
208 char *oc_oid; /* OID */
209 char **oc_names; /* Names */
210 char *oc_desc; /* Description */
211 int oc_obsolete; /* Is obsolete? */
212 char **oc_sup_oids; /* OIDs of superior classes */
213 int oc_kind; /* Kind, see below */
214 char **oc_at_oids_must; /* OIDs of required attribute types */
215 char **oc_at_oids_may; /* OIDs of optional attribute types */
216 LDAPSchemaExtensionItem **oc_extensions; /* Extensions */
222 Some integer fields (those described with a question mark) have a
223 truth value, for these fields the possible values are:
226 The answer to the question is no.
229 The answer to the question is yes.
231 For attribute types, the following usages are possible:
233 .B LDAP_SCHEMA_USER_APPLICATIONS
234 the attribute type is non-operational.
236 .B LDAP_SCHEMA_DIRECTORY_OPERATION
237 the attribute type is operational and is pertinent to the directory
238 itself, i.e. it has the same value on all servers that master the
239 entry containing this attribute type.
241 .B LDAP_SCHEMA_DISTRIBUTED_OPERATION
242 the attribute type is operational and is pertinent to replication,
243 shadowing or other distributed directory aspect. TBC.
245 .B LDAP_SCHEMA_DSA_OPERATION
246 the attribute type is operational and is pertinent to the directory
247 server itself, i.e. it may have different values for the same entry
248 when retrieved from different servers that master the entry.
250 Object classes can be of three kinds:
252 .B LDAP_SCHEMA_ABSTRACT
253 the object class is abstract, i.e. there cannot be entries of this
256 .B LDAP_SCHEMA_STRUCTURAL
257 the object class is structural, i.e. it describes the main role of the
258 entry. On some servers, once the entry is created the set of
259 structural object classes assigned cannot be changed: none of those
260 present can be removed and none other can be added.
262 .B LDAP_SCHEMA_AUXILIARY
263 the object class is auxiliary, i.e. it is intended to go with other,
264 structural, object classes. These can be added or removed at any time
265 if attribute types are added or removed at the same time as needed by
266 the set of object classes resulting from the operation.
270 return a canonical name for the definition.
274 return a string representation in the format described by RFC 4512 of
275 the struct passed in the argument. The string is a newly allocated
276 string that must be freed by the caller. These routines may return
277 NULL if no memory can be allocated for the string.
280 returns a NUL-terminated string with a text description of the error
281 found. This is a pointer to a static area, so it must not be freed by
282 the caller. The argument
284 comes from one of the parsing routines and can adopt the following
287 .B LDAP_SCHERR_OUTOFMEM
290 .B LDAP_SCHERR_UNEXPTOKEN
293 .B LDAP_SCHERR_NOLEFTPAREN
294 Missing opening parenthesis.
296 .B LDAP_SCHERR_NORIGHTPAREN
297 Missing closing parenthesis.
299 .B LDAP_SCHERR_NODIGIT
302 .B LDAP_SCHERR_BADNAME
305 .B LDAP_SCHERR_BADDESC
308 .B LDAP_SCHERR_BADSUP
311 .B LDAP_SCHERR_DUPOPT
315 Unexpected end of data.
320 .\" Shared Project Acknowledgement Text
321 .B "OpenLDAP Software"
322 is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>.
323 .B "OpenLDAP Software"
324 is derived from University of Michigan LDAP 3.3 Release.