i need init and destroy
fcusack at fcusack.com
Wed Aug 24 00:07:55 CEST 2005
On August 23, 2005 11:28:20 AM -0400 Alan DeKok <aland at ox.org> wrote:
> Frank Cusack <fcusack at fcusack.com> wrote:
>> Looks like the init and destroy methods went away 5 days ago. My module
>> (rlm_otp) needs them.
> Yes. It was discussed here, but I meant to email you privately.
>> - How was this tested? struct module_t rlm_otp still contains these
>> methods. How can this even compile?
> I delete rlm_otp from the makefile.
>> - What are the chances of getting these back? I can do something
>> like pthread_once(otp_init()) and add a refcount to cleanup in detach,
>> but really, init and destroy are superior.
> I'm not convinced any module needs them. The other modules that
> used them could be modified easily to not use them. I took a quick
> look through rlm_otp, and didn't see anything that struck me as a
> If necessary, they can be added back, but I'd like to know what
> rlm_otp is doing with them, and if another approach is equivalent.
It's fairly obvious from the code. I open a single file handle to
/dev/random, shared by all instances, and I setup an hmac key which
I need to sign access-challenge STATE attributes. I close the fd
and clear the hmac in destroy.
You're right, no module *needs* init and destroy. These are easily
simulated with pthread_once() and a refcount, but you can consider
the modules to be classes, and a static constructor and destructor
is a natural for them. init and destroy methods make sense. There's
no reason a module *has* to use them, but they should be there if you
More information about the Freeradius-Devel