/*
 * call-seq:
 * LDAP.dn2ufn(dn)  => String or nil
 *
 * Translate the DN, +dn+, to a more User-Friendly Name (UFN).
 *
 * For example:
 *
 * <code>LDAP.dn2ufn('uid=ianmacd,ou=People,dc=google,dc=com')</code>
 *
 * produces:
 *
 * ianmacd, People, google.com
 *
 * The UFN format is described in
 * RFC1781[http://www.faqs.org/rfcs/rfc1781.html].
 */
VALUE
rb_ldap_dn2ufn (VALUE self, VALUE dn)
{
  char *c_dn;
  char *c_ufn;

  if (dn == Qnil)
    {
      return Qnil;
    }

  c_dn = StringValueCStr (dn);
  if ((c_ufn = ldap_dn2ufn (c_dn)))
    {
      return rb_tainted_str_new2 (c_ufn);
    }
  else
    {
      return Qnil;
    }
}