KWallet password retrieval broken by incorrect get_result() return type #2328
+161
−2,021
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit 68e0452 introduced a bug in
get_result()that caused all KWallet password lookups to fail. The method was changed to returnKWalletResultenums, but the implementation had two critical flaws:KWalletResult.from_variant(result.arguments())passed the entire arguments list instead ofresult.arguments()[0]. SinceKWalletResultcan only be constructed from integers 0, 1, or 2, passing a list always raised ValueError and returnedKWalletResult.INVALID.The abstraction was fundamentally wrong - DBus methods return different types (bool for
isEnabled/hasEntry, str forreadPassword/networkWallet, int foropen), but everything was being converted to a 3-value enum.This caused:
get_password()to always return None (hasEntry check always failed)try_unlock()to always prompt for a new wallet nameFix: Restore
get_result()to return raw DBus values (arguments[0]) while keeping the improved error handling. Update all call sites to check forNone/truthy values instead of enum comparisons.Fixes #2327