diff options
Diffstat (limited to 'ssh-keysign.c')
-rw-r--r-- | ssh-keysign.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ssh-keysign.c b/ssh-keysign.c index 04597a91d..dae3a2e8c 100644 --- a/ssh-keysign.c +++ b/ssh-keysign.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #include "includes.h" | 24 | #include "includes.h" |
25 | RCSID("$OpenBSD: ssh-keysign.c,v 1.18 2004/08/23 14:29:23 dtucker Exp $"); | 25 | RCSID("$OpenBSD: ssh-keysign.c,v 1.19 2005/09/13 23:40:07 djm Exp $"); |
26 | 26 | ||
27 | #include <openssl/evp.h> | 27 | #include <openssl/evp.h> |
28 | #include <openssl/rand.h> | 28 | #include <openssl/rand.h> |
@@ -148,6 +148,13 @@ main(int argc, char **argv) | |||
148 | u_int slen, dlen; | 148 | u_int slen, dlen; |
149 | u_int32_t rnd[256]; | 149 | u_int32_t rnd[256]; |
150 | 150 | ||
151 | /* Ensure that stdin and stdout are connected */ | ||
152 | if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2) | ||
153 | exit(1); | ||
154 | /* Leave /dev/null fd iff it is attached to stderr */ | ||
155 | if (fd > 2) | ||
156 | close(fd); | ||
157 | |||
151 | key_fd[0] = open(_PATH_HOST_RSA_KEY_FILE, O_RDONLY); | 158 | key_fd[0] = open(_PATH_HOST_RSA_KEY_FILE, O_RDONLY); |
152 | key_fd[1] = open(_PATH_HOST_DSA_KEY_FILE, O_RDONLY); | 159 | key_fd[1] = open(_PATH_HOST_DSA_KEY_FILE, O_RDONLY); |
153 | 160 | ||