mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-28 18:49:34 -05:00
Rework backend (lastmod + glue + system schema) flags
This commit is contained in:
parent
f0cd9956ed
commit
55501e886f
9 changed files with 49 additions and 37 deletions
|
|
@ -262,9 +262,7 @@ do_add( Connection *conn, Operation *op )
|
|||
goto done;
|
||||
}
|
||||
|
||||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && !repl_user )
|
||||
{
|
||||
if ( SLAP_LASTMOD(be) && !repl_user ) {
|
||||
for( modtail = &modlist;
|
||||
*modtail != NULL;
|
||||
modtail = &(*modtail)->sml_next )
|
||||
|
|
|
|||
|
|
@ -533,9 +533,11 @@ select_backend(
|
|||
for ( j = 0; backends[i].be_nsuffix != NULL &&
|
||||
backends[i].be_nsuffix[j] != NULL; j++ )
|
||||
{
|
||||
if ((backends[i].be_glueflags&SLAP_GLUE_SUBORDINATE)&&
|
||||
noSubs)
|
||||
if (( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE )
|
||||
&& noSubs )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
len = backends[i].be_nsuffix[j]->bv_len;
|
||||
|
||||
|
|
@ -997,7 +999,7 @@ backend_group(
|
|||
/* we won't attempt to send it to a different backend */
|
||||
|
||||
be = select_backend( gr_ndn, 0,
|
||||
(be->be_glueflags & SLAP_GLUE_INSTANCE));
|
||||
(be->be_flags & SLAP_BFLAG_GLUE_INSTANCE));
|
||||
|
||||
if (be == NULL) {
|
||||
return LDAP_NO_SUCH_OBJECT;
|
||||
|
|
@ -1058,7 +1060,7 @@ backend_attribute(
|
|||
/* we won't attempt to send it to a different backend */
|
||||
|
||||
be = select_backend( edn, 0,
|
||||
(be->be_glueflags & SLAP_GLUE_INSTANCE));
|
||||
(be->be_flags & SLAP_BFLAG_GLUE_INSTANCE));
|
||||
|
||||
if (be == NULL) {
|
||||
return LDAP_NO_SUCH_OBJECT;
|
||||
|
|
|
|||
|
|
@ -785,24 +785,27 @@ 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_glueflags & SLAP_GLUE_SUBORDINATE) {
|
||||
if (b1->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE) {
|
||||
/* The last database cannot be a subordinate of noone */
|
||||
if (i == nBackendDB - 1)
|
||||
b1->be_glueflags ^= SLAP_GLUE_SUBORDINATE;
|
||||
if (i == nBackendDB - 1) {
|
||||
b1->be_flags ^= SLAP_BFLAG_GLUE_SUBORDINATE;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
gi = NULL;
|
||||
for (j = i-1, be=&backendDB[j]; j>=0; be--,j--) {
|
||||
if (!(be->be_glueflags & SLAP_GLUE_SUBORDINATE))
|
||||
if (!(be->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE)) {
|
||||
continue;
|
||||
}
|
||||
/* We will only link it once */
|
||||
if (be->be_glueflags & SLAP_GLUE_LINKED)
|
||||
if (be->be_flags & SLAP_BFLAG_GLUE_LINKED) {
|
||||
continue;
|
||||
if (!dnIsSuffix(be->be_nsuffix[0],
|
||||
b1->be_nsuffix[0]))
|
||||
}
|
||||
if (!dnIsSuffix(be->be_nsuffix[0], b1->be_nsuffix[0])) {
|
||||
continue;
|
||||
}
|
||||
cont--;
|
||||
be->be_glueflags |= SLAP_GLUE_LINKED;
|
||||
be->be_flags |= SLAP_BFLAG_GLUE_LINKED;
|
||||
if (gi == NULL) {
|
||||
/* We create a copy of the superior's be
|
||||
* structure, pointing to all of its original
|
||||
|
|
@ -811,9 +814,10 @@ glue_sub_init( )
|
|||
* is used whenever we have operations to pass
|
||||
* down to the real database.
|
||||
*/
|
||||
b1->be_glueflags |= SLAP_GLUE_INSTANCE;
|
||||
b1->be_flags |= SLAP_BFLAG_GLUE_INSTANCE;
|
||||
gi = (glueinfo *)ch_malloc(sizeof(glueinfo));
|
||||
gi->be = (BackendDB *)ch_malloc(sizeof(BackendDB) + sizeof(BackendInfo));
|
||||
gi->be = (BackendDB *)ch_malloc(
|
||||
sizeof(BackendDB) + sizeof(BackendInfo));
|
||||
bi = (BackendInfo *)(gi->be+1);
|
||||
*gi->be = *b1;
|
||||
gi->nodes = 0;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ slap_mask_t global_disallows = 0;
|
|||
slap_mask_t global_requires = 0;
|
||||
slap_ssf_set_t global_ssf_set;
|
||||
char *replogfile;
|
||||
int global_lastmod = ON;
|
||||
int global_idletimeout = 0;
|
||||
char *global_host = NULL;
|
||||
char *global_realm = NULL;
|
||||
|
|
@ -78,6 +77,7 @@ read_config( const char *fname )
|
|||
int rc;
|
||||
struct berval vals[2];
|
||||
|
||||
static int lastmod = ON;
|
||||
static BackendInfo *bi = NULL;
|
||||
static BackendDB *be = NULL;
|
||||
|
||||
|
|
@ -204,6 +204,8 @@ read_config( const char *fname )
|
|||
bi = NULL;
|
||||
be = backend_db_init( cargv[1] );
|
||||
|
||||
if( lastmod ) be->be_flags |= SLAP_BFLAG_LASTMOD;
|
||||
|
||||
if( be == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
|
||||
|
|
@ -842,7 +844,7 @@ read_config( const char *fname )
|
|||
fname, lineno, 0 );
|
||||
#endif
|
||||
} else {
|
||||
be->be_glueflags |= SLAP_GLUE_SUBORDINATE;
|
||||
be->be_flags |= SLAP_BFLAG_GLUE_SUBORDINATE;
|
||||
num_subordinates++;
|
||||
}
|
||||
|
||||
|
|
@ -1994,14 +1996,14 @@ read_config( const char *fname )
|
|||
}
|
||||
if ( strcasecmp( cargv[1], "on" ) == 0 ) {
|
||||
if ( be )
|
||||
be->be_lastmod = ON;
|
||||
be->be_flags |= SLAP_BFLAG_LASTMOD;
|
||||
else
|
||||
global_lastmod = ON;
|
||||
lastmod = ON;
|
||||
} else {
|
||||
if ( be )
|
||||
be->be_lastmod = OFF;
|
||||
be->be_flags &= ~SLAP_BFLAG_LASTMOD;
|
||||
else
|
||||
global_lastmod = OFF;
|
||||
lastmod = OFF;
|
||||
}
|
||||
|
||||
/* set idle timeout value */
|
||||
|
|
|
|||
|
|
@ -345,9 +345,7 @@ do_modify(
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && !repl_user )
|
||||
{
|
||||
if ( SLAP_LASTMOD(be) && !repl_user ) {
|
||||
for( modtail = &modlist;
|
||||
*modtail != NULL;
|
||||
modtail = &(*modtail)->sml_next )
|
||||
|
|
|
|||
|
|
@ -977,7 +977,6 @@ LDAP_SLAPD_V (const char) Versionstr[];
|
|||
LDAP_SLAPD_V (struct slap_limits_set) deflimit;
|
||||
|
||||
LDAP_SLAPD_V (slap_access_t) global_default_access;
|
||||
LDAP_SLAPD_V (int) global_lastmod;
|
||||
LDAP_SLAPD_V (int) global_idletimeout;
|
||||
LDAP_SLAPD_V (int) global_schemacheck;
|
||||
LDAP_SLAPD_V (char *) global_host;
|
||||
|
|
|
|||
|
|
@ -87,8 +87,9 @@ root_dse_info(
|
|||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
for ( i = 0; i < nbackends; i++ ) {
|
||||
if ( backends[i].be_glueflags & SLAP_GLUE_SUBORDINATE )
|
||||
if ( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE ) {
|
||||
continue;
|
||||
}
|
||||
for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
|
||||
vals[0] = *backends[i].be_suffix[j];
|
||||
attr_merge( e, ad_namingContexts, vals );
|
||||
|
|
|
|||
|
|
@ -1015,6 +1015,20 @@ struct slap_backend_db {
|
|||
#define be_sync bd_info->bi_tool_sync
|
||||
#endif
|
||||
|
||||
#define SLAP_BFLAG_LASTMOD 0x0001U
|
||||
|
||||
#define SLAP_BFLAG_GLUE_INSTANCE 0x0010U /* a glue backend */
|
||||
#define SLAP_BFLAG_GLUE_SUBORDINATE 0x0020U /* child of a glue hierarchy */
|
||||
#define SLAP_BFLAG_GLUE_LINKED 0x00400 /* child is connected to parent */
|
||||
|
||||
#define SLAP_BFLAG_ALIASES 0x0010U
|
||||
#define SLAP_BFLAG_MONITOR 0x0020U
|
||||
#define SLAP_BFLAG_REFERRALS 0x0040U
|
||||
#define SLAP_BFLAG_SUBENTRIES 0x0080U
|
||||
|
||||
slap_mask_t be_flags;
|
||||
#define SLAP_LASTMOD(be) ((be)->be_flags & SLAP_BFLAG_LASTMOD)
|
||||
|
||||
slap_mask_t be_restrictops; /* restriction operations */
|
||||
#define SLAP_RESTRICT_OP_ADD 0x0001U
|
||||
#define SLAP_RESTRICT_OP_BIND 0x0002U
|
||||
|
|
@ -1074,13 +1088,7 @@ struct slap_backend_db {
|
|||
struct berval be_update_ndn; /* allowed to make changes (in replicas) */
|
||||
BVarray be_update_refs; /* where to refer modifying clients to */
|
||||
char *be_realm;
|
||||
int be_lastmod; /* keep track of lastmodified{by,time} */
|
||||
|
||||
#define SLAP_GLUE_INSTANCE 0x01 /* a glue backend */
|
||||
#define SLAP_GLUE_SUBORDINATE 0x02 /* child of a glue hierarchy */
|
||||
#define SLAP_GLUE_LINKED 0x04 /* child is connected to parent */
|
||||
|
||||
int be_glueflags; /* */
|
||||
void *be_private; /* anything the backend database needs */
|
||||
};
|
||||
|
||||
|
|
@ -1195,7 +1203,7 @@ typedef int (BI_tool_entry_reindex) LDAP_P(( BackendDB *be, ID id ));
|
|||
typedef int (BI_tool_sync) LDAP_P(( BackendDB *be ));
|
||||
|
||||
struct slap_backend_info {
|
||||
char *bi_type; /* type of backend */
|
||||
char *bi_type; /* type of backend */
|
||||
|
||||
/*
|
||||
* per backend type routines:
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ slap_tool_init(
|
|||
/* If the named base is a glue master, operate on the
|
||||
* entire context
|
||||
*/
|
||||
if (be->be_glueflags & SLAP_GLUE_INSTANCE)
|
||||
if (be->be_flags & SLAP_BFLAG_GLUE_INSTANCE)
|
||||
nosubordinates = 1;
|
||||
|
||||
} else if ( dbnum == -1 ) {
|
||||
|
|
@ -240,7 +240,7 @@ slap_tool_init(
|
|||
/* If just doing the first by default and it is a
|
||||
* glue subordinate, find the master.
|
||||
*/
|
||||
while (be->be_glueflags & SLAP_GLUE_SUBORDINATE) {
|
||||
while (be->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE) {
|
||||
nosubordinates = 1;
|
||||
be++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue