s4:dsdb Don't segfault with ldb_transaction_prepare_commit() without begin()
authorAndrew Bartlett <abartlet@samba.org>
Thu, 26 Nov 2009 21:05:59 +0000 (08:05 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 27 Nov 2009 05:05:05 +0000 (16:05 +1100)
It is up to other modules to complain if
ldb_transaction_prepare_commit() is called before
ldb_transaction_begin_transaction()

Andrew Bartlett

source4/dsdb/samdb/ldb_modules/linked_attributes.c

index 32f9cba8fe80a02597b17b246926099bf23cf212..bd9af5545e3c8533034cae97d5d5205d82bd417e 100644 (file)
@@ -1212,6 +1212,10 @@ static int linked_attributes_prepare_commit(struct ldb_module *module)
                talloc_get_type(ldb_module_get_private(module), struct la_private);
        struct la_context *ac;
 
                talloc_get_type(ldb_module_get_private(module), struct la_private);
        struct la_context *ac;
 
+       if (!la_private) {
+               /* prepare commit without begin_transaction - let someone else return the error, just don't segfault */
+               return ldb_next_prepare_commit(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 */
        /* 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 */