Network users with longer than 8 character usernames do not show up in user list (possible fix included)

Bug #476811 reported by Joel Allardyce
144
This bug affects 25 people
Affects Status Importance Assigned to Milestone
gdm
Unknown
Medium
consolekit (Debian)
Fix Released
Unknown
consolekit (Ubuntu)
Low
Martin Pitt
Lucid
Undecided
Unassigned

Bug Description

Binary package hint: gdm

First, some details:

GDM Version: 2.28.1-0ubuntu1
Output of: lsb_release -rd
Description: Ubuntu 9.10
Release: 9.10

Also (suspected) involved:
consolekit version: 0.3.1-0ubuntu2

Related:
likewise-open5 version: 5.0.3991.1+krb5-0ubuntu2

Problem:

I am running two installations of Karmic with authentication against an Active Directory server using Likewise Open version 5. As expected, all local users show up in the face browser user list. Additionally, all recent AD users with user names shorter than 8 characters show up in the face browser list as well. The only recent network users absent from the face browser user list are Active Directory users with longer user names.

According to the GDM 2.28 documentation (http://library.gnome.org/admin/gdm/2.28/gdm.html -> see section on /apps/gdm/simple-greeter/include_all), by Default:

"The Face Browser also will display any users that have previously logged in on the system (for example NIS/LDAP users). It gets this list via calling the ck-history ConsoleKit interface."

This actually seems to work for all of the users who use this system with user names equal to or shorter than 8 characters, but it fails if a user's login name is greater than 8 charcters, and I am pretty sure I know why (I just don't know how to fix it).

First, two pieces of evidence. Examining the gdm greeter log file (:0-greeter.log), I find the following warnings repeated over and over:

gdm-simple-greeter[2534]: WARNING: Unable to lookup user name xxxxxxxx: Success
gdm-simple-greeter[2534]: WARNING: Unable to lookup user name yyyyyyyy: Success

Note: I have replaced the actual user names with xxxx's and yyyy's

Each of these are truncated user names (truncated to 8 characters). The first is my own login, from Active Directory. The second is a local user with a longer than 8 character name. It should be noted that, regardless of the warning, the local user still shows up in the user list (this is likely because GDM uses a different mechanism, fgetpwent(), to populate the list with local users), but the network user does not.

As stated in the excerpt above, GDM uses ck-history to populate network users, so I thought it might be prudent to examine the output of the ck-history command. I ran the following command, and discovered the problem:

$ck-history --frequent

The command returned the expected list of recent users, and all of the user names longer than 8 characters WERE truncated.

So, if GDM is just running this command, and parsing the output, it is receiving invalid user names (hence the log file warning, and missing users).

In addition, the problem seems to be a "printing" problem only. If I use ck-history against a particular user name (with the -u or --user commands), it expects the full username, not the truncated one. So, it is not internally truncating user names, only printing them that way. I suspect that (if ck is written in C), it is just a mistake with a printf, or some such, only allowing for an 8 character field.

(Obvious) Potential Solutions:
If my suspicion is correct, and GDM is only parsing the output of the "ck-history --frequent" command, it would seem that the simplest solution would be to use ConsoleKit's API directly (assuming it contains a "history" and "frequent users" mechanism). Or, it might be better to fix ck-history so that it does not truncate user names when printing them.

tags: added: userlist username
removed: list name user
tags: added: facebrowser
Revision history for this message
Denis Konstantinov (linvinus) wrote :

i can confirm this bug

Revision history for this message
aeneas (aeneascarver) wrote :

I can confirm this bug. If (!) there is indeed ck-histroy used or the code from ck-history then this is a oneliner:

To fix ck-history:
http://cgit.freedesktop.org/ConsoleKit/tree/tools/ck-history.c#n772

just change
                g_print ("%-8.8s %u\n", username, data->count);

to:
                g_print ("%s %u\n", username, data->count);

or even better: (swap username and datacount to omit padding issues and retain the tab-like format)
                g_print ("%8u %s\n", data->count, username);

Revision history for this message
Leon Kaiser (literalka) wrote :
Revision history for this message
Jayen (jayen) wrote :

Is it related if I also have:
gdm-simple-greeter[26247]: WARNING: Unable to lookup user name data: Success

I have no user named 'data' but I do have system accounts www-data and ftp-data.

Revision history for this message
matangdilis (matangdilis) wrote :

I am still experiencing this problem as of today, even after latest upgrades. What are its consequences?

Revision history for this message
matangdilis (matangdilis) wrote :

I changed my username, group name and real name under user settings to below 8 chars. Warning is gone.

Revision history for this message
meanasspenguin (jason-meanasspenguin) wrote :

When using gdm I am unable to login to users with names of greater than 8 characters (via LDAP). If I switch to xdm or wdm then the authentication works perfectly fine. I AM able to use gdm with users that use 8 or less characters in their name. The messages I found in the daemon.log are consistent to those listed above.

Revision history for this message
Veli-Matti Lintu (vmlintu) wrote :

I had got hit by this bug also and after digging the code it looks like there are two separate issues. In comment #7 the problem is probably this:

gui/simple-greeter/gdm-user-manager.c

static gboolean
parse_ck_history_line (const char *line,
                       char **user_namep,
                       gulong *frequencyp)
{
...
        re = g_regex_new ("(?P<username>[0-9a-zA-Z]+)[ ]+(?P<frequency>[0-9]+)", 0, 0, &error);
...
}

The regex allows only numbers 0-9 and letters a-z either downcase or uppercase. We have a lot of usernames with dashes and commas, so the regex breaks here.

The bigger problem is the 8 character limit that comes from consolekit as described in comment #2. I didn't feel like patching consolekit as it might affect quite a few other places, so I made a quick hack to make Include= accept script name like AutomaticLogin= does with pipe in the end. The patch checks if the value ends in | and executes it as script if it does. The output of the script is then used to create the userlist. The output should be formatted as username1,username2,username3,etc..

This is used as a temporary solution until we get something permanent done. With this solution both the 8 character limit of ck-history and the regex problem are avoided. As a bonus we can code the filtering logic ourselves.

Revision history for this message
Veli-Matti Lintu (vmlintu) wrote :

Something like this script can be used to fetch user information from consolekit's logfiles. Configuration is done in /etc/gdm/custom.conf:

Include=/path/to/script.pl|

Changed in gdm (Ubuntu):
importance: Undecided → Low
Revision history for this message
Seth (bugs-sehe) wrote :

I have the same symptoms. No user names > 8 characters. No non-alpha characters in user names. No non-alpha characters in passwords (yeah I know, home PC). No password >8 characters.

Still, cannot log on certain users (2), but can others (other 2). I get the error or warning

gdm-simple-greeter[32458]: WARNING: Unable to lookup user name data: Success

This might be introduced relatively recent (about 2-4 weeks) since these users rarely logged on. They are now locked out - I don't know why that can be.

Revision history for this message
Seth (bugs-sehe) wrote :

For the record, I solved my issue: apt-get remove timekpr (it turned out broken settings in the parental controls silently denied permission. Strangely enough I could log on if the user was indicated as autologin)

Revision history for this message
Erik Meitner (e.meitner) wrote :

I have this problem with 10.04 and users authenticating from our LDAP directory. All user names are in the "f.last" format.

From the logs:
May 5 08:48:51 lws-template gdm-simple-greeter[5032]: WARNING: Unable to lookup user name test: Success
May 5 08:48:51 lws-template gdm-simple-greeter[5032]: WARNING: Unable to lookup user name meldne: Success
May 5 08:48:51 lws-template gdm-simple-greeter[5032]: WARNING: Unable to lookup user name zzzdelet: Success
Note that the users above are ones who have previously logged in:
zes.test
r.meldner
zzzdelete

Users can log in, but the face browser functionality is broken.

The "Include=/path/to/script.pl|" functionality does not seem to work. The script is never executed,

consolekit 0.4.1-3ubuntu1
gdm 2.30.0-0ubuntu5

Revision history for this message
Veli-Matti Lintu (vmlintu) wrote :

#12: The Include functionality in #9 requires the patch from #8: add_include_script_support.patch

There's a precompiled gdm package with the patch in ppa here: https://launchpad.net/~opinsys/+archive/ppa, but the gdm version in the lucid repo has been updated after patching.

Revision history for this message
Erik Meitner (e.meitner) wrote :

Veli-Matti Lintu: Thanks.

I have created my own script so that GDM only shows currently logged in users. It works with the patch above. Attached.

Revision history for this message
Erik Meitner (e.meitner) wrote :

I am suggesting that the importance of this bug be set to at least 'medium'. Referencing https://wiki.ubuntu.com/Bugs/Importance , this is a bug that:
# One that can not be easily worked around by regular users
# One that is not limited to unusual configurations or uncommon hardware
# Affects a core application
# Is not a cosmetic/usability issue that does not limit the functionality of an application

Console Kit should allow user names greater than eight characters because libc6(and system tools) allows user names of up to 32 characters.

Revision history for this message
Juan Miguel Corral (cde-ruylopez) wrote :

+1 for raising the importance of the bug.

Revision history for this message
Andreas Roth (aroth) wrote :

+1
i run into this issue with my system using ldap as authentication backend. It's quite annoying for people who always use the same machine.

Revision history for this message
Joel Allardyce (joel-allardyce) wrote :

+1 from me as well. I originally reported this. It has been over a year, and there have been two Ubuntu releases since my initial report. It's still a daily annoyance, and it appears to be trivial to fix. It should at least be of medium importance, so that it gets some attention.

Revision history for this message
John Doe (jodo-deactivatedaccount) wrote :

This still occours on Ubuntu 10.10. Has someone still an eye on this?

Changed in gdm:
importance: Unknown → Medium
status: Unknown → New
Changed in gdm:
status: New → Unknown
affects: gdm (Ubuntu) → consolekit (Ubuntu)
Revision history for this message
Steve Atwell (satwell) wrote :

This was fixed in upstream consolekit a few months ago with a relatively simple patch:

http://cgit.freedesktop.org/ConsoleKit/commit/?id=803cbdfbd78b66b17ead45b1584d65a258e785bf

Can we get this patch integrated into an SRU for Lucid?

Changed in consolekit (Ubuntu):
assignee: nobody → Adam Stokes (adam-stokes)
Revision history for this message
Adam Stokes (adam-stokes) wrote :

This patch address the truncating of network login names

Changed in consolekit (Ubuntu):
assignee: Adam Stokes (adam-stokes) → nobody
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in consolekit (Ubuntu):
status: New → Confirmed
Changed in consolekit (Debian):
status: Unknown → New
Revision history for this message
Martin Pitt (pitti) wrote :
Changed in consolekit (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: Confirmed → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Uploaded fix to Debian, will sync in a bit.

Revision history for this message
Jose Plans (jplans) wrote :

Lucid debdiff

Revision history for this message
Martin Pitt (pitti) wrote :

lucid SRU sponsored. Needs ubuntu-sru review now. Thanks!

Changed in consolekit (Ubuntu Lucid):
status: New → Fix Committed
Changed in consolekit (Debian):
status: New → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Joel, or anyone else affected,

Accepted into lucid-proposed. The package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package consolekit - 0.4.5-2

---------------
consolekit (0.4.5-2) unstable; urgency=low

  * Add 00git_truncate_frequent.patch: ck-history: don't truncate --frequent
    output to 8 chars. (Closes: #660171, LP: #476811)
  * debian/README.Debian: Fix grammar, thanks lintian.

 -- Martin Pitt <email address hidden> Fri, 24 Feb 2012 10:18:00 +0100

Changed in consolekit (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Steve Atwell (satwell) wrote :

Verified that 0.4.1-3ubuntu3 fixes this problem on Lucid for me.

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Antonio Rodriguez (arodmon) wrote :

I can see this bug fix for consolekit in version 0.4.1-3ubuntu3
But it is only for architecture: i386 (32 bits)
Any bug fix for amd64 (64 bits) architecture?

Revision history for this message
Martin Pitt (pitti) wrote : Re: [Bug 476811] Re: Network users with longer than 8 character usernames do not show up in user list (possible fix included)

Antonio Rodriguez [2012-02-28 14:54 -0000]:
> I can see this bug fix for consolekit in version 0.4.1-3ubuntu3
> But it is only for architecture: i386 (32 bits)
> Any bug fix for amd64 (64 bits) architecture?

It got released at the same time for all architectures:

$ rmadison -s lucid-proposed consolekit
consolekit | 0.4.1-3ubuntu3 | lucid-proposed | source, amd64, armel, i386, ia64, powerpc, sparc

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package consolekit - 0.4.1-3ubuntu3

---------------
consolekit (0.4.1-3ubuntu3) lucid-proposed; urgency=low

  * Add 00git_truncate_frequent.patch: ck-history: don't truncate --frequent
    output to 8 chars. (Closes: #660171, LP: #476811)
 -- Martin Pitt <email address hidden> Fri, 24 Feb 2012 09:13:03 +0000

Changed in consolekit (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.