[proof of concept] libwbclient.so

Gerald (Jerry) Carter jerry at samba.org
Thu Sep 6 21:25:42 GMT 2007

Hash: SHA1

Gerald (Jerry) Carter wrote:
> Just an update...
> I've decoupled smbd from winbindd completely now.  I'll push out
> a git branch once I clean up a few things.  Probably tomorrow.
> I also played about with a libsambautil.so which has lib/replace
> and lib/talloc.  Not using is currently, but at one point I
> thought I might.  I'll include that in branch as well ven though
> it's a minor change.

New patch and doxygen files posted to

I've pushed out a git branch "libwbclient-test" (based on
the 3.2.0 code) to

(The actual commits are from coffeedude at plainjoe.org which
is just another one of my email accounts)

One thing that did come up is the handy use of talloc().
I thought about this and even built the libsambautil.so
which included talloc for use by libwbclient.  But in the
end, I felt like it was unfair to cross the API boundary
with TALLOC_CTX* and therefore require the calling
application to use talloc.  I love talloc, but at least for
right now, I think it is better to stick with malloc().

This does mean that I've got to find a better way to manage
memory in wbcLookupRids().  And we take a bit of a hit having
to copy memory in winbind_lookup_rids().  Suggestions welcome.

Now to respond to past comments:

James Peach wrote:

> The SUCCESS/FAIL values of wbcStatus are OK, but if you
> are going to make wbcStatus more detailed I'd
> suggest renaming WBC_FAIL to WBC_UNKNOWN_ERROR or
> something.

Have not done this yet but am planning to.

> How about bundling lsa_SidType into struct domain_sid?
> That way callers will always know what type of SID they
> are dealing with when they pass it around.

This brings up a question of compatibility between the
libwbclient struct domain_sid and the Samba DOM_SID.
I don't want to require these to be binary compatible
as that would break the entire reason for using a DSO.
(metze had suggested consolidating on DOM_SID).

What I've done instead is to introduce a mapping layer in
lib/winbind_util.c (included in the patch) which preserves
the existing winbind_XX() semantics (from wb_client.c) used
by smbd.  So for example, in winbind_lookup_name() I
convert the DOM_SID to a struct domain_sid before calling
wbcLookupName().  Currently this is just a memcpy() since
the structures are identical but as long as this mapping
layer is in place, then we could extend struct domain_sid
to include the wbcSidType without breaking smbd.


> looks pretty good, a few comments:
>     - hardcode MAXSUBAUTHS to avoid binary compatibility
>       issues if you hit a preprocessor conflict
>     - use the wbc prefix for the new structures and types
>     - wbcErrorString() should return const char *

Still have not completely done these.

cheers, jerry

Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the samba-technical mailing list