OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_1-459-g4f8a5b1
Gerrit Code Review
gerrit@openafs.org
Fri, 2 Aug 2024 17:34:28 -0400
The following commit has been merged in the master branch:
commit 4f8a5b1a2295ba37eb4cb0eda2c459f07ac4f09a
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.
Change-Id: I166211c8814c13f4a79273efa6408a447f0855a9
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>
src/vol/volinfo-main.c | 5 +++++
src/vol/volscan-main.c | 5 +++++
2 files changed, 10 insertions(+)
--
OpenAFS Master Repository