1 /* null.c - the null backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2002-2004 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>
32 extern BI_init null_back_initialize;
34 extern BI_db_init null_back_db_init;
35 extern BI_db_destroy null_back_db_destroy;
36 extern BI_db_config null_back_db_config;
38 extern BI_op_bind null_back_bind;
39 extern BI_op_search null_back_search;
40 extern BI_op_compare null_back_compare;
41 extern BI_op_modify null_back_modify;
42 extern BI_op_modrdn null_back_modrdn;
43 extern BI_op_add null_back_add;
44 extern BI_op_delete null_back_delete;
51 null_back_bind( Operation *op, SlapReply *rs )
53 struct null_info *ni = (struct null_info *) op->o_bd->be_private;
55 if ( ni->bind_allowed ) {
56 /* front end will send result on success (0) */
60 rs->sr_err = LDAP_INVALID_CREDENTIALS;
61 send_ldap_result( op, rs );
66 /* add, delete, modify, modrdn, search */
68 null_back_success( Operation *op, SlapReply *rs )
70 rs->sr_err = LDAP_SUCCESS;
71 send_ldap_result( op, rs );
77 null_back_false( Operation *op, SlapReply *rs )
79 rs->sr_err = LDAP_COMPARE_FALSE;
80 send_ldap_result( op, rs );
92 struct null_info *ni = (struct null_info *) be->be_private;
95 fprintf( stderr, "%s: line %d: null database info is null!\n",
100 /* bind requests allowed */
101 if ( strcasecmp( argv[0], "bind" ) == 0 ) {
104 "%s: line %d: missing <on/off> in \"bind <on/off>\" line\n",
108 ni->bind_allowed = strcasecmp( argv[1], "off" );
112 return SLAP_CONF_UNKNOWN;
120 null_back_db_init( BackendDB *be )
122 struct null_info *ni;
124 ni = ch_calloc( 1, sizeof(struct null_info) );
125 ni->bind_allowed = 0;
131 null_back_db_destroy(
135 free( be->be_private );
141 null_back_initialize(
150 bi->bi_db_init = null_back_db_init;
151 bi->bi_db_config = null_back_db_config;
154 bi->bi_db_destroy = null_back_db_destroy;
156 bi->bi_op_bind = null_back_bind;
157 bi->bi_op_unbind = 0;
158 bi->bi_op_search = null_back_success;
159 bi->bi_op_compare = null_back_false;
160 bi->bi_op_modify = null_back_success;
161 bi->bi_op_modrdn = null_back_success;
162 bi->bi_op_add = null_back_success;
163 bi->bi_op_delete = null_back_success;
164 bi->bi_op_abandon = 0;
168 bi->bi_chk_referrals = 0;
170 bi->bi_connection_init = 0;
171 bi->bi_connection_destroy = 0;
176 #if SLAPD_NULL == SLAPD_MOD_DYNAMIC
178 /* conditionally define the init_module() function */
179 SLAP_BACKEND_INIT_MODULE( null )
181 #endif /* SLAPD_NULL == SLAPD_MOD_DYNAMIC */