[Openvas-commits] r5540 - trunk/openvas-manager/src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Oct 14 14:06:44 CEST 2009
Author: felix
Date: 2009-10-14 14:06:43 +0200 (Wed, 14 Oct 2009)
New Revision: 5540
Modified:
trunk/openvas-manager/src/manage.c
trunk/openvas-manager/src/tasks_sql.h
Log:
Added stub for sending files that will receive special handling in an
openvas-scanner and that are especially needed for local security
checks.
* src/manage.c (files_append_lsc): New. Will append files to the list
of files to send.
(start_task): Markes spot where the new function files_append_lsc shall
be called.
* src/tasks_sql.h (task_file_iterator_name): New, receives filename
from iterator.
(target_iterator_name): Added doc.
Modified: trunk/openvas-manager/src/manage.c
===================================================================
--- trunk/openvas-manager/src/manage.c 2009-10-14 11:55:58 UTC (rev 5539)
+++ trunk/openvas-manager/src/manage.c 2009-10-14 12:06:43 UTC (rev 5540)
@@ -51,6 +51,7 @@
#include <openvas/openvas_auth.h>
#include <openvas/base/openvas_string.h>
+#include <openvas/hash_table_file.h>
#ifdef S_SPLINT_S
#include "splint.h"
@@ -420,6 +421,49 @@
}
/**
+ * @brief Append files that receive some special handling and are needed for
+ * @brief local security checks to a list of files.
+ *
+ * @todo Code is similar to code in openvas-scanner/openvassd/ntp_11.c
+ * (ntp_11_recv_file, build_global_sshlogin_info_map,
+ * build_global_host_sshlogins_map) and openvas-client/openvas/comm.c
+ * (send_ssh_credential_files). Consider refactoring to openvas-libraries.
+ *
+ * @param task Task of interest.
+ * @param files[in,out] List to append filepaths to.
+ */
+static void
+files_append_lsc (task_t task, GSList** filelist)
+{
+ iterator_t files;
+ GHashTable* logins = NULL;
+ GHashTable* mapping = NULL;
+
+ init_task_file_iterator (&files, task, NULL);
+ while (next (&files))
+ {
+ gsize content_len;
+ guchar *content;
+ const char *content_64 = task_file_iterator_content (&files);
+ const gchar* file_path = task_file_iterator_name (&files);
+
+ content = g_base64_decode (content_64, &content_len);
+
+ gchar* file_name = g_path_get_basename (file_path);
+ if (!strcmp (file_name, ".host_sshlogins"))
+ mapping = hash_table_file_read_text (content, content_len);
+ if (!strcmp (file_name, ".logins"))
+ ;
+
+ g_free (content);
+ }
+ cleanup_iterator (&files);
+
+ // If found mappings, add pub and private key files to filelist
+}
+
+
+/**
* @brief Return the plugins of a task, as a semicolon separated string.
*
* @param[in] task Task.
@@ -781,6 +825,9 @@
return -1;
}
+ /* Append lsc configuration to list of files to send */
+ //files_append_lsc (task, &files);
+
/* Send any files. */
while (files)
Modified: trunk/openvas-manager/src/tasks_sql.h
===================================================================
--- trunk/openvas-manager/src/tasks_sql.h 2009-10-14 11:55:58 UTC (rev 5539)
+++ trunk/openvas-manager/src/tasks_sql.h 2009-10-14 12:06:43 UTC (rev 5540)
@@ -3316,6 +3316,15 @@
}
}
+/**
+ * @brief Get the name of a file from an task_file_iterator.
+ *
+ * @param[in] iterator Iterator.
+ *
+ * @return Name of the file or NULL if iteration is complete.
+ */
+static DEF_ACCESS (task_file_iterator_name, 1);
+
DEF_ACCESS (task_file_iterator_content, 2);
int
@@ -3453,7 +3462,15 @@
init_table_iterator (iterator, "targets");
}
+/**
+ * @brief Get the name of a target from an target_iterator.
+ *
+ * @param[in] iterator Iterator.
+ *
+ * @return Name of the target or NULL if iteration is complete.
+ */
DEF_ACCESS (target_iterator_name, 0);
+
DEF_ACCESS (target_iterator_hosts, 1);
const char*
More information about the Openvas-commits
mailing list