rlm_pap code tidy
mcn4 at leicester.ac.uk
Sat Sep 29 00:57:05 CEST 2012
More tidying - this time in rlm_pap. In chunks, it's at
I've submitted a pull request; details for any comments below:
removed the 'encryption_scheme' option entirely, together with
the worthless switch() at the bottom.
the first update in getting rid of the spaghetti gotos. moves
the crypt auth check into a separate function. patch looks
messier than it is, as there's a lot of indentation changes.
the main update - move each auth test into a separate small
function, to drastically reduce the size of pap_authenticate()
and get rid of all the gotos. (I'm not against gotos, but when
they jump in and out of ifs and switch()s, it's really hard to
follow the code path!)
previous introduced an few if()s inside the main attribute check
loop, and returned within the loop. this tidies that up and
moves that outside. also removes the reliance on
RLM_MODULE_INVALID as a loop end test, which I wasn't keen on.
moves header-like stuff into rlm_pap.h
It now uses a function pointers to select the right auth function
depending on the config attribute found. I was slightly worried
that calling functions on this might slow things down a bit.
However, running 1000 auths in a tight loop (non-threaded server,
debug off) shows essentially no difference on my system - over
three runs, old code avg 23.516s, new code avg 23.464s.
Matthew Newton, Ph.D. <mcn4 at le.ac.uk>
Systems Architect (UNIX and Networks), Network Services,
I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom
For IT help contact helpdesk extn. 2253, <ithelp at le.ac.uk>
More information about the Freeradius-Devel