]> granicus.if.org Git - shadow/commitdiff
* libmisc/xgetXXbyYY.c, libmisc/xgetpwnam.c, libmisc/xgetgrnam.c,
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 11 Jun 2009 21:33:00 +0000 (21:33 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 11 Jun 2009 21:33:00 +0000 (21:33 +0000)
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.

ChangeLog
NEWS
libmisc/xgetXXbyYY.c
libmisc/xgetgrgid.c
libmisc/xgetgrnam.c
libmisc/xgetpwnam.c
libmisc/xgetpwuid.c
libmisc/xgetspnam.c

index 615ea53724dd06cdc1c1bd5307016a304bd55912..752ea133622b793f1e08cc0c82fe23219fefd871 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
-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
diff --git a/NEWS b/NEWS
index 8b96b35177ba1900c8ae925da334c26add84fc54..fc5dc73c3dace2d97e7186695c4937e8798fbca0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ $Id$
 
 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.
index 6419aa908eb11021005f9730d99308d2cc0d22fe..b3d2cd1a650bba7e104aec2ef430427fe6bba902 100644 (file)
@@ -79,7 +79,7 @@
                exit (13);
        }
 
-       do {
+       while (true) {
                int status;
                LOOKUP_TYPE *resbuf = NULL;
                buffer = (char *)realloc (buffer, length);
                        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 f691974087aa8e8264b522df3fc9e669604d2a61..2ef171d11eb90e164b0a35f5daead7c8f78d7ffb 100644 (file)
@@ -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 3f1604148a13f81a109df4303e281ef1337d6a0e..a07d0c33ee107fb161b53ad50246926e5240c3be 100644 (file)
@@ -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 6b59248de7a4eb7a3a5064b5a677ea9fd24337e4..db65abb768c8b0a9f033659f5fda5f4ac9bc6874 100644 (file)
@@ -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 f0fb04c987e4eb0bf3600f188d3be109e6b8a74f..89241344a1dcac4978a7c04b0c284efda4359944 100644 (file)
@@ -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 1705139acc0d1756ab76fce34458f7a808c14c71..287e97f23e9f5bf00a3ff70ae26b7cca9ffd3118 100644 (file)
@@ -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"