OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_1-534-g4e7b6ff

Gerrit Code Review gerrit@openafs.org
Wed, 9 Oct 2024 19:34:37 -0400


The following commit has been merged in the master branch:
commit 4e7b6ffc8f6f21a9f524986d5a8c099b5b2eda7c
Author: Michael Meffie <mmeffie@sinenomine.net>
Date:   Tue Aug 17 20:54:23 2021 -0400

    vos: Check end of dump magic when file is seekable
    
    When restoring a volume with the -file argument, vos verifies the last
    four bytes of the file are the dump end magic before sending the dump to
    the volume server. Currently, this check is skipped when reading a dump
    from stdin because it is assumed the data is being read from a pipe.
    
    However, this assumption is not correct.  The file handle created from
    stdin may be seekable when redirection is used, and the file handle
    created from a file name may or may not be seekable, depending on the
    file type.
    
    For example, when redirecting a regular file to stdin, the file handle
    is seekable, since the shell opens the given file name and associates
    stdin with the opened file:
    
       $ vos restore ... < myfile
    
    In addition, the file handle is not seekable when specifying a named
    pipe (fifo) with the -file option:
    
       $ mkfifo mypipe
       $ vos restore ... -file mypipe
    
    Instead of assuming file handles opened from file names are always
    seekable and file handles opened from stdin are never seekable, use
    USD_IOCTL() to determine when file handles are seekable, and when
    seekable, verify the file ends with the dump end magic number.
    
    While here, be sure to check the return codes from seek and reads while
    checking for the dump end magic.
    
    Change-Id: I9d16b13682365b82cb9d0b3673c4ed7c3ab4dc2e
    Reviewed-on: https://gerrit.openafs.org/14758
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>

 src/volser/vos.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 47 insertions(+), 10 deletions(-)

-- 
OpenAFS Master Repository