Greald this is what I had done (note the if statement also has similar
hack)

static int
good_name(const char *name)
{
        /*
         * User/group names must match [a-z_][a-z0-9_-]*
         */
        if (!*name || !((*name >= 'a' && *name <= 'z') || *name == '_'
|| *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;
}

After compiling and installing, useradd now accepts usernames with a dot
but the redhat graphical user manager doesn't. I guess redhat
implemented their own check.

Joseph


On Tue, 2004-06-15 at 17:23, Begumisa Gerald M. wrote:
> On Mon, 14 Jun 2004, joseph mpora wrote:
> 
> > 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;
> >     }
> 
> Most likely you'll need to hack about that while statement and add support
> for the dot.  Probably the final statement will look like this;
> 
> --
>       while (*++name) {
>               if (!((*name >= 'a' && *name <= 'z') ||
>                   (*name >= '0' && *name <= '9') ||
>                   *name == '_' || *name == '-' || *name == '.' ||
>                   (*name == '$' && *(name+1) == NULL)))
>                       return 0;
>       }
> --
> 
> 
> Gerald.
> 
> 
> ---------------------------------------------
> This service is hosted on the Infocom network
> http://www.infocom.co.ug
> 



---------------------------------------------
This service is hosted on the Infocom network
http://www.infocom.co.ug

Reply via email to