]> git.sur5r.net Git - bacula/bacula/commitdiff
First attempt at fixing bug #1735 where acls on OSX doesn't seem to reach the backup.
authorMarco van Wieringen <mvw@planets.elm.net>
Fri, 13 May 2011 17:55:53 +0000 (19:55 +0200)
committerMarco van Wieringen <mvw@planets.elm.net>
Mon, 16 May 2011 14:20:58 +0000 (16:20 +0200)
bacula/autoconf/config.h.in
bacula/autoconf/configure.in
bacula/src/filed/acl.c

index 2b4f018fd3551d275ca555a4539ca6041b4258f5..caa6daadcc1f3a45206fb3a201a49b850416767a 100644 (file)
 /* Define if you have zlib */
 #undef HAVE_LIBZ
 
-/* Define if you have libacl */
-#undef HAVE_ACL
-
-/* Define if you have AFS acls */
-#undef HAVE_AFS_ACL
-
 /* General libs */
 #undef LIBS
 
 /* Normal acl support */
 #undef HAVE_ACL
 
+/* Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type */
+#undef HAVE_ACL_TYPE_DEFAULT_DIR
+
+/* Defines if your system have the ACL_TYPE_EXTENDED acl type */
+#undef HAVE_ACL_TYPE_EXTENDED
+
+/* Defines if your system have the ACL_TYPE_NFS4 acl type */
+#undef HAVE_ACL_TYPE_NFS4
+
+/* Define to 1 if you have the 'add_proplist_entry' function. */
+#undef HAVE_ADD_PROPLIST_ENTRY
+
 /* Defines if your system has AFS support */
 #undef HAVE_AFS
 
index bbcd0e2f04f96e1787c7be6ad74788b7e512dc1d..3fd7bcc4224603ea3545cb7cea04835f5df5c537 100644 (file)
@@ -2625,14 +2625,43 @@ if test x$support_acl = xyes -o x$support_acl = xauto; then
 
    dnl
    dnl Check for acl_get_file in libpacl (OSF1)
+   dnl and if ACL_TYPE_DEFAULT_DIR is defined.
    dnl
-   if test $have_acl = no; then
+   if test $have_acl = no -a \
+          x${HAVE_OSF1_OS_TRUE} = x; then
       AC_CHECK_LIB(pacl, acl_get_file,
         [
             have_acl=yes
             FDLIBS="-lpacl $FDLIBS"
         ]
       )
+
+      AC_CHECK_DECL([ACL_TYPE_DEFAULT_DIR],
+                    [AC_DEFINE(HAVE_ACL_TYPE_DEFAULT_DIR,1,[Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type])],
+                    [],
+                    [[#include <sys/acl.h>]])
+   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_CHECK_DECL([ACL_TYPE_EXTENDED],
+                    [AC_DEFINE(HAVE_ACL_TYPE_EXTENDED,1,[Defines if your system have the ACL_TYPE_EXTENDED acl type])],
+                    [],
+                    [[#include <sys/acl.h>]])
+   fi
+
+   dnl
+   dnl On FreeBSD check for availability of ACL_TYPE_NFS4
+   dnl
+   if test $have_acl = yes -a \
+           x${HAVE_FREEBSD_OS_TRUE} = x; then
+      AC_CHECK_DECL([ACL_TYPE_NFS4],
+                    [AC_DEFINE(HAVE_ACL_TYPE_NFS4,1,[Defines if your system have the ACL_TYPE_NFS4 acl type])],
+                    [],
+                    [[#include <sys/acl.h>]])
    fi
 
    dnl
index 9e4f9225588171e6324663313a664e60688ba8f9..69659e98ba1e7f96918eaeccf28b2e1ff5fe0202 100644 (file)
@@ -480,7 +480,7 @@ static acl_type_t bac_to_os_acltype(bacl_type acltype)
    case BACL_TYPE_DEFAULT:
       ostype = ACL_TYPE_DEFAULT;
       break;
-#ifdef ACL_TYPE_NFS4
+#ifdef HAVE_ACL_TYPE_NFS4
       /**
        * FreeBSD has an additional acl type named ACL_TYPE_NFS4.
        */
@@ -488,7 +488,7 @@ static acl_type_t bac_to_os_acltype(bacl_type acltype)
       ostype = ACL_TYPE_NFS4;
       break;
 #endif
-#ifdef ACL_TYPE_DEFAULT_DIR
+#ifdef HAVE_ACL_TYPE_DEFAULT_DIR
    case BACL_TYPE_DEFAULT_DIR:
       /**
        * TRU64 has an additional acl type named ACL_TYPE_DEFAULT_DIR.
@@ -496,7 +496,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.
@@ -680,12 +680,10 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
       jcr->acl_data->content_length = 0;
       acl_free(acl);
       return bacl_exit_error;
-   }
-
-   /**
-    * Handle errors gracefully.
-    */
-   if (acl == (acl_t)NULL) {
+   } else {
+      /**
+       * Handle errors gracefully.
+       */
       switch (errno) {
 #if defined(BACL_ENOTSUP)
       case BACL_ENOTSUP:
@@ -696,7 +694,9 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
           * when we change from one filesystem to an other.
           */
          jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE;
-         break;                       /* not supported */
+         pm_strcpy(jcr->acl_data->content, "");
+         jcr->acl_data->content_length = 0;
+         return bacl_exit_ok;
 #endif
       case ENOENT:
          pm_strcpy(jcr->acl_data->content, "");
@@ -714,13 +714,6 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
          return bacl_exit_error;
       }
    }
-
-   /**
-    * Not supported, just pretend there is nothing to see
-    */
-   pm_strcpy(jcr->acl_data->content, "");
-   jcr->acl_data->content_length = 0;
-   return bacl_exit_ok;
 }
 
 /**
@@ -810,7 +803,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)
@@ -838,7 +831,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);