1:5.8.1p1-3
[openssh.git] / debian / patches / ssh-add-fifo.patch
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 ? "" : " ",