]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - repair/attr_repair.c
xfs_repair: allow '/' in attribute names
[thirdparty/xfsprogs-dev.git] / repair / attr_repair.c
index 1d04500ffe2f79997b0980196eb7e29eabdede70..5ad81c091ea4d3317d1288ee07166ea6e700a52b 100644 (file)
@@ -122,6 +122,14 @@ set_da_freemap(xfs_mount_t *mp, da_freemap_t *map, int start, int stop)
  * fork being emptied and put in shortform format.
  */
 
+static int
+attr_namecheck(
+       uint8_t *name,
+       int     length)
+{
+       return namecheck((char *)name, length, false);
+}
+
 /*
  * This routine just checks what security needs are for attribute values
  * only called when root flag is set, otherwise these names could exist in
@@ -292,11 +300,9 @@ process_shortform_attr(
                        }
                }
 
-               /* namecheck checks for / and null terminated for file names.
-                * attributes names currently follow the same rules.
-               */
-               if (namecheck((char *)&currententry->nameval[0],
-                                               currententry->namelen))  {
+               /* namecheck checks for null chars in attr names. */
+               if (attr_namecheck(currententry->nameval,
+                                               currententry->namelen)) {
                        do_warn(
        _("entry contains illegal character in shortform attribute name\n"));
                        junkit = 1;
@@ -458,7 +464,7 @@ process_leaf_attr_local(
        xfs_attr_leaf_name_local_t *local;
 
        local = xfs_attr3_leaf_name_local(leaf, i);
-       if (local->namelen == 0 || namecheck((char *)&local->nameval[0],
+       if (local->namelen == 0 || attr_namecheck(local->nameval,
                                                        local->namelen)) {
                do_warn(
        _("attribute entry %d in attr block %u, inode %" PRIu64 " has bad name (namelen = %d)\n"),
@@ -513,7 +519,7 @@ process_leaf_attr_remote(
 
        remotep = xfs_attr3_leaf_name_remote(leaf, i);
 
-       if (remotep->namelen == 0 || namecheck((char *)&remotep->name[0],
+       if (remotep->namelen == 0 || attr_namecheck(remotep->name,
                                                remotep->namelen) ||
                        be32_to_cpu(entry->hashval) !=
                                libxfs_da_hashname((unsigned char *)&remotep->name[0],