mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 08:09:34 -05:00
SLAPI fixes (better documentation)
This commit is contained in:
parent
7298f9e55e
commit
2bc4da9378
2 changed files with 59 additions and 6 deletions
|
|
@ -1149,8 +1149,6 @@ slap_send_search_entry(
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LDAP_SLAPI
|
#ifdef LDAP_SLAPI
|
||||||
/* Support Sun ONE DS 5.x computed attributes */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First, setup the computed attribute context that is
|
* First, setup the computed attribute context that is
|
||||||
* passed to all plugins.
|
* passed to all plugins.
|
||||||
|
|
@ -1174,6 +1172,11 @@ slap_send_search_entry(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
|
* Technically we shouldn't be returning operational attributes
|
||||||
|
* when the user requested only user attributes. We'll let the
|
||||||
|
* plugin decide whether to be naughty or not.
|
||||||
|
*/
|
||||||
rc = compute_evaluator( &ctx, "*", e, slapi_x_compute_output_ber );
|
rc = compute_evaluator( &ctx, "*", e, slapi_x_compute_output_ber );
|
||||||
}
|
}
|
||||||
if ( rc == 1 ) {
|
if ( rc == 1 ) {
|
||||||
|
|
|
||||||
|
|
@ -2597,11 +2597,16 @@ void slapi_x_free_ldapmods (LDAPMod **mods)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun ONE DS 5.x computed attribute support
|
* Sun ONE DS 5.x computed attribute support. Computed attributes
|
||||||
|
* allow for dynamically generated operational attributes, a very
|
||||||
|
* useful thing indeed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write the computed attribute to a BerElement.
|
* Write the computed attribute to a BerElement. Complementary
|
||||||
|
* functions need to be defined for anything that replaces
|
||||||
|
* op->o_callback->sc_sendentry, if you wish to make computed
|
||||||
|
* attributes available to it.
|
||||||
*/
|
*/
|
||||||
int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e)
|
int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e)
|
||||||
{
|
{
|
||||||
|
|
@ -2707,6 +2712,15 @@ int slapi_x_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_En
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For some reason Sun don't use the normal plugin mechanism
|
||||||
|
* registration path to register an "evaluator" function (an
|
||||||
|
* "evaluator" is responsible for adding computed attributes;
|
||||||
|
* the nomenclature is somewhat confusing).
|
||||||
|
*
|
||||||
|
* As such slapi_compute_add_evaluator() registers the
|
||||||
|
* function directly.
|
||||||
|
*/
|
||||||
int slapi_compute_add_evaluator(slapi_compute_callback_t function)
|
int slapi_compute_add_evaluator(slapi_compute_callback_t function)
|
||||||
{
|
{
|
||||||
#ifdef LDAP_SLAPI
|
#ifdef LDAP_SLAPI
|
||||||
|
|
@ -2749,13 +2763,49 @@ done:
|
||||||
#endif /* LDAP_SLAPI */
|
#endif /* LDAP_SLAPI */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See notes above regarding slapi_compute_add_evaluator().
|
||||||
|
*/
|
||||||
int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function)
|
int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function)
|
||||||
{
|
{
|
||||||
#ifdef LDAP_SLAPI
|
#ifdef LDAP_SLAPI
|
||||||
|
Slapi_PBlock *pPlugin = NULL;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
pPlugin = slapi_pblock_new();
|
||||||
|
if ( pPlugin == NULL ) {
|
||||||
|
rc = LDAP_NO_MEMORY;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)SLAPI_PLUGIN_OBJECT );
|
||||||
|
if ( rc != LDAP_SUCCESS ) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, (void *)function );
|
||||||
|
if ( rc != LDAP_SUCCESS ) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = insertPlugin( NULL, pPlugin );
|
||||||
|
if ( rc != 0 ) {
|
||||||
|
rc = LDAP_OTHER;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if ( rc != LDAP_SUCCESS ) {
|
||||||
|
if ( pPlugin != NULL ) {
|
||||||
|
slapi_pblock_destroy( pPlugin );
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
#else
|
#else
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif /* LDAP_SLAPI */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue