1LDAP_SCHEMA(3)             Library Functions Manual             LDAP_SCHEMA(3)
2
3
4

NAME

6       ldap_str2syntax,  ldap_syntax2str,  ldap_syntax2name, ldap_syntax_free,
7       ldap_str2matchingrule,  ldap_matchingrule2str,  ldap_matchingrule2name,
8       ldap_matchingrule_free, ldap_str2attributetype, ldap_attributetype2str,
9       ldap_attributetype2name, ldap_attributetype_free, ldap_str2objectclass,
10       ldap_objectclass2str,   ldap_objectclass2name,   ldap_objectclass_free,
11       ldap_scherr2str - Schema definition handling routines
12

LIBRARY

14       OpenLDAP LDAP (libldap, -lldap)
15

SYNOPSIS

17       #include <ldap.h>
18       #include <ldap_schema.h>
19
20       LDAPSyntax * ldap_str2syntax(s, code, errp, flags)
21       const char * s;
22       int * code;
23       const char ** errp;
24       const int flags;
25
26       char * ldap_syntax2str(syn)
27       const LDAPSyntax * syn;
28
29       const char * ldap_syntax2name(syn)
30       LDAPSyntax * syn;
31
32       ldap_syntax_free(syn)
33       LDAPSyntax * syn;
34
35       LDAPMatchingRule * ldap_str2matchingrule(s, code, errp, flags)
36       const char * s;
37       int * code;
38       const char ** errp;
39       const int flags;
40
41       char * ldap_matchingrule2str(mr);
42       const LDAPMatchingRule * mr;
43
44       const char * ldap_matchingrule2name(mr)
45       LDAPMatchingRule * mr;
46
47       ldap_matchingrule_free(mr)
48       LDAPMatchingRule * mr;
49
50       LDAPAttributeType * ldap_str2attributetype(s, code, errp, flags)
51       const char * s;
52       int * code;
53       const char ** errp;
54       const int flags;
55
56       char * ldap_attributetype2str(at)
57       const LDAPAttributeType * at;
58
59       const char * ldap_attributetype2name(at)
60       LDAPAttributeType * at;
61
62       ldap_attributetype_free(at)
63       LDAPAttributeType * at;
64
65       LDAPObjectClass * ldap_str2objectclass(s, code, errp, flags)
66       const char * s;
67       int * code;
68       const char ** errp;
69       const int flags;
70
71       char * ldap_objectclass2str(oc)
72       const LDAPObjectClass * oc;
73
74       const char * ldap_objectclass2name(oc)
75       LDAPObjectClass * oc;
76
77       ldap_objectclass_free(oc)
78       LDAPObjectClass * oc;
79
80       char * ldap_scherr2str(code)
81       int code;
82

DESCRIPTION

84       These routines are used to  parse  schema  definitions  in  the  syntax
85       defined  in RFC 4512 into structs and handle these structs.  These rou‐
86       tines handle four  kinds  of  definitions:  syntaxes,  matching  rules,
87       attribute  types  and  object  classes.  For each definition kind, four
88       routines are provided.
89
90       ldap_str2xxx() takes a definition in RFC 4512 format in argument s as a
91       NUL-terminated  string  and  returns, if possible, a pointer to a newly
92       allocated struct of the appropriate kind.  The  caller  is  responsible
93       for  freeing  the struct by calling ldap_xxx_free() when not needed any
94       longer.  The routine returns NULL if some problem  happened.   In  this
95       case,  the  integer  pointed  at by argument code will receive an error
96       code (see below the description of ldap_scherr2str() for an explanation
97       of  the values) and a pointer to a NUL-terminated string will be placed
98       where requested by argument errp , indicating where in argument  s  the
99       error  happened, so it must not be freed by the caller.  Argument flags
100       is a bit mask of parsing options controlling the relaxation of the syn‐
101       tax recognized.  The following values are defined:
102
103       LDAP_SCHEMA_ALLOW_NONE
104              strict parsing according to RFC 4512.
105
106       LDAP_SCHEMA_ALLOW_NO_OID
107              permit definitions that do not contain an initial OID.
108
109       LDAP_SCHEMA_ALLOW_QUOTED
110              permit quotes around some items that should not have them.
111
112       LDAP_SCHEMA_ALLOW_DESCR
113              permit a descr instead of a numeric OID in places where the syn‐
114              tax expect the latter.
115
116       LDAP_SCHEMA_ALLOW_DESCR_PREFIX
117              permit that the initial numeric OID contains a prefix  in  descr
118              format.
119
120       LDAP_SCHEMA_ALLOW_ALL
121              be very liberal, include all options.
122
123       The structures returned are as follows:
124
125              typedef struct ldap_schema_extension_item {
126                      char *lsei_name;        /* Extension name */
127                      char **lsei_values;     /* Extension values */
128              } LDAPSchemaExtensionItem;
129
130              typedef struct ldap_syntax {
131                      char *syn_oid;          /* OID */
132                      char **syn_names;       /* Names */
133                      char *syn_desc;         /* Description */
134                      LDAPSchemaExtensionItem **syn_extensions; /* Extension */
135              } LDAPSyntax;
136
137              typedef struct ldap_matchingrule {
138                      char *mr_oid;           /* OID */
139                      char **mr_names;        /* Names */
140                      char *mr_desc;          /* Description */
141                      int  mr_obsolete;       /* Is obsolete? */
142                      char *mr_syntax_oid;    /* Syntax of asserted values */
143                      LDAPSchemaExtensionItem **mr_extensions; /* Extensions */
144              } LDAPMatchingRule;
145
146              typedef struct ldap_attributetype {
147                      char *at_oid;           /* OID */
148                      char **at_names;        /* Names */
149                      char *at_desc;          /* Description */
150                      int  at_obsolete;       /* Is obsolete? */
151                      char *at_sup_oid;       /* OID of superior type */
152                      char *at_equality_oid;  /* OID of equality matching rule */
153                      char *at_ordering_oid;  /* OID of ordering matching rule */
154                      char *at_substr_oid;    /* OID of substrings matching rule */
155                      char *at_syntax_oid;    /* OID of syntax of values */
156                      int  at_syntax_len;     /* Suggested minimum maximum length */
157                      int  at_single_value;   /* Is single-valued?  */
158                      int  at_collective;     /* Is collective? */
159                      int  at_no_user_mod;    /* Are changes forbidden through LDAP? */
160                      int  at_usage;          /* Usage, see below */
161                      LDAPSchemaExtensionItem **at_extensions; /* Extensions */
162              } LDAPAttributeType;
163
164              typedef struct ldap_objectclass {
165                      char *oc_oid;           /* OID */
166                      char **oc_names;        /* Names */
167                      char *oc_desc;          /* Description */
168                      int  oc_obsolete;       /* Is obsolete? */
169                      char **oc_sup_oids;     /* OIDs of superior classes */
170                      int  oc_kind;           /* Kind, see below */
171                      char **oc_at_oids_must; /* OIDs of required attribute types */
172                      char **oc_at_oids_may;  /* OIDs of optional attribute types */
173                      LDAPSchemaExtensionItem **oc_extensions; /* Extensions */
174              } LDAPObjectClass;
175
176       Some integer fields (those described with a question mark) have a truth
177       value, for these fields the possible values are:
178
179       LDAP_SCHEMA_NO
180              The answer to the question is no.
181
182       LDAP_SCHEMA_YES
183              The answer to the question is yes.
184
185       For attribute types, the following usages are possible:
186
187       LDAP_SCHEMA_USER_APPLICATIONS
188              the attribute type is non-operational.
189
190       LDAP_SCHEMA_DIRECTORY_OPERATION
191              the attribute type is operational and is pertinent to the direc‐
192              tory itself, i.e. it has the same value on all servers that mas‐
193              ter the entry containing this attribute type.
194
195       LDAP_SCHEMA_DISTRIBUTED_OPERATION
196              the attribute type is operational and is pertinent  to  replica‐
197              tion, shadowing or other distributed directory aspect.  TBC.
198
199       LDAP_SCHEMA_DSA_OPERATION
200              the attribute type is operational and is pertinent to the direc‐
201              tory server itself, i.e. it may have different  values  for  the
202              same entry when retrieved from different servers that master the
203              entry.
204
205       Object classes can be of three kinds:
206
207       LDAP_SCHEMA_ABSTRACT
208              the object class is abstract, i.e. there cannot  be  entries  of
209              this class alone.
210
211       LDAP_SCHEMA_STRUCTURAL
212              the  object class is structural, i.e. it describes the main role
213              of the entry.  On some servers, once the entry  is  created  the
214              set  of  structural  object  classes assigned cannot be changed:
215              none of those present can be  removed  and  none  other  can  be
216              added.
217
218       LDAP_SCHEMA_AUXILIARY
219              the  object  class  is auxiliary, i.e. it is intended to go with
220              other, structural,  object  classes.   These  can  be  added  or
221              removed  at  any time if attribute types are added or removed at
222              the same time as needed by the set of object  classes  resulting
223              from the operation.
224
225       Routines ldap_xxx2name() return a canonical name for the definition.
226
227       Routines  ldap_xxx2str()  return  a string representation in the format
228       described by RFC 4512 of the struct passed in the argument.  The string
229       is  a  newly  allocated string that must be freed by the caller.  These
230       routines may return NULL if no memory can be allocated for the string.
231
232       ldap_scherr2str() returns a NUL-terminated string with a text  descrip‐
233       tion  of  the  error  found.  This is a pointer to a static area, so it
234       must not be freed by the caller.  The argument code comes from  one  of
235       the parsing routines and can adopt the following values:
236
237       LDAP_SCHERR_OUTOFMEM
238              Out of memory.
239
240       LDAP_SCHERR_UNEXPTOKEN
241              Unexpected token.
242
243       LDAP_SCHERR_NOLEFTPAREN
244              Missing opening parenthesis.
245
246       LDAP_SCHERR_NORIGHTPAREN
247              Missing closing parenthesis.
248
249       LDAP_SCHERR_NODIGIT
250              Expecting digit.
251
252       LDAP_SCHERR_BADNAME
253              Expecting a name.
254
255       LDAP_SCHERR_BADDESC
256              Bad description.
257
258       LDAP_SCHERR_BADSUP
259              Bad superiors.
260
261       LDAP_SCHERR_DUPOPT
262              Duplicate option.
263
264       LDAP_SCHERR_EMPTY
265              Unexpected end of data.
266
267

SEE ALSO

269       ldap(3)
270

ACKNOWLEDGEMENTS

272       OpenLDAP  Software  is developed and maintained by The OpenLDAP Project
273       <http://www.openldap.org/>.  OpenLDAP Software is derived from the Uni‐
274       versity of Michigan LDAP 3.3 Release.
275
276
277
278OpenLDAP 2.4.50                   2020/04/28                    LDAP_SCHEMA(3)
Impressum