Issue #9604: posix.initgroups() encodes the username using the fileystem
encoding and surrogateescape error handler. Patch written by David Watson.
This commit is contained in:
parent
5fe6de8c72
commit
61ec5dca2b
|
@ -83,6 +83,9 @@ Extensions
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #9604: posix.initgroups() encodes the username using the fileystem
|
||||||
|
encoding and surrogateescape error handler. Patch written by David Watson.
|
||||||
|
|
||||||
- Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name
|
- Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name
|
||||||
using the filesystem encoding and surrogateescape error handler. Patch
|
using the filesystem encoding and surrogateescape error handler. Patch
|
||||||
written by David Watson.
|
written by David Watson.
|
||||||
|
|
|
@ -4249,13 +4249,19 @@ group id.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_initgroups(PyObject *self, PyObject *args)
|
posix_initgroups(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
PyObject *oname;
|
||||||
char *username;
|
char *username;
|
||||||
|
int res;
|
||||||
long gid;
|
long gid;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "sl:initgroups", &username, &gid))
|
if (!PyArg_ParseTuple(args, "O&l:initgroups",
|
||||||
|
PyUnicode_FSConverter, &oname, &gid))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
username = PyBytes_AS_STRING(oname);
|
||||||
|
|
||||||
if (initgroups(username, (gid_t) gid) == -1)
|
res = initgroups(username, (gid_t) gid);
|
||||||
|
Py_DECREF(oname);
|
||||||
|
if (res == -1)
|
||||||
return PyErr_SetFromErrno(PyExc_OSError);
|
return PyErr_SetFromErrno(PyExc_OSError);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
|
Loading…
Reference in New Issue