uid = '1000'
realname = 'Ross Burton,,,'
seat = 'Seat1'
session-type = ''
active = TRUE
x11-display = ':0'
x11-display-device = '/dev/tty7'
display-device = ''
remote-host-name = ''
is-local = TRUE
on-since = '2008-11-23T09:58:25.055160Z'
I'm pretty certain my passport doesn't say "Ross Burton,,,". I guess CK should see if the field contains three commas, and if it does then parse it as a GECOS field (http://en.wikipedia.org/wiki/Gecos_field), otherwise use the entire string as the name.
Created attachment 20812 [details] [review]
Search a comma to truncate the string
Here is a patch looking for a comma before truncating the string. I'm not sure if the GECOS delimiter is the same accross the unices (Linux, *BSD, AIX, etc). It remains a question: what about the real name containing a comma?
Created attachment 20813 [details] [review]
The right patch
Sorry, here is the right patch (the former does not compile).
Checking that there are three commas would handle false-positives in the case where the field contains "Bar, Foo".
I discover the GECOS handling... this is the hell ;-)
> Checking that there are three commas would handle false-positives in the case
> where the field contains "Bar, Foo".
What do you mean i should do?
1- look for the string ",,," to detect a GECOS format then truncating the string (this solution fixes the entry "Burton, Ross,,," but not "Burton, Ross,Room R123,,")
2- look for the 3 times string "," ? (by starting from the end, we could handle more cases)
Definitively, the real name should be stored elsewhere :-)
I'd search the string for at least three commas. If there are three or more, the username is up to the first comma. If less, then the username is the entire field.
If GECOS is being used then the user's real name can't contain any commas (see chfn(1)).
Created attachment 20891 [details] [review]
Looking for 3 commas
Here is a new patch following the advices of Ross (thx, btw :-); it should handle the common cases.
Sorry for the long delay. I've fixed this to use the same method that glib uses. Should be fixed in master. Please reopen if you still have problems. Thanks.