summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-07-29 01:23:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:08 -0500
commit09b861f45ba2354edee85ccc966e3b3ee62e02e0 (patch)
tree20d851e1f7c6d5337bcad87333ea70c280f81c2a /source4
parent2d65c9ada5ca3f5d263707947d73106e180a9920 (diff)
downloadsamba-09b861f45ba2354edee85ccc966e3b3ee62e02e0.tar.gz
samba-09b861f45ba2354edee85ccc966e3b3ee62e02e0.tar.bz2
samba-09b861f45ba2354edee85ccc966e3b3ee62e02e0.zip
r17301: Add a new function to copy a list of attributes, while adding one to
the end. Andrew Bartlett (This used to be commit 2a87ed1111f4ed72798372d6005a88a929c39de6)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/common/ldb_msg.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 797d050975..254775cfbc 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -611,6 +611,28 @@ const char **ldb_attr_list_copy(TALLOC_CTX *mem_ctx, const char * const *attrs)
/*
+ copy an attribute list. This only copies the array, not the elements
+ (ie. the elements are left as the same pointers)
+*/
+const char **ldb_attr_list_copy_add(TALLOC_CTX *mem_ctx, const char * const *attrs, const char *new_attr)
+{
+ const char **ret;
+ int i;
+ for (i=0;attrs[i];i++) /* noop */ ;
+ ret = talloc_array(mem_ctx, const char *, i+2);
+ if (ret == NULL) {
+ return NULL;
+ }
+ for (i=0;attrs[i];i++) {
+ ret[i] = attrs[i];
+ }
+ ret[i] = new_attr;
+ ret[i+1] = NULL;
+ return ret;
+}
+
+
+/*
return 1 if an attribute is in a list of attributes, or 0 otherwise
*/
int ldb_attr_in_list(const char * const *attrs, const char *attr)