[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ValuesReturnFilter implementation

At 03:18 AM 2002-03-06, Mikhail Sahalaev wrote:
>I have small problem I don't know how to solve and I need your advice. Following the design you had approved I have added filtering matched values routine after attribute checking in send_search_entry().

That's good.

>It deletes values that doesn't match from current entry structure.

That's bad.  You MUST NOT change the entry copy from cache.

>The problem is: this entry returns to the cash afterwards and next client will recieve cutted entry. How to solve this problem? Do not send entry to the cash if it was changed or, maybe, check if value matched before putting it to ber and don't touch entry at all.

There are two basic approaches which can be used.
        a) write only the "matched" values into the BER (based upon
           the information recorded during filtering).
        b) make a local copy of the entry (in send_search_entry())
          and muck with it (based upon information recorded during

b) is probably the easiest to implement overall, especially
without any entry copy optimizations.  To make an copy (without
any optimizations), just make a malloc'ed copy as you would any
other complex C struct.

>Also its possible to make copy of the entry before filtering and send to cash this copy after, but I don't really know how to do it.

I don't think it is desirable to make copies of entries before