Skip to content
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

Multiple errors on wrong password entry at lock screen #943

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,11 @@ SPDX-FileCopyrightText = "Copyright (c) 2017-2020, Linaro Limited"
path = [
"targets/nvidia-jetson-orin/0001-ta-pkcs11-Build-time-option-for-controlling-pin-lock.patch"
]

[[annotations]]
SPDX-License-Identifier = "GPL-3.0-only"
SPDX-FileCopyrightText = "Copyright (C) 2007 Free Software Foundation, Inc."
path = [
"overlays/custom-packages/gtklock/*.patch"
]

3 changes: 1 addition & 2 deletions modules/desktop/graphics/labwc.config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ let
drawerStyle = pkgs.callPackage ./styles/launcher-style.nix { };
inherit (config.ghaf.services.audio) pulseaudioTcpControlPort;
gtklockStyle = pkgs.callPackage ./styles/lock-style.nix { };
gtklockLayout = pkgs.callPackage ./styles/lock-layout.nix { };
autostart = pkgs.writeShellApplication {
name = "labwc-autostart";

Expand Down Expand Up @@ -255,7 +254,7 @@ let
gtklockConfig = ''
[main]
style=${gtklockStyle}
layout=${gtklockLayout}
layout=${pkgs.gtklock}/share/layout/gtklock.ui.xml
date-format=%A, %b %d
modules=${pkgs.gtklock-powerbar-module}/lib/gtklock/powerbar-module.so;${pkgs.gtklock-userinfo-module}/lib/gtklock/userinfo-module.so
#background=
Expand Down
137 changes: 0 additions & 137 deletions modules/desktop/graphics/styles/lock-layout.nix

This file was deleted.

1 change: 1 addition & 0 deletions overlays/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The status of the integration in nixpkgs can be tracked using the [Pull Request
## From Overlays

[gtklock-userinfo-module: update](https://github.com/jovanlanik/gtklock-userinfo-module/commit/aa4b5832185d2dd9e7f88826fd9d03e3d5ea1ad6)
[gtklock: Multiple errors on wrong password](https://github.com/jovanlanik/gtklock/pull/119)

## carried in tiiuae/nixpkgs/...
[texinfo: cross compile failure](https://github.com/NixOS/nixpkgs/pull/328919)
1 change: 1 addition & 0 deletions overlays/custom-packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
final.libsForQt5.callPackage ../../packages/globalprotect-openconnect
{ };
gtklock-userinfo-module = import ./gtklock-userinfo-module { inherit prev; };
gtklock = import ./gtklock { inherit prev; };
})
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

18 changes: 18 additions & 0 deletions overlays/custom-packages/gtklock/default.nix
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
gngram marked this conversation as resolved.
Show resolved Hide resolved
];

postInstall = ''
mkdir -p $out/share/layout
cp ${oldAttrs.src}/res/gtklock.ui $out/share/layout/gtklock.ui.xml
'';
})
Loading