LDAPSCHEMA(3) LDAPSCHEMA(3)
NAME
ldapstr2syntax, ldapsyntax2str, ldapsyntax2name, ldapsyntaxfree,
ldapstr2matchingrule, ldapmatchingrule2str, ldapmatchingrule2name,
ldapmatchingrulefree, ldapstr2attributetype, ldapattributetype2str,
ldapattributetype2name, ldapattributetypefree, ldapstr2objectclass,
ldapobjectclass2str, ldapobjectclass2name, ldapobjectclassfree,
ldapscherr2str - Schema definition handling routines
LIBRARY
OpenLDAP LDAP (libldap, -lldap)
SYNOPSIS
##include <>
##include <>
LDAPSyntax ** ldapstr2syntax(s,, code,, errp,, flags)
const char * s;
int * code;
const char ** errp;
const int flags;
char ** ldapsyntax2str(syn)
const LDAPSyntax * syn;
const char ** ldapsyntax2name(syn)
LDAPSyntax * syn;
ldapsyntaxfree(syn)
LDAPSyntax * syn;
LDAPatchingRule ** ldapstr2matchingrule(s,, code,, errp,, flags)
const char * s;
int * code;
const char ** errp;
const int flags;
char ** ldapmatchingrule2str(mr);;
const LDAPMatchingRule * mr;
const char ** ldapmatchingrule2name(mr)
LDAPMatchingRule * mr;
ldapmatchingrulefree(mr)
LDAPMatchingRule * mr;
LDAPAttributeType ** ldapstr2attributetype(s,, code,, errp,, flags)
const char * s;
int * code;
const char ** errp;
const int flags;
char ** ldapattributetype2str(at)
const LDAPAttributeType * at;
const char ** ldapattributetype2name(at)
LDAPAttributeType * at;
ldapattributetypefree(at)
LDAPAttributeType * at;
LDAPObjectClass ** ldapstr2objectclass(s,, code,, errp,, flags)
const char * s;
int * code;
const char ** errp;
const int flags;
char ** ldapobjectclass2str(oc)
const LDAPObjectClass * oc;
const char ** ldapobjectclass2name(oc)
LDAPObjectClass * oc;
ldapobjectclassfree(oc)
LDAPObjectClass * oc;
char ** ldapscherr2str(code)
int code;
DESCRIPTION
These routines are used to parse schema definitions in the syntax
defined in RFC 2252 into structs and handle these structs. These rou-
tines handle four kinds of definitions: syntaxes, matching rules,
attribute types and objectclasses. For each definition kind, four rou-
tines are provided.
ldapstr2xxx() takes a definition in RFC 2252 format in argument s as a
NUL-terminated string and returns, if possible, a pointer to a newly
allocated struct of the appropriate kind. The caller is responsible
for freeing the struct by calling ldapxxxfree() when not needed any
longer. The routine returns NUL if some problem happened. In this
case, the integer pointed at by argument code will receive an error
code (see below the description of ldapscherr2str() for an explanation
of the values) and a pointer to a NUL-terminated string will be placed
where requested by argument errp , indicating where in argument s the
error happened, so it must not be freed by the caller. Argument flags
is a bit mask of parsing options controlling the relaxation of the syn-
tax recognized. The following values are defined:
LDAPSCHEMALOWNONE
strict parsing according to RFC 2252.
LDAPSCHEMALOWNOID
permit definitions that do not contain an initial OID.
LDAPSCHEMALOWQUOTED
permit quotes around some items that should not have them.
LDAPSCHEMALOWDESCR
permit a descr instead of a numeric OID in places where the syn-
tax expect the latter.
LDAPSCHEMALOWDESCRPREFIX
permit that the initial numeric OID contains a prefix in descr
format.
LDAPSCHEMALOWAL
be very liberal, include all options.
The structures returned are as follows:
typedef struct ldapschemaextensionitem {
char *lseiname; /* Extension name */
char **lseivalues; /* Extension values */
} LDAPSchemaExtensionItem;
typedef struct ldapsyntax {
char *synoid; /* OID */
char **synnames; /* Names */
char *syndesc; /* Description */
LDAPSchemaExtensionItem **synextensions; /* Extension */
} LDAPSyntax;
typedef struct ldapmatchingrule {
char *mroid; /* OID */
char **mrnames; /* Names */
char *mrdesc; /* Description */
int mrobsolete; /* Is obsolete? */
char *mrsyntaxoid; /* Syntax of asserted values */
LDAPSchemaExtensionItem **mrextensions; /* Extensions */
} LDAPMatchingRule;
typedef struct ldapattributetype {
char *atoid; /* OID */
char **atnames; /* Names */
char *atdesc; /* Description */
int atobsolete; /* Is obsolete? */
char *atsupoid; /* OID of superior type */
char *atequalityoid; /* OID of equality matching rule */
char *atorderingoid; /* OID of ordering matching rule */
char *atsubstroid; /* OID of substrings matching rule */
char *atsyntaxoid; /* OID of syntax of values */
int atsyntaxlen; /* Suggested minimum maximum length */
int atsinglevalue; /* Is single-valued? */
int atcollective; /* Is collective? */
int atnousermod; /* Are changes forbidden through LDAP? */
int atusage; /* Usage, see below */
LDAPSchemaExtensionItem **atextensions; /* Extensions */
} LDAPAttributeType;
typedef struct ldapobjectclass {
char *ocoid; /* OID */
char **ocnames; /* Names */
char *ocdesc; /* Description */
int ocobsolete; /* Is obsolete? */
char **ocsupoids; /* OIDs of superior classes */
int ockind; /* Kind, see below */
char **ocatoidsmust; /* OIDs of required attribute types */
char **ocatoidsmay; /* OIDs of optional attribute types */
LDAPSchemaExtensionItem **ocextensions; /* Extensions */
} LDAPObjectClass;
Some integer fields (those described with a question mark) have a truth
value, for these fields the possible values are:
LDAPSCHEMANO
The answer to the question is no.
LDAPSCHEMAYES
The answer to the question is yes.
For attribute types, the following usages are possible:
LDAPSCHEMAUSERAPLICATIONS
the attribute type is non-operational.
LDAPSCHEMADIRECTORYOPERATION
the attribute type is operational and is pertinent to the direc-
tory itself, i.e. it has the same value on all servers that mas-
ter the entry containing this attribute type.
LDAPSCHEMADISTRIBUTEDOPERATION
the attribute type is operational and is pertinent to replica-
tion, shadowing or other distributed directory aspect. TBC.
LDAPSCHEMADSAOPERATION
the attribute type is operational and is pertinent to the direc-
tory server itself, i.e. it may have different values for the
same entry when retrieved from different servers that master the
entry.
Object classes can be of three kinds:
LDAPSCHEMABSTRACT
the object class is abstract, i.e. there cannot be entries of
this class alone.
LDAPSCHEMASTRUCTURAL
the object class is structural, i.e. it describes the main role
of the entry. On some servers, once the entry is created the
set of structural object classes assigned cannot be changed:
none of those present can be removed and none other can be
added.
LDAPSCHEMAUXILIARY
the object class is auxiliary, i.e. it is intended to go with
other, structural, object classes. These can be added or
removed at any time if attribute types are added or removed at
the same time as needed by the set of object classes resulting
from the operation.
Routines ldapxxx2name() return a canonical name for the definition.
Routines ldapxxx2str() return a string representation in the format
described by RFC 2252 of the struct passed in the argument. The string
is a newly allocated string that must be freed by the caller. These
routines may return NUL if no memory can be allocated for the string.
ldapscherr2str() returns a NUL-terminated string with a text descrip-
tion of the error found. This is a pointer to a static area, so it
must not be freed by the caller. The argument code comes from one of
the parsing routines and can adopt the following values:
LDAPSCHEROUTOFMEM
Out of memory.
LDAPSCHERUNEXPTOKEN
Unexpected token.
LDAPSCHERNOLEFTPAREN
Missing opening parenthesis.
LDAPSCHERNORIGHTPAREN
Missing closing parenthesis.
LDAPSCHERNODIGIT
Expecting digit.
LDAPSCHERBADNAME
Expecting a name.
LDAPSCHERBADESC
Bad description.
LDAPSCHERBADSUP
Bad superiors.
LDAPSCHERDUPOPT
Duplicate option.
LDAPSCHEREMPTY
Unexpected end of data.
SEE ALSO
ldap(3)
ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project
(http:/www.openldap.org/). OpenLDAP is derived from University of
Michigan LDAP 3.3 Release.
OpenLDAP 2.2.19 2004/11/26 LDAPSCHEMA(3)
|