goto done;
}
- rc = slapi_int_load_plugin( pPlugin, path, initfunc, TRUE, NULL, &hdLoadHandle );
+ rc = slapi_int_load_plugin( pPlugin, path, initfunc, 1, NULL, &hdLoadHandle );
if ( rc != 0 ) {
goto done;
}
Slapi_PBlock *pSavePB;
int rc = LDAP_SUCCESS;
- assert( be != NULL ); /* global plugins are now stored in frontendDB */
+ assert( be != NULL );
- pTmpPB = (Slapi_PBlock *)be->be_pb;
+ pTmpPB = SLAPI_BACKEND_PBLOCK( be );
if ( pTmpPB == NULL ) {
- be->be_pb = (void *)pPB;
+ SLAPI_BACKEND_PBLOCK( be ) = pPB;
} else {
while ( pTmpPB != NULL && rc == LDAP_SUCCESS ) {
pSavePB = pTmpPB;
int rc = LDAP_SUCCESS;
assert( ppFuncPtrs != NULL );
- assert( be != NULL );
- /*
- * First, count the plugins associated with a specific
- * backend.
- */
- if ( be != frontendDB ) {
- pCurrentPB = (Slapi_PBlock *)be->be_pb;
-
- while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
- rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
- if ( rc == LDAP_SUCCESS ) {
- if ( FuncPtr != NULL ) {
- numPB++;
- }
- rc = slapi_pblock_get( pCurrentPB,
- SLAPI_IBM_PBLOCK, &pCurrentPB );
- }
- }
- }
- if ( rc != LDAP_SUCCESS ) {
+ if ( be == NULL ) {
goto done;
}
- /*
- * Then, count the global plugins.
- */
- pCurrentPB = (Slapi_PBlock *)frontendDB->be_pb;
+ pCurrentPB = SLAPI_BACKEND_PBLOCK( be );
while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
SLAPI_IBM_PBLOCK, &pCurrentPB );
}
}
- if ( rc != LDAP_SUCCESS ) {
- goto done;
- }
if ( numPB == 0 ) {
*ppFuncPtrs = NULL;
goto done;
}
- if ( be != frontendDB ) {
- pCurrentPB = (Slapi_PBlock *)be->be_pb;
-
- while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
- rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
- if ( rc == LDAP_SUCCESS ) {
- if ( FuncPtr != NULL ) {
- *pTmpFuncPtr = FuncPtr;
- pTmpFuncPtr++;
- }
- rc = slapi_pblock_get( pCurrentPB,
- SLAPI_IBM_PBLOCK, &pCurrentPB );
- }
- }
- }
-
- pCurrentPB = (Slapi_PBlock *)frontendDB->be_pb;
+ pCurrentPB = SLAPI_BACKEND_PBLOCK( be );
while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
SLAPI_IBM_PBLOCK, &pCurrentPB );
}
}
- *pTmpFuncPtr = NULL ;
+
+ *pTmpFuncPtr = NULL;
+
done:
if ( rc != LDAP_SUCCESS && *ppFuncPtrs != NULL ) {
return LDAP_LOCAL_ERROR;
}
- if ( doInit == TRUE ) {
+ if ( doInit ) {
rc = ( *fpInitFunc )( pPlugin );
if ( rc != LDAP_SUCCESS ) {
lt_dlclose( *pLdHandle );
fname, lineno );
return 1;
}
+
+ /* automatically instantiate overlay if necessary */
+ if ( !overlay_is_inst( be, SLAPI_OVERLAY_NAME ) ) {
+ if ( overlay_config( be, SLAPI_OVERLAY_NAME ) != 0 ) {
+ fprintf( stderr, "Failed to instantiate SLAPI overlay\n");
+ return -1;
+ }
+ }
if ( strcasecmp( argv[1], "preoperation" ) == 0 ) {
iType = SLAPI_PLUGIN_PREOPERATION;
idx.bv_val = ibuf;
i = 0;
- for ( pp = be->be_pb;
+ for ( pp = SLAPI_BACKEND_PBLOCK( be );
pp != NULL;
slapi_pblock_get( pp, SLAPI_IBM_PBLOCK, &pp ) )
{
return -1;
}
- return 0;
+ return slapi_int_overlay_init();
}
-