s4-dsdb: prevent crash on bad DN in construct_parent_guid()
authorAndrew Tridgell <tridge@samba.org>
Wed, 7 Sep 2011 06:25:48 +0000 (16:25 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 8 Sep 2011 01:35:27 +0000 (03:35 +0200)
this was found by a flakey test in autobuild

source4/dsdb/samdb/ldb_modules/operational.c

index dcc047f13e3a55aef4f808e4fa12964392fcf07a..1a13895a93d4b1819079db73ae5ab24083bd7e87 100644 (file)
@@ -283,6 +283,9 @@ static int construct_parent_guid(struct ldb_module *module,
        ret = dsdb_module_search_dn(module, msg, &res, msg->dn, attrs,
                                    DSDB_FLAG_NEXT_MODULE |
                                    DSDB_SEARCH_SHOW_RECYCLED, parent);
+       if (ret != LDB_SUCCESS) {
+               return ret;
+       }
 
        instanceType = ldb_msg_find_attr_as_uint(res->msgs[0],
                                                 "instanceType", 0);