1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

Merge pull request #1431 from dmach/fix-keyring-keyutils-callable-password

Fix retrieving a password in case a function returns another callable
This commit is contained in:
Daniel Mach 2023-10-13 20:22:59 +02:00 committed by GitHub
commit 2aa7c17331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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