1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-12 16:56:15 +01:00

Fix retrieving a password in case a function returns another callable

This commit is contained in:
Daniel Mach 2023-10-13 14:26:28 +02:00
parent 225fea0e06
commit 53968bf91c

View File

@ -104,6 +104,11 @@ class Password(collections.UserString):
# we use the password only from time to time to make a session cookie
# and there's no need to keep the password in program memory longer than necessary
result = self._data()
# the function can also return a function, let's evaluate them recursively
while callable(result):
result = result()
if result is None:
raise oscerr.OscIOError(None, "Unable to retrieve password")
return result