... btw, shouldn't this function free the "result" string when it's done
with it? AFAICS that string is not returned to the caller, it's just
being leaked.
(I'll refrain from asking why it's creating the string in the first
place rather than parsing ldap_get_values_len's output as-is ...)
regards, tom lane