Re: Compiling 3.4.5 on OpenBSD 6.1

2017-08-02 Thread Eric Lovelace
I worked your patch in with some changes I made and got it to compile (The 
changes to 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 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: mailto:owner-amanda-us...@amanda.org>> on 
behalf of Jean-Louis Martineau 
mailto:jmartin...@carbonite.com>>
Date: Wednesday, August 2, 2017 at 1:02 PM
To: Eric Lovelace 
mailto:elovel...@msddecatur.k12.in.us>>, 
"amanda-users@amanda.org" 
mailto:amanda-users@amanda.org>>
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):

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 
[jmartin...@carbonite.com]
Sent: Tuesday, August 01, 2017 5:11 PM
To: Eric Lovelace; amanda-users@amanda.org
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

Re: Compiling 3.4.5 on OpenBSD 6.1

2017-08-02 Thread Jean-Louis Martineau
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 
> ):
>
> 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 [jmartin...@carbonite.com]
> Sent: Tuesday, August 01, 2017 5:11 PM
> To: Eric Lovelace; amanda-users@amanda.org
> 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/security-util.c b/common-src/security-util.c
index 0058ab8..348f145 100644
--- a/common-src/security-util.c
+++ b/common-src/security-util.c
@@ -3302,10 +3302,11 @@ find_port_for_service(
 } else {
 struct servent *result;
 #ifdef HAVE_GETSERVBYNAME_R
-struct servent sp;
-char buf[2048];
 
+#define GETSERVBYNAME_R4
 #ifdef GETSERVBYNAME_R5
+struct servent sp;
+char buf[2048];
 	result = getservbyname_r(service, proto, &sp, buf, 2048);
 	if (result == 0) {
 	assert(errno != ERANGE);
@@ -3314,6 +3315,19 @@ find_port_for_service(
 	port = (in_port_t)(ntohs((in_port_t)sp.s_port));
 	}
 #else
+#ifdef GETSE