-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes multiple errors on wrong password entry at lock screen Signed-off-by: Ganga Ram <[email protected]>
- Loading branch information
Showing
7 changed files
with
93 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
overlays/custom-packages/gtklock/0001-Multiple-errors-on-wrong-password.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
From a5913c0ed15ad7e07fdc7d979355a58d32666793 Mon Sep 17 00:00:00 2001 | ||
From: Ganga Ram <[email protected]> | ||
Date: Thu, 26 Dec 2024 08:56:18 +0400 | ||
Subject: [PATCH] Multiple errors on wrong password | ||
|
||
gtklock tries to reauthenticate using old wrong password which | ||
results the error. This patch stops authentication if password is | ||
incorrect. | ||
|
||
Signed-off-by: Ganga Ram <[email protected]> | ||
--- | ||
src/auth.c | 15 ++++++++++++--- | ||
1 file changed, 12 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/src/auth.c b/src/auth.c | ||
index 53e6628..364be36 100644 | ||
--- a/src/auth.c | ||
+++ b/src/auth.c | ||
@@ -15,6 +15,7 @@ | ||
#include "auth.h" | ||
|
||
struct conv_data { | ||
+ char authentication_err; | ||
const char *pw; | ||
int *err; | ||
int *out; | ||
@@ -58,6 +59,12 @@ static int conversation( | ||
switch(msg[i]->msg_style) { | ||
case PAM_PROMPT_ECHO_OFF: | ||
case PAM_PROMPT_ECHO_ON: | ||
+ if (data->authentication_err == 1) { | ||
+ free(*resp); | ||
+ *resp = NULL; | ||
+ return PAM_ABORT; | ||
+ } | ||
+ | ||
resp[i]->resp = strdup(data->pw); | ||
if(resp[i]->resp == NULL) { | ||
g_warning("Failed allocation"); | ||
@@ -65,8 +72,10 @@ static int conversation( | ||
} | ||
break; | ||
case PAM_ERROR_MSG: | ||
- send_msg(msg[i]->msg, data->err[1]); | ||
- break; | ||
+ //send_msg(msg[i]->msg, data->err[1]); | ||
+ g_warning("gtklock: Wrong password!"); | ||
+ data->authentication_err = 1; | ||
+ break; | ||
case PAM_TEXT_INFO: | ||
send_msg(msg[i]->msg, data->out[1]); | ||
break; | ||
@@ -88,7 +97,7 @@ static void auth_child(const char *s, int *err, int *out) { | ||
char *username = pwd->pw_name; | ||
int pam_status; | ||
struct pam_handle *handle; | ||
- struct conv_data data = { .pw = s, .err = err, .out = out }; | ||
+ struct conv_data data = { .authentication_err = 0, .pw = s, .err = err, .out = out }; | ||
struct pam_conv conv = { conversation, (void *)&data }; | ||
pam_status = pam_start("gtklock", username, &conv, &handle); | ||
if(pam_status != PAM_SUCCESS) { | ||
-- | ||
2.47.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# TODO: Remove patch, once the fix is available in gtklock | ||
# | ||
# https://github.com/jovanlanik/gtklock/pull/119 | ||
# | ||
{ prev }: | ||
prev.gtklock.overrideAttrs (oldAttrs: { | ||
patches = [ | ||
./0001-Multiple-errors-on-wrong-password.patch | ||
]; | ||
|
||
postInstall = '' | ||
mkdir -p $out/share/layout | ||
cp ${oldAttrs.src}/res/gtklock.ui $out/share/layout/gtklock.ui.xml | ||
''; | ||
}) |