diff options
author | George Lebl <jirka@5z.com> | 2004-05-28 19:01:13 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2004-05-28 19:01:13 +0000 |
commit | 7ffd705c444ea4694927ba863792b3510f5f17e7 (patch) | |
tree | 39bbd8ad027c1923f4be185574baa4524140d223 /gui/greeter | |
parent | eb9d2552a8ac7e8ce79fca3c32c4b5f1234fa60d (diff) | |
download | gdm-7ffd705c444ea4694927ba863792b3510f5f17e7.tar.gz |
Cut after the comma in the gecos field if there is more then one comma as
Fri May 28 12:01:02 2004 George Lebl <jirka@5z.com>
* gui/gdmlogin.c, gui/greeter/greeter_item_ulist.c: Cut after
the comma in the gecos field if there is more then one comma
as then it's probably ugly arguments and not the name. Fixes
#142274
Diffstat (limited to 'gui/greeter')
-rw-r--r-- | gui/greeter/greeter_item_ulist.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gui/greeter/greeter_item_ulist.c b/gui/greeter/greeter_item_ulist.c index 7c261bee..944b9959 100644 --- a/gui/greeter/greeter_item_ulist.c +++ b/gui/greeter/greeter_item_ulist.c @@ -57,6 +57,7 @@ gdm_greeter_user_alloc (const gchar *logname, uid_t uid, const gchar *homedir, gchar buf[PIPE_SIZE]; size_t size; int bufsize; + char *p; user = g_new0 (GdmGreeterUser, 1); @@ -66,6 +67,18 @@ gdm_greeter_user_alloc (const gchar *logname, uid_t uid, const gchar *homedir, user->gecos = ve_locale_to_utf8 (gecos); else user->gecos = g_strdup (gecos); + + /* Cut up to first comma since those are ugly arguments and + * not the name anymore, but only if more then 1 comma is found, + * since otherwise it might be part of the actual comment, + * this is sort of "heurestic" because there seems to be no + * real standard, it's all optional */ + p = strchr (user->gecos, ','); + if (p != NULL) { + if (strchr (p+1, ',') != NULL) + *p = '\0'; + } + user->homedir = g_strdup (homedir); if (defface != NULL) user->picture = (GdkPixbuf *)g_object_ref (G_OBJECT (defface)); @@ -295,7 +308,7 @@ gdm_greeter_users_init (void) user = gdm_greeter_user_alloc (pwent->pw_name, pwent->pw_uid, pwent->pw_dir, - pwent->pw_gecos); + ve_sure_string (pwent->pw_gecos)); if ((user) && (! g_list_find_custom (users, user, (GCompareFunc) gdm_greeter_sort_func))) { |