24.11. slapi_entry_attr_find()

Determines if an entry contains the specified attribute. If the entry contains the attribute, the function returns a pointer to the attribute.
Syntax

#include "slapi-plugin.h"
int slapi_entry_attr_find( const Slapi_Entry *e, const char *type, Slapi_Attr **attr );

Parameters

This function takes the following parameters:

e
Entry that you want to check.
type
Name of the attribute that you want to check.
attr
Pointer to the attribute, if the attribute is in the entry.
Returns

This function returns one of the following values:

  • 0 if the entry contains the specified attribute.
  • -1 if the entry does not contain the specified attribute.
Memory Concerns

Do not free the returned attr. It is a pointer to the internal entry data structure. It is usually wise to make a copy of the returned attr, using slapi_attr_dup(), to avoid dangling pointers if the entry is freed while the pointer to attr is still being used.