[Openvas-commits] r9395 - in branches/openvas-cli-1-0: . omp

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 12 10:20:04 CET 2010


Author: mwiegand
Date: 2010-11-12 10:20:02 +0100 (Fri, 12 Nov 2010)
New Revision: 9395

Modified:
   branches/openvas-cli-1-0/CMakeLists.txt
   branches/openvas-cli-1-0/ChangeLog
   branches/openvas-cli-1-0/omp/CMakeLists.txt
   branches/openvas-cli-1-0/omp/omp.c
Log:
Make sure openvas-cli builds with openvas-libraries =< 3.1.4 as well
  as newer versions by setting the includes based on the
  openvas-libraries version.

  * CMakeLists.txt: Check openvas-libraries version and set
  LIBOPENVAS_OLD_INCLUDE_PATH if the old include paths should be used.

  * src/CMakeLists.txt: Handle setting of LIBOPENVAS_OLD_INCLUDE_PATH.

  * omp/omp.c: Check if LIBOPENVAS_OLD_INCLUDE_PATH is defined when
  including headers originating from openvas-libraries/misc.
  (manager_get_reports): Adjust call to omp_get_report () based on
  libraries version so openvas-cli 1.0.x builds with openvas-libraries
  >= 3.2.0 as well.


Modified: branches/openvas-cli-1-0/CMakeLists.txt
===================================================================
--- branches/openvas-cli-1-0/CMakeLists.txt	2010-11-12 08:37:49 UTC (rev 9394)
+++ branches/openvas-cli-1-0/CMakeLists.txt	2010-11-12 09:20:02 UTC (rev 9395)
@@ -188,6 +188,24 @@
   if (LO_MAJOR_VER_FAIL OR LO_MINOR_VER_FAIL OR LO_PATCH_VER_FAIL)
     message (FATAL_ERROR "openvas-libraries version >= ${LO_MAJOR_MIN_VER}.${LO_MINOR_MIN_VER}.${LO_PATCH_MIN_VER} not found.")
   endif (LO_MAJOR_VER_FAIL OR LO_MINOR_VER_FAIL OR LO_PATCH_VER_FAIL)
+
+  # Check if openvas-libraries < 3.2.0, in which case we have to use the old include paths.
+  # Can be removed once we require openvas-libraries >= 3.2.0 above.
+  set (LO_MAJOR_VER_OLD FALSE)
+  set (LO_MINOR_VER_OLD FALSE)
+  set (LO_PATCH_VER_OLD FALSE)
+  if (${LO_MAJOR_VER} LESS 3)
+    set (LO_MAJOR_VER_OLD TRUE)
+  endif (${LO_MAJOR_VER} LESS 3)
+  if (${LO_MAJOR_VER} EQUAL 3 AND ${LO_MINOR_VER} LESS 2)
+    set (LO_MINOR_VER_OLD TRUE)
+  endif (${LO_MAJOR_VER} EQUAL 3 AND ${LO_MINOR_VER} LESS 2)
+  if (${LO_MAJOR_VER} EQUAL 3 AND ${LO_MINOR_VER} EQUAL 2 AND ${LO_PATCH_VER} LESS 0)
+    set (LO_PATCH_VER_OLD TRUE)
+  endif (${LO_MAJOR_VER} EQUAL 3 AND ${LO_MINOR_VER} EQUAL 2 AND ${LO_PATCH_VER} LESS 0)
+  if (LO_MAJOR_VER_OLD OR LO_MINOR_VER_OLD OR LO_PATCH_VER_OLD)
+    set (LO_OLD_INCLUDE_PATH TRUE)
+  endif (LO_MAJOR_VER_OLD OR LO_MINOR_VER_OLD OR LO_PATCH_VER_OLD)
 else (PATH_TO_LIBOPENVASCONFIG)
    message (FATAL_ERROR "Could not determine openvas-libraries version.")
 endif (PATH_TO_LIBOPENVASCONFIG)

Modified: branches/openvas-cli-1-0/ChangeLog
===================================================================
--- branches/openvas-cli-1-0/ChangeLog	2010-11-12 08:37:49 UTC (rev 9394)
+++ branches/openvas-cli-1-0/ChangeLog	2010-11-12 09:20:02 UTC (rev 9395)
@@ -1,3 +1,20 @@
+2010-11-12  Michael Wiegand <michael.wiegand at greenbone.net>
+
+	Make sure openvas-cli builds with openvas-libraries =< 3.1.4 as well
+	as newer versions by setting the includes based on the
+	openvas-libraries version.
+
+	* CMakeLists.txt: Check openvas-libraries version and set
+	LIBOPENVAS_OLD_INCLUDE_PATH if the old include paths should be used.
+
+	* src/CMakeLists.txt: Handle setting of LIBOPENVAS_OLD_INCLUDE_PATH.
+
+	* omp/omp.c: Check if LIBOPENVAS_OLD_INCLUDE_PATH is defined when
+	including headers originating from openvas-libraries/misc.
+	(manager_get_reports): Adjust call to omp_get_report () based on
+	libraries version so openvas-cli 1.0.x builds with openvas-libraries
+	>= 3.2.0 as well.
+
 2010-10-27  Michael Wiegand <michael.wiegand at greenbone.net>
 
 	Post release version bump.

Modified: branches/openvas-cli-1-0/omp/CMakeLists.txt
===================================================================
--- branches/openvas-cli-1-0/omp/CMakeLists.txt	2010-11-12 08:37:49 UTC (rev 9394)
+++ branches/openvas-cli-1-0/omp/CMakeLists.txt	2010-11-12 09:20:02 UTC (rev 9395)
@@ -72,6 +72,10 @@
   add_definitions (-DOPENVAS_LOG_DIR=\\\"${OPENVAS_LOG_DIR}\\\")
 endif (OPENVAS_LOG_DIR)
 
+if (LO_OLD_INCLUDE_PATH)
+  add_definitions (-DLIBOPENVAS_OLD_INCLUDE_PATH)
+endif (LO_OLD_INCLUDE_PATH)
+
 if (MINGW)
   set (GLIB_LDFLAGS "-L${CROSS_ENV}/lib")
   set (OPENVAS_LDFLAGS "-L${CMAKE_INSTALL_PREFIX}/lib")

Modified: branches/openvas-cli-1-0/omp/omp.c
===================================================================
--- branches/openvas-cli-1-0/omp/omp.c	2010-11-12 08:37:49 UTC (rev 9394)
+++ branches/openvas-cli-1-0/omp/omp.c	2010-11-12 09:20:02 UTC (rev 9395)
@@ -53,13 +53,21 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef LIBOPENVAS_OLD_INCLUDE_PATH
 #include <openvas/openvas_server.h>
+#else
+#include <openvas/misc/openvas_server.h>
+#endif
 #ifdef _WIN32
 #include <winsock2.h>
 #endif
 #ifndef _WIN32
+#ifdef LIBOPENVAS_OLD_INCLUDE_PATH
 #include <openvas/openvas_logging.h>
+#else
+#include <openvas/misc/openvas_logging.h>
 #endif
+#endif
 #include <openvas/omp/omp.h>
 #include <openvas/omp/xml.h>
 
@@ -365,7 +373,11 @@
     {
       entity_t entity, report_xml;
 
-      if (omp_get_report (&(connection->session), *report_ids, "xml", &entity))
+      if (omp_get_report (&(connection->session), *report_ids, "xml",
+#ifndef LIBOPENVAS_OLD_INCLUDE_PATH
+                          0,
+#endif
+                          &entity))
         {
           fprintf (stderr, "Failed to get report.\n");
           manager_close (connection);



More information about the Openvas-commits mailing list