From bdeecd41c80251db0042a292643bef6997eb1ca5 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Mon, 16 May 2011 16:16:39 +0200 Subject: [PATCH] Backport of acl check logic from master. This should fix bug #1735 --- bacula/autoconf/config.h.in | 11 ++-- bacula/autoconf/configure.in | 106 ++++++++++------------------------- bacula/src/filed/acl.c | 8 +-- 3 files changed, 38 insertions(+), 87 deletions(-) diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index 0f5796d0b0..60a7f87aa9 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -258,14 +258,11 @@ /* Normal acl support */ #undef HAVE_ACL -/* Defines if your system has AFS support */ -#undef HAVE_AFS +/* Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type */ +#undef HAVE_ACL_TYPE_DEFAULT_DIR -/* Andrew FileSystem ACL support */ -#undef HAVE_AFS_ACL - -/* Define to 1 if you have the header file. */ -#undef HAVE_AFS_STDS_H +/* Defines if your system have the ACL_TYPE_EXTENDED acl type */ +#undef HAVE_ACL_TYPE_EXTENDED /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 99f9c5b321..b37e738f41 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -2445,82 +2445,6 @@ if test x$ZLIBS = x-lz; then fi AC_SUBST(ZLIBS) -dnl -dnl Check if we have AFS on this system -dnl -AFS_CFLAGS="" -AFS_LIBS="" -support_afs=auto -AC_ARG_ENABLE(afs, - AC_HELP_STRING([--disable-afs], [disable afs support @<:@default=auto@:>@]), - [ - if test x$enableval = xyes; then - support_afs=yes - elif test x$enableval = xno; then - support_afs=no - fi - ] -) - -have_afs=no -if test x$support_afs = xyes -o x$support_afs = xauto; then - AC_ARG_WITH(afsdir, - AC_HELP_STRING([--with-afsdir@<:@=DIR@:>@], [Directory holding AFS includes/libs]), - with_afsdir=$withval - ) - - dnl - dnl Search in standard places, or --with-afsdir not specified - dnl - if test x$with_afsdir = x; then - for root in /usr /usr/local; do - if test -d ${root}/include/afs/ ; then - with_afsdir=${root} - break - fi - done - fi - - AFS_CFLAGS="-I${with_afsdir}/include" - - saved_CFLAGS="${CFLAGS}" - CFLAGS="${AFS_CFLAGS} ${saved_CFLAGS}" - - AC_CHECK_HEADERS(afs/stds.h) - - CFLAGS="${saved_CFLAGS}" - - dnl - dnl See if we can find a libsys with the pioctl symbol in there - dnl - for dir in ${with_afsdir}/lib ${with_afsdir}/lib/afs - do - for arch_type in .a .so - do - A=`test -f ${dir}/libsys${arch_type} && nm ${dir}/libsys${arch_type} | grep pioctl` - pkg=$? - if test $pkg = 0; then - have_afs=yes - AFS_LIBS="-L${dir} -lsys -lrx -llwp ${dir}/util.a" - break - fi - done - done - - if test x$support_afs = xyes -a $have_afs != yes; then - AC_MSG_ERROR([afs support explicitly enabled but no supported afs implementation found, - please either load the afs libraries or rerun configure without --enable-afs]) - else - if test $have_afs = yes; then - AC_DEFINE([HAVE_AFS],1,[Defines if your system has AFS support]) - AC_DEFINE([HAVE_AFS_ACL],1,[Andrew FileSystem ACL support]) - fi - fi -fi - -AC_SUBST(AFS_CFLAGS) -AC_SUBST(AFS_LIBS) - dnl dnl Check for ACL support and libraries dnl @@ -2584,6 +2508,36 @@ if test x$support_acl = xyes -o x$support_acl = xauto; then ] ) + dnl + dnl On OSF1 check for availability of ACL_TYPE_DEFAULT_DIR + dnl + if test $have_acl = no -a \ + x${HAVE_OSF1_OS_TRUE} = x; then + AC_MSG_CHECKING(for ACL_TYPE_DEFAULT_DIR in acl.h include file) + grep ACL_TYPE_DEFAULT_DIR /usr/include/sys/acl.h > /dev/null 2>&1 + if test $? = 0; then + AC_DEFINE(HAVE_ACL_TYPE_DEFAULT_DIR,1,[Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + fi + + dnl + dnl On OSX check for availability of ACL_TYPE_EXTENDED + dnl + if test $have_acl = yes -a \ + x${HAVE_DARWIN_OS_TRUE} = x; then + AC_MSG_CHECKING(for ACL_TYPE_EXTENDED in acl.h include file) + grep ACL_TYPE_EXTENDED /usr/include/sys/acl.h > /dev/null 2>&1 + if test $? = 0; then + AC_DEFINE(HAVE_ACL_TYPE_EXTENDED,1,[Defines if your system have the ACL_TYPE_EXTENDED acl type]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + fi + if test x$support_acl = xyes -a $have_acl != yes; then AC_MSG_ERROR([acl support explicitly enabled but no supported acl implementation found, please either load the acl libraries or rerun configure without --enable-acl]) diff --git a/bacula/src/filed/acl.c b/bacula/src/filed/acl.c index 1e18e125be..4c83700d81 100644 --- a/bacula/src/filed/acl.c +++ b/bacula/src/filed/acl.c @@ -205,7 +205,7 @@ static acl_type_t bac_to_os_acltype(bacl_type acltype) ostype = ACL_TYPE_DEFAULT; break; -#ifdef ACL_TYPE_DEFAULT_DIR +#ifdef HAVE_ACL_TYPE_DEFAULT_DIR case BACL_TYPE_DEFAULT_DIR: /* * OSF1 has an additional acl type named ACL_TYPE_DEFAULT_DIR. @@ -213,7 +213,7 @@ static acl_type_t bac_to_os_acltype(bacl_type acltype) ostype = ACL_TYPE_DEFAULT_DIR; break; #endif -#ifdef ACL_TYPE_EXTENDED +#ifdef HAVE_ACL_TYPE_EXTENDED case BACL_TYPE_EXTENDED: /* * MacOSX has an additional acl type named ACL_TYPE_EXTENDED. @@ -502,7 +502,7 @@ static int os_default_acl_streams[1] = { -1 }; static bacl_exit_code darwin_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt) { -#if defined(ACL_TYPE_EXTENDED) +#if defined(HAVE_ACL_TYPE_EXTENDED) /* * On MacOS X, acl_get_file (name, ACL_TYPE_ACCESS) * and acl_get_file (name, ACL_TYPE_DEFAULT) @@ -530,7 +530,7 @@ static bacl_exit_code darwin_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt) static bacl_exit_code darwin_parse_acl_streams(JCR *jcr, int stream) { -#if defined(ACL_TYPE_EXTENDED) +#if defined(HAVE_ACL_TYPE_EXTENDED) return generic_set_acl_on_os(jcr, BACL_TYPE_EXTENDED); #else return generic_set_acl_on_os(jcr, BACL_TYPE_ACCESS); -- 2.39.5