* 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.
This commit is contained in:
nekral-guest 2009-06-11 21:33:00 +00:00
parent 7d5d9c1841
commit fa69d08d13
8 changed files with 26 additions and 14 deletions

View File

@ -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 * src/su.c, man/su.1.xml: The default behavior (without -p or
--login) is to copy most of the environment variables. Revert a --login) is to copy most of the environment variables. Revert a

3
NEWS
View File

@ -2,6 +2,9 @@ $Id$
shadow-4.1.4.1 -> shadow-4.1.4.2 UNRELEASED shadow-4.1.4.1 -> shadow-4.1.4.2 UNRELEASED
- general
* Improved support for large groups (impacts most tools).
- su - su
* Preserve the DISPLAY and XAUTHORITY environment variables. This was * Preserve the DISPLAY and XAUTHORITY environment variables. This was
only the case in the non PAM enabled versions. only the case in the non PAM enabled versions.

View File

@ -79,7 +79,7 @@
exit (13); exit (13);
} }
do { while (true) {
int status; int status;
LOOKUP_TYPE *resbuf = NULL; LOOKUP_TYPE *resbuf = NULL;
buffer = (char *)realloc (buffer, length); buffer = (char *)realloc (buffer, length);
@ -106,8 +106,14 @@
return NULL; return NULL;
} }
length *= 4; if (length <= ((size_t)-1 / 4)) {
} while (length < MAX_LENGTH); length *= 4;
} else if (length == (size_t) -1) {
break;
} else {
length = (size_t) -1;
}
}
free(buffer); free(buffer);
free(result); free(result);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007 , Nicolas François * Copyright (c) 2007 - 2009, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -58,7 +58,6 @@
#define ARG_TYPE gid_t #define ARG_TYPE gid_t
#define ARG_NAME gid #define ARG_NAME gid
#define DUP_FUNCTION __gr_dup #define DUP_FUNCTION __gr_dup
#define MAX_LENGTH 0x8000
#define HAVE_FUNCTION_R (defined HAVE_GETGRGID_R) #define HAVE_FUNCTION_R (defined HAVE_GETGRGID_R)
#include "xgetXXbyYY.c" #include "xgetXXbyYY.c"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007 , Nicolas François * Copyright (c) 2007 - 2009, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -58,7 +58,6 @@
#define ARG_TYPE const char * #define ARG_TYPE const char *
#define ARG_NAME name #define ARG_NAME name
#define DUP_FUNCTION __gr_dup #define DUP_FUNCTION __gr_dup
#define MAX_LENGTH 0x8000
#define HAVE_FUNCTION_R (defined HAVE_GETGRNAM_R) #define HAVE_FUNCTION_R (defined HAVE_GETGRNAM_R)
#include "xgetXXbyYY.c" #include "xgetXXbyYY.c"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007 - 2008, Nicolas François * Copyright (c) 2007 - 2009, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -58,7 +58,6 @@
#define ARG_TYPE const char * #define ARG_TYPE const char *
#define ARG_NAME name #define ARG_NAME name
#define DUP_FUNCTION __pw_dup #define DUP_FUNCTION __pw_dup
#define MAX_LENGTH 0x8000
#define HAVE_FUNCTION_R (defined HAVE_GETPWNAM_R) #define HAVE_FUNCTION_R (defined HAVE_GETPWNAM_R)
#include "xgetXXbyYY.c" #include "xgetXXbyYY.c"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007 , Nicolas François * Copyright (c) 2007 - 2009, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -58,7 +58,6 @@
#define ARG_TYPE uid_t #define ARG_TYPE uid_t
#define ARG_NAME uid #define ARG_NAME uid
#define DUP_FUNCTION __pw_dup #define DUP_FUNCTION __pw_dup
#define MAX_LENGTH 0x8000
#define HAVE_FUNCTION_R (defined HAVE_GETPWUID_R) #define HAVE_FUNCTION_R (defined HAVE_GETPWUID_R)
#include "xgetXXbyYY.c" #include "xgetXXbyYY.c"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008 , Nicolas François * Copyright (c) 2008 - 2009, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -58,7 +58,6 @@
#define ARG_TYPE const char * #define ARG_TYPE const char *
#define ARG_NAME name #define ARG_NAME name
#define DUP_FUNCTION __spw_dup #define DUP_FUNCTION __spw_dup
#define MAX_LENGTH 0x8000
#define HAVE_FUNCTION_R (defined HAVE_GETSPNAM_R) #define HAVE_FUNCTION_R (defined HAVE_GETSPNAM_R)
#include "xgetXXbyYY.c" #include "xgetXXbyYY.c"