On ke, 03 heinä 2019, Elena Fedorov via FreeIPA-users wrote:
Hello,
what is the best way of sharing a private value between pre and post
operation of two plugins, for example between prebind and postbind plugins.
I was looking at the Slapi_PBlock *pb - can I use a field of this structure
to set a value in the prebind plugin and then read this value in the post
bind plugin?
If yes, which field can be used for this?
If no, what other mechanism is available for sharing values between pre
and post plugins?
You can use plugin object extensions to store the data and access
it
between different callbacks:
https://access.redhat.com/documentation/en-us/red_hat_directory_server/10...
See, for example, freeipa/daemons/ipa-slapi-plugins/ipa-pwd-extop --
plugin that implements operations on passwords. It registers own object
extension that gets attached to a server operation -- when that
operation is created for each request, a constructor function for the
extension is called. It then allocates memory. Later, at different
plugin callbacks, we retrieve a pointer to this memory and either update
its content or read it for own needs.
--
/ Alexander Bokovoy
Sr. Principal Software Engineer
Security / Identity Management Engineering
Red Hat Limited, Finland