Improving loadparm design to fix bug in configuration reloading

Matt McCutchen matt at mattmccutchen.net
Wed Jan 14 07:25:33 GMT 2009


While I was working on the avoid-reverse-lookup patches, I found a flaw
in the daemon's behavior of reloading the configuration on each
connection.  If I remove a module parameter (in my case, "hosts allow")
from the global section, the removal does not take effect.  This is
because loadparm.c does not reset sDefaults to the application defaults
before reloading the configuration.

I'll work on a fix for this.  I think I'll take the opportunity to
improve the design a bit by actually adding a section structure
representing the global values of section parameters to the global
structure; this is essentially what the &include code was doing anyway.
Then rsync will have a statically initialized "const struct global" for
the application-level defaults, plus a "struct global" and zero or more
"struct section" for the currently loaded configuration.  

Comments on this approach before I begin?

I noticed that FN_LOCAL_STRING works differently from the other
FN_LOCAL_* in that it goes back to sDefaults if a valid module number is
given but the module contains a NULL value.  Is there a reason for this?
I'm checking the history of the Samba code that from which this was
taken.

-- 
Matt



More information about the rsync mailing list