* STREAM_SHA256_DIGEST
* STREAM_SHA512_DIGEST
*/
-#define STREAM_NONE 0 /* Reserved Non-Stream */
-#define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */
-#define STREAM_FILE_DATA 2 /* Standard uncompressed data */
-#define STREAM_MD5_SIGNATURE 3 /* deprecated */
-#define STREAM_MD5_DIGEST 3 /* MD5 digest for the file */
-#define STREAM_GZIP_DATA 4 /* GZip compressed file data */
-#define STREAM_UNIX_ATTRIBUTES_EX 5 /* Extended Unix attr for Win32 EX - Deprecated */
-#define STREAM_SPARSE_DATA 6 /* Sparse data stream */
-#define STREAM_SPARSE_GZIP_DATA 7 /* Sparse gzipped data stream */
-#define STREAM_PROGRAM_NAMES 8 /* program names for program data */
-#define STREAM_PROGRAM_DATA 9 /* Data needing program */
-#define STREAM_SHA1_SIGNATURE 10 /* deprecated */
-#define STREAM_SHA1_DIGEST 10 /* SHA1 digest for the file */
-#define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */
-#define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */
-#define STREAM_MACOS_FORK_DATA 13 /* Mac resource fork */
-#define STREAM_HFSPLUS_ATTRIBUTES 14 /* Mac OS extra attributes */
-#define STREAM_UNIX_ACCESS_ACL 15 /* Standard ACL attributes on UNIX - Deprecated */
-#define STREAM_UNIX_DEFAULT_ACL 16 /* Default ACL attributes on UNIX - Deprecated */
-#define STREAM_SHA256_DIGEST 17 /* SHA-256 digest for the file */
-#define STREAM_SHA512_DIGEST 18 /* SHA-512 digest for the file */
-#define STREAM_SIGNED_DIGEST 19 /* Signed File Digest, ASN.1, DER Encoded */
-#define STREAM_ENCRYPTED_FILE_DATA 20 /* Encrypted, uncompressed data */
-#define STREAM_ENCRYPTED_WIN32_DATA 21 /* Encrypted, uncompressed Win32 BackupRead data */
-#define STREAM_ENCRYPTED_SESSION_DATA 22 /* Encrypted Session Data, ASN.1, DER Encoded */
-#define STREAM_ENCRYPTED_FILE_GZIP_DATA 23 /* Encrypted, compressed data */
-#define STREAM_ENCRYPTED_WIN32_GZIP_DATA 24 /* Encrypted, compressed Win32 BackupRead data */
-#define STREAM_ENCRYPTED_MACOS_FORK_DATA 25 /* Encrypted, uncompressed Mac resource fork */
-#define STREAM_PLUGIN_NAME 26 /* Plugin "file" string */
-#define STREAM_PLUGIN_DATA 27 /* Plugin specific data */
+#define STREAM_NONE 0 /* Reserved Non-Stream */
+#define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */
+#define STREAM_FILE_DATA 2 /* Standard uncompressed data */
+#define STREAM_MD5_SIGNATURE 3 /* deprecated */
+#define STREAM_MD5_DIGEST 3 /* MD5 digest for the file */
+#define STREAM_GZIP_DATA 4 /* GZip compressed file data */
+#define STREAM_UNIX_ATTRIBUTES_EX 5 /* Extended Unix attr for Win32 EX - Deprecated */
+#define STREAM_SPARSE_DATA 6 /* Sparse data stream */
+#define STREAM_SPARSE_GZIP_DATA 7 /* Sparse gzipped data stream */
+#define STREAM_PROGRAM_NAMES 8 /* program names for program data */
+#define STREAM_PROGRAM_DATA 9 /* Data needing program */
+#define STREAM_SHA1_SIGNATURE 10 /* deprecated */
+#define STREAM_SHA1_DIGEST 10 /* SHA1 digest for the file */
+#define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */
+#define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */
+#define STREAM_MACOS_FORK_DATA 13 /* Mac resource fork */
+#define STREAM_HFSPLUS_ATTRIBUTES 14 /* Mac OS extra attributes */
+#define STREAM_UNIX_ACCESS_ACL 15 /* Standard ACL attributes on UNIX - Deprecated */
+#define STREAM_UNIX_DEFAULT_ACL 16 /* Default ACL attributes on UNIX - Deprecated */
+#define STREAM_SHA256_DIGEST 17 /* SHA-256 digest for the file */
+#define STREAM_SHA512_DIGEST 18 /* SHA-512 digest for the file */
+#define STREAM_SIGNED_DIGEST 19 /* Signed File Digest, ASN.1, DER Encoded */
+#define STREAM_ENCRYPTED_FILE_DATA 20 /* Encrypted, uncompressed data */
+#define STREAM_ENCRYPTED_WIN32_DATA 21 /* Encrypted, uncompressed Win32 BackupRead data */
+#define STREAM_ENCRYPTED_SESSION_DATA 22 /* Encrypted Session Data, ASN.1, DER Encoded */
+#define STREAM_ENCRYPTED_FILE_GZIP_DATA 23 /* Encrypted, compressed data */
+#define STREAM_ENCRYPTED_WIN32_GZIP_DATA 24 /* Encrypted, compressed Win32 BackupRead data */
+#define STREAM_ENCRYPTED_MACOS_FORK_DATA 25 /* Encrypted, uncompressed Mac resource fork */
+#define STREAM_PLUGIN_NAME 26 /* Plugin "file" string */
+#define STREAM_PLUGIN_DATA 27 /* Plugin specific data */
/*
* Additional Stream definitions. Once defined these must NEVER
* different acl streams from 1000 on and the different extended attributes streams from
* 1999 down. So the two naming spaces grows towards each other.
*/
-#define STREAM_ACL_AIX_TEXT 1000 /* AIX specific string representation from acl_get */
+#define STREAM_ACL_AIX_TEXT 1000 /* AIX specific string representation from acl_get */
#define STREAM_ACL_DARWIN_ACCESS_ACL 1001 /* Darwin (OSX) specific acl_t string representation
- * from acl_to_text (POSIX acl)
- */
+ * from acl_to_text (POSIX acl)
+ */
#define STREAM_ACL_FREEBSD_DEFAULT_ACL 1002 /* FreeBSD specific acl_t string representation
- * from acl_to_text (POSIX acl) for default acls.
- */
+ * from acl_to_text (POSIX acl) for default acls.
+ */
#define STREAM_ACL_FREEBSD_ACCESS_ACL 1003 /* FreeBSD specific acl_t string representation
- * from acl_to_text (POSIX acl) for access acls.
- */
-#define STREAM_ACL_HPUX_ACL_ENTRY 1004 /* HPUX specific acl_entry string representation
- * from acltostr (POSIX acl)
- */
+ * from acl_to_text (POSIX acl) for access acls.
+ */
+#define STREAM_ACL_HPUX_ACL_ENTRY 1004 /* HPUX specific acl_entry string representation
+ * from acltostr (POSIX acl)
+ */
#define STREAM_ACL_IRIX_DEFAULT_ACL 1005 /* IRIX specific acl_t string representation
- * from acl_to_text (POSIX acl) for default acls.
- */
+ * from acl_to_text (POSIX acl) for default acls.
+ */
#define STREAM_ACL_IRIX_ACCESS_ACL 1006 /* IRIX specific acl_t string representation
- * from acl_to_text (POSIX acl) for access acls.
- */
+ * from acl_to_text (POSIX acl) for access acls.
+ */
#define STREAM_ACL_LINUX_DEFAULT_ACL 1007 /* Linux specific acl_t string representation
- * from acl_to_text (POSIX acl) for default acls.
- */
+ * from acl_to_text (POSIX acl) for default acls.
+ */
#define STREAM_ACL_LINUX_ACCESS_ACL 1008 /* Linux specific acl_t string representation
- * from acl_to_text (POSIX acl) for access acls.
- */
+ * from acl_to_text (POSIX acl) for access acls.
+ */
#define STREAM_ACL_TRU64_DEFAULT_ACL 1009 /* Tru64 specific acl_t string representation
- * from acl_to_text (POSIX acl) for default acls.
- */
+ * from acl_to_text (POSIX acl) for default acls.
+ */
#define STREAM_ACL_TRU64_DEFAULT_DIR_ACL 1010 /* Tru64 specific acl_t string representation
- * from acl_to_text (POSIX acl) for default acls.
- */
+ * from acl_to_text (POSIX acl) for default acls.
+ */
#define STREAM_ACL_TRU64_ACCESS_ACL 1011 /* Tru64 specific acl_t string representation
- * from acl_to_text (POSIX acl) for access acls.
- */
+ * from acl_to_text (POSIX acl) for access acls.
+ */
#define STREAM_ACL_SOLARIS_ACLENT 1012 /* Solaris specific aclent_t string representation
- * from acltotext or acl_totext (POSIX acl)
- */
+ * from acltotext or acl_totext (POSIX acl)
+ */
#define STREAM_ACL_SOLARIS_ACE 1013 /* Solaris specific ace_t string representation from
- * from acl_totext (NFSv4 or ZFS acl)
- */
-#define STREAM_XATTR_DARWIN 1996 /* Darwin (OSX) specific extended attributes */
-#define STREAM_XATTR_FREEBSD 1997 /* FreeBSD specific extended attributes */
-#define STREAM_XATTR_LINUX 1998 /* Linux specific extended attributes */
-#define STREAM_XATTR_NETBSD 1999 /* NetBSD specific extended attributes */
+ * from acl_totext (NFSv4 or ZFS acl)
+ */
+#define STREAM_XATTR_SOLARIS 1995 /* Solaris specific extented attributes and extensible attributes */
+#define STREAM_XATTR_DARWIN 1996 /* Darwin (OSX) specific extended attributes */
+#define STREAM_XATTR_FREEBSD 1997 /* FreeBSD specific extended attributes */
+#define STREAM_XATTR_LINUX 1998 /* Linux specific extended attributes */
+#define STREAM_XATTR_NETBSD 1999 /* NetBSD specific extended attributes */
/*
* File type (Bacula defined).
#include "filed.h"
/*
- * List of supported OSs.
+ * List of supported OSs. Everything outside that gets stub functions.
+ * Also when XATTR support is explicitly disabled.
* Not sure if all the HAVE_XYZ_OS are correct for autoconf.
* The ones that says man page, are coded according to man pages only.
*/
*/
static bool solaris_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
{
- int len, flags;
+ int acl_enabled, len, flags;
acl_t *aclp;
char *acl_text;
bool stream_status = false;
+ /*
+ * See if filesystem supports acls.
+ */
+ acl_enabled = pathconf(jcr->last_fname, _PC_ACL_ENABLED);
+ switch (acl_enabled) {
+ case 0:
+ pm_strcpy(jcr->acl_data, "");
+
+ return true;
+ case -1:
+ Jmsg2(jcr, M_ERROR, 0, _("pathconf error on file \"%s\": ERR=%s\n"),
+ jcr->last_fname, strerror(errno));
+ Dmsg2(100, "pathconf error file=%s ERR=%s\n",
+ jcr->last_fname, strerror(errno));
+
+ return false;
+ default:
+ break;
+ }
+
/*
* Get ACL info: don't bother allocating space if there is only a trivial ACL.
*/
if (acl_get(jcr->last_fname, ACL_NO_TRIVIAL, &aclp) != 0) {
- switch (errno) {
-#if defined(BACL_ENOTSUP)
- case BACL_ENOTSUP:
- /*
- * Not supported, just pretend there is nothing to see
- */
- pm_strcpy(jcr->acl_data, "");
- return true;
-#endif
- default:
- Jmsg2(jcr, M_ERROR, 0, _("acl_get error on file \"%s\": ERR=%s\n"),
- jcr->last_fname, acl_strerror(errno));
- Dmsg2(100, "acl_get error file=%s ERR=%s\n",
- jcr->last_fname, acl_strerror(errno));
+ Jmsg2(jcr, M_ERROR, 0, _("acl_get error on file \"%s\": ERR=%s\n"),
+ jcr->last_fname, acl_strerror(errno));
+ Dmsg2(100, "acl_get error file=%s ERR=%s\n",
+ jcr->last_fname, acl_strerror(errno));
- return false;
- }
+ return false;
}
if (aclp == NULL) {
static bool solaris_parse_acl_stream(JCR *jcr, int stream)
{
acl_t *aclp;
- int error;
+ int acl_enabled, error;
switch (stream) {
case STREAM_UNIX_ACCESS_ACL:
case STREAM_ACL_SOLARIS_ACLENT:
case STREAM_ACL_SOLARIS_ACE:
+ /*
+ * First make sure the filesystem supports acls.
+ */
+ acl_enabled = pathconf(jcr->last_fname, _PC_ACL_ENABLED);
+ switch (acl_enabled) {
+ case 0:
+ Jmsg1(jcr, M_ERROR, 0, _("Trying to restore acl on file \"%s\" on filesystem without acl support\n"),
+ jcr->last_fname);
+
+ return false;
+ case -1:
+ Jmsg2(jcr, M_ERROR, 0, _("pathconf error on file \"%s\": ERR=%s\n"),
+ jcr->last_fname, strerror(errno));
+ Dmsg3(100, "pathconf error acl=%s file=%s ERR=%s\n",
+ jcr->acl_data, jcr->last_fname, strerror(errno));
+
+ return false;
+ default:
+ /*
+ * On a filesystem with ACL support make sure this particilar ACL type can be restored.
+ */
+ switch (stream) {
+ case STREAM_ACL_SOLARIS_ACLENT:
+ /*
+ * An aclent can be restored on filesystems with _ACL_ACLENT_ENABLED or _ACL_ACE_ENABLED support.
+ */
+ if ((acl_enabled & (_ACL_ACLENT_ENABLED | _ACL_ACE_ENABLED)) == 0) {
+ Jmsg1(jcr, M_ERROR, 0, _("Trying to restore acl on file \"%s\" on filesystem without aclent acl support\n"),
+ jcr->last_fname);
+ return false;
+ }
+ break;
+ case STREAM_ACL_SOLARIS_ACE:
+ /*
+ * An ace can only be restored on a filesystem with _ACL_ACE_ENABLED support.
+ */
+ if ((acl_enabled & _ACL_ACE_ENABLED) == 0) {
+ Jmsg1(jcr, M_ERROR, 0, _("Trying to restore acl on file \"%s\" on filesystem without ace acl support\n"),
+ jcr->last_fname);
+ return false;
+ }
+ break;
+ default:
+ /*
+ * Stream id which doesn't describe the type of acl which is encoded.
+ */
+ break;
+ }
+ break;
+ }
+
if ((error = acl_fromtext(jcr->acl_data, &aclp)) != 0) {
Jmsg2(jcr, M_ERROR, 0, _("acl_fromtext error on file \"%s\": ERR=%s\n"),
jcr->last_fname, acl_strerror(error));
jcr->last_fname);
return false;
}
+ break;
case STREAM_ACL_SOLARIS_ACE:
if (acl_type(aclp) != ACE_T) {
Jmsg1(jcr, M_ERROR, 0, _("wrong encoding of acl type in acl stream on file \"%s\"\n"),
jcr->last_fname);
return false;
}
+ break;
default:
/*
* Stream id which doesn't describe the type of acl which is encoded.
#define BACL_ENOTSUP ENOSYS
#elif defined(HAVE_LINUX_OS)
#define BACL_ENOTSUP ENOTSUP
-#elif defined(HAVE_SUN_OS)
-#define BACL_ENOTSUP ENOSYS
#endif
#endif
* they were saved using a filed on the same platform.
*
* Currently we support the following OSes:
- * - FreeBSD
- * - Darwin
- * - Linux
- * - NetBSD
+ * - FreeBSD (Extended Attributes)
+ * - Darwin (Extended Attributes)
+ * - Linux (Extended Attributes)
+ * - NetBSD (Extended Attributes)
+ * - Solaris (Extended Attributes and Extensible Attributes)
*
* Written by Marco van Wieringen, November MMVIII
*
#include "xattr.h"
/*
- * List of supported OSs.
+ * List of supported OSs. Everything outside that gets stub functions.
+ * Also when XATTR support is explicitly disabled.
*/
-#if !defined(HAVE_XATTR) /* Extended Attributes support is required, of course */ \
- || !( defined(HAVE_DARWIN_OS) \
- || defined(HAVE_FREEBSD_OS) \
- || defined(HAVE_LINUX_OS) \
- || defined(HAVE_NETBSD_OS) \
+#if !defined(HAVE_XATTR) /* Extended Attributes support is required, of course */ \
+ || !( defined(HAVE_DARWIN_OS) /* OSX has XATTR support using getxattr etc. */ \
+ || defined(HAVE_FREEBSD_OS) /* FreeBSD has XATTR support using lgetxattr etc. */ \
+ || defined(HAVE_LINUX_OS) /* Linux has XATTR support using the lgetxattr etc. */ \
+ || defined(HAVE_NETBSD_OS) /* NetBSD has XATTR support using the lgetxattr etc. */ \
+ || defined(HAVE_SUN_OS) /* Solaris has XATTR support using attropen etc. */ \
)
bool build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
#else
+/*
+ * This is a supported OS, See what kind of interface we should use.
+ * Start with the generic interface used by most OS-es.
+ */
+#if defined(HAVE_DARWIN_OS) \
+ || defined(HAVE_FREEBSD_OS) \
+ || defined(HAVE_LINUX_OS) \
+ || defined(HAVE_NETBSD_OS)
+
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
#endif
switch (stream) {
case STREAM_XATTR_DARWIN:
return generic_xattr_parse_streams(jcr);
+ default:
+ return false;
}
- return false;
}
#elif defined(HAVE_FREEBSD_OS)
static bool freebsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
switch (stream) {
case STREAM_XATTR_FREEBSD:
return generic_xattr_parse_streams(jcr);
+ default:
+ return false;
}
}
#elif defined(HAVE_LINUX_OS)
switch (stream) {
case STREAM_XATTR_LINUX:
return generic_xattr_parse_streams(jcr);
+ default:
+ return false;
}
- return false;
}
#elif defined(HAVE_NETBSD_OS)
static bool netbsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
switch (stream) {
case STREAM_XATTR_NETBSD:
return generic_xattr_parse_streams(jcr);
+ default:
+ return false;
}
- return false;
}
+#endif
+#elif defined(HAVE_SUN_OS)
+
+static bool solaris_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
+{
+ return true;
+}
+
+static bool solaris_parse_xattr_stream(JCR *jcr, int stream)
+{
+ switch (stream) {
+ case STREAM_XATTR_SOLARIS:
+ return true;
+ default:
+ return false;
+ }
+}
+
#endif
bool build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
{
-#if defined(HAVE_DARWIN_OS)
+#if defined(HAVE_SUN_OS)
+ return solaris_build_xattr_streams(jcr, ff_pkt);
+#elif defined(HAVE_DARWIN_OS)
return darwin_build_xattr_streams(jcr, ff_pkt);
#elif defined(HAVE_FREEBSD_OS)
return freebsd_build_xattr_streams(jcr, ff_pkt);
* is true per compile we never end up with duplicate switch values.
*/
switch (stream) {
-#if defined(HAVE_DARWIN_OS)
+#if defined(HAVE_SUN_OS)
+ case STREAM_XATTR_SOLARIS:
+ return solaris_parse_xattr_stream(jcr, stream);
+#elif defined(HAVE_DARWIN_OS)
case STREAM_XATTR_DARWIN:
return darwin_parse_xattr_stream(jcr, stream);
#elif defined(HAVE_FREEBSD_OS)
return _("Solaris Specific ACL attribs");
case STREAM_ACL_SOLARIS_ACE:
return _("Solaris Specific ACL attribs");
+ case STREAM_XATTR_SOLARIS:
+ return _("Solaris Specific Extended attribs and Extensible attribs");
case STREAM_XATTR_DARWIN:
return _("Darwin Specific Extended attribs");
case STREAM_XATTR_FREEBSD:
/* Ignore Unix ACL attributes */
break;
+ case STREAM_XATTR_SOLARIS:
case STREAM_XATTR_DARWIN:
case STREAM_XATTR_FREEBSD:
case STREAM_XATTR_LINUX:
General:
18Jan09
+kes Apply acl_solaris_update.patch submitted by Marco (thanks).
kes Remove configure check for resolv.h -- it is apparently not needed
and causes build warnings on FreeBSD.
kes Ensure that the installer and newinstaller Makefiles are called