* 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
}
/* namecheck checks for null chars in attr names. */
- if (attr_namecheck(currententry->nameval,
- currententry->namelen)) {
+ if (!libxfs_attr_namecheck(currententry->nameval,
+ currententry->namelen)) {
do_warn(
_("entry contains illegal character in shortform attribute name\n"));
junkit = 1;
xfs_attr_leaf_name_local_t *local;
local = xfs_attr3_leaf_name_local(leaf, i);
- if (local->namelen == 0 || attr_namecheck(local->nameval,
- local->namelen)) {
+ if (local->namelen == 0 ||
+ !libxfs_attr_namecheck(local->nameval,
+ local->namelen)) {
do_warn(
_("attribute entry %d in attr block %u, inode %" PRIu64 " has bad name (namelen = %d)\n"),
i, da_bno, ino, local->namelen);
remotep = xfs_attr3_leaf_name_remote(leaf, i);
- if (remotep->namelen == 0 || attr_namecheck(remotep->name,
- remotep->namelen) ||
- be32_to_cpu(entry->hashval) !=
- libxfs_da_hashname((unsigned char *)&remotep->name[0],
- remotep->namelen) ||
- be32_to_cpu(entry->hashval) < last_hashval ||
- be32_to_cpu(remotep->valueblk) == 0) {
+ if (remotep->namelen == 0 ||
+ !libxfs_attr_namecheck(remotep->name,
+ remotep->namelen) ||
+ be32_to_cpu(entry->hashval) !=
+ libxfs_da_hashname((unsigned char *)&remotep->name[0],
+ remotep->namelen) ||
+ be32_to_cpu(entry->hashval) < last_hashval ||
+ be32_to_cpu(remotep->valueblk) == 0) {
do_warn(
_("inconsistent remote attribute entry %d in attr block %u, ino %" PRIu64 "\n"), i, da_bno, ino);
return -1;
#include "bmap.h"
#include "da_util.h"
-/*
- * Takes a name and length (name need not be null-terminated) and whether
- * we are checking a dir (as opposed to an attr).
- * Returns 1 if the name contains a NUL or if a directory entry contains a '/'.
- * Returns 0 if the name checks out.
- */
-int
-namecheck(
- char *name,
- int length,
- bool isadir)
-{
- char *c;
- int i;
-
- ASSERT(length < MAXNAMELEN);
-
- for (c = name, i = 0; i < length; i++, c++) {
- if (isadir && *c == '/')
- return 1;
- if (*c == '\0')
- return 1;
- }
-
- return 0;
-}
-
/*
* the cursor gets passed up and down the da btree processing
* routines. The interior block processing routines use the
l->ino = ino;
}
-static int
-dir_namecheck(
- uint8_t *name,
- int length)
-{
- return namecheck((char *)name, length, true);
-}
-
int
dir2_is_badino(
xfs_ino_t ino)
* the length value is stored in a byte
* so it can't be too big, it can only wrap
*/
- if (dir_namecheck(sfep->name, namelen)) {
+ if (!libxfs_dir2_namecheck(sfep->name, namelen)) {
/*
* junk entry
*/
* during phase 4.
*/
junkit = dep->name[0] == '/';
- nm_illegal = dir_namecheck(dep->name, dep->namelen);
+ nm_illegal = !libxfs_dir2_namecheck(dep->name, dep->namelen);
if (ino_discovery && nm_illegal) {
do_warn(
_("entry at block %u offset %" PRIdPTR " in directory inode %" PRIu64 " has illegal name \"%*.*s\": "),