diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2024-03-30 04:27:45 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2024-03-30 04:27:45 +0000 |
commit | d34665c0d0293a2f5a1063dd052963303727753c (patch) | |
tree | d862c4ce5d285070b1505f57037fb0b4156ddbac | |
parent | 41524d6c4d792c4350c3b9062c08c6590505079d (diff) |
allow WAYLAND_DISPLAY to enable SSH_ASKPASS
From dkg via GHPR479; ok dtucker@
-rw-r--r-- | usr.bin/ssh/readpass.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/ssh/readpass.c b/usr.bin/ssh/readpass.c index d94a21b823b..420736e2612 100644 --- a/usr.bin/ssh/readpass.c +++ b/usr.bin/ssh/readpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readpass.c,v 1.70 2022/05/27 04:27:49 dtucker Exp $ */ +/* $OpenBSD: readpass.c,v 1.71 2024/03/30 04:27:44 djm Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * @@ -124,8 +124,9 @@ read_passphrase(const char *prompt, int flags) const char *askpass_hint = NULL; const char *s; - if ((s = getenv("DISPLAY")) != NULL) - allow_askpass = *s != '\0'; + if (((s = getenv("DISPLAY")) != NULL && *s != '\0') || + ((s = getenv("WAYLAND_DISPLAY")) != NULL && *s != '\0')) + allow_askpass = 1; if ((s = getenv(SSH_ASKPASS_REQUIRE_ENV)) != NULL) { if (strcasecmp(s, "force") == 0) { use_askpass = 1; @@ -258,7 +259,7 @@ notify_start(int force_askpass, const char *fmt, ...) debug3_f("cannot notify: no askpass"); goto out; } - if (getenv("DISPLAY") == NULL && + if (getenv("DISPLAY") == NULL && getenv("WAYLAND_DISPLAY") == NULL && ((s = getenv(SSH_ASKPASS_REQUIRE_ENV)) == NULL || strcmp(s, "force") != 0)) { debug3_f("cannot notify: no display"); |