mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Shortcut name mapping
If the naming attribute is in the RDN we don't need to look it up.
This commit is contained in:
parent
7380354270
commit
571a7c72fc
@ -326,6 +326,30 @@ adremap_search_resp(
|
|||||||
a = attr_find(e->e_attrs, ad->ad_dnattr);
|
a = attr_find(e->e_attrs, ad->ad_dnattr);
|
||||||
}
|
}
|
||||||
for (i=0; i<a->a_numvals; i++) {
|
for (i=0; i<a->a_numvals; i++) {
|
||||||
|
struct berval dv;
|
||||||
|
dv = ad->ad_deref->ad_cname;
|
||||||
|
/* If the RDN uses the deref attr, just use it directly */
|
||||||
|
if (a->a_nvals[i].bv_val[dv.bv_len] == '=' &&
|
||||||
|
!memcmp(a->a_nvals[i].bv_val, dv.bv_val, dv.bv_len)) {
|
||||||
|
struct berval bv, nv;
|
||||||
|
char *ptr;
|
||||||
|
bv = a->a_vals[i];
|
||||||
|
nv = a->a_nvals[i];
|
||||||
|
bv.bv_val += dv.bv_len + 1;
|
||||||
|
ptr = strchr(bv.bv_val, ',');
|
||||||
|
if (ptr)
|
||||||
|
bv.bv_len = ptr - bv.bv_val;
|
||||||
|
else
|
||||||
|
bv.bv_len -= dv.bv_len+1;
|
||||||
|
nv.bv_val += dv.bv_len + 1;
|
||||||
|
ptr = strchr(nv.bv_val, ',');
|
||||||
|
if (ptr)
|
||||||
|
nv.bv_len = ptr - nv.bv_val;
|
||||||
|
else
|
||||||
|
nv.bv_len -= dv.bv_len+1;
|
||||||
|
attr_merge_one(e, ad->ad_newattr, &bv, &nv);
|
||||||
|
} else {
|
||||||
|
/* otherwise look up the deref attr */
|
||||||
n = NULL;
|
n = NULL;
|
||||||
rc = be_entry_get_rw(op, &a->a_nvals[i], NULL, ad->ad_deref, 0, &n);
|
rc = be_entry_get_rw(op, &a->a_nvals[i], NULL, ad->ad_deref, 0, &n);
|
||||||
if (!rc && n) {
|
if (!rc && n) {
|
||||||
@ -337,6 +361,7 @@ adremap_search_resp(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return SLAP_CB_CONTINUE;
|
return SLAP_CB_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +391,7 @@ static adremap_dnv *adremap_filter(
|
|||||||
|
|
||||||
/* Do we need to munge the filter? First see if it's of
|
/* Do we need to munge the filter? First see if it's of
|
||||||
* the form (&(objectClass=<mapgrp>)...)
|
* the form (&(objectClass=<mapgrp>)...)
|
||||||
* or of (&(&(objectClass=<mapgrp>)...)...)
|
* or form (&(&(objectClass=<mapgrp>)...)...)
|
||||||
*/
|
*/
|
||||||
if (f->f_choice == LDAP_FILTER_AND && f->f_and) {
|
if (f->f_choice == LDAP_FILTER_AND && f->f_and) {
|
||||||
struct berval bv;
|
struct berval bv;
|
||||||
|
Loading…
Reference in New Issue
Block a user