From d766ac1c6346728bcadb9735bcc22714f54dd082 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Jun 01 2021 12:32:45 +0000 Subject: Revert "nc option -i/-d is unnecessary" --- diff --git a/tests/p_dovecot/dovecot_imap_login.sh b/tests/p_dovecot/dovecot_imap_login.sh index 6aecfac..949d34c 100755 --- a/tests/p_dovecot/dovecot_imap_login.sh +++ b/tests/p_dovecot/dovecot_imap_login.sh @@ -7,14 +7,22 @@ t_Log "Running $0 - adding imaptest local user account + attempting IMAP login" { userdel -rf imaptest; useradd imaptest && echo imaptest | passwd --stdin imaptest; } &>/dev/null # creating maildir in HOME, else test will fail at first try -mkdir -m 700 -p /home/imaptest/mail/.imap/INBOX +mkdir -m 700 -p /home/imaptest/mail/.imap/INBOX chown -R imaptest:imaptest /home/imaptest/mail ret_val=1 t_Log "Dovecot IMAP login test" -echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." +# EL7 comes with nmap-nc , different from nc so different options to use + +if [ "$centos_ver" -ge 7 ];then + nc_options="-d 3 -w 5" +else + nc_options="-i 3 -w 5" +fi + +echo -e "01 LOGIN imaptest imaptest\n" | nc ${nc_options} localhost 143 | grep -q "Logged in." ret_val=$? diff --git a/tests/p_dovecot/dovecot_pop3_login.sh b/tests/p_dovecot/dovecot_pop3_login.sh index 7e1a8cd..0ce53fc 100755 --- a/tests/p_dovecot/dovecot_pop3_login.sh +++ b/tests/p_dovecot/dovecot_pop3_login.sh @@ -7,12 +7,20 @@ t_Log "Running $0 - adding pop3test local user account + attempting POP3 login" { userdel -rf pop3test; useradd pop3test && echo pop3test | passwd --stdin pop3test; } &>/dev/null # creating maildir in HOME, else test will fail at first try -mkdir -m 700 -p /home/pop3test/mail/.imap/INBOX +mkdir -m 700 -p /home/pop3test/mail/.imap/INBOX chown -R pop3test:pop3test /home/pop3test/mail/.imap/INBOX t_Log "Dovecot POP3 login test" +# EL7 comes with nmap-nc , different from nc so different options to use -echo -e "user pop3test\npass pop3test\n" | nc -w 5 localhost 110 | grep -q "+OK Logged in." +if [ "$centos_ver" -ge 7 ];then + nc_options="-d 3 -w 5" +else + nc_options="-i 3 -w 5" +fi + + +echo -e "user pop3test\npass pop3test\n" | nc ${nc_options} localhost 110 | grep -q "+OK Logged in." t_CheckExitStatus $?