return ret;
}
+static int encrypted_check_name(e2fsck_t ctx,
+ struct ext2_dir_entry *dirent,
+ struct problem_context *pctx)
+{
+ if (ext2fs_dirent_name_len(dirent) < EXT4_CRYPTO_BLOCK_SIZE) {
+ if (fix_problem(ctx, PR_2_BAD_ENCRYPTED_NAME, pctx)) {
+ dirent->inode = 0;
+ return 1;
+ }
+ ext2fs_unmark_valid(ctx->fs);
+ }
+ return 0;
+}
+
/*
* Check the directory filetype (if present)
*/
if (!encrypted && check_name(ctx, dirent, &cd->pctx))
dir_modified++;
+ if (encrypted && (dot_state) > 1 &&
+ encrypted_check_name(ctx, dirent, &cd->pctx)) {
+ dir_modified++;
+ goto next;
+ }
+
if (check_filetype(ctx, dirent, ino, &cd->pctx))
dir_modified++;
N_("Fixing size of inline @d @i %i failed.\n"),
PROMPT_TRUNCATE, 0 },
+ /* Encrypted directory entry is too short */
+ { PR_2_BAD_ENCRYPTED_NAME,
+ N_("Encrypted @E is too short.\n"),
+ PROMPT_CLEAR, 0 },
+
/* Pass 3 errors */
/* Pass 3: Checking directory connectivity */
/* fixing inline dir size failed */
#define PR_2_FIX_INLINE_DIR_FAILED 0x02004F
+/* Encrypted directory entry is too short */
+#define PR_2_BAD_ENCRYPTED_NAME 0x020050
+
/*
* Pass 3 errors
*/
#define EXT4_MAX_KEY_SIZE 64
#define EXT4_KEY_DESCRIPTOR_SIZE 8
+#define EXT4_CRYPTO_BLOCK_SIZE 16
/* Password derivation constants */
#define EXT4_MAX_PASSPHRASE_SIZE 1024
--- /dev/null
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Encrypted entry 'motd' in /get_shorty (12) is too short.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Unattached inode 13
+Connect to /lost+found? yes
+
+Inode 13 ref count is 2, should be 1. Fix? yes
+
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/16 files (0.0% non-contiguous), 23/100 blocks
+Exit status is 1
--- /dev/null
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/16 files (0.0% non-contiguous), 23/100 blocks
+Exit status is 0
--- /dev/null
+short encrypted directory entry