rbarrell@rdb1.UUCP (rbarrell) (10/05/90)
Recently, a friend of mine noticed that even though I had logged onto his system a number of times, the 'last' command would not show any entries for me if he asked for "rbarrell" directly. When other options of 'last' (or none at all) were used, everything was fine. After a little experimentation and snooping around on my own machine, I noticed that utmp.h specifies ut_user[8]. I have heard that user names were supposed to be no more than 8 characters, but this would indicate that 7 should be the real maximum. If not, it means whoever programmed that structure, and wanted to allow for 8-character usernames, forgot to allow for the null at the end of the string. I have never had any difficulties in using 8-character names, but I wonder if there is a potential problem in my doing so, since ut_user[] has only 8 characters. For the 'last' command, this is relatively minor, but is there anything else, that uses the utmp structure, which could be more seriously affected? BTW, since my use of an 8-character username causes ut_user[] to run right into ut_id[], the solution to the 'last' command problem was to put the terminal id as part of my username when searching (e.g. "last rbarrell1A"). This would indicate one (or more) of the following: 1) Usernames should really never exceed 7 characters. 2) Someone goofed and didn't allow for the null at the end of ut_user[]. 3) Whoever wrote 'last' goofed by not using strncmp(ut_user,name,strlen(name)) instead of strcmp(ut_user,name). This behavior is found on SCO xenix 2.3.x on 286 and 386 machines (I have not had the opportunity to test it on others, especially since older versions of SCO didn't have 'last'). Has anyone else experienced this on other versions of *nix? -- Robert Barrell | rbarrell@rdb1.UUCP | Phillips Consulting Group Milo's Meadow BBS | uunet!pcgbase!rdb1!rbarrell | 282 North Shore Drive login: bbs or nuucp | "... Pooh just IS." | Ormond Beach, FL 32176 (904) 441-5028 | -- The Tao of Pooh | (904) 672 - 3856