[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

proposed-update: useradd fails with long lines in /etc/group



Version: 1:4.1.4.2-1


Dear stable release manager,

Support for long lines (more than 8k) in /etc/group is broken is the
shadow tools. This is a regression compared to Etch and blocks the
migration of systems from Etch to Lenny (if these systems may have groups
with a lot of users).

This issue was fixed in version 1:4.1.4.2-1 (in Debian since July 24) with
the attached patch.

Severity of Bug #552006 is currently important. Do you think such bug
should be fixed in proposed-update?

Best Regards,
-- 
Nekral
Index: libmisc/xgetXXbyYY.c
===================================================================
--- libmisc/xgetXXbyYY.c	(révision 3018)
+++ libmisc/xgetXXbyYY.c	(révision 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);
Index: libmisc/xgetpwnam.c
===================================================================
--- libmisc/xgetpwnam.c	(révision 3018)
+++ libmisc/xgetpwnam.c	(révision 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"
Index: libmisc/xgetgrnam.c
===================================================================
--- libmisc/xgetgrnam.c	(révision 3018)
+++ libmisc/xgetgrnam.c	(révision 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"
Index: libmisc/xgetpwuid.c
===================================================================
--- libmisc/xgetpwuid.c	(révision 3018)
+++ libmisc/xgetpwuid.c	(révision 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"
Index: libmisc/xgetgrgid.c
===================================================================
--- libmisc/xgetgrgid.c	(révision 3018)
+++ libmisc/xgetgrgid.c	(révision 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"
Index: libmisc/xgetspnam.c
===================================================================
--- libmisc/xgetspnam.c	(révision 3018)
+++ libmisc/xgetspnam.c	(révision 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"
Index: ChangeLog
===================================================================
--- ChangeLog	(révision 3018)
+++ ChangeLog	(révision 3019)
@@ -1,5 +1,13 @@
-2009-06-06  Nicolas François  <nicolas.francois@centraliens.net>
+2009-06-11  Nicolas François  <nicolas.francois@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@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.
Index: NEWS
===================================================================
--- NEWS	(révision 3018)
+++ NEWS	(révision 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.

Reply to: