/*
 * call-seq:
 * entry.get_attributes  => Array of String
 * entry.attrs           => Array of String
 *
 * Return an array of all the attributes belonging to the entry.
 */
VALUE
rb_ldap_entry_get_attributes (VALUE self)
{
  RB_LDAPENTRY_DATA *edata;
  VALUE vals;
  char *attr;
  BerElement *ber;

  GET_LDAPENTRY_DATA (self, edata);

  vals = rb_ary_new ();
  for (attr = ldap_first_attribute (edata->ldap, edata->msg, &ber);
       attr != NULL;
       attr = ldap_next_attribute (edata->ldap, edata->msg, ber))
    {
      rb_ary_push (vals, rb_tainted_str_new2 (attr));
    }

  /* this code may cause segv
     #if !defined(USE_OPENLDAP1)
     if( ber != NULL ){
     ber_free(ber, 0);
     }
     #endif
   */

  return vals;
}