1 /* null.c - the null backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2002-2005 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 Hallvard Furuseth for inclusion
18 * in OpenLDAP Software.
24 #include <ac/string.h>
33 null_back_bind( Operation *op, SlapReply *rs )
35 struct null_info *ni = (struct null_info *) op->o_bd->be_private;
37 if ( ni->bind_allowed ) {
38 /* front end will send result on success (0) */
42 rs->sr_err = LDAP_INVALID_CREDENTIALS;
43 send_ldap_result( op, rs );
48 /* add, delete, modify, modrdn, search */
50 null_back_success( Operation *op, SlapReply *rs )
52 rs->sr_err = LDAP_SUCCESS;
53 send_ldap_result( op, rs );
59 null_back_false( Operation *op, SlapReply *rs )
61 rs->sr_err = LDAP_COMPARE_FALSE;
62 send_ldap_result( op, rs );
74 struct null_info *ni = (struct null_info *) be->be_private;
77 fprintf( stderr, "%s: line %d: null database info is null!\n",
82 /* bind requests allowed */
83 if ( strcasecmp( argv[0], "bind" ) == 0 ) {
86 "%s: line %d: missing <on/off> in \"bind <on/off>\" line\n",
90 ni->bind_allowed = strcasecmp( argv[1], "off" );
94 return SLAP_CONF_UNKNOWN;
101 null_back_db_init( BackendDB *be )
103 struct null_info *ni;
105 ni = ch_calloc( 1, sizeof(struct null_info) );
106 ni->bind_allowed = 0;
112 null_back_db_destroy( Backend *be )
114 free( be->be_private );
120 null_back_initialize( BackendInfo *bi )
127 bi->bi_db_init = null_back_db_init;
128 bi->bi_db_config = null_back_db_config;
131 bi->bi_db_destroy = null_back_db_destroy;
133 bi->bi_op_bind = null_back_bind;
134 bi->bi_op_unbind = 0;
135 bi->bi_op_search = null_back_success;
136 bi->bi_op_compare = null_back_false;
137 bi->bi_op_modify = null_back_success;
138 bi->bi_op_modrdn = null_back_success;
139 bi->bi_op_add = null_back_success;
140 bi->bi_op_delete = null_back_success;
141 bi->bi_op_abandon = 0;
145 bi->bi_chk_referrals = 0;
147 bi->bi_connection_init = 0;
148 bi->bi_connection_destroy = 0;
153 #if SLAPD_NULL == SLAPD_MOD_DYNAMIC
155 /* conditionally define the init_module() function */
156 SLAP_BACKEND_INIT_MODULE( null )
158 #endif /* SLAPD_NULL == SLAPD_MOD_DYNAMIC */