libsmbclient and smb.conf

Steve Langasek vorlon at
Fri Jan 5 23:27:40 GMT 2001

Hi Richard,

> I know that there has been some discussion on this topic, and I have not
> had too much to say so far ...

> My hopes as far as libsmbclient are concerned are the following:

> 1. pull in $HOME/.smb/smb.conf

> 2. If that fails, pull in /etc/smb.conf (or the global one)

> 3. Allow the user to provide an override, that vectors all the lp_xxx
> functions to their callback.

> Now, at the moment, the only parameters that I think I need are in the
> global section anyway, so I don't see a need to introduce a separate section.

> Also, at the moment, the only file I get is $HOME/.smb/smb.conf. Providing
> a fallback is complicated because the code in Samba does no more than tell
> you whether or not loading the parameters succeeded, which makes life hard.
> I have to figure out whether or not I want to try to change that part of
> Samba so that we can figure out what the problems were.

> Finally, allowing users to override parameter stuff is really hard because
> of the way that this is done in Samba, with all parameters being accessed
> via functions. I will have to add one more level of indirection :-)

Would it be possible to do the following?

if [ -e /etc/smb.conf ]; then
	load /etc/smb.conf

if [ -e ~/.smb/smb.conf ]; then
	load ~/.smb/smb.conf

If you have a function that you can pass the name of the conf file to, which
won't try to zero out your conf structure before running, then it's not too
difficult to load first the parameters from /etc/smb.conf, and then load the
user-specific conf file, overriding anything previously set in the global
config.  That way, users don't even have to supply full config info, they only
have to set those values that are different from the global config.

I don't know how easily Samba's current code would support this, but IMHO this
is the best way to handle the situation.

Steve Langasek
postmodern programmer

More information about the samba-technical mailing list