blob: 449115ddb41163e3991175be226bd7a39c0f144d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# try a bunch of invalid 'list-mailbox' values:
# empty string, missing space between values, unterminated string
for v in '""' '"f o o""bar"' '"f o o" "bar" "baz\" x'; do
sed -ri "s/^(list-mailbox\\s*=\\s*).*/\\1${v//\\/\\\\}/" "$XDG_CONFIG_HOME/interimap/config"
! interimap
xgrep -xF "Invalid value for list-mailbox: $v" <"$STDERR"
done
# create some mailboxes
doveadm -u "local" mailbox create "foo" "foo bar" "f\\\"o!o.bar" "f.o.o" "bad"
for m in "foo" "foo bar" "f\\\"o!o.bar" "f.o.o" "bad" "INBOX"; do
sample_message | deliver -u "local" -- -m "$m"
done
# restrict 'list-mailbox' to the above minus "bad"
sed -ri 's/^(list-mailbox\s*=\s*).*/\1foo "foo bar" "f\\\\\\"o\\x21o.*" "f\\0o\\0o"/' \
"$XDG_CONFIG_HOME/interimap/config"
# run partial sync
interimap
check_mailbox_list "foo" "foo bar" "f\\\"o!o.bar" "f.o.o" "INBOX" "f\\\"o!o" "f" "f.o"
check_mailboxes_status "foo" "foo bar" "f\\\"o!o.bar" "f.o.o"
# check that "bad" isn't in the remote imap server
! doveadm -u "remote" mailbox status uidvalidity "bad"
# check that "bad" and "INBOX" aren't in the database
sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/count" <<-EOF
SELECT COUNT(*)
FROM mailboxes
WHERE mailbox = x'$(printf "%s" "bad" | xxd -ps)'
OR mailbox = x'$(printf "%s" "INBOX" | xxd -ps)'
EOF
[ $(< "$TMPDIR/count") -eq 0 ]
# run partial sync
doveadm -u "remote" mailbox create "f\\\"o!o~baz" "f\\\"o!o~bad"
for m in "f\\\"o!o~baz" "f\\\"o!o~bad"; do
sample_message | deliver -u "remote" -- -m "$m"
done
interimap "f\\\"o!o.baz"
check_mailbox_list "foo" "foo bar" "f\\\"o!o.bar" "f.o.o" "INBOX" "f\\\"o!o" "f" "f.o" "f\\\"o!o.baz"
check_mailboxes_status "foo" "foo bar" "f\\\"o!o.bar" "f.o.o" "f\\\"o!o.baz"
# check that "bad", "f\\\"o!o.bad" and "INBOX" aren't in the database
sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/count" <<-EOF
SELECT COUNT(*)
FROM mailboxes
WHERE mailbox = x'$(printf "%s" "bad" | xxd -ps)'
OR mailbox = x'$(printf "%s" "INBOX" | xxd -ps)'
OR mailbox = x'$(printf "%s\\0%s" "f\\\"o!o" "bad" | xxd -ps)'
EOF
[ $(< "$TMPDIR/count") -eq 0 ]
# vim: set filetype=sh :
|