Browse Source

Issue 50971 - Support building on FreeBSD.

Bug Description:

The build on FreeBSD wasn't *quite* working.

Fix Description:

A few surprisingly minor fixes to support building 389ds on FreeBSD:

 * slapd: Don't use `O_PATH' if it's not available.
 * slapd: Don't invoke `#include' inside a function.
 * slapd: Move the `#include' of libgen.h to grab basename(3).
 * pwdstorage: Set `_BSD_SOURCE'; and fix up includes for FreeBSD.
 * slapd: statvfs(3) doesn't have `f_mntonname', but statfs(2) does.
 * libaccess: `LASIpAddPatternIPV6' returns `int'; `NULL' can't be cast.
 * buildnum.py: Use `env' to find python3.
 * autogen: Use `gsed' (hopefully GNU sed) if it's available.

Relates: https://pagure.io/389-ds-base/issue/50971

Author: Jashank Jeremy (@jashankj)

Review by: William Brown (@firstyear)
tags/debian/1.4.3.6-1
Jashank Jeremy 10 months ago
parent
commit
81c50ce8e2
No known key found for this signature in database GPG Key ID: AC3081A55581D2C0
8 changed files with 43 additions and 21 deletions
  1. +10
    -3
      autogen.sh
  2. +1
    -1
      buildnum.py
  3. +14
    -8
      ldap/servers/plugins/pwdstorage/crypt_pwd.c
  4. +2
    -2
      ldap/servers/slapd/daemon.c
  5. +7
    -1
      ldap/servers/slapd/dse.c
  6. +7
    -4
      ldap/servers/slapd/getsocketpeer.c
  7. +1
    -1
      ldap/servers/slapd/ssl.c
  8. +1
    -1
      lib/libaccess/lasip.cpp

+ 10
- 3
autogen.sh View File

@@ -59,8 +59,15 @@ checkvers() {
return 0
}

# We use GNU sed-isms, so if `gsed' exists, use that instead.
sed=sed
if command -v gsed >/dev/null
then
sed=gsed
fi

# Check autoconf version
AC_VERSION=`autoconf --version | sed '/^autoconf/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`
AC_VERSION=`autoconf --version | $sed '/^autoconf/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`
if checkvers "$AC_VERSION" $ac_need_maj $ac_need_min ; then
echo Found valid autoconf version $AC_VERSION
else
@@ -69,7 +76,7 @@ else
fi

# Check automake version
AM_VERSION=`automake --version | sed '/^automake/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`
AM_VERSION=`automake --version | $sed '/^automake/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`
if checkvers "$AM_VERSION" $am_need_maj $am_need_min $am_need_rev ; then
echo Found valid automake version $AM_VERSION
else
@@ -83,7 +90,7 @@ fi
# letter - note that the shell -lt and -gt comparisons will fail with
# test: 6b: integer expression expected if the number to compare
# contains a non-digit
LT_VERSION=`libtool --version | sed '/GNU libtool/ {s/^.* \([1-9][0-9a-zA-Z.]*\)$/\1/; s/[a-zA-Z]//g; q}'`
LT_VERSION=`libtool --version | $sed '/GNU libtool/ {s/^.* \([1-9][0-9a-zA-Z.]*\)$/\1/; s/[a-zA-Z]//g; q}'`
if checkvers "$LT_VERSION" $lt_need_maj $lt_need_min $lt_need_rev ; then
echo Found valid libtool version $LT_VERSION
else


+ 1
- 1
buildnum.py View File

@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2020 Red Hat, Inc.
# All rights reserved.


+ 14
- 8
ldap/servers/plugins/pwdstorage/crypt_pwd.c View File

@@ -16,17 +16,23 @@
*
*/

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#if defined(hpux) || defined(LINUX) || defined(__FreeBSD__)
#ifndef __USE_XOPEN
#define __USE_XOPEN /* linux */
#endif /* __USE_XOPEN */
# ifndef __USE_XOPEN
# define __USE_XOPEN /* linux */
# endif /* __USE_XOPEN */
# ifndef _BSD_SOURCE
# define _BSD_SOURCE
# endif /* !defined(_BSD_SOURCE) */
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <crypt.h>
#ifndef __FreeBSD__
# include <crypt.h>
#endif
#include "pwdstorage.h"

/* characters used in crypt encoding */


+ 2
- 2
ldap/servers/slapd/daemon.c View File

@@ -232,8 +232,8 @@ disk_mon_get_mount_point(char *dir)
char *
disk_mon_get_mount_point(char *dir)
{
struct statvfs sb;
if (statvfs(dir, &sb) != 0) {
struct statfs sb;
if (statfs(dir, &sb) != 0) {
return NULL;
}



+ 7
- 1
ldap/servers/slapd/dse.c View File

@@ -1008,7 +1008,13 @@ dse_write_file_nolock(struct dse *pdse)
* We have now written to the tmp location, and renamed it
* we need to open and fsync the dir to make the rename stick.
*/
int fp_configdir = open(pdse->dse_configdir, O_PATH | O_DIRECTORY);
int fp_configdir =
#ifdef O_PATH
open(pdse->dse_configdir, O_PATH | O_DIRECTORY)
#else
open(pdse->dse_configdir, O_RDONLY | O_DIRECTORY)
#endif
;
if (fp_configdir != -1) {
fsync(fp_configdir);
close(fp_configdir);


+ 7
- 4
ldap/servers/slapd/getsocketpeer.c View File

@@ -24,6 +24,13 @@
*/
#include <private/pprio.h>

#if !(defined(SO_PEERCRED) || defined(HAVE_PEERUCRED) || defined(HAVE_GETPEEREID))
# include <string.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <errno.h>
#endif

int
slapd_get_socket_peer(PRFileDesc *nspr_fd, uid_t *uid, gid_t *gid)
{
@@ -74,10 +81,6 @@ slapd_get_socket_peer(PRFileDesc *nspr_fd, uid_t *uid, gid_t *gid)
ret = 0;

#else /* hpux / Solaris9 / some BSDs - file descriptor cooperative auth */
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
struct msghdr msg = {0};
struct iovec iov;
char dummy[8];


+ 1
- 1
ldap/servers/slapd/ssl.c View File

@@ -14,6 +14,7 @@
/* SSL-related stuff for slapd */

#include <stdio.h>
#include <libgen.h>
#include <sys/param.h>
#include <ssl.h>
#include <nss.h>
@@ -2401,7 +2402,6 @@ slapd_get_unlocked_key_for_cert(CERTCertificate *cert, void *pin_arg)
/*
* Functions to extract key and cert from the NSS cert db.
*/
#include <libgen.h>
#include <seccomon.h>
#include <secmodt.h>
#include <certt.h>


+ 1
- 1
lib/libaccess/lasip.cpp View File

@@ -332,7 +332,7 @@ LASIpBuild(NSErr_t *errp, char *attr_name, CmpOp_t comparator, char *attr_patter
return (retcode);
}

if (LASIpAddPatternIPv6(errp, netmask, &ipv6, &context->treetop_ipv6) != (int)NULL) {
if (LASIpAddPatternIPv6(errp, netmask, &ipv6, &context->treetop_ipv6) != 0) {
return LAS_EVAL_INVALID;
}
}


Loading…
Cancel
Save