verifiers: File type for fine-grained signature-verification controlling

Let's provide file type info to the I/O layer. This way verifiers
framework and its users will be able to differentiate files and verify
only required ones.

This is preparatory patch.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
This commit is contained in:
Vladimir Serbinenko 2013-11-20 02:28:29 +01:00 committed by Vincent Batts
parent e1bc2b23f1
commit aebe31c375
70 changed files with 292 additions and 221 deletions

View file

@ -120,9 +120,9 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
return;
}
if (uncompress == 0)
grub_file_filter_disable_compression ();
file = grub_file_open (pathname);
file = grub_file_open (pathname, ((uncompress == 0)
? GRUB_FILE_TYPE_NO_DECOMPRESS : GRUB_FILE_TYPE_NONE)
| GRUB_FILE_TYPE_FSTEST);
if (!file)
{
grub_util_error (_("cannot open `%s': %s"), pathname,

View file

@ -208,7 +208,7 @@ fuse_getattr (const char *path, struct stat *st)
if (!ctx.file_info.dir)
{
grub_file_t file;
file = grub_file_open (path);
file = grub_file_open (path, GRUB_FILE_TYPE_GET_SIZE);
if (! file && grub_errno == GRUB_ERR_BAD_FILE_TYPE)
{
grub_errno = GRUB_ERR_NONE;
@ -244,7 +244,7 @@ static int
fuse_open (const char *path, struct fuse_file_info *fi __attribute__ ((unused)))
{
grub_file_t file;
file = grub_file_open (path);
file = grub_file_open (path, GRUB_FILE_TYPE_MOUNT);
if (! file)
return translate_error ();
files[first_fd++] = file;
@ -308,7 +308,7 @@ fuse_readdir_call_fill (const char *filename,
grub_file_t file;
char *tmp;
tmp = xasprintf ("%s/%s", ctx->path, filename);
file = grub_file_open (tmp);
file = grub_file_open (tmp, GRUB_FILE_TYPE_GET_SIZE);
free (tmp);
/* Symlink to directory. */
if (! file && grub_errno == GRUB_ERR_BAD_FILE_TYPE)