+/*
+ * Read and send an ACL for the last encountered file.
+ */
+bool build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+{
+ /*
+ * Call the appropriate function, the ifdefs make sure the proper code is compiled.
+ */
+#if defined(HAVE_AIX_OS)
+ return aix_build_acl_streams(jcr, ff_pkt);
+#elif defined(HAVE_DARWIN_OS)
+ return darwin_build_acl_streams(jcr, ff_pkt);
+#elif defined(HAVE_FREEBSD_OS)
+ return freebsd_build_acl_streams(jcr, ff_pkt);
+#elif defined(HAVE_HPUX_OS)
+ return hpux_build_acl_streams(jcr, ff_pkt);
+#elif defined(HAVE_IRIX_OS)
+ return irix_build_acl_streams(jcr, ff_pkt);
+#elif defined(HAVE_LINUX_OS)
+ return linux_build_acl_streams(jcr, ff_pkt);
+#elif defined(HAVE_OSF1_OS)
+ return tru64_build_acl_streams(jcr, ff_pkt);
+#elif defined(HAVE_SUN_OS)
+ return solaris_build_acl_streams(jcr, ff_pkt);
+#endif
+}
+
+bool parse_acl_stream(JCR *jcr, int stream)
+{
+ /*
+ * Based on the stream being passed in dispatch to the right function
+ * for parsing and restoring a specific acl. The platform determines
+ * which streams are recognized and parsed and which are handled by
+ * the default case and ignored. The old STREAM_UNIX_ACCESS_ACL and
+ * STREAM_UNIX_DEFAULT_ACL is handled as a legacy stream by each function.
+ * As only one of the platform defines is true per compile we never end
+ * up with duplicate switch values.
+ */
+ switch (stream) {
+#if defined(HAVE_AIX_OS)
+ case STREAM_UNIX_ACCESS_ACL:
+ case STREAM_UNIX_DEFAULT_ACL:
+ case STREAM_ACL_AIX_TEXT:
+ return aix_parse_acl_stream(jcr, stream);
+#elif defined(HAVE_DARWIN_OS)
+ case STREAM_UNIX_ACCESS_ACL:
+ case STREAM_ACL_DARWIN_ACCESS_ACL:
+ return darwin_parse_acl_stream(jcr, stream);
+#elif defined(HAVE_FREEBSD_OS)
+ case STREAM_UNIX_ACCESS_ACL:
+ case STREAM_UNIX_DEFAULT_ACL:
+ case STREAM_ACL_FREEBSD_DEFAULT_ACL:
+ case STREAM_ACL_FREEBSD_ACCESS_ACL:
+ return freebsd_parse_acl_stream(jcr, stream);
+#elif defined(HAVE_HPUX_OS)
+ case STREAM_UNIX_ACCESS_ACL:
+ case STREAM_ACL_HPUX_ACL_ENTRY:
+ return hpux_parse_acl_stream(jcr, stream);
+#elif defined(HAVE_IRIX_OS)
+ case STREAM_UNIX_ACCESS_ACL:
+ case STREAM_UNIX_DEFAULT_ACL:
+ case STREAM_ACL_IRIX_DEFAULT_ACL:
+ case STREAM_ACL_IRIX_ACCESS_ACL:
+ return irix_parse_acl_stream(jcr, stream);
+#elif defined(HAVE_LINUX_OS)
+ case STREAM_UNIX_ACCESS_ACL:
+ case STREAM_UNIX_DEFAULT_ACL:
+ case STREAM_ACL_LINUX_DEFAULT_ACL:
+ case STREAM_ACL_LINUX_ACCESS_ACL:
+ return linux_parse_acl_stream(jcr, stream);
+#elif defined(HAVE_OSF1_OS)
+ case STREAM_UNIX_ACCESS_ACL:
+ case STREAM_UNIX_DEFAULT_ACL:
+ case STREAM_ACL_TRU64_DEFAULT_ACL:
+ case STREAM_ACL_TRU64_ACCESS_ACL:
+ case STREAM_ACL_TRU64_DEFAULT_DIR_ACL:
+ return tru64_parse_acl_stream(jcr, stream);
+#elif defined(HAVE_SUN_OS)
+ case STREAM_UNIX_ACCESS_ACL:
+ case STREAM_ACL_SOLARIS_ACLENT:
+#if defined(HAVE_EXTENDED_ACL)
+ case STREAM_ACL_SOLARIS_ACE:
+#endif
+ return solaris_parse_acl_stream(jcr, stream);
+#endif
+ default:
+ /*
+ * Issue a warning and discard the message. But pretend the restore was ok.
+ */
+ Qmsg2(jcr, M_WARNING, 0,
+ _("Can't restore ACLs of %s - incompatible acl stream encountered - %d\n"),
+ jcr->last_fname, stream);
+ return true;
+ } /* end switch (stream) */