[Pkg-shadow-devel] [PATCH] make group max length a configure option
Mike Frysinger
vapier at gentoo.org
Thu Nov 27 20:38:48 UTC 2008
The configure behavior encoded is:
<no option> -> default of 16 (like today)
--with-group-name-max-length -> default of 16
--without-group-name-max-length -> no max length
--with-group-name-max-length=n > max is set to n
- no sanity checking is performed on n so people could do
something neat like --with-group-name-max-length=MAX_INT
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
configure.in | 10 ++++++++++
libmisc/chkname.c | 3 +--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/configure.in b/configure.in
index 25ed154..5361b3b 100644
--- a/configure.in
+++ b/configure.in
@@ -254,6 +254,16 @@ AC_ARG_WITH(sha-crypt,
AC_ARG_WITH(nscd,
[AC_HELP_STRING([--with-nscd], [enable support for nscd @<:@default=yes@:>@])],
[with_nscd=$withval], [with_nscd=yes])
+AC_ARG_WITH(group-name-max-length,
+ [AC_HELP_STRING([--with-group-name-max-length], [set max group name length @<:@default=16@:>@])],
+ [with_group_name_max_length=$withval], [with_group_name_max_length=yes])
+
+if test "$with_group_name_max_length" = "no" ; then
+ with_group_name_max_length=0
+elif test "$with_group_name_max_length" = "yes" ; then
+ with_group_name_max_length=16
+fi
+AC_DEFINE_UNQUOTED(GROUP_NAME_MAX_LENGTH, $with_group_name_max_length, [max group name length])
AM_CONDITIONAL(USE_SHA_CRYPT, test "x$with_sha_crypt" = "xyes")
if test "$with_sha_crypt" = "yes"; then
diff --git a/libmisc/chkname.c b/libmisc/chkname.c
index 2bdc06b..1ae6a3d 100644
--- a/libmisc/chkname.c
+++ b/libmisc/chkname.c
@@ -100,9 +100,8 @@ bool is_valid_group_name (const char *name)
* Arbitrary limit for group names - max 16
* characters (same as on HP-UX 10).
*/
- if (strlen (name) > 16) {
+ if (GROUP_NAME_MAX_LENGTH && strlen (name) > GROUP_NAME_MAX_LENGTH)
return false;
- }
return is_valid_name (name);
}
--
1.6.0.4
More information about the Pkg-shadow-devel
mailing list