Closed mpotra closed 2 years ago
lgtm, I am wondering why you using custom
run_command
function, but this is ok for me.In case
run_command
is justified, might it be moved to another module for reuse ?
Ah, indeed, there was no other need for it, so I've removed it and placed the body within the calling function. Thanks for pointing it out to me
Currently, the connection to the unix socket fails when using External auth mech for any user that does not have the UID 1000 The reason is that the default cookie is set for UID 1000, and for example
root
user has UID 0 which fails the auth.While there is the option to provide a different cookie via the
external_cookie
application env variable, this PR introduces thesystem_user
value as a way of automatically attempting to determine the correct UID and set the hex-encoded cookie accordingly.The steps are, somewhat similar to what session_sha1 mech does, but expanded:
USER
env variableid -u <user>
command?cookie
This way, by simply setting
application:set_env(dbus, external_cookie, system_user)
from any application that relies onerlang-dbus
, the UID is resolved automatically or fails gracefully to the default.