long userids

Lyndon Nerenberg lyndon at cs.athabascau.ca
Fri Jan 18 09:25:21 AEST 1991


>| Are there any deadly implications to using long (>8 chars) userid names
>| in /etc/passwd?

Yes. A lot of Unix implementations have the following line in <stdio.h>:

	#define L_cuserid       9

This constant defines the size of a char array large enough to hold
a login name plus the terminating NULL. Some (not a lot, but some)
software uses this constant to size buffers. If the code doesn't check
for (strlen(pw->pw_name) < L_cuserid) you're going to have problems.

Not all Unix releases document this constant. Under SunOS it's mentioned
in the cuserid(3) man page.

I would strongly advise that you limit login names to a maximum of
eight characters. There are better ways to achieve what you're setting
out to do than by overloading the semantics of login names.



-- 
    Lyndon Nerenberg  VE6BBM / Computing Services / Athabasca University
        {alberta,cbmvax,mips}!atha!lyndon || lyndon at cs.athabascau.ca
                    Packet: ve6bbm at ve6mc [.ab.can.na]
      The only thing open about OSF is their mouth.  --Chuck Musciano



More information about the Comp.unix.questions mailing list