Re: LDAP controls in response
| From: | Pierangelo Masarati | Date: | Thu, 10 Nov 2005 17:58:34 +0000 |
| Subject: | Re: LDAP controls in response | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19949@lists.php.net to get a copy of this message | ||
On Wed, 2005-11-09 at 10:03 +0200, Jani Taskinen wrote:
> Anyway, it might be the time to cleanup the API of this extension
> and make it simpler. It's pretty confusing as it is.
> The returned arrays are also weird with their "count" fields and such.
OK, Jani.
I've removed those "count" stuff; also, I noted that I forgot things
like declaring the new arg to ldap_parse_result() to be passed by
reference, and few more details which I fixed. I also removed all the
occurrences of the ldap_*value*_len substitutions.
This is in <php-ldap-result-controls.2.txt>.
I've also added a tentative <php-ldap-known-controls.0.txt> that
partially implements encoding and decoding the pagedResults control (I
use it as a benchmark because it goes on the request and on the
response). If you find this interface useful, I'd extend it to most of
the standard track controls we support in OpenLDAP. As a C programmer,
I prefer to provide a nice and clean high level PHP interface to known
controls in addition to access to the raw encoding for skilled
developers. In my view, the API should be, for each control:
a) a ldap_ctrl_<name>() call to encode it;
b) a(n optional) ldap_ctrl_<name>_resp() call to decode the related
response, if the control requires any.
Furthermore, the (a) call:
a.1) when passed a valid LDAP handler, should set the control using the
LDAP-level ldap_set_option() API;
a.2) otherwise, it could return a PHP array containing the OID, the
value and the criticality flag, ready to be passed to the PHP-level
ldap_set_option(); this would allow to incrementally build controls
together.
The (b) call should return all the requested fields contained in the
control response.
The pagedResults calls contained in the second patch should provide a
clear example, although the second functionality of the
ldap_ctrl_paged_results() call is not implemented yet. Its usage is
exemplified in the attached <pagedResults.php> (to test it, you only
need to run OpenLDAP 2.3 test003 with "./run -k test003" from the tests/
directory; the "-k" will keep the server alive after populating it with
the right stuff).
This second patch is clearly a work in progress, I don't expect it to be
considered for inclusion in its current state; I'd rather appreciate
some feedback while I keep developing it.
p.
Ing. Pierangelo Masarati
Responsabile Open Solution
SysNet s.n.c.
Via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
------------------------------------------
Office: +39.02.23998309
Mobile: +39.333.4963172
Email: pierangelo.masarati@sys-net.it
------------------------------------------
Attachment: [text/x-patch] php-ldap-result-controls.2.txt
Attachment: [text/x-patch] php-ldap-known-controls.0.txt
Attachment: [application/x-php] pagedResults.php
Attachment: [text/x-patch] php-ldap-result-controls.2.txt
Attachment: [text/x-patch] php-ldap-known-controls.0.txt
Attachment: [application/x-php] pagedResults.php