Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Nessus: commits

NessusClient/nessus/prefs_dialog prefs_scope_tree.c,1.12,1.13

 

 

Nessus commits RSS feed   Index | Next | Previous | View Threaded


renaud at nessus

Oct 10, 2006, 6:01 AM

Post #1 of 1 (679 views)
Permalink
NessusClient/nessus/prefs_dialog prefs_scope_tree.c,1.12,1.13

Update of /usr/local/cvs/NessusClient/nessus/prefs_dialog
In directory raccoon.nessus.org:/tmp/cvs-serv45257

Modified Files:
prefs_scope_tree.c
Log Message:
do not count the number of h/w/n in each nbe files at startup - keep a cache of the counts instead

Index: prefs_scope_tree.c
===================================================================
RCS file: /usr/local/cvs/NessusClient/nessus/prefs_dialog/prefs_scope_tree.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- prefs_scope_tree.c 25 Apr 2006 16:08:31 -0000 1.12
+++ prefs_scope_tree.c 10 Oct 2006 13:00:57 -0000 1.13
@@ -550,22 +550,54 @@


void
-scopetreestore_counters_update(treestore, iter, be)
+scopetreestore_counters_update(treestore, iter, be, fname)
GtkTreeStore *treestore;
GtkTreeIter iter;
int be;
+ char * fname;
{
- struct arglist *hosts = backend_convert(be);
+ struct arglist *hosts;
+ char cached_counters[1024];
+ FILE * fp;
+ int h = 0, w = 0, n = 0;
+
+ /*
+ * Cache the results in a '.cnt' file to avoid recounting
+ * each .nbe file on startup
+ */
+ snprintf(cached_counters, sizeof(cached_counters), "%s.cnt", fname);
+ fp = fopen(cached_counters, "r");
+ if ( fp == NULL )
+ {
+ hosts = backend_convert(be);
+ h = number_of_holes(hosts);
+ w = number_of_warnings(hosts);
+ n = number_of_notes(hosts);
+ if(hosts) arg_free_all(hosts);
+ fp = fopen(cached_counters, "w");
+ if ( fp != NULL )
+ {
+ fprintf(fp, "%d %d %d\n", h, w, n);
+ fclose(fp);
+ }
+ else perror("open ");
+ }
+ else
+ {
+ fscanf(fp, "%d %d %d", &h, &h, &n);
+ fclose(fp);
+ }
+
+
+

/* XXX: add these to scopes and tasks? */
gtk_tree_store_set(treestore, &iter,
- COL_NOTE, number_of_notes(hosts),
- COL_WARN, number_of_warnings(hosts),
- COL_HOLE, number_of_holes(hosts),
+ COL_NOTE, h,
+ COL_WARN, w,
+ COL_HOLE, n,
-1);

- if(hosts)
- arg_free_all(hosts);
}

void
@@ -847,8 +879,8 @@

fname = report_get_filename(reports);
be = backend_import_report(fname);
+ scopetreestore_counters_update(treestore, report, be, fname);
efree(&fname);
- scopetreestore_counters_update(treestore, report, be);
backend_dispose(be);
}
reports = reports->next;

_______________________________________________
Nessus-cvs mailing list
Nessus-cvs [at] list
http://mail.nessus.org/mailman/listinfo/nessus-cvs

Nessus commits RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.