|
||
|
|
This chapter contains reference information on Netscape Directory Server (Directory Server) server plug-in API. The server plug-in API includes the following functions:
- Distribution Routines
![]()
- Functions for Access Control
![]()
- Functions for Internal Operations and Plug-In Callback
![]()
- Functions for Setting Internal Operation Flags
![]()
- Functions for Handling Attributes
![]()
- Functions for Managing Backend Operations
![]()
- Functions for Dealing with Controls
![]()
- Functions for Syntax Plug-In
![]()
- Functions for Managing Memory
![]()
- Functions for Managing DNs
![]()
- Functions for Managing Entries
![]()
- Functions Related to Entry Flags
![]()
- Functions for Dealing with Filters
![]()
- Functions Specific to Extended Operation
![]()
- Functions Specific to Bind Methods
![]()
- Functions for Thread-Safe LDAP Connections
![]()
- Functions for Logging
![]()
- Functions for Handling Matching Rules
![]()
- Functions for LDAPMod Manipulation
![]()
- Functions for Monitoring Operations
![]()
- Functions for Managing Parameter Block
![]()
- Functions for Handling Passwords
![]()
- Functions for Managing RDN
![]()
- Functions for Managing Roles
![]()
- Functions for Managing DNs
![]()
- Functions for Sending Entries and Results to the Client
![]()
- Functions Related to UTF-8
![]()
- Functions for Handling Values
![]()
- Functions for Handling Valueset
![]()
- Functions Specific to Virtual Attribute Service
![]()
- Functions for Managing Locks and Synchronization
![]()
- Functions for Managing Computed Attributes
![]()
- Functions for Manipulating Bits
![]()
- Functions for Registering Object Extensions
![]()
- Functions Related to Data Interoperability
![]()
- Functions for Registering Additional Plug-Ins
![]()
Each section summarizes the front-end functions in a table followed by the function details.
This section contains reference information on distribution routines.
Table 15-1 Distribution Routines
distribution_plugin_entry_point()
Allows for backend distribution.
#include "slapi-plugin.h"
int distribution_plugin_entry_point (Slapi_PBlock *pb,
Slapi_DN *target_dn, char **mtn_be_names, int be_count,
Slapi_DN * node_dn);This function takes the following parameters:
Pointer to the list of names of backends declared for this node.
This function should return the index of the backend in the
mtn_be_namestable that is used to resolve the current operation. For search operations,SLAPI_BE_ALL_BACKENDScan be returned to specify that backends must be searched. The use ofSLAPI_BE_ALL_BACKENDSfor non-search operations is not supported and may give random results.Backend distribution is the capability to span the LDAP subtree contents under a specified DIT node into multiple backends in the same server and/or database links to other servers. Under such a configuration, this function is responsible for deciding where the database or database link under the DIT node will be applied. This function will be called for ever operation reaching a DIT node, including subtree search operations that are started above the node.
Note that this function can only be called if the server has been configured to take advantage of such capability.
This section contains reference information on access control routines.
Table 15-2 Access Control Routines
Determines if a user (who is requesting the current operation) has the access rights to perform an operation on a given entry, attribute, or value.
#include "slapi-plugin.h"
int slapi_access_allowed( Slapi_PBlock *pb, Slapi_Entry *e,
char *attr, struct berval *val, int access );This function takes the following parameters:
The value of the
accessargument can be one of the following:
Permission to compare the specified values of an attribute in an entry.
Permission to write a specified attribute or value or permission to rename a specified entry.
This function returns one of the following values:
LDAP_SUCCESSif the user has the specified rights to the entry, attribute, or value.![]()
LDAP_INSUFFICIENT_ACCESSif the user does not have the specified rights to the entry, attribute, or value.![]()
- If a problem occurs during processing, the function will return one of the following error codes:
![]()
Call this function to determine if a user has access rights to a specified entry, attribute, or value. The function performs this check for users who request the operation that invokes this plug-in.
For example, suppose you are writing a pre-operation plug-in for the add operation. You can call this function to determine if users have the proper access rights before they can add an entry to the directory.
As part of the process of determining if the user has access rights, the function does the following:
- Checks to see if the user requesting the operation is the root DN.
![]()
- If so, the function returns
LDAP_SUCCESS. (The root DN has permission to perform any operation.)
- Gets information about the operation being requested, the connection to the client, and the back-end database where directory information is stored.
![]()
- If (for some reason) the function cannot determine which operation is being requested, the function returns
LDAP_OPERATIONS_ERROR.![]()
- If no connection to a client exists (in other words, if the request for the operation was made by the server or its back-end), the function returns
LDAP_SUCCESS. (The server and its back-end are not restricted by access control lists.)![]()
- If the back-end database is read-only and the request is checking for write access (
SLAPI_ACL_WRITE), the function returnsLDAP_UNWILLING_TO_PERFORM.![]()
- Determines if the user requesting the operation is attempting to modify his or her own entry.
![]()
ACLs can be set up to allow users the rights to modify their own entries. The
slapi_access_allowed()function checks for this condition.The caller must ensure that the backend specified in the
pblockis set prior to calling this function. For example:be = slapi_be_select( slapi_entry_get_sdn_const( seObjectEntry ));
if ( NULL == be ) {
cleanup("backend selection failed for entry: \"%s\"\n",
szObjectDN);
slapi_send_ldap_result( pb, LDAP_NO_SUCH_OBJECT, NULL,
" Object could not be found", 0, NULL );
return( SLAPI_PLUGIN_EXTENDED_SENT_RESULT );
}
slapi_pblock_set( pb, SLAPI_BACKEND, be );
nAccessResult = slapi_access_allowed( pb, seObjectEntry,
"*", bval, SLAPI_ACL_DELETE);
Determines if a user has the rights to perform the specified modifications on an entry.
#include "slapi-plugin.h"
int slapi_acl_check_mods( Slapi_PBlock *pb, Slapi_Entry *e,
LDAPMod **mods, char **errbuf );This function takes the following parameters:
Array of
LDAPModstructures that represent the modifications to be made to the entry.Pointer to a string containing an error message if an error occurs during the processing of this function.
This function returns one of the following values:
LDAP_SUCCESSif the user has write permission to the values in the specified attributes.![]()
LDAP_INSUFFICIENT_ACCESSif the user does not have write permission to the values of the specified attribute.![]()
- If a problem occurs during processing, the function will return one of the following error codes:
![]()
Call this function to determine if a user has access rights to modify the specified entry. The function performs this check for users who request the operation that invokes this plug-in.
For example, suppose you are writing a database plug-in. You can call this function to determine if users have the proper access rights before they can add, modify, or delete entries from the database.
As part of the process of determining if the user has access rights, the
slapi_access_allowed()function does the following:
- Checks to access control for the directory is disabled (for example, if the
dse.ldiffile contains the directiveaccesscontrol off).![]()
- If access control is disabled, the function returns
LDAP_SUCCESS.
- For each value in each attribute specified in the
LDAPModarray, the function determines if the user has permissions to write to that value. (Essentially, the function callsslapi_access_allowed()withSLAPI_ACL_WRITEas the access right to check.)![]()
- If for some reason the function cannot determine which operation is being requested, the function returns
LDAP_OPERATIONS_ERROR.![]()
- If no connection to a client exists (in other words, if the request for the operation was made by the server or its back-end), the function returns
LDAP_SUCCESS. (The server and its back-end are not restricted by access control lists.)![]()
- If the back-end database is read-only and the request is checking for write access (
SLAPI_ACL_WRITE), the function returnsLDAP_UNWILLING_TO_PERFORM.![]()
You must free the
errbufbuffer by callingslapi_ch_free()when you are finished using the error message.
Determines whether or not the access control items (ACIs) on an entry are valid.
#include "slapi-plugin.h"
int slapi_acl_verify_aci_syntax (Slapi_Entry *e,
char **errbuf);This function takes the following parameters:
Pointer to the error message returned if the ACI syntax is invalid.
This function returns one of the following values:
You must free the
errbufbuffer by callingslapi_ch_free()when you are finished using the error message.Functions for Internal Operations and Plug-In Callback
This section contains reference information on routines for internal operations and plug-in callbacksthese functions can be used for internal operations based on DN as well as on unique ID. These functions should be used by all new plug-ins and preferably old plug-ins should be changed to use them to take advantage of new plug-in configuration capabilities and to use an extensible interface.
Table 15-3 Internal Operations and Plug-In Callback Routines
Adds an LDAP add operation based on a parameter block to add a new directory entry.
#include "slapi-plugin.h"
int slapi_add_internal_pb(Slapi_PBlock *pb);This function takes the following parameter:
A parameter block that has been initialized using
slapi_add_internal_set_pb().
This function returns one of the following values:
- 0 if successful.
![]()
- -1 if an error occurs. If -1 is returned, the
SLAPI_PLUGIN_INTOP_RESULTfield of the parameter block should be consulted to determine the precise LDAP result code.![]()
The function performs an internal add operation based on a parameter block. The parameter block should be initialized by calling
slapi_add_internal_set_pb()orslapi_add_entry_internal_set_pb().None of the parameters that are passed
slapi_add_internal_set_pb()are altered or consumed by this function. The entry parameter that is passed toslapi_add_entry_internal_set_pb()is consumed by a successful call to this function.
Performs an LDAP delete operation based on a parameter block to remove a directory entry.
#include "slapi-plugin.h"
int slapi_delete_internal_pb(Slapi_PBlock *pb);This function takes the following parameter:
A parameter block that has been initialized using
slapi_delete_internal_set_pb().
This function returns one of the following values:
- 0 if successful.
![]()
- -1 if an error occurs. If -1 is returned, the
SLAPI_PLUGIN_INTOP_RESULTfield of the parameter block should be consulted to determine the precise LDAP result code.![]()
This function performs an internal delete operation based on a parameter block. The parameter block should be initialized by calling
slapi_delete_internal_set_pb().None of the parameters that are passed to
slapi_delete_internal_set_pb()are altered or consumed by this function.slapi_free_search_results_internal()
Frees search results returned by the
slapi_search_internal_pb()andslapi_search_internal_callback_pb()functions.#include "slapi-plugin.h"
void slapi_free_search_results_internal(Slapi_PBlock *pb);This function takes the following parameters:
Parameter block returned by the
slapi_search_internal_pb()andslapi_search_internal_callback_pb()functions.
This function must be called when you are finished with the entries before freeing the
pblock.
Performs an LDAP modify operation based on a parameter block to modify a directory entry.
#include "slapi-plugin.h"
int slapi_modify_internal_pb(Slapi_PBlock *pb);This function takes the following parameter:
A parameter block that has been initialized using
slapi_modify_internal_set_pb().
This function returns one of the following values:
- 0 if successful.
![]()
- -1 if an error occurs. If -1 is returned, the
SLAPI_PLUGIN_INTOP_RESULTfield of the parameter block should be consulted to determine the precise LDAP result code.![]()
This function performs an internal modify operation based on a parameter block. The parameter block should be initialized by calling
slapi_modify_internal_set_pb().None of the parameters that are passed to
slapi_modify_internal_set_pb()are altered or consumed by this function.
Performs an LDAP modify RDN operation based on a parameter block to rename a directory entry.
#include "slapi-plugin.h"
int slapi_modrdn_internal_pb(Slapi_PBlock *pb);This function takes the following parameter:
A parameter block that has been initialized using
slapi_rename_internal_set_pb().
This function returns one of the following values:
- 0 if successful.
![]()
- -1 if an error occurs. If -1 is returned, the
SLAPI_PLUGIN_INTOP_RESULTfield of the parameter block should be consulted to determine the precise LDAP result code.![]()
This function performs an internal modify RDN operation based on a parameter block. The parameter block should be initialized by calling
slapi_rename_internal_set_pb().None of the parameters that are passed to
slapi_modrdn_internal_set_pb()are altered or consumed by this function.slapi_search_internal_callback_pb()
Performs an LDAP search operation based on a parameter block to search the directory. Unlike
slapi_search_internal_pb(), this function allows you to specify callback functions that are invoked when the search operation finds matching entries or entries with referrals.#include "slapi-plugin.h"
int slapi_search_internal_callback_pb(Slapi_PBlock *pb,
void *callback_data,plugin_result_callback prc,
plugin_search_entry_callback psec,
plugin_referral_entry_callback prec);This function takes the following parameters:
A parameter block that has been initialized using
slapi_seq_internal_callback_set_pb().A pointer to arbitrary plug-in or operation-specific data that you would like to pass to your callback functions.
Callback function that the server calls to send result codes. The function must have the prototype specified by
plugin_result_callback.Callback function that the server calls when finding a matching entry in the directory. The function must have the prototype specified by
plugin_search_entry_callback.Callback function that the server calls when finding an entry that contains LDAP v3 referrals. The function must have the prototype specified by
plugin_referral_entry_callback.
This function returns one of the following values:
- 0 if successful.
![]()
- -1 if an error occurs. If -1 is returned, the
SLAPI_PLUGIN_INTOP_RESULTfield of the parameter block should be consulted to determine the precise LDAP result code.![]()
Like
slapi_search_internal_pb(), this function allows you to search the directory from a plug-in function. Unlike a search operation requested by a client, no result code, search entries, or referrals are sent to a client byslapi_search_internal_callback_pb(). However, you can write your own callback functions that are invoked when these events occur:
- You can write a callback function that is invoked when the search operation normally sends a result code to the client.
![]()
- This function must have the prototype specified by
plugin_result_callback. You specify this function in theprcargument ofslapi_search_internal_callback_pb().
- You can write a callback function that is invoked when the search operation normally sends a search entry to the client.
![]()
- This function must have the prototype specified by
plugin_search_entry_callback. You specify this function in thepsecargument ofslapi_search_internal_callback_pb().
- You can write a callback function that is invoked when the search operation normally sends LDAP v3 search result references.
![]()
- This function must have the prototype specified by
plugin_referral_entry_callback. You specify this function in theprecargument ofslapi_search_internal_callback_pb(). You can also pass arbitrary plug-in or operation-specific data to these callback functions. Specify the data that you want to pass as thecallback_dataargument ofslapi_search_internal_callback_pb().
The entries passed to the search entry callback function do not need to be freed. If you need to access an entry after returning from the callback function, call
slapi_entry_dup()to make a copy.The referral URLs passed to the referral entry callback function do not need to be freed. If you need to access a referral string after returning from the callback function, call
slapi_ch_strdup()to make a copy.You do not need to call
slapi_free_search_results_internal()after callingslapi_search_internal_callback_pb().slapi_search_internal_get_entry()
Performs an internal search operation to read one entry (that is, it performs a base object search).
#include "slapi-plugin.h"
int slapi_search_internal_get_entry( Slapi_DN *dn,
char ** attrlist, Slapi_Entry **ret_entry, void *caller_identity);This function takes the following parameter:
A
NULLterminated array of attribute types to return from entries that match filter. If you specify aNULL, all attributes will be returned.The address of a
Slapi_Entrypointer to receive the entry if it is found.A plug-in or component identifier. This value can be obtained from the
SLAPI_PLUGIN_IDENTITYfield of the parameter block that is passed to your plug-in initialization function.
This function returns the LDAP result code for the search operation.
This function performs an internal search operation to read one entry (that is, it preforms a base object search). If an entry named by
dnis found, theret_entrypointer will be set to point to a copy of the entry that contains the attribute values specified by theattrlistparameter.The returned entry (
*ret_entry) should be freed by callingslapi_entry_free().
Performs an LDAP search operation based on a parameter block to search the directory.
#include "slapi-plugin.h"
int slapi_search_internal_pb(Slapi_PBlock *pb);This function takes the following parameter:
A parameter block that has been initialized using
slapi_search_internal_set_pb().
This function returns one of the following values:
- 0 if successful.
![]()
- -1 if an error occurs. If -1 is returned, the
SLAPI_PLUGIN_INTOP_RESULTfield of the parameter block should be consulted to determine the precise LDAP result code.![]()
This function performs an internal search based on a parameter block. The parameter block should be initialized by calling the
slapi_search_internal_set_pb()function.
slapi_free_search_results_internal()should be called to dispose of any entires and other items that were allocated by a call toslapi_search_internal_pb().Functions for Setting Internal Operation Flags
This section contains reference information on routines for setting internal-operation flags.
Table 15-4 Internal Operation Flag Routines
Sets up a parameter block so that it can be used by
slapi_add_internal_pb()for an internal add operation.Sets up a parameter block so that it can be used by
slapi_add_internal_pb()for an internal add operation; the entry is constructed from a DN and a set of attributes.Sets up a parameter block so that it can be used by
slapi_delete_internal_pb()for an internal delete operation.Sets up a parameter block so that it can be used by
slapi_modify_internal_pb()for an internal modify operation.Sets up a parameter block so that it can be used by
slapi_modrdn_internal_pb()for an internal rename operation.Sets up a parameter block so that it can be used by
slapi_search_internal_pb()for an internal search operation.Sets up a parameter block for use by
slapi_seq_internal_callback_pb()for an internal, sequential-access operation.slapi_add_entry_internal_set_pb()
Sets up a parameter block so that it can be used by
slapi_add_internal_pb()for an internal add operation.#include "slapi-plugin.h"
void slapi_add_entry_internal_set_pb(Slapi_PBlock *pb,
Slapi_Entry *e, LDAPControl **controls,
Slapi_ComponentId *plugin_identity, int operation_flags);This function takes the following parameters:
This function populates parameters in the
pblockstructure so that it can be used byslapi_add_internal_pb()for an internal add operation.
Sets up a parameter block so that it can be used by
slapi_add_internal_pb()for an internal add operation.#include "slapi-plugin.h"
int slapi_add_internal_set_pb(Slapi_PBlock *pb, const char *dn,
LDAPMod **attrs, LDAPControl **controls,
Slapi_ComponentId *plugin_identity, int operation_flags);This function takes the following parameters:
This function is similar to
slapi_add_entry_internal_set_pb()except that it constructs the entry from a DN and a set of attributes. The function setspblockto contain the following data:
SLAPI_TARGET_DNset to DN of the new entry.![]()
SLAPI_CONTROLS_ARGset to request controls, if present.![]()
SLAPI_ADD_ENTRYset toSlapi_Entryto add.![]()
This function returns
LDAP_SUCCESSor one of the LDAP error codes if the entry cannot be constructed from the specified attributes due to constraint violation.slapi_delete_internal_set_pb()
Sets up a parameter block so that it can be used by
slapi_delete_internal_pb()for an internal delete operation.#include "slapi-plugin.h"
void slapi_delete_internal_set_pb (Slapi_PBlock *pb, const char *dn,
LDAPControl **controls, const char *uniqueid,
Slapi_ComponentId *plugin_identity, int operation_flags);This function takes the following parameters:
This function populates
pblockto contain data for use byslapi_delete_internal_pb()for an internal delete operation.For unique identifier-based operation:
SLAPI_TARGET_DNset to the DN that allows to select the right backend.![]()
SLAPI_TARGET_UNIQUEIDset to the unique ID of the entry.![]()
SLAPI_CONTROLS_ARGset request controls, if present.![]()
slapi_modify_internal_set_pb()
Sets up a parameter block so that it can be used by
slapi_modify_internal_pb()for an internal modify operation.#include "slapi-plugin.h"
void slapi_modify_internal_set_pb(Slapi_PBlock *pb, const char *dn,
LDAPMod **mods, LDAPControl **controls, const char *uniqueid,
Slapi_ComponentId *plugin_identity, int operation_flags);This function takes the following parameters:
This function populates
pblockto contain data for use byslapi_modify_internal_pb()for an internal modify operation.For unique ID-based operation:
SLAPI_TARGET_DNset to the DN that allows to select the right backend.![]()
SLAPI_TARGET_UNIQUEIDset to the unique ID of the entry.![]()
SLAPI_MODIFY_MODSset to the mods.![]()
SLAPI_CONTROLS_ARGset to request controls, if present.![]()
SLAPI_TARGET_DNset to the entry DN.![]()
SLAPI_MODIFY_MODSset to the mods.![]()
SLAPI_CONTROLS_ARGset to request controls, if present.![]()
slapi_rename_internal_set_pb()
Sets up a parameter block so that it can be used by
slapi_modrdn_internal_pb()for an internal rename operation.#include "slapi-plugin.h"
void slapi_rename_internal_set_pb(Slapi_PBlock *pb,
const char *olddn, const char *newrdn, const char *newsuperior,
int deloldrdn, LDAPControl **controls, const char *uniqueid,
Slapi_ComponentId *plugin_identity, int operation_flags);This function takes the following parameters:
This function populates
pblockwith parameters for use byslapi_modrdn_internal_pb()for an internal rename operation. The function sets the parameter block to contain the following data.For unique ID-based operation:
SLAPI_TARGET_DNset to the DN that allows to select the right backend.![]()
SLAPI_TARGET_UNIQUEIDset to the uniqueid of the entry.![]()
SLAPI_MODRDN_NEWRDNset to the new RDN of the entry.![]()
SLAPI_MODRDN_DELOLDRDNindicates whether the old RDN should be kept in the entry.![]()
LAPI_CONTROLS_ARGset to request controls, if present.![]()
SLAPI_TARGET_DNset to the entry DN.![]()
SLAPI_MODRDN_NEWRDNset to the new RDN of the entry.![]()
SLAPI_MODRDN_DELOLDRDNindicates whether the old RDN should be kept in the entry.![]()
SLAPI_CONTROLS_ARGset to request controls, if present.![]()
slapi_search_internal_set_pb()
Sets up a parameter block so that it can be used by
slapi_search_internal_pb()for an internal search operation.#include "slapi-plugin.h"
void slapi_search_internal_set_pb(Slapi_PBlock *pb,
const char *base, int scope, const char *filter, char **attrs,
int attrsonly, LDAPControl **controls, const char *uniqueid,
Slapi_ComponentId *plugin_identity, int operation_flags);This function takes the following parameters:
This function sets up the parameter block, for subsequent use by
slapi_search_internal_pb(), to contain the following data for an internal search operation.
SLAPI_TARGET_DNset to the DN that allows to select the right backend.![]()
SLAPI_TARGET_UNIQUEIDset to the unique ID of the entry.![]()
SLAPI_TARGET_DNset to the search base.![]()
SLAPI_SEARCH_SCOPEset to the search scope.![]()
SLAPI_SEARCH_STRFILTERset to the search filter.![]()
SLAPI_CONTROLS_ARGset to request controls, if present.![]()
SLAPI_SEARCH_ATTRSset to the list of attributes to return.![]()
SLAPI_SEARCH_ATTRSONLYindicates whether attribute values should be returned.![]()
slapi_seq_internal_callback_pb()
Performs internal sequential access operation.
#include "slapi-plugin.h"
int slapi_seq_internal_callback_pb(Slapi_PBlock *pb,
void *callback_data, plugin_result_callback res_callback,
plugin_search_entry_callback srch_callback,
plugin_referral_entry_callback ref_callback);This function takes the following parameters:
Parameter block initialized with operation parameters. The easiest way to provide required parameters is by calling
slapi_seq_internal_set_pb()function. Parameters can also be set directly.
This function performs internal sequential access operation.
This function returns 0 on success; -1 on error.
Sets up a parameter block for use by
slapi_seq_internal_callback_pb()for an internal, sequential-access operation.#include "slapi-plugin.h"
void slapi_seq_internal_set_pb(Slapi_PBlock *pb, char *ibase,
int type, char *attrname, char *val, char **attrs, int attrsonly,
LDAPControl **controls, Slapi_ComponentId *plugin_identity,
int operation_flags);This function takes the following parameters:
This function sets up
pblockfor use byslapi_seq_internal_callback_pb()for an internal, sequential-access operation; the function sets up the parameter block contain the following data:
SLAPI_SEARCH_TARGETset to the search base.![]()
SAPI_SEQ_TYPEset to the sequential-access type (SLAPI_SEQ_FIRST,SLAPI_SEQ_NEXT, and so on.)![]()
SLAPI_SEQ_ATTRNAMEdefines attribute value assertion relative to which access is performed.![]()
SLAPI_SEQ_VALdefines attribute value assertion relative to which access is performed.![]()
SLAPI_CONTROLS_ARGset to request controls, if present.![]()
SLAPI_SEARCH_ATTRSset to the list of attributes to return.![]()
SLAPI_SEARCH_ATTRSONLYindicates whether attribute values should be returned.![]()
Functions for Handling Attributes
This section contains reference information on attribute routines.
#include "slapi-plugin.h"
int slapi_attr_add_value(Slapi_Attr *a, const Slapi_Value *v);This function takes the following parameters:
This function always returns 0.
Returns the base type of an attribute (for example, if given
cn;lang-jp, returnscn).#include "slapi-plugin.h"
char *slapi_attr_basetype( char *type, char *buf,
size_t bufsiz );This function takes the following parameters:
This function returns
NULLif the base type fits in the buffer. If the base type is longer than the buffer, the function allocates memory for the base type and returns a pointer to it.This function returns the base type of an attribute (for example, if given
cn;lang-jp,returnscn).You should free the returned base type when done by calling
slapi_ch_free().
#include "slapi-plugin.h"
Slapi_Attr *slapi_attr_dup(const Slapi_Attr *attr);This function takes the following parameters:
This function returns the newly created copy of the attribute.
Use this function to make a copy of an attribute.
You must free the returned attribute using
slapi_attr_free().
Gets the first value of an attribute.
#include "slapi-plugin.h"
int slapi_attr_first_value( Slapi_Attr *a, Slapi_Value **v );This function takes the following parameters:
This function returns one of the following values:
Use this function to get the first value of an attribute. This is part of a set of functions to enumerate over an
Slapi_Attrstructure.
Determines if certain flags are set for a particular attribute. These flags can identify an attribute as a single-valued attribute, an operational attribute, or as a read-only attribute.
#include "slapi-plugin.h"
int slapi_attr_flag_is_set( Slapi_Attr *attr, unsigned long flag );This function takes the following parameters:
The value of the
flagargument can be one of the following:
Flag that determines if the attribute is an operational attribute.
This function returns one of the following values:
This function determines if certain flags are set for a particular attribute. These flags can identify an attribute as a single-valued attribute, an operational attribute, or as a read-only attribute.
#include "slapi-plugin.h"
void slapi_attr_free( Slapi_Attr **a );This function takes the following parameters:
Use this function to free an attribute when you are finished with it.
Puts the values contained in an attribute into an array of
bervalstructures.#include "slapi-plugin.h"
int slapi_attr_get_bervals_copy( Slapi_Attr *a,
struct berval ***vals );This function takes the following parameters:
Pointer to an array of
bervalstructure pointers to hold the desired values.
This function returns one of the following values:
This function copies the values from an attribute into an array of
bervalstructure pointers.You should free this array using
ber_bvecfreefrom the LDAP SDK for C.
Gets the flags associated with the specified attribute. These flags can identify an attribute as a single-valued attribute, an operational attribute, or as a read-only attribute.
#include "slapi-plugin.h"
int slapi_attr_get_flags( Slapi_Attr *attr, unsigned long *flags );This function takes the following parameters:
When you call
slapi_attr_get_flags(), this parameter is set to a pointer to the flags of the specified attribute. Do not free the flags; the flags are part of the actual data in the attribute, not a copy of the data.
To determine which flags have been set, you can bitwise AND the value of the
flagsargument with one or more of the following:
Flag that determines if the attribute is an operational attribute.
This function returns 0 if successful.
This function gets the flags associated with the specified attribute. These flags can identify an attribute as a single-valued attribute, an operational attribute, or as a read-only attribute.
Puts the count of values of an attribute into a provided integer.
#include "slapi-plugin.h"
int slapi_attr_get_numvalues( const Slapi_Attr *a, int *numValues);This function takes the following parameters:
This function always returns 0.
This function counts the number of values in an attribute and places that count in an integer.