[Openvas-commits] r4095 - in trunk/openvas-server: . openvasd

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun Jul 19 22:06:36 CEST 2009


Author: jan
Date: 2009-07-19 22:06:35 +0200 (Sun, 19 Jul 2009)
New Revision: 4095

Modified:
   trunk/openvas-server/ChangeLog
   trunk/openvas-server/openvasd/attack.c
   trunk/openvas-server/openvasd/pluginscheduler.h
   trunk/openvas-server/openvasd/plugs_req.c
   trunk/openvas-server/openvasd/plugs_req.h
Log:
Add handling for mandatory_keys. This is part of
implementing Change Request #39,
http://www.openvas.org/openvas-cr-39.html.

* openvasd/pluginscheduler.h (struct scheduler_plugin): Added
element for mandatory_keys.

* openvasd/plugs_req.c (mandatory_requirements_met): New.
Checks whether mandatory requirments (so far only KB keys).

* openvasd/plugs_req.h: Added proto for mandatory_requirements_met.

* openvasd/attack.c (launch_plugin): Take care the plugin
in only launched if mandatory requirements are met. This
esentially means regardless of flag optmize flag set.



Modified: trunk/openvas-server/ChangeLog
===================================================================
--- trunk/openvas-server/ChangeLog	2009-07-19 19:14:35 UTC (rev 4094)
+++ trunk/openvas-server/ChangeLog	2009-07-19 20:06:35 UTC (rev 4095)
@@ -1,5 +1,23 @@
-2009-04-09  Felix Wolfsteller <felix.wolfsteller at intevation.de>
+2009-07-19  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
+	Add handling for mandatory_keys. This is part of
+	implementing Change Request #39,
+	http://www.openvas.org/openvas-cr-39.html.
+
+	* openvasd/pluginscheduler.h (struct scheduler_plugin): Added
+	element for mandatory_keys.
+
+	* openvasd/plugs_req.c (mandatory_requirements_met): New.
+	Checks whether mandatory requirments (so far only KB keys).
+
+	* openvasd/plugs_req.h: Added proto for mandatory_requirements_met.
+
+	* openvasd/attack.c (launch_plugin): Take care the plugin
+	in only launched if mandatory requirements are met. This
+	esentially means regardless of flag optmize flag set.
+
+2009-07-09  Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
 	First part of fixing bug #779.
 	Result of collaborative effort of Chandra, Thomas Reinke, Jan-Oliver
 	Wagner, Michael Wiegand, Felix Wolfsteller.

Modified: trunk/openvas-server/openvasd/attack.c
===================================================================
--- trunk/openvas-server/openvasd/attack.c	2009-07-19 19:14:35 UTC (rev 4094)
+++ trunk/openvas-server/openvasd/attack.c	2009-07-19 20:06:35 UTC (rev 4095)
@@ -240,7 +240,8 @@
             }
           }
 
-      if(!optimize || !(error = requirements_plugin(kb, plugin, preferences)))
+      if((!optimize || !(error = requirements_plugin(kb, plugin, preferences)))
+         && mandatory_requirements_met(kb, plugin))
         {
           int pid;
 

Modified: trunk/openvas-server/openvasd/pluginscheduler.h
===================================================================
--- trunk/openvas-server/openvasd/pluginscheduler.h	2009-07-19 19:14:35 UTC (rev 4094)
+++ trunk/openvas-server/openvasd/pluginscheduler.h	2009-07-19 20:06:35 UTC (rev 4095)
@@ -38,6 +38,7 @@
 	struct arglist * required_ports;
 	struct arglist * required_udp_ports;
 	struct arglist * required_keys;
+	struct arglist * mandatory_keys;
 	struct arglist * excluded_keys;
 	struct arglist * arglist;
 	struct hash   *  parent_hash;

Modified: trunk/openvas-server/openvasd/plugs_req.c
===================================================================
--- trunk/openvas-server/openvasd/plugs_req.c	2009-07-19 19:14:35 UTC (rev 4094)
+++ trunk/openvas-server/openvasd/plugs_req.c	2009-07-19 20:06:35 UTC (rev 4095)
@@ -201,6 +201,23 @@
  return ret;
 }
 
+/**
+ * @brief Check whether mandatory requirements for plugin are met.
+ *
+ * @param kb     The arglist knowledge base with all keys.
+ *
+ * @param plugin The arglist plugin.
+ *
+ * @return 0 if all mandatory requirements for the plugin are
+ *         met. 1 if it is not the case.
+ */
+int mandatory_requirements_met(struct kb_item ** kb,
+                               struct scheduler_plugin * plugin)
+{
+  if(key_missing(kb, plugin->mandatory_keys)) return 1;
+  
+  return 0;
+}
 
 /*-------------------------------------------------------
 

Modified: trunk/openvas-server/openvasd/plugs_req.h
===================================================================
--- trunk/openvas-server/openvasd/plugs_req.h	2009-07-19 19:14:35 UTC (rev 4094)
+++ trunk/openvas-server/openvasd/plugs_req.h	2009-07-19 20:06:35 UTC (rev 4095)
@@ -35,6 +35,9 @@
                            struct scheduler_plugin *, 
 			   struct arglist *);
 
+int mandatory_requirements_met(struct kb_item **, 
+                               struct scheduler_plugin *); 
+
 struct arglist*  requirements_common_ports(struct scheduler_plugin *, struct scheduler_plugin *);
 			       
 #endif			  



More information about the Openvas-commits mailing list