mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
ldb_tdb: Optionally use a GUID index key in ltdb_dn_list_find_msg()
This function is used to find an existing index value and this change allows it to find the value by GUID rather than by DN once the GUID index is enabled. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
parent
9d9ae1c005
commit
b154acb0c7
@ -108,9 +108,19 @@ static int ltdb_dn_list_find_msg(struct ltdb_private *ltdb,
|
||||
const struct ldb_message *msg)
|
||||
{
|
||||
struct ldb_val v;
|
||||
const char *dn_str = ldb_dn_get_linearized(msg->dn);
|
||||
v.data = discard_const_p(unsigned char, dn_str);
|
||||
v.length = strlen(dn_str);
|
||||
const struct ldb_val *key_val;
|
||||
if (ltdb->cache->GUID_index_attribute == NULL) {
|
||||
const char *dn_str = ldb_dn_get_linearized(msg->dn);
|
||||
v.data = discard_const_p(unsigned char, dn_str);
|
||||
v.length = strlen(dn_str);
|
||||
} else {
|
||||
key_val = ldb_msg_find_ldb_val(msg,
|
||||
ltdb->cache->GUID_index_attribute);
|
||||
if (key_val == NULL) {
|
||||
return -1;
|
||||
}
|
||||
v = *key_val;
|
||||
}
|
||||
return ltdb_dn_list_find_val(ltdb, list, &v);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user