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
This commit is contained in:
Xin LI 2015-02-25 20:47:25 +00:00
parent 65f2833127
commit 3b557094a2

View File

@ -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) {