Staging
v0.8.1
v0.8.1
https://github.com/python/cpython
Revision c48b055258cfc31d8043af9c427e7a0e2980e60d authored by Benjamin Peterson on 06 March 2010, 20:37:32 UTC, committed by Benjamin Peterson on 06 March 2010, 20:37:32 UTC
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r78739 | benjamin.peterson | 2010-03-06 14:34:24 -0600 (Sat, 06 Mar 2010) | 10 lines Merged revisions 78718 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78718 | gregory.p.smith | 2010-03-06 01:35:19 -0600 (Sat, 06 Mar 2010) | 3 lines Call setreuid and setregid in a subprocess to avoid altering the test runner's process state. Should fix issue8045. ........ ................
1 parent e4b56d2
Tip revision: c48b055258cfc31d8043af9c427e7a0e2980e60d authored by Benjamin Peterson on 06 March 2010, 20:37:32 UTC
Merged revisions 78739 via svnmerge from
Merged revisions 78739 via svnmerge from
Tip revision: c48b055
cryptmodule.c
/* cryptmodule.c - by Steve Majewski
*/
#include "Python.h"
#include <sys/types.h>
#ifdef __VMS
#include <openssl/des.h>
#endif
/* Module crypt */
static PyObject *crypt_crypt(PyObject *self, PyObject *args)
{
char *word, *salt;
#ifndef __VMS
extern char * crypt(const char *, const char *);
#endif
if (!PyArg_ParseTuple(args, "ss:crypt", &word, &salt)) {
return NULL;
}
/* On some platforms (AtheOS) crypt returns NULL for an invalid
salt. Return None in that case. XXX Maybe raise an exception? */
return Py_BuildValue("s", crypt(word, salt));
}
PyDoc_STRVAR(crypt_crypt__doc__,
"crypt(word, salt) -> string\n\
word will usually be a user's password. salt is a 2-character string\n\
which will be used to select one of 4096 variations of DES. The characters\n\
in salt must be either \".\", \"/\", or an alphanumeric character. Returns\n\
the hashed password as a string, which will be composed of characters from\n\
the same alphabet as the salt.");
static PyMethodDef crypt_methods[] = {
{"crypt", crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
{NULL, NULL} /* sentinel */
};
static struct PyModuleDef cryptmodule = {
PyModuleDef_HEAD_INIT,
"crypt",
NULL,
-1,
crypt_methods,
NULL,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC
PyInit_crypt(void)
{
return PyModule_Create(&cryptmodule);
}
Computing file changes ...