Commit e2fe9e39 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

fix controls run-time registered by global overlays (kludge non longer required?)

parent 8b730300
......@@ -314,6 +314,8 @@ ldap_chain_response( Operation *op, SlapReply *rs )
char textbuf[ SLAP_TEXT_BUFLEN ];
size_t textlen = sizeof( textbuf );
assert( SLAP_DBFLAGS( op->o_bd ) & SLAP_DBFLAG_GLOBAL_OVERLAY );
/* global overlay: create entry */
/* NOTE: this is a hack to use the chain overlay
* as global. I expect to be able to remove this
......@@ -504,9 +506,9 @@ ldap_chain_db_config(
int rc;
be->be_private = on->on_bi.bi_private;
if ( strncasecmp( argv[ 0 ], "chain-", sizeof( "chain-" ) - 1 ) == 0 ) {
if ( strncasecmp( argv[ 0 ], "chain-", STRLENOF( "chain-" ) ) == 0 ) {
argv0 = argv[ 0 ];
argv[ 0 ] = &argv[ 0 ][ sizeof( "chain-" ) - 1 ];
argv[ 0 ] = &argv[ 0 ][ STRLENOF( "chain-" ) ];
}
rc = lback->bi_db_config( be, fname, lineno, argc, argv );
if ( argv0 ) {
......@@ -704,7 +706,7 @@ chain_init( void )
int rc;
rc = register_supported_control( LDAP_CONTROL_X_CHAINING_BEHAVIOR,
SLAP_CTRL_FRONTEND|SLAP_CTRL_ACCESS|SLAP_CTRL_HIDE, NULL,
/* SLAP_CTRL_FRONTEND| */ SLAP_CTRL_ACCESS|SLAP_CTRL_HIDE, NULL,
ldap_chain_parse_ctrl, &sc_chainingBehavior );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, "Failed to register chaining behavior control: %d\n", rc );
......
......@@ -467,33 +467,13 @@ overlay_is_inst( BackendDB *be, const char *over_type )
return 0;
}
#if 0
int
overlay_is_global( BackendDB *be )
{
BackendInfo *frontendBI;
if ( !overlay_is_over( be ) ) {
return 0;
}
frontendBI = frontendDB->bd_info;
if ( overlay_is_over( frontendDB ) ) {
frontendBI = ((slap_overinfo *)frontendBI->bi_private)->oi_orig;
}
return ((slap_overinfo *)be->bd_info->bi_private)->oi_orig == frontendBI;
}
#endif
int
overlay_register_control( BackendDB *be, const char *oid )
{
int rc = 0;
int gotit = 0;
#if 0
if ( overlay_is_global( be ) ) {
if ( SLAP_DBFLAGS( be ) & SLAP_DBFLAG_GLOBAL_OVERLAY ) {
int i;
/* add to all backends... */
......@@ -507,7 +487,7 @@ overlay_register_control( BackendDB *be, const char *oid )
if ( bd->be_controls == NULL ||
!ldap_charray_inlist( bd->be_controls, oid ) )
{
rc = ldap_charray_add( &be->be_controls, oid );
rc = ldap_charray_add( &bd->be_controls, oid );
if ( rc ) {
break;
}
......@@ -515,7 +495,6 @@ overlay_register_control( BackendDB *be, const char *oid )
}
}
#endif
if ( rc == 0 && !gotit && !ldap_charray_inlist( be->be_controls, oid ) ) {
rc = ldap_charray_add( &be->be_controls, oid );
......@@ -549,6 +528,13 @@ overlay_config( BackendDB *be, const char *ov )
oi->oi_orig = be->bd_info;
oi->oi_bi = *be->bd_info;
/* NOTE: the first time a global overlay is configured,
* frontendDB gets this flag; it is used later by overlays
* to determine if they're stacked on top of the frontendDB */
if ( oi->oi_orig == frontendDB->bd_info ) {
SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_GLOBAL_OVERLAY;
}
/* Save a pointer to ourself in bi_private.
*/
oi->oi_bi.bi_private = oi;
......
......@@ -1593,7 +1593,8 @@ struct slap_backend_db {
#define SLAP_DBFLAG_GLUE_INSTANCE 0x0010U /* a glue backend */
#define SLAP_DBFLAG_GLUE_SUBORDINATE 0x0020U /* child of a glue hierarchy */
#define SLAP_DBFLAG_GLUE_LINKED 0x0040U /* child is connected to parent */
#define SLAP_DBFLAG_OVERLAY 0x0080U /* this db struct is an overlay */
#define SLAP_DBFLAG_OVERLAY 0x0080U /* this db struct is an overlay */
#define SLAP_DBFLAG_GLOBAL_OVERLAY 0x0100U /* this db struct is a global overlay */
#define SLAP_DBFLAG_SHADOW 0x8000U /* a shadow */
#define SLAP_DBFLAG_SYNC_SHADOW 0x1000U /* a sync shadow */
#define SLAP_DBFLAG_SLURP_SHADOW 0x2000U /* a slurp shadow */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment