]>
git.saurik.com Git - apt.git/blob - test/integration/test-releasefile-date-older
2d6746b1047d3031f56a4faefaca23f472849bba
4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
7 configarchitecture 'i386'
9 insertpackage 'wheezy' 'apt' 'all' '0.8.15'
11 setupaptarchive --no-update
13 # we don't complain as the server could have just sent a 'Hit' here and this
14 # 'downgrade attack' is usually performed by out-of-sync mirrors. Valid-Until
15 # catches the 'real' downgrade attacks (expect that it finds stale mirrors).
16 # Scaring users with an error here serves hence no point.
18 msgmsg 'InRelease file is silently rejected if' 'new Date is before old Date'
19 rm -rf rootdir/var/lib/apt/lists
20 generatereleasefiles 'now' 'now + 7 days'
22 testsuccess aptget update
23 listcurrentlistsdirectory > listsdir.lst
24 redatereleasefiles 'now - 2 days'
25 testsuccess aptget update
26 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
28 msgmsg 'Release.gpg file is silently rejected if' 'new Date is before old Date'
29 rm -rf rootdir/var/lib/apt/lists
30 generatereleasefiles 'now' 'now + 7 days'
32 find aptarchive -name 'InRelease' -delete
33 testsuccess aptget update
34 listcurrentlistsdirectory > listsdir.lst
35 redatereleasefiles 'now - 2 days'
36 find aptarchive -name 'InRelease' -delete
37 testsuccess aptget update
38 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
40 msgmsg 'Crisscross InRelease/Release.gpg file is silently rejected if' 'new Date is before old Date'
41 rm -rf rootdir/var/lib/apt/lists
42 generatereleasefiles 'now' 'now + 7 days'
44 find aptarchive -name 'Release.gpg' -delete
45 testsuccess aptget update
46 listcurrentlistsdirectory > listsdir.lst
47 redatereleasefiles 'now - 2 days'
48 find aptarchive -name 'InRelease' -delete
49 testsuccess aptget update
50 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
52 msgmsg 'Crisscross Release.gpg/InRelease file is silently rejected if' 'new Date is before old Date'
53 rm -rf rootdir/var/lib/apt/lists
54 generatereleasefiles 'now' 'now + 7 days'
56 find aptarchive -name 'InRelease' -delete
57 testsuccess aptget update
58 listcurrentlistsdirectory > listsdir.lst
59 redatereleasefiles 'now - 2 days'
60 find aptarchive -name 'Release.gpg' -delete
61 testsuccess aptget update
62 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
64 msgmsg 'Release file has' 'no Date and no Valid-Until field'
65 rm -rf rootdir/var/lib/apt/lists
66 generatereleasefiles 'now'
67 sed -i '/^Date: / d' $(find ./aptarchive -name 'Release')
69 testwarning aptget update
70 listcurrentlistsdirectory > listsdir.lst
71 # have no effect as Date is unknown
72 testwarning aptget update -o Acquire::Min-ValidTime=$((3600*24*30))
73 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
74 testwarning aptget update -o Acquire::Max-ValidTime=1
75 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
76 sed -i '/^Codename: / a\
77 Another-Field: yes' $(find aptarchive/ -name 'Release')
78 touch -d 'now + 1 day' $(find aptarchive/ -name 'Release')
79 signreleasefiles "${2:-Joe Sixpack}"
80 testwarning aptget update
81 testsuccess cmp $(find aptarchive/ -name 'InRelease') $(find rootdir/var/lib/apt/ -name '*_InRelease')
83 msgmsg 'Release file has' 'no Date field, but Valid-Until expired'
84 rm -rf rootdir/var/lib/apt/lists
85 generatereleasefiles 'now' 'now - 2 days'
86 sed -i '/^Date: / d' $(find ./aptarchive -name 'Release')
88 testfailure aptget update
89 listcurrentlistsdirectory > listsdir.lst
90 # have no effect as Date is unknown
91 testfailure aptget update -o Acquire::Min-ValidTime=$((3600*24*30))
92 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
93 testfailure aptget update -o Acquire::Max-ValidTime=1
94 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
96 msgmsg 'Release file has' 'no Date field, but Valid-Until is good'
97 rm -rf rootdir/var/lib/apt/lists
98 generatereleasefiles 'now' 'now + 2 days'
99 sed -i '/^Date: / d' $(find ./aptarchive -name 'Release')
101 testwarning aptget update