[Pkg-shadow-commits] r3019 - in upstream/trunk: . libmisc

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Thu Jun 11 21:33:00 UTC 2009


Author: nekral-guest
Date: 2009-06-11 21:33:00 +0000 (Thu, 11 Jun 2009)
New Revision: 3019

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/NEWS
   upstream/trunk/libmisc/xgetXXbyYY.c
   upstream/trunk/libmisc/xgetgrgid.c
   upstream/trunk/libmisc/xgetgrnam.c
   upstream/trunk/libmisc/xgetpwnam.c
   upstream/trunk/libmisc/xgetpwuid.c
   upstream/trunk/libmisc/xgetspnam.c
Log:
	* libmisc/xgetXXbyYY.c, libmisc/xgetpwnam.c, libmisc/xgetgrnam.c,
	libmisc/xgetpwuid.c, libmisc/xgetgrgid.c, libmisc/xgetspnam.c: Do
	not limit the size of the buffer to hold the group or user
	structure. It used to be limited to 16k, which caused issues with
	groups having many users.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-06-11 20:01:21 UTC (rev 3018)
+++ upstream/trunk/ChangeLog	2009-06-11 21:33:00 UTC (rev 3019)
@@ -1,5 +1,13 @@
-2009-06-06  Nicolas François  <nicolas.francois at centraliens.net>
+2009-06-11  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* libmisc/xgetXXbyYY.c, libmisc/xgetpwnam.c, libmisc/xgetgrnam.c,
+	libmisc/xgetpwuid.c, libmisc/xgetgrgid.c, libmisc/xgetspnam.c: Do
+	not limit the size of the buffer to hold the group or user
+	structure. It used to be limited to 16k, which caused issues with
+	groups having many users.
+
+2009-06-11  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/su.c, man/su.1.xml: The default behavior (without -p or
 	--login) is to copy most of the environment variables. Revert a
 	previous change and update the documentation.

Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS	2009-06-11 20:01:21 UTC (rev 3018)
+++ upstream/trunk/NEWS	2009-06-11 21:33:00 UTC (rev 3019)
@@ -2,6 +2,9 @@
 
 shadow-4.1.4.1 -> shadow-4.1.4.2						UNRELEASED
 
+- general
+  * Improved support for large groups (impacts most tools).
+
 - su
   * Preserve the DISPLAY and XAUTHORITY environment variables. This was
     only the case in the non PAM enabled versions.

Modified: upstream/trunk/libmisc/xgetXXbyYY.c
===================================================================
--- upstream/trunk/libmisc/xgetXXbyYY.c	2009-06-11 20:01:21 UTC (rev 3018)
+++ upstream/trunk/libmisc/xgetXXbyYY.c	2009-06-11 21:33:00 UTC (rev 3019)
@@ -79,7 +79,7 @@
 		exit (13);
 	}
 
-	do {
+	while (true) {
 		int status;
 		LOOKUP_TYPE *resbuf = NULL;
 		buffer = (char *)realloc (buffer, length);
@@ -106,8 +106,14 @@
 			return NULL;
 		}
 
-		length *= 4;
-	} while (length < MAX_LENGTH);
+		if (length <= ((size_t)-1 / 4)) {
+			length *= 4;
+		} else if (length == (size_t) -1) {
+			break;
+		} else {
+			length = (size_t) -1;
+		}
+	}
 
 	free(buffer);
 	free(result);

Modified: upstream/trunk/libmisc/xgetgrgid.c
===================================================================
--- upstream/trunk/libmisc/xgetgrgid.c	2009-06-11 20:01:21 UTC (rev 3018)
+++ upstream/trunk/libmisc/xgetgrgid.c	2009-06-11 21:33:00 UTC (rev 3019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007       , Nicolas François
+ * Copyright (c) 2007 - 2009, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,6 @@
 #define ARG_TYPE	gid_t
 #define ARG_NAME	gid
 #define DUP_FUNCTION	__gr_dup
-#define MAX_LENGTH	0x8000
 #define HAVE_FUNCTION_R (defined HAVE_GETGRGID_R)
 
 #include "xgetXXbyYY.c"

Modified: upstream/trunk/libmisc/xgetgrnam.c
===================================================================
--- upstream/trunk/libmisc/xgetgrnam.c	2009-06-11 20:01:21 UTC (rev 3018)
+++ upstream/trunk/libmisc/xgetgrnam.c	2009-06-11 21:33:00 UTC (rev 3019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007       , Nicolas François
+ * Copyright (c) 2007 - 2009, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,6 @@
 #define ARG_TYPE	const char *
 #define ARG_NAME	name
 #define DUP_FUNCTION	__gr_dup
-#define MAX_LENGTH	0x8000
 #define HAVE_FUNCTION_R (defined HAVE_GETGRNAM_R)
 
 #include "xgetXXbyYY.c"

Modified: upstream/trunk/libmisc/xgetpwnam.c
===================================================================
--- upstream/trunk/libmisc/xgetpwnam.c	2009-06-11 20:01:21 UTC (rev 3018)
+++ upstream/trunk/libmisc/xgetpwnam.c	2009-06-11 21:33:00 UTC (rev 3019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007 - 2008, Nicolas François
+ * Copyright (c) 2007 - 2009, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,6 @@
 #define ARG_TYPE	const char *
 #define ARG_NAME	name
 #define DUP_FUNCTION	__pw_dup
-#define MAX_LENGTH	0x8000
 #define HAVE_FUNCTION_R (defined HAVE_GETPWNAM_R)
 
 #include "xgetXXbyYY.c"

Modified: upstream/trunk/libmisc/xgetpwuid.c
===================================================================
--- upstream/trunk/libmisc/xgetpwuid.c	2009-06-11 20:01:21 UTC (rev 3018)
+++ upstream/trunk/libmisc/xgetpwuid.c	2009-06-11 21:33:00 UTC (rev 3019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007       , Nicolas François
+ * Copyright (c) 2007 - 2009, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,6 @@
 #define ARG_TYPE	uid_t
 #define ARG_NAME	uid
 #define DUP_FUNCTION	__pw_dup
-#define MAX_LENGTH	0x8000
 #define HAVE_FUNCTION_R (defined HAVE_GETPWUID_R)
 
 #include "xgetXXbyYY.c"

Modified: upstream/trunk/libmisc/xgetspnam.c
===================================================================
--- upstream/trunk/libmisc/xgetspnam.c	2009-06-11 20:01:21 UTC (rev 3018)
+++ upstream/trunk/libmisc/xgetspnam.c	2009-06-11 21:33:00 UTC (rev 3019)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008       , Nicolas François
+ * Copyright (c) 2008 - 2009, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,6 @@
 #define ARG_TYPE	const char *
 #define ARG_NAME	name
 #define DUP_FUNCTION	__spw_dup
-#define MAX_LENGTH	0x8000
 #define HAVE_FUNCTION_R (defined HAVE_GETSPNAM_R)
 
 #include "xgetXXbyYY.c"




More information about the Pkg-shadow-commits mailing list