summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2017-04-20 14:00:21 +1200
committerAndrew Bartlett <abartlet@samba.org>2017-07-21 09:30:25 +0200
commit4031b303e495210ee8d6a4e2dd49974d90f9c402 (patch)
treef2c06ffae83ea7cb469750eba91fb3b3cc40c809
parentff7df3d3f5259362a6bb6780d6b532e57e89681d (diff)
downloadsamba-4031b303e495210ee8d6a4e2dd49974d90f9c402.tar.gz
getncchanges: Do not segfault if somehow we get 0 results from an ldb_search with scope BASE
This should not happen, but we have seen this happen in autobuild before the whole-DB locking issues were resolved by https://bugzilla.samba.org/show_bug.cgi?id=12858 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
-rw-r--r--source4/rpc_server/drsuapi/getncchanges.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source4/rpc_server/drsuapi/getncchanges.c b/source4/rpc_server/drsuapi/getncchanges.c
index da294a6623a..a2063aaac8f 100644
--- a/source4/rpc_server/drsuapi/getncchanges.c
+++ b/source4/rpc_server/drsuapi/getncchanges.c
@@ -2578,8 +2578,13 @@ allowed:
W_ERROR_HAVE_NO_MEMORY(msg_dn);
- /* by re-searching here we avoid having a lot of full
- * records in memory between calls to getncchanges
+ /*
+ * by re-searching here we avoid having a lot of full
+ * records in memory between calls to getncchanges.
+ *
+ * We expect that we may get some objects that vanish
+ * (tombstone expunge) between the first and second
+ * check.
*/
ret = drsuapi_search_with_extended_dn(sam_ctx, obj, &msg_res,
msg_dn,
@@ -2593,6 +2598,16 @@ allowed:
continue;
}
+ if (msg_res->count == 0) {
+ DEBUG(1,("getncchanges: got LDB_SUCCESS but failed"
+ "to get any results in fetch of DN "
+ "%s (race with tombstone expunge?)\n",
+ ldb_dn_get_extended_linearized(obj,
+ msg_dn, 1)));
+ talloc_free(obj);
+ continue;
+ }
+
msg = msg_res->msgs[0];
/*