- /*
- * Try restoring the extended attribute.
- */
- cnt = extattr_set_link(jcr->last_fname, current_attrnamespace,
- attrname, xattr->value, xattr->value_length);
- if (cnt < 0 || cnt != xattr->value_length) {
- switch (errno) {
- case ENOENT:
- break;
- default:
- Mmsg2(jcr->errmsg, _("extattr_set_link error on file \"%s\": ERR=%s\n"),
- jcr->last_fname, be.bstrerror());
- Dmsg2(100, "extattr_set_link error file=%s ERR=%s\n",
- jcr->last_fname, be.bstrerror());
- return bxattr_exit_error;
- break;
+ foreach_alist(current_xattr, xattr_value_list) {
+ /*
+ * Try splitting the xattr_name into a namespace and name part.
+ * The splitting character is a .
+ */
+ attrnamespace = current_xattr->name;
+ if ((attrname = strchr(attrnamespace, '.')) == (char *)NULL) {
+ Mmsg2(jcr->errmsg, _("Failed to split %s into namespace and name part on file \"%s\"\n"),
+ current_xattr->name, jcr->last_fname);
+ Dmsg2(100, "Failed to split %s into namespace and name part on file \"%s\"\n",
+ current_xattr->name, jcr->last_fname);
+ goto bail_out;
+ }
+ *attrname++ = '\0';
+
+ /*
+ * Make sure the attrnamespace makes sense.
+ */
+ if (extattr_string_to_namespace(attrnamespace, ¤t_attrnamespace) != 0) {
+ Mmsg2(jcr->errmsg, _("Failed to convert %s into namespace on file \"%s\"\n"),
+ attrnamespace, jcr->last_fname);
+ Dmsg2(100, "Failed to convert %s into namespace on file \"%s\"\n",
+ attrnamespace, jcr->last_fname);
+ goto bail_out;
+ }
+
+ /*
+ * Try restoring the extended attribute.
+ */
+ cnt = extattr_set_link(jcr->last_fname, current_attrnamespace,
+ attrname, current_xattr->value, current_xattr->value_length);
+ if (cnt < 0 || cnt != (int)current_xattr->value_length) {
+ switch (errno) {
+ case ENOENT:
+ goto bail_out;
+ break;
+ default:
+ Mmsg2(jcr->errmsg, _("extattr_set_link error on file \"%s\": ERR=%s\n"),
+ jcr->last_fname, be.bstrerror());
+ Dmsg2(100, "extattr_set_link error file=%s ERR=%s\n",
+ jcr->last_fname, be.bstrerror());
+ goto bail_out;
+ break;
+ }