Exemplo n.º 1
0
Arquivo: delete.c Projeto: leto/389-ds
/* 	This is new style API to issue internal delete operation.
	pblock should contain the following data (can be set via call to slapi_delete_internal_set_pb):
	For uniqueid based operation:
		SLAPI_TARGET_DN set to dn that allows to select right backend, can be stale
		SLAPI_TARGET_UNIQUEID set to the uniqueid of the entry we are looking for
		SLAPI_CONTROLS_ARG set to request controls if present

	For dn based search:
		SLAPI_TARGET_DN set to the entry dn
		SLAPI_CONTROLS_ARG set to request controls if present		 				
 */
int slapi_delete_internal_pb (Slapi_PBlock *pb)
{
	if (pb == NULL)
		return -1;

	if (!allow_operation (pb))
	{
		slapi_send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
						 "This plugin is not configured to access operation target data", 0, NULL );
		return 0;
	}

	return delete_internal_pb (pb);
}
Exemplo n.º 2
0
Arquivo: add.c Projeto: Firstyear/ds
/*  This is new style API to issue internal add operation.
	pblock should contain the following data (can be set via call to slapi_add_internal_set_pb):
	SLAPI_TARGET_SDN	set to sdn of the new entry
	SLAPI_CONTROLS_ARG	set to request controls if present
	SLAPI_ADD_ENTRY		set to Slapi_Entry to add
	Beware: The entry is consumed. */
int slapi_add_internal_pb (Slapi_PBlock *pb)
{
	if (pb == NULL)
		return -1;

	if (!allow_operation (pb))
	{
		/* free the entry as it's expected to be consumed */
		Slapi_Entry *e;
		slapi_pblock_get(pb, SLAPI_ADD_ENTRY, &e);
		slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
		slapi_entry_free(e);

		slapi_send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
						 "This plugin is not configured to access operation target data", 0, NULL );
		return 0;
	}

	return add_internal_pb (pb);
}