From 51849d6ecb17283c3539ac8a7cf2ec1f9d2fc808 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 3 Mar 2003 22:25:28 +0000 Subject: [PATCH] fix ITS#2343 --- servers/slapd/back-monitor/database.c | 2 +- servers/slapd/backend.c | 2 +- servers/slapd/backglue.c | 6 +++--- servers/slapd/root_dse.c | 2 +- servers/slapd/slap.h | 4 ++++ servers/slapd/tools/slapcommon.c | 8 +++++--- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/servers/slapd/back-monitor/database.c b/servers/slapd/back-monitor/database.c index 0a2ee4b13d..05a6688f8a 100644 --- a/servers/slapd/back-monitor/database.c +++ b/servers/slapd/back-monitor/database.c @@ -103,7 +103,7 @@ monitor_subsys_database_init( be = &backendDB[i]; /* Subordinates are not exposed as their own naming context */ - if ( be->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE ) { + if ( SLAP_GLUE_SUBORDINATE( be ) ) { continue; } diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 07877bad8d..2d7c040baa 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -536,7 +536,7 @@ select_backend( 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; diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 8ffccd74f5..4db1e9f40a 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -610,7 +610,7 @@ glue_sub_init( ) * backends and connect them to their superior. */ for (i = nBackendDB - 1, b1=&backendDB[i]; cont && i>=0; b1--,i--) { - if (b1->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE) { + if (SLAP_GLUE_SUBORDINATE ( b1 ) ) { /* The last database cannot be a subordinate of noone */ if (i == nBackendDB - 1) { b1->be_flags ^= SLAP_BFLAG_GLUE_SUBORDINATE; @@ -619,11 +619,11 @@ glue_sub_init( ) } gi = NULL; for (j = i-1, be=&backendDB[j]; j>=0; be--,j--) { - if (!(be->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE)) { + if ( ! SLAP_GLUE_SUBORDINATE( be ) ) { continue; } /* We will only link it once */ - if (be->be_flags & SLAP_BFLAG_GLUE_LINKED) { + if ( SLAP_GLUE_LINKED( be ) ) { continue; } if (!dnIsSuffix(&be->be_nsuffix[0], &b1->be_nsuffix[0])) { diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c index bb8e5ed8c5..5ab1467bc1 100644 --- a/servers/slapd/root_dse.c +++ b/servers/slapd/root_dse.c @@ -137,7 +137,7 @@ root_dse_info( } continue; } - if ( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE ) { + if ( SLAP_GLUE_SUBORDINATE( &backends[i] ) ) { continue; } for ( j = 0; backends[i].be_suffix[j].bv_val != NULL; j++ ) { diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 80a5f4aa48..217d7c44af 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1334,6 +1334,10 @@ struct slap_backend_db { #define SLAP_BFLAG_DYNAMIC 0x2000U slap_mask_t be_flags; #define SLAP_LASTMOD(be) (!((be)->be_flags & SLAP_BFLAG_NOLASTMOD)) +#define SLAP_GLUE_INSTANCE(be) ((be)->be_flags & SLAP_BFLAG_GLUE_INSTANCE) +#define SLAP_GLUE_SUBORDINATE(be) \ + ((be)->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE) +#define SLAP_GLUE_LINKED(be) ((be)->be_flags & SLAP_BFLAG_GLUE_LINKED) #define SLAP_ALIASES(be) ((be)->be_flags & SLAP_BFLAG_ALIASES) #define SLAP_REFERRALS(be) ((be)->be_flags & SLAP_BFLAG_REFERRALS) #define SLAP_SUBENTRIES(be) ((be)->be_flags & SLAP_BFLAG_SUBENTRIES) diff --git a/servers/slapd/tools/slapcommon.c b/servers/slapd/tools/slapcommon.c index 37cb8eafe9..167eaf80d7 100644 --- a/servers/slapd/tools/slapcommon.c +++ b/servers/slapd/tools/slapcommon.c @@ -250,7 +250,7 @@ slap_tool_init( /* If the named base is a glue master, operate on the * entire context */ - if (be->be_flags & SLAP_BFLAG_GLUE_INSTANCE) + if (SLAP_GLUE_INSTANCE(be)) nosubordinates = 1; } else if ( dbnum == -1 ) { @@ -258,8 +258,10 @@ slap_tool_init( /* If just doing the first by default and it is a * glue subordinate, find the master. */ - while (be->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE) { - nosubordinates = 1; + while (SLAP_GLUE_SUBORDINATE(be) || SLAP_MONITOR(be)) { + if (SLAP_GLUE_SUBORDINATE(be)) { + nosubordinates = 1; + } be++; }