summaryrefslogtreecommitdiffstats
path: root/tests/018
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-10-31 07:18:41 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-10-31 07:18:41 -0700
commit00d7b468e94d23646bb58b1774f5bec33b7c9fb1 (patch)
treef694ebdf6167de879ea9614279bf51b50297ac4e /tests/018
parent746dddd01f28dc4499825c855c42aa5e95d5055a (diff)
downloadtxr-00d7b468e94d23646bb58b1774f5bec33b7c9fb1.tar.gz
txr-00d7b468e94d23646bb58b1774f5bec33b7c9fb1.tar.bz2
txr-00d7b468e94d23646bb58b1774f5bec33b7c9fb1.zip
crypt: remove dubious validator.
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.
Diffstat (limited to 'tests/018')
-rw-r--r--tests/018/crypt.tl18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/018/crypt.tl b/tests/018/crypt.tl
new file mode 100644
index 00000000..55a897af
--- /dev/null
+++ b/tests/018/crypt.tl
@@ -0,0 +1,18 @@
+(load "../common")
+
+(mtest
+ (crypt nil nil) :error
+ (crypt "a" "b") :error
+ (crypt "a" "bc") "bcshMw5X24ayQ"
+ (crypt "a" "bcd") "bcshMw5X24ayQ")
+
+(if (eq :linux (os-symbol))
+ (mtest
+ (crypt "a" "$0$") :error
+ (crypt "a" "$9$") :error
+ (crypt "a" "$1$") "$1$$Ij31LCAysPM23KuPlm1wA/"
+ (crypt "a" "$1$bcd$") "$1$bcd$cgz778Ks3pkbWfyW.CWae/"
+ (crypt "a" "$5$") "$5$$QG6CCM7eJAxpUPcBpn0Z2K29NHtaI6Mk1fCpPrpjdj3"
+ (crypt "a" "$5$bcd$") "$5$bcd$OGt98FNCHtKIrT6qWAKLXOQ8eIApFT5dJngrYreMwF3"
+ (crypt "a" "$6$") "$6$$ek/ucQg0IM8SQLyD2D66mpoW0vAF26eA0/pqoN95V.F0nZh1IFuENNo0OikacRkDBk5frNqziMYMdVVrQ0o.51"
+ (crypt "a" "$6$bcd$") "$6$bcd$RK8RFj8wSE1NBJi8s.KDjGQK3EbpI474a6f4UP0LGOkQU50ZQrwykBaSjx7tZFVEpanpL44zd1p6A9q.sy.YH0"))