masarati@aero.polimi.it wrote:
I need to implement a modify operation whose semantics is "add if not present", an add that only takes place if that attribute is not yet present in the entry.
I need it as an internal operation, so right now I wouldn't bother formalizing it as an extension of the semantics of the modify operation. Something like the SLAP_MOD_SOFTADD, which in turn consists in adding an attribute value only if that value is not already present.
I'd introduce a SLAP_MOD_ADD_IF_NOT_PRESENT flag and add code to support it in all (well, most) backends/overlays that need to muck with modify operation type.
Sounds like you could do it with an Assertion Control (!(attr=*)).
Well, I already considered the possibility to combine already existing semantics; however, there are two good reasons not to use that:
1) if the assertion fails, the operation needs to be resubmitted
2) there might already be an assertion control on the request
p.