Bug 10184 - rusersd only returns first 7 characters of username.
rusersd only returns first 7 characters of username.
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: rusers (Show other bugs)
6.1
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Nalin Dahyabhai
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-03-15 11:15 EST by di990013
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-11-30 10:24:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description di990013 2000-03-15 11:15:07 EST
When running RH 6.1, rusers returns only the first 7 characters (andresen)
of my username (andresen). I traced the problem to appear in the server
part of Netkit-rusers-0.16-x.

In the source for rusers_proc.c I found:

static void do_strncpy(char *tgt, const char *src, size_t len) {
    strncpy(tgt, src, len);
    tgt[len-1] = 0;          // Line in question
};

This effectively cuts the last (8.) character away.

Question: Is this necessary ?

Running RH 4.2 on my old computer, I get the entire string (andresen) ..
Comment 1 Derek Tattersall 2000-08-10 14:55:04 EDT
Still returns only first 7 characters of user name at RHL 7.0 RC1.
Comment 2 Need Real Name 2000-11-30 10:24:05 EST
In may, I reported this bug to netbug@ftp.uk.linux.org, that maintain the netkit
package. The reply I got, was this:

<copy>
> Here at uni, we have both HP-UX 10.20 and Redhat Linux 6.1 machines. In
> one of my scipts, I use rusers (to figure out who is online). Lately, I've
> noticied a strange thing with rusers. When I do a 

The short answer is "rusers sucks".

The long answer is it looks like you're right. ut_name should be
strncpy, and the others should be do_strncpy.
</copy>

Now I've checked ftp://ftp.uk.linux.org/pub/linux/Networking/netkit and found a
new version of the netkit. After a quick look at the source, I noticed this:
<from rpc.rusersd/rusers_proc.c:do_names_2(int all)>
/* note NOT do_strncpy */
strncpy(utmp_idle[nusers].ui_utmp.ut_name, 
              uptr->ut_name, 
              sizeof(utmp_idle[nusers].ui_utmp.ut_name));
</from rpc.rusersd/rusers_proc.c:do_names_2(int all)>

This source was released around 31 of july. I've made a quick test and the new
version fixes the problem. Now the question is:

Will you (Redhat) make an (rpm-) update available to fix the problem ??
Comment 3 Phil Knirsch 2001-06-06 11:03:00 EDT
This has been fixed in the RedHat 7.1 release which includes the 0.17 netkit
package.

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.