Blame tests/p_dovecot/dovecot_imap_login.sh
|
Karanbir Singh |
0b5bb2 |
#!/bin/sh
|
|
Karanbir Singh |
0b5bb2 |
# Author: Athmane Madjoudj <athmanem@gmail.com>
|
|
Christoph Galuschka |
7fc582 |
# Christoph Galuschka <tigalch@tigalch.org>
|
|
Karanbir Singh |
0b5bb2 |
|
|
Karanbir Singh |
2dd0be |
t_Log "Running $0 - adding imaptest local user account + attempting IMAP login"
|
|
Karanbir Singh |
0b5bb2 |
|
|
Athmane Madjoudj |
0a3c81 |
{ userdel -rf imaptest; useradd imaptest && echo imaptest | passwd --stdin imaptest; } &>/dev/null
|
|
Karanbir Singh |
2dd0be |
|
|
Christoph Galuschka |
0e2392 |
# creating maildir in HOME, else test will fail at first try
|
|
Christoph Galuschka |
0e2392 |
mkdir -m 700 -p /home/imaptest/mail/.imap/INBOX
|
|
Christoph Galuschka |
a0530a |
chown -R imaptest:imaptest /home/imaptest/mail
|
|
Karanbir Singh |
2dd0be |
|
|
Christoph Galuschka |
26f935 |
ret_val=1
|
|
Christoph Galuschka |
26f935 |
|
|
Christoph Galuschka |
0e2392 |
t_Log "Dovecot IMAP login test"
|
|
Christoph Galuschka |
a0530a |
# after a restart of dovecot this always results with
|
|
Christoph Galuschka |
a0530a |
# 'imap-login: Disconnected (no auth attempts)' in /var/log/maillog
|
|
Christoph Galuschka |
a0530a |
# first try will be ignored
|
|
Athmane Madjoudj |
87c52a |
echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in."
|
|
Christoph Galuschka |
26f935 |
|
|
Christoph Galuschka |
a0530a |
# and we need some time between login attempts
|
|
Christoph Galuschka |
a0530a |
sleep 3
|
|
Christoph Galuschka |
a0530a |
|
|
Christoph Galuschka |
a0530a |
echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in."
|
|
Christoph Galuschka |
7fc582 |
# let's see if a third iteration reduces flakyness of the test
|
|
Christoph Galuschka |
7fc582 |
sleep 3
|
|
Christoph Galuschka |
7fc582 |
|
|
Christoph Galuschka |
7fc582 |
echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in."
|
|
Christoph Galuschka |
a0530a |
ret_val=$?
|
|
Athmane Madjoudj |
3a45f5 |
|
|
Christoph Galuschka |
26f935 |
t_CheckExitStatus $ret_val
|
|
Athmane Madjoudj |
31ca2c |
|
|
Athmane Madjoudj |
31ca2c |
userdel -rf imaptest
|