2 Commits

2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -26,7 +26,10 @@ def search(*, config: Config, arguments: Arguments) -> typing.Iterable[Result]:
if arguments.krb: if arguments.krb:
ldap_con.sasl_gssapi_bind_s() ldap_con.sasl_gssapi_bind_s()
else: else:
ldap_con.simple_bind_s(realm.account, config.get_password(realm)) password = config.get_password(realm)
# use only first line (and without whitespace); assume remaining lines are comments/...
password = password.splitlines()[0].strip()
ldap_con.simple_bind_s(realm.account, password)
assert arguments.base assert arguments.base
assert arguments.filter assert arguments.filter
+4 -1
View File
@@ -121,7 +121,10 @@ class Keyringer(PasswordManager):
check=True, check=True,
encoding="utf-8", encoding="utf-8",
) )
return result.stdout.strip() password = result.stdout.strip()
if "Nothing matches , try again." in password:
raise SystemExit(f"No password stored for {secretname}")
return password
@dataclasses.dataclass @dataclasses.dataclass