From cd32051ff4b79dc26438e652ccb432f34ba2db82 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 22 Jan 2013 12:31:29 +0000 Subject: [PATCH] ITS#7496, more for ITS#7483 Missing entries need to be checked at runtime too, not just slapcat. Apparently some people will still try to run slapd even after slapadd tells them their DB load was invalid. --- servers/slapd/back-mdb/id2entry.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/servers/slapd/back-mdb/id2entry.c b/servers/slapd/back-mdb/id2entry.c index b6898d3707..0caaf4f028 100644 --- a/servers/slapd/back-mdb/id2entry.c +++ b/servers/slapd/back-mdb/id2entry.c @@ -121,12 +121,17 @@ int mdb_id2edata( MDB_val *data ) { MDB_val key; + int rc; key.mv_data = &id; key.mv_size = sizeof(ID); /* fetch it */ - return mdb_cursor_get( mc, &key, data, MDB_SET ); + rc = mdb_cursor_get( mc, &key, data, MDB_SET ); + /* stubs from missing parents - DB is actually invalid */ + if ( rc == MDB_SUCCESS && !data.mv_size ) + rc = MDB_NOTFOUND; + return rc; } int mdb_id2entry( @@ -178,6 +183,9 @@ int mdb_id2entry( return MDB_SUCCESS; } } + /* stubs from missing parents - DB is actually invalid */ + if ( rc == MDB_SUCCESS && !data.mv_size ) + rc = MDB_NOTFOUND; if ( rc ) return rc; rc = mdb_entry_decode( op, &data, e ); -- 2.39.5