X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-null%2Fnull.c;h=7d9ba21ac60f5374e3dc87f60b8255d3b8ad15b3;hb=e4b899df95374d56f79350a146fea649db3b2a57;hp=bbe0dcc50c2cbb7b22a79cb81c3cd9db4b5e474e;hpb=03340f440daf7b9fcb3db224f33340e9e6e14f8a;p=openldap diff --git a/servers/slapd/back-null/null.c b/servers/slapd/back-null/null.c index bbe0dcc50c..7d9ba21ac6 100644 --- a/servers/slapd/back-null/null.c +++ b/servers/slapd/back-null/null.c @@ -1,7 +1,21 @@ /* null.c - the null backend */ -/* - * Copyright 2002-2003 The OpenLDAP Foundation, All Rights Reserved. - * COPYING RESTRICTIONS APPLY, see COPYRIGHT file +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . + * + * Copyright 2002-2003 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . + */ +/* ACKNOWLEDGEMENTS: + * This work was originally developed by Howard Chu for inclusion + * in OpenLDAP Software. */ #include "portable.h" @@ -17,116 +31,39 @@ struct null_info { }; int -null_back_bind( - Backend *be, - Connection *conn, - Operation *op, - struct berval *dn, - struct berval *ndn, - int method, - struct berval *cred, - struct berval *edn -) +null_back_bind( Operation *op, SlapReply *rs ) { - struct null_info *ni = (struct null_info *) be->be_private; + struct null_info *ni = (struct null_info *) op->o_bd->be_private; - if( ni->bind_allowed ) + if ( ni->bind_allowed ) { /* front end will send result on success (0) */ return 0; - send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS, - NULL, NULL, NULL, NULL ); - return LDAP_INVALID_CREDENTIALS; -} - -int -null_back_add( - BackendDB *be, - Connection *conn, - Operation *op, - Entry *e ) -{ - send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL, NULL, NULL ); - return 0; -} + } -int -null_back_compare( - BackendDB *be, - Connection *conn, - Operation *op, - struct berval *dn, - struct berval *ndn, - AttributeAssertion *ava -) -{ - send_ldap_result( conn, op, LDAP_COMPARE_FALSE, NULL, NULL, NULL, NULL ); - return 0; -} + rs->sr_err = LDAP_INVALID_CREDENTIALS; + send_ldap_result( op, rs ); -int -null_back_delete( - BackendDB *be, - Connection *conn, - Operation *op, - struct berval *dn, - struct berval *ndn -) -{ - send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL, NULL, NULL ); - return 0; + return 1; } +/* add, delete, modify, modrdn, search */ int -null_back_modify( - BackendDB *be, - Connection *conn, - Operation *op, - struct berval *dn, - struct berval *ndn, - Modifications *modlist ) +null_back_success( Operation *op, SlapReply *rs ) { - send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL, NULL, NULL ); + rs->sr_err = LDAP_SUCCESS; + send_ldap_result( op, rs ); return 0; } +/* compare */ int -null_back_modrdn( - Backend *be, - Connection *conn, - Operation *op, - struct berval *dn, - struct berval *ndn, - struct berval *newrdn, - struct berval *nnewrdn, - int deleteoldrdn, - struct berval *newSuperior, - struct berval *nnewSuperior ) +null_back_false( Operation *op, SlapReply *rs ) { - send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL, NULL, NULL ); + rs->sr_err = LDAP_COMPARE_FALSE; + send_ldap_result( op, rs ); return 0; } -int -null_back_search( - BackendDB *be, - Connection *conn, - Operation *op, - struct berval *base, - struct berval *nbase, - int scope, - int deref, - int slimit, - int tlimit, - Filter *filter, - struct berval *filterstr, - AttributeName *attrs, - int attrsonly ) -{ - send_search_result( conn, op, LDAP_SUCCESS, NULL, NULL, NULL, NULL, 0 ); - return 1; -} - - int null_back_db_config( BackendDB *be, @@ -155,9 +92,7 @@ null_back_db_config( /* anything else */ } else { - fprintf( stderr, -"%s: line %d: unknown directive \"%s\" in null database definition (ignored)\n", - fname, lineno, argv[0] ); + return SLAP_CONF_UNKNOWN; } return 0; @@ -167,7 +102,11 @@ null_back_db_config( int null_back_db_init( BackendDB *be ) { - be->be_private = ch_calloc( 1, sizeof(struct null_info) ); + struct null_info *ni; + + ni = ch_calloc( 1, sizeof(struct null_info) ); + ni->bind_allowed = 0; + be->be_private = ni; return 0; } @@ -199,12 +138,12 @@ null_back_initialize( bi->bi_op_bind = null_back_bind; bi->bi_op_unbind = 0; - bi->bi_op_search = null_back_search; - bi->bi_op_compare = null_back_compare; - bi->bi_op_modify = null_back_modify; - bi->bi_op_modrdn = null_back_modrdn; - bi->bi_op_add = null_back_add; - bi->bi_op_delete = null_back_delete; + bi->bi_op_search = null_back_success; + bi->bi_op_compare = null_back_false; + bi->bi_op_modify = null_back_success; + bi->bi_op_modrdn = null_back_success; + bi->bi_op_add = null_back_success; + bi->bi_op_delete = null_back_success; bi->bi_op_abandon = 0; bi->bi_extended = 0;