From: Mark Valence Date: Sun, 4 Jun 2000 23:02:19 +0000 (+0000) Subject: Update to work with schemas (SLAPD_SCHEMA_NOT_COMPAT=1) X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2765 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bd7c946cccf18991bfa7c00b125fc42752a15bf7;p=openldap Update to work with schemas (SLAPD_SCHEMA_NOT_COMPAT=1) --- diff --git a/servers/slapd/back-ldap/add.c b/servers/slapd/back-ldap/add.c index 2ff2b7568c..2d579215ce 100644 --- a/servers/slapd/back-ldap/add.c +++ b/servers/slapd/back-ldap/add.c @@ -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; } diff --git a/servers/slapd/back-ldap/compare.c b/servers/slapd/back-ldap/compare.c index f19cc440a1..d33cf99852 100644 --- a/servers/slapd/back-ldap/compare.c +++ b/servers/slapd/back-ldap/compare.c @@ -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 ) ); } diff --git a/servers/slapd/back-ldap/external.h b/servers/slapd/back-ldap/external.h index d5fc09a076..f8cbe3baa6 100644 --- a/servers/slapd/back-ldap/external.h +++ b/servers/slapd/back-ldap/external.h @@ -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 */ diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index c77420da60..6ffc05d019 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -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);