X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-null%2Fnull.c;h=d5096f5f52b41fabdb1d01c2fb855549aa816d3a;hb=2c7f30061933e3bc65477ea2d9561b264497a6c9;hp=76b448dd12f6d2232c3f9e01e26fc4d122932339;hpb=3a4a442a513b9f41c3b71245e7db01ae02bcfd3d;p=openldap diff --git a/servers/slapd/back-null/null.c b/servers/slapd/back-null/null.c index 76b448dd12..d5096f5f52 100644 --- a/servers/slapd/back-null/null.c +++ b/servers/slapd/back-null/null.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2002-2005 The OpenLDAP Foundation. + * Copyright 2002-2006 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,15 +26,19 @@ #include "slap.h" struct null_info { - int bind_allowed; + int ni_bind_allowed; + ID ni_nextid; }; + +/* LDAP operations */ + static int null_back_bind( Operation *op, SlapReply *rs ) { struct null_info *ni = (struct null_info *) op->o_bd->be_private; - if ( ni->bind_allowed ) { + if ( ni->ni_bind_allowed ) { /* front end will send result on success (0) */ return LDAP_SUCCESS; } @@ -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, @@ -87,7 +135,7 @@ null_back_db_config( fname, lineno ); return 1; } - ni->bind_allowed = strcasecmp( argv[1], "off" ); + ni->ni_bind_allowed = strcasecmp( argv[1], "off" ); /* anything else */ } else { @@ -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) ); - ni->bind_allowed = 0; + 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; }