closes bpo-38402: Check error of primitive crypt/crypt_r. (GH-16599)

Checks also for encryption algorithms methods not supported in different
OSs.

Signed-off-by: Antonio Gutierrez <chibby0ne@gmail.com>
This commit is contained in:
Antonio Gutierrez 2019-10-08 06:22:17 +02:00 committed by Benjamin Peterson
parent 4d5f94b8cd
commit 0d3fe8ae49
3 changed files with 13 additions and 1 deletions

View file

@ -42,6 +42,9 @@ crypt_crypt_impl(PyObject *module, const char *word, const char *salt)
#else
crypt_result = crypt(word, salt);
#endif
if (crypt_result == NULL) {
return PyErr_SetFromErrno(PyExc_OSError);
}
return Py_BuildValue("s", crypt_result);
}