0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-12 09:41:18 +02:00

fix: use euidaccess to check permissions

This commit is contained in:
MusiKid 2022-01-26 12:52:45 +01:00 committed by musikid
parent 42d18c8db5
commit ab79c5b674
No known key found for this signature in database
GPG key ID: 7567D43648C6E2F4

View file

@ -359,10 +359,11 @@ auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
if (workaround == Workaround::Native && pass_task.is_active()) {
pass_task.stop(true);
} else if (workaround == Workaround::Input) {
if (geteuid() != 0) {
syslog(LOG_WARNING, "Insufficient permission to create the fake device");
// We check if we have the right permissions on /dev/uinput
if (euidaccess("/dev/uinput", W_OK | R_OK) != 0) {
syslog(LOG_WARNING, "Insufficient permissions to create the fake device");
conv_function(PAM_ERROR_MSG,
S("Insufficient permission to send Enter "
S("Insufficient permissions to send Enter "
"press, waiting for user to press it instead"));
} else {
try {