LDAP_SLAPI_F (Modifications *) slapi_int_ldapmods2modifications LDAP_P(( LDAPMod **, void *ctx ));
LDAP_SLAPI_F (void) slapi_int_free_ldapmods LDAP_P(( LDAPMod ** ));
LDAP_SLAPI_F (int) slapi_int_count_controls LDAP_P(( LDAPControl **ctrls ));
-
-LDAP_SLAPI_F (int) slapi_int_access_allowed LDAP_P((Operation *op,
- Entry *entry,
- AttributeDescription *desc,
- struct berval *val,
- slap_access_t access,
- AccessControlState *state ));
-
LDAP_SLAPI_F (char **) slapi_get_supported_extended_ops LDAP_P((void));
+LDAP_SLAPI_F (int) slapi_int_access_allowed LDAP_P((Operation *op, Entry *entry, AttributeDescription *desc, struct berval *val, slap_access_t access, AccessControlState *state ));
/* slapi_ops.c */
LDAP_SLAPI_F (int) slapi_int_response LDAP_P(( Slapi_Operation *op, SlapReply *rs ));
LDAP_SLAPI_F (int) slapi_int_pblock_get_first LDAP_P(( Backend *be, Slapi_PBlock **pb ));
LDAP_SLAPI_F (int) slapi_int_pblock_get_next LDAP_P(( Slapi_PBlock **pb ));
-#define PBLOCK_ASSERT_OP( _pb, _tag ) do { \
+#define PBLOCK_ASSERT_CONN( _pb ) do { \
assert( (_pb) != NULL ); \
- assert( (_pb)->pop != NULL ); \
assert( (_pb)->pconn != NULL ); \
+ } while (0)
+
+#define PBLOCK_ASSERT_OP( _pb, _tag ) do { \
+ PBLOCK_ASSERT_CONN( _pb ); \
+ assert( (_pb)->pop != NULL ); \
if ( _tag != 0 ) \
assert( (_pb)->pop->o_tag == (_tag)); \
} while (0)
#define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_BE_POST_DELETE_FN)
-#define SLAPI_OPERATION_PARAMETERS 138
-
-#define SLAPI_PLUGIN_DB_TEST_FN 227
-#define SLAPI_PLUGIN_DB_NO_ACL 250
-
-/* DS 5.x Computed Attribute Callbacks (not exposed) */
-#define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN 1200
-#define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
+#define SLAPI_IBM_PBLOCK -3
#define SLAPI_ENTRY_PRE_OP 52
#define SLAPI_ENTRY_POST_OP 53
#define SLAPI_ABANDON_MSGID 120
+#define SLAPI_OPERATION_PARAMETERS 138
+
#define SLAPI_SEQ_TYPE 150
#define SLAPI_SEQ_ATTRNAME 151
#define SLAPI_SEQ_VAL 152
#define SLAPI_DBSIZE 199
-/* really private stuff */
+#define SLAPI_PLUGIN_DB_TEST_FN 227
+#define SLAPI_PLUGIN_DB_NO_ACL 250
+
+/* OpenLDAP private parametrs */
+#define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN 1200
+#define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
+
#define SLAPI_X_CONFIG_ARGV 1400
#define SLAPI_X_INTOP_FLAGS 1401
#define SLAPI_X_INTOP_RESULT_CALLBACK 1402
#define SLAPI_X_INTOP_CALLBACK_DATA 1405
#define SLAPI_X_OLD_RESCONTROLS 1406
-#define SLAPI_IBM_PBLOCK -3
-
LDAP_SLAPI_V (ldap_pvt_thread_mutex_t) slapi_hn_mutex;
LDAP_SLAPI_V (ldap_pvt_thread_mutex_t) slapi_time_mutex;
LDAP_SLAPI_V (ldap_pvt_thread_mutex_t) slapi_printmessage_mutex;
#include <ac/ctype.h>
#include <ac/unistd.h>
+#ifdef LDAP_SLAPI
+
#include <slap.h>
#include <slapi.h>
-#ifdef LDAP_SLAPI
/*
* Object extensions
*
void *slapi_get_object_extension(int objecttype, void *object, int extensionhandle)
{
-#ifdef LDAP_SLAPI
struct slapi_extension_block *eblock;
void *parent;
}
return NULL;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
}
void slapi_set_object_extension(int objecttype, void *object, int extensionhandle, void *extension)
{
-#ifdef LDAP_SLAPI
struct slapi_extension_block *eblock;
void *parent;
/* constructed by caller */
eblock->extensions[extensionhandle] = extension;
}
-#endif /* LDAP_SLAPI */
}
int slapi_register_object_extension(
int *objecttype,
int *extensionhandle)
{
-#ifdef LDAP_SLAPI
int rc;
slapi_extension_t type;
struct slapi_registered_extension *re;
ldap_pvt_thread_mutex_unlock( ®istered_extensions.mutex );
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int slapi_int_create_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
int i;
struct slapi_extension_block *eblock;
void **peblock;
*peblock = eblock;
return 0;
-#else
- return -1;
-#endif
}
int slapi_int_free_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
int i;
struct slapi_extension_block *eblock;
void **peblock;
slapi_ch_free( peblock );
return 0;
-#else
- return -1;
-#endif
}
/* for reusable object types */
int slapi_int_clear_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
int i;
struct slapi_extension_block *eblock;
void *parent;
}
return 0;
-#else
- return -1;
-#endif
}
int slapi_int_init_object_extensions(void)
{
-#ifdef LDAP_SLAPI
memset( ®istered_extensions, 0, sizeof( registered_extensions ) );
if ( ldap_pvt_thread_mutex_init( ®istered_extensions.mutex ) != 0 ) {
}
return 0;
-#else
- return -1;
-#endif
}
+
+#endif /* LDAP_SLAPI */
*((slap_ssf_t *)value) = pb->pconn->c_ssf;
break;
case SLAPI_X_CONN_SASL_CONTEXT:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
if ( pb->pconn->c_sasl_authctx != NULL )
*value = pb->pconn->c_sasl_authctx;
else
break;
case SLAPI_CONN_AUTHTYPE:
case SLAPI_CONN_AUTHMETHOD: /* XXX should return SASL mech */
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
*((char **)value) = pblock_get_authtype( &pb->pconn->c_authz,
#ifdef HAVE_TLS
pb->pconn->c_is_tls
);
break;
case SLAPI_X_CONN_IS_UDP:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
#ifdef LDAP_CONNECTIONLESS
*((int *)value) = pb->pconn->c_is_udp;
#else
#endif
break;
case SLAPI_CONN_ID:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
*((unsigned long *)value) = pb->pconn->c_connid;
break;
case SLAPI_CONN_DN:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
*((char **)value) = pb->pconn->c_dn.bv_val;
break;
case SLAPI_CONN_CLIENTIP:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
if ( strncmp( pb->pconn->c_peer_name.bv_val, "IP=", 3 ) == 0 )
*((char **)value) = &pb->pconn->c_peer_name.bv_val[3];
else
*value = NULL;
break;
case SLAPI_X_CONN_CLIENTPATH:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
if ( strncmp( pb->pconn->c_peer_name.bv_val, "PATH=", 3 ) == 0 )
*((char **)value) = &pb->pconn->c_peer_name.bv_val[5];
else
*value = NULL;
break;
case SLAPI_CONN_SERVERIP:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
if ( strncmp( pb->pconn->c_peer_name.bv_val, "IP=", 3 ) == 0 )
*((char **)value) = &pb->pconn->c_sock_name.bv_val[3];
else
*value = NULL;
break;
case SLAPI_X_CONN_SERVERPATH:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
if ( strncmp( pb->pconn->c_peer_name.bv_val, "PATH=", 3 ) == 0 )
*((char **)value) = &pb->pconn->c_sock_name.bv_val[5];
else
else
*value = NULL;
break;
+ case SLAPI_ABANDON_MSGID:
+ if ( pb->pop->o_tag == LDAP_REQ_ABANDON )
+ *((int *)value) = pb->pop->orn_msgid;
+ else
+ *((int *)value) = 0;
+ break;
default:
rc = pblock_get_default( pb, param, value );
break;
pb->pconn = (Connection *)value;
break;
case SLAPI_X_CONN_SSF:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
PBLOCK_LOCK_CONN( pb );
pb->pconn->c_ssf = (slap_ssf_t)value;
PBLOCK_UNLOCK_CONN( pb );
break;
case SLAPI_X_CONN_SASL_CONTEXT:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
PBLOCK_LOCK_CONN( pb );
pb->pconn->c_sasl_authctx = value;
PBLOCK_UNLOCK_CONN( pb );
rc = pblock_set_dn( value, &pb->pop->o_req_dn, &pb->pop->o_req_ndn, pb->pop->o_tmpmemctx );
break;
case SLAPI_CONN_ID:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
PBLOCK_LOCK_CONN( pb );
pb->pconn->c_connid = (unsigned long)value;
PBLOCK_UNLOCK_CONN( pb );
break;
case SLAPI_CONN_DN:
- PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_ASSERT_CONN( pb );
PBLOCK_LOCK_CONN( pb );
rc = pblock_set_dn( value, &pb->pconn->c_dn, &pb->pconn->c_ndn, NULL );
PBLOCK_UNLOCK_CONN( pb );
break;
case SLAPI_SEARCH_FILTER:
PBLOCK_ASSERT_OP( pb, 0 );
- if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) {
+ if ( pb->pop->o_tag == LDAP_REQ_SEARCH )
pb->pop->ors_filter = (Slapi_Filter *)value;
- } else {
+ else
rc = PBLOCK_ERROR;
- }
break;
case SLAPI_SEARCH_STRFILTER:
PBLOCK_ASSERT_OP( pb, 0 );
PBLOCK_ASSERT_OP( pb, 0 );
PBLOCK_VALIDATE_IS_INTOP( pb );
- if ( pb->pop->o_tag == LDAP_REQ_COMPARE ) {
+ if ( pb->pop->o_tag == LDAP_REQ_COMPARE )
pb->pop->orc_ava->aa_value = *((struct berval *)value);
- } else {
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_ABANDON_MSGID:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pop->o_tag == LDAP_REQ_ABANDON)
+ pb->pop->orn_msgid = *((int *)value);
+ else
rc = PBLOCK_ERROR;
- }
break;
case SLAPI_REQUESTOR_ISROOT:
case SLAPI_REQUESTOR_ISUPDATEDN:
case SLAPI_X_CONN_CLIENTPATH:
case SLAPI_CONN_SERVERIP:
case SLAPI_X_CONN_SERVERPATH:
+ /* These parameters cannot be set */
rc = PBLOCK_ERROR;
break;
default:
return pb;
}
-void
-slapi_pblock_destroy( Slapi_PBlock* pb )
+static void
+pblock_destroy( Slapi_PBlock *pb )
{
LDAPControl **controls = NULL;
+ LDAPMod **mods = NULL;
+ char **attrs = NULL;
assert( pb != NULL );
+ pblock_get_default( pb, SLAPI_RESCONTROLS, (void **)&controls );
+ if ( controls != NULL ) {
+ ldap_controls_free( controls );
+ }
+
if ( pb->internal_op ) {
slapi_int_connection_done_pb( pb );
} else {
- LDAPMod **mods = NULL;
- char **attrs = NULL;
-
pblock_get_default( pb, SLAPI_MODIFY_MODS, (void **)&mods );
-
if ( mods != NULL )
slapi_int_free_ldapmods( mods );
pblock_get_default( pb, SLAPI_SEARCH_ATTRS, (void **)&attrs );
-
if ( attrs != NULL )
pb->pop->o_tmpfree( attrs, pb->pop->o_tmpmemctx );
}
- pblock_get_default( pb, SLAPI_RESCONTROLS, (void **)&controls );
- if ( controls != NULL ) {
- ldap_controls_free( controls );
- }
-
ldap_pvt_thread_mutex_destroy( &pb->pblockMutex );
-
slapi_ch_free( (void **)&pb );
}
+void
+slapi_pblock_destroy( Slapi_PBlock *pb )
+{
+ if ( pb != NULL ) {
+ pblock_destroy( pb );
+ }
+}
+
int
slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value )
{