proposal for remotable smb.conf via \winreg pipe

tridge at tridge at
Wed Jul 20 13:31:41 GMT 2005


Interesting idea!

I've been looking at loadparm from a different angle lately. The main
problem I see with it from an interface view is that it uses a
separate function per parameter, and the whole codebase assumes that
lp_*() calls are zero cost. 

If we ever want to have our config be stored remotely then we need to
change both these properties. We do have code currently that can
access a parameter by its string name, but it is very slow. To see
what sort of affect this might have I've measured how often lp_*()
calls are made in Samba4 during a 20 second "make quicktest" run. We
make more than 50k calls to lp functions in that time!

So to fix this we would need to call the lp_*() function only when a
subsystem is initialised, and not call it again on that subsystem. So
for example, when we get a SMB connection we would call a few lp_*()
functions to fetch basic parameters for that connection and store them
in the connection structure.

A good example is lp_security(). That happens to be the single most
called lp_*() function in Samba4, as it is called on every
packet. Changing the code like this:

-               if (lp_security() == SEC_SHARE) {
+               if (smb_conn-> == SEC_SHARE) {

makes a huge difference.

Once we've got the number of calls to a reasonable level we could
possibly offer true remote config support, in ldap or other forms
(perhaps even over winreg). I know we can in theory have smb.conf
remote now, but only by pulling the whole config, which means
dynamically editing the config is hopeless.

I know this is quite different from your winreg proposal, but if
revamping of loadparm is on the agenda then I think the above should
be addressed at the same time.

We also have the long standing problem of preserving comments in
smb.conf after automated editing (such as with swat). I think that can
be done by using a data structure that preserves the parameter
ordering and attaches the comment lines before the parameter, but I
think it would best be done at the same time as we ditch the lp_xxx()
per-parameter access functions and move to string names. If we reduce
the number of lp_ calls made sufficiently and add a hash based lookup
on parameter name I think we can get something that will work quite

Cheers, Tridge

More information about the samba-technical mailing list