----- Original Message -----
From: Glenn Remot
To: [EMAIL PROTECTED] ; Philippine Linux Users Group Mailing List
Sent: Saturday, November 15, 2003 8:04 PM
Subject: Re: [plug] adduser name.user
>They probably want to create such for e-mail accounts through passwd.
>Marc Henry Galang wrote:
>er. why would you like to create such username?
>Juan Gaspar said:
>Hope that any of u have encountered this, and hopefully have a fix.
i never encountered this but i can help you on that matter :->
according to useradd man page in the NOTES section and it says:
NOTES
This version of useradd was modified by Red Hat to suit Red Hat
user/group conventions
i cant find any redhat user/group specifications on the net, what we are
going to do is to look at the source code of useradd.c to find how redhat
deals with its user name convention... useradd.c belongs to shadow-x.y.z
file... the function name to check whether the username is good or bad is at
chkname.c with a function name of good_name()...
static int
good_name(const char *name)
{
/*
* User/group names must match [a-z_][a-z0-9_-]*
*/
if (!*name || !((*name >= 'a' && *name <= 'z') || *name == '_'))
return 0;
while (*++name) {
if (!((*name >= 'a' && *name <= 'z') ||
(*name >= '0' && *name <= '9') ||
*name == '_' || *name == '-' ||
(*name == '$' && *(name+1) == NULL)))
return 0;
}
return 1;
}
a return value of 1 indicates that a good and valid username while a return
value of 0 indicates a badname...
it says here that the first character of username must match lowercase a to
z or underscore... no digits, uppercase A to Z and other characters...
the second character and so on and so forth are valid with one of the
followings:
1). lowercase a to z
2) 0 to 9
3) underscore
4) minus sign
5) dollar sign
no uppercase A to Z characters are valid here and also your dot character...
to fix your problem..... you must alter chkname.c so that it will not comply
to redhat specification and rebuild the whole package of shadow-x.y.z...
here is the altered good_name() function inside chkname.c file to suit your
needs:
static int
good_name(const char *name)
{
/*
* User/group names must match [a-z_][a-z0-9_-]*
*/
if (!*name || !((*name >= 'a' && *name <= 'z') || *name == '_'))
return 0;
while (*++name) {
if (!((*name >= 'a' && *name <= 'z') ||
(*name >= '0' && *name <= '9') ||
*name == '_' || *name == '-' || *name == '.' ||
(*name == '$' && *(name+1) == NULL)))
return 0;
}
return 1;
}
fooler.
--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie