]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapo-retcode.5
c5c9d7e8227964ddd70c7677c08dc2710b213cfd
[openldap] / doc / man / man5 / slapo-retcode.5
1 .TH SLAPO-RETCODE 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 1998-2017 The OpenLDAP Foundation, All Rights Reserved.
3 .\" Copying restrictions apply.  See the COPYRIGHT file.
4 .\" Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
5 .\" $OpenLDAP$
6 .SH NAME
7 slapo\-retcode \- return code overlay to slapd
8 .SH SYNOPSIS
9 ETCDIR/slapd.conf
10 .SH DESCRIPTION
11 The
12 .B retcode
13 overlay to
14 .BR slapd (8)
15 is useful to test the behavior of clients when server-generated erroneous
16 and/or unusual responses occur, e.g. error codes, referrals, 
17 excessive response times and so on.
18
19 The error responses are generated according to different strategies.
20 .LP
21 In the first case, all operations targeted at a specific configurable
22 subtree cause the object related to the request DN to be looked up
23 and checked for return code data: a response code, plus an optional
24 textual message, an optional configurable delay, an optional matched DN
25 field, and, when the response code is "referral", a (list of) referral(s).
26 .LP
27 Well-known response codes from standard track documents are provided
28 in \fBretcode.conf\fP, which can be included after instantiating
29 the overlay.
30 .LP
31 In the second case, objects of classes inherited from 
32 the \fBerrAbsObject\fP, like \fBerrObject\fP or \fBerrAuxObject\fP,
33 when returned as intermediate responses of a search request, are changed
34 into the response dictated by their content.
35 .LP
36 A third mode causes objects to be looked up from the underlying database 
37 to discover if their class inherits from \fBerrABsObject\fP;
38 in that case, their content is used to compute the corresponding response.
39 .LP
40 The behavior is disabled by using the \fBmanageDSAit\fP control (RFC 3296);
41 in that case, the resulting object, either present in the directory 
42 or dynamically generated by the overlay, or contained in the request,
43 is handled as usual.
44 .LP 
45 The config directives that are specific to the
46 .B retcode
47 overlay must be prefixed by
48 .BR retcode\- ,
49 to avoid conflicts with directives specific to the underlying database
50 or to other stacked overlays.  The following specific directives 
51 can be used to configure the retcode overlay: 
52 .TP
53 .B retcode\-parent <DN>
54 This directive defines the parent DN where dynamically generated
55 entries reside.
56 If not defined, the suffix of the database is used.
57 .HP
58 .hy 0
59 .B retcode\-item <RDN> <errCode> [op=<oplist>] [text=<message>]
60 .B [ref=<referral>] [sleeptime=<sec>] [matched=<DN>]
61 .B [unsolicited=<OID>[:<data>]] [flags=[\{pre|post\}\-]disconnect[,...]]
62 .RS
63 A dynamically generated entry, located below \fBretcode\-parent\fP.
64 The \fBerrCode\fP is the number of the response code;
65 it can be in any format supported by
66 .BR strtol (3).
67 The optional \fBoplist\fP is a list of operations that cause
68 response code generation; if absent, all operations are affected.
69 The \fBmatched\fP field is the matched DN that is returned
70 along with the error, while the \fBtext\fP field is an optional
71 diagnostics message.
72 The \fBref\fP field is only allowed for the \fBreferral\fP 
73 response code.
74 The \fBsleeptime\fP field causes
75 .BR slapd (8)
76 to sleep the specified number of seconds before proceeding 
77 with the operation.
78 The \fBunsolicited\fP field can be used to cause the return
79 of an RFC 4511 unsolicited response message; if \fBOID\fP
80 is not "0", an extended response is generated, with the optional
81 \fBdata\fP appended.
82 If \fBflags\fP contains \fBdisconnect\fP, or \fBpre\-disconnect\fP,
83 .BR slapd (8)
84 disconnects abruptly, without notice; \fBpost\-disconnect\fP
85 causes disconnection right after sending response as appropriate.
86 .RE
87 .TP
88 .B retcode\-indir
89 Enables exploitation of in-directory stored errAbsObject.
90 May result in a lot of unnecessary overhead.
91 .TP
92 .B retcode\-sleep [\-]<n>
93 Defines a sleep time in seconds that is spent before actually handling
94 any operation.
95 If negative, a random time between 0 and the absolute value of the argument
96 is used.
97
98 .SH SCHEMA
99 The
100 .B retcode
101 overlay utilizes the "return code" schema described herein. 
102 This schema is specifically designed for use with this
103 overlay and is not intended to be used otherwise.
104 It is also noted that the schema described here is
105 .I a work in
106 .IR progress ,
107 and hence subject to change without notice.
108 The schema is loaded automatically by the overlay.
109
110 The schema includes a number of object classes and associated
111 attribute types as described below.
112
113 .LP
114 The error code:
115 .RS 4
116 (  1.3.6.1.4.1.4203.666.11.4.1.1
117     NAME ( 'errCode' )
118     DESC 'LDAP error code'
119     EQUALITY integerMatch
120     ORDERING integerOrderingMatch
121     SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
122     SINGLE\-VALUE )
123 .RE
124 .LP
125 The operations that trigger the response code:
126 .RS 4
127 ( 1.3.6.1.4.1.4203.666.11.4.1.2
128     NAME ( 'errOp' )
129     DESC 'Operations the errObject applies to'
130     EQUALITY caseIgnoreMatch
131     SUBSTR caseIgnoreSubstringsMatch
132     SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
133 .RE
134 .LP
135 The text message:
136 .RS 4
137 ( 1.3.6.1.4.1.4203.666.11.4.1.3
138     NAME ( 'errText' )
139     DESC 'LDAP error textual description'
140     EQUALITY caseIgnoreMatch
141     SUBSTR caseIgnoreSubstringsMatch
142     SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
143     SINGLE\-VALUE )
144 .RE
145 .LP
146 The sleep time before the response is actually returned to the client:
147 .RS 4
148 ( 1.3.6.1.4.1.4203.666.11.4.1.4
149     NAME ( 'errSleepTime' )
150     DESC 'Time to wait before returning the error'
151     EQUALITY integerMatch
152     SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
153     SINGLE\-VALUE )
154 .RE
155 .LP
156 The matched DN returned to the client:
157 .RS 4
158 ( 1.3.6.1.4.1.4203.666.11.4.1.5
159     NAME ( 'errMatchedDN' )
160     DESC 'Value to be returned as matched DN'
161     EQUALITY distinguishedNameMatch
162     SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
163     SINGLE\-VALUE )
164 .RE
165 .LP
166 The OID to be returned as extended response OID
167 in RFC 4511 unsolicited responses
168 ("0" generates a regular response with msgid set to 0):
169 .RS 4
170 ( 1.3.6.1.4.1.4203.666.11.4.1.6
171     NAME ( 'errUnsolicitedOID' )
172     DESC 'OID to be returned within unsolicited response'
173     EQUALITY objectIdentifierMatch
174     SYNTAX 1.3.6.1.4.1.1466.115.121.1.38
175     SINGLE\-VALUE )
176 .RE
177 .LP
178 The octet string to be returned as extended response data
179 in RFC 4511 unsolicited response:
180 .RS 4
181 ( 1.3.6.1.4.1.4203.666.11.4.1.7
182     NAME ( 'errUnsolicitedData' )
183     DESC 'Data to be returned within unsolicited response'
184     SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
185     SINGLE\-VALUE )
186 .RE
187 .LP
188 If TRUE,
189 .BR slapd (8)
190 disconnects abruptly without notice; if FALSE, it disconnects
191 after sending response as appropriate:
192 .RS 4
193 ( 1.3.6.1.4.1.4203.666.11.4.1.8
194     NAME ( 'errDisconnect' )
195     DESC 'Disconnect without notice'
196     SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
197     SINGLE\-VALUE )
198 .RE
199 .LP
200 The abstract class that triggers the overlay:
201 .RS 4
202 ( 1.3.6.1.4.1.4203.666.11.4.3.0
203     NAME ( 'errAbsObject' )
204     SUP top ABSTRACT
205     MUST ( errCode )
206     MAY ( cn $ description $ errOp $ errText $ errSleepTime
207         $ errMatchedDN ) )
208 .RE
209 .LP
210 The standalone structural objectclass for specifically created data:
211 .RS 4
212 ( 1.3.6.1.4.1.4203.666.11.4.3.1
213     NAME ( 'errObject' )
214     SUP errAbsObject STRUCTURAL )
215 .RE
216 .LP
217 The auxiliary objectclass to alter the behavior of existing objects:
218 .RS 4
219 ( 1.3.6.1.4.1.4203.666.11.4.3.2
220     NAME ( 'errAuxObject' )
221     SUP errAbsObject AUXILIARY )
222 .RE
223
224 .SH EXAMPLE
225 .LP
226 .RS
227 .nf
228 overlay         retcode
229 retcode\-parent  "ou=RetCodes,dc=example,dc=com"
230
231 # retcode.conf is found in tests/data/ of the source tree
232 include         ./retcode.conf
233
234 # Wait 10 seconds, then return success (0x00)
235 retcode\-item    "cn=Success after 10 seconds" 0x00 sleeptime=10
236 # Wait 10 seconds, then return timelimitExceeded (0x03)
237 retcode\-item    "cn=Timelimit after 10 seconds" 0x03 sleeptime=10
238 .fi
239 .RE
240 .LP
241 .LP
242
243 .SH FILES
244 .TP
245 ETCDIR/slapd.conf
246 default slapd configuration file
247 .SH SEE ALSO
248 .BR slapd.conf (5),
249 .BR slapd\-config (5),
250 .BR slapd (8).
251 The
252 .BR slapo\-retcode (5)
253 overlay supports dynamic configuration via
254 .BR back-config .
255 .SH ACKNOWLEDGEMENTS
256 .P
257 This module was written in 2005 by Pierangelo Masarati for SysNet s.n.c.