Merged revisions 70980,71059,71225,71234,71241,71243,71249,71251,71255,71266,71299,71329,71397-71398,71486 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70980 | jack.diederich | 2009-04-01 15:26:13 -0500 (Wed, 01 Apr 2009) | 3 lines

  bounds check arguments to mmap.move().  All of them.  Really.
  fixes crasher on OS X 10.5
........
  r71059 | mark.dickinson | 2009-04-02 13:39:37 -0500 (Thu, 02 Apr 2009) | 2 lines

  sys.long_info attributes should be ints, not longs
........
  r71225 | georg.brandl | 2009-04-05 06:54:07 -0500 (Sun, 05 Apr 2009) | 1 line

  #5580: no need to use parentheses when converterr() argument is actually a type description.
........
  r71234 | georg.brandl | 2009-04-05 08:16:35 -0500 (Sun, 05 Apr 2009) | 1 line

  Whitespace normalization.
........
  r71241 | georg.brandl | 2009-04-05 09:48:49 -0500 (Sun, 05 Apr 2009) | 1 line

  #5471: fix expanduser() for $HOME set to "/".
........
  r71243 | georg.brandl | 2009-04-05 10:14:29 -0500 (Sun, 05 Apr 2009) | 1 line

  #5432: make plistlib docstring a raw string, since it contains examples with backslash escapes.
........
  r71249 | georg.brandl | 2009-04-05 11:30:43 -0500 (Sun, 05 Apr 2009) | 1 line

  #5444: adapt make.bat to new htmlhelp output file name.
........
  r71251 | georg.brandl | 2009-04-05 12:17:42 -0500 (Sun, 05 Apr 2009) | 1 line

  #5298: clarify docs about GIL by using more consistent wording.
........
  r71255 | georg.brandl | 2009-04-05 13:34:58 -0500 (Sun, 05 Apr 2009) | 1 line

  #602893: add indicator for current line in cgitb that doesnt rely on styling alone.
........
  r71266 | georg.brandl | 2009-04-05 15:23:13 -0500 (Sun, 05 Apr 2009) | 1 line

  Normalize issue referencing style.
........
  r71299 | gregory.p.smith | 2009-04-05 18:43:58 -0500 (Sun, 05 Apr 2009) | 3 lines

  Fixes issue5705: os.setuid() and friends did not accept the same range of
  values that pwd.getpwnam() returns.
........
  r71329 | benjamin.peterson | 2009-04-06 16:53:33 -0500 (Mon, 06 Apr 2009) | 1 line

  add create_connection to __all__ #5711
........
  r71397 | georg.brandl | 2009-04-08 11:36:39 -0500 (Wed, 08 Apr 2009) | 1 line

  Remove redundant backtick.
........
  r71398 | georg.brandl | 2009-04-08 11:39:04 -0500 (Wed, 08 Apr 2009) | 1 line

  Update ignore file for suspicious builder.
........
  r71486 | andrew.kuchling | 2009-04-11 11:18:14 -0500 (Sat, 11 Apr 2009) | 1 line

  Re-word
........
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 1d1e299..7b32eda 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4168,9 +4168,15 @@
 static PyObject *
 posix_setuid(PyObject *self, PyObject *args)
 {
-	int uid;
-	if (!PyArg_ParseTuple(args, "i:setuid", &uid))
+	long uid_arg;
+	uid_t uid;
+	if (!PyArg_ParseTuple(args, "l:setuid", &uid_arg))
 		return NULL;
+	uid = uid_arg;
+	if (uid != uid_arg) {
+		PyErr_SetString(PyExc_OverflowError, "user id too big");
+		return NULL;
+	}
 	if (setuid(uid) < 0)
 		return posix_error();
 	Py_INCREF(Py_None);
@@ -4187,10 +4193,16 @@
 static PyObject *
 posix_seteuid (PyObject *self, PyObject *args)
 {
-	int euid;
-	if (!PyArg_ParseTuple(args, "i", &euid)) {
+	long euid_arg;
+	uid_t euid;
+	if (!PyArg_ParseTuple(args, "l", &euid_arg))
 		return NULL;
-	} else if (seteuid(euid) < 0) {
+	euid = euid_arg;
+	if (euid != euid_arg) {
+		PyErr_SetString(PyExc_OverflowError, "user id too big");
+		return NULL;
+	}
+	if (seteuid(euid) < 0) {
 		return posix_error();
 	} else {
 		Py_INCREF(Py_None);
@@ -4207,10 +4219,16 @@
 static PyObject *
 posix_setegid (PyObject *self, PyObject *args)
 {
-	int egid;
-	if (!PyArg_ParseTuple(args, "i", &egid)) {
+	long egid_arg;
+	gid_t egid;
+	if (!PyArg_ParseTuple(args, "l", &egid_arg))
 		return NULL;
-	} else if (setegid(egid) < 0) {
+	egid = egid_arg;
+	if (egid != egid_arg) {
+		PyErr_SetString(PyExc_OverflowError, "group id too big");
+		return NULL;
+	}
+	if (setegid(egid) < 0) {
 		return posix_error();
 	} else {
 		Py_INCREF(Py_None);
@@ -4227,10 +4245,17 @@
 static PyObject *
 posix_setreuid (PyObject *self, PyObject *args)
 {
-	int ruid, euid;
-	if (!PyArg_ParseTuple(args, "ii", &ruid, &euid)) {
+	long ruid_arg, euid_arg;
+	uid_t ruid, euid;
+	if (!PyArg_ParseTuple(args, "ll", &ruid_arg, &euid_arg))
 		return NULL;
-	} else if (setreuid(ruid, euid) < 0) {
+	ruid = ruid_arg;
+	euid = euid_arg;
+	if (euid != euid_arg || ruid != ruid_arg) {
+		PyErr_SetString(PyExc_OverflowError, "user id too big");
+		return NULL;
+	}
+	if (setreuid(ruid, euid) < 0) {
 		return posix_error();
 	} else {
 		Py_INCREF(Py_None);
@@ -4247,10 +4272,17 @@
 static PyObject *
 posix_setregid (PyObject *self, PyObject *args)
 {
-	int rgid, egid;
-	if (!PyArg_ParseTuple(args, "ii", &rgid, &egid)) {
+	long rgid_arg, egid_arg;
+	gid_t rgid, egid;
+	if (!PyArg_ParseTuple(args, "ll", &rgid_arg, &egid_arg))
 		return NULL;
-	} else if (setregid(rgid, egid) < 0) {
+	rgid = rgid_arg;
+	egid = egid_arg;
+	if (egid != egid_arg || rgid != rgid_arg) {
+		PyErr_SetString(PyExc_OverflowError, "group id too big");
+		return NULL;
+	}
+	if (setregid(rgid, egid) < 0) {
 		return posix_error();
 	} else {
 		Py_INCREF(Py_None);
@@ -4267,9 +4299,15 @@
 static PyObject *
 posix_setgid(PyObject *self, PyObject *args)
 {
-	int gid;
-	if (!PyArg_ParseTuple(args, "i:setgid", &gid))
+	long gid_arg;
+	gid_t gid;
+	if (!PyArg_ParseTuple(args, "l:setgid", &gid_arg))
 		return NULL;
+	gid = gid_arg;
+	if (gid != gid_arg) {
+		PyErr_SetString(PyExc_OverflowError, "group id too big");
+		return NULL;
+	}
 	if (setgid(gid) < 0)
 		return posix_error();
 	Py_INCREF(Py_None);