diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-08-29 14:11:52 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-08-29 14:11:52 +0000 |
| commit | e8a42c01c573311c587920e6d7ebacb747284ea9 (patch) | |
| tree | bf4d6c909cad55504fc97d1bfb7ab402bf42c5c2 | |
| parent | 7b0d3ae6b4f08828d39809682ca525bb9a392f70 (diff) | |
| download | zabbix-e8a42c01c573311c587920e6d7ebacb747284ea9.tar.gz zabbix-e8a42c01c573311c587920e6d7ebacb747284ea9.tar.xz zabbix-e8a42c01c573311c587920e6d7ebacb747284ea9.zip | |
ported r3229:3235 (UserParameters fixing) from 1.1.2
git-svn-id: svn://svn.zabbix.com/trunk@3239 97f52cf1-0a1b-0410-bd0e-c28be96e8082
| -rw-r--r-- | ChangeLog | 2 | ||||
| -rw-r--r-- | src/libs/zbxsysinfo/common/common.c | 27 |
2 files changed, 21 insertions, 8 deletions
@@ -1,5 +1,7 @@ Changes for 1.3: + - disabled exit code handling of UserParameter scripts (Eugene) + - improved UserParameter substitution (Eugene) - improved definition of integer and float point types (Eugene) - fixed problem with ASN_IPADDRESS SNMP values (Eugene) - added action email action variable '{TRIGGER.SEVERITY}' (Eugene) diff --git a/src/libs/zbxsysinfo/common/common.c b/src/libs/zbxsysinfo/common/common.c index 3610086d..fe70e32f 100644 --- a/src/libs/zbxsysinfo/common/common.c +++ b/src/libs/zbxsysinfo/common/common.c @@ -404,7 +404,7 @@ int replace_param(const char *cmd, const char *param, char *out, int outlen) if(pr[1] == '0') { - strncpy(buf, cmd, MAX_STRING_LEN); + strncpy(buf, command, MAX_STRING_LEN); } else { @@ -416,7 +416,11 @@ int replace_param(const char *cmd, const char *param, char *out, int outlen) pl = pr + 2; continue; + } else if(pr[1] == '$') + { + pr++; /* remove second '$' symbol */ } + pl = pr + 1; strncat(out, "$", outlen); outlen -= 1; @@ -491,11 +495,18 @@ int process(const char *in_command, unsigned flags, AGENT_RESULT *result) if(commands[i].main_param) { - err = replace_param( - commands[i].main_param, - usr_param, - param, - MAX_STRING_LEN); + if(commands[i].flags & CF_USEUPARAM) + { + err = replace_param( + commands[i].main_param, + usr_param, + param, + MAX_STRING_LEN); + } + else + { + snprintf(param, MAX_STRING_LEN, "%s", commands[i].main_param); + } } else { @@ -1246,7 +1257,7 @@ int EXECUTE_STR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT zabbix_log(LOG_LEVEL_DEBUG, "Run remote command [%s] Result [%d] [%s]", command, strlen(cmd_result), cmd_result); - if(pclose(f) != 0) + if(pclose(f) == -1) { switch (errno) { @@ -1260,7 +1271,7 @@ int EXECUTE_STR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT #endif /* _WINDOWS */ /* We got EOL only */ - if(cmd_result[0] == '\n') + if(cmd_result[0] == '\n' || cmd_result[0] == '\0') { return SYSINFO_RET_FAIL; } |
