[Openvas-commits] r1347 - in trunk/openvas-server: . openvasd
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Sep 15 15:36:34 CEST 2008
Author: mwiegand
Date: 2008-09-15 15:36:33 +0200 (Mon, 15 Sep 2008)
New Revision: 1347
Modified:
trunk/openvas-server/ChangeLog
trunk/openvas-server/openvasd/comm.c
trunk/openvas-server/openvasd/nasl_plugins.c
trunk/openvas-server/openvasd/plugs_hash.c
Log:
Fixes to re-enable plugin loading after the OID changes. Please note
that the selection of the plugins chosen by the user at the start of a
new scan is _very_ slow at the moment since the plugin retrieval
function is not yet optimized.
Modified: trunk/openvas-server/ChangeLog
===================================================================
--- trunk/openvas-server/ChangeLog 2008-09-15 13:33:14 UTC (rev 1346)
+++ trunk/openvas-server/ChangeLog 2008-09-15 13:36:33 UTC (rev 1347)
@@ -1,3 +1,22 @@
+2008-09-15 Michael Wiegand <michael.wiegand at intevation.de>
+
+ Fixes to re-enable plugin loading after the OID changes. Please note
+ that the selection of the plugins chosen by the user at the start of a
+ new scan is _very_ slow at the moment since the plugin retrieval
+ function is not yet optimized.
+
+ * openvasd/nasl_plugins.c (nasl_plugin_launch): Call
+ preferences_plugin_timeout with OID instead of ID.
+
+ * openvasd/plugs_hash.c (plugins_send_md5_byid): Send OID instead of ID
+ when sending MD5 hashes for plugin. (plugins_send_md5): Removed
+ handling of obsolete md5_by_name capability.
+
+ * openvasd/comm.c: Added new get_plug_by_oid function to retrieve
+ plugins based on OID. Note that this makes plugin selection _very_ slow
+ at the moment since the ID based optimized retrieval could no longer be
+ used. (comm_setup_plugins) Changed to parse and use OIDs instead of IDs.
+
2008-09-10 Michael Wiegand <michael.wiegand at intevation.de>
Make the plugin timeout settings use OID instead of ID.
Modified: trunk/openvas-server/openvasd/comm.c
===================================================================
--- trunk/openvas-server/openvasd/comm.c 2008-09-15 13:33:14 UTC (rev 1346)
+++ trunk/openvas-server/openvasd/comm.c 2008-09-15 13:36:33 UTC (rev 1347)
@@ -498,6 +498,17 @@
return _get_plug_by_id(array, id, 0, num_plugins, num_plugins);
}
+static struct arglist * get_plug_by_oid(struct arglist * plugins, char * oid)
+{
+ while(plugins != NULL)
+ {
+ if (!strcmp(plug_get_oid(plugins->value), oid)) return plugins;
+ plugins = plugins->next;
+ }
+
+ return NULL;
+}
+
/*-------------------------------------------------------------------------------*/
@@ -512,6 +523,7 @@
struct arglist * p = plugins;
struct arglist ** array;
char * t;
+ char * oid;
int i;
int enable = 0;
@@ -526,15 +538,13 @@
plug_set_launch(p->value, enable);
p = p->next;
}
-
+
if ( num_plugins == 0 || enable != 0 )
return;
-
-
/* Store the plugins in an array for quick access */
p = plugins;
- i = 0;
+/* i = 0;
array = emalloc ( num_plugins * sizeof(struct arglist ** ));
while ( p->next != NULL )
{
@@ -542,31 +552,26 @@
p = p->next;
}
- qsort( array, num_plugins, sizeof(struct arglist * ), qsort_cmp);
+ qsort( array, num_plugins, sizeof(struct arglist * ), qsort_cmp);*/
t = list;
- while ( t[0] == ';' ) t ++;
+ oid = strtok(t, ";");
/* Read the list provided by the user and enable the plugins accordingly */
- for ( ;; )
+ while (oid != NULL)
+ {
+ p = get_plug_by_oid(plugins, oid);
+ if(p != NULL)
{
- id = atoi(t);
- if ( id != 0 )
- {
- p = get_plug_by_id(array, id, num_plugins);
- if ( p != NULL ) plug_set_launch(p->value, LAUNCH_RUN);
+ plug_set_launch(p->value, LAUNCH_RUN);
+ }
#ifdef DEBUG
- else printf("PLUGIN ID %d NOT FOUND!!!\n", id);
+ else log_write("PLUGIN ID %s NOT FOUND!!!\n", oid);
#endif
- }
+ oid = strtok(NULL, ";");
+ }
- t = strchr(t + 1, ';');
- if ( t != NULL ) t ++;
- else break;
- }
-
-
- efree(&array);
+// efree(&array);
}
void
Modified: trunk/openvas-server/openvasd/nasl_plugins.c
===================================================================
--- trunk/openvas-server/openvasd/nasl_plugins.c 2008-09-15 13:33:14 UTC (rev 1346)
+++ trunk/openvas-server/openvasd/nasl_plugins.c 2008-09-15 13:36:33 UTC (rev 1347)
@@ -157,7 +157,7 @@
arg_add_value(d, "preferences", ARG_STRING, -1, preferences);
category = plug_get_category(plugin);
- timeout = preferences_plugin_timeout(preferences, plug_get_id(plugin));
+ timeout = preferences_plugin_timeout(preferences, plug_get_oid(plugin));
if( timeout == 0 )
{
if(category == ACT_SCANNER)
Modified: trunk/openvas-server/openvasd/plugs_hash.c
===================================================================
--- trunk/openvas-server/openvasd/plugs_hash.c 2008-09-15 13:33:14 UTC (rev 1346)
+++ trunk/openvas-server/openvasd/plugs_hash.c 2008-09-15 13:36:33 UTC (rev 1347)
@@ -188,9 +188,9 @@
{
struct arglist * args = plugins->value;
char * fname = plug_get_path(args);
- int id = plug_get_id(args);
+ char * oid = plug_get_oid(args);
char * md5 = file_hash(fname);
- auth_printf(globals, "%d <|> %s\n", id, md5);
+ auth_printf(globals, "%s <|> %s\n", oid, md5);
efree(&md5);
plugins = plugins->next;
}
@@ -240,12 +240,6 @@
void plugins_send_md5(struct arglist * globals)
{
- ntp_caps * caps = arg_get_value(globals, "ntp_caps");
- if( caps == NULL )
- return;
- if(caps->md5_by_name)
- plugins_send_md5_byname(globals);
- else
plugins_send_md5_byid(globals);
}
More information about the Openvas-commits
mailing list