- case STREAM_ACL_SOLARIS_ACLENT_T:
- case STREAM_ACL_SOLARIS_ACE_T:
- 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));
+ 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:
+ Mmsg1(jcr->errmsg, _("Trying to restore acl on file \"%s\" on filesystem without acl support\n"),
+ jcr->last_fname);
+ return bacl_exit_error;
+ case -1:
+ switch (errno) {
+ case ENOENT:
+ return bacl_exit_ok;
+ default:
+ Mmsg2(jcr->errmsg, _("pathconf error on file \"%s\": ERR=%s\n"),
+ jcr->last_fname, be.bstrerror());
+ Dmsg3(100, "pathconf error acl=%s file=%s ERR=%s\n",
+ jcr->acl_data->content, jcr->last_fname, be.bstrerror());
+ return bacl_exit_error;
+ }
+ 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) {
+ Mmsg1(jcr->errmsg, _("Trying to restore acl on file \"%s\" on filesystem without aclent acl support\n"),
+ jcr->last_fname);
+ return bacl_exit_error;
+ }
+ 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) {
+ Mmsg1(jcr->errmsg, _("Trying to restore acl on file \"%s\" on filesystem without ace acl support\n"),
+ jcr->last_fname);
+ return bacl_exit_error;
+ }
+ break;
+ default:
+ /**
+ * Stream id which doesn't describe the type of acl which is encoded.
+ */
+ break;
+ }
+ break;
+ }
+
+ if ((error = acl_fromtext(jcr->acl_data->content, &aclp)) != 0) {
+ Mmsg2(jcr->errmsg, _("acl_fromtext error on file \"%s\": ERR=%s\n"),
+ jcr->last_fname, acl_strerror(error));