summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-07-10 21:49:13 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-07-10 21:49:13 +0000
commit3863f3795b4c4913c333215cd834750d97afc55b (patch)
treed36b94cb535572060e26eabe988a82a937a308a6
parent2dbfdc3db65b16e49cf5430a97078d5d8a68aa3c (diff)
don't panic if fork or pipe fail (just return an empty passwd).
-rw-r--r--usr.bin/ssh/readpass.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/ssh/readpass.c b/usr.bin/ssh/readpass.c
index 7ab205f8f66..020016dae6d 100644
--- a/usr.bin/ssh/readpass.c
+++ b/usr.bin/ssh/readpass.c
@@ -32,7 +32,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: readpass.c,v 1.20 2001/07/02 22:29:20 markus Exp $");
+RCSID("$OpenBSD: readpass.c,v 1.21 2001/07/10 21:49:12 markus Exp $");
#include <readpassphrase.h>
@@ -56,10 +56,14 @@ ssh_askpass(char *askpass, const char *msg)
error("ssh_askpass: fflush: %s", strerror(errno));
if (askpass == NULL)
fatal("internal error: askpass undefined");
- if (pipe(p) < 0)
- fatal("ssh_askpass: pipe: %s", strerror(errno));
- if ((pid = fork()) < 0)
- fatal("ssh_askpass: fork: %s", strerror(errno));
+ if (pipe(p) < 0) {
+ error("ssh_askpass: pipe: %s", strerror(errno));
+ return xstrdup("");
+ }
+ if ((pid = fork()) < 0) {
+ error("ssh_askpass: fork: %s", strerror(errno));
+ return xstrdup("");
+ }
if (pid == 0) {
seteuid(getuid());
setuid(getuid());