Blame tests/p_dovecot/dovecot_pop3_login.sh

Karanbir Singh 2dd0be
#!/bin/bash
Karanbir Singh 0b5bb2
# Author: Athmane Madjoudj <athmanem@gmail.com>
Christoph Galuschka 0e2392
#         Christoph Galuschka <christoph.galuschka@chello.at>
Karanbir Singh 0b5bb2
Karanbir Singh 2dd0be
t_Log "Running $0 - adding pop3test local user account + attempting POP3 login"
Karanbir Singh 0b5bb2
40b4c8
if [ "$CONTAINERTEST" -eq "1" ]; then
40b4c8
    t_Log "Running in container -> SKIP"
40b4c8
    exit 0
40b4c8
fi
40b4c8
Christoph Galuschka 0e2392
{ userdel -rf pop3test; useradd pop3test && echo pop3test | passwd --stdin pop3test; } &>/dev/null
Karanbir Singh 2dd0be
Christoph Galuschka 0e2392
# creating maildir in HOME, else test will fail at first try
Fabian Arrotin d766ac
mkdir -m 700 -p /home/pop3test/mail/.imap/INBOX 
Christoph Galuschka 0e2392
chown -R pop3test:pop3test /home/pop3test/mail/.imap/INBOX
Karanbir Singh 2dd0be
Christoph Galuschka 0e2392
t_Log "Dovecot POP3 login test"
Fabian Arrotin d766ac
# EL7 comes with nmap-nc , different from nc so different options to use
aca28c
Fabian Arrotin d766ac
if [ "$centos_ver" -ge 7 ];then
Fabian Arrotin d766ac
 nc_options="-d 3 -w 5"
Fabian Arrotin d766ac
else
Fabian Arrotin d766ac
 nc_options="-i 3 -w 5"
Fabian Arrotin d766ac
fi
Fabian Arrotin d766ac
Fabian Arrotin d766ac
Fabian Arrotin d766ac
echo -e "user pop3test\npass pop3test\n" | nc ${nc_options} localhost 110 | grep -q "+OK Logged in."
Athmane Madjoudj 3a45f5
Steve Barnes 464547
t_CheckExitStatus $?
Athmane Madjoudj 31ca2c
Athmane Madjoudj 31ca2c
userdel -rf pop3test