Skip to content

Commit

Permalink
add 'auth' debug category, support 'GETPIN' messages
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Oct 14, 2021
1 parent b517d04 commit 151a2dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions xpra/scripts/pinentry_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from xpra.exit_codes import EXIT_UNSUPPORTED
from xpra.log import Logger

log = Logger("exec")
log = Logger("exec", "auth")

SKIP_UI = envbool("XPRA_SKIP_UI", False)
PINENTRY = envbool("XPRA_SSH_PINENTRY", POSIX and not OSX)
Expand Down Expand Up @@ -82,7 +82,8 @@ def do_run_pinentry(proc, get_input, process_output):
while proc.poll() is None:
try:
line = proc.stdout.readline()
process_output(message, line)
while process_output(message, line):
pass
message = get_input()
if message is None:
break
Expand Down Expand Up @@ -110,6 +111,10 @@ def get_input():
return messages.pop(0)
def process_output(message, output):
if message=="GETPIN":
if output.startswith(b"S "):
log("getpin message: %s", bytestostr(output[2:]))
#ie: 'S PASSWORD_FROM_CACHE'
return True #read more data
if output.startswith(b"D "):
pin_value = output[2:].rstrip(b"\n\r").decode()
pin_cb(pin_value)
Expand Down

0 comments on commit 151a2dc

Please sign in to comment.