1 /* null.c - the null backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2002-2003 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This work was originally developed by Howard Chu for inclusion
18 * in OpenLDAP Software.
24 #include <ac/string.h>
34 null_back_bind( Operation *op, SlapReply *rs )
36 struct null_info *ni = (struct null_info *) op->o_bd->be_private;
38 if ( ni->bind_allowed ) {
39 /* front end will send result on success (0) */
43 rs->sr_err = LDAP_INVALID_CREDENTIALS;
44 send_ldap_result( op, rs );
49 /* add, delete, modify, modrdn, search */
51 null_back_success( Operation *op, SlapReply *rs )
53 rs->sr_err = LDAP_SUCCESS;
54 send_ldap_result( op, rs );
60 null_back_false( Operation *op, SlapReply *rs )
62 rs->sr_err = LDAP_COMPARE_FALSE;
63 send_ldap_result( op, rs );
75 struct null_info *ni = (struct null_info *) be->be_private;
78 fprintf( stderr, "%s: line %d: null database info is null!\n",
83 /* bind requests allowed */
84 if ( strcasecmp( argv[0], "bind" ) == 0 ) {
87 "%s: line %d: missing <on/off> in \"bind <on/off>\" line\n",
91 ni->bind_allowed = strcasecmp( argv[1], "off" );
96 "%s: line %d: unknown directive \"%s\" in null database definition (ignored)\n",
97 fname, lineno, argv[0] );
105 null_back_db_init( BackendDB *be )
107 struct null_info *ni;
109 ni = ch_calloc( 1, sizeof(struct null_info) );
110 ni->bind_allowed = 0;
116 null_back_db_destroy(
120 free( be->be_private );
126 null_back_initialize(
135 bi->bi_db_init = null_back_db_init;
136 bi->bi_db_config = null_back_db_config;
139 bi->bi_db_destroy = null_back_db_destroy;
141 bi->bi_op_bind = null_back_bind;
142 bi->bi_op_unbind = 0;
143 bi->bi_op_search = null_back_success;
144 bi->bi_op_compare = null_back_false;
145 bi->bi_op_modify = null_back_success;
146 bi->bi_op_modrdn = null_back_success;
147 bi->bi_op_add = null_back_success;
148 bi->bi_op_delete = null_back_success;
149 bi->bi_op_abandon = 0;
153 bi->bi_chk_referrals = 0;
155 bi->bi_connection_init = 0;
156 bi->bi_connection_destroy = 0;
161 #ifdef SLAPD_NULL_DYNAMIC
162 int back_null_LTX_init_module(
168 memset( &bi, '\0', sizeof(bi) );
170 bi.bi_init = null_back_initialize;
175 #endif /* SLAPD_NULL_DYNAMIC */