Bug 1667096

Summary: lsmcli fs-export --anongid/anonuid allows invalid values
Product: Red Hat Enterprise Linux 7 Reporter: Jakub Krysl <jkrysl>
Component: libstoragemgmtAssignee: Tony Asleson <tasleson>
Status: CLOSED ERRATA QA Contact: Jakub Krysl <jkrysl>
Severity: low Docs Contact:
Priority: low    
Version: 7.6   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 12:40:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jakub Krysl 2019-01-17 12:50:24 UTC
Description of problem:
Valid values for user/group ID is 0 to 65534 with special -1 as omitted value. So giving values out of range -1 to 65534 should fail, but it does not.

Version-Release number of selected component (if applicable):
libstoragemgmt-1.7.2-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. lsmcli -u sim:// fs-export --fs FS_ID_00001 --exportpath /foo/bar --rw-host local --anonuid -2
2. lsmcli -u sim:// fs-export --fs FS_ID_00001 --exportpath /foo/bar --rw-host local --anongid -2
3. lsmcli -u sim:// fs-export --fs FS_ID_00001 --exportpath /foo/bar --rw-host local --anongid 65535
3. lsmcli -u sim:// fs-export --fs FS_ID_00001 --exportpath /foo/bar --rw-host local --anonuid 65535

Actual results:
fs exported

Expected results:
INAVLID_ARGUMENT(101)

Additional info:

Comment 2 Jakub Krysl 2019-01-17 12:59:01 UTC
netapp plugin anonuid invalid value results in PLUGIN_BUG(2), anongid shows correctly INVALID_AGUMENT(101)

# lsmcli -u "ontap+ssl://root@*****" fs-export --exportpath='/foo/bar' --fs='8c799d3f-01d0-4f29-9253-42fffbbfe29f' --rw-host local --anonuid='-2' -P
Password: 
PLUGIN_BUG(2): Append rules failed with error: Invalid argument  (vendor error code= 22)

# lsmcli -u "ontap+ssl://root@*****" fs-export --exportpath='/foo/bar' --fs='8c799d3f-01d0-4f29-9253-42fffbbfe29f' --rw-host local --anongid='-2' -P
Password: 
INVALID_ARGUMENT(101): ontap plugin does not support anon_gid setting

Comment 3 Tony Asleson 2019-02-11 17:20:03 UTC
UID & GID are unsigned values, thus < 0 should not be accepted as a valid input on the command line.  Internally in the API we use -1 & -2 to signify certain things, but that shouldn't be known or used for command line use.  As for the upper range, depending on the type and version of Unix like system it can vary.  For example older versions of Linux the limit was 16 bits, newer versions it's 32.  Thus I'm hesitant to impose an upper limit in the command line interface as we will likely get it wrong some times.  The plugin/array should be ultimately validating the value.

Comment 6 Jakub Krysl 2019-03-28 11:56:41 UTC
libstoragemgmt-1.7.3-2.el7.x86_64

# lsmcli -u "ontap+ssl://root@*****" fs-export --exportpath='/foo/bar' --fs='8c799d3f-01d0-4f29-9253-42fffbbfe29f' --rw-host local --anonuid='-2' -P
usage: lsmcli fs-export [-h] [-v] [-u <URI>] [-P] [-H] [-t <SEP>] [-e] [-f]
                        [-w CHILD_WAIT] [--header] [-b] [-s] --fs <FS_ID>
                        [--exportpath <EXPORT_PATH>] [--anonuid <ANON_UID>]
                        [--anongid <ANON_GID>] [--auth-type <AUTH_TYPE>]
                        [--root-host <ROOT_HOST>] [--ro-host <RO_HOST>]
                        [--rw-host <RW_HOST>]
lsmcli fs-export: error: argument --anonuid: invalid: require positive integer value '-2'

# lsmcli -u "ontap+ssl://root@*****" fs-export --exportpath='/foo/bar' --fs='8c799d3f-01d0-4f29-9253-42fffbbfe29f' --rw-host local --anongid='-2' -P
usage: lsmcli fs-export [-h] [-v] [-u <URI>] [-P] [-H] [-t <SEP>] [-e] [-f]
                        [-w CHILD_WAIT] [--header] [-b] [-s] --fs <FS_ID>
                        [--exportpath <EXPORT_PATH>] [--anonuid <ANON_UID>]
                        [--anongid <ANON_GID>] [--auth-type <AUTH_TYPE>]
                        [--root-host <ROOT_HOST>] [--ro-host <RO_HOST>]
                        [--rw-host <RW_HOST>]
lsmcli fs-export: error: argument --anongid: invalid: require positive integer value '-2'

Comment 8 errata-xmlrpc 2019-08-06 12:40:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2064