version 1.58.2.1, 2005/03/10 16:28:27 |
version 1.58.2.2, 2005/09/02 03:44:59 |
|
|
#include "authfile.h" |
#include "authfile.h" |
#include "rsa.h" |
#include "rsa.h" |
#include "misc.h" |
#include "misc.h" |
|
#include "atomicio.h" |
|
|
/* Version identification string for SSH v1 identity files. */ |
/* Version identification string for SSH v1 identity files. */ |
static const char authfile_id_string[] = |
static const char authfile_id_string[] = |
|
|
buffer_free(&encrypted); |
buffer_free(&encrypted); |
return 0; |
return 0; |
} |
} |
if (write(fd, buffer_ptr(&encrypted), buffer_len(&encrypted)) != |
if (atomicio(vwrite, fd, buffer_ptr(&encrypted), |
buffer_len(&encrypted)) { |
buffer_len(&encrypted)) != buffer_len(&encrypted)) { |
error("write to key file %s failed: %s", filename, |
error("write to key file %s failed: %s", filename, |
strerror(errno)); |
strerror(errno)); |
buffer_free(&encrypted); |
buffer_free(&encrypted); |
|
|
Key *pub; |
Key *pub; |
struct stat st; |
struct stat st; |
char *cp; |
char *cp; |
int i; |
u_int i; |
size_t len; |
size_t len; |
|
|
if (fstat(fd, &st) < 0) { |
if (fstat(fd, &st) < 0) { |
|
|
buffer_init(&buffer); |
buffer_init(&buffer); |
cp = buffer_append_space(&buffer, len); |
cp = buffer_append_space(&buffer, len); |
|
|
if (read(fd, cp, (size_t) len) != (size_t) len) { |
if (atomicio(read, fd, cp, len) != len) { |
debug("Read from key file %.200s failed: %.100s", filename, |
debug("Read from key file %.200s failed: %.100s", filename, |
strerror(errno)); |
strerror(errno)); |
buffer_free(&buffer); |
buffer_free(&buffer); |
|
|
key_load_private_rsa1(int fd, const char *filename, const char *passphrase, |
key_load_private_rsa1(int fd, const char *filename, const char *passphrase, |
char **commentp) |
char **commentp) |
{ |
{ |
int i, check1, check2, cipher_type; |
u_int i; |
|
int check1, check2, cipher_type; |
size_t len; |
size_t len; |
Buffer buffer, decrypted; |
Buffer buffer, decrypted; |
u_char *cp; |
u_char *cp; |
|
|
buffer_init(&buffer); |
buffer_init(&buffer); |
cp = buffer_append_space(&buffer, len); |
cp = buffer_append_space(&buffer, len); |
|
|
if (read(fd, cp, (size_t) len) != (size_t) len) { |
if (atomicio(read, fd, cp, len) != len) { |
debug("Read from key file %.200s failed: %.100s", filename, |
debug("Read from key file %.200s failed: %.100s", filename, |
strerror(errno)); |
strerror(errno)); |
buffer_free(&buffer); |
buffer_free(&buffer); |