summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--frontends/php/include/config.inc.php61
-rw-r--r--frontends/php/include/locales/de_de.inc.php2
-rw-r--r--frontends/php/include/locales/en_gb.inc.php2
-rw-r--r--frontends/php/include/locales/fr_fr.inc.php2
-rw-r--r--frontends/php/include/locales/it_it.inc.php2
-rw-r--r--frontends/php/include/locales/ja_jp.inc.php2
-rw-r--r--frontends/php/include/locales/lv_lv.inc.php2
-rw-r--r--frontends/php/include/locales/ru_ru.inc.php2
-rw-r--r--frontends/php/include/locales/sp_sp.inc.php2
-rw-r--r--frontends/php/include/profiles.inc.php2
-rw-r--r--frontends/php/report1.php2
-rw-r--r--frontends/php/tr_status.php22
-rw-r--r--misc/conf/zabbix_agentd.conf6
-rw-r--r--src/libs/zbxnet/security.c29
15 files changed, 94 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index 0be2ccc8..bb3db3ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
Changes for 1.1beta3:
+ - Applied ServerByName patch. (James)
+ - First pass at optimization of MySQL queries on reports page. (James)
+ - Fixed Groupid selection in triggers page (James)
+ - Fixed Update Profile in profiles page (James)
+ - Fixed Number Of Hosts in reports page (James)
- optimized sysinfo functions for solaris system (Eugene)
- optimized sysinfo functions for linux system (Eugene)
- grouped commands in to the new command with parameters for linux (Eugene)
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 4fd2f119..2dcd3e6e 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -234,7 +234,7 @@
function get_media_count_by_userid($userid)
{
- $sql="select count(*) as cnt from media where userid=$userid";
+ $sql="select count(mediaid) as cnt from media where userid=$userid";
$result=DBselect($sql);
$row=DBfetch($result);
return $row["cnt"];
@@ -244,13 +244,13 @@
{
$cnt=0;
- $sql="select count(*) as cnt from actions where triggerid=$triggerid and scope=0";
+ $sql="select count(actionid) as cnt from actions where triggerid=$triggerid and scope=0";
$result=DBselect($sql);
$row=DBfetch($result);
$cnt=$cnt+$row["cnt"];
- $sql="select count(*) as cnt from actions where scope=2";
+ $sql="select count(actionid) as cnt from actions where scope=2";
$result=DBselect($sql);
$row=DBfetch($result);
@@ -1392,7 +1392,7 @@ echo "</head>";
$itemid=DBget_field($res,0,0);
# echo "ITEMID:$itemid<BR>";
-# $sql="select functionid,count(*) from functions where function='$function' and parameter=$parameter group by 1";
+# $sql="select functionid,count(functionid) from functions where function='$function' and parameter=$parameter group by 1";
# echo $sql,"<Br>";
# $res=DBselect($sql);
#
@@ -2532,55 +2532,70 @@ echo "</head>";
function get_stats()
{
- $result=DBselect("select count(*) from history");
- $stat["history_count"]=DBget_field($result,0,0);
+ global $DB_TYPE;
+ if ($DB_TYPE == "MYSQL")
+ {
+ $result=DBselect("show table status like 'history'");
+ $stat["history_count"]=DBget_field($result,0,3);
- $result=DBselect("select count(*) from trends");
- $stat["trends_count"]=DBget_field($result,0,0);
+ $result=DBselect("show table status like 'trends'");
+ $stat["trends_count"]=DBget_field($result,0,3);
+ }
+ else
+ {
+ $result=DBselect("select count(itemid) from history");
+ $stat["history_count"]=DBget_field($result,0,3);
- $result=DBselect("select count(*) from alarms");
+ $result=DBselect("select count(itemid) from trends");
+ $stat["trends_count"]=DBget_field($result,0,3);
+ }
+
+ $result=DBselect("select count(alarmid) from alarms");
$stat["alarms_count"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from alerts");
+ $result=DBselect("select count(alertid) from alerts");
$stat["alerts_count"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from triggers");
+ $result=DBselect("select count(triggerid) from triggers");
$stat["triggers_count"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from triggers where status=0");
+ $result=DBselect("select count(triggerid) from triggers where status=0");
$stat["triggers_count_enabled"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from triggers where status=1");
+ $result=DBselect("select count(triggerid) from triggers where status=1");
$stat["triggers_count_disabled"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from items");
+ $result=DBselect("select count(itemid) from items");
$stat["items_count"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from items where status=0");
+ $result=DBselect("select count(itemid) from items where status=0");
$stat["items_count_active"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from items where status=1");
+ $result=DBselect("select count(itemid) from items where status=1");
$stat["items_count_not_active"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from items where status=3");
+ $result=DBselect("select count(itemid) from items where status=3");
$stat["items_count_not_supported"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from items where type=2");
+ $result=DBselect("select count(itemid) from items where type=2");
$stat["items_count_trapper"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from hosts");
+ $result=DBselect("select count(hostid) from hosts");
$stat["hosts_count"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from hosts where status=".HOST_STATUS_MONITORED);
+ $result=DBselect("select count(hostid) from hosts where status=".HOST_STATUS_MONITORED);
$stat["hosts_count_monitored"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from hosts where status!=".HOST_STATUS_MONITORED);
+ $result=DBselect("select count(hostid) from hosts where status!=".HOST_STATUS_MONITORED);
$stat["hosts_count_not_monitored"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from hosts where status=".HOST_STATUS_DELETED);
+ $result=DBselect("select count(hostid) from hosts where status=".HOST_STATUS_TEMPLATE);
$stat["hosts_count_template"]=DBget_field($result,0,0);
- $result=DBselect("select count(*) from users");
+ $result=DBselect("select count(hostid) from hosts where status=".HOST_STATUS_DELETED);
+ $stat["hosts_count_deleted"]=DBget_field($result,0,0);
+
+ $result=DBselect("select count(userid) from users");
$stat["users_count"]=DBget_field($result,0,0);
diff --git a/frontends/php/include/locales/de_de.inc.php b/frontends/php/include/locales/de_de.inc.php
index 8c0e97ce..166850ef 100644
--- a/frontends/php/include/locales/de_de.inc.php
+++ b/frontends/php/include/locales/de_de.inc.php
@@ -496,7 +496,7 @@
"S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED"=>"Anzahl der Ausl&ouml;ser (aktiviert/deaktiviert)",
"S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER"=> "Anzahl der Elemente (aktiviert/Empf&auml;nger/deaktiviert/nicht unterst&uuml;tzt)",
"S_NUMBER_OF_USERS"=> "Anzahl der Benutzer",
- "S_NUMBER_OF_HOSTS_MONITORED"=> "Anzahl der Systeme (&uuml;berwacht/nicht &uuml;berwacht/Vorlagen)",
+ "S_NUMBER_OF_HOSTS_MONITORED"=> "Anzahl der Systeme (&uuml;berwacht/nicht &uuml;berwacht/Vorlagen/deleted)",
"S_YES"=> "Ja",
"S_NO"=> "Nein",
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 94b20817..8f57fcd4 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -540,7 +540,7 @@
"S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED"=>"Number of triggers (enabled/disabled)",
"S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER"=> "Number of items (active/trapper/not active/not supported)",
"S_NUMBER_OF_USERS"=> "Number of users",
- "S_NUMBER_OF_HOSTS_MONITORED"=> "Number of hosts (monitored/not monitored/templates)",
+ "S_NUMBER_OF_HOSTS_MONITORED"=> "Number of hosts (monitored/not monitored/templates/deleted)",
"S_YES"=> "Yes",
"S_NO"=> "No",
diff --git a/frontends/php/include/locales/fr_fr.inc.php b/frontends/php/include/locales/fr_fr.inc.php
index 5aa1e3bf..a73d6e25 100644
--- a/frontends/php/include/locales/fr_fr.inc.php
+++ b/frontends/php/include/locales/fr_fr.inc.php
@@ -489,7 +489,7 @@
"S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED"=>"Nombre de déclencheurs (activés/désactivés)",
"S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER"=> "Nombre d'items (actifs/collecteurs/inactifs/non supportés)",
"S_NUMBER_OF_USERS"=> "Nombre d'utilisateurs",
- "S_NUMBER_OF_HOSTS_MONITORED"=> "Nombre d'hôtes (surveillés/non surveillés/modèles)",
+ "S_NUMBER_OF_HOSTS_MONITORED"=> "Nombre d'hôtes (surveillés/non surveillés/modèles/deleted)",
"S_YES"=> "Oui",
"S_NO"=> "Non",
diff --git a/frontends/php/include/locales/it_it.inc.php b/frontends/php/include/locales/it_it.inc.php
index 4cb8130b..f70148d8 100644
--- a/frontends/php/include/locales/it_it.inc.php
+++ b/frontends/php/include/locales/it_it.inc.php
@@ -491,7 +491,7 @@
"S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED"=>"Numero di inneschi (abilitati/disabilitati)",
"S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER"=> "Numero di parametri (attivi/trapper/non attivi/non supportati)",
"S_NUMBER_OF_USERS"=> "Numero di utenti",
- "S_NUMBER_OF_HOSTS_MONITORED"=> "Numero di dispositivi (abilitati/disabilitati/modelli)",
+ "S_NUMBER_OF_HOSTS_MONITORED"=> "Numero di dispositivi (abilitati/disabilitati/modelli/deleted)",
"S_YES"=> "Sì",
"S_NO"=> "No",
diff --git a/frontends/php/include/locales/ja_jp.inc.php b/frontends/php/include/locales/ja_jp.inc.php
index d69a846c..b7c2bfc5 100644
--- a/frontends/php/include/locales/ja_jp.inc.php
+++ b/frontends/php/include/locales/ja_jp.inc.php
@@ -540,7 +540,7 @@
"S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED"=>"トリガー数 (有効/無効)",
"S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER"=> "アイテム数 (有効/トラッパー/無効/å–å¾—ä¸å¯)",
"S_NUMBER_OF_USERS"=> "ユーザー数",
- "S_NUMBER_OF_HOSTS_MONITORED"=> "ホスト数 (有効/無効/テンプレート)",
+ "S_NUMBER_OF_HOSTS_MONITORED"=> "ホスト数 (有効/無効/テンプレート/deleted)",
"S_YES"=> "Yes",
"S_NO"=> "No",
diff --git a/frontends/php/include/locales/lv_lv.inc.php b/frontends/php/include/locales/lv_lv.inc.php
index f9f12259..9fd954da 100644
--- a/frontends/php/include/locales/lv_lv.inc.php
+++ b/frontends/php/include/locales/lv_lv.inc.php
@@ -489,7 +489,7 @@
"S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED"=>"Number of triggers (enabled/disabled)",
"S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER"=> "Number of items (active/trapper/not active/not supported)",
"S_NUMBER_OF_USERS"=> "Number of users",
- "S_NUMBER_OF_HOSTS_MONITORED"=> "Number of hosts (monitored/not monitored/templates)",
+ "S_NUMBER_OF_HOSTS_MONITORED"=> "Number of hosts (monitored/not monitored/templates/deleted)",
"S_YES"=> "Yes",
"S_NO"=> "No",
diff --git a/frontends/php/include/locales/ru_ru.inc.php b/frontends/php/include/locales/ru_ru.inc.php
index de63fda5..53f32e8f 100644
--- a/frontends/php/include/locales/ru_ru.inc.php
+++ b/frontends/php/include/locales/ru_ru.inc.php
@@ -489,7 +489,7 @@
"S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED"=>"Number of triggers (enabled/disabled)",
"S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER"=> "Number of items (active/trapper/not active/not supported)",
"S_NUMBER_OF_USERS"=> "Number of users",
- "S_NUMBER_OF_HOSTS_MONITORED"=> "Number of hosts (monitored/not monitored/templates)",
+ "S_NUMBER_OF_HOSTS_MONITORED"=> "Number of hosts (monitored/not monitored/templates/deleted)",
"S_YES"=> "Yes",
"S_NO"=> "No",
diff --git a/frontends/php/include/locales/sp_sp.inc.php b/frontends/php/include/locales/sp_sp.inc.php
index 7f5c2964..4cab2f90 100644
--- a/frontends/php/include/locales/sp_sp.inc.php
+++ b/frontends/php/include/locales/sp_sp.inc.php
@@ -489,7 +489,7 @@
"S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED"=>"Número de triggers (habilitado/deshabilitado)",
"S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER"=> "Number of items (active/trapper/not active/not supported)",
"S_NUMBER_OF_USERS"=> "Número de usuarios",
- "S_NUMBER_OF_HOSTS_MONITORED"=> "Número de items (active/trapper/no activos/no soportados)",
+ "S_NUMBER_OF_HOSTS_MONITORED"=> "Número de items (active/trapper/no activos/no soportados/deleted)",
"S_YES"=> "Sí",
"S_NO"=> "No",
diff --git a/frontends/php/include/profiles.inc.php b/frontends/php/include/profiles.inc.php
index 21b6c54c..db66663a 100644
--- a/frontends/php/include/profiles.inc.php
+++ b/frontends/php/include/profiles.inc.php
@@ -87,7 +87,7 @@
$location=addslashes($location);
$notes=addslashes($notes);
- $sql="update hosts_profiles set hostid=$hostid,devicetype='$devicetype',name='$name',os='$os',serialno='$serialno',tag='$tag',macaddress='$macaddress',hardware='$hardware',software='$software',contact='$contact',location='$location',notes='$notes'";
+ $sql="update hosts_profiles set devicetype='$devicetype',name='$name',os='$os',serialno='$serialno',tag='$tag',macaddress='$macaddress',hardware='$hardware',software='$software',contact='$contact',location='$location',notes='$notes' where hostid=$hostid";
$result=DBexecute($sql);
return $result;
diff --git a/frontends/php/report1.php b/frontends/php/report1.php
index 04e32f36..f140ba65 100644
--- a/frontends/php/report1.php
+++ b/frontends/php/report1.php
@@ -53,7 +53,7 @@
table_row(array(S_NUMBER_OF_TRIGGERS_ENABLED_DISABLED,$stats["triggers_count"]."(".$stats["triggers_count_enabled"]."/".$stats["triggers_count_disabled"].")"),$col++);
table_row(array(S_NUMBER_OF_ITEMS_ACTIVE_TRAPPER,$stats["items_count"]."(".$stats["items_count_active"]."/".$stats["items_count_trapper"]."/".$stats["items_count_not_active"]."/".$stats["items_count_not_supported"].")"),$col++);
table_row(array(S_NUMBER_OF_USERS,$stats["users_count"]),$col++);
- table_row(array(S_NUMBER_OF_HOSTS_MONITORED,$stats["hosts_count"]."(".$stats["hosts_count_monitored"]."/".$stats["hosts_count_not_monitored"]."/".$stats["hosts_count_template"].")"),$col++);
+ table_row(array(S_NUMBER_OF_HOSTS_MONITORED,$stats["hosts_count"]."(".$stats["hosts_count_monitored"]."/".$stats["hosts_count_not_monitored"]."/".$stats["hosts_count_template"]."/".$stats["hosts_count_deleted"].")"),$col++);
table_end();
?>
diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php
index 3c621bbf..f9dc9731 100644
--- a/frontends/php/tr_status.php
+++ b/frontends/php/tr_status.php
@@ -220,6 +220,19 @@
$h2=$h2."<select class=\"biginput\" name=\"hostid\" onChange=\"submit()\">";
$h2=$h2.form_select("hostid",0,S_SELECT_HOST_DOT_DOT_DOT);
+ if(isset($_REQUEST["groupid"])&&($_REQUEST["groupid"]!=0))
+ {
+ $groupcond=" and hg.hostid=h.hostid and hg.groupid=".$_REQUEST["groupid"]." ";
+ $groupname=",hosts_groups hg";
+ }
+ else
+ {
+ $groupcond="";
+ $groupname="";
+ }
+ $sql="select h.hostid,h.host from hosts h,items i".$groupname." where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid $groupcond group by h.hostid,h.host order by h.host";
+
+/*
if(isset($_REQUEST["groupid"]))
{
$sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host";
@@ -228,6 +241,7 @@
{
$sql="select h.hostid,h.host from hosts h,items i where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid group by h.hostid,h.host order by h.host";
}
+*/
$result=DBselect($sql);
while($row=DBfetch($result))
@@ -365,11 +379,11 @@
if($onlytrue=='true')
{
- $sql="select t.priority,count(*) from triggers t,hosts h,items i,functions f where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and t.triggerid=f.triggerid and t.description $select_cond and i.status=0 $cond group by 1";
+ $sql="select t.priority,count(*) from triggers t,hosts h,items i,functions f".$groupname." where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and t.triggerid=f.triggerid and t.description $select_cond and i.status=0 $cond $groupcond group by 1";
}
else
{
- $sql="select t.priority,count(*) from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.status=0 and h.status=".HOST_STATUS_MONITORED." and t.description $select_cond and i.status=0 $cond group by 1";
+ $sql="select t.priority,count(*) from triggers t,hosts h,items i,functions f".$groupname." where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.status=0 and h.status=".HOST_STATUS_MONITORED." and t.description $select_cond and i.status=0 $cond $groupcond group by 1";
}
$result=DBselect($sql);
$p0=$p1=$p2=$p3=$p4=$p5=0;
@@ -495,11 +509,11 @@
if($onlytrue=='true')
{
- $result=DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.comments,t.url,t.value from triggers t,hosts h,items i,functions f where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and t.description $select_cond and t.triggerid=f.triggerid and i.status in (0,2) and h.status=".HOST_STATUS_MONITORED." $cond $sort");
+ $result=DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.comments,t.url,t.value from triggers t,hosts h,items i,functions f".$groupname." where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and t.description $select_cond and t.triggerid=f.triggerid and i.status in (0,2) and h.status=".HOST_STATUS_MONITORED." $cond $groupcond $sort");
}
else
{
- $result=DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.comments,t.url,t.value from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.status=0 and t.description $select_cond and i.status in (0,2) and h.status=".HOST_STATUS_MONITORED." $cond $sort");
+ $result=DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.comments,t.url,t.value from triggers t,hosts h,items i,functions f".$groupname." where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.status=0 and t.description $select_cond and i.status in (0,2) and h.status=".HOST_STATUS_MONITORED." $cond $groupcond $sort");
}
$col=0;
while($row=DBfetch($result))
diff --git a/misc/conf/zabbix_agentd.conf b/misc/conf/zabbix_agentd.conf
index c65cb33b..f51ecce5 100644
--- a/misc/conf/zabbix_agentd.conf
+++ b/misc/conf/zabbix_agentd.conf
@@ -3,8 +3,10 @@
############ GENERAL PARAMETERS #################
-# List of comma delimited IP addresses of ZABBIX servers. No spaces allowed.
-# First IP is used for sending active checks.
+# List of comma delimited IP addresses (or hostnames) of ZABBIX servers.
+# No spaces allowed. First entry is used for sending active checks.
+# Note that hostnames must resolve hostname->IP address and
+# IP address->hostname.
Server=127.0.0.1
diff --git a/src/libs/zbxnet/security.c b/src/libs/zbxnet/security.c
index 49a32301..db4f841f 100644
--- a/src/libs/zbxnet/security.c
+++ b/src/libs/zbxnet/security.c
@@ -22,6 +22,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <netdb.h>
#include <string.h>
@@ -52,12 +53,12 @@
******************************************************************************/
int check_security(int sockfd, char *ip_list, int allow_if_empty)
{
- char *sname;
struct sockaddr_in name;
int i;
- char *s;
+ char *sip, *host;
+ struct hostent *hp;
- char tmp[MAX_STRING_LEN];
+ char tmp[MAX_STRING_LEN], sname[MAX_STRING_LEN];
zabbix_log( LOG_LEVEL_DEBUG, "In check_security()");
@@ -68,24 +69,32 @@ int check_security(int sockfd, char *ip_list, int allow_if_empty)
i=sizeof(name);
-/* if(getpeername(sockfd, (struct sockaddr *)&name, (size_t *)&i) == 0)*/
if(getpeername(sockfd, (struct sockaddr *)&name, (socklen_t *)&i) == 0)
{
i=sizeof(struct sockaddr_in);
- sname=inet_ntoa(name.sin_addr);
+ strcpy(sname,inet_ntoa(name.sin_addr));
zabbix_log( LOG_LEVEL_DEBUG, "Connection from [%s]. Allowed servers [%s] ",sname, ip_list);
strscpy(tmp,ip_list);
- s=(char *)strtok(tmp,",");
- while(s!=NULL)
+ host=(char *)strtok(tmp,",");
+ while(host!=NULL)
{
- if(strcmp(sname, s)==0)
+ /* Allow IP addresses or DNS names for authorization */
+ if((hp=gethostbyname(host)) == 0)
{
- return SUCCEED;
+ zabbix_log( LOG_LEVEL_WARNING, "Error gethostbyname, can not resolve [%s]",host);
}
- s=(char *)strtok(NULL,",");
+ else
+ {
+ sip=inet_ntoa(*((struct in_addr *)hp->h_addr));
+ if(strcmp(sname, sip)==0)
+ {
+ return SUCCEED;
+ }
+ }
+ host=(char *)strtok(NULL,",");
}
}
else