]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapo-constraint.5
07d08c29bcd8572345471545e31f8ae15613e03c
[openldap] / doc / man / man5 / slapo-constraint.5
1 .TH SLAPO-CONSTRAINT 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 2005-2006 Hewlett-Packard Company
3 .\" Copyright 2006-2017 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .\" $OpenLDAP$
6 .SH NAME
7 slapo\-constraint \- Attribute Constraint Overlay to slapd
8 .SH SYNOPSIS
9 ETCDIR/slapd.conf
10 .SH DESCRIPTION
11 The constraint overlay is used to ensure that attribute values match
12 some constraints beyond basic LDAP syntax.  Attributes can
13 have multiple constraints placed upon them, and all must be satisfied
14 when modifying an attribute value under constraint.
15 .LP
16 This overlay is intended to be used to force syntactic regularity upon
17 certain string represented data which have well known canonical forms,
18 like telephone numbers, post codes, FQDNs, etc.
19 .LP
20 It constrains only LDAP \fIadd\fP, \fImodify\fP and \fIrename\fP commands
21 and only seeks to control the \fIadd\fP and \fIreplace\fP values
22 of \fImodify\fP and \fIrename\fP requests.
23 .LP
24 No constraints are applied for operations performed with the
25 .I relax
26 control set.
27 .SH CONFIGURATION
28 This
29 .B slapd.conf
30 option applies to the constraint overlay.
31 It should appear after the
32 .B overlay
33 directive.
34 .TP
35 .B constraint_attribute <attribute_name>[,...] <type> <value> [<extra> [...]]
36 Specifies the constraint which should apply to the comma-separated
37 attribute list named as the first parameter.
38 Five types of constraint are currently supported -
39 .BR regex ,
40 .BR size ,
41 .BR count ,
42 .BR uri ,
43 and
44 .BR set .
45
46 The parameter following the
47 .B regex
48 type is a Unix style regular expression (See
49 .BR regex (7)
50 ). The parameter following the
51 .B uri
52 type is an LDAP URI. The URI will be evaluated using an internal search.
53 It must not include a hostname, and it must include a list of attributes
54 to evaluate.
55
56 The parameter following the
57 .B set
58 type is a string that is interpreted according to the syntax in use
59 for ACL sets.  This allows one to construct constraints based on the contents
60 of the entry.
61
62 The 
63 .B size
64 type can be used to enforce a limit on an attribute length, and the
65 .B count
66 type limits the number of values of an attribute.
67
68 Extra parameters can occur in any order after those described above.
69 .RS
70 .TP
71 .B <extra> : restrict=<uri>
72 .RE
73
74 .RS
75 This extra parameter allows one to restrict the application of the corresponding
76 constraint only to entries that match the
77 .IR base ,
78 .I scope
79 and
80 .I filter
81 portions of the LDAP URI.
82 The
83 .IR base ,
84 if present, must be within the naming context of the database.
85 The
86 .I scope
87 is only used when the
88 .I base
89 is present; it defaults to
90 .BR base .
91 The other parameters of the URI are not allowed.
92 .RE
93
94 .LP
95 Any attempt to add or modify an attribute named as part of the
96 constraint overlay specification which does not fit the 
97 constraint listed will fail with a
98 LDAP_CONSTRAINT_VIOLATION error.
99 .SH EXAMPLES
100 .LP
101 .RS
102 .nf
103 overlay constraint
104 constraint_attribute jpegPhoto size 131072
105 constraint_attribute userPassword count 3
106 constraint_attribute mail regex ^[[:alnum:]]+@mydomain.com$
107 constraint_attribute title uri
108   ldap:///dc=catalog,dc=example,dc=com?title?sub?(objectClass=titleCatalog)
109 constraint_attribute cn,sn,givenName set
110   "(this/givenName + [ ] + this/sn) & this/cn"
111   restrict="ldap:///ou=People,dc=example,dc=com??sub?(objectClass=inetOrgPerson)"
112 .fi
113
114 .RE
115 A specification like the above would reject any
116 .B mail
117 attribute which did not look like
118 .BR "<alpha-numeric string>@mydomain.com" .
119 It would also reject any
120 .B title
121 attribute whose values were not listed in the
122 .B title
123 attribute of any
124 .B titleCatalog
125 entries in the given scope. (Note that the
126 "dc=catalog,dc=example,dc=com" subtree ought to reside
127 in a separate database, otherwise the initial set of
128 titleCatalog entries could not be populated while the
129 constraint is in effect.)
130 Finally, it requires the values of the attribute
131 .B cn
132 to be constructed by pairing values of the attributes
133 .B sn
134 and 
135 .BR givenName ,
136 separated by a space, but only for entries derived from the objectClass
137 .BR inetOrgPerson .
138 .RE
139 .SH FILES
140 .TP
141 ETCDIR/slapd.conf
142 default slapd configuration file
143 .SH SEE ALSO
144 .BR slapd.conf (5),
145 .BR slapd\-config (5),
146 .SH ACKNOWLEDGEMENTS
147 This module was written in 2005 by Neil Dunbar of Hewlett-Packard and subsequently
148 extended by Howard Chu and Emmanuel Dreyfus.
149 .so ../Project