]> git.sur5r.net Git - openldap/commitdiff
ITS#4991 restore mapped AttributeNames before processing a response
authorRalf Haferkamp <ralf@openldap.org>
Thu, 31 May 2007 15:46:46 +0000 (15:46 +0000)
committerRalf Haferkamp <ralf@openldap.org>
Thu, 31 May 2007 15:46:46 +0000 (15:46 +0000)
servers/slapd/overlays/rwm.c

index a54b41e8e6abe7bc14f7aa1332d5d0a098bfdefa..1c37890585d5113de5c16c622eb726323006d87c 100644 (file)
@@ -32,6 +32,7 @@ typedef struct rwm_op_state {
        struct berval ro_ndn;
        struct berval r_dn;
        struct berval r_ndn;
+       AttributeName *mapped_attrs;
        OpRequest o_request;
 } rwm_op_state;
 
@@ -88,7 +89,7 @@ rwm_op_cleanup( Operation *op, SlapReply *rs )
                        }
                        break;
                case LDAP_REQ_SEARCH:
-                       ch_free( op->ors_attrs );
+                       ch_free( ros->mapped_attrs );
                        filter_free_x( op, op->ors_filter );
                        ch_free( op->ors_filterstr.bv_val );
                        op->ors_attrs = ros->ors_attrs;
@@ -779,6 +780,11 @@ rwm_swap_attrs( Operation *op, SlapReply *rs )
        rwm_op_state *ros = cb->sc_private;
 
        rs->sr_attrs = ros->ors_attrs;
+
+       /* other overlays might have touched op->ors_attrs, 
+        * so we restore the original version here, otherwise
+        * attribute-mapping might fail */
+       op->ors_attrs = ros->mapped_attrs; 
        
        return SLAP_CB_CONTINUE;
 }
@@ -853,6 +859,9 @@ rwm_op_search( Operation *op, SlapReply *rs )
        }
 
        op->ors_attrs = an;
+       /* store the mapped Attributes for later usage, in
+        * the case that other overlays change op->ors_attrs */
+       roc->ros.mapped_attrs = an;
        roc->cb.sc_response = rwm_swap_attrs;
 
        op->o_callback = &roc->cb;