OpenAFS Master Repository branch, openafs-stable-1_8_x, updated. openafs-stable-1_8_13_2-26-g141469d

Gerrit Code Review gerrit@openafs.org
Thu, 20 Mar 2025 17:28:43 -0400


The following commit has been merged in the openafs-stable-1_8_x branch:
commit 141469dc16e2af16750ed89b9fa1443385b50e79
Author: Marcio Barbosa <mbarbosa@sinenomine.net>
Date:   Wed Jul 31 08:26:59 2024 +0000

    volinfo: Refuse zero and non-numeric -volumeid
    
    Currently, volinfo/volscan offers an optional -volumeid parameter,
    allowing users to specify the id of a single volume to generate output
    for. If this option is omitted, volinfo/volscan processes every volume
    in the specified partition, or all local partitions if no partition is
    specified. Internally, when the -volumeid parameter is not provided, its
    corresponding variable defaults to 0, which volinfo/volscan interprets
    as an indication to process all volumes.
    
    Unfortunately, if an invalid volume id is specified (e.g., a volume name
    instead of a number), volinfo/volscan incorrectly treats it as 0 and
    processes all volumes instead of validating the input and notifying the
    user. This issue occurs because strtoul(), the function used to convert
    the volume id string to a number, returns 0 when it fails to perform a
    valid conversion, leading volinfo/volscan to misinterpret invalid volume
    ids as 0.
    
    This commit fixes this issue by adding validation for the -volumeid
    option. It parses the result from strtoul() and returns an error if the
    volume id is invalid. This ensures that users are properly informed when
    an invalid id is provided, preventing unintended processing of all
    volumes in the given partition.
    
    Reviewed-on: https://gerrit.openafs.org/15771
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    (cherry picked from commit 4f8a5b1a2295ba37eb4cb0eda2c459f07ac4f09a)
    
    Change-Id: I068bd2ffa5e1e055b0e7fb3de874cc0bad0a3b71
    Reviewed-on: https://gerrit.openafs.org/15817
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

 src/vol/volinfo-main.c | 5 +++++
 src/vol/volscan-main.c | 5 +++++
 2 files changed, 10 insertions(+)

-- 
OpenAFS Master Repository