summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-12-10 23:44:44 +1100
committerAndrew Tridgell <tridge@samba.org>2009-12-14 22:29:57 +1100
commit0d76df995332b468b26dbb5807ad0317e55ad288 (patch)
tree02138e54d300ae283a2d51d70ac25c5f745c9538 /source4
parent725e25a20604c7032a14bcc8e3c33625e802757a (diff)
downloadsamba-0d76df995332b468b26dbb5807ad0317e55ad288.tar.gz
samba-0d76df995332b468b26dbb5807ad0317e55ad288.tar.bz2
samba-0d76df995332b468b26dbb5807ad0317e55ad288.zip
s4-ldb: added a function to filter extended components of a ldb_dn
We need to be able to filter out components that should not be exposed to users
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/common/ldb_dn.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index bd42bd5f18..f11ccf35d7 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -873,6 +873,22 @@ char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode)
return p;
}
+/*
+ filter out all but an acceptable list of extended DN components
+ */
+void ldb_dn_extended_filter(struct ldb_dn *dn, const char * const *accept)
+{
+ int i;
+ for (i=0; i<dn->ext_comp_num; i++) {
+ if (!ldb_attr_in_list(accept, dn->ext_components[i].name)) {
+ memmove(&dn->ext_components[i],
+ &dn->ext_components[i+1],
+ (dn->ext_comp_num-(i+1))*sizeof(dn->ext_components[0]));
+ dn->ext_comp_num--;
+ i--;
+ }
+ }
+}
char *ldb_dn_alloc_linearized(void *mem_ctx, struct ldb_dn *dn)