#include "bacula.h"
#include "filed.h"
-/*
- * List of supported OSes. Everything outside that gets stub functions.
- * Also when ACL 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.
- */
-#if !defined(HAVE_ACL) /* ACL support is required, of course */ \
- || !( defined(HAVE_AIX_OS) /* man page -- may need flags */ \
- || defined(HAVE_DARWIN_OS) /* tested -- compile without flags */ \
- || defined(HAVE_FREEBSD_OS) /* tested -- compile without flags */ \
- || defined(HAVE_HPUX_OS) /* man page -- may need flags */ \
- || defined(HAVE_IRIX_OS) /* man page -- compile without flags */ \
- || defined(HAVE_LINUX_OS) /* tested -- compile with -lacl */ \
- || defined(HAVE_OSF1_OS) /* man page -- may need -lpacl */ \
- || defined(HAVE_SUN_OS) /* tested -- compile with -lsec */ \
- )
-
+#if !defined(HAVE_ACL)
/*
* Entry points when compiled without support for ACLs or on an unsupported platform.
*/
bool build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
{
- Jmsg(jcr, M_FATAL, 0, _("ACL support not configured for your machine.\n"));
return false;
}
-
+-
bool parse_acl_stream(JCR *jcr, int stream)
{
- Jmsg(jcr, M_FATAL, 0, _("ACL support not configured for your machine.\n"));
return false;
}
-
#else
-
/*
* Send an ACL stream to the SD.
*/
#include "bacula.h"
#include "filed.h"
+#if defined(HAVE_ACL)
+const bool have_acl = true;
+#else
+const bool have_acl = false;
+#endif
+
+#if defined(HAVE_XATTR)
+const bool have_xattr = true;
+#else
+const bool have_xattr = false;
+#endif
+
/* Forward referenced functions */
int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level);
static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, DIGEST *signature_digest);
start_heartbeat_monitor(jcr);
- jcr->acl_data = get_pool_memory(PM_MESSAGE);
- jcr->xattr_data = get_pool_memory(PM_MESSAGE);
+ if (have_acl) {
+ jcr->acl_data = get_pool_memory(PM_MESSAGE);
+ }
+ if (have_xattr) {
+ jcr->xattr_data = get_pool_memory(PM_MESSAGE);
+ }
/* Subroutine save_file() is called for each file */
if (!find_files(jcr, (FF_PKT *)jcr->ff, save_file, plugin_save)) {
sd->signal(BNET_EOD); /* end of sending data */
- if (jcr->acl_data) {
+ if (have_acl && jcr->acl_data) {
free_pool_memory(jcr->acl_data);
jcr->acl_data = NULL;
}
- if (jcr->xattr_data) {
+ if (have_xattr && jcr->xattr_data) {
free_pool_memory(jcr->xattr_data);
jcr->xattr_data = NULL;
}
#endif
/*
- * Save ACLs for anything not being a symlink and not being a plugin.
+ * Save ACLs when requested and available for anything not being a symlink and not being a plugin.
*/
- if (!ff_pkt->cmd_plugin) {
- if (ff_pkt->flags & FO_ACL && ff_pkt->type != FT_LNK) {
- if (!build_acl_streams(jcr, ff_pkt))
- goto bail_out;
- }
+ if (ff_pkt->flags & FO_ACL && have_acl &&
+ ff_pkt->type != FT_LNK && !ff_pkt->cmd_plugin) {
+ if (!build_acl_streams(jcr, ff_pkt))
+ goto bail_out;
}
/*
- * Save Extended Attributes for all files not being a plugin.
+ * Save Extended Attributes when requested and available for all files not being a plugin.
*/
- if (!ff_pkt->cmd_plugin) {
- if (ff_pkt->flags & FO_XATTR) {
- if (!build_xattr_streams(jcr, ff_pkt))
- goto bail_out;
- }
+ if (ff_pkt->flags & FO_XATTR && have_xattr &&
+ !ff_pkt->cmd_plugin) {
+ if (!build_xattr_streams(jcr, ff_pkt))
+ goto bail_out;
}
/* Terminate the signing digest and send it to the Storage daemon */
static int enable_vss = 0;
#endif
+/*
+ * As Windows saves ACLs as part of the standard backup stream
+ * we just pretend here that is has implicit acl support.
+ */
+#if defined(HAVE_ACL) || defined(HAVE_WIN32)
+const bool have_acl = true;
+#else
+const bool have_acl = false;
+#endif
+
+#if defined(HAVE_XATTR)
+const bool have_xattr = true;
+#else
+const bool have_xattr = false;
+#endif
+
extern CLIENT *me; /* our client resource */
/* Imported functions */
* 5. FD gets/runs ClientRunBeforeJob and sends ClientRunAfterJob
* 6. Dir sends include/exclude
* 7. FD sends data to SD
- * 8. SD/FD disconnects while SD despools data and attributes (optionnal)
+ * 8. SD/FD disconnects while SD despools data and attributes (optional)
* 9. FD runs ClientRunAfterJob
*/
}
#endif
+ /*
+ * Validate some options given to the backup make sense for the compiled in
+ * options of this filed.
+ */
+ if (jcr->ff->flags & FO_ACL && !have_acl) {
+ Jmsg(jcr, M_FATAL, 0, _("ACL support not configured for your machine.\n"));
+ goto cleanup;
+ }
+ if (jcr->ff->flags & FO_XATTR && !have_xattr) {
+ Jmsg(jcr, M_FATAL, 0, _("XATTR support not configured for your machine.\n"));
+ goto cleanup;
+ }
+
set_jcr_job_status(jcr, JS_Blocked);
jcr->set_JobType(JT_BACKUP);
Dmsg1(100, "begin backup ff=%p\n", jcr->ff);
#endif
#ifdef HAVE_SHA2
- const bool have_sha2 = true;
+const bool have_sha2 = true;
#else
- const bool have_sha2 = false;
+const bool have_sha2 = false;
#endif
#if defined(HAVE_XATTR)
binit(&rctx.bfd);
binit(&rctx.forkbfd);
attr = rctx.attr = new_attr(jcr);
- jcr->acl_data = get_pool_memory(PM_MESSAGE);
- jcr->xattr_data = get_pool_memory(PM_MESSAGE);
+ if (have_acl) {
+ jcr->acl_data = get_pool_memory(PM_MESSAGE);
+ }
+ if (have_xattr) {
+ jcr->xattr_data = get_pool_memory(PM_MESSAGE);
+ }
while (bget_msg(sd) >= 0 && !job_canceled(jcr)) {
/* Remember previous stream type */
jcr->compress_buf_size = 0;
}
- if (jcr->xattr_data) {
+ if (have_xattr && jcr->xattr_data) {
free_pool_memory(jcr->xattr_data);
jcr->xattr_data = NULL;
}
- if (jcr->acl_data) {
+ if (have_acl && jcr->acl_data) {
free_pool_memory(jcr->acl_data);
jcr->acl_data = NULL;
}
#include "filed.h"
#include "xattr.h"
+#if !defined(HAVE_XATTR)
/*
- * List of supported OSes. Everything outside that gets stub functions.
- * Also when XATTR support is explicitly disabled.
+ * Entry points when compiled without support for XATTRs or on an unsupported platform.
*/
-#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)
{
- Jmsg(jcr, M_FATAL, 0, _("XATTR support not configured for your machine.\n"));
return false;
}
bool parse_xattr_stream(JCR *jcr, int stream)
{
- Jmsg(jcr, M_FATAL, 0, _("XATTR support not configured for your machine.\n"));
return false;
}
-
#else
-
/*
* Send a XATTR stream to the SD.
*/
if (xattr_link_cache_head == NULL) {
xattr_link_cache_head = ptr;
}
- if (xattr_link_cache_tail != NULL)
+ if (xattr_link_cache_tail != NULL) {
xattr_link_cache_tail->next = ptr;
}
}
acl_t *aclp = NULL;
if ((error = acl_fromtext(acl_text, &aclp)) != 0) {
- Jmsg1(jcr, M_ERROR, 0, _("Unable to convert acl from text on file \"%s\"\n"
- jcr->last_fname));
+ Jmsg1(jcr, M_ERROR, 0, _("Unable to convert acl from text on file \"%s\"\n"),
+ jcr->last_fname);
return true; /* non-fatal */
}
General:
+04Jul09
+mvw Change checking for acl and xattr support from first file to
+ job level.
+mvw Call acl and xattr function only when requested for fileset
+ and filed has support for acl or xattr
+mvw Fix typo introduces by fix for bug #1305
03Jul09
ebl Should fix the first part #1323 about the restore option
"List Jobs where a given File is saved" wich display deleted files