PDA

View Full Version : [patch] for alert.c


amcorreia
11-08-2006, 21:27
this is a simple patch for alert.c,

in execl();
int execl(const char *path, const char *arg, ...);

if /*path/ contain a initial white space the command not is executed.

follow is from my zabbix_server.log
----cut----

002340:20060811:140038 Parameter [net.if.in[int]] became supported by agent on host [fw1b]
002340:20060811:140107 Parameter [net.if.in[int]] is not supported by agent on host [fw1b] Old status [0]
002327:20060811:140116 Unsupported media type [3] for alert ID [2132]
002327:20060811:140116 Unsupported media type [3] for alert ID [2135]
008383:20060811:140316 Error executing [ /home/zabbix/bin/zabbix_envia_email.sh] [No such file or directory]
002327:20060811:140332 Unsupported media type [3] for alert ID [2137]
002327:20060811:140332 Unsupported media type [3] for alert ID [2140]

----cut----



--- zabbix-1.1.1.ori/src/zabbix_server/alerter/alerter.c Fri Jun 2 10:49:14 2006
+++ zabbix-1.1.1/src/zabbix_server/alerter/alerter.c Fri Aug 11 15:23:17 2006
@@ -135,6 +135,7 @@ static int execute_action(DB_ALERT *aler
strscpy(full_path,CONFIG_ALERT_SCRIPTS_PATH);
strncat(full_path,"/",MAX_STRING_LEN);
strncat(full_path,mediatype->exec_path,MAX_STRING_LEN);
+ ltrim_spaces (full_path);
zabbix_log( LOG_LEVEL_DEBUG, "Before executing [%s] [%m]", full_path);
if(-1 == execl(full_path,mediatype->exec_path,alert->sendto,alert->subject,alert->message,(char *)0))
{

James Wells
19-09-2006, 05:21
Greetings,

Nice catch Amcorreia. I have added this to a patch I am building for the CVS repository for inclusion in 1.1.3.

James Wells
21-09-2006, 18:46
This has now been submitted to CVS