GNOME Bugzilla – Bug 232451
LDAP backend should use displayName for full_name
Last modified: 2021-05-19 12:14:34 UTC
RFC2798 (inetOrgPerson) says: When displaying an entry, especially within a one-line summary list, it is useful to be able to identify a name to be used. Since other attribute types such as 'cn' are multivalued, an additional attribute type is needed. Display name is defined for this purpose. We should be using displayName rather than cn for the full_name attribute. This will also fix the problems some sites have with using pas-backend-ldap to talk to Active Directory. Apparently Netscape and Pine both use displayName rather than cn.
Please, make it configurable. And please don't do any assumption on content as currently with with 'cn'. This makes entries with layout other than "surname lastname" to be useless. Eg. "surname lastname description" renders in evolution as: description, surname.
This is definitely the right thing to do but we are too short of time for 2.0
In 2.6.0 still not fixed. Any hope to have it in 2.6.x ?
removing old target milestone.
Ubuntu bug about that: https://launchpad.net/evolution/+bug/81349
Where/how do you want to configure such thing? For example, my test server has pretty "cn" and no "displayName". And as I saw the code, the "displayName" is mapped to Nick name in the contact.
As you see from above coments: 1. I have also pretty "cn" also :) The problem is that Evolution is not displaying them as they are. It takes 1st and 3rd word of "cn" attribute and displays it as 3,1. If it didn't modify the "cn" attribute value it would be fine for me. 2. Other people pointed out that "cn" is a multivalued attribute. And "displayName" is not. I suppose you could have a setting "LDAP attribute to use as contact name" configured per LDAP addressbook. And if this setting is not null, then it is used.
I'm afraid that the problem isn't with cn, but with E_CONTACT_FULL_NAME property, it just tries its best to parse it in proper way (here really badly).
I just noticed that you can pick the way how evolution shows your contact when editing it, the dropdown arrow next to File Under field. Does that do what you want from evo? Maybe an option for reasonable default can be better that playing with LDAP backend?
Pseduocode in diff format for e-book-backend-ldap. Basically adds a method that fronts the decision whether to get the fullname as displayname, and if that isn't there, gets cn. This may or may not even compile... sorry that's the best I can do. 335d334 < STRING_PROP (E_CONTACT_FULL_DISPLAY_NAME, "displayName" ), 1201a1201 > char *cn, *cn_part = NULL; 1203c1203,1236 < dn = contact_get_fullname(contact, root_dn); --- > > cn = e_contact_get (contact, E_CONTACT_FULL_NAME); > if (cn) { > if (strchr (cn, ',')) { > /* need to escape commas */ > char *new_cn = g_malloc0 (strlen (cn) * 3 + 1); > int i, j; > > for (i = 0, j = 0; i < strlen (cn); i ++) { > if (cn[i] == ',') { > sprintf (new_cn + j, "%%%02X", cn[i]); > j += 3; > } > else { > new_cn[j++] = cn[i]; > } > } > cn_part = g_strdup_printf ("cn=%s", new_cn); > g_free (new_cn); > } > else { > cn_part = g_strdup_printf ("cn=%s", cn); > } > } > else { > cn_part = g_strdup (""); > } > > dn = g_strdup_printf ("%s%s%s", cn_part, > (root_dn && strlen(root_dn)) ? "," : "", > (root_dn && strlen(root_dn)) ? root_dn: ""); > > g_free (cn_part); > 1204a1238 > 2683,2727d2716 < static char * < contact_get_fullname(EContact *contact, const char *root_dn) < { < char *name, *cn, *cn_part; < name = e_contact_get (contact_new, E_CONTACT_FULL_NAME_DISPLAY); < < if(!name){ < cn = e_contact_get (contact_new, E_CONTACT_FULL_NAME); < if (cn) { < if (strchr (cn, ',')) { < /* need to escape commas */ < char *new_cn = g_malloc0 (strlen (cn) * 3 + 1); < int i, j; < < for (i = 0, j = 0; i < strlen (cn); i ++) { < if (cn[i] == ',') { < sprintf (new_cn + j, "%%%02X", cn[i]); < j += 3; < } < else { < new_cn[j++] = cn[i]; < } < } < cn_part = g_strdup_printf ("cn=%s", new_cn); < g_free (new_cn); < } < else { < cn_part = g_strdup_printf ("cn=%s", cn); < } < } < else { < cn_part = g_strdup (""); < } < < name = g_strdup_printf ("%s%s%s", cn_part, < (root_dn && strlen(root_dn)) ? "," : "", < (root_dn && strlen(root_dn)) ? root_dn: ""); < < g_free (cn_part); < g_free (cn); < < } < return name; < } < 2741,2742c2730,2731 < list_name1 = contact_get_fullname(contact_new); < list_name2 = contact_get_fullname(contact_current); --- > list_name1 = e_contact_get (contact_new, E_CONTACT_FULL_NAME); > list_name2 = e_contact_get (contact_current, E_CONTACT_FULL_NAME);
Created attachment 139511 [details] [review] Rough code for a suggested fix sorry i didnt see the attach mode until after i pasted the patch as a comment...
Comment on attachment 139511 [details] [review] Rough code for a suggested fix "git diff" patch is welcome (current file makes it impossible to know which file is patch, plus missing unified format)
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines and create a new bug report ticket at https://gitlab.gnome.org/GNOME/evolution/-/issues/ Thank you for your understanding and your help.