Hello community,

here is the log from the commit of package arpwatch for openSUSE:Factory 
checked in at 2019-02-08 12:14:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/arpwatch (Old)
 and      /work/SRC/openSUSE:Factory/.arpwatch.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "arpwatch"

Fri Feb  8 12:14:50 2019 rev:27 rq:672504 version:2.1a15

Changes:
--------
--- /work/SRC/openSUSE:Factory/arpwatch/arpwatch.changes        2017-11-24 
10:54:16.708705966 +0100
+++ /work/SRC/openSUSE:Factory/.arpwatch.new.28833/arpwatch.changes     
2019-02-08 12:14:56.777434598 +0100
@@ -1,0 +2,12 @@
+Thu Feb  7 12:21:45 UTC 2019 - [email protected]
+
+- One %service_* call for all service files
+
+-------------------------------------------------------------------
+Tue Feb  5 12:25:15 UTC 2019 - [email protected]
+
+- added getnameinfo.patch to prevent memory leak in gethname
+  (bsc#1119851)
+- %service_* invocations for [email protected]
+
+-------------------------------------------------------------------

New:
----
  getnameinfo.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ arpwatch.spec ++++++
--- /var/tmp/diff_new_pack.PBjpHT/_old  2019-02-08 12:14:57.965434152 +0100
+++ /var/tmp/diff_new_pack.PBjpHT/_new  2019-02-08 12:14:57.973434150 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package arpwatch
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -40,6 +40,7 @@
 Patch6:         arpwatch-2.1a11-drop-privs.dif
 Patch7:         arpwatch-2.1a11-emailaddr.dif
 Patch8:         arpwatch-2.1a15-massagevendor.patch
+Patch9:         getnameinfo.patch
 BuildRequires:  libpcap-devel
 BuildRequires:  postfix
 BuildRequires:  systemd-rpm-macros
@@ -70,6 +71,7 @@
 %patch6 -p1 -E
 %patch7 -p1 -E
 %patch8 -p1
+%patch9 -p1
 
 %build
 %configure
@@ -102,18 +104,18 @@
 EOF
 
 %pre
-%service_add_pre arpwatch.service
+%service_add_pre arpwatch.service [email protected]
 
 %preun
-%service_del_preun arpwatch.service
+%service_del_preun arpwatch.service [email protected]
 
 %post
-%service_add_post arpwatch.service
+%service_add_post arpwatch.service [email protected]
 %fillup_only
 %tmpfiles_create %{_tmpfilesdir}/arpwatch.conf
 
 %postun
-%service_del_postun arpwatch.service
+%service_del_postun arpwatch.service [email protected]
 
 %files
 %{_unitdir}/arpwatch.service

++++++ getnameinfo.patch ++++++
Index: arpwatch-2.1a15/db.c
===================================================================
--- arpwatch-2.1a15.orig/db.c   2019-01-22 13:34:02.942536296 +0100
+++ arpwatch-2.1a15/db.c        2019-01-22 13:38:54.099329959 +0100
@@ -269,6 +269,7 @@ elist_alloc(register u_int32_t a, regist
        register u_int size;
        static struct einfo *elist = NULL;
        static int eleft = 0;
+       char free_hostname = 0;
 
        if (eleft <= 0) {
                /* Allocate some more */
@@ -285,12 +286,16 @@ elist_alloc(register u_int32_t a, regist
        ep = elist++;
        --eleft;
        BCOPY(e, ep->e, 6);
-       if (h == NULL && !initializing)
+       if (h == NULL && !initializing) {
                h = getsname(a);
+               free_hostname = 1;
+       }
        if (h != NULL && !isdigit((int)*h)) {
                memset(ep->h, 0, sizeof(ep->h));
                strncpy(ep->h, h, sizeof(ep->h)-1);
        }
+       if (free_hostname)
+           free(h);
        ep->t = t;
        return (ep);
 }
@@ -313,6 +318,7 @@ check_hname(register struct ainfo *ap)
                memset(ep->h, 0, sizeof(ep->h));
                strncpy(ep->h, h, sizeof(ep->h)-1);
        }
+       free(h);
 }
 
 int
Index: arpwatch-2.1a15/dns.c
===================================================================
--- arpwatch-2.1a15.orig/dns.c  2000-10-14 03:50:52.000000000 +0200
+++ arpwatch-2.1a15/dns.c       2019-01-22 13:39:31.043941461 +0100
@@ -137,24 +137,30 @@ gethinfo(register char *hostname, regist
        return (0);
 }
 
-/* Return the cannonical name of the host */
+/* Return the cannonical name of the host
+   Returned value needs to be free'd
+*/
 char *
 gethname(u_int32_t a)
 {
-       register int32_t options;
-       register struct hostent *hp;
+       struct sockaddr_in sa;
+       char node[NI_MAXHOST];
+       struct in_addr addr;
 
-       options = _res.options;
-       _res.options |= RES_AAONLY;
-       _res.options &= ~(RES_DEFNAMES | RES_DNSRCH);
-       hp = gethostbyaddr((char *)&a, sizeof(a), AF_INET);
-       _res.options = options;
-       if (hp == NULL)
-               return (intoa(a));
-       return (hp->h_name);
+       addr.s_addr   = a;
+       sa.sin_family = AF_INET;
+       sa.sin_addr   = addr;
+
+       int res = getnameinfo((struct sockaddr*)&sa, sizeof(sa), node, 
sizeof(node), NULL, 0, 0 );
+       if (res)
+           return strdup(intoa(a));
+
+       return strdup(node);
 }
 
-/* Return the simple name of the host */
+/* Return the simple name of the host
+   Returned value needs to be free'd
+*/
 char *
 getsname(register u_int32_t a)
 {
Index: arpwatch-2.1a15/report.c
===================================================================
--- arpwatch-2.1a15.orig/report.c       2019-01-22 13:34:02.962536621 +0100
+++ arpwatch-2.1a15/report.c    2019-01-22 13:37:04.081507637 +0100
@@ -311,6 +311,7 @@ report(register char *title, register u_
                (void)fprintf(f, "Subject: %s (%s)\n", title, hn);
        else {
                (void)fprintf(f, "Subject: %s\n", title);
+               free( hn );
                hn = unknown;
        }
        (void)putc('\n', f);
@@ -324,6 +325,8 @@ report(register char *title, register u_
                (void)sprintf(buf, "%s %s", cpu, os);
                (void)fprintf(f, fmt, "dns cpu & os", buf);
        }
+       if (hn != unknown)
+           free(hn);
        if (e2) {
                (void)fprintf(f, fmt, "old mac address", e2str(e2));
                if ((cp = ec_find(e2)) == NULL)

Reply via email to