Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | RS Wood <rswood@therandymon.com> |
|---|---|
| Newsgroups | comp.misc |
| Subject | FreeBSD, openPAM, and unit tests |
| Date | 2014-02-26 20:42 +0000 |
| Organization | solani.org |
| Message-ID | <leljk6$d9o$1@solani.org> (permalink) |
From the "PAM not SPAM" department: Title: On testing, part III Author: Dag-Erling Smørgrav Date: Wed, 26 Feb 2014 12:20:22 -0500 Link: http://blog.des.no/2014/02/on-testing-part-iii/ I just got word of an embarrassing bug in OpenPAM Nummularia[1]. The is_upper() macro, which is supposed to evaluate to true if its argument is an upper-case letter in the ASCII character set, only evaluates to true for the letter A: #define is_upper(ch) (ch >= 'A' && ch <>= 'A') This macro is never used directly, but it is referenced by is_letter(), which is referenced by is_pfcs(), which is used to validate paths and path-like strings, i.e. service names and module names or paths. As a consequence, OpenPAM does not support services or modules which contain an upper-case letter other than A. I never noticed because a) none of the services or modules in use on the systems I use to develop and test OpenPAM have upper-case letters in their names and b) there are no unit or regression tests for the character classification macros, nor for any code path that uses them (except openpam_readword(), which uses is_lws() and is_ws()). The obvious course of action is to add unit tests for the character classification macros (r760[2]) and then fix the bug (r761[3]). In this case, complete coverage is easy to achieve since there are only 256 possible inputs for each predicate. I have merged the fix to FreeBSD head (r262529[4] and r262530[5]). Impatient users can fix their system by running the following commands: % cd /usr/src/contrib/openpam % svn diff -r758:762 svn://svn.openpam.org/openpam/trunk | patch % cd /usr/src/lib/libpam/libpam % make && make install Unsurprisingly, writing more unit tests for OpenPAM is moving up on my TODO list. Please contact me if you have the time and inclination to help out. [image 6] Links: [1]: http://www.openpam.org/wiki/Releases/Nummularia (link) [2]: http://www.openpam.org/changeset/760/openpam (link) [3]: http://www.openpam.org/changeset/761/openpam (link) [4]: http://svnweb.freebsd.org/base?view=revision&revision=r262529 (link) [5]: http://svnweb.freebsd.org/base?view=revision&revision=r262530 (link) [6]: http://feeds.feedburner.com/~r/PlanetFreebsd/~4/UhK6JB8eW9U (image)
Back to comp.misc | Previous | Next | Find similar | Unroll thread
FreeBSD, openPAM, and unit tests RS Wood <rswood@therandymon.com> - 2014-02-26 20:42 +0000
csiph-web