]> git.sur5r.net Git - openldap/commitdiff
Patch for ITS#3133
authorJong Hyuk Choi <jongchoi@openldap.org>
Mon, 31 May 2004 02:01:59 +0000 (02:01 +0000)
committerJong Hyuk Choi <jongchoi@openldap.org>
Mon, 31 May 2004 02:01:59 +0000 (02:01 +0000)
servers/slapd/backend.c
servers/slapd/backglue.c
servers/slapd/ctxcsn.c
servers/slapd/slap.h

index b99ecdc1e2c2eab6c589a99b787ed032e11e49e5..903176c62a4bda7ea6fa4f56005e7e2ff09e7d16 100644 (file)
@@ -302,7 +302,9 @@ int backend_startup(Backend *be)
        if(be != NULL) {
                /* startup a specific backend database */
 
-               LDAP_TAILQ_INIT( &be->be_pending_csn_list );
+               be->be_pending_csn_list = (struct be_pcl *)
+                                                               ch_calloc( 1, sizeof( struct be_pcl ));
+               LDAP_TAILQ_INIT( be->be_pending_csn_list );
 
 #ifdef NEW_LOGGING
                LDAP_LOG( BACKEND, DETAIL1, "backend_startup:  starting \"%s\"\n",
@@ -381,7 +383,9 @@ int backend_startup(Backend *be)
                /* append global access controls */
                acl_append( &backendDB[i].be_acl, global_acl );
 
-               LDAP_TAILQ_INIT( &backendDB[i].be_pending_csn_list );
+               backendDB[i].be_pending_csn_list = (struct be_pcl *)
+                                                               ch_calloc( 1, sizeof( struct be_pcl ));
+               LDAP_TAILQ_INIT( backendDB[i].be_pending_csn_list );
 
                if ( backendDB[i].be_suffix == NULL ) {
 #ifdef NEW_LOGGING
index cd8a63d3546201cd0e65a3230777f0bcfbfab6a4..04d36ea608c979cb60492961174f8bb41c35b187 100644 (file)
@@ -138,6 +138,7 @@ glue_back_db_open (
        glueOpened = 1;
 
        gi->bd.be_acl = be->be_acl;
+       gi->bd.be_pending_csn_list = be->be_pending_csn_list;
 
        if (gi->bd.bd_info->bi_db_open)
                rc = gi->bd.bd_info->bi_db_open(&gi->bd);
@@ -284,6 +285,19 @@ glue_back_search ( Operation *op, SlapReply *rs )
 #ifdef LDAP_SCOPE_SUBORDINATE
        case LDAP_SCOPE_SUBORDINATE: /* FIXME */
 #endif
+
+               if ( op->o_sync_mode & SLAP_SYNC_REFRESH ) {
+                       op->o_bd = glue_back_select (b0, op->o_req_ndn.bv_val);
+
+                       if (op->o_bd && op->o_bd->be_search) {
+                               rs->sr_err = op->o_bd->be_search( op, rs );
+                       } else {
+                               send_ldap_error(op, rs, LDAP_UNWILLING_TO_PERFORM,
+                                             "No search target found");
+                       }
+                       return rs->sr_err;
+               }
+
                op->o_callback = &cb;
                rs->sr_err = gs.err = LDAP_UNWILLING_TO_PERFORM;
                scope0 = op->ors_scope;
index ab1061978edca72b40f496c4fe57e93dfe931815..4672273293f078b2e0e6f3955e857642aa12bc13 100644 (file)
@@ -41,14 +41,14 @@ slap_get_commit_csn( Operation *op, struct berval *csn )
 
        ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex );
 
-       LDAP_TAILQ_FOREACH( csne, &op->o_bd->be_pending_csn_list, ce_csn_link ) {
+       LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) {
                if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) {
                        csne->ce_state = SLAP_CSN_COMMIT;
                        break;
                }
        }
 
-       LDAP_TAILQ_FOREACH( csne, &op->o_bd->be_pending_csn_list, ce_csn_link ) {
+       LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) {
                if ( csne->ce_state == SLAP_CSN_COMMIT ) committed_csne = csne;
                if ( csne->ce_state == SLAP_CSN_PENDING ) break;
        }
@@ -64,7 +64,7 @@ slap_rewind_commit_csn( Operation *op )
 
        ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex );
 
-       LDAP_TAILQ_FOREACH( csne, &op->o_bd->be_pending_csn_list, ce_csn_link ) {
+       LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) {
                if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) {
                        csne->ce_state = SLAP_CSN_PENDING;
                        break;
@@ -84,9 +84,9 @@ slap_graduate_commit_csn( Operation *op )
 
        ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex );
 
-       LDAP_TAILQ_FOREACH( csne, &op->o_bd->be_pending_csn_list, ce_csn_link ) {
+       LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) {
                if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) {
-                       LDAP_TAILQ_REMOVE( &op->o_bd->be_pending_csn_list,
+                       LDAP_TAILQ_REMOVE( op->o_bd->be_pending_csn_list,
                                csne, ce_csn_link );
                        ch_free( csne->ce_csn->bv_val );
                        ch_free( csne->ce_csn );
@@ -166,7 +166,7 @@ slap_get_csn(
                pending->ce_connid = op->o_connid;
                pending->ce_opid = op->o_opid;
                pending->ce_state = SLAP_CSN_PENDING;
-               LDAP_TAILQ_INSERT_TAIL( &op->o_bd->be_pending_csn_list,
+               LDAP_TAILQ_INSERT_TAIL( op->o_bd->be_pending_csn_list,
                        pending, ce_csn_link );
                ldap_pvt_thread_mutex_unlock( &op->o_bd->be_pcl_mutex );
        }
index a20909d27a7a8644e23e46d6cf23bcfbec328fe2..c7e76756ac1085f0516825007a7877071ff6375e 100644 (file)
@@ -1415,6 +1415,8 @@ typedef struct syncinfo_s {
                LDAP_STAILQ_ENTRY( syncinfo_s ) si_next;
 } syncinfo_t;
 
+LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry );
+
 struct slap_backend_db {
        BackendInfo     *bd_info;       /* pointer to shared backend info */
 
@@ -1567,7 +1569,7 @@ struct slap_backend_db {
        char    *be_replogfile; /* replication log file (in master)        */
        struct berval be_update_ndn;    /* allowed to make changes (in replicas) */
        BerVarray       be_update_refs; /* where to refer modifying clients to */
-       LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry )       be_pending_csn_list;
+       struct          be_pcl  *be_pending_csn_list;
        ldap_pvt_thread_mutex_t                                 be_pcl_mutex;
        struct berval                                                   be_context_csn;
        ldap_pvt_thread_mutex_t                                 be_context_csn_mutex;