1
/*****************************************************************************
3
Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
5
This software is subject to the provisions of the Zope Public License,
6
Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
7
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
8
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
10
FOR A PARTICULAR PURPOSE
12
****************************************************************************/
15
* This has been reported for inclusion in Python here: http://bugs.python.org/issue7333
16
* Hopefully we may be able to remove this file in some years.
21
#if defined(__unix__) || defined(unix) || defined(__NetBSD__) || defined(__MACH__) /* Mac OS X */
24
#include <sys/types.h>
28
initgroups_initgroups(PyObject *self, PyObject *args)
34
if (!PyArg_ParseTuple(args, "sI:initgroups", &username, &igid))
39
if (initgroups(username, gid) == -1)
40
return PyErr_SetFromErrno(PyExc_OSError);
46
static PyMethodDef InitgroupsMethods[] = {
47
{"initgroups", initgroups_initgroups, METH_VARARGS},
53
/* This module is empty on non-UNIX systems. */
55
static PyMethodDef InitgroupsMethods[] = {
59
#endif /* defined(__unix__) || defined(unix) */
64
Py_InitModule("_initgroups", InitgroupsMethods);