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

Re: limiting rewrite global variable scope



> Hi,
>
> back-ldap
>
> I have just discovered that global variables in rewriting are remembered
>  between results, if more than one result is returned from a search.
>
> I would really like to be able to start a fresh set of variables for
> each  result, to prevent "leakage".

It is unclear what you mean by "remember global vars"; it is intended
that global vars are remembered across calls to rewriting; note, though,
that after successive rewritings, the old value by design  is REPLACED
by the new one, so there should be no leaking.  If you found any, that's
a bug, and it is a completely different matter.

>
> I tried to do a rewrite_var_delete at the end of ldap_send_entry, but
> it's  getting me into locking problems -- and in any case, I'm not sure
> that I  should be deleting the avltree entirely - I just want to empty
> it, not  destroy it.

I haven't been playing with the rewrite stuff for a while, and there
might well be locking problems out there; however, I suggest you don't
deal with rewrite internals and stay with the published API, that is
functions that live in include/rewrite.h; the function you mention is
in libraries/librewrite/rewrite-int.h and, as such, it is intended
to be used only from inside librewrite.

Pierangelo.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it