bstinson / centos / t_functional

Forked from centos/t_functional 3 years ago
Clone

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
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
Christoph Galuschka 0e2392
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"
aca28c
# EL7 comes with nmap-nc , different from nc so different options to use
aca28c
Pablo Greco bf4e34
if [ "$centos_ver" -ge 7 ];then
aca28c
 nc_options="-d 3 -w 5"
aca28c
else
aca28c
 nc_options="-i 3 -w 5"
aca28c
fi
aca28c
aca28c
aca28c
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