smb2www - libsmbclient.so

Andrew Bartlett abartlet at pcug.org.au
Thu Jan 3 18:50:04 GMT 2002


Richard Sharpe wrote:
> 
> Hmmm,
> 
> I guess I should look at this :-)
> 

I just started looking at this, and it looks to me like a fundamental
design problem :-(

The problem (IMHO) is that you are using global variables in your lib,
preventing people from creating multiple contexts - in this case the
ability to shut that context down.

As this is a part of Samba I actually want to use (the new smb2www
sounds *really* neat) I put some thought into how I would fix it:

smbc_init() returns a SMBC_CTX.

All functions are pointers off that context, and take that context as
their first arg.

For backward compatibility, existing functions are replaced with new
functions that use a static SMBC_CTX, initilised at startup in the same
way the current stuff is.

We then have the ability to sensibly do a smbc_destroy() without
significant pain, and programs that accidentily use the lib twice don't
get nasty shocks (becouse it should be up to the app to determine the
scope for 'magic' connection reuse, not the lib).

This would not only solve the problem mentioned, but would make the lib
much more flexible.

Other ideas I have:  I want to allow kerberos authentication via
libsmbclient, because I'll be using mod_auth_krb5 on my webserver, and
this will allow me to avoid passing passwords about :-).

Anyway, thats my two bobs worth,

Andrew Bartlett

-- 
Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net




More information about the samba-technical mailing list