Use the attached patch instead of doing the include in common-src/sockaddr-util.h

This build is not from the 3.4 branch, it is either the 3.5 branch or trunk.

Which branch are you building? I can send you a tarball so that you will not need swig to do the build.

Jean-Louis

On 03/08/17 04:34 PM, Eric Lovelace wrote:
After the patch, I also had to include <sys/types.h> and <netinet/in.h> in common-src/sockaddr-util (per https://man.openbsd.org/inet.4 <https://man.openbsd.org/inet.4> and https://man.openbsd.org/inet6.4 <https://man.openbsd.org/inet6.4>) to avoid the error below. Now its just complaining about SWIG not being installed even though I installed it. I will look into that next but didn’t want to leave you hanging for a response. Thanks for your help!


gmake[3]: Entering directory '/home/admin/git/amanda/amanda/common-src'
depbase=`echo ambind.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I../config -I../gnulib -I../common-src -fno-strict-aliasing -I/usr/local/include -D_GNU_SOURCE -I/usr/include -pthread -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -Wall -Wextra -Wparentheses -Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wformat -Wformat-security -Wsign-compare -Wfloat-equal -Wold-style-definition -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-deprecated-declarations -DAMANDA_FILE=\"`basename ambind.c`\" -g -O2 -fno-strict-aliasing -MT ambind.o -MD -MP -MF $depbase.Tpo -c -o ambind.o ambind.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ambind.c:28:
sockaddr-util.h:39: error: field 'sin' has incomplete type
sockaddr-util.h:41: error: field 'sin6' has incomplete type
gmake[3]: *** [Makefile:2519: ambind.o] Error 1
gmake[3]: Leaving directory '/home/admin/git/amanda/amanda/common-src'
gmake[2]: *** [Makefile:2125: all] Error 2
gmake[2]: Leaving directory '/home/admin/git/amanda/amanda/common-src'
gmake[1]: *** [Makefile:1713: all-recursive] Error 1
gmake[1]: Leaving directory '/home/admin/git/amanda/amanda'
gmake: *** [Makefile:1637: all] Error 2


From: Jean-Louis Martineau <[email protected] <mailto:[email protected]>>
Date: Thursday, August 3, 2017 at 9:03 AM
To: Eric Lovelace <[email protected] <mailto:[email protected]>>, "[email protected] <mailto:[email protected]>" <[email protected] <mailto:[email protected]>>
Subject: Re: Compiling 3.4.5 on OpenBSD 6.1

Eric,

Try this patch.
It doesn't use syshacks, it really detect the getservbyname_r variant.

Jean-Louis

On 02/08/17 05:57 PM, Eric Lovelace wrote:
I worked your patch in with some changes I made and got it to compile (The changes to Makefile.am <http://Makefile.am> were a separate problem that came up after). Currently I am working with inetd to try and actually get it running to confirm that it works, but it definitely compiles now! Changes are below.

--- config/amanda/syshacks.m4 Wed Aug 2 11:06:49 2017
+++ config/amanda/syshacks.m4.bak Wed Aug 2 11:05:12 2017
@@ -23,7 +23,6 @@
*-freebsd*)
;;
*-openbsd*)
- AC_DEFINE(GETSERVBYNAME_R4,1,[Define on openbsd])
;;
*-hp-*)
case "$CC" in

--- /root/amanda-3.4.5/common-src/security-util.c Wed Aug 2 17:39:04 2017 +++ /root/amanda-3.4.5/common-src/security-util.c.bak Wed Aug 2 08:56:01 2017
@@ -3305,7 +3305,7 @@
         struct servent sp;
         char buf[2048];

-#if defined GETSERVBYNAME_R5
+#ifdef GETSERVBYNAME_R5
        result = getservbyname_r(service, proto, &sp, buf, 2048);
        if (result == 0) {
            assert(errno != ERANGE);
@@ -3313,16 +3313,6 @@
        } else {
            port = (in_port_t)(ntohs((in_port_t)sp.s_port));
        }
-#elif defined GETSERVBYNAME_R4
-       struct servent_data servent_data;
-        int r;
-       memset(&servent_data, 0, sizeof(struct servent_data));
-        r = getservbyname_r(service, proto, &result, &servent_data);
-        if (r !=0) {
-            port = 0;
-        } else {
-            port = (in_port_t)(ntohs((in_port_t)result->s_port));
-        }
 #else
        int r;
        r = getservbyname_r(service, proto, &sp, buf, 2048, &result);

--- Makefile.am <http://Makefile.am> Wed Aug 2 14:12:14 2017
+++ Makefile.am.bak Wed Aug 2 13:30:41 2017
@@ -4,7 +4,7 @@
include $(top_srcdir)/config/automake/vars.am
include $(top_srcdir)/config/automake/installperms.am

-ACLOCAL_AMFLAGS = --force -I config -I . -I config/gettext-macros -I config/gnulib -I config/amanda -I config/macro-archive +ACLOCAL_AMFLAGS = --force -I config -I . -I config/gettext-macros -I config/gnulib -I config/amanda -I config/macro-archive -I /usr/share/aclocal

if WANT_CLIENT
CLIENT_SUBDIRS = client-src application-src

From: <[email protected] <mailto:[email protected]>> on behalf of Jean-Louis Martineau <[email protected] <mailto:[email protected]>>
Date: Wednesday, August 2, 2017 at 1:02 PM
To: Eric Lovelace <[email protected] <mailto:[email protected]>>, "[email protected] <mailto:[email protected]>" <[email protected] <mailto:[email protected]>>
Subject: Re: Compiling 3.4.5 on OpenBSD 6.1

Another variant of getservbyname_r.

Try the attached patch.
I can't compile it, I do not have an openbsd host.

If the patch works, we will have to fix the configure script to detect that variant and define GETSERVBYNAME_R4

Jean-Louis


On 01/08/17 06:17 PM, Eric Lovelace wrote:
This seems to be the relevant part from the doc (located here: https://man.openbsd.org/getservent.3 <https://man.openbsd.org/getservent.3>):

int getservbyname_r(const char *name, const char *proto, struct servent *servent, struct servent_data *servent_data);

I checked out the line from the source (security-util.c line 3318)
r = getservbyname_r(service, proto, &sp, buf, 2048, &result);

So there definitely is a mismatch in parameters. It also looks like that area of code already has some logic for switching between a 5 parameter call and a 6 parameter call; I guess when I sit back down in front of the system in question I will see if I can get enough of a handle on the code to write the 4 parameter call.
________________________________________
From: Jean-Louis Martineau [[email protected]]
Sent: Tuesday, August 01, 2017 5:11 PM
To: Eric Lovelace; [email protected]
Subject: Re: Compiling 3.4.5 on OpenBSD 6.1

How getservbyname_r is defined on OpenBSD 6.1

Jean-Louis

On 01/08/17 04:28 PM, Eric Lovelace wrote:
> Hello,
>
> I would like to run Amanda on OpenBSD (Ideally with current versions of
> each). From what I have found online, this was possible in previous
> versions of both softwares but I can¹t find any examples with more recent
> versions; is this setup still supported? I ran into an issue with the
> default make command (that apparently the Makefile used some GNU make
> exclusive features), but using gmake seemed to advance the progress a
> little further. Has anyone encountered anything similar and been able to
> get it working? Thanks in advance!
>
> The error from running gmake
> ============================
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../config -I../gnulib
> -I../common-src -fno-strict-aliasing -D_GNU_SOURCE -I/usr/include -pthread
> -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
> -I/usr/local/include -Wall -Wextra -Wparentheses
> -Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes
> -Wmissing-declarations -Wformat -Wformat-security -Wsign-compare
> -Wfloat-equal -Wold-style-definition -Wno-strict-aliasing
> -Wno-unknown-pragmas -Wno-deprecated-declarations
> -DAMANDA_FILE=\"security-util.c\" -g -O2 -fno-strict-aliasing -MT
> security-util.lo -MD -MP -MF .deps/security-util.Tpo -c security-util.c
> -fPIC -DPIC -o .libs/security-util.o
> security-util.c: In function 'find_port_for_service':
> security-util.c:3318: warning: passing argument 4 of 'getservbyname_r'
> from incompatible pointer type
> security-util.c:3318: error: too many arguments to function
> 'getservbyname_r'
> gmake[3]: *** [Makefile:2479: security-util.lo] Error 1
> gmake[3]: Leaving directory '/root/amanda-3.4.5/common-src'
> gmake[2]: *** [Makefile:2123: all] Error 2
> gmake[2]: Leaving directory '/root/amanda-3.4.5/common-src'
> gmake[1]: *** [Makefile:1717: all-recursive] Error 1
> gmake[1]: Leaving directory '/root/amanda-3.4.5'
> gmake: *** [Makefile:1641: all] Error 2
>
>
>
>
> The results from ./configure
> ============================
> Directories:
> Application: /usr/local/libexec/amanda/application
> Configuration: /usr/local/etc/amanda
> GNU Tar lists: /usr/local/var/amanda/gnutar-lists
> Perl modules (amperldir): /usr/local/libdata/perl5/site_perl
> Template and example data files (amdatadir): /usr/local/share/amanda
> Temporary: /tmp/amanda
> WARNINGS:
> no user specified (--with-user) -- using 'amanda'
> no group specified (--with-group) -- using 'backup'
> /bin/tar is not GNU tar, so it will not be used.
> /usr/local/bin/smbclient does not seem to be smbclient.
>
>
This message is the property of CARBONITE, INC. and may contain confidential or 
privileged information.
If this message has been delivered to you by mistake, then do not copy or 
deliver this message to anyone.  Instead, destroy it and notify me by reply 
e-mail
diff --git a/common-src/ambind.c b/common-src/ambind.c
index bbe5a5d..2eba985 100644
--- a/common-src/ambind.c
+++ b/common-src/ambind.c
@@ -25,8 +25,9 @@
  */
 
 #include <config.h>
-#include "sockaddr-util.h"
 #include <sys/types.h>
+#include <netinet/in.h>
+#include "sockaddr-util.h"
 #include <sys/socket.h>
 #include <errno.h>
 #include <stdio.h>

Reply via email to