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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 10 11:03:02 CEST 2008


Author: jan
Date: 2008-09-10 11:03:02 +0200 (Wed, 10 Sep 2008)
New Revision: 1317

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/nessus/cli.c
   trunk/openvas-client/nessus/plugin_infos.c
Log:
Migrate timout settings handling as well as SQL dumping to OID.

* nessus/cli.c (_cli_sql_dump_plugins): Use OID for INSERT command
instead of ID.
(cli_sql_dump_plugins): Use OID as VARCHAR for CREATE TABLE instead
of ID as Integer.

* nessus/plugin_infos.c (plugin_info_window_setup): Use OID for
calling the timeout settings dialog.
(set_timeout): Base the timeout request on OID instead of ID now.
Apply ANSI C func declaration.
(set_timeout_build_window): Apply OID instead of ID as key for storing
them internally. Apply ANSI C func declaration.

* nessus/plugin_infos.c (do_set_timeout): Look for the values with
the key "OID" instead of "ID".



Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2008-09-10 08:30:19 UTC (rev 1316)
+++ trunk/openvas-client/ChangeLog	2008-09-10 09:03:02 UTC (rev 1317)
@@ -1,5 +1,24 @@
 2008-09-10  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
 
+	Migrate timout settings handling as well as SQL dumping to OID.
+
+	* nessus/cli.c (_cli_sql_dump_plugins): Use OID for INSERT command
+	instead of ID.
+	(cli_sql_dump_plugins): Use OID as VARCHAR for CREATE TABLE instead
+	of ID as Integer.
+
+	* nessus/plugin_infos.c (plugin_info_window_setup): Use OID for
+	calling the timeout settings dialog.
+	(set_timeout): Base the timeout request on OID instead of ID now.
+	Apply ANSI C func declaration.
+	(set_timeout_build_window): Apply OID instead of ID as key for storing
+	them internally. Apply ANSI C func declaration.
+
+	* nessus/plugin_infos.c (do_set_timeout): Look for the values with
+	the key "OID" instead of "ID".
+
+2008-09-10  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
+
 	Migrate plugin(nvt) caches to OID.
 
 	* nessus/plugin_cache.c: Changed HEADER_MAGIC to OpenVAS code,

Modified: trunk/openvas-client/nessus/cli.c
===================================================================
--- trunk/openvas-client/nessus/cli.c	2008-09-10 08:30:19 UTC (rev 1316)
+++ trunk/openvas-client/nessus/cli.c	2008-09-10 09:03:02 UTC (rev 1317)
@@ -439,7 +439,7 @@
  {
  char * m, * n;
 
- printf("INSERT INTO plugins VALUES ('%d', ", p->id);
+ printf("INSERT INTO plugins VALUES ('%s', ", p->oid);
 
 
  m = sql_addslashes(p->name);
@@ -560,7 +560,7 @@
 {
  printf("DROP TABLE plugins;\n");
  printf("CREATE TABLE plugins (\n");
- printf(" id int NOT NULL,\n");
+ printf(" oid varchar(50) NOT NULL,\n");
  printf(" name varchar(255),\n");
  printf(" family varchar(255),\n");
  printf(" category varchar(255),\n");

Modified: trunk/openvas-client/nessus/plugin_infos.c
===================================================================
--- trunk/openvas-client/nessus/plugin_infos.c	2008-09-10 08:30:19 UTC (rev 1316)
+++ trunk/openvas-client/nessus/plugin_infos.c	2008-09-10 09:03:02 UTC (rev 1317)
@@ -142,7 +142,7 @@
  char * pref;
  int type;
  
- id  = (int)arg_get_value(ctrls, "ID");
+ id  = (int)arg_get_value(ctrls, "OID");
  
  to = (char*)gtk_entry_get_text(GTK_ENTRY(w));
  pref = emalloc(40);
@@ -162,10 +162,7 @@
 
 
 void
-set_timeout_build_window(id, cur_to, def_to)
-  int id;
-  char* cur_to;
-  int def_to;
+set_timeout_build_window(const char * oid, char * cur_to, int def_to)
 {
   GtkWindow * window = GTK_WINDOW(arg_get_value(MainDialog, "WINDOW"));
   GtkWidget * dialog;
@@ -205,7 +202,7 @@
 
   arg_add_value(ctrls, "WINDOW", ARG_PTR, -1, window);
   arg_add_value(ctrls, "ENTRY", ARG_PTR, -1, w);
-  arg_add_value(ctrls, "ID", ARG_INT, sizeof(int), (void*)id);
+  arg_add_value(ctrls, "OID", ARG_STRING, strlen(oid), estrdup(oid));
 
   /* execute and later remove the dialog */
   switch (gtk_dialog_run(GTK_DIALOG(dialog)))
@@ -221,16 +218,15 @@
 
 
 static int
-set_timeout(w, id)
- GtkWidget * w;
- int id;
+set_timeout(GtkWidget * w,
+            const char * oid)
 {
  struct arglist * serv_prefs = arg_get_value(Context->prefs, "SERVER_PREFS");
  char * name = emalloc(40);
  int to_set = 1;
  char* timeout = NULL;
  
- sprintf(name, "timeout.%d", id);
+ sprintf(name, "timeout.%s", oid);
  if(arg_get_type(serv_prefs,  name) == ARG_STRING)
   timeout = arg_get_value(serv_prefs, name);
  else
@@ -241,7 +237,7 @@
   * Now, build a dialog
   */ 
   
- set_timeout_build_window(id, timeout, !to_set);
+ set_timeout_build_window(oid, timeout, !to_set);
  return 0;
 }
 
@@ -413,7 +409,7 @@
   /* The button for setting the plugin timeout */
   button = gtk_button_new_with_label(_("Set plugin timeout..."));
   g_signal_connect(GTK_OBJECT(button), "clicked",GTK_SIGNAL_FUNC(set_timeout),
-                   (void*)plugin->id);
+                   (void*)plugin->oid);
   gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5);
   gtk_widget_show(button);
 



More information about the Openvas-commits mailing list