[Openvas-commits] r11698 - in trunk/openvas-plugins: . scripts

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Sep 27 09:49:00 CEST 2011


Author: hdoreau
Date: 2011-09-27 09:48:53 +0200 (Tue, 27 Sep 2011)
New Revision: 11698

Modified:
   trunk/openvas-plugins/ChangeLog
   trunk/openvas-plugins/scripts/gather-hardware-info.nasl
Log:
* scripts/gather-hardware-info.nasl: Fixed an incorrect isnull() check
(function returns 0 not NULL). Use script-wide constants for the
registration of host details.


Modified: trunk/openvas-plugins/ChangeLog
===================================================================
--- trunk/openvas-plugins/ChangeLog	2011-09-27 07:01:49 UTC (rev 11697)
+++ trunk/openvas-plugins/ChangeLog	2011-09-27 07:48:53 UTC (rev 11698)
@@ -1,3 +1,9 @@
+2011-09-27  Henri Doreau <henri.doreau at greenbone.net>
+
+	* scripts/gather-hardware-info.nasl: Fixed an incorrect isnull() check
+	(function returns 0 not NULL). Use script-wide constants for the
+	registration of host details.
+
 2011-09-26  Michael Meyer <michael.meyer at greenbone.net>
 
 	* scripts/ping_host.nasl:

Modified: trunk/openvas-plugins/scripts/gather-hardware-info.nasl
===================================================================
--- trunk/openvas-plugins/scripts/gather-hardware-info.nasl	2011-09-27 07:01:49 UTC (rev 11697)
+++ trunk/openvas-plugins/scripts/gather-hardware-info.nasl	2011-09-27 07:48:53 UTC (rev 11698)
@@ -57,13 +57,16 @@
 include("host_details.inc");
 
 
+NVT_OID = "1.3.6.1.4.1.25623.1.0.103996";
+NVT_DESC = "Gather hardware related information";
+
+
 # Register hostname, despite this isn't stricly speaking hardware related information
 hostname = get_host_name();
 if (!isnull(hostname) && hostname != '' && hostname != get_host_ip()) {
-    register_host_detail(name:"hostname", value:hostname, nvt:"1.3.6.1.4.1.25623.1.0.103996", desc:"Gather hardware related information");
+    register_host_detail(name:"hostname", value:hostname, nvt:NVT_OID, desc:NVT_DESC);
 }
 
-
 run_script= script_get_preference("gather hardware information");
 if (isnull(run_script) || "no" >< run_script) {
     exit(0);
@@ -79,7 +82,7 @@
 }
 
 sock = ssh_login_or_reuse_connection();
-if(isnull(sock)) {
+if(!sock) {
     # Send "error" as set by ssh_funcs.
     log_message(port:port, data:get_ssh_error());
     exit(0);
@@ -137,15 +140,15 @@
         }
         cpu_str += string(cpus[cputype], " ", cputype);
     }
-    register_host_detail(name:"cpuinfo", value:cpu_str, nvt:"1.3.6.1.4.1.25623.1.0.103996", desc:"Gather hardware related information");
+    register_host_detail(name:"cpuinfo", value:cpu_str, nvt:NVT_OID, desc:NVT_DESC);
 }
 
 if (memtotal != "") {
-    register_host_detail(name:"meminfo", value:memtotal, nvt:"1.3.6.1.4.1.25623.1.0.103996", desc:"Gather hardware related information");
+    register_host_detail(name:"meminfo", value:memtotal, nvt:NVT_OID, desc:NVT_DESC);
 }
 
 if (netinfo != "") {
-    register_host_detail(name:"netinfo", value:netinfo, nvt:"1.3.6.1.4.1.25623.1.0.103996", desc:"Gather hardware related information");
+    register_host_detail(name:"netinfo", value:netinfo, nvt:NVT_OID, desc:NVT_DESC);
 }
 
 exit(0);



More information about the Openvas-commits mailing list