diff options
author | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:32:03 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:32:03 +0000 |
commit | 04942aa41fa94ec6f2c3ce1d348f600f31bb7c78 (patch) | |
tree | af8e928bd79d3f2d0219bb5b2c78b573ec31d94c /authfile.c | |
parent | 9ad7b718d42e43f3a285fcbc8f91193931fce324 (diff) | |
parent | 16704d57999d987fb8d9ba53379841a79f016d67 (diff) |
import openssh-4.2p1-gsskex-20050926-2.patch
Diffstat (limited to 'authfile.c')
-rw-r--r-- | authfile.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/authfile.c b/authfile.c index 6a04cd7a9..420813f37 100644 --- a/authfile.c +++ b/authfile.c | |||
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "includes.h" | 38 | #include "includes.h" |
39 | RCSID("$OpenBSD: authfile.c,v 1.60 2004/12/11 01:48:56 dtucker Exp $"); | 39 | RCSID("$OpenBSD: authfile.c,v 1.61 2005/06/17 02:44:32 djm Exp $"); |
40 | 40 | ||
41 | #include <openssl/err.h> | 41 | #include <openssl/err.h> |
42 | #include <openssl/evp.h> | 42 | #include <openssl/evp.h> |
@@ -52,6 +52,7 @@ RCSID("$OpenBSD: authfile.c,v 1.60 2004/12/11 01:48:56 dtucker Exp $"); | |||
52 | #include "authfile.h" | 52 | #include "authfile.h" |
53 | #include "rsa.h" | 53 | #include "rsa.h" |
54 | #include "misc.h" | 54 | #include "misc.h" |
55 | #include "atomicio.h" | ||
55 | 56 | ||
56 | /* Version identification string for SSH v1 identity files. */ | 57 | /* Version identification string for SSH v1 identity files. */ |
57 | static const char authfile_id_string[] = | 58 | static const char authfile_id_string[] = |
@@ -147,8 +148,8 @@ key_save_private_rsa1(Key *key, const char *filename, const char *passphrase, | |||
147 | buffer_free(&encrypted); | 148 | buffer_free(&encrypted); |
148 | return 0; | 149 | return 0; |
149 | } | 150 | } |
150 | if (write(fd, buffer_ptr(&encrypted), buffer_len(&encrypted)) != | 151 | if (atomicio(vwrite, fd, buffer_ptr(&encrypted), |
151 | buffer_len(&encrypted)) { | 152 | buffer_len(&encrypted)) != buffer_len(&encrypted)) { |
152 | error("write to key file %s failed: %s", filename, | 153 | error("write to key file %s failed: %s", filename, |
153 | strerror(errno)); | 154 | strerror(errno)); |
154 | buffer_free(&encrypted); | 155 | buffer_free(&encrypted); |
@@ -236,7 +237,7 @@ key_load_public_rsa1(int fd, const char *filename, char **commentp) | |||
236 | Key *pub; | 237 | Key *pub; |
237 | struct stat st; | 238 | struct stat st; |
238 | char *cp; | 239 | char *cp; |
239 | int i; | 240 | u_int i; |
240 | size_t len; | 241 | size_t len; |
241 | 242 | ||
242 | if (fstat(fd, &st) < 0) { | 243 | if (fstat(fd, &st) < 0) { |
@@ -253,7 +254,7 @@ key_load_public_rsa1(int fd, const char *filename, char **commentp) | |||
253 | buffer_init(&buffer); | 254 | buffer_init(&buffer); |
254 | cp = buffer_append_space(&buffer, len); | 255 | cp = buffer_append_space(&buffer, len); |
255 | 256 | ||
256 | if (read(fd, cp, (size_t) len) != (size_t) len) { | 257 | if (atomicio(read, fd, cp, len) != len) { |
257 | debug("Read from key file %.200s failed: %.100s", filename, | 258 | debug("Read from key file %.200s failed: %.100s", filename, |
258 | strerror(errno)); | 259 | strerror(errno)); |
259 | buffer_free(&buffer); | 260 | buffer_free(&buffer); |
@@ -322,7 +323,8 @@ static Key * | |||
322 | key_load_private_rsa1(int fd, const char *filename, const char *passphrase, | 323 | key_load_private_rsa1(int fd, const char *filename, const char *passphrase, |
323 | char **commentp) | 324 | char **commentp) |
324 | { | 325 | { |
325 | int i, check1, check2, cipher_type; | 326 | u_int i; |
327 | int check1, check2, cipher_type; | ||
326 | size_t len; | 328 | size_t len; |
327 | Buffer buffer, decrypted; | 329 | Buffer buffer, decrypted; |
328 | u_char *cp; | 330 | u_char *cp; |
@@ -347,7 +349,7 @@ key_load_private_rsa1(int fd, const char *filename, const char *passphrase, | |||
347 | buffer_init(&buffer); | 349 | buffer_init(&buffer); |
348 | cp = buffer_append_space(&buffer, len); | 350 | cp = buffer_append_space(&buffer, len); |
349 | 351 | ||
350 | if (read(fd, cp, (size_t) len) != (size_t) len) { | 352 | if (atomicio(read, fd, cp, len) != len) { |
351 | debug("Read from key file %.200s failed: %.100s", filename, | 353 | debug("Read from key file %.200s failed: %.100s", filename, |
352 | strerror(errno)); | 354 | strerror(errno)); |
353 | buffer_free(&buffer); | 355 | buffer_free(&buffer); |