summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-06-15 22:57:14 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-06-16 09:57:52 +1000
commit25abcb68185ed21ecf030ee6b081e2c912a687f5 (patch)
tree6248faf3aa7eaa866985afc653edc15870da4d98
parent5150f8597a2211414ddbd588e8bd64e0ef3c29a7 (diff)
downloadsamba-25abcb68185ed21ecf030ee6b081e2c912a687f5.tar.gz
samba-25abcb68185ed21ecf030ee6b081e2c912a687f5.tar.bz2
samba-25abcb68185ed21ecf030ee6b081e2c912a687f5.zip
s4:dsdb Fix linked_attributes to cope with the Feb 2010 changes to DLIST
The DLIST macros changed in behaviour in Feb 2010, and walking the lists backwards is no longer safe if you don't use the macros. Andrew Bartlett
-rw-r--r--source4/dsdb/samdb/ldb_modules/linked_attributes.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
index 4f36509a85..d2a435ef50 100644
--- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c
+++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
@@ -1039,9 +1039,13 @@ static int linked_attributes_prepare_commit(struct ldb_module *module)
/* walk the list backwards, to do the first entry first, as we
* added the entries with DLIST_ADD() which puts them at the
* start of the list */
- for (ac = la_private->la_list; ac && ac->next; ac=ac->next) ;
- for (; ac; ac=ac->prev) {
+ /* Start at the end of the list - so we can start
+ * there, but ensure we don't create a loop by NULLing
+ * it out in the first element */
+ ac = DLIST_TAIL(la_private->la_list);
+
+ for (; ac; ac=DLIST_PREV(ac)) {
int ret;
ac->req = NULL;
ret = la_do_mod_request(module, ac);