rlm_pap code tidy
Matthew Newton
mcn4 at leicester.ac.uk
Sat Sep 29 00:57:05 CEST 2012
Hi,
More tidying - this time in rlm_pap. In chunks, it's at
https://github.com/mcnewton/freeradius-server/commits/rlm_pap_tidy
I've submitted a pull request; details for any comments below:
faa17a14 -
removed the 'encryption_scheme' option entirely, together with
the worthless switch() at the bottom.
a9d0b282 -
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.
d71b7e3b -
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!)
df48421a -
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.
52b68318 -
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.
Cheers,
Matthew
--
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
mailing list