summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2019-06-09 22:09:35 +0100
committerColin Watson <cjwatson@debian.org>2019-06-09 22:10:43 +0100
commitedf60d2bf70b7cc9a651434faa87b732af081808 (patch)
tree23d893f8098ba534db2523aed6d40565e002a61d
parent865a97e05b6aab1619e1c8eeb33ccb8f9a9e48d3 (diff)
parentbbc5ff0a295797174b4ef3928f58969e43f5adfe (diff)
Fix utimensat tests when not using compat code
-rw-r--r--debian/.git-dpm4
-rw-r--r--debian/changelog2
-rw-r--r--debian/patches/fix-utimensat-test.patch58
-rw-r--r--debian/patches/series1
-rw-r--r--openbsd-compat/regress/utimensattest.c20
5 files changed, 80 insertions, 5 deletions
diff --git a/debian/.git-dpm b/debian/.git-dpm
index 46a4f4209..635786aca 100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@ -1,6 +1,6 @@
1# see git-dpm(1) from git-dpm package 1# see git-dpm(1) from git-dpm package
27d50f9e5be88179325983a1f58c9d51bb58f025a 2bbc5ff0a295797174b4ef3928f58969e43f5adfe
37d50f9e5be88179325983a1f58c9d51bb58f025a 3bbc5ff0a295797174b4ef3928f58969e43f5adfe
4102062f825fb26a74295a1c089c00c4c4c76b68a 4102062f825fb26a74295a1c089c00c4c4c76b68a
5102062f825fb26a74295a1c089c00c4c4c76b68a 5102062f825fb26a74295a1c089c00c4c4c76b68a
6openssh_8.0p1.orig.tar.gz 6openssh_8.0p1.orig.tar.gz
diff --git a/debian/changelog b/debian/changelog
index c272f8fc8..9b6a47ba2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -121,6 +121,8 @@ openssh (1:8.0p1-1) UNRELEASED; urgency=medium
121 - Enable gssapi-keyex authentication without gssapi-with-mic. 121 - Enable gssapi-keyex authentication without gssapi-with-mic.
122 - Allow querying for GSSAPI key exchange algorithms from ssh (-Q 122 - Allow querying for GSSAPI key exchange algorithms from ssh (-Q
123 kex-gss). 123 kex-gss).
124 * Apply upstream patch to fix the utimensat regression tests when not
125 using the compatibility implementation.
124 126
125 -- Colin Watson <cjwatson@debian.org> Wed, 05 Jun 2019 07:09:47 +0100 127 -- Colin Watson <cjwatson@debian.org> Wed, 05 Jun 2019 07:09:47 +0100
126 128
diff --git a/debian/patches/fix-utimensat-test.patch b/debian/patches/fix-utimensat-test.patch
new file mode 100644
index 000000000..799337e64
--- /dev/null
+++ b/debian/patches/fix-utimensat-test.patch
@@ -0,0 +1,58 @@
1From bbc5ff0a295797174b4ef3928f58969e43f5adfe Mon Sep 17 00:00:00 2001
2From: Darren Tucker <dtucker@dtucker.net>
3Date: Fri, 7 Jun 2019 23:47:37 +1000
4Subject: Update utimensat test.
5
6POSIX specifies that when given a symlink, AT_SYMLINK_NOFOLLOW should
7update the symlink and not the destination. The compat code doesn't
8have a way to do this, so where possible it fails instead of following a
9symlink when explicitly asked not to. Instead of checking for an explicit
10failure, check that it does not update the destination, which both the
11real and compat implementations should honour.
12
13Inspired by github pull req #125 from chutzpah at gentoo.org.
14
15Origin: upstream, https://anongit.mindrot.org/openssh.git/commit/?id=182898192d4b720e4faeafd5b39c2cfb3b92aa21
16Last-Update: 2019-06-09
17
18Patch-Name: fix-utimensat-test.patch
19---
20 openbsd-compat/regress/utimensattest.c | 20 +++++++++++++++++---
21 1 file changed, 17 insertions(+), 3 deletions(-)
22
23diff --git a/openbsd-compat/regress/utimensattest.c b/openbsd-compat/regress/utimensattest.c
24index a7bc7634b..b29cef2f1 100644
25--- a/openbsd-compat/regress/utimensattest.c
26+++ b/openbsd-compat/regress/utimensattest.c
27@@ -83,14 +83,28 @@ main(void)
28 fail("mtim.tv_nsec", 45678000, sb.st_mtim.tv_nsec);
29 #endif
30
31+ /*
32+ * POSIX specifies that when given a symlink, AT_SYMLINK_NOFOLLOW
33+ * should update the symlink and not the destination. The compat
34+ * code doesn't have a way to do this, so where possible it fails
35+ * with ENOSYS instead of following a symlink when explicitly asked
36+ * not to. Here we just test that it does not update the destination.
37+ */
38 if (rename(TMPFILE, TMPFILE2) == -1)
39 fail("rename", 0, 0);
40 if (symlink(TMPFILE2, TMPFILE) == -1)
41 fail("symlink", 0, 0);
42+ ts[0].tv_sec = 11223344;
43+ ts[1].tv_sec = 55667788;
44+ (void)utimensat(AT_FDCWD, TMPFILE, ts, AT_SYMLINK_NOFOLLOW);
45+ if (stat(TMPFILE2, &sb) == -1)
46+ fail("stat", 0, 0 );
47+ if (sb.st_atime == 11223344)
48+ fail("utimensat symlink st_atime", 0, 0 );
49+ if (sb.st_mtime == 55667788)
50+ fail("utimensat symlink st_mtime", 0, 0 );
51
52- if (utimensat(AT_FDCWD, TMPFILE, ts, AT_SYMLINK_NOFOLLOW) != -1)
53- fail("utimensat followed symlink", 0, 0);
54-
55+ /* Clean up */
56 if (!(unlink(TMPFILE) == 0 && unlink(TMPFILE2) == 0))
57 fail("unlink", 0, 0);
58 exit(0);
diff --git a/debian/patches/series b/debian/patches/series
index 6304f537a..ba5a5ad4b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -25,3 +25,4 @@ seccomp-s390-flock-ipc.patch
25seccomp-s390-ioctl-ep11-crypto.patch 25seccomp-s390-ioctl-ep11-crypto.patch
26conch-old-privkey-format.patch 26conch-old-privkey-format.patch
27revert-ipqos-defaults.patch 27revert-ipqos-defaults.patch
28fix-utimensat-test.patch
diff --git a/openbsd-compat/regress/utimensattest.c b/openbsd-compat/regress/utimensattest.c
index a7bc7634b..b29cef2f1 100644
--- a/openbsd-compat/regress/utimensattest.c
+++ b/openbsd-compat/regress/utimensattest.c
@@ -83,14 +83,28 @@ main(void)
83 fail("mtim.tv_nsec", 45678000, sb.st_mtim.tv_nsec); 83 fail("mtim.tv_nsec", 45678000, sb.st_mtim.tv_nsec);
84#endif 84#endif
85 85
86 /*
87 * POSIX specifies that when given a symlink, AT_SYMLINK_NOFOLLOW
88 * should update the symlink and not the destination. The compat
89 * code doesn't have a way to do this, so where possible it fails
90 * with ENOSYS instead of following a symlink when explicitly asked
91 * not to. Here we just test that it does not update the destination.
92 */
86 if (rename(TMPFILE, TMPFILE2) == -1) 93 if (rename(TMPFILE, TMPFILE2) == -1)
87 fail("rename", 0, 0); 94 fail("rename", 0, 0);
88 if (symlink(TMPFILE2, TMPFILE) == -1) 95 if (symlink(TMPFILE2, TMPFILE) == -1)
89 fail("symlink", 0, 0); 96 fail("symlink", 0, 0);
97 ts[0].tv_sec = 11223344;
98 ts[1].tv_sec = 55667788;
99 (void)utimensat(AT_FDCWD, TMPFILE, ts, AT_SYMLINK_NOFOLLOW);
100 if (stat(TMPFILE2, &sb) == -1)
101 fail("stat", 0, 0 );
102 if (sb.st_atime == 11223344)
103 fail("utimensat symlink st_atime", 0, 0 );
104 if (sb.st_mtime == 55667788)
105 fail("utimensat symlink st_mtime", 0, 0 );
90 106
91 if (utimensat(AT_FDCWD, TMPFILE, ts, AT_SYMLINK_NOFOLLOW) != -1) 107 /* Clean up */
92 fail("utimensat followed symlink", 0, 0);
93
94 if (!(unlink(TMPFILE) == 0 && unlink(TMPFILE2) == 0)) 108 if (!(unlink(TMPFILE) == 0 && unlink(TMPFILE2) == 0))
95 fail("unlink", 0, 0); 109 fail("unlink", 0, 0);
96 exit(0); 110 exit(0);