Small problem (and fix) of username size


Subject: Small problem (and fix) of username size
From: Livio Baldini Soares (livio@linux.ime.usp.br)
Date: Sun Jul 23 2000 - 00:43:24 CEST


Hi to all,

  this is my first message to this list (as a matter os fact, to ANY
development list). So I really don't know if I'm being out of hand, if
I am please tell me so. I have a small, tiny patch, but I don't know
how to submit it, so I'll describe the problem, and how I fixed it.

I'm an undergraduate student in Computer Science at IME-USP
(University of São Paulo-Brazil *that's why all the English
mistakes). And I'm one of System Administrators of the net which is
destined for all the students. We run pure Linux/Debian, and we've
just upgraded to Debian-potato. We chose to use cfingerd, instead of
conventional fingerd.

Testing are new distribution I noticed an error. When a did:
jacuzzi:/home/bcc/livio> finger @epicurus
[epicurus.linux.ime.usp.br]
Username Real name Idletime TTY Remote console location
rcaetan rcaetan 23:09 2 (epicurus)
livio Livio Baldini Soares 0:09 pt (200.182.14)

We'll `rcaetan` isn't a user, but `rcaetano` is (last `o` missing). So
I said - What the heck!
And went to look for anything in the configuration files. I find out
that the problem was in the `userlist` program.

I got the 1.4.3 source code in metalab.unc.edu cause
ftp.infodrom.north.de doesn't respond (I think it's down).
(By the way, in the FAQ I got it says: get the source in
/pub/Linux/system/Network/finger, but `Network` is really `network`).

I discovered where problem was. It's in `userlist/display.c`.
Well there were two errors.
1) On compilation:
gcc -g -O2 -Wall -c display.c -o display.o
display.c: In function `process_display':
display.c:92: `cp'undeclared (first use this function)
display.c:92: (Each undeclared identifier is reported only once
display.c:92: for each function it appears in.)
display.c:93: `x'undeclared (first use this function)
make: *** [display.o] Error 1

To fix this a just added, to line 92:
char *cp, *x;

2) The size bug:
In line 82, `ru` is declared with size 8, except in my Linux all
usernames have 8 chars+(\0) = 9 chars. But to change the size to 9, I
thought would be falty, so I put these taken from
`userlist/initialize.c`:

#ifdef BSD
#define ULIST_UNAME 16
#else
#define ULIST_UNAME 8
#endif

Before `process_display` function.
And changed the definition o ru, now line 89, to:
char ru[ULIST_UNAME+1], fn[STRLEN];

Compiled and tested again. Here is the result:
jacuzzi:/home/bcc/livio/tmp> ./userlist
USERNAME Real name Idletime TTY Remote console location
rcaetano Rafael Caetano dos Santos :0 (console)
livio Livio Baldini Soares 0:15 pt (epicurus.linux)

Now, previously `rcaetan`, is `rcaetano` and his real name is filled
out.

That's all.

Sorry about the size of this e-mail, and sorry to all if was
inconvinient in any way,

  bye,

 Livio Baldini Soares <livio@linux.ime.usp.br>



This archive was generated by hypermail 2b25 : Sun Jul 23 2000 - 00:42:26 CEST