/* $OpenLDAP$ */
/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* backend.c - routines for dealing with back-end databases */
#include "portable.h"
-#include "slapi_common.h"
#include <stdio.h>
#include <ac/string.h>
#include <ac/socket.h>
-
#include <sys/stat.h>
#include "slap.h"
-#include "slapi.h"
#include "lutil.h"
#include "lber_pvt.h"
+#ifdef LDAP_SLAPI
+#include "slapi.h"
+#endif
+
/*
* If a module is configured as dynamic, its header should not
* get included into slapd. While this is a general rule and does
for ( j = 0; backends[i].be_nsuffix != NULL &&
backends[i].be_nsuffix[j].bv_val != NULL; j++ )
{
- if (( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE )
+ if ( ( SLAP_GLUE_SUBORDINATE( &backends[i] ) )
&& noSubs )
{
continue;
)
{
int i;
- int rc;
+#if defined( LDAP_SLAPI )
Slapi_PBlock *pb = op->o_pb;
-#if defined( LDAP_SLAPI )
- slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
- slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
+ int rc;
+ slapi_x_connection_set_pb( pb, conn );
+ slapi_x_operation_set_pb( pb, op );
#endif /* defined( LDAP_SLAPI ) */
for ( i = 0; i < nbackends; i++ ) {
slapi_pblock_set( pb, SLAPI_BACKEND, (void *)&backends[i] );
rc = doPluginFNs( &backends[i], SLAPI_PLUGIN_PRE_UNBIND_FN,
(Slapi_PBlock *)pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
+ if ( rc != 0 ) {
/*
- * either there is no preOp (unbind) plugins
- * or a plugin failed. Just log it.
- *
- * FIXME: is this correct?
+ * A preoperation plugin failure will abort the
+ * entire operation.
*/
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_bind: Unbind preOps "
+ LDAP_LOG( OPERATION, INFO, "do_bind: Unbind preoperation plugin "
"failed\n", 0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_bind: Unbind preOps "
+ Debug(LDAP_DEBUG_TRACE, "do_bind: Unbind preoperation plugin "
"failed.\n", 0, 0, 0);
#endif
+ return 0;
}
#endif /* defined( LDAP_SLAPI ) */
}
#if defined( LDAP_SLAPI )
- rc = doPluginFNs( &backends[i], SLAPI_PLUGIN_POST_UNBIND_FN,
- (Slapi_PBlock *)pb );
- if ( rc != 0 && rc != LDAP_OTHER ) {
- /*
- * either there is no postOp (unbind) plugins
- * or a plugin failed. Just log it.
- *
- * FIXME: is this correct?
- */
+ if ( doPluginFNs( &backends[i], SLAPI_PLUGIN_POST_UNBIND_FN,
+ (Slapi_PBlock *)pb ) != 0 ) {
#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, INFO, "do_unbind: Unbind postOps "
+ LDAP_LOG( OPERATION, INFO, "do_unbind: Unbind postoperation plugins "
"failed\n", 0, 0, 0);
#else
- Debug(LDAP_DEBUG_TRACE, "do_unbind: Unbind postOps "
+ Debug(LDAP_DEBUG_TRACE, "do_unbind: Unbind postoperation plugins "
"failed.\n", 0, 0, 0);
#endif
}
}
{
- struct berval bv = BER_BVC( LDAP_EXOP_START_TLS );
- if( bvmatch( opdata, &bv ) ) {
+ if( bvmatch( opdata, &slap_EXOP_START_TLS ) ) {
session++;
starttls++;
break;
}
{
- struct berval bv = BER_BVC( LDAP_EXOP_X_WHO_AM_I );
- if( bvmatch( opdata, &bv ) ) {
+ if( bvmatch( opdata, &slap_EXOP_WHOAMI ) ) {
break;
}
}
+#ifdef LDAP_EXOP_X_CANCEL
+ {
+ if ( bvmatch( opdata, &slap_EXOP_CANCEL ) ) {
+ break;
+ }
+ }
+#endif
+
/* treat everything else as a modify */
opflag = SLAP_RESTRICT_OP_MODIFY;
updateop++;
}
#ifdef SLAP_X_LISTENER_MOD
- if ( ! ( conn->c_listener->sl_perms & S_IWUSR ) ) {
+ if ( conn->c_listener && ! ( conn->c_listener->sl_perms & S_IWUSR ) ) {
/* no "w" mode means readonly */
*text = "modifications not allowed on this listener";
return LDAP_UNWILLING_TO_PERFORM;
#ifdef SLAP_X_LISTENER_MOD
if ( !starttls && op->o_dn.bv_len == 0 ) {
- if ( ! ( conn->c_listener->sl_perms & S_IXUSR ) ) {
+ if ( conn->c_listener && ! ( conn->c_listener->sl_perms & S_IXUSR ) ) {
/* no "x" mode means bind required */
*text = "bind required on this listener";
return LDAP_STRONG_AUTH_REQUIRED;
}
if ( !starttls && !updateop ) {
- if ( ! ( conn->c_listener->sl_perms & S_IRUSR ) ) {
+ if ( conn->c_listener && ! ( conn->c_listener->sl_perms & S_IRUSR ) ) {
/* no "r" mode means no read */
*text = "read not allowed on this listener";
return LDAP_UNWILLING_TO_PERFORM;