Matt McCutchen
2009-Jan-14 07:25 UTC
Improving loadparm design to fix bug in configuration reloading
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
Wayne Davison
2009-Jan-17 03:23 UTC
Improving loadparm design to fix bug in configuration reloading
On Wed, Jan 14, 2009 at 02:25:33AM -0500, Matt McCutchen wrote:> 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 structureI was thinking we could get rid of the big, must-keep-sorted, statically initialized structure and make use of the init_globals() function to set the initial values. However, if you've got something you've done already, I'd be glad to consider it.> 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.It's the only one that is a pointer instead of a value, but I haven't yet looked to see if there was a way for a section to get a NULL pointer where the sDefault value is non-NULL. ..wayne..