summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authfile.c7
-rw-r--r--debian/changelog2
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/ssh-add-fifo.patch37
4 files changed, 45 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)
317static int 317static int
318key_load_file(int fd, const char *filename, Buffer *blob) 318key_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 ? "" : " ",
diff --git a/debian/changelog b/debian/changelog
index b79607514..c75c3f031 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ openssh (1:5.8p1-3) UNRELEASED; urgency=low
2 2
3 * Correct ssh-keygen instruction in the changelog for 1:5.7p1-1 (thanks, 3 * Correct ssh-keygen instruction in the changelog for 1:5.7p1-1 (thanks,
4 Joel Stanley). 4 Joel Stanley).
5 * Allow ssh-add to read from FIFOs (thanks, Daniel Kahn Gillmor; closes:
6 #614897).
5 7
6 -- Colin Watson <cjwatson@debian.org> Wed, 09 Feb 2011 03:02:45 +0000 8 -- Colin Watson <cjwatson@debian.org> Wed, 09 Feb 2011 03:02:45 +0000
7 9
diff --git a/debian/patches/series b/debian/patches/series
index a243174dd..0a21f8ead 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -38,6 +38,7 @@ doc-hash-tab-completion.patch
38 38
39# Miscellaneous bug fixes 39# Miscellaneous bug fixes
40selinux-build-failure.patch 40selinux-build-failure.patch
41ssh-add-fifo.patch
41 42
42# Debian-specific configuration 43# Debian-specific configuration
43gnome-ssh-askpass2-icon.patch 44gnome-ssh-askpass2-icon.patch
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 @@
1Description: Allow ssh-add to read from FIFOs
2Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1869
4Bug-Debian: http://bugs.debian.org/614897
5Origin: other, https://bugzilla.mindrot.org/attachment.cgi?id=2002&action=diff
6Forwarded: yes
7Last-Update: 2011-03-18
8
9Index: 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 ? "" : " ",