Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
61c5edf6
Commit
61c5edf6
authored
Oct 18, 2001
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose setgroups. Fixes feature request #468116.
parent
6b471294
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
4 deletions
+62
-4
Doc/lib/libos.tex
Doc/lib/libos.tex
+7
-0
Misc/NEWS
Misc/NEWS
+1
-1
Modules/posixmodule.c
Modules/posixmodule.c
+48
-0
configure
configure
+2
-2
configure.in
configure.in
+1
-1
pyconfig.h.in
pyconfig.h.in
+3
-0
No files found.
Doc/lib/libos.tex
View file @
61c5edf6
...
...
@@ -204,6 +204,13 @@ Set the current process' group id.
Availability:
\UNIX
{}
.
\end{funcdesc}
\begin{funcdesc}
{
setgroups
}{
groups
}
Set list of supplemental group ids associated with the current
process to
\var
{
groups
}
.
Availability:
\UNIX
{}
.
\versionadded
{
2.2
}
\end{funcdesc}
\begin{funcdesc}
{
setpgrp
}{}
Calls the system call
\cfunction
{
setpgrp()
}
or
\cfunction
{
setpgrp(0,
0)
}
depending on which version is implemented (if any). See the
...
...
Misc/NEWS
View file @
61c5edf6
...
...
@@ -44,7 +44,7 @@ Extension modules
- readline now supports setting the startup_hook and the pre_event_hook.
- posix supports chroot where available.
- posix supports chroot
and setgroups
where available.
- Decompression objects in the zlib module now accept an optional
second parameter to decompress() that specifies the maximum amount
...
...
Modules/posixmodule.c
View file @
61c5edf6
...
...
@@ -3127,6 +3127,51 @@ posix_setgid(PyObject *self, PyObject *args)
}
#endif
/* HAVE_SETGID */
#ifdef HAVE_SETGROUPS
static
char
posix_setgroups__doc__
[]
=
"setgroups(list) -> None
\n
\
Set the groups of the current process to list."
;
static
PyObject
*
posix_setgroups
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
groups
;
int
i
,
len
;
gid_t
grouplist
[
MAX_GROUPS
];
if
(
!
PyArg_ParseTuple
(
args
,
"O:setgid"
,
&
groups
))
return
NULL
;
if
(
!
PySequence_Check
(
groups
))
{
PyErr_SetString
(
PyExc_TypeError
,
"setgroups argument must be a sequence"
);
return
NULL
;
}
len
=
PySequence_Size
(
groups
);
if
(
len
>
MAX_GROUPS
)
{
PyErr_SetString
(
PyExc_ValueError
,
"too many groups"
);
return
NULL
;
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
PyObject
*
elem
;
elem
=
PySequence_GetItem
(
groups
,
i
);
if
(
!
elem
)
return
NULL
;
if
(
!
PyInt_Check
(
elem
))
{
PyErr_SetString
(
PyExc_TypeError
,
"groups must be integers"
);
Py_DECREF
(
elem
);
return
NULL
;
}
/* XXX: check that value fits into gid_t. */
grouplist
[
i
]
=
PyInt_AsLong
(
elem
);
Py_DECREF
(
elem
);
}
if
(
setgroups
(
len
,
grouplist
)
<
0
)
return
posix_error
();
Py_INCREF
(
Py_None
);
return
Py_None
;
}
#endif
/* HAVE_SETGROUPS */
#ifdef HAVE_WAITPID
static
char
posix_waitpid__doc__
[]
=
...
...
@@ -5467,6 +5512,9 @@ static PyMethodDef posix_methods[] = {
#ifdef HAVE_SETGID
{
"setgid"
,
posix_setgid
,
METH_VARARGS
,
posix_setgid__doc__
},
#endif
/* HAVE_SETGID */
#ifdef HAVE_SETGROUPS
{
"setgroups"
,
posix_setgroups
,
METH_VARARGS
,
posix_setgroups__doc__
},
#endif
/* HAVE_SETGROUPS */
#ifdef HAVE_SETPGRP
{
"setpgrp"
,
posix_setpgrp
,
METH_VARARGS
,
posix_setpgrp__doc__
},
#endif
/* HAVE_SETPGRP */
...
...
configure
View file @
61c5edf6
#! /bin/sh
# From configure.in Revision: 1.26
8
# From configure.in Revision: 1.26
9
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
...
...
@@ -4804,7 +4804,7 @@ for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \
hstrerror inet_pton
kill link
lstat
mkfifo
mktime mremap
\
nice
pathconf pause plock poll pthread_init
\
putenv
readlink
\
select
setegid seteuid setgid
\
select
setegid seteuid setgid
setgroups
\
setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf
\
sigaction siginterrupt sigrelse strftime strptime symlink sysconf
\
tcgetpgrp tcsetpgrp tempnam timegm
times
tmpfile tmpnam tmpnam_r
\
...
...
configure.in
View file @
61c5edf6
...
...
@@ -1391,7 +1391,7 @@ AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
hstrerror inet_pton kill link lstat mkfifo mktime mremap \
nice pathconf pause plock poll pthread_init \
putenv readlink \
select setegid seteuid setgid \
select setegid seteuid setgid
setgroups
\
setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
...
...
pyconfig.h.in
View file @
61c5edf6
...
...
@@ -498,6 +498,9 @@
/* Define if you have the setgid function. */
#undef HAVE_SETGID
/* Define if you have the setgroups function. */
#undef HAVE_SETGROUPS
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment