Mailing List Archive

NessusClient/nessus report.h, 1.3, 1.4 report.c, 1.6, 1.7 context.h, 1.10, 1.11 context.c, 1.8, 1.9
Update of /usr/local/cvs/NessusClient/nessus
In directory raccoon.nessus.org:/tmp/cvs-serv56568/nessus

Modified Files:
report.h report.c context.h context.c
Log Message:
Move fill_plugin_prefs and report_load_plugin_cache to context.c and
rename the latter to context_load_plugin_cache. The function will be
needed by scopes too.


Index: report.h
===================================================================
RCS file: /usr/local/cvs/NessusClient/nessus/report.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- report.h 25 Apr 2006 15:28:45 -0000 1.3
+++ report.h 27 Apr 2006 16:09:48 -0000 1.4
@@ -38,8 +38,6 @@
char *report_get_filename(struct context *);
int is_there_any_hole(struct arglist *);

-void report_load_plugin_cache(struct context *context);
-
#ifdef USE_GTK
void report_save(struct context *, int, const char *);
void open_report_selectfile(void);

Index: report.c
===================================================================
RCS file: /usr/local/cvs/NessusClient/nessus/report.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- report.c 27 Apr 2006 14:09:11 -0000 1.6
+++ report.c 27 Apr 2006 16:09:48 -0000 1.7
@@ -37,7 +37,6 @@
#include "backend.h"
#include "nbe_output.h"

-#include "comm.h"
#include "preferences.h"

/* returns filename of report (must be freed) or NULL */
@@ -194,54 +193,6 @@
}


-/* Fill the plugin preferences from the information read from the
- * report's nessusrc.
- */
-static void
-fill_plugin_prefs(struct context *context)
-{
- struct arglist *pref = arg_get_value(context->prefs, "PLUGINS_PREFS");
- while (pref && pref->next)
- {
- char *value = NULL;
- if (pref->type == ARG_INT)
- value = pref->value ? "yes" : "no";
- else if (pref->type == ARG_STRING)
- value = pref->value;
- else
- fprintf(stderr, "unknown type\n");
-
- if (value != NULL)
- /* nessusrc and hence PLUGINS_PREFS may contain settings for old
- * plugins that are not available on the server anymore and which
- * are therefore also not in the plugin cache. So we deactivate
- * the warnings about missing plugins in comm_parse_preference */
- comm_parse_preference(context, NULL, NULL, context->prefs,
- pref->name, value, 0);
-
- pref = pref->next;
- }
-}
-
-/* Read the plugin information stored with the report, if any
- */
-void
-report_load_plugin_cache(struct context *context)
-{
- if (context->type == CONTEXT_REPORT && !context->report_plugin_cache_loaded
- && context->plugins == NULL
- && prefs_get_int(Global, "reports_use_plugin_cache"))
- {
- /* FIXME: plugin_cache_read may fail. for the time being we can
- * ignore this as the most likely reason is that there simply isn't
- * any plugin cache stored with the report, but it would be nicer to
- * produce a message about it. */
- plugin_cache_read(context, "");
- context->report_plugin_cache_loaded = 1;
- fill_plugin_prefs(context);
- context_reset_plugin_tree(context);
- }
-}


/*

Index: context.h
===================================================================
RCS file: /usr/local/cvs/NessusClient/nessus/context.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- context.h 27 Apr 2006 15:06:01 -0000 1.10
+++ context.h 27 Apr 2006 16:09:48 -0000 1.11
@@ -84,6 +84,7 @@
struct context *context_by_type(struct context*, context_type);
void context_reset_plugin_tree(struct context*);
void context_add_plugin(struct context*, struct nessus_plugin*);
+void context_load_plugin_cache(struct context *context);
#ifdef USE_GTK
void context_collect(struct context*);
void context_rename(struct context*, const char*);

Index: context.c
===================================================================
RCS file: /usr/local/cvs/NessusClient/nessus/context.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- context.c 25 Apr 2006 15:28:46 -0000 1.8
+++ context.c 27 Apr 2006 16:09:48 -0000 1.9
@@ -24,6 +24,8 @@
#include "context.h"
#include "preferences.h"
#include "error_dialog.h"
+#include "plugin_cache.h"
+#include "comm.h"

#ifdef USE_GTK
#include <gtk/gtk.h>
@@ -532,6 +534,60 @@
}
preferences_save(context);
}
+
+
+/* Fill the plugin preferences from the information read from the
+ * report's nessusrc.
+ */
+static void
+fill_plugin_prefs(struct context *context)
+{
+ struct arglist *pref = arg_get_value(context->prefs, "PLUGINS_PREFS");
+ while (pref && pref->next)
+ {
+ char *value = NULL;
+ if (pref->type == ARG_INT)
+ value = pref->value ? "yes" : "no";
+ else if (pref->type == ARG_STRING)
+ value = pref->value;
+ else
+ fprintf(stderr, "unknown type\n");
+
+ if (value != NULL)
+ /* nessusrc and hence PLUGINS_PREFS may contain settings for old
+ * plugins that are not available on the server anymore and which
+ * are therefore also not in the plugin cache. So we deactivate
+ * the warnings about missing plugins in comm_parse_preference */
+ comm_parse_preference(context, NULL, NULL, context->prefs,
+ pref->name, value, 0);
+
+ pref = pref->next;
+ }
+}
+
+
+/* Load the plugin cache of the context if it has one, the context
+ * doesn't have plugin information yet and caching of plugins hasn't
+ * been switched off.
+ */
+void
+context_load_plugin_cache(struct context *context)
+{
+ if (context->type == CONTEXT_REPORT && !context->report_plugin_cache_loaded
+ && context->plugins == NULL
+ && prefs_get_int(Global, "reports_use_plugin_cache"))
+ {
+ /* FIXME: plugin_cache_read may fail. for the time being we can
+ * ignore this as the most likely reason is that there simply isn't
+ * any plugin cache stored with the report, but it would be nicer to
+ * produce a message about it. */
+ plugin_cache_read(context, "");
+ context->report_plugin_cache_loaded = 1;
+ fill_plugin_prefs(context);
+ context_reset_plugin_tree(context);
+ }
+}
+

/*
* replacements for g_file_test which is unreliable on windows

_______________________________________________
Nessus-cvs mailing list
Nessus-cvs@list.nessus.org
http://mail.nessus.org/mailman/listinfo/nessus-cvs