The "display name" logic in storage_ldapvcard seems broken, no?

if ("surname" defined)
        jabber display name = surname ("sn")
        if ("initials" defined)
                append initials
else if ("displayName" exists)
        jabber display name = displayName
else
        jabber display name = JID ("just...@xmpp.norchemlab.com")


It seems wrong that, with an ldap displayName set, I appeared as "Pryzby T" and
not as "Justin Pryzby".

I patched it to do the right thing in our environment, it would seem to me it's
right in most (?).

|       vals = (char **)ldap_get_values(data->ld, entry, "displayName");
|       if (ldap_count_values(vals)>0) {
|           strncpy(name, vals[0], 1023);
|           name[1023]='\0';
|       } else {
|           ldap_value_free(vals);
|           vals = (char **)ldap_get_values(data->ld, entry, "sn");
|           if (ldap_count_values(vals)>0) {
|               strncpy(name, vals[0], sizeof(name)-1);
|               name[sizeof(name)-1]='\0';
|               ldap_value_free(vals);
|
|               vals = (char **)ldap_get_values(data->ld, entry, "initials");
|               if (ldap_count_values(vals)>0) {
|                       strncat(name, " ", 1023);
|                       strncat(name, vals[0], 1023);
|               }
|           } else {
|               strncpy(name, jid, sizeof(name)-1);
|               name[sizeof(name)-1]='\0';
|           }
|       }
|       ldap_value_free(vals);

I haven't tested the alternate paths, but if it's deemed useful, I'll do so and
provide a real patch.

Justin

-- 
To unsubscribe send a mail to jabberd2+unsubscr...@lists.xiaoka.com

Reply via email to