Re: [hackers] [slock][PATCH] Support ^U for clearing password

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat, 16 Aug 2025 11:15:26 +0200

On Fri, Aug 15, 2025 at 07:30:19PM -0400, Drew Marino wrote:
> ^U is a fairly common key combo for clearing fields, this patch adds
> support for it.
> ---
> slock.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/slock.c b/slock.c
> index b5a9b04..b5d05b1 100644
> --- a/slock.c
> +++ b/slock.c
> _AT_@ -185,6 +185,9 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
> (len + num < sizeof(passwd))) {
> memcpy(passwd + len, buf, num);
> len += num;
> + } else if (buf[0] == '\025') {
> + explicit_bzero(&passwd, sizeof(passwd));
> + len = 0;
> }
> break;
> }
> --
> 2.50.1
>
>

Thanks, I pushed the patch with an added comment for the ctrl-u combo.

I was thinking of changing it so the mask for XKeyEvent (ev->state) ControlMask
is checked. Maybe like dwm does with the CLEANMASK() macro, but I'm not sure
it's neccesary and your current version looks simpler.

-- 
Kind regards,
Hiltjo
Received on Sat Aug 16 2025 - 11:15:26 CEST

This archive was generated by hypermail 2.3.0 : Sat Aug 16 2025 - 11:24:35 CEST