svn commit: r279296 - head/usr.bin/enigma

Xin LI delphij at FreeBSD.org
Wed Feb 25 20:47:26 UTC 2015


Author: delphij
Date: Wed Feb 25 20:47:25 2015
New Revision: 279296
URL: https://svnweb.freebsd.org/changeset/base/279296

Log:
  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

Modified:
  head/usr.bin/enigma/enigma.c

Modified: head/usr.bin/enigma/enigma.c
==============================================================================
--- head/usr.bin/enigma/enigma.c	Wed Feb 25 18:50:24 2015	(r279295)
+++ head/usr.bin/enigma/enigma.c	Wed Feb 25 20:47:25 2015	(r279296)
@@ -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) {


More information about the svn-src-head mailing list