mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r7055: automatically add the dn to all ldbSearch results
(This used to be commit d6fa280808
)
This commit is contained in:
parent
2e315315e5
commit
c77ea0c100
@ -78,11 +78,12 @@ static struct MprVar mprLdbMessage(struct ldb_message *msg)
|
||||
need a special case for the single value case */
|
||||
const char *multivalued[] = { "objectClass", "memberOf", "privilege",
|
||||
"member", NULL };
|
||||
struct MprVar val;
|
||||
|
||||
var = mprCreateObjVar(msg->dn, ESP_HASH_SIZE);
|
||||
|
||||
for (i=0;i<msg->num_elements;i++) {
|
||||
struct ldb_message_element *el = &msg->elements[i];
|
||||
struct MprVar val;
|
||||
if (el->num_values == 1 &&
|
||||
!str_list_check_ci(multivalued, el->name)) {
|
||||
val = mprData(el->values[0].data, el->values[0].length);
|
||||
@ -97,6 +98,12 @@ static struct MprVar mprLdbMessage(struct ldb_message *msg)
|
||||
}
|
||||
mprCreateProperty(&var, el->name, &val);
|
||||
}
|
||||
|
||||
/* add the dn if it is not already specified */
|
||||
if (mprGetProperty(&var, "dn", 0) == 0) {
|
||||
val = mprCreateStringVar(msg->dn, 1);
|
||||
mprCreateProperty(&var, "dn", &val);
|
||||
}
|
||||
|
||||
return var;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user