On 10/04/2009 08:25 PM, Dan McGhee wrote:
Hans Kaper wrote:
That the problem arises after the installation of Shadow does not surprise
me. After the installation groupadd from LFS-Shadow takes over from Shadow
of your hostsystem.
Yes, I've done more research and discovered that there's no way around it.
A couple Shadow versions ago, there was a patch I think in the CLFS book
to fix a few issues - one was to alter useradd and groupadd to reduce
the restrictions on user and group names - I've attached the patch here.
As I said, this was a couple versions ago so most of the issues in the
patch have already been fixed in the latest Shadow version, but the
restrictions on user and group names are still there, so the first bit
of that patch can still be applied if you want.
It's not really a problem for me since I just use the package name in
all lower case (yeah, I use package users too) - my only issue has been
the maximum length of user/group names, though in recent Shadow versions
that can be changed with a configure switch - I add
--without-group-name-max-length to Shadow's configure command.
Submitted By: Jim Gifford (patches at jg555 dot com)
Date: 2007-09-04
Initial Package Version: 4.0.18.1
Origin: Mailing List
Upstream Status: Submitted
Description: Fixes Various Issues From Upstream
Adds compability for Samba Machine Names
Corrects Grammer in Man Files
Corrects Useradd issue
Fixes useradd -G and -g
Fix chpasswd and chgpasswd stack overflow
diff -Naur shadow-4.0.18.1.orig/libmisc/chkname.c
shadow-4.0.18.1/libmisc/chkname.c
--- shadow-4.0.18.1.orig/libmisc/chkname.c 2005-08-31 10:24:57.000000000
-0700
+++ shadow-4.0.18.1/libmisc/chkname.c 2007-09-03 17:30:39.000000000 -0700
@@ -18,16 +18,24 @@
static int good_name (const char *name)
{
/*
- * User/group names must match [a-z_][a-z0-9_-]*[$]
- */
- if (!*name || !((*name >= 'a' && *name <= 'z') || *name == '_'))
+ * User/group names must match gnu e-regex:
+ * [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
+ *
+ * as a non-POSIX, extension, allow "$" as the last char for
+ * sake of Samba 3.x "add machine script"
+ */
+ if (!*name || !((*name >= 'a' && *name <= 'z')
+ || (*name >= 'A' && *name <= 'Z')
+ || (*name >= '0' && *name <= '9')
+ || *name == '_' || *name == '.'))
return 0;
while (*++name) {
- if (!((*name >= 'a' && *name <= 'z') ||
- (*name >= '0' && *name <= '9') ||
- *name == '_' || *name == '-' ||
- (*name == '$' && *(name + 1) == '\0')))
+ if (!( (*name >= 'a' && *name <= 'z')
+ || (*name >= 'A' && *name <= 'Z')
+ || (*name >= '0' && *name <= '9')
+ || *name == '_' || *name == '.' || *name == '-'
+ || (*name == '$' && *(name + 1) == '\0')))
return 0;
}
@@ -43,10 +51,9 @@
#endif
/*
- * User names are limited by whatever utmp can
- * handle (usually max 8 characters).
+ * User names are limited by whatever utmp can handle.
*/
- if (strlen (name) > sizeof (ut.ut_user))
+ if (strlen(name) + 1 > sizeof(ut.ut_user))
return 0;
return good_name (name);
@@ -54,11 +61,13 @@
int check_group_name (const char *name)
{
- /*
- * Arbitrary limit for group names - max 16
- * characters (same as on HP-UX 10).
- */
- if (strlen (name) > 16)
+#if HAVE_UTMPX_H
+ struct utmpx ut;
+#else
+ struct utmp ut;
+#endif
+
+ if (strlen(name) + 1 > sizeof(ut.ut_user))
return 0;
return good_name (name);
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page