diff options
| author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-05-09 08:21:43 +0000 |
|---|---|---|
| committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-05-09 08:21:43 +0000 |
| commit | daab98b057be572898c131de7e3eb7ddd571e920 (patch) | |
| tree | 9118528aed9ab674949a78be7f6ed23bf4958e51 /src/libs/zbxconf | |
| parent | b62606b1d22dff6f2d0aaf1f31e08d9b70b5c69b (diff) | |
| download | zabbix-daab98b057be572898c131de7e3eb7ddd571e920.tar.gz zabbix-daab98b057be572898c131de7e3eb7ddd571e920.tar.xz zabbix-daab98b057be572898c131de7e3eb7ddd571e920.zip | |
- support of Include directive for configuration files (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@4099 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs/zbxconf')
| -rw-r--r-- | src/libs/zbxconf/cfg.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libs/zbxconf/cfg.c b/src/libs/zbxconf/cfg.c index e8931223..97f43bce 100644 --- a/src/libs/zbxconf/cfg.c +++ b/src/libs/zbxconf/cfg.c @@ -53,6 +53,10 @@ int parse_cfg_file(const char *cfg_file,struct cfg_line *cfg) { FILE *file; + static level = 0; + +#define ZBX_MAX_INCLUDE_LEVEL 10 + register int i, lineno; @@ -67,6 +71,12 @@ int parse_cfg_file(const char *cfg_file,struct cfg_line *cfg) assert(cfg); + if(++level > ZBX_MAX_INCLUDE_LEVEL) + { + /* Ignore include files of depth 10 */ + return result; + } + if(cfg_file) { if( NULL == (file = fopen(cfg_file,"r")) ) @@ -97,6 +107,11 @@ int parse_cfg_file(const char *cfg_file,struct cfg_line *cfg) zabbix_log(LOG_LEVEL_DEBUG, "cfg: para: [%s] val [%s]", parameter, value); + if(strcmp(parameter, "Include") == 0) + { + parse_cfg_file(value, cfg); + } + for(i = 0; value[i] != '\0'; i++) { if(value[i] == '\n') |
