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 /debian/patches/ssh-add-fifo.patch | |
parent | bcbcf62473fff7d01ab78d9706484818ddcfe524 (diff) |
Allow ssh-add to read from FIFOs (thanks, Daniel Kahn Gillmor; closes:
#614897).
Diffstat (limited to 'debian/patches/ssh-add-fifo.patch')
-rw-r--r-- | debian/patches/ssh-add-fifo.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/debian/patches/ssh-add-fifo.patch b/debian/patches/ssh-add-fifo.patch new file mode 100644 index 000000000..deac58e75 --- /dev/null +++ b/debian/patches/ssh-add-fifo.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | Description: Allow ssh-add to read from FIFOs | ||
2 | Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net> | ||
3 | Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1869 | ||
4 | Bug-Debian: http://bugs.debian.org/614897 | ||
5 | Origin: other, https://bugzilla.mindrot.org/attachment.cgi?id=2002&action=diff | ||
6 | Forwarded: yes | ||
7 | Last-Update: 2011-03-18 | ||
8 | |||
9 | Index: b/authfile.c | ||
10 | =================================================================== | ||
11 | --- a/authfile.c | ||
12 | +++ b/authfile.c | ||
13 | @@ -317,7 +317,7 @@ | ||
14 | static int | ||
15 | key_load_file(int fd, const char *filename, Buffer *blob) | ||
16 | { | ||
17 | - size_t len; | ||
18 | + size_t len, readcount; | ||
19 | u_char *cp; | ||
20 | struct stat st; | ||
21 | |||
22 | @@ -337,11 +337,14 @@ | ||
23 | return 0; | ||
24 | } | ||
25 | len = (size_t)st.st_size; /* truncated */ | ||
26 | + if (0 == len && S_ISFIFO(st.st_mode)) | ||
27 | + len = 8192; /* we will try reading up to 8KiB from a FIFO */ | ||
28 | |||
29 | buffer_init(blob); | ||
30 | cp = buffer_append_space(blob, len); | ||
31 | |||
32 | - if (atomicio(read, fd, cp, len) != len) { | ||
33 | + readcount = atomicio(read, fd, cp, len); | ||
34 | + if (readcount != len && !(readcount > 0 && S_ISFIFO(st.st_mode))) { | ||
35 | debug("%s: read from key file %.200s%sfailed: %.100s", __func__, | ||
36 | filename == NULL ? "" : filename, | ||
37 | filename == NULL ? "" : " ", | ||