File: controls.xml

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (234 lines) | stat: -rw-r--r-- 6,272 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<chapter xml:id="ldap.controls" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <title>LDAP controls</title>
 <para>
   Controls are special objects which may be sent alongside an
   LDAP request to alter LDAP server behavior while performing
   the request. There may also be controls sent by the server
   alongside the response to provide more information, usually
   to answer a control object from the request.
  <note>
   <para>
    Not all controls are supported by all LDAP servers. To know which controls
    are supported by a server, you need to query the root DSE by reading an
    empty dn with the filter (objectClass=*).
   </para>
   <example>
    <title>Testing support for paged result control</title>
    <programlisting role="php">
<![CDATA[
<?php

// $ds is a valid link identifier for a directory server

$result = ldap_read($ds, '', '(objectClass=*)', ['supportedControl']);
if (!in_array(LDAP_CONTROL_PAGEDRESULTS, ldap_get_entries($ds, $result)[0]['supportedcontrol'])) {
  die("This server does not support paged result control");
}

?>
]]>
    </programlisting>
   </example>
  </note>
 </para>

 <para>
   As of PHP 7.3, you can send controls with your request in all
   request functions using the <parameter>controls</parameter> parameter. When a ext
   version of a function exists, you should use it if you want to
   get access to the full response object and be able to parse
   response controls from it using <function>ldap_parse_result</function>.
 </para>

 <para>
   <parameter>controls</parameter> must be an array containing an array for each control to send,
   containing the following keys:
   <variablelist>
    <varlistentry>
     <term>
      oid
      (<type>string</type>)
     </term>
     <listitem>
      <simpara>
       The OID of the control. You should use constants starting with
       LDAP_CONTROL_ for this. See <link linkend="ldap.constants">LDAP Constants</link>.
      </simpara>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term>
      iscritical
      (<type>bool</type>)
     </term>
     <listitem>
      <simpara>
       If a control is noted as critical, the request will fail if the
       control is not supported by the server, or if it fails to be
       applied. Note that some controls should always be marked as critical
       as noted in the RFC introducing them. Defaults to &false;.
      </simpara>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term>
      value
      (<type>mixed</type>)
     </term>
     <listitem>
      <simpara>
       If applicable, the value of the control. Read below for more information.
      </simpara>
     </listitem>
    </varlistentry>
   </variablelist>

 </para>

 <para>
   Most control values are sent to the server BER-encoded.
   You may either BER-encode the value yourself, or you can instead
   pass an array with the correct keys so that the encoding is done
   for you.
   Supported controls to be passed as an array are:
  <itemizedlist>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_PAGEDRESULTS</constant>
     Expected keys are [size] and [cookie]
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_ASSERT</constant>
     Expected key is filter
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_VALUESRETURNFILTER</constant>
     Expected key is filter
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_PRE_READ</constant>
     Expected key is attrs
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_POST_READ</constant>
     Expected key is attrs
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_SORTREQUEST</constant>
     Expects an array of arrays with keys attr, [oid], [reverse].
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_VLVREQUEST</constant>
     Expected keys are before, after, attrvalue|(offset, count), [context]
    </para>
   </listitem>
  </itemizedlist>
 </para>

 <para>
   The following controls do not need any value:
  <itemizedlist>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_PASSWORDPOLICYREQUEST</constant>
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_MANAGEDSAIT</constant>
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_DONTUSECOPY</constant>
    </para>
   </listitem>
  </itemizedlist>
 </para>

 <para>
   The control <constant>LDAP_CONTROL_PROXY_AUTHZ</constant> is a special case
   as its value is not expected to be BER-encoded, so you can directly
   use a string for its value.
 </para>

 <para>
   When controls are parsed by <function>ldap_parse_result</function>, values are
   turned into an array if supported.
   This is supported for:
  <itemizedlist>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_PASSWORDPOLICYRESPONSE</constant>
     Keys are expire, grace, [error]
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_PAGEDRESULTS</constant>
     Keys are size, cookie
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_PRE_READ</constant>
     Keys are dn and LDAP attributes names
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_POST_READ</constant>
     Keys are dn and LDAP attributes names
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_SORTRESPONSE</constant>
     Keys are errcode, [attribute]
    </para>
   </listitem>
   <listitem>
    <para>
     <constant>LDAP_CONTROL_VLVRESPONSE</constant>
     Keys are target, count, errcode, context
    </para>
   </listitem>
  </itemizedlist>
 </para>
</chapter>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->