smb context cached connection problem.

derrell at samba.org derrell at samba.org
Fri Jan 20 14:49:24 GMT 2006


Henrik Zagerholm <henke at mac.se> writes:

> Hi list,
> I think my question is better suited to this list than the normal.
>
> I wonder if it is possible to disable connection caching?
>
> I've noticed that a successful connection is cached until the process  (pid)
> is killed.
> Using libsmbclient and changing the user/pass to something faulty  still let
> me access the share if I in the beginning of the code makes  a successful
> connection.
> How can I make libsmbclient not to cache a successful logon?

The caching functions are independent of the main libsmbclient code, and are
intended to be overridden by user code when required.  Look at libsmb_cache.c
where you'll find the caching functions.

If you're using smbc_init(), then you can call smbc_set_context(NULL) after
calling smbc_init() to retrieve the context handle, and then set the four
cache functions as is done in smbc_default_cache_functions() in smbc_cache.c.

If you're calling smbc_new_context() and smbc_init_context() directly, then
after calling smbc_new_context(), you can reset the cache functions as they
were set to the defaults by that function.

Alternatively, you should be able to just define your own
smbc_default_cache_functions() function which sets the pointers to your own
set of cache functions.  The linker should include your version and not
include the functions in libsmb_cache.c that way, and simply calling
smbc_init() should automatically set use of your cache functions.

Cheers,

Derrell

-- 
democracy n.
  A product so extensively exported that the domestic supply is depleted


More information about the samba-technical mailing list