[openssh-commits] [openssh] 01/08: upstream: let the "Confirm user presence for key ..." ssh-askpass
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Aug 27 11:28:43 AEST 2020
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit e9c2002891a7b8e66f4140557a982978f372e5a3
Author: djm at openbsd.org <djm at openbsd.org>
Date: Tue Aug 11 09:45:54 2020 +0000
upstream: let the "Confirm user presence for key ..." ssh-askpass
notification respect $SSH_ASKPASS_REQUIRE; ok markus@
OpenBSD-Commit-ID: 7c1a616b348779bda3b9ad46bf592741f8e206c1
---
readpass.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/readpass.c b/readpass.c
index 69edce30..122d2a87 100644
--- a/readpass.c
+++ b/readpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readpass.c,v 1.62 2020/07/14 23:57:01 djm Exp $ */
+/* $OpenBSD: readpass.c,v 1.63 2020/08/11 09:45:54 djm Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
*
@@ -235,8 +235,8 @@ notify_start(int force_askpass, const char *fmt, ...)
int devnull;
pid_t pid;
void (*osigchld)(int);
- const char *askpass;
- struct notifier_ctx *ret;
+ const char *askpass, *s;
+ struct notifier_ctx *ret = NULL;
va_start(args, fmt);
xvasprintf(&prompt, fmt, args);
@@ -248,15 +248,19 @@ notify_start(int force_askpass, const char *fmt, ...)
(void)write(STDERR_FILENO, "\r", 1);
(void)write(STDERR_FILENO, prompt, strlen(prompt));
(void)write(STDERR_FILENO, "\r\n", 2);
- free(prompt);
- return NULL;
+ goto out;
}
if ((askpass = getenv("SSH_ASKPASS")) == NULL)
askpass = _PATH_SSH_ASKPASS_DEFAULT;
- if (getenv("DISPLAY") == NULL || *askpass == '\0') {
- debug3("%s: cannot notify", __func__);
- free(prompt);
- return NULL;
+ if (*askpass == '\0') {
+ debug3("%s: cannot notify: no askpass", __func__);
+ goto out;
+ }
+ if (getenv("DISPLAY") == NULL &&
+ ((s = getenv(SSH_ASKPASS_REQUIRE_ENV)) == NULL ||
+ strcmp(s, "force") != 0)) {
+ debug3("%s: cannot notify: no display", __func__);
+ goto out;
}
osigchld = ssh_signal(SIGCHLD, SIG_DFL);
if ((pid = fork()) == -1) {
@@ -284,6 +288,7 @@ notify_start(int force_askpass, const char *fmt, ...)
}
ret->pid = pid;
ret->osigchld = osigchld;
+ out:
free(prompt);
return ret;
}
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list