Am 2019-08-12 16:20, schrieb Franklin, Jason:
On Fri, Aug 9, 2019 at 8:15 PM Thiago Macieira <thi...@kde.org> wrote:
On Thursday, 8 August 2019 12:00:34 PDT Franklin, Jason wrote:
> However, after trying several invocations, I can't get the tool to behave as
> expected (i.e., take a password on stdin and exit with 0/1 on success/
> failure).
That's because the tool does not take the password on stdin.
$ /usr/lib64/libexec/kcheckpass
Only binary protocol supported
You need to pass a file descriptor number with the -S option.
This is what I discovered when trying it myself. This means that the
commentary in the code for kcheckpass is way out of sync with the
actual
behavior of the tool.
I think this should be fixed, and I'd be willing to help.
I'm also curious, why doesn't the following work?
echo -n 'test' | /usr/lib64/libexec/kcheckpass -S 0
I get "Communication breakdown on write". Seems like passing to stdin
with
file descriptor 0 should work.
kcheckpass.c also makes debugging difficult, by setting a bunch of
options to
prevent unauthorised attaching to the process. You need to modify the
source
to turn those off.
I really appreciate your response and the tip you provided here. I'll
do my best to
investigate further.
However, I've noticed that this process is not well-documented at all.
The README
file included with kcheckpass isn't very helpful in guiding someone to
debugging
the code. Also, installing a Debian dbgsym package doesn't seem to be
sufficient, as
you noted here.
I'd be very willing to help with this, but the package maintainers
haven't responded
to my query yet. I submitted the bug report below:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=934185
I'm still hoping to hear back!
I was probably the last one who touched the code and performed cleanups.
Kcheckpass is not meant to be used from a command line - I'm sorry,
that's just not the use case. We only use the binary protocol in
kscreenlocker and removed everything else. The implementation is in:
https://cgit.kde.org/kscreenlocker.git/tree/greeter/authenticator.cpp
It's a pretty much stand alone class, so you can wrap this in an own
class to interact with it.
Cheers
Martin