diff options
author | Colin Watson <cjwatson@debian.org> | 2005-09-14 12:45:47 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2005-09-14 12:45:47 +0000 |
commit | 9b71add4cecf753c45f5fbd6ff0913bc95b3e95d (patch) | |
tree | d4ea8fdb30c7949c6433f5277c39548ea579d4dc /ssh-rand-helper.c | |
parent | ed07bcbea56007ab5b218ddf3aa6a7d4e21966e0 (diff) | |
parent | 16704d57999d987fb8d9ba53379841a79f016d67 (diff) |
Merge 4.2p1 to the trunk.
Diffstat (limited to 'ssh-rand-helper.c')
-rw-r--r-- | ssh-rand-helper.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ssh-rand-helper.c b/ssh-rand-helper.c index d7d8d0f3b..87e52cf75 100644 --- a/ssh-rand-helper.c +++ b/ssh-rand-helper.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include "pathnames.h" | 39 | #include "pathnames.h" |
40 | #include "log.h" | 40 | #include "log.h" |
41 | 41 | ||
42 | RCSID("$Id: ssh-rand-helper.c,v 1.23 2005/02/16 02:32:30 dtucker Exp $"); | 42 | RCSID("$Id: ssh-rand-helper.c,v 1.26 2005/07/17 07:26:44 djm Exp $"); |
43 | 43 | ||
44 | /* Number of bytes we write out */ | 44 | /* Number of bytes we write out */ |
45 | #define OUTPUT_SEED_SIZE 48 | 45 | #define OUTPUT_SEED_SIZE 48 |
@@ -123,7 +123,7 @@ get_random_bytes_prngd(unsigned char *buf, int len, | |||
123 | unsigned short tcp_port, char *socket_path) | 123 | unsigned short tcp_port, char *socket_path) |
124 | { | 124 | { |
125 | int fd, addr_len, rval, errors; | 125 | int fd, addr_len, rval, errors; |
126 | char msg[2]; | 126 | u_char msg[2]; |
127 | struct sockaddr_storage addr; | 127 | struct sockaddr_storage addr; |
128 | struct sockaddr_in *addr_in = (struct sockaddr_in *)&addr; | 128 | struct sockaddr_in *addr_in = (struct sockaddr_in *)&addr; |
129 | struct sockaddr_un *addr_un = (struct sockaddr_un *)&addr; | 129 | struct sockaddr_un *addr_un = (struct sockaddr_un *)&addr; |
@@ -135,8 +135,8 @@ get_random_bytes_prngd(unsigned char *buf, int len, | |||
135 | if (socket_path != NULL && | 135 | if (socket_path != NULL && |
136 | strlen(socket_path) >= sizeof(addr_un->sun_path)) | 136 | strlen(socket_path) >= sizeof(addr_un->sun_path)) |
137 | fatal("Random pool path is too long"); | 137 | fatal("Random pool path is too long"); |
138 | if (len > 255) | 138 | if (len <= 0 || len > 255) |
139 | fatal("Too many bytes to read from PRNGD"); | 139 | fatal("Too many bytes (%d) to read from PRNGD", len); |
140 | 140 | ||
141 | memset(&addr, '\0', sizeof(addr)); | 141 | memset(&addr, '\0', sizeof(addr)); |
142 | 142 | ||
@@ -190,7 +190,7 @@ reopen: | |||
190 | goto done; | 190 | goto done; |
191 | } | 191 | } |
192 | 192 | ||
193 | if (atomicio(read, fd, buf, len) != len) { | 193 | if (atomicio(read, fd, buf, len) != (size_t)len) { |
194 | if (errno == EPIPE && errors < 10) { | 194 | if (errno == EPIPE && errors < 10) { |
195 | close(fd); | 195 | close(fd); |
196 | errors++; | 196 | errors++; |
@@ -398,8 +398,8 @@ hash_command_output(entropy_cmd_t *src, unsigned char *hash) | |||
398 | debug3("Time elapsed: %d msec", msec_elapsed); | 398 | debug3("Time elapsed: %d msec", msec_elapsed); |
399 | 399 | ||
400 | if (waitpid(pid, &status, 0) == -1) { | 400 | if (waitpid(pid, &status, 0) == -1) { |
401 | error("Couldn't wait for child '%s' completion: %s", | 401 | error("Couldn't wait for child '%s' completion: %s", |
402 | src->cmdstring, strerror(errno)); | 402 | src->cmdstring, strerror(errno)); |
403 | return 0.0; | 403 | return 0.0; |
404 | } | 404 | } |
405 | 405 | ||
@@ -600,7 +600,7 @@ prng_write_seedfile(void) | |||
600 | save_errno = errno; | 600 | save_errno = errno; |
601 | unlink(tmpseed); | 601 | unlink(tmpseed); |
602 | fatal("problem renaming PRNG seedfile from %.100s " | 602 | fatal("problem renaming PRNG seedfile from %.100s " |
603 | "to %.100s (%.100s)", tmpseed, filename, | 603 | "to %.100s (%.100s)", tmpseed, filename, |
604 | strerror(save_errno)); | 604 | strerror(save_errno)); |
605 | } | 605 | } |
606 | } | 606 | } |