-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
D-Bus: Send reply on auth failure #548
D-Bus: Send reply on auth failure #548
Conversation
@benzea @radosroka @muelli any thoughts? Thank you! 🙏 |
I would say, two possibilities:
|
@benzea thanks for your review. Did you get a chance to try out the function aspect of this change — does it work for you as expected?
I considered that option, but pulling that into
The current code in What do you think? |
@radosroka any thoughts? |
Hello, I like the idea of introducing an automatic reply on authentication failure. At first, I thought that this was a security measure similar to when you want to change to a different user but enter the wrong password and it lets you wait a few seconds. |
@@ -93,7 +97,11 @@ namespace usbguard | |||
} | |||
|
|||
if (method_name == "setParameter") { | |||
if (! isAuthorizedByPolkit(invocation)) { | |||
GDBusError authErrorCode = G_DBUS_ERROR_FAILED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to bundle the following lines? Doing so we could remove duplicate code as these occur many times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really see how, at least not in C++. Any concrete ideas how to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see two possibilities here:
- C++ solution what @benzea already suggested (D-Bus: Send reply on auth failure #548 (comment)) or
- a C-like solution using macros
Anyway, this is not a blocker :) I think it can be done in a later PR
Thanks for the PR! |
In reaction to comment #546 (comment) by @benzea.
The effect can be seen e.g. when running…
$ dbus-send --system --print-reply --dest=org.usbguard1 /org/usbguard1 org.usbguard1.getParameter string:ImplicitPolicyTarget
… (as non-root) and then hitting the
Cancel
button in the PolKit auth dialog. Previously,dbus-send
would continue to run waiting for a reply that is not coming with this pull request applied it shuts down properly saying:as expected.
Note that there are no changes to whether interactive authentication is requested from Polkit.
CC @benzea @radosroka @muelli