summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-21 20:25:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:34 -0500
commitf45b0ff698414f4fcdb49f1324ebfc5576f785ae (patch)
tree7e42b06bd67a8eeb44daca78ffed5b8d6d2fbc13 /source4/lib
parentcfea76ac9bd29ce6eae908be4d45b38defebe5a1 (diff)
downloadsamba-f45b0ff698414f4fcdb49f1324ebfc5576f785ae.tar.gz
samba-f45b0ff698414f4fcdb49f1324ebfc5576f785ae.tar.bz2
samba-f45b0ff698414f4fcdb49f1324ebfc5576f785ae.zip
r12408: as we always add the destinguishedName as autogenerated value,
don't store it on disk, as this would cause confusing results metze (This used to be commit c3d3309ba1567a4363c7c0235842833b5e2b6771)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_pack.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c
index bf57aa904c..b037fe272a 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c
@@ -59,6 +59,17 @@ static unsigned int pull_uint32(uint8_t *p, int ofs)
return p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24);
}
+static int attribute_storable_values(const struct ldb_message_element *el)
+{
+ if (el->num_values == 0) return 0;
+
+ if (ldb_attr_cmp(el->name, "dn") == 0) return 0;
+
+ if (ldb_attr_cmp(el->name, "distinguishedName") == 0) return 0;
+
+ return el->num_values;
+}
+
/*
pack a ldb message into a linear buffer in a TDB_DATA
@@ -84,21 +95,18 @@ int ltdb_pack_data(struct ldb_module *module,
return -1;
}
- for (i=0;i<message->num_elements;i++) {
- if (message->elements[i].num_values != 0) {
- real_elements++;
- }
- }
-
/* work out how big it needs to be */
size = 8;
size += 1 + strlen(dn);
for (i=0;i<message->num_elements;i++) {
- if (message->elements[i].num_values == 0) {
+ if (attribute_storable_values(&message->elements[i]) == 0) {
continue;
}
+
+ real_elements++;
+
size += 1 + strlen(message->elements[i].name) + 4;
for (j=0;j<message->elements[i].num_values;j++) {
size += 4 + message->elements[i].values[j].length + 1;
@@ -126,7 +134,7 @@ int ltdb_pack_data(struct ldb_module *module,
p += len + 1;
for (i=0;i<message->num_elements;i++) {
- if (message->elements[i].num_values == 0) {
+ if (attribute_storable_values(&message->elements[i]) == 0) {
continue;
}
len = strlen(message->elements[i].name);