The Samba-Bugzilla – Bug 5090
Provisioning: New problems with ldb
Last modified: 2008-01-06 23:23:21 UTC
On recent SVN's, the provisioning fails again due to changes in the ldb libraries.
Created attachment 2977 [details]
Corrected version of ejs_ldbSearch
To start correcting this, I began to fix up the function "ejs_ldbSearch" which wasn't handling error cases correctly.
Created attachment 2978 [details]
Corrected version of ltdb_search
I think, so should this function be correct.
Created attachment 2979 [details]
A small patch
Created attachment 2980 [details]
Updated version of ejs_ldbSearch
Now the function breaks right when ldb gives an error code!
Created attachment 2981 [details]
Updated version of ltdb_search
Now also ltdb_search is able to give error codes back in (my opinion) the right way.
When correcting this, I discovered that the handling of the "handles" parameter/variable is quite a bit a mess. It's often set twice or three times to the same value. Andrew, could you have a look on this?
Created attachment 2982 [details]
Another update of ltdb_search
I forgot some changes.
Created attachment 2983 [details]
Another update of ejs_ldbSearch
I forgot some changes.
It's now necessary to fix up the provision script "provision.js" (for example in "ldb_erase_partitions"). I don't understand there the search operations, and so maybe you are able to fix that!
I'm quite at a loss to see what you are trying to do here, aside from fixing some of the switch statement around base DN checks.
The handle should return any error that occurs due to searching, but it is quite valid to return errors due to out of memory earlier, just in the same way.
Also, it is not valid to do:
+ ret = ldb_request(ldb, req);
+ ret |= ldb_wait(req->handle, LDB_WAIT_ALL);
If ldb_request fails, we must not run ldb_wait, and we want the error code preserved, not mixed with a bitwise or.
Getting back to the original problem, what exactly is the failure, and can you give me some more details to reproduce it?
1.) I tried to generally clean up the code for the ldb search. Because it seems that it doesn't handle all failures correct. Also the mentioned "switch" statement seems to be wrong (ltdb_search).
2.) Then I tried to fix up the ejs binding so that it fails (more) correctly when the ldb search didn't give a correct answer (ejs_ldbSearch).
3.) The small patch does change the result from "0" to the more correct "LDB_SUCCESS".
I propose this changes and cleanups so you can comment and point out the positions you aren't willing to apply. So I can change that.
The main point, because I've done that was, that the provisioning does/did a ldb search operation that wasn't concluded successfully and a "assert" failed (provision.js - function "ldb_erase_partitions").
Ok, the provisioning is working again.
But the cleanups (mainly in ltdb_search) you don't want to apply?
I've applied the trivial patch. The rest I think has been fixed by other work since this time.