HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
Pointer to the NULL-terminated array of berval structures containing the LDAPv3
referrals (search result references) found in the entry.
refs
Pointer to the array of berval structures used to collect LDAP referrals for LDAPv2
clients.
urls
Returns This function returns one of the following values:
0 if successful.
-1 if an error occurs.
See also
“slapi_send_ldap_result()”
“slapi_send_ldap_search_entry()”
40.2 slapi_send_ldap_result()
Description Call slapi_send_ldap_result() to send an LDAP result code (such as
LDAP_SUCCESS) back to the client.
The following arguments are intended for use only in certain situations:
matched
When sending an LDAP_NO_SUCH_OBJECT result code back to a client, use matched to specify
how much of the target DN could be found in the database. For example, if the client was
attempting to find the DN
cn=Babs Jensen, ou=Product Division, l=US, dc=example,dc=com
and the database contains entries for c=US and dc=example,dc=com,c=US but no entry for
ou=Product Division,l=US,dc=example,dc=com, you should set the matched parameter
to
l=US, dc=example,dc=com
urls
When sending an LDAP_PARTIAL_RESULTS result code back to an LDAPv2 client or an
LDAP_REFERRAL result code back to an LDAPv3 client, use urls to specify the referral URLs.
For LDAPv3 referrals, you can call the “slapi_str2filter()” to send referrals to LDAPv3 clients
and collect them for LDAPv2 clients. You can pass the array of collected referrals to the urls
argument of slapi_send_ldap_results(). For example:
struct berval **urls;
...
slapi_send_ldap_referral( ld, e, &refs, &urls );
slapi_send_ldap_result( ld, LDAP_PARTIAL_RESULTS, NULL, NULL, 0, \ urls );
If you want to define your own function for sending result codes, write a function that complies
with the type definition send_ldap_result_fn_ptr_t, and set the SLAPI_PLUGIN_DB_RESULT_FN
parameter in the parameter block to the name of your function.
Syntax
#include "slapi-plugin.h"
void slapi_send_ldap_result( Slapi_PBlock *pb, int err,
char *matched, char *text, int nentries, struct berval **urls );
Parameters This function takes the following parameters:
Parameter block.
pb
LDAP result code that you want sent back to the client; for example, LDAP_SUCCESS.err
When sending back an LDAP_NO_SUCH_OBJECT result code, use this argument to
specify the portion of the target DN that could be matched. Pass NULL in other situations.
matched
324 Functions for sending entries and results to the client