Describe the bug
If extra messages get added to profile extract data in result xml returned by IRRSMO00, it should not be included in the Python dictionary that the XML gets transformed into.
To Reproduce
Steps to reproduce the behavior:
Logon to a z/OS user id that is only authorized to extract their own base segment but no other segments.
Ensure an affected version of pyRACF is installed.
Extract the user's own profile and include additional segments.
from pyracf import UserAdmin
user_admin = UserAdmin()
# An even number of additional segments results in extraneous
# malformed data being added to the extracted profile data
user_admin.extract("squidwrd", segments=["omvs", "tso"]
# An odd number of additional segments results in a stack trace.
user_admin.extract("squidwrd", segments=["omvs"]
Expected behavior
All profile extract functions or more specifically anything that executes the listdata operation, should exclude any extra messages attached to the end of the result xml.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/u/squidwrd/.local/lib/python3.11/site-packages/pyracf/user/user_admin.py", line 810, in extract
result = self._extract_and_check_result(user_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/squidwrd/.local/lib/python3.11/site-packages/pyracf/common/security_admin.py", line 130, in _extract_and_check_result
self._format_profile(result)
File "/u/squidwrd/.local/lib/python3.11/site-packages/pyracf/user/user_admin.py", line 838, in _format_profile
profile = self._format_profile_generic(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/squidwrd/.local/lib/python3.11/site-packages/pyracf/common/security_admin.py", line 379, in _format_profile_generic
i = self.__format_user_profile_data(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/squidwrd/.local/lib/python3.11/site-packages/pyracf/common/security_admin.py", line 478, in __format_user_profile_data
messages[i] = f"{messages[i]}={messages[i+1]}"
~~~~~~~~^^^^^
IndexError: list index out of range
Environment Information:
z/OS Version: 2.4
Python Version: 3.11
is RSecMgtOper (IRRSMO00)_ setup? Yes
Additional context
Add any other context about the problem here.
Describe the bug If extra messages get added to profile extract data in result xml returned by IRRSMO00, it should not be included in the Python dictionary that the XML gets transformed into.
To Reproduce Steps to reproduce the behavior:
Expected behavior All profile extract functions or more specifically anything that executes the
listdata
operation, should exclude any extra messages attached to the end of the result xml.Console Output
Two Additional Segments:
Result XML
Result Dictionary
One Additional Segment
Result XML
Stack Trace
Environment Information:
Additional context Add any other context about the problem here.