Bug 172247

Summary: last(1) only prints first 8 chars of username
Product: Red Hat Enterprise Linux 3 Reporter: Adam Thompson <athompso>
Component: SysVinitAssignee: Bill Nottingham <notting>
Status: CLOSED DUPLICATE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: rvokal
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: i386   
OS: Linux   
URL: (none)
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-11-01 21:52:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adam Thompson 2005-11-01 21:47:28 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

Description of problem:
/usr/include/bits/utmp.h: #define UT_NAMESIZE     32

but... in last.c (from sysvinit sources) enforcese a %8.8 format mask for usernames.

Since we have longer usernames now (courtesy winbind), last has suddenly become useless.  The name of our domain is longer than 8 characters, so although the information is there in the utmp file, last can't display it!


Version-Release number of selected component (if applicable):
SysVinit-2.85-4

How reproducible:
Always

Steps to Reproduce:
1. Enable winbindd
2. Set "utmp = yes" in smb.conf
3. Run "last"
4. See useless output :-(


Actual Results:  [root@Vailtech root]# last
root     pts/0        corporate.dryden Tue Nov  1 15:40   still logged in   
DRYDENDO smb/4        10.0.1.56        Tue Nov  1 15:29   still logged in   
DRYDENDO smb/3        10.0.1.52        Tue Nov  1 15:26   still logged in   
root     pts/0        10.0.1.91        Tue Nov  1 15:24 - 15:27  (00:03)    
DRYDENDO smb/1        10.0.1.51        Tue Nov  1 15:22   still logged in   
DRYDENDO smb/1        10.0.1.51        Tue Nov  1 15:22 - 15:22  (00:00)    
root     smb/1        10.0.1.51        Tue Nov  1 15:21 - 15:21  (00:00)    
DRYDENDO smb/2        10.0.50.235      Tue Nov  1 15:19   still logged in   
DRYDENDO smb/1        10.0.1.51        Tue Nov  1 15:16 - 15:20  (00:03)    
root     pts/0        corporate.dryden Tue Nov  1 13:26 - 15:19  (01:52)    



Expected Results:  [root@Vailtech root]# widelast
root                             pts/0        corporate.dryden Tue Nov  1 15:40   still logged in   
DRYDENDOMAIN\jsalina             smb/4        10.0.1.56        Tue Nov  1 15:29   still logged in   
DRYDENDOMAIN\jburgstaler         smb/3        10.0.1.52        Tue Nov  1 15:26   still logged in   
root                             pts/0        10.0.1.91        Tue Nov  1 15:24 - 15:27  (00:03)    
DRYDENDOMAIN\dsmith              smb/1        10.0.1.51        Tue Nov  1 15:22   still logged in   
DRYDENDOMAIN\dsmith              smb/1        10.0.1.51        Tue Nov  1 15:22 - 15:22  (00:00)    
root                             smb/1        10.0.1.51        Tue Nov  1 15:21 - 15:21  (00:00)    
DRYDENDOMAIN\lrobinson           smb/2        10.0.50.235      Tue Nov  1 15:19   still logged in   
DRYDENDOMAIN\dsmith              smb/1        10.0.1.51        Tue Nov  1 15:16 - 15:20  (00:03)    
root                             pts/0        corporate.dryden Tue Nov  1 13:26 - 15:19  (01:52)    


Additional info:

Easily fixed:
    sed -e 's/%8.8/%32.2/' last.c

I'm sure that would break something else somewhere, so possibly a new command-line switch that causes printf to use "%UT_NAMESIZE.UT_NAMESIZE" instead of "%8.8" ?

Comment 1 Bill Nottingham 2005-11-01 21:52:07 UTC

*** This bug has been marked as a duplicate of 121426 ***