/* * call-seq: * conn.compare_ext(dn, attr, val, sctrls, cctrls) => true or false * * Compare the DN given as +dn+ to see whether it has the attribute +attr+ * with a value of +val+. +sctrls+ is an array of server controls, whilst * +cctrls+ is an array of client controls. */ VALUE rb_ldap_conn_compare_ext_s (VALUE self, VALUE dn, VALUE attr, VALUE val, VALUE serverctrls, VALUE clientctrls) { RB_LDAP_DATA *ldapdata; char *c_dn, *c_attr; #ifdef USE_WLDAP32 char *c_val; #endif struct berval bval; LDAPControl **sctrls, **cctrls; GET_LDAP_DATA (self, ldapdata); c_dn = StringValueCStr (dn); c_attr = StringValueCStr (attr); #ifdef USE_WLDAP32 c_val = StringValueCStr (val); #endif bval.bv_val = StringValueCStr (val); bval.bv_len = RSTRING (val)->len; sctrls = rb_ldap_get_controls (serverctrls); cctrls = rb_ldap_get_controls (clientctrls); ldapdata->err = ldap_compare_ext_s (ldapdata->ldap, c_dn, c_attr, #ifdef USE_WLDAP32 c_val, #endif &bval, sctrls, cctrls); 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_ext_s() unexpectedly set no error.\n"); return self; }