#include "portable.h"
+#include "slapi_common.h"
#include <stdio.h>
#include <sys/stat.h>
#include "slap.h"
+#include "slapi.h"
#include "lutil.h"
#include "lber_pvt.h"
int i;
for ( i = 0; be->be_nsuffix != NULL && be->be_nsuffix[i].bv_val != NULL; i++ ) {
- if ( ber_bvcmp( &be->be_nsuffix[i], bvsuffix ) == 0 ) {
+ if ( bvmatch( &be->be_nsuffix[i], bvsuffix ) ) {
return( 1 );
}
}
Operation *op
)
{
- int i;
+ int i;
+ int rc;
+ 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 );
+#endif /* defined( LDAP_SLAPI ) */
for ( i = 0; i < nbackends; i++ ) {
+#if defined( LDAP_SLAPI )
+ 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 ) {
+ /*
+ * either there is no preOp (unbind) plugins
+ * or a plugin failed. Just log it.
+ *
+ * FIXME: is this correct?
+ */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_bind: Unbind preOps failed\n"));
+#else
+ Debug (LDAP_DEBUG_TRACE, " Unbind preOps failed.\n", 0, 0, 0);
+#endif
+ }
+#endif /* defined( LDAP_SLAPI ) */
+
if ( backends[i].be_unbind ) {
(*backends[i].be_unbind)( &backends[i], conn, op );
}
+
+#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?
+ */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_unbind: Unbind postOps failed\n"));
+#else
+ Debug (LDAP_DEBUG_TRACE, " Unbind postOps failed.\n", 0, 0, 0);
+#endif
+ }
+#endif /* defined( LDAP_SLAPI ) */
}
return 0;
Operation *op,
const char **text )
{
- LDAPControl **ctrls;
- ctrls = op->o_ctrls;
- if( ctrls == NULL ) {
- return LDAP_SUCCESS;
- }
+ LDAPControl **ctrls = op->o_ctrls;
- if ( be->be_controls == NULL ) {
- *text = "control unavailable in context";
- return LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
- }
+ if( ctrls == NULL ) return LDAP_SUCCESS;
for( ; *ctrls != NULL ; ctrls++ ) {
if( (*ctrls)->ldctl_iscritical &&
{
struct berval bv = BER_BVC( LDAP_EXOP_START_TLS );
- if( ber_bvcmp( opdata, &bv ) == 0 ) {
+ if( bvmatch( opdata, &bv ) ) {
session++;
starttls++;
break;
{
struct berval bv = BER_BVC( LDAP_EXOP_X_WHO_AM_I );
- if( ber_bvcmp( opdata, &bv ) == 0 ) {
+ if( bvmatch( opdata, &bv ) ) {
break;
}
}
return LDAP_CONFIDENTIALITY_REQUIRED;
}
+
+ if( op->o_tag == LDAP_REQ_BIND && opdata == NULL ) {
+ /* simple bind specific check */
+ if( op->o_ssf < ssf->sss_simple_bind ) {
+ *text = "confidentiality required";
+ return LDAP_CONFIDENTIALITY_REQUIRED;
+ }
+ }
+
if( op->o_tag != LDAP_REQ_BIND || opdata == NULL ) {
/* these checks don't apply to SASL bind */
return LDAP_CONFIDENTIALITY_REQUIRED;
}
- if( op->o_ndn.bv_len == 0 ) {
+ if( !( global_allows & SLAP_ALLOW_UPDATE_ANON ) &&
+ op->o_ndn.bv_len == 0 )
+ {
*text = "modifications require authentication";
return LDAP_STRONG_AUTH_REQUIRED;
}
+
+#ifdef SLAP_X_LISTENER_MOD
+ if ( ! ( conn->c_listener->sl_perms & S_IWUSR ) ) {
+ /* no "w" mode means readonly */
+ *text = "modifications not allowed on this listener";
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
+#endif /* SLAP_X_LISTENER_MOD */
}
}
return LDAP_OPERATIONS_ERROR;
}
}
+
+#ifdef SLAP_X_LISTENER_MOD
+ if ( !starttls && op->o_dn.bv_len == 0 ) {
+ if ( ! ( 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 ) ) {
+ /* no "r" mode means no read */
+ *text = "read not allowed on this listener";
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
+ }
+#endif /* SLAP_X_LISTENER_MOD */
+
}
if( restrictops & opflag ) {
* and the backend supports specific operational attributes,
* add them to the attribute list
*/
-#ifdef SLAPD_SCHEMA_DN
if ( opattrs || ( attrs &&
ad_inlist( slap_schema.si_ad_subschemaSubentry, attrs )) ) {
*ap = slap_operational_subschemaSubentry( be );
ap = &(*ap)->a_next;
}
-#endif
+
if ( ( opattrs || attrs ) && be && be->be_operational != NULL ) {
( void )be->be_operational( be, conn, op, e, attrs, opattrs, ap );
}