26.6. slapi_filter_get_ava()

Gets the attribute type and the value from the filter.
Description

Filters of the type LDAP_FILTER_EQUALITY, LDAP_FILTER_GE, LDAP_FILTER_LE, and LDAP_FILTER_APPROX generally compare a value against an attribute. For example:

					(cn=Barbara Jensen)
This filter finds entries in which the value of the cn attribute is equal to Barbara Jensen.
The attribute type is returned in the parameter type, and the value is returned in the parameter bval.
Syntax

#include "slapi-plugin.h"
int slapi_filter_get_ava( Slapi_Filter *f, char **type, struct berval **bval );

Parameters

This function takes the following parameters:

f
Filter from which you want to get the attribute and value.
type
Pointer to the attribute type of the filter.
bval
Pointer to the address of the berval structure containing the value of the filter.
Returns

This function returns one of the following values:

  • 0 if successful.
  • -1 if the filter is not one of the types listed above.
Memory Concerns

The strings within the parameters type and bval are direct pointers to memory inside the Slapi_Filter and therefore should not be freed after usage. They will be freed when a server entity calls slapi_filter_free() after usage of the Slapi_Filter structure.