1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ldb: Split out ldb_val_as_dn() helper function

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-03-03 09:17:39 +13:00 committed by Andrew Bartlett
parent 619caa1ba4
commit 570a3ac866
3 changed files with 15 additions and 3 deletions

View File

@ -280,6 +280,7 @@ ldb_transaction_start: int (struct ldb_context *)
ldb_unpack_data: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *)
ldb_unpack_data_flags: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *, unsigned int)
ldb_unpack_get_format: int (const struct ldb_val *, uint32_t *)
ldb_val_as_dn: struct ldb_dn *(struct ldb_context *, TALLOC_CTX *, const struct ldb_val *)
ldb_val_dup: struct ldb_val (TALLOC_CTX *, const struct ldb_val *)
ldb_val_equal_exact: int (const struct ldb_val *, const struct ldb_val *)
ldb_val_map_local: struct ldb_val (struct ldb_module *, void *, const struct ldb_map_attribute *, const struct ldb_val *)

View File

@ -1002,10 +1002,16 @@ struct ldb_dn *ldb_msg_find_attr_as_dn(struct ldb_context *ldb,
const struct ldb_message *msg,
const char *attr_name)
{
struct ldb_dn *res_dn;
const struct ldb_val *v;
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
return ldb_val_as_dn(ldb, mem_ctx, v);
}
struct ldb_dn *ldb_val_as_dn(struct ldb_context *ldb,
TALLOC_CTX *mem_ctx,
const struct ldb_val *v)
{
struct ldb_dn *res_dn;
v = ldb_msg_find_ldb_val(msg, attr_name);
if (!v || !v->data) {
return NULL;
}

View File

@ -598,4 +598,9 @@ void ldb_handle_use_global_event_context(struct ldb_handle *handle);
*
*/
const char **ldb_options_get(struct ldb_context *ldb);
struct ldb_dn *ldb_val_as_dn(struct ldb_context *ldb,
TALLOC_CTX *mem_ctx,
const struct ldb_val *v);
#endif