summaryrefslogtreecommitdiffstats
path: root/usr.bin/enigma
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-02-25 20:47:25 +0000
committerdelphij <delphij@FreeBSD.org>2015-02-25 20:47:25 +0000
commit380807ef474b5dde53ae3a42a592632e1c3a5762 (patch)
tree78646fcf0f6ce50f87ac31acb5adae2645697504 /usr.bin/enigma
parent03eeeb2651118370f5b3b824c5d9bd36b37ef233 (diff)
downloadFreeBSD-src-380807ef474b5dde53ae3a42a592632e1c3a5762.zip
FreeBSD-src-380807ef474b5dde53ae3a42a592632e1c3a5762.tar.gz
Explicitly crypt_set_format("des") and bail out if we
can't. This would prevent problem when we changed the default crypt(3) algorithm or removed it in the future. PR: bin/189958 MFC after: 1 month
Diffstat (limited to 'usr.bin/enigma')
-rw-r--r--usr.bin/enigma/enigma.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/enigma/enigma.c b/usr.bin/enigma/enigma.c
index 893766e..e476e65 100644
--- a/usr.bin/enigma/enigma.c
+++ b/usr.bin/enigma/enigma.c
@@ -43,6 +43,11 @@ setup(char *pw)
int32_t seed;
char *cryptpw;
+ if (crypt_set_format("des") == 0) {
+ fprintf(stderr, "crypt_set_format(\"des\") failed.\n");
+ exit(1);
+ }
+
strlcpy(salt, pw, sizeof(salt));
cryptpw = crypt(pw, salt);
if (cryptpw == NULL) {
OpenPOWER on IntegriCloud