From Sam Rushing's Medusa, via SF patch #100858: add & document

os.seteuid(), os.setegid(), os.setreuid(), os.setregid().
This commit is contained in:
Andrew M. Kuchling 2000-07-13 01:26:58 +00:00
parent 4d5d5bf5ae
commit 8d2f2b2db2
5 changed files with 263 additions and 141 deletions

View File

@ -181,6 +181,16 @@ calls to \function{putenv()} don't update \code{os.environ}, so it is
actually preferable to assign to items of \code{os.environ}.
\end{funcdesc}
\begin{funcdesc}{setegid}{egid}
Set the current process's effective group id.
Availability: \UNIX{}.
\end{funcdesc}
\begin{funcdesc}{seteuid}{euid}
Set the current process's effective user id.
Availability: \UNIX{}.
\end{funcdesc}
\begin{funcdesc}{setgid}{gid}
Set the current process' group id.
Availability: \UNIX{}.
@ -199,6 +209,16 @@ for the semantics.
Availability: \UNIX{}.
\end{funcdesc}
\begin{funcdesc}{setreuid}{ruid, euid}
Set the current process's real and effective user ids.
Availability: \UNIX{}.
\end{funcdesc}
\begin{funcdesc}{setregid}{rgid, egid}
Set the current process's real and effective group ids.
Availability: \UNIX{}.
\end{funcdesc}
\begin{funcdesc}{setsid}{}
Calls the system call \cfunction{setsid()}. See the \UNIX{} manual
for the semantics.

View File

@ -2618,6 +2618,82 @@ posix_setuid(PyObject *self, PyObject *args)
#endif /* HAVE_SETUID */
#ifdef HAVE_SETEUID
static char posix_seteuid__doc__[] =
"seteuid(uid) -> None\n\
Set the current process's effective user id.";
static PyObject *
posix_seteuid (PyObject *self, PyObject *args)
{
int euid;
if (!PyArg_ParseTuple(args, "i", &euid)) {
return NULL;
} else if (seteuid(euid) < 0) {
return posix_error();
} else {
Py_INCREF(Py_None);
return Py_None;
}
}
#endif /* HAVE_SETEUID */
#ifdef HAVE_SETEGID
static char posix_setegid__doc__[] =
"setegid(gid) -> None\n\
Set the current process's effective group id.";
static PyObject *
posix_setegid (PyObject *self, PyObject *args)
{
int egid;
if (!PyArg_ParseTuple(args, "i", &egid)) {
return NULL;
} else if (setegid(egid) < 0) {
return posix_error();
} else {
Py_INCREF(Py_None);
return Py_None;
}
}
#endif /* HAVE_SETEGID */
#ifdef HAVE_SETREUID
static char posix_setreuid__doc__[] =
"seteuid(ruid, euid) -> None\n\
Set the current process's real and effective user ids.";
static PyObject *
posix_setreuid (PyObject *self, PyObject *args)
{
int ruid, euid;
if (!PyArg_ParseTuple(args, "ii", &ruid, &euid)) {
return NULL;
} else if (setreuid(ruid, euid) < 0) {
return posix_error();
} else {
Py_INCREF(Py_None);
return Py_None;
}
}
#endif /* HAVE_SETREUID */
#ifdef HAVE_SETREGID
static char posix_setregid__doc__[] =
"setegid(rgid, egid) -> None\n\
Set the current process's real and effective group ids.";
static PyObject *
posix_setregid (PyObject *self, PyObject *args)
{
int rgid, egid;
if (!PyArg_ParseTuple(args, "ii", &rgid, &egid)) {
return NULL;
} else if (setregid(rgid, egid) < 0) {
return posix_error();
} else {
Py_INCREF(Py_None);
return Py_None;
}
}
#endif /* HAVE_SETREGID */
#ifdef HAVE_SETGID
static char posix_setgid__doc__[] =
"setgid(gid) -> None\n\
@ -4898,6 +4974,18 @@ static PyMethodDef posix_methods[] = {
#ifdef HAVE_SETUID
{"setuid", posix_setuid, METH_VARARGS, posix_setuid__doc__},
#endif /* HAVE_SETUID */
#ifdef HAVE_SETEUID
{"seteuid", posix_seteuid, METH_VARARGS, posix_seteuid__doc__},
#endif /* HAVE_SETEUID */
#ifdef HAVE_SETEGID
{"setegid", posix_setegid, METH_VARARGS, posix_setegid__doc__},
#endif /* HAVE_SETEGID */
#ifdef HAVE_SETREUID
{"setreuid", posix_setreuid, METH_VARARGS, posix_setreuid__doc__},
#endif /* HAVE_SETREUID */
#ifdef HAVE_SETREGID
{"setregid", posix_setregid, METH_VARARGS, posix_setregid__doc__},
#endif /* HAVE_SETREGID */
#ifdef HAVE_SETGID
{"setgid", posix_setgid, METH_VARARGS, posix_setgid__doc__},
#endif /* HAVE_SETGID */

View File

@ -407,6 +407,12 @@
/* Define if you have the select function. */
#undef HAVE_SELECT
/* Define if you have the setegid function. */
#undef HAVE_SETEGID
/* Define if you have the seteuid function. */
#undef HAVE_SETEUID
/* Define if you have the setgid function. */
#undef HAVE_SETGID
@ -419,6 +425,12 @@
/* Define if you have the setpgrp function. */
#undef HAVE_SETPGRP
/* Define if you have the setregid function. */
#undef HAVE_SETREGID
/* Define if you have the setreuid function. */
#undef HAVE_SETREUID
/* Define if you have the setsid function. */
#undef HAVE_SETSID

281
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -822,7 +822,8 @@ AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \
kill link lstat mkfifo mktime mremap \
nice pathconf pause plock pthread_init \
putenv readlink \
select setgid setlocale setuid setsid setpgid setpgrp setvbuf \
select setegid seteuid setgid \
setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf \
sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
truncate uname waitpid)