git: 0898eafb807f - main - security/gvm-libs: update to 22.4.0

From: Jose Alonso Cardenas Marquez <acm_at_FreeBSD.org>
Date: Mon, 01 Aug 2022 18:53:33 UTC
The branch main has been updated by acm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0898eafb807f2779d3efb03c861f3e532664c1e2

commit 0898eafb807f2779d3efb03c861f3e532664c1e2
Author:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
AuthorDate: 2022-08-01 18:38:43 +0000
Commit:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
CommitDate: 2022-08-01 18:41:44 +0000

    security/gvm-libs: update to 22.4.0
    
    ChangeLog at:   https://github.com/greenbone/gvm-libs/releases/tag/v22.4.0
---
 security/gvm-libs/Makefile                  |  7 ++--
 security/gvm-libs/distinfo                  |  6 +--
 security/gvm-libs/files/patch-base_hosts.c  | 57 +++++++++++------------------
 security/gvm-libs/files/patch-boreas_ping.c | 41 +++++++++++----------
 security/gvm-libs/files/patch-osp_osp.c     | 26 ++++++++-----
 security/gvm-libs/pkg-plist                 | 22 ++++++-----
 6 files changed, 79 insertions(+), 80 deletions(-)

diff --git a/security/gvm-libs/Makefile b/security/gvm-libs/Makefile
index abf9d4fa6e5d..595433d5bb5a 100644
--- a/security/gvm-libs/Makefile
+++ b/security/gvm-libs/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	gvm
-DISTVERSION=	21.4.4
-PORTREVISION=	1
+DISTVERSION=	22.4.0
 DISTVERSIONPREFIX=	v
 CATEGORIES=	security
 PKGNAMESUFFIX=	-libs
@@ -19,7 +18,8 @@ LIB_DEPENDS=	libassuan.so:security/libassuan \
 		libssh.so:security/libssh \
 		libhiredis.so:databases/hiredis \
 		libnet.so:net/libnet \
-		libgcrypt.so:security/libgcrypt
+		libgcrypt.so:security/libgcrypt \
+		libpaho-mqtt3a.so:net/libpaho-mqtt3
 RUN_DEPENDS=	doxygen>0:devel/doxygen
 
 USE_GITHUB=	yes
@@ -42,5 +42,6 @@ RADIUS_LIB_DEPENDS=	libfreeradius-client.so:net/freeradius-client
 post-patch:
 	@${REINPLACE_CMD} -e 's|2.25.0|1.45.6|g' ${WRKSRC}/util/libgvm_util.pc.in
 	@${REINPLACE_CMD} -e 's|uuid>=2.25.0|uuid>=1.45.6|g' ${WRKSRC}/util/CMakeLists.txt
+	@${REINPLACE_CMD} '31d' ${WRKSRC}/base/proctitle.c
 
 .include <bsd.port.mk>
diff --git a/security/gvm-libs/distinfo b/security/gvm-libs/distinfo
index e02b2cb41ad9..fc932bb79794 100644
--- a/security/gvm-libs/distinfo
+++ b/security/gvm-libs/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1651424691
-SHA256 (greenbone-gvm-libs-v21.4.4_GH0.tar.gz) = 119e61725c64cbff24c67f47e85463eb6f508f3ece4455da186ac28c29af96b2
-SIZE (greenbone-gvm-libs-v21.4.4_GH0.tar.gz) = 298551
+TIMESTAMP = 1659306967
+SHA256 (greenbone-gvm-libs-v22.4.0_GH0.tar.gz) = 568ca642d9e616c27be128041acb0764022e8eebe5b43a6f96e82e4527734da5
+SIZE (greenbone-gvm-libs-v22.4.0_GH0.tar.gz) = 308302
diff --git a/security/gvm-libs/files/patch-base_hosts.c b/security/gvm-libs/files/patch-base_hosts.c
index 20cdbd489f1a..45a12c4a803d 100644
--- a/security/gvm-libs/files/patch-base_hosts.c
+++ b/security/gvm-libs/files/patch-base_hosts.c
@@ -1,61 +1,48 @@
---- base/hosts.c	2021-10-11 09:38:23.000000000 -0500
-+++ base/hosts.c	2021-10-27 21:07:36.955872000 -0500
-@@ -34,11 +34,11 @@
+--- base/hosts.c	2022-07-18 03:40:56.000000000 -0500
++++ base/hosts.c	2022-07-31 17:50:48.439636000 -0500
+@@ -34,7 +34,11 @@
  #include <arpa/inet.h> /* for inet_pton, inet_ntop */
  #include <assert.h>    /* for assert */
  #include <ctype.h>     /* for isdigit */
--#include <malloc.h>
++#if defined(__FreeBSD__)
++#include <malloc_np.h>
++#else
+ #include <malloc.h>
++#endif
  #include <netdb.h>      /* for getnameinfo, NI_NAMEREQD */
  #include <stdint.h>     /* for uint8_t, uint32_t */
  #include <stdio.h>      /* for sscanf, perror */
- #include <stdlib.h>     /* for strtol, atoi */
-+#include <malloc_np.h>
- #include <string.h>     /* for strchr, memcpy, memcmp, bzero, strcasecmp */
- #include <sys/socket.h> /* for AF_INET, AF_INET6, sockaddr */
- 
-@@ -1092,7 +1092,7 @@
-   hosts->count -= duplicates;
-   hosts->duplicated += duplicates;
-   hosts->current = 0;
--  malloc_trim (0);
-+ // malloc_trim (0);
- }
- 
- /**
-@@ -1287,7 +1287,7 @@
-     gvm_hosts_deduplicate (hosts);
- 
-   g_strfreev (split);
--  malloc_trim (0);
-+  //malloc_trim (0);
-   return hosts;
- }
- 
-@@ -1467,8 +1467,8 @@
+@@ -1472,8 +1476,13 @@
            gvm_vhost_t *vhost;
  
            new = gvm_host_new ();
--          if (ip6->s6_addr32[0] != 0 || ip6->s6_addr32[1] != 0
--              || ip6->s6_addr32[2] != htonl (0xffff))
-+          if (ip6->s6_addr[0] != 0 || ip6->s6_addr[1] != 0
++#if defined(__FreeBSD__)
++	  if (ip6->s6_addr[0] != 0 || ip6->s6_addr[1] != 0
 +              || ip6->s6_addr[2] != 0xff)
++#else
+           if (ip6->s6_addr32[0] != 0 || ip6->s6_addr32[1] != 0
+               || ip6->s6_addr32[2] != htonl (0xffff))
++#endif
              {
                new->type = HOST_TYPE_IPV6;
                memcpy (&new->addr6, ip6, sizeof (new->addr6));
-@@ -1476,7 +1476,7 @@
+@@ -1481,7 +1490,11 @@
            else
              {
                new->type = HOST_TYPE_IPV4;
--              memcpy (&new->addr6, &ip6->s6_addr32[3], sizeof (new->addr));
++#if defined(__FreeBSD__)
 +              memcpy (&new->addr6, &ip6->s6_addr[12], sizeof (new->addr));
++#else
+               memcpy (&new->addr6, &ip6->s6_addr32[3], sizeof (new->addr));
++#endif
              }
            vhost =
              gvm_vhost_new (g_strdup (host->name), g_strdup ("Forward-DNS"));
-@@ -2034,7 +2034,11 @@
+@@ -2040,7 +2053,11 @@
        ret->addr.s_addr = host->addr.s_addr;
        break;
      case HOST_TYPE_IPV6:
-+#if defined (__FreeBSD__)
++#if defined(__FreeBSD__)
 +      ret->addr6.__u6_addr = host->addr6.__u6_addr;
 +#else
        ret->addr6.__in6_u = host->addr6.__in6_u;
diff --git a/security/gvm-libs/files/patch-boreas_ping.c b/security/gvm-libs/files/patch-boreas_ping.c
index 6672c778a132..282c6b22e380 100644
--- a/security/gvm-libs/files/patch-boreas_ping.c
+++ b/security/gvm-libs/files/patch-boreas_ping.c
@@ -1,6 +1,6 @@
---- boreas/ping.c	2021-04-15 09:22:56.000000000 -0500
-+++ boreas/ping.c	2021-06-14 19:24:32.398090000 -0500
-@@ -26,9 +26,13 @@
+--- boreas/ping.c	2022-07-18 03:40:56.000000000 -0500
++++ boreas/ping.c	2022-07-31 17:59:55.449717000 -0500
+@@ -27,9 +27,13 @@
  #include <errno.h>
  #include <glib.h>
  #include <ifaddrs.h> /* for getifaddrs() */
@@ -14,7 +14,7 @@
  #include <netinet/ip6.h>
  #include <netinet/ip_icmp.h>
  #include <netinet/tcp.h>
-@@ -36,7 +40,6 @@
+@@ -37,7 +41,6 @@
  #include <sys/ioctl.h>
  #include <sys/socket.h>
  #include <sys/time.h>
@@ -22,7 +22,7 @@
  #include <unistd.h>
  
  #undef G_LOG_DOMAIN
-@@ -105,7 +108,11 @@
+@@ -106,7 +109,11 @@
    int cur_so_sendbuf = -1;
  
    /* Get the current size of the output queue size */
@@ -34,7 +34,7 @@
      {
        g_warning ("%s: ioctl error: %s", __func__, strerror (errno));
        usleep (100000);
-@@ -121,7 +128,11 @@
+@@ -122,7 +129,11 @@
        while (cur_so_sendbuf >= so_sndbuf)
          {
            usleep (100000);
@@ -46,7 +46,7 @@
              {
                g_warning ("%s: ioctl error: %s", __func__, strerror (errno));
                usleep (100000);
-@@ -208,12 +219,23 @@
+@@ -209,12 +220,22 @@
    static int init = -1;
  
    icmp = (struct icmphdr *) sendbuf;
@@ -58,7 +58,6 @@
    icmp->code = 0;
 +#endif
  
-+
    len = 8 + datalen;
 +#ifdef __FreeBSD__
 +  icmp->icmp_cksum = 0;
@@ -70,19 +69,20 @@
  
    memset (&soca, 0, sizeof (soca));
    soca.sin_family = AF_INET;
-@@ -276,7 +298,11 @@
-     }
-   else
-     {
+@@ -287,7 +308,11 @@
+         }
+       else
+         {
+-          dst4.s_addr = dst6_p->s6_addr32[3];
 +#ifdef __FreeBSD__
 +      dst4.s_addr = dst6_p->s6_addr[12];
 +#else
-       dst4.s_addr = dst6_p->s6_addr32[3];
++      dst4.s_addr = dst6_p->s6_addr32[3];
 +#endif
-       send_icmp_v4 (scanner->icmpv4soc, dst4_p);
-     }
- }
-@@ -538,7 +564,11 @@
+           send_icmp_v4 (scanner->icmpv4soc, dst4_p);
+         }
+       if (grace_period > 0)
+@@ -552,7 +577,11 @@
      }
    else
      {
@@ -94,12 +94,15 @@
        send_tcp_v4 (scanner, dst4_p);
      }
  }
-@@ -588,7 +618,7 @@
+@@ -602,7 +631,11 @@
        /* Need to transform the IPv6 mapped IPv4 address back to an IPv4 string.
         * We can not just use the host_value_str as it might be an IPv4 mapped
         * IPv6 string. */
--      if (inet_ntop (AF_INET, &(dst6_p->s6_addr32[3]), ipv4_str,
++#if defined(__FreeBSD__)
 +      if (inet_ntop (AF_INET, &(dst6_p->s6_addr[12]), ipv4_str,
++#else
+       if (inet_ntop (AF_INET, &(dst6_p->s6_addr32[3]), ipv4_str,
++#endif
                       sizeof (ipv4_str))
            == NULL)
          {
diff --git a/security/gvm-libs/files/patch-osp_osp.c b/security/gvm-libs/files/patch-osp_osp.c
index a9cae258b0e4..a7ccd18fce69 100644
--- a/security/gvm-libs/files/patch-osp_osp.c
+++ b/security/gvm-libs/files/patch-osp_osp.c
@@ -1,22 +1,28 @@
---- osp/osp.c	2021-01-03 15:42:39.761321000 -0500
-+++ osp/osp.c	2021-01-03 15:48:50.962832000 -0500
-@@ -134,7 +134,6 @@
+--- osp/osp.c	2022-07-18 03:40:56.000000000 -0500
++++ osp/osp.c	2022-07-31 18:21:56.704338000 -0500
+@@ -141,7 +141,9 @@
    if (host && *host == '/')
      {
        struct sockaddr_un addr;
--      int len;
++#if !defined(__FreeBSD__)
+       int len;
++#endif
  
        connection = g_malloc0 (sizeof (*connection));
        connection->socket = socket (AF_UNIX, SOCK_STREAM, 0);
-@@ -142,9 +141,8 @@
-         return NULL;
+@@ -152,10 +154,15 @@
+         }
  
        addr.sun_family = AF_UNIX;
--      strncpy (addr.sun_path, host, sizeof (addr.sun_path) - 1);
--      len = strlen (addr.sun_path) + sizeof (addr.sun_family);
--      if (connect (connection->socket, (struct sockaddr *) &addr, len) == -1)
++#if defined (__FreeBSD__)
 +      strcpy (addr.sun_path, host);
 +      if (connect (connection->socket, (struct sockaddr *) &addr, sizeof(struct sockaddr_un)) == -1)
++#else
+       memset (addr.sun_path, 0, sizeof (addr.sun_path));
+       memcpy (addr.sun_path, host, sizeof (addr.sun_path) - 1);
+       len = strlen (addr.sun_path) + sizeof (addr.sun_family);
+       if (connect (connection->socket, (struct sockaddr *) &addr, len) == -1)
++#endif
          {
            close (connection->socket);
-           return NULL;
+           g_free (connection);
diff --git a/security/gvm-libs/pkg-plist b/security/gvm-libs/pkg-plist
index 07a6321d3b1c..289b7c62214d 100644
--- a/security/gvm-libs/pkg-plist
+++ b/security/gvm-libs/pkg-plist
@@ -2,6 +2,7 @@ include/gvm/base/array.h
 include/gvm/base/credentials.h
 include/gvm/base/cvss.h
 include/gvm/base/drop_privileges.h
+include/gvm/base/gvm_sentry.h
 include/gvm/base/hosts.h
 include/gvm/base/logging.h
 include/gvm/base/networking.h
@@ -29,6 +30,7 @@ include/gvm/util/fileutils.h
 include/gvm/util/gpgmeutils.h
 include/gvm/util/kb.h
 include/gvm/util/ldaputils.h
+include/gvm/util/mqtt.h
 include/gvm/util/nvticache.h
 include/gvm/util/passwordbasedauthentication.h
 include/gvm/util/radiusutils.h
@@ -37,20 +39,20 @@ include/gvm/util/sshutils.h
 include/gvm/util/uuidutils.h
 include/gvm/util/xmlutils.h
 lib/libgvm_base.so
-lib/libgvm_base.so.21
-lib/libgvm_base.so.21.4.4
+lib/libgvm_base.so.22
+lib/libgvm_base.so.22.4.0
 lib/libgvm_boreas.so
-lib/libgvm_boreas.so.21
-lib/libgvm_boreas.so.21.4.4
+lib/libgvm_boreas.so.22
+lib/libgvm_boreas.so.22.4.0
 lib/libgvm_gmp.so
-lib/libgvm_gmp.so.21
-lib/libgvm_gmp.so.21.4.4
+lib/libgvm_gmp.so.22
+lib/libgvm_gmp.so.22.4.0
 lib/libgvm_osp.so
-lib/libgvm_osp.so.21
-lib/libgvm_osp.so.21.4.4
+lib/libgvm_osp.so.22
+lib/libgvm_osp.so.22.4.0
 lib/libgvm_util.so
-lib/libgvm_util.so.21
-lib/libgvm_util.so.21.4.4
+lib/libgvm_util.so.22
+lib/libgvm_util.so.22.4.0
 libdata/pkgconfig/libgvm_base.pc
 libdata/pkgconfig/libgvm_boreas.pc
 libdata/pkgconfig/libgvm_gmp.pc