diff --git a/REUSE.toml b/REUSE.toml index 1a1234d0d..5837cbc06 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -134,3 +134,10 @@ 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" +] diff --git a/modules/desktop/graphics/labwc.config.nix b/modules/desktop/graphics/labwc.config.nix index 85151cec6..e0435dab9 100644 --- a/modules/desktop/graphics/labwc.config.nix +++ b/modules/desktop/graphics/labwc.config.nix @@ -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"; @@ -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= diff --git a/modules/desktop/graphics/styles/lock-layout.nix b/modules/desktop/graphics/styles/lock-layout.nix deleted file mode 100644 index 1ee3f4efd..000000000 --- a/modules/desktop/graphics/styles/lock-layout.nix +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors -# SPDX-License-Identifier: Apache-2.0 - -# Ghaf lock screen layout -# Base layout taken from gtklock upstream: https://github.com/jovanlanik/gtklock/blob/master/res/gtklock.ui -{ - writeText, - ... -}: -writeText "gtklock.ui.xml" '' - - - - window-box - 100 - center - center - vertical - 30 - - - info-box - center - vertical - 10 - - - time-box - center - vertical - - - clock-label - center - - - - - date-label - center - - - - - - - - - crossfade - 0 - - - 30 - 5 - - - input-field - Password - 380 - 0 - 0 - password - view-reveal-symbolic - - - - - 1 - 0 - 2 - - - - - none - 1 - - - never - 256 - 1 - - - - - vertical - 1 - - - - - - - - - 1 - 1 - 2 - - - - - center - top - 15 - vertical - 0 - true - true - - - warning-label - true - true - - - - - error-label - true - true - - - - - 1 - 2 - 2 - - - - - - - - -'' diff --git a/overlays/custom-packages/default.nix b/overlays/custom-packages/default.nix index 1bd4f08a5..ad6cad0f3 100644 --- a/overlays/custom-packages/default.nix +++ b/overlays/custom-packages/default.nix @@ -21,4 +21,5 @@ final.libsForQt5.callPackage ../../packages/globalprotect-openconnect { }; gtklock-userinfo-module = import ./gtklock-userinfo-module { inherit prev; }; + gtklock = import ./gtklock { inherit prev; }; }) diff --git a/overlays/custom-packages/gtklock/0001-Multiple-errors-on-wrong-password.patch b/overlays/custom-packages/gtklock/0001-Multiple-errors-on-wrong-password.patch new file mode 100644 index 000000000..cb9052d02 --- /dev/null +++ b/overlays/custom-packages/gtklock/0001-Multiple-errors-on-wrong-password.patch @@ -0,0 +1,64 @@ +From a5913c0ed15ad7e07fdc7d979355a58d32666793 Mon Sep 17 00:00:00 2001 +From: Ganga Ram +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 +--- + 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 + diff --git a/overlays/custom-packages/gtklock/default.nix b/overlays/custom-packages/gtklock/default.nix new file mode 100644 index 000000000..603e00bfc --- /dev/null +++ b/overlays/custom-packages/gtklock/default.nix @@ -0,0 +1,16 @@ +# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# +# TODO: Remove patch, once there new release for gtklock-userinfo-module +# +{ 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 + ''; +})