viced: Return separate error from ParseRights()master
commit877d75169f344f0409d77565a6f89315deaf3b5f
authorAndrew Deason <adeason@sinenomine.net>
Thu, 30 Jan 2025 19:09:41 +0000 (30 13:09 -0600)
committerAndrew Deason <adeason@sinenomine.net>
Fri, 7 Feb 2025 18:44:22 +0000 (7 13:44 -0500)
tree9946d3742adf05a4485fc836414ca30a658ee204
parent053659cab31bc78e0a80986e970c44adb51c51e0
viced: Return separate error from ParseRights()

Currently, if a user gives the 'H' right to the -implicit option, the
fileserver will silently exit with an error code. This happens because
we detect a bogus string given to -implicit by checking for a negative
return value from ParseRights(). But the 'H' right corresponds to
PRSFS_USR7, which is 0x80000000, so setting that bit makes the returned
value negative (since we return an afs_int32). So we interpret the
returned value as an error, and exit without printing out an error
message.

While we could check for the value -1 specifically to detect an error,
try to avoid this error-prone design and change ParseRights() to return
an error code separately from the parsed rights bitfield.

The only other place where we parse ACL rights in the tree is Convert()
in fs.c. That function just exit()s on an invalid string, and so callers
do not check for errors at all and don't need to be updated in this
commit.

Change-Id: I0ebbee2c7e7afefb36a5fbfd7b67e086d9a281bd
Reviewed-on: https://gerrit.openafs.org/16223
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
src/viced/viced.c