From scm-commit at wald.intevation.org Wed Jul 1 08:07:30 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Wed, 1 Jul 2009 08:07:30 +0200 (CEST) Subject: [Openvas-commits] r3895 - branches Message-ID: <20090701060730.31CC67A178@pyrosoma.intevation.org> Author: mwiegand Date: 2009-07-01 08:07:25 +0200 (Wed, 01 Jul 2009) New Revision: 3895 Added: branches/openvas-libnasl-2-0/ Log: Creating branch for 2.0 series of openvas-libnasl to unblock trunk/openvas-libnasl for deeper changes. Copied: branches/openvas-libnasl-2-0 (from rev 3894, trunk/openvas-libnasl) From scm-commit at wald.intevation.org Wed Jul 1 08:10:51 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Wed, 1 Jul 2009 08:10:51 +0200 (CEST) Subject: [Openvas-commits] r3896 - in trunk/openvas-libnasl: . doc Message-ID: <20090701061051.8B29A7A178@pyrosoma.intevation.org> Author: mwiegand Date: 2009-07-01 08:10:50 +0200 (Wed, 01 Jul 2009) New Revision: 3896 Modified: trunk/openvas-libnasl/ChangeLog trunk/openvas-libnasl/VERSION trunk/openvas-libnasl/doc/Doxyfile trunk/openvas-libnasl/doc/Doxyfile_full Log: Post branch version bump. * VERSION: Set to 2.1.0.SVN. * doc/Doxyfile, doc/Doxyfile_full: Updated PROJECT_NUMBER. Modified: trunk/openvas-libnasl/ChangeLog =================================================================== --- trunk/openvas-libnasl/ChangeLog 2009-07-01 06:07:25 UTC (rev 3895) +++ trunk/openvas-libnasl/ChangeLog 2009-07-01 06:10:50 UTC (rev 3896) @@ -1,3 +1,11 @@ +2009-07-01 Michael Wiegand + + Post branch version bump. + + * VERSION: Set to 2.1.0.SVN. + + * doc/Doxyfile, doc/Doxyfile_full: Updated PROJECT_NUMBER. + 2009-06-22 Jan-Oliver Wagner * nasl/nasl_nessusd_glue.c (script_elem): Since english was the Modified: trunk/openvas-libnasl/VERSION =================================================================== --- trunk/openvas-libnasl/VERSION 2009-07-01 06:07:25 UTC (rev 3895) +++ trunk/openvas-libnasl/VERSION 2009-07-01 06:10:50 UTC (rev 3896) @@ -1 +1 @@ -2.0.2.SVN +2.1.0.SVN Modified: trunk/openvas-libnasl/doc/Doxyfile =================================================================== --- trunk/openvas-libnasl/doc/Doxyfile 2009-07-01 06:07:25 UTC (rev 3895) +++ trunk/openvas-libnasl/doc/Doxyfile 2009-07-01 06:10:50 UTC (rev 3896) @@ -23,7 +23,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.0.2.SVN +PROJECT_NUMBER = 2.1.0.SVN # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. Modified: trunk/openvas-libnasl/doc/Doxyfile_full =================================================================== --- trunk/openvas-libnasl/doc/Doxyfile_full 2009-07-01 06:07:25 UTC (rev 3895) +++ trunk/openvas-libnasl/doc/Doxyfile_full 2009-07-01 06:10:50 UTC (rev 3896) @@ -23,7 +23,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.0.2.SVN +PROJECT_NUMBER = 2.1.0.SVN # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. From scm-commit at wald.intevation.org Wed Jul 1 08:55:14 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Wed, 1 Jul 2009 08:55:14 +0200 (CEST) Subject: [Openvas-commits] r3897 - in trunk/openvas-libnasl: . nasl Message-ID: <20090701065514.D09877A187@pyrosoma.intevation.org> Author: jan Date: 2009-07-01 08:55:14 +0200 (Wed, 01 Jul 2009) New Revision: 3897 Modified: trunk/openvas-libnasl/ChangeLog trunk/openvas-libnasl/nasl/nasl_nessusd_glue.c Log: * nasl/nasl_nessusd_glue.c (script_elem): Adapt to new API of script_name, etc. Modified: trunk/openvas-libnasl/ChangeLog =================================================================== --- trunk/openvas-libnasl/ChangeLog 2009-07-01 06:10:50 UTC (rev 3896) +++ trunk/openvas-libnasl/ChangeLog 2009-07-01 06:55:14 UTC (rev 3897) @@ -1,3 +1,8 @@ +2009-07-01 Jan-Oliver Wagner + + * nasl/nasl_nessusd_glue.c (script_elem): Adapt to new API + of script_name, etc. + 2009-07-01 Michael Wiegand Post branch version bump. Modified: trunk/openvas-libnasl/nasl/nasl_nessusd_glue.c =================================================================== --- trunk/openvas-libnasl/nasl/nasl_nessusd_glue.c 2009-07-01 06:10:50 UTC (rev 3896) +++ trunk/openvas-libnasl/nasl/nasl_nessusd_glue.c 2009-07-01 06:55:14 UTC (rev 3897) @@ -188,8 +188,10 @@ return FAKE_CELL; } -typedef void(*script_register_func_t)(struct arglist*, const char *, const char*); +typedef void(*script_register_func_t)(struct arglist*, const char *); +// TODO: This function can be elminiated (functionality back to script_name, etc) +// once all NASL scripts are being cleared of old I18N concept static tree_cell * script_elem(lex_ctxt* lexic, script_register_func_t script_register_func) { struct arglist * script_infos = lexic->script_infos; @@ -202,7 +204,7 @@ return FAKE_CELL; } - script_register_func(script_infos, str, NULL); + script_register_func(script_infos, str); return FAKE_CELL; } From scm-commit at wald.intevation.org Wed Jul 1 10:01:32 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Wed, 1 Jul 2009 10:01:32 +0200 (CEST) Subject: [Openvas-commits] r3898 - in trunk/openvas-manager: . src Message-ID: <20090701080132.830CA7A19C@pyrosoma.intevation.org> Author: mattm Date: 2009-07-01 10:01:32 +0200 (Wed, 01 Jul 2009) New Revision: 3898 Modified: trunk/openvas-manager/ChangeLog trunk/openvas-manager/src/omp.c Log: * src/omp.c (omp_xml_handle_end_element): In GET_STATUS only print a LAST_REPORT if there is a last report. Modified: trunk/openvas-manager/ChangeLog =================================================================== --- trunk/openvas-manager/ChangeLog 2009-07-01 06:55:14 UTC (rev 3897) +++ trunk/openvas-manager/ChangeLog 2009-07-01 08:01:32 UTC (rev 3898) @@ -1,3 +1,8 @@ +2009-07-01 Matthew Mundell + + * src/omp.c (omp_xml_handle_end_element): In GET_STATUS only print a + LAST_REPORT if there is a last report. + 2009-06-30 Matthew Mundell Add a LAST_REPORT element to the GET_STATUS response. Modified: trunk/openvas-manager/src/omp.c =================================================================== --- trunk/openvas-manager/src/omp.c 2009-07-01 06:55:14 UTC (rev 3897) +++ trunk/openvas-manager/src/omp.c 2009-07-01 08:01:32 UTC (rev 3898) @@ -2064,15 +2064,29 @@ int ret; gchar* response; char* name; - gchar* last_report_id; + gchar *last_report_id, *last_report; last_report_id = task_last_report_id (tsk_uuid); - if (last_report_id == NULL) + if (last_report_id) { - free (tsk_uuid); - error_send_to_client (error); - return; + last_report = g_strdup_printf ("" + "" + "" + "FIX" + "" + "" + "0" + "0" + "0" + "0" + "" + "" + "", + last_report_id); + g_free (last_report_id); } + else + last_report = g_strdup (""); name = task_name (task); response = g_strdup_printf ("%i" "" "%u" - "" - "" - "FIX" - "" - "0" - "0" - "0" - "0" - "" - "" - "", + "%s", tsk_uuid, name, task_run_status_name (task), @@ -2108,8 +2112,8 @@ task_logs_size (task), task_notes_size (task), task_report_count (task), - last_report_id); - g_free (last_report_id); + last_report); + g_free (last_report); ret = send_to_client (response); g_free (response); g_free (name); @@ -2155,18 +2159,30 @@ gchar* line; char* name = task_name (index); char* tsk_uuid; - gchar* last_report_id; + gchar *last_report_id, *last_report; // FIX buffer entire response so this can respond on err if (task_uuid (index, &tsk_uuid)) abort (); last_report_id = task_last_report_id (tsk_uuid); - if (last_report_id == NULL) + if (last_report_id) { - free (tsk_uuid); - error_send_to_client (error); - return; + last_report = g_strdup_printf ("" + "" + "FIX" + "" + "0" + "0" + "0" + "0" + "" + "" + "", + last_report_id); + g_free (last_report_id); } + else + last_report = g_strdup (""); line = g_strdup_printf ("" @@ -2180,17 +2196,7 @@ "%i" "" "%u" - "" - "" - "FIX" - "" - "0" - "0" - "0" - "0" - "" - "" - "" + "%s" "", tsk_uuid, name, @@ -2201,8 +2207,8 @@ task_logs_size (index), task_notes_size (index), task_report_count (index), - last_report_id); - g_free (last_report_id); + last_report); + g_free (last_report); free (name); free (tsk_uuid); if (send_to_client (line)) From scm-commit at wald.intevation.org Wed Jul 1 10:08:01 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Wed, 1 Jul 2009 10:08:01 +0200 (CEST) Subject: [Openvas-commits] r3899 - in trunk/openvas-manager: . src Message-ID: <20090701080801.B027F7A19C@pyrosoma.intevation.org> Author: mattm Date: 2009-07-01 10:08:00 +0200 (Wed, 01 Jul 2009) New Revision: 3899 Modified: trunk/openvas-manager/ChangeLog trunk/openvas-manager/src/manage.c trunk/openvas-manager/src/manage.h trunk/openvas-manager/src/omp.c trunk/openvas-manager/src/tasks_sql.h Log: Add a PROGRESS element to the GET_STATUS response. * src/manage.c (task_last_report_id): Remove old comment. * src/tasks_sql.h (task_current_port, task_max_port): New functions. * src/manage.h: Update headers. * src/omp.c (omp_xml_handle_end_element): Add PROGRESS to GET_STATUS. Modified: trunk/openvas-manager/ChangeLog =================================================================== --- trunk/openvas-manager/ChangeLog 2009-07-01 08:01:32 UTC (rev 3898) +++ trunk/openvas-manager/ChangeLog 2009-07-01 08:08:00 UTC (rev 3899) @@ -1,5 +1,15 @@ 2009-07-01 Matthew Mundell + Add a PROGRESS element to the GET_STATUS response. + + * src/manage.c (task_last_report_id): Remove old comment. + * src/tasks_sql.h (task_current_port, task_max_port): New functions. + * src/manage.h: Update headers. + + * src/omp.c (omp_xml_handle_end_element): Add PROGRESS to GET_STATUS. + +2009-07-01 Matthew Mundell + * src/omp.c (omp_xml_handle_end_element): In GET_STATUS only print a LAST_REPORT if there is a last report. Modified: trunk/openvas-manager/src/manage.c =================================================================== --- trunk/openvas-manager/src/manage.c 2009-07-01 08:01:32 UTC (rev 3898) +++ trunk/openvas-manager/src/manage.c 2009-07-01 08:08:00 UTC (rev 3899) @@ -211,7 +211,6 @@ GError* link_error; gchar *link, *report, *last_report_id; - // FIX same as above, mv to manage link = g_build_filename (OPENVAS_STATE_DIR "/mgr/users/", current_credentials.username, Modified: trunk/openvas-manager/src/manage.h =================================================================== --- trunk/openvas-manager/src/manage.h 2009-07-01 08:01:32 UTC (rev 3898) +++ trunk/openvas-manager/src/manage.h 2009-07-01 08:08:00 UTC (rev 3899) @@ -303,6 +303,12 @@ int add_task_description_line (task_t, const char*, size_t); +unsigned int +task_current_port (task_t); + +unsigned int +task_max_port (task_t); + void set_task_ports (task_t, unsigned int, unsigned int); Modified: trunk/openvas-manager/src/omp.c =================================================================== --- trunk/openvas-manager/src/omp.c 2009-07-01 08:01:32 UTC (rev 3898) +++ trunk/openvas-manager/src/omp.c 2009-07-01 08:08:00 UTC (rev 3899) @@ -2065,6 +2065,8 @@ gchar* response; char* name; gchar *last_report_id, *last_report; + long progress; + unsigned int max_port; last_report_id = task_last_report_id (tsk_uuid); if (last_report_id) @@ -2088,12 +2090,23 @@ else last_report = g_strdup (""); + max_port = task_max_port (task); + if (max_port) + { + progress = (task_current_port (task) * 100) / max_port; + if (progress < 0) progress = 0; + else if (progress > 100) progress = 100; + } + else + progress = 100; + name = task_name (task); response = g_strdup_printf ("" "" "%s" "%s" + "%li" "" "%i" "%i" @@ -2106,6 +2119,7 @@ tsk_uuid, name, task_run_status_name (task), + progress, task_debugs_size (task), task_holes_size (task), task_infos_size (task), @@ -2160,7 +2174,19 @@ char* name = task_name (index); char* tsk_uuid; gchar *last_report_id, *last_report; + long progress; + unsigned int max_port; + max_port = task_max_port (index); + if (max_port) + { + progress = (task_current_port (index) * 100) / max_port; + if (progress < 0) progress = 0; + else if (progress > 100) progress = 100; + } + else + progress = 100; + // FIX buffer entire response so this can respond on err if (task_uuid (index, &tsk_uuid)) abort (); @@ -2188,6 +2214,7 @@ " id=\"%s\">" "%s" "%s" + "%li" "" "%i" "%i" @@ -2201,6 +2228,7 @@ tsk_uuid, name, task_run_status_name (index), + progress, task_debugs_size (index), task_holes_size (index), task_infos_size (index), Modified: trunk/openvas-manager/src/tasks_sql.h =================================================================== --- trunk/openvas-manager/src/tasks_sql.h 2009-07-01 08:01:32 UTC (rev 3898) +++ trunk/openvas-manager/src/tasks_sql.h 2009-07-01 08:08:00 UTC (rev 3899) @@ -1226,6 +1226,38 @@ } /** + * @brief Return the current port of a task. + * + * @param[in] task Task. + * + * @return Current port. + */ +unsigned int +task_current_port (task_t task) +{ + return (unsigned int) sql_int (0, 0, + "SELECT current_port FROM tasks_%s WHERE ROWID = %llu;", + current_credentials.username, + task); +} + +/** + * @brief Return the max port of a task. + * + * @param[in] task Task. + * + * @return Max port. + */ +unsigned int +task_max_port (task_t task) +{ + return (unsigned int) sql_int (0, 0, + "SELECT max_port FROM tasks_%s WHERE ROWID = %llu;", + current_credentials.username, + task); +} + +/** * @brief Set the ports of a task. * * @param[in] task The task. From scm-commit at wald.intevation.org Wed Jul 1 10:43:19 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Wed, 1 Jul 2009 10:43:19 +0200 (CEST) Subject: [Openvas-commits] r3900 - in trunk/openvas-manager: . src Message-ID: <20090701084319.7A2437A19E@pyrosoma.intevation.org> Author: mattm Date: 2009-07-01 10:43:18 +0200 (Wed, 01 Jul 2009) New Revision: 3900 Modified: trunk/openvas-manager/ChangeLog trunk/openvas-manager/src/omp.c Log: * src/omp.c (omp_xml_handle_end_element): Account for 0 current_port in GET_STATUS progress calculation. Modified: trunk/openvas-manager/ChangeLog =================================================================== --- trunk/openvas-manager/ChangeLog 2009-07-01 08:08:00 UTC (rev 3899) +++ trunk/openvas-manager/ChangeLog 2009-07-01 08:43:18 UTC (rev 3900) @@ -1,5 +1,10 @@ 2009-07-01 Matthew Mundell + * src/omp.c (omp_xml_handle_end_element): Account for 0 current_port in + GET_STATUS progress calculation. + +2009-07-01 Matthew Mundell + Add a PROGRESS element to the GET_STATUS response. * src/manage.c (task_last_report_id): Remove old comment. Modified: trunk/openvas-manager/src/omp.c =================================================================== --- trunk/openvas-manager/src/omp.c 2009-07-01 08:08:00 UTC (rev 3899) +++ trunk/openvas-manager/src/omp.c 2009-07-01 08:43:18 UTC (rev 3900) @@ -2066,7 +2066,7 @@ char* name; gchar *last_report_id, *last_report; long progress; - unsigned int max_port; + unsigned int max_port, current_port; last_report_id = task_last_report_id (tsk_uuid); if (last_report_id) @@ -2091,14 +2091,15 @@ last_report = g_strdup (""); max_port = task_max_port (task); + current_port = task_current_port (task); if (max_port) { - progress = (task_current_port (task) * 100) / max_port; + progress = (current_port * 100) / max_port; if (progress < 0) progress = 0; else if (progress > 100) progress = 100; } else - progress = 100; + progress = current_port ? 100 : 0; name = task_name (task); response = g_strdup_printf (" 100) progress = 100; } else - progress = 100; + progress = current_port ? 100 : 0; // FIX buffer entire response so this can respond on err if (task_uuid (index, &tsk_uuid)) abort (); From scm-commit at wald.intevation.org Wed Jul 1 12:06:37 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Wed, 1 Jul 2009 12:06:37 +0200 (CEST) Subject: [Openvas-commits] r3901 - trunk/doc/website Message-ID: <20090701100637.71BD37A175@pyrosoma.intevation.org> Author: felix Date: 2009-07-01 12:06:37 +0200 (Wed, 01 Jul 2009) New Revision: 3901 Added: trunk/doc/website/openvas-cr-37.htm4 Log: Stub for CR #37 (introduce dependency openvas-client -> openvas-libraries Added: trunk/doc/website/openvas-cr-37.htm4 =================================================================== --- trunk/doc/website/openvas-cr-37.htm4 2009-07-01 08:43:18 UTC (rev 3900) +++ trunk/doc/website/openvas-cr-37.htm4 2009-07-01 10:06:37 UTC (rev 3901) @@ -0,0 +1,139 @@ +m4_dnl -*-html-*- +m4_include(`template.m4') + +m4_dnl OpenVAS +m4_dnl $Id$ +m4_dnl Description: OpenVAS Change Request #37 +m4_dnl +m4_dnl Authors: +m4_dnl Felix Wolfsteller +m4_dnl +m4_dnl Copyright: +m4_dnl Copyright (C) 2009 Intevation GmbH +m4_dnl +m4_dnl This program is free software; you can redistribute it and/or modify +m4_dnl it under the terms of the GNU General Public License version 2, +m4_dnl as published by the Free Software Foundation. +m4_dnl +m4_dnl This program is distributed in the hope that it will be useful, +m4_dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +m4_dnl GNU General Public License for more details. +m4_dnl +m4_dnl You should have received a copy of the GNU General Public License +m4_dnl along with this program; if not, write to the Free Software +m4_dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + +PAGE_START +

OpenVAS Change Request #37: Introduce dependency openvas-client -> +openvas-libraries

+ +Status: In discussion + +

Purpose

+ +

+ To avoid exact code duplicates and associated maintance work. +

+

+ To allow code cleanup and removal of code nearly-duplicates. +

+

+ To allow further refactoring of openvas-client and use common 2.1 code base. +

+ +

References

+ +

+

+ +

Rationale

+ +

+ Currently openvas-client is a self- contained project, sharing some of the +dependencies of e.g. openvas-server but not depending on openvas-libraries. +It contains some (partly modified) code copied from openvas-libraries. Of some +newer modules exact copies exist in booth openvas-libraries and openvas-client. +

+

+ As openvas-client deals with similar 'entities' (e.g. NVTs, reported +issues) as openvas-server and openvas- libraries, there exist +

    +
  • exact code duplicates (same files, e.g. every file in src/openvas-lib), +
  • +
  • nearly exact code duplicates or extracts (e.g. arglists, network related + functions) and
  • +
  • secondary, separate implementations of functionality (e.g. file- related + functions, parsing),
  • +
+which makes maintenance harder and can require double effort when debugging. +

+

+ Current developements (e.g. openvas-manager, logging facility) in the 2.1 +line will likely introduce more general code that could and should be used by +openvas-client. +

+ +

Effects

+ +

+ As an effect, a module would be split off openvas-libraries (libopenvas-core). +This new module itself would not depend on anything that openvas-client does not +depend on. +

+

+ The new dependency would make some files and functions in openvas-client +obsolete and thus reduce overall code size. +

+

+ The new dependency would also allow refactoring and ease future developement. +

+

+ Releases of openvas-client would could not necessarily be made independently +of releases of the other modules. +

+ +

Design and Implementation

+ +

+ The dependency would first be created formally. +

+

+ Then, libopenvas-core has to be created (e.g. via Makefile). +

+

+ Afterwards, effected modules and functions in the client can be removed one +by one. +Maybe modified functions or comments will be "backported" to openvas-libraries. +

+

+ Access to core structs and functionality (e.g. nvtis) can help in cleaning up +openvas-client code overall and allow new functionality like improved logging. +

+ +

+ A list of some effected files: +

    +
  • openvas-client/libnessus/addslashes.* (openvas-libraries/libopenvas/plugutils.*)
  • +
  • openvas-client/libnessus/arglists.* (openvas-libraries/libopenvas/harglists.*)
  • +
  • openvas-client/libnessus/harglists.* (openvas-libraries/libopenvas/harglists.*)
  • +
  • openvas-client/libnessus/hlst.* (openvas-libraries/libopenvas/hlst.*)
  • +
  • openvas-client/libnessus/network.* (openvas-libraries/libopenvas/network.*)
  • +
  • openvas-client/libnessus/rand.* (openvas-libraries/libopenvas/rand.*)
  • +
  • openvas-client/libnessus/resolve.* (openvas-libraries/libopenvas/resolve.*)
  • +
  • openvas-client/libnessus/system.* (openvas-libraries/libopenvas/system.*)
  • +
  • openvas-client/include/libnessus.h
  • +
  • openvas-client/src/hash_table_file.* (openvas-libraries/libopenvas/hash_table_file.*)
  • +
  • openvas-client/src/openvas_certificates.* (openvas-libraries/libopenvas/openvas_certificates.*)
  • +
  • openvas-client/src/openvas_certificate_file.* (openvas-libraries/libopenvas/openvas_certificate_file.*)
  • +
  • openvas-client/src/openvas_ssh_login.* (openvas-libraries/libopenvas/openvas_ssh_login.*)
  • +
+

+ +

History

+ +
    +
  • 2009-06-29 Felix Wolfsteller <felix.wolfsteller at intevation.de>:
    + Initial text.
  • +
From scm-commit at wald.intevation.org Thu Jul 2 11:00:28 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Thu, 2 Jul 2009 11:00:28 +0200 (CEST) Subject: [Openvas-commits] r3902 - trunk/doc/website Message-ID: <20090702090028.60F8E7A16A@pyrosoma.intevation.org> Author: felix Date: 2009-07-02 11:00:28 +0200 (Thu, 02 Jul 2009) New Revision: 3902 Modified: trunk/doc/website/openvas-cr-37.htm4 Log: Improved structure and readability, credits to Jan-Oliver Wagner. Modified: trunk/doc/website/openvas-cr-37.htm4 =================================================================== --- trunk/doc/website/openvas-cr-37.htm4 2009-07-01 10:06:37 UTC (rev 3901) +++ trunk/doc/website/openvas-cr-37.htm4 2009-07-02 09:00:28 UTC (rev 3902) @@ -6,6 +6,7 @@ m4_dnl Description: OpenVAS Change Request #37 m4_dnl m4_dnl Authors: +m4_dnl Jan-Oliver Wagner m4_dnl Felix Wolfsteller m4_dnl m4_dnl Copyright: @@ -26,22 +27,19 @@ PAGE_START -

OpenVAS Change Request #37: Introduce dependency openvas-client -> -openvas-libraries

+

OpenVAS Change Request #37: Make openvas-client depend on openvas-libraries

Status: In discussion

Purpose

- To avoid exact code duplicates and associated maintance work. + To avoid comprehensive code duplicates and associated maintance work.

+

- To allow code cleanup and removal of code nearly-duplicates. + To allow code cleanup and removal of code redundancy.

-

- To allow further refactoring of openvas-client and use common 2.1 code base. -

References

@@ -51,14 +49,15 @@

Rationale

- Currently openvas-client is a self- contained project, sharing some of the -dependencies of e.g. openvas-server but not depending on openvas-libraries. -It contains some (partly modified) code copied from openvas-libraries. Of some -newer modules exact copies exist in booth openvas-libraries and openvas-client. +Currently openvas-client is independent of any other OpenVAS module. +Since it shares some code base with the other modules, copies of various +files from openvas-libraries are inside the openvas-client module.

+

- As openvas-client deals with similar 'entities' (e.g. NVTs, reported -issues) as openvas-server and openvas- libraries, there exist +As openvas-client deals with similar 'entities' (e.g. NVTs, reported +issues) as openvas-server and openvas-libraries, there exist +

  • exact code duplicates (same files, e.g. every file in src/openvas-lib),
  • @@ -67,54 +66,44 @@
  • secondary, separate implementations of functionality (e.g. file- related functions, parsing),
-which makes maintenance harder and can require double effort when debugging. + +which makes maintenance harder and can require double debugging efforts.

+

Current developements (e.g. openvas-manager, logging facility) in the 2.1 -line will likely introduce more general code that could and should be used by +series will likely introduce more general code that could and should be used by openvas-client.

Effects

- As an effect, a module would be split off openvas-libraries (libopenvas-core). -This new module itself would not depend on anything that openvas-client does not -depend on. +For compilation or installation of OpenVAS-Client, presence of openvas-libraries +will be a strict requirement.

-

- The new dependency would make some files and functions in openvas-client -obsolete and thus reduce overall code size. -

-

- The new dependency would also allow refactoring and ease future developement. -

-

- Releases of openvas-client would could not necessarily be made independently -of releases of the other modules. -

Design and Implementation

-

- The dependency would first be created formally. -

-

- Then, libopenvas-core has to be created (e.g. via Makefile). -

-

- Afterwards, effected modules and functions in the client can be removed one -by one. -Maybe modified functions or comments will be "backported" to openvas-libraries. -

-

- Access to core structs and functionality (e.g. nvtis) can help in cleaning up -openvas-client code overall and allow new functionality like improved logging. -

+

Changes to openvas-client

-

- A list of some effected files:

    +
  • Change autoconf to strictly require openvas-libraries.
  • +
  • Identify and remove affected files and code parts (see preliminary list + below).
  • +
+ +

Changes to openvas-libraries

+ +
    +
  • For nearly exact code duplicates and separate implementations, changes from + openvas-client have to be merged in and tested carefully.
  • +
+ + +

Incomplete list of affected files in openvas-client

+The files counterparts in libopenvas are given in braces. +
  • openvas-client/libnessus/addslashes.* (openvas-libraries/libopenvas/plugutils.*)
  • openvas-client/libnessus/arglists.* (openvas-libraries/libopenvas/harglists.*)
  • openvas-client/libnessus/harglists.* (openvas-libraries/libopenvas/harglists.*)
  • @@ -134,6 +123,8 @@

    History

      +
    • 2009-07-02 Felix Wolfsteller <felix.wolfsteller at intevation.de> and Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>:
      + Enhanced structure and readability.
    • 2009-06-29 Felix Wolfsteller <felix.wolfsteller at intevation.de>:
      Initial text.
    From scm-commit at wald.intevation.org Thu Jul 2 12:14:08 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Thu, 2 Jul 2009 12:14:08 +0200 (CEST) Subject: [Openvas-commits] r3903 - in trunk/openvas-manager: . src Message-ID: <20090702101408.18C1B7A144@pyrosoma.intevation.org> Author: mattm Date: 2009-07-02 12:14:07 +0200 (Thu, 02 Jul 2009) New Revision: 3903 Modified: trunk/openvas-manager/ChangeLog trunk/openvas-manager/src/oxpd.c Log: * src/oxpd.c (read_protocol): Read as much as possible at a time up to the length of the OTP protocol string, in case the client presumes that what it has written has been entirely read. Modified: trunk/openvas-manager/ChangeLog =================================================================== --- trunk/openvas-manager/ChangeLog 2009-07-02 09:00:28 UTC (rev 3902) +++ trunk/openvas-manager/ChangeLog 2009-07-02 10:14:07 UTC (rev 3903) @@ -1,5 +1,11 @@ 2009-07-01 Matthew Mundell + * src/oxpd.c (read_protocol): Read as much as possible at a time up to + the length of the OTP protocol string, in case the client presumes that + what it has written has been entirely read. + +2009-07-01 Matthew Mundell + * src/omp.c (omp_xml_handle_end_element): Account for 0 current_port in GET_STATUS progress calculation. Modified: trunk/openvas-manager/src/oxpd.c =================================================================== --- trunk/openvas-manager/src/oxpd.c 2009-07-02 09:00:28 UTC (rev 3902) +++ trunk/openvas-manager/src/oxpd.c 2009-07-02 10:14:07 UTC (rev 3903) @@ -83,7 +83,7 @@ */ struct sockaddr_in server_address; -#define OTP_INIT_STRING "< OTP/1.0 >" +#define OTP_INIT_STRING "< OTP/1.0 >\n" /** * @brief Read and return the type of protocol from the client. @@ -98,8 +98,8 @@ read_protocol (gnutls_session_t* client_session, int client_socket) { protocol_read_t ret; - char* from_client_current; time_t start_time; + int left; /* Turn on blocking. */ // FIX get flags first @@ -124,7 +124,7 @@ return PROTOCOL_FAIL; } ret = PROTOCOL_FAIL; - from_client_current = from_client + from_client_end; + left = strlen (OTP_INIT_STRING); while (from_client_end < FROM_BUFFER_SIZE) { int select_ret; @@ -181,7 +181,7 @@ count = gnutls_record_recv (*client_session, from_client + from_client_end, - 1); + left); if (count == GNUTLS_E_INTERRUPTED) /* Interrupted, try read again. */ continue; @@ -212,11 +212,10 @@ ret = PROTOCOL_CLOSE; break; } - assert (count == 1); from_client_end += count; + left -= count; - /* Check for the OTP string. */ - if (*from_client_current == '>') + if (left == 0) { if (strstr (from_client, OTP_INIT_STRING)) ret = PROTOCOL_OTP; @@ -224,13 +223,10 @@ ret = PROTOCOL_OMP; break; } - else if (from_client_current - from_client == strlen (OTP_INIT_STRING)) - { - ret = PROTOCOL_OMP; - break; - } - - from_client_current += count; + else if (memchr (from_client, + '>', + strlen (OTP_INIT_STRING) - left)) + ret = PROTOCOL_OMP; } } From scm-commit at wald.intevation.org Thu Jul 2 12:24:33 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Thu, 2 Jul 2009 12:24:33 +0200 (CEST) Subject: [Openvas-commits] r3904 - in branches/openvas-client-2-0: . nessus Message-ID: <20090702102433.B6D457A160@pyrosoma.intevation.org> Author: felix Date: 2009-07-02 12:24:33 +0200 (Thu, 02 Jul 2009) New Revision: 3904 Modified: branches/openvas-client-2-0/ChangeLog branches/openvas-client-2-0/nessus/html_output.c Log: * nessus/html_output.c: Cosmetics, documentation, added TODO about possible memory leak. Modified: branches/openvas-client-2-0/ChangeLog =================================================================== --- branches/openvas-client-2-0/ChangeLog 2009-07-02 10:14:07 UTC (rev 3903) +++ branches/openvas-client-2-0/ChangeLog 2009-07-02 10:24:33 UTC (rev 3904) @@ -1,8 +1,7 @@ -2009-06-10 Felix Wolfsteller +2009-07-02 Felix Wolfsteller - * nessus/preferences.c (preferences_new): - Set default value of plugins_timeout parameter to 320 (as in the - servers default). + * nessus/html_output.c: + Cosmetics, documentation, added TODO about possible memory leak. 2009-06-10 Felix Wolfsteller Modified: branches/openvas-client-2-0/nessus/html_output.c =================================================================== --- branches/openvas-client-2-0/nessus/html_output.c 2009-07-02 10:14:07 UTC (rev 3903) +++ branches/openvas-client-2-0/nessus/html_output.c 2009-07-02 10:24:33 UTC (rev 3904) @@ -36,23 +36,26 @@ * some more fixes for valid html4.0 * */ - + +/** @file + * Export of report to html. + */ + #include #include "report.h" #include "report_utils.h" #include "error_dlg.h" #include "preferences.h" - void summary_to_file(FILE *, struct arglist *); - /* * Handy functions */ /** - * print URL linking to CVE/BID/OpenVAS database to file. + * @brief print URL linking to CVE/BID/OpenVAS database to file. + * * '%s' in urlfmt (from preferences) will be replaced by * item IDs (or their parts split at minus characters). * '%%' will insert a percent character. @@ -109,7 +112,10 @@ } /** - * All the cross references (CVE, BID) have the same format - XREF: ,...
    + * @brief All the cross references (CVE, BID) have the same format - + * @brief XREF: \,...\ + * + * @file File to write to. */ char* html_output_extract_xref (FILE* file, char* str, char* key) @@ -119,29 +125,29 @@ char * e1 = strchr(str, ','); char * e2 = strchr(str, '<'); char tmp = '\0'; - if((e1 > e2) || (e1 == NULL))e1 = e2; - - - if(e1 != NULL) - { - tmp = e1[0]; - e1[0] = '\0'; - } + if ((e1 > e2) || (e1 == NULL)) e1 = e2; + + if (e1 != NULL) + { + tmp = e1[0]; + e1[0] = '\0'; + } html_output_fprint_link(file, key, str); str = e1; - if(e1 != NULL) - { - e1[0] = tmp; - - if(tmp == ','){ - fputc(',', file); - fputc(' ', file); - str ++; - str ++; - } - else - fputc('<', file); - } + if (e1 != NULL) + { + e1[0] = tmp; + + if (tmp == ',') + { + fputc (',', file); + fputc (' ', file); + str ++; + str ++; + } + else + fputc ('<', file); + } } return str; } @@ -156,11 +162,11 @@ { char * e1, * e2; char tmp = 0; - + e1 = strchr(str, ' '); e2 = strstr(str, "
    "); if((e1 > e2) || (e1 == NULL))e1 = e2; - + if(e1 != NULL) { tmp = e1[0]; @@ -189,7 +195,7 @@ if(str != NULL) str++; } - + fprintf(file, "OpenVAS ID : "); if (internal_link == TRUE) fprintf(file, "%s", plugin_oid, plugin_oid); @@ -198,7 +204,7 @@ } /** - * Replaces newlines and \<, \> by "\" and "\>"" , "\<". + * @brief Replaces newlines and \<, \> by "\" and "\>"" , "\<". * * @param str String to convert. * @return String str where newlines and \<, \> have been replaced by html tags. @@ -206,24 +212,23 @@ char* html_output_convert_cr_to_html (char* str) { - int num = 0; - char * t; - char * ret; - int i, j = 0; - /* - * Compute the size we'll need - */ - + int num = 0; + char * t; + char * ret; + int i, j = 0; + + /* Compute the size we'll need */ t = str; - while(t[0]) + while (t[0]) + { + if((t[0]=='\n')||(t[0]=='>')||(t[0]=='<')) + num++; + t++; + } + + ret = emalloc (strlen(str)+5*num+1); + for (i=0, j=0;str[i];i++,j++) { - if((t[0]=='\n')||(t[0]=='>')||(t[0]=='<'))num++; - t++; - } - - ret = emalloc(strlen(str)+5*num+1); - for(i=0, j=0;str[i];i++,j++) - { if(str[i]=='\n'){ ret[j++]='<'; ret[j++]='b'; @@ -255,20 +260,15 @@ { char *t, *k; - /* - * Convert '192.168.1.1' to '192_168_1_1' or - * 'prof.nessus.org' to 'prof_nessus_org' - */ - hostname = - t = estrdup (hostname) ; + hostname = t = estrdup (hostname); + /* Convert '192.168.1.1' to '192_168_1_1' or + * 'prof.nessus.org' to'prof_nessus_org' */ while ((t = strchr (t, '.')) != 0) - t [0] = '_' ; + t [0] = '_'; if (name == 0) - return hostname ; + return hostname; - /* - * Convert 'telnet (21/tcp)' to '21_tcp' - */ + /* Convert 'telnet (21/tcp)' to '21_tcp' */ name = k = estrdup (name); if ((t = strrchr (k, '(')) != 0) @@ -277,19 +277,16 @@ t [0] = '\0' ; while ((t = strchr (k, '/')) != 0) t [0] = '_' ; - - /* - * append: "name" + "_" + "hostname" - */ + + /* append: "name" + "_" + "hostname" */ t = emalloc (strlen (hostname) + strlen (k) + 2); strcat (strcat (strcpy (t, hostname), "_"), k); efree (&hostname); efree (&name); - return t ; + return t; } - /* As pdf export works via intermediate html export, it might be worth looking at arglist_to_plainhtml (pdf_output.c), refactor and merge. */ /** @@ -303,49 +300,51 @@ int arglist_to_html (struct arglist* hosts, char* filename) { - FILE * file; - struct arglist * h; - - if(!strcmp(filename, "-"))file = stdout; - else file = fopen(filename, "w"); - if(!file){ - show_error("Could not create this file !"); - perror("fopen "); - return(-1); - } + FILE * file; + struct arglist * h; - /* Print the Style Sheet Opts and Report Summary */ - summary_to_file(file, hosts); + if (!strcmp(filename, "-")) + file = stdout; + else + file = fopen (filename, "w"); - h = hosts; + if (!file) + { + show_error ("Could not create this file !"); + perror ("fopen "); + return (-1); + } + /* Print the Style Sheet Opts and Report Summary */ + summary_to_file (file, hosts); - /* Loop through hosts and print out their problems "Host List"*/ - while(h && h->next) - { - int result; - char * href = html_output_portname_to_ahref(NULL, h->name); - fprintf(file, " \n\t %s\n", href, h->name); - result = is_there_any_hole(h->value); - - if(result == HOLE_PRESENT) - fprintf(file, "\tSecurity hole(s) found\n"); - else if(result == WARNING_PRESENT) - fprintf(file, "\tSecurity warning(s) found\n"); - else if(result == NOTE_PRESENT) - fprintf(file, "\tSecurity note(s) found\n"); - else if(result == FALSE_PRESENT) - fprintf(file, "\tFalse positive(s) found\n"); - else fprintf(file, "\tNo noticeable information found\n"); - efree(&href); - h = h->next; - } - fprintf(file, "\n\n"); - /* Finish printing Host list */ + h = hosts; + /* Loop through hosts and print out their problems "Host List" */ + while(h && h->next) + { + int result; + char * href = html_output_portname_to_ahref (NULL, h->name); + fprintf (file, " \n\t %s\n", href, h->name); + result = is_there_any_hole (h->value); + if (result == HOLE_PRESENT) + fprintf (file, "\tSecurity hole(s) found\n"); + else if (result == WARNING_PRESENT) + fprintf (file, "\tSecurity warning(s) found\n"); + else if (result == NOTE_PRESENT) + fprintf (file, "\tSecurity note(s) found\n"); + else if (result == FALSE_PRESENT) + fprintf (file, "\tFalse positive(s) found\n"); + else fprintf (file, "\tNo noticeable information found\n"); + efree (&href); + h = h->next; + } + fprintf (file, "\n\n"); + /* Finish printing Host list */ - /* Enter crazy loop for hosts and specific issues */ + + /* Enter crazy loop for hosts and specific issues */ while(hosts && hosts->next) { char * hostname; @@ -356,12 +355,12 @@ char * name; hostname = hosts->name; - href = html_output_portname_to_ahref(NULL, hostname); - fprintf(file, "\n", href); - efree(&href); - name = html_output_portname_to_ahref("toc", hostname); - fprintf(file, "\n", name); - efree(&name); + href = html_output_portname_to_ahref (NULL, hostname); + fprintf (file, "\n", href); + efree (&href); + name = html_output_portname_to_ahref ("toc", hostname); + fprintf (file, "\n", name); + efree (&name); fprintf(file, "

    \n"); fprintf(file, "\n"); @@ -371,14 +370,13 @@ fprintf(file, "\t\n"); fprintf(file, "\t\n"); - + ports = arg_get_value(hosts->value, "PORTS"); if(ports) { struct arglist * open = ports; if(open->next) { - while(open && open->next){ name = html_output_portname_to_ahref(open->name, hostname); if(name) @@ -386,7 +384,7 @@ if(arg_get_value(open->value, "REPORT") || arg_get_value(open->value, "INFO") || arg_get_value(open->value, "FALSE") || - arg_get_value(open->value, "NOTE")) + arg_get_value(open->value, "NOTE")) { fprintf(file, " \n\t\n", hostname); fprintf(file, "\t\n", @@ -395,9 +393,8 @@ else if(arg_get_value(open->value, "INFO")) fprintf(file, "\t\n"); else if(arg_get_value(open->value, "FALSE")) fprintf(file, "\t\n"); else fprintf(file, "\t\n"); - - } - else { + } + else { fprintf(file, " \n\t\n", hostname); fprintf(file, "\t\n\t\n", open->name); } @@ -420,9 +417,7 @@ fprintf(file, "\t\t\n"); fprintf(file, "\t\t\n"); - /* - * Write the summary of the open ports here - */ + /* Write the summary of the open ports here */ while(ports && ports->next) { struct arglist * report; @@ -432,109 +427,103 @@ port = ports->name; report = arg_get_value(ports->value, "REPORT"); - if(report)while(report && report->next) + if(report) while(report && report->next) { - if(strlen(report->value)) - { - /* - * Convert the \n to

    - */ - desc = html_output_convert_cr_to_html(report->value); - name = html_output_portname_to_ahref("toc", hostname); - efree(&name); - fprintf(file, "\t\t

    \n\t\n"); + if(strlen(report->value)) + { + /* Convert the \n to

    */ + desc = html_output_convert_cr_to_html (report->value); + name = html_output_portname_to_ahref ("toc", hostname); + efree (&name); + fprintf (file, "\t\t

    \n\t\n"); - name = html_output_portname_to_ahref(ports->name, hostname); - fprintf(file, "\t\t\n", name, port); - efree(&name); + name = html_output_portname_to_ahref (ports->name, hostname); + fprintf (file, "\t\t\n", name, port); + efree (&name); - fprintf(file, "\t\t\n"); - efree(&desc); + fprintf (file, "\t\t\n"); + efree (&desc); + } + report = report->next; } - report = report->next; - } + info = arg_get_value(ports->value, "INFO"); if(info)while(info && info->next) - { - if(strlen(info->value)) - { - /* - * Convert the \n to

    - */ - desc = html_output_convert_cr_to_html(info->value); - name = html_output_portname_to_ahref("toc", hostname); - efree(&name); - fprintf(file, "

    \t\n\n"); + { + if(strlen(info->value)) + { + /* Convert the \n to

    */ + desc = html_output_convert_cr_to_html (info->value); + name = html_output_portname_to_ahref ("toc", hostname); + efree (&name); + fprintf (file, "

    \t\n\n"); - name = html_output_portname_to_ahref(ports->name, hostname); - fprintf(file, "\t\n", name, port); - efree(&name); - - fprintf(file, "\t\n"); - efree(&desc); - } - info = info->next; - } + name = html_output_portname_to_ahref (ports->name, hostname); + fprintf (file, "\t\n", name, port); + efree (&name); + fprintf (file, "\t\n"); + efree (&desc); + } + info = info->next; + } + false_positive = arg_get_value(ports->value, "FALSE"); if(false_positive)while(false_positive->next) { if(strlen(false_positive->value)) - { - char * name; - desc = emalloc(strlen(false_positive->value)+1); - strncpy(desc, false_positive->value, strlen(false_positive->value)); - /* - * Convert the \n to

    - */ - desc = html_output_convert_cr_to_html(false_positive->value); - name = html_output_portname_to_ahref("toc", hostname); - efree(&name); - fprintf(file, "

    \n\t\n"); + { + char * name; + /** @TODO confirm and close following memleak: */ + desc = emalloc (strlen(false_positive->value)+1); + strncpy (desc, false_positive->value, strlen(false_positive->value)); + /* Convert the \n to

    */ + desc = html_output_convert_cr_to_html (false_positive->value); + name = html_output_portname_to_ahref ("toc", hostname); + efree (&name); + fprintf (file, "

    \n\t\n"); - name = html_output_portname_to_ahref(ports->name, hostname); - fprintf(file, "\t\n", name, port); - efree(&name); + name = html_output_portname_to_ahref(ports->name, hostname); + fprintf (file, "\t\n", name, port); + efree (&name); - fprintf(file, "\t\n"); - efree(&desc); - } + fprintf (file, "\t\n"); + efree (&desc); + } false_positive = false_positive->next; } note = arg_get_value(ports->value, "NOTE"); if(note)while(note->next) - { - if(strlen(note->value)) - { - char * name; - desc = emalloc(strlen(note->value)+1); - strncpy(desc, note->value, strlen(note->value)); - /* - * Convert the \n to

    - */ - desc = html_output_convert_cr_to_html(note->value); - name = html_output_portname_to_ahref("toc", hostname); - efree(&name); - fprintf(file, "

    \n\t\n"); + { + if(strlen(note->value)) + { + char * name; + desc = emalloc (strlen(note->value)+1); + strncpy (desc, note->value, strlen(note->value)); + /* Convert the \n to

    */ + desc = html_output_convert_cr_to_html (note->value); + name = html_output_portname_to_ahref ("toc", hostname); + efree (&name); + fprintf (file, "

    \n\t\n"); - name = html_output_portname_to_ahref(ports->name, hostname); - fprintf(file, "\t\n", name, port); - efree(&name); + name = html_output_portname_to_ahref (ports->name, hostname); + fprintf (file, "\t\n", name, port); + efree (&name); - fprintf(file, "\t\n"); - efree(&desc); - } - note = note->next; - } + fprintf (file, "\t\n"); + efree (&desc); + } + note = note->next; + } ports = ports->next; } @@ -542,6 +531,7 @@ fprintf(file, "
    Port/ServiceIssue regarding Port
    %s%sSecurity warning(s) found
    False positive(s) found
    Security note(s) found
    %s%sNo Information
    PortIssue and Fix
    Vulnerability
    Vulnerability%s%s"); - html_output_print_data_with_links(file, desc, report->name, FALSE); - fprintf(file, "\t
    "); + html_output_print_data_with_links (file, desc, report->name, FALSE); + fprintf (file, "\t
    Warning
    Warning%s"); - html_output_print_data_with_links(file, desc, info->name, FALSE); - fprintf(file, "
    %s"); + html_output_print_data_with_links (file, desc, info->name, FALSE); + fprintf (file, "
    Informational
    Informational%s%s"); - html_output_print_data_with_links(file, desc, false_positive->name, FALSE); - fprintf(file, "
    "); + html_output_print_data_with_links (file, desc, false_positive->name, FALSE); + fprintf (file, "
    Informational
    Informational%s%s"); - html_output_print_data_with_links(file, desc, note->name, FALSE); - fprintf(file, "
    "); + html_output_print_data_with_links (file, desc, note->name, FALSE); + fprintf (file, "
    \n"); hosts = hosts->next; } + fprintf(file, "
    \n"); fprintf(file, "This file was generated by the "); fprintf(file, "OpenVAS security scanner.\n"); @@ -551,11 +541,9 @@ return(0); } - void summary_to_file (FILE *file, struct arglist *hosts) { - fprintf(file, "\n"); fprintf(file, "\n"); fprintf(file, " \n"); @@ -607,9 +595,7 @@ fprintf(file, "\n"); - /* - * Write a (small) summary Hosts that are up, holes/warnings ect. - */ + /* Write a (small) summary Hosts that are up, holes/warnings ect. */ fprintf(file, "\n"); fprintf(file, "
    \n"); fprintf(file, " \n \n"); @@ -639,5 +625,4 @@ fprintf(file, " \n \n\t\n"); fprintf(file, " \n\t\n"); fprintf(file, "\t\n"); - } From scm-commit at wald.intevation.org Thu Jul 2 12:28:57 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Thu, 2 Jul 2009 12:28:57 +0200 (CEST) Subject: [Openvas-commits] r3905 - branches/openvas-client-2-0 Message-ID: <20090702102857.0F0B77A160@pyrosoma.intevation.org> Author: felix Date: 2009-07-02 12:28:56 +0200 (Thu, 02 Jul 2009) New Revision: 3905 Modified: branches/openvas-client-2-0/ChangeLog Log: Reverted unwanted ChangeLog change. Modified: branches/openvas-client-2-0/ChangeLog =================================================================== --- branches/openvas-client-2-0/ChangeLog 2009-07-02 10:24:33 UTC (rev 3904) +++ branches/openvas-client-2-0/ChangeLog 2009-07-02 10:28:56 UTC (rev 3905) @@ -2,7 +2,13 @@ * nessus/html_output.c: Cosmetics, documentation, added TODO about possible memory leak. + +2009-06-10 Felix Wolfsteller + * nessus/preferences.c (preferences_new): + Set default value of plugins_timeout parameter to 320 (as in the + servers default). + 2009-06-10 Felix Wolfsteller Enabled storing and recovering of Global Timeout Settings, added From scm-commit at wald.intevation.org Thu Jul 2 12:41:59 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Thu, 2 Jul 2009 12:41:59 +0200 (CEST) Subject: [Openvas-commits] r3906 - in branches/openvas-client-2-0: . nessus Message-ID: <20090702104159.271717A14E@pyrosoma.intevation.org> Author: felix Date: 2009-07-02 12:41:58 +0200 (Thu, 02 Jul 2009) New Revision: 3906 Modified: branches/openvas-client-2-0/ChangeLog branches/openvas-client-2-0/nessus/html_output.c Log: * nessus/html_output.c (arglist_to_html): Fixed mem leak (the malloced memory for desc was never read, html_output_convert_cr_to_html will allocated new mem), removed associated TODO comment. Modified: branches/openvas-client-2-0/ChangeLog =================================================================== --- branches/openvas-client-2-0/ChangeLog 2009-07-02 10:28:56 UTC (rev 3905) +++ branches/openvas-client-2-0/ChangeLog 2009-07-02 10:41:58 UTC (rev 3906) @@ -1,5 +1,12 @@ 2009-07-02 Felix Wolfsteller + * nessus/html_output.c (arglist_to_html): + Fixed mem leak (the malloced memory for desc was never read, + html_output_convert_cr_to_html will allocated new mem), removed + associated TODO comment. + +2009-07-02 Felix Wolfsteller + * nessus/html_output.c: Cosmetics, documentation, added TODO about possible memory leak. Modified: branches/openvas-client-2-0/nessus/html_output.c =================================================================== --- branches/openvas-client-2-0/nessus/html_output.c 2009-07-02 10:28:56 UTC (rev 3905) +++ branches/openvas-client-2-0/nessus/html_output.c 2009-07-02 10:41:58 UTC (rev 3906) @@ -478,9 +478,6 @@ if(strlen(false_positive->value)) { char * name; - /** @TODO confirm and close following memleak: */ - desc = emalloc (strlen(false_positive->value)+1); - strncpy (desc, false_positive->value, strlen(false_positive->value)); /* Convert the \n to

    */ desc = html_output_convert_cr_to_html (false_positive->value); name = html_output_portname_to_ahref ("toc", hostname); From scm-commit at wald.intevation.org Thu Jul 2 12:58:47 2009 From: scm-commit at wald.intevation.org (scm-commit@wald.intevation.org) Date: Thu, 2 Jul 2009 12:58:47 +0200 (CEST) Subject: [Openvas-commits] r3907 - in branches/openvas-client-2-0: . nessus Message-ID: <20090702105847.2C9DF7A15D@pyrosoma.intevation.org> Author: felix Date: 2009-07-02 12:58:46 +0200 (Thu, 02 Jul 2009) New Revision: 3907 Modified: branches/openvas-client-2-0/ChangeLog branches/openvas-client-2-0/nessus/backend.c Log: * nessus/backend.c: Cosmetics, docs. Modified: branches/openvas-client-2-0/ChangeLog =================================================================== --- branches/openvas-client-2-0/ChangeLog 2009-07-02 10:41:58 UTC (rev 3906) +++ branches/openvas-client-2-0/ChangeLog 2009-07-02 10:58:46 UTC (rev 3907) @@ -1,5 +1,10 @@ 2009-07-02 Felix Wolfsteller + * nessus/backend.c: + Cosmetics, docs. + +2009-07-02 Felix Wolfsteller + * nessus/html_output.c (arglist_to_html): Fixed mem leak (the malloced memory for desc was never read, html_output_convert_cr_to_html will allocated new mem), removed Modified: branches/openvas-client-2-0/nessus/backend.c =================================================================== --- branches/openvas-client-2-0/nessus/backend.c 2009-07-02 10:41:58 UTC (rev 3906) +++ branches/openvas-client-2-0/nessus/backend.c 2009-07-02 10:58:46 UTC (rev 3907) @@ -26,13 +26,13 @@ * do so, delete this exception statement from your version. */ -/** +/** @file * If we want to scan big networks, nothing should be kept in memory * but be stored on disk instead. This also makes the link with * a database much easier. * * "As-is", this modules generates a flat file which is queried as a DB. - * Users who deal with a huge number of hosts should consider installing + * Users who deal with a huge number of hosts should consider developing * a MySQL module. */ @@ -51,11 +51,11 @@ struct backend backends[MAX_TMPFILES]; - /** * @brief Prints info to stdout when BACKEND_DEBUG is defined. */ -void be_info(int be, const char * str) +void +be_info (int be, const char * str) { #ifdef BACKEND_DEBUG printf("%s(%d) disposable:%d, fd:%d, %s\n", @@ -71,7 +71,6 @@ Monitoring functions ----------------------------------------------------------------------*/ - /** * @return -1 in case of error(s). */ @@ -81,7 +80,7 @@ char * tmpfile; int i = 0; char * tmpdir; - + while((backends[i].fname) && (i= 0 ) @@ -205,7 +204,7 @@ { fprintf(stderr, "backend_insert: some arguments are NULL\n"); return -1; - } + } lseek(backends[be].fd, 0, SEEK_END); data = addslashes(data); @@ -303,205 +302,212 @@ struct arglist* backend_convert (int be) { - harglst * hhosts; - FILE * fd = fopen(backends[be].fname, "r"); - char buf[65535]; - char * current_hostname = NULL; - struct arglist* current_host = NULL; - struct arglist* nhosts = NULL; - char * key; - int line = 0; - unsigned x; + harglst * hhosts; + FILE * fd = fopen (backends[be].fname, "r"); + char buf[65535]; + char * current_hostname = NULL; + struct arglist* current_host = NULL; + struct arglist* nhosts = NULL; + char * key; + int line = 0; + unsigned x; - if(!fd) - { - perror("fopen "); - return NULL; - } - - hhosts = harg_create(65000); - bzero(buf, sizeof(buf)); - - while(fgets(buf, sizeof(buf) - 1, fd) && !feof(fd)) - { - char * buffer = NULL; - struct arglist * host = NULL; - struct arglist * ports = NULL; - struct arglist * port = NULL; - struct arglist * content = NULL; - char * hostname; - char * t; - char * t2; - char * id = NULL; - char * p = NULL; - - - line++; - - /* remove trailing \n */ - buf[strlen(buf) - 1] = '\0'; - - /* skip lines that are not */ - if(strncmp (buf, "results", - strlen("results"))) /* RATS: ignore, string literal is always nul- terminated */ - continue; - - /* "validate the nbe", as it has to have three '|'s */ - t = strchr(buf, '|'); - if(!t)goto parse_error; - - t = strchr(t+1, '|'); - if(!t)goto parse_error; - - hostname = &(t[1]); - t = strchr(t+1, '|'); - if(!t)goto parse_error; - - t[0] = '\0'; - - if(!current_hostname || strcmp(current_hostname, hostname)) - { - host = harg_get_ptr(hhosts, hostname); - if(!host) + if (!fd) { - current_host = host = emalloc(sizeof(struct arglist)); - if(current_hostname) efree(¤t_hostname); - current_hostname = estrdup(hostname); - harg_add_ptr(hhosts, hostname, host); + perror ("fopen "); + return NULL; } - else - { - current_host = host; - if(current_hostname)efree(¤t_hostname); - current_hostname = estrdup(hostname); - } - } - else + + hhosts = harg_create (65000); + bzero (buf, sizeof(buf)); + + while (fgets(buf, sizeof(buf) - 1, fd) && !feof(fd)) { - host = current_host; - } - - t += sizeof(char); - /* - * |

    Host List
    Host(s)Possible Issue