Author: idra Date: 2006-08-12 15:20:06 +0000 (Sat, 12 Aug 2006) New Revision: 17503
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17503 Log: Add a useful function to search for a DN Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c branches/SAMBA_4_0/source/lib/ldb/include/ldb.h Changeset: Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c 2006-08-12 10:42:17 UTC (rev 17502) +++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c 2006-08-12 15:20:06 UTC (rev 17503) @@ -377,6 +377,19 @@ return (const char *)v->data; } +struct ldb_dn *ldb_msg_find_dn(void *mem_ctx, + const struct ldb_message *msg, + const char *attr_name) +{ + const struct ldb_val *v; + + v = ldb_msg_find_ldb_val(msg, attr_name); + if (!v || !v->data) { + return NULL; + } + return ldb_dn_explode(mem_ctx, (const char *)v->data); +} + /* sort the elements of a message by name */ Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2006-08-12 10:42:17 UTC (rev 17502) +++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2006-08-12 15:20:06 UTC (rev 17503) @@ -1269,6 +1269,10 @@ const char *attr_name, const char *default_value); +struct ldb_dn *ldb_msg_find_dn(void *mem_ctx, + const struct ldb_message *msg, + const char *attr_name); + void ldb_msg_sort_elements(struct ldb_message *msg); struct ldb_message *ldb_msg_copy_shallow(void *mem_ctx,