[shadow] allow dot characters in login name

Jérôme Augé jerome.auge at cesamnet.fr
Fri Dec 15 18:31:56 CET 2006


Hi,

I noticed that I can't create login name containing a '.' (dot)
character (e.g. firstname.lastname). I stumbled upon this problem when I
needed to upgrade an older PLD Samba server where accounts where all
created as firstname.lastname. So, I ended up patching the shadow
package to allow dot in logins and use it instead of the PLD/ac default
shadow pkg.

What about allowing the dot character by default in the shadow package ?

Here is the good_name() function used by Fedora :

static int good_name (const char *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 >= 'A' && *name <= 'Z')
                     || (*name >= '0' && *name <= '9')
                     || *name == '_' || *name == '.' || *name == '-'
                     || (*name == '$' && *(name + 1) == '\0')))
                        return 0;
        }

        return 1;
}

Regards,
Jérôme


More information about the pld-devel-en mailing list