* call-seq:
 * conn.compare(dn, attr, val)  => true or false
 * Compare the DN given as +dn+ to see whether it has the attribute +attr+
 * with a value of +val+.
rb_ldap_conn_compare_s (VALUE self, VALUE dn, VALUE attr, VALUE val)
  RB_LDAP_DATA *ldapdata;
  char *c_dn, *c_attr, *c_val;

  GET_LDAP_DATA (self, ldapdata);
  c_dn = StringValueCStr (dn);
  c_attr = StringValueCStr (attr);
  c_val = StringValueCStr (val);

  ldapdata->err = ldap_compare_s (ldapdata->ldap, c_dn, c_attr, c_val);

  if ((ldapdata->err) == LDAP_COMPARE_TRUE)
    return Qtrue;
  else if ((ldapdata->err) == LDAP_COMPARE_FALSE)
    return Qfalse;

  Check_LDAP_Result (ldapdata->err);

  fprintf (stderr, "rb_ldap_conn_compare_s() unexpectedly set no error.\n");

  return self;