summaryrefslogtreecommitdiffstats
path: root/tests/018/crypt.tl
Commit message (Collapse)AuthorAgeFilesLines
* crypt: newly proposed test still fails on Musl.Kaz Kylheku2023-09-031-1/+1
| | | | | | | | * tests/018/crypt.tl: replace (crypt "a" "*$") test with (crypt "a" "::"). Musl's crypt treats all unrecognized hashes through DES, and the DES module accepts almost anything as salt characters, except '\0', '\n' and ':', since those characters would wreck the password file.
* crypt: detect error tokens more weakly; drop some tests.Kaz Kylheku2023-09-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | It has been reported by user cielesti that some of our crypt tests fail on the Musl library. Musl has some additional agorithms so it yields a meaningful hash for a "$0$" salt, as well as for "$9$". Musl uses "*" and "x" as error tokens rather than "*0" and "*1". We need to change how we detect error tokens. * sysif.c (crypt_wrap): Detect error tokens only by their length: if a string emerges from crypt or crypt_r, whose length is less than 13, it's an error token. * tests/018/crypt.tl: Drop the tests that require :error for salts "$0$" and "$9$", replacing them with a test for a salt that is almost certainly invalid in all C libraries on Linux. * txr.1: Document that crypt throws an error exception and under what circumstances (when the C library function does what).
* android, cygwin: do not try to test crypt.Kaz Kylheku2022-12-301-0/+3
| | | | | * tests/018/crypt.tl: Exit with successful termination status on Android or Cygwin.
* crypt: fix for platforms that lack crypt_r.Kaz Kylheku2022-12-301-1/+1
| | | | | | | | | | | | * sysif.c (crypt_wrap): Don't call free(cd) on platforms where we don't have crypt_r and have not defined the cd variable. * test/018/crypt.tl: Move the (crypt "a" "b") test case to be GNU/Linux-only. On Solaris, it yields a valid-looking hash instead of failing. That hash will not validate the password though; i.e. (crypt "a" (crypt "a" "b")) is not equal to (crypt "a" "b").
* crypt: remove dubious validator.Kaz Kylheku2022-10-311-0/+18
The validate_salt function was introduced in commit c3a0ceb2cea1a9d43f2baf5a2e63d0d712c8df19, February 2020. I cannot reproduce the internal crash in crypt which it alleges, and I neglected to mention the bad inputs in the commit or add tests. I'm not able to reproduce the alleged behavior in spite of trying all sorts of bad inputs; and looking at the crypt source in glibc, I don't see any obvious problem. And so, on this Halowe'en, we exorcise the ghost that has been haunting the crypt. * sysif.c (salt_char_p, validate_salt): Static functions removed. (crypt_wrap): Don't call validate_salt, and so cwsalt need not be tested for null. * tests/018/crypt.tl: New file. * txr.1: Mention that crypt_r is used if available, which avoids static storage.