@@ -2618,6 +2618,82 @@ posix_setuid(PyObject *self, PyObject *args)
26182618#endif /* HAVE_SETUID */
26192619
26202620
2621+ #ifdef HAVE_SETEUID
2622+ static char posix_seteuid__doc__ [] =
2623+ "seteuid(uid) -> None\n\
2624+ Set the current process's effective user id." ;
2625+ static PyObject *
2626+ posix_seteuid (PyObject * self , PyObject * args )
2627+ {
2628+ int euid ;
2629+ if (!PyArg_ParseTuple (args , "i" , & euid )) {
2630+ return NULL ;
2631+ } else if (seteuid (euid ) < 0 ) {
2632+ return posix_error ();
2633+ } else {
2634+ Py_INCREF (Py_None );
2635+ return Py_None ;
2636+ }
2637+ }
2638+ #endif /* HAVE_SETEUID */
2639+
2640+ #ifdef HAVE_SETEGID
2641+ static char posix_setegid__doc__ [] =
2642+ "setegid(gid) -> None\n\
2643+ Set the current process's effective group id." ;
2644+ static PyObject *
2645+ posix_setegid (PyObject * self , PyObject * args )
2646+ {
2647+ int egid ;
2648+ if (!PyArg_ParseTuple (args , "i" , & egid )) {
2649+ return NULL ;
2650+ } else if (setegid (egid ) < 0 ) {
2651+ return posix_error ();
2652+ } else {
2653+ Py_INCREF (Py_None );
2654+ return Py_None ;
2655+ }
2656+ }
2657+ #endif /* HAVE_SETEGID */
2658+
2659+ #ifdef HAVE_SETREUID
2660+ static char posix_setreuid__doc__ [] =
2661+ "seteuid(ruid, euid) -> None\n\
2662+ Set the current process's real and effective user ids." ;
2663+ static PyObject *
2664+ posix_setreuid (PyObject * self , PyObject * args )
2665+ {
2666+ int ruid , euid ;
2667+ if (!PyArg_ParseTuple (args , "ii" , & ruid , & euid )) {
2668+ return NULL ;
2669+ } else if (setreuid (ruid , euid ) < 0 ) {
2670+ return posix_error ();
2671+ } else {
2672+ Py_INCREF (Py_None );
2673+ return Py_None ;
2674+ }
2675+ }
2676+ #endif /* HAVE_SETREUID */
2677+
2678+ #ifdef HAVE_SETREGID
2679+ static char posix_setregid__doc__ [] =
2680+ "setegid(rgid, egid) -> None\n\
2681+ Set the current process's real and effective group ids." ;
2682+ static PyObject *
2683+ posix_setregid (PyObject * self , PyObject * args )
2684+ {
2685+ int rgid , egid ;
2686+ if (!PyArg_ParseTuple (args , "ii" , & rgid , & egid )) {
2687+ return NULL ;
2688+ } else if (setregid (rgid , egid ) < 0 ) {
2689+ return posix_error ();
2690+ } else {
2691+ Py_INCREF (Py_None );
2692+ return Py_None ;
2693+ }
2694+ }
2695+ #endif /* HAVE_SETREGID */
2696+
26212697#ifdef HAVE_SETGID
26222698static char posix_setgid__doc__ [] =
26232699"setgid(gid) -> None\n\
@@ -4898,6 +4974,18 @@ static PyMethodDef posix_methods[] = {
48984974#ifdef HAVE_SETUID
48994975 {"setuid" , posix_setuid , METH_VARARGS , posix_setuid__doc__ },
49004976#endif /* HAVE_SETUID */
4977+ #ifdef HAVE_SETEUID
4978+ {"seteuid" , posix_seteuid , METH_VARARGS , posix_seteuid__doc__ },
4979+ #endif /* HAVE_SETEUID */
4980+ #ifdef HAVE_SETEGID
4981+ {"setegid" , posix_setegid , METH_VARARGS , posix_setegid__doc__ },
4982+ #endif /* HAVE_SETEGID */
4983+ #ifdef HAVE_SETREUID
4984+ {"setreuid" , posix_setreuid , METH_VARARGS , posix_setreuid__doc__ },
4985+ #endif /* HAVE_SETREUID */
4986+ #ifdef HAVE_SETREGID
4987+ {"setregid" , posix_setregid , METH_VARARGS , posix_setregid__doc__ },
4988+ #endif /* HAVE_SETREGID */
49014989#ifdef HAVE_SETGID
49024990 {"setgid" , posix_setgid , METH_VARARGS , posix_setgid__doc__ },
49034991#endif /* HAVE_SETGID */
0 commit comments