mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-31 03:59:34 -05:00
Null backend support for slapadd and slapcat
This commit is contained in:
parent
fc1514431c
commit
e0a8e693af
1 changed files with 58 additions and 4 deletions
|
|
@ -26,9 +26,13 @@
|
|||
#include "slap.h"
|
||||
|
||||
struct null_info {
|
||||
int ni_bind_allowed;
|
||||
int ni_bind_allowed;
|
||||
ID ni_nextid;
|
||||
};
|
||||
|
||||
|
||||
/* LDAP operations */
|
||||
|
||||
static int
|
||||
null_back_bind( Operation *op, SlapReply *rs )
|
||||
{
|
||||
|
|
@ -63,6 +67,50 @@ null_back_false( Operation *op, SlapReply *rs )
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Slap tools */
|
||||
|
||||
static int
|
||||
null_tool_entry_open( BackendDB *be, int mode )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
null_tool_entry_close( BackendDB *be )
|
||||
{
|
||||
assert( be != NULL );
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ID
|
||||
null_tool_entry_next( BackendDB *be )
|
||||
{
|
||||
return NOID;
|
||||
}
|
||||
|
||||
static Entry *
|
||||
null_tool_entry_get( BackendDB *be, ID id )
|
||||
{
|
||||
assert( slapMode & SLAP_TOOL_MODE );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ID
|
||||
null_tool_entry_put( BackendDB *be, Entry *e, struct berval *text )
|
||||
{
|
||||
assert( slapMode & SLAP_TOOL_MODE );
|
||||
assert( text != NULL );
|
||||
assert( text->bv_val != NULL );
|
||||
assert( text->bv_val[0] == '\0' ); /* overconservative? */
|
||||
|
||||
e->e_id = ((struct null_info *) be->be_private)->ni_nextid++;
|
||||
return e->e_id;
|
||||
}
|
||||
|
||||
|
||||
/* Setup */
|
||||
|
||||
static int
|
||||
null_back_db_config(
|
||||
BackendDB *be,
|
||||
|
|
@ -100,10 +148,9 @@ null_back_db_config(
|
|||
static int
|
||||
null_back_db_init( BackendDB *be )
|
||||
{
|
||||
struct null_info *ni;
|
||||
|
||||
ni = ch_calloc( 1, sizeof(struct null_info) );
|
||||
struct null_info *ni = ch_calloc( 1, sizeof(struct null_info) );
|
||||
ni->ni_bind_allowed = 0;
|
||||
ni->ni_nextid = 1;
|
||||
be->be_private = ni;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -147,6 +194,13 @@ null_back_initialize( BackendInfo *bi )
|
|||
bi->bi_connection_init = 0;
|
||||
bi->bi_connection_destroy = 0;
|
||||
|
||||
bi->bi_tool_entry_open = null_tool_entry_open;
|
||||
bi->bi_tool_entry_close = null_tool_entry_close;
|
||||
bi->bi_tool_entry_first = null_tool_entry_next;
|
||||
bi->bi_tool_entry_next = null_tool_entry_next;
|
||||
bi->bi_tool_entry_get = null_tool_entry_get;
|
||||
bi->bi_tool_entry_put = null_tool_entry_put;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue