[Openvas-commits] r1291 - in trunk/openvas-client: . nessus

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 5 23:44:03 CEST 2008


Author: jan
Date: 2008-09-05 23:44:03 +0200 (Fri, 05 Sep 2008)
New Revision: 1291

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/nessus/cli.c
   trunk/openvas-client/nessus/context.c
   trunk/openvas-client/nessus/filter.c
   trunk/openvas-client/nessus/nessus_plugin.c
   trunk/openvas-client/nessus/nessus_plugin.h
   trunk/openvas-client/nessus/preferences.c
   trunk/openvas-client/nessus/preferences.h
Log:
Renaming element "asc_id" of struct "nessus_plugin" into
"oid" all over the code. This prepares protocol changes
that will consistently use OIDs.
The renaming does not change the length of the data
structure of nessus_plugin and with OIDs being strings
anyway there is not use of a asc_id anymore.

* nessus/nessus_plugin.h: Rename asc_id to oid in struct
nessus_plugin.

* nessus/nessus_plugin.c (nessus_plugin_new,
nessus_plugin_duplicate): Renamed asc_id to oid.

* nessus/cli.c (_cli_dump_plugins): Renamed asc_id to oid.

* nessus/context.c (context_add_plugin): Renamed asc_id to oid.

* nessus/filter.c (filter_plugin): Renamed asc_id to oid.

* nessus/preferences.c (plugin_asc_id, plugin_id): Removed
these methods.

* nessus/preferences.h: Removed proto for plugin_asc_id().



Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2008-09-05 21:06:37 UTC (rev 1290)
+++ trunk/openvas-client/ChangeLog	2008-09-05 21:44:03 UTC (rev 1291)
@@ -1,5 +1,31 @@
 2008-09-05  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
 
+	Renaming element "asc_id" of struct "nessus_plugin" into
+	"oid" all over the code. This prepares protocol changes
+	that will consistently use OIDs.
+	The renaming does not change the length of the data
+	structure of nessus_plugin and with OIDs being strings
+	anyway there is not use of a asc_id anymore.
+
+	* nessus/nessus_plugin.h: Rename asc_id to oid in struct
+	nessus_plugin.
+
+	* nessus/nessus_plugin.c (nessus_plugin_new,
+	nessus_plugin_duplicate): Renamed asc_id to oid.
+
+	* nessus/cli.c (_cli_dump_plugins): Renamed asc_id to oid.
+
+	* nessus/context.c (context_add_plugin): Renamed asc_id to oid.
+
+	* nessus/filter.c (filter_plugin): Renamed asc_id to oid.
+
+	* nessus/preferences.c (plugin_asc_id, plugin_id): Removed
+	these methods.
+
+	* nessus/preferences.h: Removed proto for plugin_asc_id().
+
+2008-09-05  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
+
 	* nessus/nessus.h: Removed "timestamps" as protocol extension for
 	OTP1.0 (it is default now).
 

Modified: trunk/openvas-client/nessus/cli.c
===================================================================
--- trunk/openvas-client/nessus/cli.c	2008-09-05 21:06:37 UTC (rev 1290)
+++ trunk/openvas-client/nessus/cli.c	2008-09-05 21:44:03 UTC (rev 1291)
@@ -506,7 +506,7 @@
 {
  while( p != NULL )
  {
-  char * var = p->asc_id;
+  char * var = p->oid;
   char * n;
 
   printf("%s|", var);

Modified: trunk/openvas-client/nessus/context.c
===================================================================
--- trunk/openvas-client/nessus/context.c	2008-09-05 21:06:37 UTC (rev 1290)
+++ trunk/openvas-client/nessus/context.c	2008-09-05 21:44:03 UTC (rev 1291)
@@ -144,18 +144,18 @@
 context_add_plugin(struct context *context, struct nessus_plugin *plugin)
 {
   char *category = plugin->category;
-  char *asc_id =   plugin->asc_id;
+  char *oid =   plugin->oid;
   int is_scanner = (strcmp(category, "scanner") == 0);
   struct nessus_plugin *plugins = is_scanner ? context->scanners
 					     : context->plugins;
   struct arglist *pluginset = prefs_get_pluginset(context,
       is_scanner ? "SCANNER_SET" : "PLUGIN_SET", NULL);
-  int in_pluginset = (int)(arg_get_type(pluginset, asc_id) >= 0);
+  int in_pluginset = (int)(arg_get_type(pluginset, oid) >= 0);
   int enabled = 0;
 
   if (in_pluginset)
   {
-    if (arg_get_value(pluginset, asc_id))
+    if (arg_get_value(pluginset, oid))
       enabled = 1;
   }
   else if (!is_scanner)
@@ -165,7 +165,7 @@
   plugin->next = plugins;
 
   if (!in_pluginset)
-    arg_add_value(pluginset, asc_id, ARG_INT, sizeof(int), (void *)enabled);
+    arg_add_value(pluginset, oid, ARG_INT, sizeof(int), (void *)enabled);
 
   if (is_scanner)
     context->scanners = plugin;

Modified: trunk/openvas-client/nessus/filter.c
===================================================================
--- trunk/openvas-client/nessus/filter.c	2008-09-05 21:06:37 UTC (rev 1290)
+++ trunk/openvas-client/nessus/filter.c	2008-09-05 21:44:03 UTC (rev 1291)
@@ -283,7 +283,7 @@
  char * description = nessus_plugin_get_description(plugin);
  char * summary = plugin->summary;
  char * author =  plugin->copyright;
- char * id = 	  plugin->asc_id;
+ char * oid = plugin->oid;
  char * category =  plugin->category;
  char * cve = 	  plugin->cve;
  char * bid = 	  plugin->bid;
@@ -341,7 +341,7 @@
 	 
 	 if (!ret) goto ret;
 	 }	 
- if(filter->filter_on_id)ret= match(id, filter->pattern);
+ if(filter->filter_on_id)ret= match(oid, filter->pattern);
 
  retval = ret;
 

Modified: trunk/openvas-client/nessus/nessus_plugin.c
===================================================================
--- trunk/openvas-client/nessus/nessus_plugin.c	2008-09-05 21:06:37 UTC (rev 1290)
+++ trunk/openvas-client/nessus/nessus_plugin.c	2008-09-05 21:44:03 UTC (rev 1291)
@@ -32,7 +32,7 @@
  if ( np == NULL ) abort();
  bzero(np, sizeof(*np));
  np->id = atoi(id);
- np->asc_id = cache_inc(id);
+ np->oid = cache_inc(id);
  np->md5sum = NULL;
 
  np->name = cache_inc(name); 
@@ -97,7 +97,7 @@
 struct nessus_plugin*
 nessus_plugin_duplicate(struct nessus_plugin *plugin)
 {
-  struct nessus_plugin * copy = nessus_plugin_new(plugin->asc_id,
+  struct nessus_plugin * copy = nessus_plugin_new(plugin->oid,
       plugin->name, plugin->category, plugin->copyright,
       nessus_plugin_get_description(plugin), plugin->summary, plugin->family,
       plugin->version, plugin->cve, plugin->bid, plugin->xrefs);

Modified: trunk/openvas-client/nessus/nessus_plugin.h
===================================================================
--- trunk/openvas-client/nessus/nessus_plugin.h	2008-09-05 21:06:37 UTC (rev 1290)
+++ trunk/openvas-client/nessus/nessus_plugin.h	2008-09-05 21:44:03 UTC (rev 1291)
@@ -1,7 +1,7 @@
 
 struct nessus_plugin {
 	int id;
-	char * asc_id;
+	char * oid;
 	char * name;
 	char * md5sum;
 	

Modified: trunk/openvas-client/nessus/preferences.c
===================================================================
--- trunk/openvas-client/nessus/preferences.c	2008-09-05 21:06:37 UTC (rev 1290)
+++ trunk/openvas-client/nessus/preferences.c	2008-09-05 21:44:03 UTC (rev 1291)
@@ -51,31 +51,6 @@
 int preferences_process(struct context *);
 char * preferences_get_filename(struct context *);
 
-static int
-plugin_id(plugin)
-  struct arglist *plugin;
-{
-  return (int)arg_get_value(plugin, "ID");
-}
-
-char *
-plugin_asc_id(plugin)
-  struct arglist *plugin;
-{
-  static char asc_id[21];
-  char *ret;
-
-  if((ret = arg_get_value(plugin, "ASC_ID")))
-    return ret;
-  else
-  {
-    bzero(asc_id, sizeof(asc_id));
-    sprintf(asc_id, "%d", plugin_id(plugin));
-    arg_add_value(plugin, "ASC_ID", ARG_STRING, strlen(asc_id), asc_id);
-    return asc_id;
-  }
-}
-
 int
 preferences_init(context)
   struct context *context;

Modified: trunk/openvas-client/nessus/preferences.h
===================================================================
--- trunk/openvas-client/nessus/preferences.h	2008-09-05 21:06:37 UTC (rev 1290)
+++ trunk/openvas-client/nessus/preferences.h	2008-09-05 21:44:03 UTC (rev 1291)
@@ -38,7 +38,6 @@
 struct arglist *prefs_get_pluginset(struct context *, char *, struct nessus_plugin *);
 int    preferences_process_filename(struct context *, char *);
 int    preferences_generate_new_file(struct context *, const char *);
-char * plugin_asc_id(struct arglist *);
 char * preferences_get_altname(struct context *, const char *);
 void * prefs_get_default(struct context *, const char *);
 void * prefs_get_value(struct context *, const char *);



More information about the Openvas-commits mailing list