diff options
author | Wayne Davison <wayned@samba.org> | 2008-07-27 12:13:35 -0700 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2008-07-27 12:13:35 -0700 |
commit | 2206abf88410dc19632faf6743eae525ad94199a (patch) | |
tree | 2bdfde60f88810e821911496a1e5c7e1bbf527f7 /loadparm.c | |
parent | fcd613d6c71948334cf8135c22ac4936807204f0 (diff) | |
download | android_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.c | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -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) { |