Update to work with schemas (SLAPD_SCHEMA_NOT_COMPAT=1)

This commit is contained in:
Mark Valence 2000-06-04 23:02:19 +00:00
parent ea069cb7c2
commit bd7c946ccc
4 changed files with 49 additions and 1 deletions

View File

@ -67,7 +67,11 @@ ldap_back_add(
for (i=0, a=e->e_attrs; a; i++, a=a->a_next) {
attrs[i] = (LDAPMod *)ch_malloc(sizeof(LDAPMod));
attrs[i]->mod_op = LDAP_MOD_BVALUES;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
attrs[i]->mod_type = a->a_desc->ad_cname->bv_val;
#else
attrs[i]->mod_type = a->a_type;
#endif
attrs[i]->mod_vals.modv_bvals = a->a_vals;
}

View File

@ -39,7 +39,11 @@ ldap_back_compare(
Operation *op,
const char *dn,
const char *ndn,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeAssertion *ava
#else
Ava *ava
#endif
)
{
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
@ -55,6 +59,10 @@ ldap_back_compare(
return( -1 );
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
ldap_compare_s( lc->ld, dn, ava->aa_desc->ad_cname->bv_val, ava->aa_value->bv_val );
#else
ldap_compare_s( lc->ld, dn, ava->ava_type, ava->ava_value.bv_val );
#endif
return( ldap_back_op_result( lc, op ) );
}

View File

@ -30,9 +30,17 @@ extern int ldap_back_search LDAP_P(( BackendDB *bd,
Filter *filter, const char *filterstr,
char **attrs, int attrsonly ));
#ifdef SLAPD_SCHEMA_NOT_COMPAT
extern int ldap_back_compare LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
AttributeAssertion *ava ));
#else
extern int ldap_back_compare LDAP_P((BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, Ava *ava ));
const char *dn, const char *ndn,
Ava *ava ));
#endif
extern int ldap_back_modify LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
@ -54,6 +62,21 @@ extern int ldap_back_delete LDAP_P(( BackendDB *bd,
extern int ldap_back_abandon LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, int msgid ));
#ifdef SLAPD_SCHEMA_NOT_COMPAT
extern int ldap_back_group LDAP_P(( BackendDB *bd,
Entry *target,
const char* gr_ndn,
const char* op_ndn,
ObjectClass* group_oc,
AttributeDescription* group_at));
#else
extern int ldap_back_group LDAP_P(( BackendDB *bd,
Entry *target,
const char* gr_ndn, const char* op_ndn,
const char* group_oc,
const char* group_at));
#endif
LDAP_END_DECL
#endif /* _LDAP_EXTERNAL_H */

View File

@ -145,6 +145,9 @@ ldap_send_entry(
BerElement *ber = NULL;
Attribute *attr, **attrp;
struct berval *dummy = NULL;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
char *text;
#endif
ent.e_dn = ldap_get_dn(lc->ld, e);
ent.e_ndn = ch_strdup( ent.e_dn);
@ -158,8 +161,16 @@ ldap_send_entry(
a = ldap_next_attribute(lc->ld, e, ber)) {
attr = (Attribute *)ch_malloc( sizeof(Attribute) );
attr->a_next = 0;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
/* FIXME: we assume here that the local server knows about
* all the attributes that the remote server might send.
* How should this really be handled?
*/
slap_str2ad(a, &attr->a_desc, &text);
#else
attr->a_type = ch_strdup(a);
attr->a_syntax = attr_syntax(a);
#endif
attr->a_vals = ldap_get_values_len(lc->ld, e, a);
if (!attr->a_vals)
attr->a_vals = &dummy;
@ -170,7 +181,9 @@ ldap_send_entry(
for (;ent.e_attrs;) {
attr=ent.e_attrs;
ent.e_attrs = attr->a_next;
#ifndef SLAPD_SCHEMA_NOT_COMPAT
free(attr->a_type);
#endif
if (attr->a_vals != &dummy)
ber_bvecfree(attr->a_vals);
free(attr);