aboutsummaryrefslogtreecommitdiffstats
path: root/loadparm.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-07-27 12:13:35 -0700
committerWayne Davison <wayned@samba.org>2008-07-27 12:13:35 -0700
commit2206abf88410dc19632faf6743eae525ad94199a (patch)
tree2bdfde60f88810e821911496a1e5c7e1bbf527f7 /loadparm.c
parentfcd613d6c71948334cf8135c22ac4936807204f0 (diff)
downloadandroid_external_rsync-2206abf88410dc19632faf6743eae525ad94199a.tar.gz
android_external_rsync-2206abf88410dc19632faf6743eae525ad94199a.tar.bz2
android_external_rsync-2206abf88410dc19632faf6743eae525ad94199a.zip
Added a command-line override for daemon config parameters:
--dparam=PARAMETER=VALUE (-M PARAMETER=VALUE).
Diffstat (limited to 'loadparm.c')
-rw-r--r--loadparm.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/loadparm.c b/loadparm.c
index 2af7b8df..3515358e 100644
--- a/loadparm.c
+++ b/loadparm.c
@@ -45,6 +45,9 @@
#include "rsync.h"
#include "ifuncs.h"
+
+extern item_list dparam_list;
+
#define strequal(a, b) (strcasecmp(a, b)==0)
#define BOOLSTR(b) ((b) ? "Yes" : "No")
@@ -699,8 +702,11 @@ static BOOL do_section(char *sectionname)
isglobal = strwicmp(sectionname, GLOBAL_NAME) == 0;
/* if we were in a global section then do the local inits */
- if (bInGlobalSection && !isglobal)
+ if (bInGlobalSection && !isglobal) {
+ if (!section_list.count)
+ set_dparams(0);
init_locals();
+ }
/* if we've just struck a global section, note the fact. */
bInGlobalSection = isglobal;
@@ -745,6 +751,30 @@ int lp_load(char *pszFname, int globals_only)
return pm_process(pszFname, globals_only ? NULL : do_section, do_parameter);
}
+BOOL set_dparams(int syntax_check_only)
+{
+ char *equal, *val, **params = dparam_list.items;
+ unsigned j;
+
+ for (j = 0; j < dparam_list.count; j++) {
+ equal = strchr(params[j], '='); /* options.c verified this */
+ *equal = '\0';
+ if (syntax_check_only) {
+ if (map_parameter(params[j]) < 0) {
+ rprintf(FCLIENT, "Unknown parameter \"%s\"\n", params[j]);
+ *equal = '=';
+ return False;
+ }
+ } else {
+ for (val = equal+1; isSpace(val); val++) {}
+ do_parameter(params[j], val);
+ }
+ *equal = '=';
+ }
+
+ return True;
+}
+
/* Return the max number of modules (sections). */
int lp_num_modules(void)
{