Bug 5090 - Provisioning: New problems with ldb
Provisioning: New problems with ldb
Status: RESOLVED FIXED
Product: Samba 4.0
Classification: Unclassified
Component: Other
unspecified
All All
: P3 normal
: ---
Assigned To: Andrew Bartlett
Andrew Bartlett
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-18 05:49 UTC by Matthias Dieter Wallnöfer
Modified: 2008-01-06 23:23 UTC (History)
0 users

See Also:


Attachments
Corrected version of ejs_ldbSearch (1.31 KB, patch)
2007-11-18 05:55 UTC, Matthias Dieter Wallnöfer
no flags Details
Corrected version of ltdb_search (247 bytes, patch)
2007-11-18 07:12 UTC, Matthias Dieter Wallnöfer
no flags Details
A small patch (347 bytes, patch)
2007-11-18 07:52 UTC, Matthias Dieter Wallnöfer
no flags Details
Updated version of ejs_ldbSearch (1.26 KB, patch)
2007-11-18 10:19 UTC, Matthias Dieter Wallnöfer
no flags Details
Updated version of ltdb_search (1.22 KB, patch)
2007-11-18 10:23 UTC, Matthias Dieter Wallnöfer
no flags Details
Another update of ltdb_search (2.24 KB, patch)
2007-11-18 11:15 UTC, Matthias Dieter Wallnöfer
no flags Details
Another update of ejs_ldbSearch (1.31 KB, patch)
2007-11-18 11:16 UTC, Matthias Dieter Wallnöfer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Dieter Wallnöfer 2007-11-18 05:49:53 UTC
On recent SVN's, the provisioning fails again due to changes in the ldb libraries.
Comment 1 Matthias Dieter Wallnöfer 2007-11-18 05:55:48 UTC
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.
Comment 2 Matthias Dieter Wallnöfer 2007-11-18 07:12:30 UTC
Created attachment 2978 [details]
Corrected version of ltdb_search

I think, so should this function be correct.
Comment 3 Matthias Dieter Wallnöfer 2007-11-18 07:52:12 UTC
Created attachment 2979 [details]
A small patch
Comment 4 Matthias Dieter Wallnöfer 2007-11-18 10:19:51 UTC
Created attachment 2980 [details]
Updated version of ejs_ldbSearch

Now the function breaks right when ldb gives an error code!
Comment 5 Matthias Dieter Wallnöfer 2007-11-18 10:23:04 UTC
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?
Comment 6 Matthias Dieter Wallnöfer 2007-11-18 11:15:08 UTC
Created attachment 2982 [details]
Another update of ltdb_search

I forgot some changes.
Comment 7 Matthias Dieter Wallnöfer 2007-11-18 11:16:57 UTC
Created attachment 2983 [details]
Another update of ejs_ldbSearch

I forgot some changes.
Comment 8 Matthias Dieter Wallnöfer 2007-11-18 11:21:09 UTC
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!
Comment 9 Andrew Bartlett 2007-11-25 21:59:01 UTC
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?

Thanks,

Andrew Bartlett
Comment 10 Matthias Dieter Wallnöfer 2007-11-26 06:53:56 UTC
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").
Comment 11 Matthias Dieter Wallnöfer 2007-11-29 07:53:02 UTC
Ok, the provisioning is working again.

But the cleanups (mainly in ltdb_search) you don't want to apply?
Comment 12 Andrew Bartlett 2008-01-06 23:23:21 UTC
I've applied the trivial patch.  The rest I think has been fixed by other work since this time.