ldb error codes

Simo Sorce idra at samba.org
Tue Nov 1 00:01:39 GMT 2005


On Tue, 2005-11-01 at 10:32 +1100, tridge at samba.org wrote:
> Simo,
> 
>  > There's a 4th option I like to explore, change the return value of
>  > ldb_search into a structure, and have both error code and count hanging
>  > on this structure.
> 
> That gives me another idea (a 5th option?)
> 
> We could change ldb_search like this:
> 
> int ldb_search(struct ldb_context *ldb, 
> 	       const struct ldb_dn *base,
> 	       enum ldb_scope scope,
> 	       const char *expression,
> 	       const char * const *attrs, struct ldb_result **res);
> 
> where ldb_result is this:
> 
> struct ldb_result {
> 	uint_t count;
> 	struct ldb_message **msgs;
> }
> 
> and ldb_search would return an error code, just like all other ldb
> calls.
> 
> The advantage of this approach is it will make it easier for us to add
> referral results later, as we can expand the struct ldb_result
> structure with new elements at the end (thats why I made it a pointer
> to a pointer - it means new elements remain binary compatible).
> 
> It means we have to change all calls to ldb_search(), but thats
> actually easier than some of the other proposals as the compiler would
> point out the places that need doing, and the change itself will be to
> look for res->count and res->msgs instead of ret and (*res), which is
> a quite simple change to make.

I like this, I will put this change in the batch of interface changes
I'm doing for ldb_request(), ok?

Simo.

-- 
Simo Sorce    -  idra at samba.org
Samba Team    -  http://www.samba.org
Italian Site  -  http://samba.xsec.it



More information about the samba-technical mailing list