diff options
author | Colin Watson <cjwatson@debian.org> | 2011-03-18 16:38:30 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2011-03-18 16:38:30 +0000 |
commit | 8d0030f3d2ffcbbf27e475e0b9032e74dede5b8f (patch) | |
tree | 5b122355b76bb124231848927dc20db21093b88a /authfile.c | |
parent | bcbcf62473fff7d01ab78d9706484818ddcfe524 (diff) |
Allow ssh-add to read from FIFOs (thanks, Daniel Kahn Gillmor; closes:
#614897).
Diffstat (limited to 'authfile.c')
-rw-r--r-- | authfile.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/authfile.c b/authfile.c index be650af67..2ed250232 100644 --- a/authfile.c +++ b/authfile.c | |||
@@ -317,7 +317,7 @@ key_parse_public_rsa1(Buffer *blob, char **commentp) | |||
317 | static int | 317 | static int |
318 | key_load_file(int fd, const char *filename, Buffer *blob) | 318 | key_load_file(int fd, const char *filename, Buffer *blob) |
319 | { | 319 | { |
320 | size_t len; | 320 | size_t len, readcount; |
321 | u_char *cp; | 321 | u_char *cp; |
322 | struct stat st; | 322 | struct stat st; |
323 | 323 | ||
@@ -337,11 +337,14 @@ key_load_file(int fd, const char *filename, Buffer *blob) | |||
337 | return 0; | 337 | return 0; |
338 | } | 338 | } |
339 | len = (size_t)st.st_size; /* truncated */ | 339 | len = (size_t)st.st_size; /* truncated */ |
340 | if (0 == len && S_ISFIFO(st.st_mode)) | ||
341 | len = 8192; /* we will try reading up to 8KiB from a FIFO */ | ||
340 | 342 | ||
341 | buffer_init(blob); | 343 | buffer_init(blob); |
342 | cp = buffer_append_space(blob, len); | 344 | cp = buffer_append_space(blob, len); |
343 | 345 | ||
344 | if (atomicio(read, fd, cp, len) != len) { | 346 | readcount = atomicio(read, fd, cp, len); |
347 | if (readcount != len && !(readcount > 0 && S_ISFIFO(st.st_mode))) { | ||
345 | debug("%s: read from key file %.200s%sfailed: %.100s", __func__, | 348 | debug("%s: read from key file %.200s%sfailed: %.100s", __func__, |
346 | filename == NULL ? "" : filename, | 349 | filename == NULL ? "" : filename, |
347 | filename == NULL ? "" : " ", | 350 | filename == NULL ? "" : " ", |