From c28c443d8f0e38dbf64f6657636d31633f1e2498 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sun, 30 Nov 2008 01:29:40 +0000 Subject: [PATCH] * NEWS, configure.in, libmisc/chkname.c: make group max length a configure option. The configure behavior encoded is: -> 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. --- ChangeLog | 9 +++++++++ NEWS | 8 ++++++++ configure.in | 10 ++++++++++ libmisc/chkname.c | 3 +-- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4669e985..0d95b23c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-27 Mike Frysinger + + * NEWS, configure.in, libmisc/chkname.c: make group max length a + configure option. The configure behavior encoded is: + -> 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. + 2008-11-23 Nicolas François * src/su.c: (!USE_PAM) Provide visible information indicating that diff --git a/NEWS b/NEWS index 7aab4d40..bbf004cb 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,14 @@ shadow-4.1.2.2 -> shadow-4.1.3 UNRELEASED groupadd, groupdel, groupmod, newusers, useradd, userdel, and usermod. This authentication is not necessary when these tools are not installed setuid root. + * Added configure --with-group-name-max-length (default) / + --without-group-name-max-length options. This permits to configure the maximum length allowed for group names: + -> 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 - addition of users or groups * Speed improvement in case UID_MAX/SYS_UID_MAX/GID_MAX/SYS_GID_MAX is used for an user/group. This should be noticeable in case of LDAP diff --git a/configure.in b/configure.in index 25ed1546..5361b3b8 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 2bdc06b6..1ae6a3d7 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); }